diff --git a/.envrc b/.envrc new file mode 100644 index 000000000..3550a30f2 --- /dev/null +++ b/.envrc @@ -0,0 +1 @@ +use flake diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml deleted file mode 100644 index d88257ed0..000000000 --- a/.github/workflows/ci.yml +++ /dev/null @@ -1,310 +0,0 @@ -name: "CI" - -on: - push: - branches: [ "master" ] - pull_request: - branches: [ "master" ] - paths: - - .github/workflows/**/*.yml - - app/**/* - - bundle/**/* - - ci/**/* - - license-generator/**/* - - src/**/* - - test/**/* - - .gitignore - - .hlint.yaml - - .hspec - - cabal.project - - purescript.cabal - - Setup.hs - - stack.yaml - - update-changelog.hs - - weeder.dhall - release: - types: [ "published" ] - -defaults: - run: - shell: "bash" - -env: - CI_PRERELEASE: "${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}" - CI_RELEASE: "${{ github.event_name == 'release' }}" - STACK_VERSION: "2.9.3" - -concurrency: - # We never want two prereleases building at the same time, since they would - # likely both claim the same version number. Pull request builds can happen - # in parallel with anything else, since they don't mutate global state with a - # release. Release builds don't change their behavior based on published - # state, so they don't interfere with each other and there's no point in - # canceling a prerelease build if a release build starts; and we would never - # want a release build to be canceled by a prerelease build either. (GitHub - # Actions is either too cheap to give us `if` expressions or too lazy to - # document them, but we have untyped boolean operators to fall back on.) - group: "${{ github.event_name != 'push' && github.run_id || 'continuous-deployment' }}" - cancel-in-progress: true - -jobs: - build: - strategy: - fail-fast: false # do not cancel builds for other OSes if one fails - matrix: - include: - - # If upgrading the Haskell image, also upgrade it in the lint job below - os: ["ubuntu-latest"] - image: haskell:9.2.5@sha256:2597b0e2458165a6635906204f7fac43c22e7d2a46aca1235a811194bb6cd419 - - os: ["macOS-11"] - - os: ["windows-2019"] - - os: ["self-hosted", "macos", "ARM64"] - - os: ["self-hosted", "Linux", "ARM64"] - - runs-on: "${{ matrix.os }}" - container: "${{ matrix.image }}" - - outputs: - do-not-prerelease: "${{ steps.build.outputs.do-not-prerelease }}" - version: "${{ steps.build.outputs.version }}" - - steps: - - # We need a proper Git repository, but the checkout step will unpack a tarball instead of doing a clone - # if the Git version is less than 2.18. - name: "(Linux only) Install a newer version of Git" - if: "contains(matrix.os, 'ubuntu-latest')" - run: | - . /etc/os-release - echo deb http://deb.debian.org/debian "$VERSION_CODENAME"-backports main >> /etc/apt/sources.list - apt-get update && apt-get install -y git/"$VERSION_CODENAME"-backports - - - # We need `gh` installed on the Linux version. Otherwise, release artifacts won't be uploaded. - name: "(Linux only) Install gh" - if: "contains(matrix.os, 'ubuntu-latest')" - run: | - curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg - chmod go+r /usr/share/keyrings/githubcli-archive-keyring.gpg - echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | tee /etc/apt/sources.list.d/github-cli.list > /dev/null - apt-get update - apt-get install gh - - - uses: "actions/checkout@v2" - - uses: "actions/setup-node@v2" - with: - node-version: "16" - - - id: "haskell" - name: "(Non-Linux only) Install Haskell" - # Note: here we exclude the self-hosted runners because this action does not work on ARM - # and their Haskell environment is instead provided by a nix-shell - # See https://github.com/purescript/purescript/pulls/4455 - if: "!contains(matrix.os, 'ubuntu-latest') && !contains(matrix.os, 'self-hosted')" - uses: "haskell/actions/setup@v1" - with: - enable-stack: true - stack-version: "${{ env.STACK_VERSION }}" - stack-no-global: true - - - name: "(Linux only) Check Stack version and fix working directory ownership" - if: "contains(matrix.os, 'ubuntu-latest')" - run: | - [ "$(stack --numeric-version)" = "$STACK_VERSION" ] - chown root:root . - - - uses: "actions/cache@v2" - with: - path: | - /root/.stack - ${{ steps.haskell.outputs.stack-root }} - key: "${{ matrix.image || runner.os }}--MdyPsf-${{ hashFiles('stack.yaml') }}" - - - name: "(Windows only) Configure Stack to store its programs in STACK_ROOT" - # This ensures that the local GHC and MSYS binaries that Stack installs - # are included in the cache. (This behavior is the default on - # non-Windows OSes.) - if: "${{ runner.os == 'Windows' }}" - run: | - mkdir -p "$STACK_ROOT" - echo "local-programs-path: $STACK_ROOT/programs" > $STACK_ROOT/config.yaml - - - id: "build" - run: "ci/fix-home ci/build.sh" - - - name: "(Linux only) Build the entire package set" - if: "contains(matrix.os, 'ubuntu-latest')" - # We build in this directory in build.sh, so this is where we need to - # launch `stack exec`. The actual package-set building happens in a - # temporary directory. - working-directory: "sdist-test" - # The presence or absence of the --haddock flag changes the location - # into which stack places all build artifacts. Since we use --haddock - # in our CI builds, in order to actually get stack to find the purs - # binary it created, we need to use the flag here as well. - # - # Moreover, npm has a hook issue that will cause spago to fail to install - # We upgrade npm to fix this - run: | - npm i -g npm@8.8.0 - ../ci/fix-home stack --haddock exec ../ci/build-package-set.sh - - - name: Verify that 'libtinfo' isn't in binary - if: "runner.os == 'Linux'" - working-directory: "sdist-test" - run: | - if [ $(ldd $(../ci/fix-home stack path --local-doc-root)/../bin/purs | grep 'libtinfo' | wc -l) -ge 1 ]; then - echo "libtinfo detected" - ldd $(../ci/fix-home stack path --local-doc-root)/../bin/purs | grep 'libtinfo' - exit 1 - fi - - - name: "(Self-hosted Linux ARM64 only) Patch the binary to work on non-Nix systems" - if: "runner.os == 'Linux' && runner.arch == 'ARM64'" - working-directory: "sdist-test" - # The self-hosted build happens inside a nix-shell that provides a working stack binary - # on ARM systems, and while the macOS binary is fine - because macOS binaries are almost - # statically linked), the linux ones are all pointing at the nix store. - # So here we first point the binary to the right linker that should work on a generic linux, - # and then fix the RUNPATH with the right location to load the shared libraries from - run: | - patchelf --set-interpreter /usr/lib/ld-linux-aarch64.so.1 --set-rpath /usr/lib/aarch64-linux-gnu $(stack path --local-doc-root)/../bin/purs - - - name: "(Release/prerelease only) Create bundle" - if: "${{ env.CI_RELEASE == 'true' || env.CI_PRERELEASE == 'true' && steps.build.outputs.do-not-prerelease != 'true' }}" - run: | - os_name="${{ runner.os }}" - os_arch="${{ runner.arch }}" - case "$os_name" in - Linux) - case "$os_arch" in - ARM64) - bundle_os=linux-arm64;; - *) - bundle_os=linux64;; - esac;; - macOS) - case "$os_arch" in - ARM64) - bundle_os=macos-arm64;; - *) - bundle_os=macos;; - esac;; - Windows) - bundle_os=win64;; - *) - echo "Unknown OS name: $os_name" - exit 1;; - esac - cd sdist-test - ../ci/fix-home bundle/build.sh "$bundle_os" - - - name: "(Prerelease only) Upload bundle" - if: "${{ env.CI_PRERELEASE == 'true' && steps.build.outputs.do-not-prerelease != 'true' }}" - uses: "actions/upload-artifact@v3" - with: - name: "${{ runner.os }}-${{ runner.arch }}-bundle" - path: | - sdist-test/bundle/*.sha - sdist-test/bundle/*.tar.gz - - - name: "(Release only) Publish bundle" - if: "${{ env.CI_RELEASE == 'true' }}" - # This requires the gh command line tool to be installed on our - # self-hosted runners - env: - GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" - run: "gh release upload --clobber ${{ github.ref_name }} sdist-test/bundle/*.{tar.gz,sha}" - - lint: - runs-on: "ubuntu-latest" - # At the moment, this is a different image from the image used for - # compilation, though the GHC versions match. This is because the - # compilation image uses an old version of glibc, which we want because it - # means our published binaries will work on the widest number of platforms. - # But the HLint binary downloaded by this job requires a newer glibc - # version. - container: haskell:9.2.5@sha256:2597b0e2458165a6635906204f7fac43c22e7d2a46aca1235a811194bb6cd419 - - steps: - - # We need a proper Git repository, but the checkout step will unpack a tarball instead of doing a clone - # if the Git version is less than 2.18. - name: "Install a newer version of Git" - run: | - . /etc/os-release - echo deb http://deb.debian.org/debian "$VERSION_CODENAME"-backports main >> /etc/apt/sources.list - apt-get update && apt-get install -y git/"$VERSION_CODENAME"-backports - - uses: "actions/checkout@v2" - - - name: "Fix working directory ownership" - run: | - chown root:root . - - - uses: "actions/cache@v2" - with: - path: | - /root/.stack - key: "lint-${{ hashFiles('stack.yaml') }}" - - - run: "ci/fix-home ci/run-hlint.sh --git" - env: - VERSION: "3.5" - - # Note: the weeder version will need to be updated when we next update our version - # of GHC. - # - # weeder-2.2.0 has somewhat strange version deps. It doesn't appear to - # support the exact versions of dhall and generic-lens in LTS-18. - # However, forcing it to use the versions of dhall and generic-lens in - # LTS-18 doesn't cause any problems when building, so the following - # commands build weeder while ignoring version constraints. - - name: Install weeder - run: | - # The `stack.yaml` file is copied to a separate file so that - # adding `allow-newer: true` doesn't affect any subsequant - # calls to `stack`. - cp stack.yaml stack-weeder.yaml - # `allow-newer: true` is needed so that weeder-2.2.0 can be - # installed with the dependencies present in LTS-18. - echo 'allow-newer: true' >> stack-weeder.yaml - ci/fix-home stack --no-terminal --jobs=2 build --copy-compiler-tool --stack-yaml ./stack-weeder.yaml weeder-2.4.0 - - - run: "ci/fix-home stack --no-terminal --jobs=2 build --fast --ghc-options -fwrite-ide-info" - - - run: "ci/fix-home stack exec weeder" - - # Now do it again, with the test suite included. We don't want a - # reference from our test suite to count in the above check; the fact - # that a function is tested is not evidence that it's needed. But we also - # don't want to leave weeds lying around in our test suite either. - - run: "ci/fix-home stack --no-terminal --jobs=2 build --fast --test --no-run-tests --ghc-options -fwrite-ide-info" - - - run: "ci/fix-home stack exec weeder" - - make-prerelease: - runs-on: "ubuntu-latest" - needs: - - "build" - - "lint" - if: "${{ github.event_name == 'push' && needs.build.outputs.do-not-prerelease != 'true' }}" - steps: - - uses: "actions/download-artifact@v3" - - uses: "ncipollo/release-action@v1.10.0" - with: - tag: "v${{ needs.build.outputs.version }}" - artifacts: "*-bundle/*" - prerelease: true - body: "This is an automated preview release. Get the latest stable release [here](https://github.com/purescript/purescript/releases/latest)." - - uses: "actions/checkout@v3" - - uses: "actions/setup-node@v3" - with: - node-version: "16.x" - registry-url: "https://registry.npmjs.org" - - name: "Publish npm package" - working-directory: "npm-package" - env: - BUILD_VERSION: "${{ needs.build.outputs.version }}" - NODE_AUTH_TOKEN: "${{ secrets.NPM_TOKEN }}" - run: | - src_version=$(node -pe 'require("./package.json").version') - npm version --allow-same-version "$BUILD_VERSION" - sed -i -e "s/--purs-ver=${src_version//./\\.}/--purs-ver=$BUILD_VERSION/" package.json - npm publish --tag next diff --git a/.gitignore b/.gitignore index 0454beffc..8abf505bc 100644 --- a/.gitignore +++ b/.gitignore @@ -19,7 +19,7 @@ bower_components/ node_modules tmp/ .stack-work/ -output +# output tests/purs/docs/docs/ core-tests/full-core-docs.md tests/support/package-lock.json @@ -27,6 +27,7 @@ tests/support/package-lock.json .psc-package/ tags TAGS +.nvimrc # Gather source map files from golden tests .source-maps @@ -38,3 +39,8 @@ TAGS *.ps *.svg tests/purs/make/ +.direnv/ +/.pre-commit-config.yaml +/result* + +tests/purus/passing/**/cache-db.json diff --git a/Architecture.md b/Architecture.md new file mode 100644 index 000000000..2b804ec05 --- /dev/null +++ b/Architecture.md @@ -0,0 +1,100 @@ +# Architecture + +This document contains an overview of the *current* architecture of our compiler pipeline. It is not meant to be exhaustive and is intended to serve as a guide for onboarding new developers / make the giant PRs more accessible. + + +## Step 1: Type Deduction/Synthesis (Language.PureScript.CoreFn.Desugar) + +During the research phase of this project, we determined that PIR (Plutus Intermediate Representation) should be our ultimate compilation target (with final compilation to UPLC handled by the PIR compiler). Because PIR is an explicitly typed language, and because the vanilla `CoreFn` AST is not explicitly typed, it is necessary to convert the `Language.PureScript.AST` AST into a typed variant. + +Because conversion to `CoreFn` occurs after the initial (vanilla PS) typechecker pass, we receive *most* expressions (but not all of them) annotated with the inferred or explicitly declared type. Desugared expressions or declarations involving type classes, however, are not ignored by the PS typechecker, but we require explicit annotations for explicit type class dictionaries and the functions that operate on them. + +This step consists of two main phases: + + - First, we traverse every *type* annotation in the vanilla PS `Module` that is the input to our conversion function and desugar constraint types to types that require explicit dictionary arguments. E.g. `Eq a => a -> (...)` becomes `Eq$Dict a -> a -> (...)`. + - Next, we deduce the types. Because top-level declarations are always explicitly typed, we proceed "top-down" from the top-level signature as far as we can, and switch to a "bottom-up" synthesis strategy in cases where the type cannot be determined by the top-level signature. + +Some notes: + + - We want to preserve quantifiers in this step. While some quantifiers can be eliminated during monomorphization, there is no guarantee that *all* of them will be eliminated (this is not a problem, because PIR supports universal quantification). This requires special machinery when performing type deduction on expressions that contain quantified polymorphic functions, since we must take care to ensure that the type variables "line up". + - We run our desugarer in the same monad stack as the PS TypeChecker, but this is largely a convenience (since it lets us use the PS machinery for binding local variables or type variables, etc). We should *never* perform type inference or make any calls to `unify`. + - The trickiest part of this is ensuring that type information for explicit type class dictionaries is introduced at the correct point. Again, type class dictionaries are not processed by the PS typechecker. + +## Step 2: Monomorphization & Inlining (Language.PureScript.CoreFn.Convert.Monomorphize) + +PureScript's implementation of Records employs Row Types. Moreover, PureScript supports *polymorphic* records, which are backed by *open rows* (e.g. `{a :: Foo | r}`). + +Records in PureScript (unlike in Haskell) are not just syntatic sugar for products - the order of fields in the record is *not* determined by the order of fields in the declaration or expression that introduces the record. *An* order can be established for any fully instantiated (i.e. closed - doesn't contain any type variables of kind `Row Type`) record types - we choose a lexicographic ordering to mirror PureScript's `RowToList` sorting but this is not essenital. + +We must, therefore, perform monomorphization on record types in order to transform Object Literals to literal products, transform record accessors into `case` analysis of the product that corresponds to the original record, and transform record updates into product updates. + +Because a single polymorphic record type may be instantiated to different concrete types at different places in the AST, we must also inline while we monomorphize. + +The general monomorphization procedure is as follows (not a full algorithm): + + 1. We traverse the AST until we reach an `App` node. + 2. We "peel" the App node and get an `(f,args)` where `f` is the "terminal" function expression and `args` is a list of the argument expressions to which it is applied. + 3. We check whether the type of `f` is already monomorphic. If it is, we make no change to the node. + 4. If `f` is not monomorphic, we strip the quantifiers and check whether we can specialize any bound type variables to a concrete type. E.g. if `f :: forall x. Tuple x x -> x -> Int` and the arguments are `[Tuple String String, String]`, we instantiate `x` to `String`. + 5. We recurse down the list of arguments. If we encounter an argument that is a free (term-level) variable that is *not* a Plutus builtin, we inline it, monomorphizing it to the concrete type of the argument if possible. + 6. We apply the (possibly monomorphized & inlined) argument to the function and procede to the next argument + until we run out of arguments to process. + 7. Finally, we re-quantify the type of `f` in the resulting expression. (It may contain free type variables of kind `Type`, which can be represented in PIR) + +The procedure for inlining is: + 1. We check whether the (term level) variable we aim to inline is locally scoped (i.e. qualified by source position) or globally scoped (e.g. qualified by module name). For now, we only attempt to inline globally scoped variables (...I forget why...) + 2. If the variable is globally scoped (i.e. is the name of a module-level declaration), we lookup the body of the declaration. There are two possibilities here: Either the declaration will be a single non-recursive binding, or it will be a member of a mutually recursive binding group. (PS compiler sorts these for us) + - If the declaration is non-recursive we "walk" its expression-body and monomorphize/inline the sub-expressions as necessary in order to properly assign the expression the type that it is to be monomorphized to. + - If the declaration the member of a recursive binding group, we pause inlining, walk the expression, and "collect" a `Map Name (Name,SourceType,Expr)` where the key is the original name of the expression, and the values are, respectively: The new "fresh" name to give to the monomorphized expression, the monomorphic type that we must assign the expression to, and the body of the declaration. We do this recursively until we have collected every member of the recursive binding group used in the target expression. Finally, we use that map to construct a *monomorphic* mutually recursive binding group (where the names are all fresh) and create a `Let`-binding for the monomorphized mutually recursive group. + +The implementation of the monomorphizer/inliner consists in a few key functions that call each other recursively. To make reviewing easier, here's a brief explanation of what the key functions do (or are supposed to do at any rate): + + - `monomorphizeA` is the entry point that checks whether the node is an `App`, peels the arguments and function parts from the `App`, and calls `handleFunction` on the function expression and its arguments. + - `handleFunction` branches depending on the function expression it is passed: + - If it is passed a `Var` qualified by modulename, and the modulename is `Builtin`, it just returns the variable (since Builtins cannot be meaningfully inlined). + - If it is passed an `Abs`, `handleFunction` tries to instantiate the type variables of the function type with corresponding concrete types of the arguments. If it succeeds, it subsitutes the concrete type in for the bound type variable in all sub-expressions and their types, then calls itself recursively on the body of the `Abs` until the type has been fully monomorphized. + - If it is passed a `Var` that is not a builtin, `handleFunction` attempts to inline the expression the `Var` refers to by calling `inlineAs` with the monomorphized type. If this succeeds, `handleFunction` calls itself recursively with the monomorphized/inlined expression. + - If it is passed anything else as the `f`, it checks whether the function type is monomorphic. + - If the `f` is monomorphic, it applies it to its arguments and returns the resulting expresion. + - If the `f` is not monomorphic, `handleFunction` throws an error. + - `inlineAs` performs inlining and implements the above algorithm. Note that `inlineAs` is passed a PS `Type` argument, which represents the type that the expression corresponding to the `Name` being inlined *should* have after inlining. + - `monomorphizeWithType` rewrites the type of an expression to match the supplied type and (much more importantly) rewrites the types of all sub-expressions to conform with the supplied type of the top-level expression. + +## Step 3: Object desugaring and final IR (Language.PureScript.CoreFn.[IR / DesugarObjects]) + +By the end of step 2, all polymorphic records have been monommorphized that can be monomorphized, but record-specific expression nodes (object updates/accessors/literals) still remain in the AST. In order to ensure that all "invalid" expressions and types have been desugared/eliminated prior to final PIR conversion, we define a restricted AST and `Type` type such that only expressions which can be converted into PIR can be represented - a kind of "parse-don't-validate" approach. (This AST is implemented with the `Bound` library.) + +At this stage, we construct a set of dictionaries for type and data constructors. When constructing these maps, we add an arbitrary number of constructors for anonymous products (i.e. tuples) to accommodate objects. Specifically, we add constructors for tuples of up to 100 (they look like `data $GEN.~Tuple1 a = $GEN.~Tuple1 a` etc). These dictionaries serve two purposes: + - We construct them in such a way that the SOP representation of the underlying data type is very explicit. I.e. for each *type* constructor, we construct an `[(Int,[Type])]` where the `Int` represents the corresponding data constructor's index in the data type, where this information (the constructor's index & arguments) is also available in the dictionary for each *data* constructor. (Due to the implementation of the PS AST, we need both of these dictionaries, even though in principle only the tycon dictionary is necessary) + - Embedding generated tuple types into these dictionaries allows us to treat desugared records as "normal" data types in the final compilation stage (i.e. they don't require any special handling). + +Conversion into this restricted IR AST is, aside from object expressions, very straightforward. Therefore, in the rest of this section I will explain the object desugaring process. + +### Object Literals + + 1. We extract a `Map PSString SourceType` from the object literal expression by inspecting the expressions in each field. + 2. We sort the fields lexicographically (which establishes the uniform order of the product that will be constructed). + 3. We generate "fake" names for the product's type and constructor. E.g. `$GEN.~Tuple2 a b`. + 4. We construct a specialized function type for the product's data constructor using the sorted arguments. + 5. We assemble the literal with the "fake" constructor function and the arguments. + +### Record Accessors + 1. We perform steps 1-4 of Object Literals conversion on the expression the accessor is being applied to, except we construct a Constructor `Binder` (a pattern), where the arguments are wildcard binders for every argument except the one that corresponds to the field being accessed. + 2. We use that pattern to construct a case expression that extracts the value corresponding to the field. + - This is kind of hard to explain without an example. Suppose we have `foo = {a: 1, b :: "yup"}` in `foo.b` + - That gets turned into (something like) `case foo of {$GEN.Tuple2 _ $HERE -> $HERE} ` + +### Record Updates + 1. Proceeds much like the accessor case, except we return a product in our case expression instead of returning a field. + - Using the above definition of `foo`, if we have `foo {b = "hello"}`, this turns into: + - `case foo of {$GEN.Tuple2 a _ -> $GEN.Tuple2 a "hello"}` + +## Step 4: Final Conversion to PIR (Language.PureScript.CoreFn.Convert.ToPIR) + +The final step of compilation is conceptually simple: We match on the constructors of our final IR and translate expressions (and the types they contain) into PIR `Term`s and `Type`s, using some machinery to generate fresh names when we need to construct a lambda (which should only happen when desugaring case expressions). + +NOTE: The *implementation* of case expressions is incredibly complex. At the moment we support matching on simple constructor patterns. Going forward, we ought to weak the final IR so that case expressions are presented in a form that makes it simpler to handle. + + + + diff --git a/cabal.project b/cabal.project index 51c7ecb87..94c16d7b6 100644 --- a/cabal.project +++ b/cabal.project @@ -1,2 +1,23 @@ +repository cardano-haskell-packages + url: https://input-output-hk.github.io/cardano-haskell-packages + secure: True + root-keys: + 3e0cce471cf09815f930210f7827266fd09045445d65923e6d0238a6cd15126f + 443abb7fb497a134c343faf52f0b659bd7999bc06b7f63fa76dc99d631f9bea1 + a86a1f6ce86c449c46666bda44268677abf29b5b2d2eb5ec7af903ec2f117a82 + bcec67e8e99cabfa7764d75ad9b158d72bfacf70ca1d0ec8bc6b4406d1bf8413 + c00aae8461a256275598500ea0e187588c35a5d5d7454fb57eac18d9edb86a56 + d4a35cd3121aa00d18544bb0ac01c3e1691d618f462c46129271bccf39f7e8ee + + packages: purescript.cabal + +-- HACK: plutus core cannot build without it, remove after bump. +constraints: + nothunks < 0.2 + +test-show-details: direct + +index-state: + , cardano-haskell-packages 2024-06-27T10:04:00Z diff --git a/casepattern.md b/casepattern.md new file mode 100644 index 000000000..1ffc5bc64 --- /dev/null +++ b/casepattern.md @@ -0,0 +1,111 @@ +Case Desugaring: Temporary Patterns + +data ADT + = C0 + | C1 Int + | C2 ADT Bool + +-- f :: Bool -> Int + +example :: ADT -> Int +example = \case +i. C0 -> 0 +ii. three@(C1 x) -> x +iii. C1 2 -> 2 +iv. C2 C0 True -> 0 +v. C2 (C1 x) _ -> f x +vi. C2 x y -> example x + f y + + +1) Calculate the temporary SOP type for matching. Each case branch is a "constructor" and each bound variable is an argument to the product. Call this `mkTmpSop` + +mkTmpSOP example =[ +i. [], +ii. [ADT,Int], +iii. [], +iv. [], +v. [Int], +vi. [ADT,Int] +] + +2) Calculate the variables bound in the patterns of each branch, and their types: + +example Bindings = [ +i. [], +ii. [three :: ADT, x :: Int], +iii. [], +iv. [x :: Int] +v. [x :: ADT, y :: Bool] +] + +3) Write a function that checks whether a scrutinee matches a pattern. Call this `matches` + - we need this when we have nested patterns, like in ii. We need to know whether the inner pattern (`C1 x`) matches before binding any variables + +'#' is a PIR-level application operator + +Procedure: + - VarP/WildP always match, so for these patterns the function is: \_ -> True + - AsP matches if the inner pattern matches + - LitPs match if the literals in the pattern are equal to the expression, so for iii the function is: \(x :: Int) -> x == 2 + - Constructor patterns match if: + 1. The scrutinee variant is the same variant as the constructor in the pattern (i.e. the constructor indices match) + 2. All of the arguments to the constructor expression match their respective arguments (if there aren't any arguments, i.e. if the ctor is unary, 1. is the only test) + So in PIR-ish notation, we get: + i. C0 ==> \scrut -> + case scrut [ True -- C0 case + , False + , False + ] + ii. C1 x ==> \scrut -> + case scrut [ False, + , \_ -> True -- C1 has 1 arg and it's a VarP so it matches any Int + , \_ _ -> False -- C2 has 2 args but they don't matter here + ] + iii. C1 2 ==> \scrut -> + case scrut [ False + , \scrut0 -> scrut0 == 2 + , \_ _ -> False + ] + iv. C2 C0 True ==> \scrut -> + case scrut [ False + , \_ -> False + , \scrut0 scrut1 -> (matches C0 # scrut0) && (matches True # scrut1) + ] + ...etc + +4) Write a function that maps the scrutinee to the Tmp Pattern ADT for each alt branch. call this `toPatSOP` + +Preliminary: For a list of alternatives (alt:alts), we often need `toPatsSOP alts` to construct the `alt` case. Call this function `fallThrough` + +Procedure: + + - VarP always binds a var succeeds. So if we have a TOP LEVEL VarP pattern `x` for an alternative at index `n` toPatSOP `x` = \scrut -> Constr n [scrut] + - If we have a nested VarP (i.e. inside of a constructor pattern), we don't map to a Constr (see below) + - WildP doesn't bind any vars and maps to an empty list of fields at the current alternative index: _ ==> \_ -> Constr n [] + - Literal patterns don't bind any variables and are just used to construct the `matches` functions. + - E.g. a top level `1` pattern ==> \scrut -> if (matches `1` # scrut) (Constr n []) else (fallThrough # scrut) + - Constructor patterns map the variables bound in their argument patterns to a Constructor in the temporary ADT. Example: + iv. C2 (C1 x) True ==> \scrut -> case scrut [ fallThrough # scrut + , \_ -> fallThrough # scrut + , \(arg0 :: ADT) (arg1 :: Bool) -> + if (matches (C1 x) # arg0) && (matches True # arg1) + then case arg0 [ error + , \xInt -> Constr n xInt + , error + ] + else (fallThrough # scrut) + ] + Another example w/ multiple bound vars: + ??. C2 (C2 x y) z ==> \scrut -> case scrut [ fallThrough # scrut + , \_ -> fallThrough # scrut + , \(arg0 :: ADT) (arg1 :: Bool) -> + if (matches (C1 x y) # arg0) && (matches y # arg1) + then let res0 = case arg0 [error + ,\xADT _ -> xInt + ,error] + res1 = case arg0 [error + ,\_ yADT-> xInt + ,error] + in Constr n [res0,res1] + else (fallThrough # scrut) + ] diff --git a/default.nix b/default.nix new file mode 100644 index 000000000..4ff7fc519 --- /dev/null +++ b/default.nix @@ -0,0 +1,31 @@ +{ + perSystem = { self', pkgs, config, ... }: + let + cardanoPackages = pkgs.fetchFromGitHub { + owner = "input-output-hk"; + repo = "cardano-haskell-packages"; + rev = "3df392af2a61d61bdac1afd9c3674f27d6aa8efc"; # branch: repo + hash = "sha256-vvm56KzA6jEkG3mvwh1LEdK4H4FKxeoOJNz90H8l8dQ="; + }; + + purus = config.libHaskell.mkPackage { + name = "purus"; + src = ./.; + + externalRepositories = { + "https://input-output-hk.github.io/cardano-haskell-packages" = cardanoPackages; + }; + }; + in + { + devShells.purus = purus.devShell; + + packages = { + purs = purus.packages."purescript:exe:purs"; + }; + + apps = { + purs.program = "${self'.packages.purs}/bin/purs"; + }; + }; +} diff --git a/flake.lock b/flake.lock new file mode 100644 index 000000000..34d0f876a --- /dev/null +++ b/flake.lock @@ -0,0 +1,813 @@ +{ + "nodes": { + "HTTP": { + "flake": false, + "locked": { + "lastModified": 1451647621, + "narHash": "sha256-oHIyw3x0iKBexEo49YeUDV1k74ZtyYKGR2gNJXXRxts=", + "owner": "phadej", + "repo": "HTTP", + "rev": "9bc0996d412fef1787449d841277ef663ad9a915", + "type": "github" + }, + "original": { + "owner": "phadej", + "repo": "HTTP", + "type": "github" + } + }, + "cabal-32": { + "flake": false, + "locked": { + "lastModified": 1603716527, + "narHash": "sha256-X0TFfdD4KZpwl0Zr6x+PLxUt/VyKQfX7ylXHdmZIL+w=", + "owner": "haskell", + "repo": "cabal", + "rev": "48bf10787e27364730dd37a42b603cee8d6af7ee", + "type": "github" + }, + "original": { + "owner": "haskell", + "ref": "3.2", + "repo": "cabal", + "type": "github" + } + }, + "cabal-34": { + "flake": false, + "locked": { + "lastModified": 1645834128, + "narHash": "sha256-wG3d+dOt14z8+ydz4SL7pwGfe7SiimxcD/LOuPCV6xM=", + "owner": "haskell", + "repo": "cabal", + "rev": "5ff598c67f53f7c4f48e31d722ba37172230c462", + "type": "github" + }, + "original": { + "owner": "haskell", + "ref": "3.4", + "repo": "cabal", + "type": "github" + } + }, + "cabal-36": { + "flake": false, + "locked": { + "lastModified": 1669081697, + "narHash": "sha256-I5or+V7LZvMxfbYgZATU4awzkicBwwok4mVoje+sGmU=", + "owner": "haskell", + "repo": "cabal", + "rev": "8fd619e33d34924a94e691c5fea2c42f0fc7f144", + "type": "github" + }, + "original": { + "owner": "haskell", + "ref": "3.6", + "repo": "cabal", + "type": "github" + } + }, + "cardano-shell": { + "flake": false, + "locked": { + "lastModified": 1608537748, + "narHash": "sha256-PulY1GfiMgKVnBci3ex4ptk2UNYMXqGjJOxcPy2KYT4=", + "owner": "input-output-hk", + "repo": "cardano-shell", + "rev": "9392c75087cb9a3d453998f4230930dea3a95725", + "type": "github" + }, + "original": { + "owner": "input-output-hk", + "repo": "cardano-shell", + "type": "github" + } + }, + "flake-compat": { + "flake": false, + "locked": { + "lastModified": 1672831974, + "narHash": "sha256-z9k3MfslLjWQfnjBtEtJZdq3H7kyi2kQtUThfTgdRk0=", + "owner": "input-output-hk", + "repo": "flake-compat", + "rev": "45f2638735f8cdc40fe302742b79f248d23eb368", + "type": "github" + }, + "original": { + "owner": "input-output-hk", + "ref": "hkm/gitlab-fix", + "repo": "flake-compat", + "type": "github" + } + }, + "flake-compat_2": { + "flake": false, + "locked": { + "lastModified": 1696426674, + "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, + "flake-parts": { + "inputs": { + "nixpkgs-lib": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1706830856, + "narHash": "sha256-a0NYyp+h9hlb7ddVz4LUn1vT/PLwqfrWYcHMvFB1xYg=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "b253292d9c0a5ead9bc98c4e9a26c6312e27d69f", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1701680307, + "narHash": "sha256-kAuep2h5ajznlPMD9rnQyffWG8EM/C73lejGofXvdM8=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "4022d587cbbfd70fe950c1e2083a02621806a725", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "ghc-8.6.5-iohk": { + "flake": false, + "locked": { + "lastModified": 1600920045, + "narHash": "sha256-DO6kxJz248djebZLpSzTGD6s8WRpNI9BTwUeOf5RwY8=", + "owner": "input-output-hk", + "repo": "ghc", + "rev": "95713a6ecce4551240da7c96b6176f980af75cae", + "type": "github" + }, + "original": { + "owner": "input-output-hk", + "ref": "release/8.6.5-iohk", + "repo": "ghc", + "type": "github" + } + }, + "ghc98X": { + "flake": false, + "locked": { + "lastModified": 1696643148, + "narHash": "sha256-E02DfgISH7EvvNAu0BHiPvl1E5FGMDi0pWdNZtIBC9I=", + "ref": "ghc-9.8", + "rev": "443e870d977b1ab6fc05f47a9a17bc49296adbd6", + "revCount": 61642, + "submodules": true, + "type": "git", + "url": "https://gitlab.haskell.org/ghc/ghc" + }, + "original": { + "ref": "ghc-9.8", + "submodules": true, + "type": "git", + "url": "https://gitlab.haskell.org/ghc/ghc" + } + }, + "ghc99": { + "flake": false, + "locked": { + "lastModified": 1701580282, + "narHash": "sha256-drA01r3JrXnkKyzI+owMZGxX0JameMzjK0W5jJE/+V4=", + "ref": "refs/heads/master", + "rev": "f5eb0f2982e9cf27515e892c4bdf634bcfb28459", + "revCount": 62197, + "submodules": true, + "type": "git", + "url": "https://gitlab.haskell.org/ghc/ghc" + }, + "original": { + "submodules": true, + "type": "git", + "url": "https://gitlab.haskell.org/ghc/ghc" + } + }, + "gitignore": { + "inputs": { + "nixpkgs": [ + "pre-commit-hooks-nix", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1703887061, + "narHash": "sha256-gGPa9qWNc6eCXT/+Z5/zMkyYOuRZqeFZBDbopNZQkuY=", + "owner": "hercules-ci", + "repo": "gitignore.nix", + "rev": "43e1aa1308018f37118e34d3a9cb4f5e75dc11d5", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "gitignore.nix", + "type": "github" + } + }, + "hackage": { + "flake": false, + "locked": { + "lastModified": 1708215850, + "narHash": "sha256-jaxFHCObJ3uON5RNbeon795RmBG/SUFcFM77TAxx3hg=", + "owner": "input-output-hk", + "repo": "hackage.nix", + "rev": "f5c26f4307f80cdc8ba7b762e0738c09d40a4685", + "type": "github" + }, + "original": { + "owner": "input-output-hk", + "repo": "hackage.nix", + "type": "github" + } + }, + "haskell-nix": { + "inputs": { + "HTTP": "HTTP", + "cabal-32": "cabal-32", + "cabal-34": "cabal-34", + "cabal-36": "cabal-36", + "cardano-shell": "cardano-shell", + "flake-compat": "flake-compat", + "ghc-8.6.5-iohk": "ghc-8.6.5-iohk", + "ghc98X": "ghc98X", + "ghc99": "ghc99", + "hackage": "hackage", + "hls-1.10": "hls-1.10", + "hls-2.0": "hls-2.0", + "hls-2.2": "hls-2.2", + "hls-2.3": "hls-2.3", + "hls-2.4": "hls-2.4", + "hls-2.5": "hls-2.5", + "hls-2.6": "hls-2.6", + "hpc-coveralls": "hpc-coveralls", + "hydra": "hydra", + "iserv-proxy": "iserv-proxy", + "nix-tools-static": "nix-tools-static", + "nixpkgs": [ + "haskell-nix", + "nixpkgs-unstable" + ], + "nixpkgs-2003": "nixpkgs-2003", + "nixpkgs-2105": "nixpkgs-2105", + "nixpkgs-2111": "nixpkgs-2111", + "nixpkgs-2205": "nixpkgs-2205", + "nixpkgs-2211": "nixpkgs-2211", + "nixpkgs-2305": "nixpkgs-2305", + "nixpkgs-2311": "nixpkgs-2311", + "nixpkgs-unstable": "nixpkgs-unstable", + "old-ghc-nix": "old-ghc-nix", + "stackage": "stackage" + }, + "locked": { + "lastModified": 1708217408, + "narHash": "sha256-Ri9PXSAvg25bBvcJOCTsi6pRhaT8Wp37037KMfXYeOU=", + "owner": "input-output-hk", + "repo": "haskell.nix", + "rev": "2fb6466a23873e590ef96066ee18a75998830c7b", + "type": "github" + }, + "original": { + "owner": "input-output-hk", + "repo": "haskell.nix", + "type": "github" + } + }, + "hci-effects": { + "inputs": { + "flake-parts": [ + "flake-parts" + ], + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1704029560, + "narHash": "sha256-a4Iu7x1OP+uSYpqadOu8VCPY+MPF3+f6KIi+MAxlgyw=", + "owner": "hercules-ci", + "repo": "hercules-ci-effects", + "rev": "d5cbf433a6ae9cae05400189a8dbc6412a03ba16", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "hercules-ci-effects", + "type": "github" + } + }, + "hls-1.10": { + "flake": false, + "locked": { + "lastModified": 1680000865, + "narHash": "sha256-rc7iiUAcrHxwRM/s0ErEsSPxOR3u8t7DvFeWlMycWgo=", + "owner": "haskell", + "repo": "haskell-language-server", + "rev": "b08691db779f7a35ff322b71e72a12f6e3376fd9", + "type": "github" + }, + "original": { + "owner": "haskell", + "ref": "1.10.0.0", + "repo": "haskell-language-server", + "type": "github" + } + }, + "hls-2.0": { + "flake": false, + "locked": { + "lastModified": 1687698105, + "narHash": "sha256-OHXlgRzs/kuJH8q7Sxh507H+0Rb8b7VOiPAjcY9sM1k=", + "owner": "haskell", + "repo": "haskell-language-server", + "rev": "783905f211ac63edf982dd1889c671653327e441", + "type": "github" + }, + "original": { + "owner": "haskell", + "ref": "2.0.0.1", + "repo": "haskell-language-server", + "type": "github" + } + }, + "hls-2.2": { + "flake": false, + "locked": { + "lastModified": 1693064058, + "narHash": "sha256-8DGIyz5GjuCFmohY6Fa79hHA/p1iIqubfJUTGQElbNk=", + "owner": "haskell", + "repo": "haskell-language-server", + "rev": "b30f4b6cf5822f3112c35d14a0cba51f3fe23b85", + "type": "github" + }, + "original": { + "owner": "haskell", + "ref": "2.2.0.0", + "repo": "haskell-language-server", + "type": "github" + } + }, + "hls-2.3": { + "flake": false, + "locked": { + "lastModified": 1695910642, + "narHash": "sha256-tR58doOs3DncFehHwCLczJgntyG/zlsSd7DgDgMPOkI=", + "owner": "haskell", + "repo": "haskell-language-server", + "rev": "458ccdb55c9ea22cd5d13ec3051aaefb295321be", + "type": "github" + }, + "original": { + "owner": "haskell", + "ref": "2.3.0.0", + "repo": "haskell-language-server", + "type": "github" + } + }, + "hls-2.4": { + "flake": false, + "locked": { + "lastModified": 1699862708, + "narHash": "sha256-YHXSkdz53zd0fYGIYOgLt6HrA0eaRJi9mXVqDgmvrjk=", + "owner": "haskell", + "repo": "haskell-language-server", + "rev": "54507ef7e85fa8e9d0eb9a669832a3287ffccd57", + "type": "github" + }, + "original": { + "owner": "haskell", + "ref": "2.4.0.1", + "repo": "haskell-language-server", + "type": "github" + } + }, + "hls-2.5": { + "flake": false, + "locked": { + "lastModified": 1701080174, + "narHash": "sha256-fyiR9TaHGJIIR0UmcCb73Xv9TJq3ht2ioxQ2mT7kVdc=", + "owner": "haskell", + "repo": "haskell-language-server", + "rev": "27f8c3d3892e38edaef5bea3870161815c4d014c", + "type": "github" + }, + "original": { + "owner": "haskell", + "ref": "2.5.0.0", + "repo": "haskell-language-server", + "type": "github" + } + }, + "hls-2.6": { + "flake": false, + "locked": { + "lastModified": 1705325287, + "narHash": "sha256-+P87oLdlPyMw8Mgoul7HMWdEvWP/fNlo8jyNtwME8E8=", + "owner": "haskell", + "repo": "haskell-language-server", + "rev": "6e0b342fa0327e628610f2711f8c3e4eaaa08b1e", + "type": "github" + }, + "original": { + "owner": "haskell", + "ref": "2.6.0.0", + "repo": "haskell-language-server", + "type": "github" + } + }, + "hpc-coveralls": { + "flake": false, + "locked": { + "lastModified": 1607498076, + "narHash": "sha256-8uqsEtivphgZWYeUo5RDUhp6bO9j2vaaProQxHBltQk=", + "owner": "sevanspowell", + "repo": "hpc-coveralls", + "rev": "14df0f7d229f4cd2e79f8eabb1a740097fdfa430", + "type": "github" + }, + "original": { + "owner": "sevanspowell", + "repo": "hpc-coveralls", + "type": "github" + } + }, + "hydra": { + "inputs": { + "nix": "nix", + "nixpkgs": [ + "haskell-nix", + "hydra", + "nix", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1671755331, + "narHash": "sha256-hXsgJj0Cy0ZiCiYdW2OdBz5WmFyOMKuw4zyxKpgUKm4=", + "owner": "NixOS", + "repo": "hydra", + "rev": "f48f00ee6d5727ae3e488cbf9ce157460853fea8", + "type": "github" + }, + "original": { + "id": "hydra", + "type": "indirect" + } + }, + "iserv-proxy": { + "flake": false, + "locked": { + "lastModified": 1691634696, + "narHash": "sha256-MZH2NznKC/gbgBu8NgIibtSUZeJ00HTLJ0PlWKCBHb0=", + "ref": "hkm/remote-iserv", + "rev": "43a979272d9addc29fbffc2e8542c5d96e993d73", + "revCount": 14, + "type": "git", + "url": "https://gitlab.haskell.org/hamishmack/iserv-proxy.git" + }, + "original": { + "ref": "hkm/remote-iserv", + "type": "git", + "url": "https://gitlab.haskell.org/hamishmack/iserv-proxy.git" + } + }, + "lowdown-src": { + "flake": false, + "locked": { + "lastModified": 1633514407, + "narHash": "sha256-Dw32tiMjdK9t3ETl5fzGrutQTzh2rufgZV4A/BbxuD4=", + "owner": "kristapsdz", + "repo": "lowdown", + "rev": "d2c2b44ff6c27b936ec27358a2653caaef8f73b8", + "type": "github" + }, + "original": { + "owner": "kristapsdz", + "repo": "lowdown", + "type": "github" + } + }, + "nix": { + "inputs": { + "lowdown-src": "lowdown-src", + "nixpkgs": "nixpkgs", + "nixpkgs-regression": "nixpkgs-regression" + }, + "locked": { + "lastModified": 1661606874, + "narHash": "sha256-9+rpYzI+SmxJn+EbYxjGv68Ucp22bdFUSy/4LkHkkDQ=", + "owner": "NixOS", + "repo": "nix", + "rev": "11e45768b34fdafdcf019ddbd337afa16127ff0f", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "2.11.0", + "repo": "nix", + "type": "github" + } + }, + "nix-tools-static": { + "flake": false, + "locked": { + "lastModified": 1706266250, + "narHash": "sha256-9t+GRk3eO9muCtKdNAwBtNBZ5dH1xHcnS17WaQyftwA=", + "owner": "input-output-hk", + "repo": "haskell-nix-example", + "rev": "580cb6db546a7777dad3b9c0fa487a366c045c4e", + "type": "github" + }, + "original": { + "owner": "input-output-hk", + "ref": "nix", + "repo": "haskell-nix-example", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1657693803, + "narHash": "sha256-G++2CJ9u0E7NNTAi9n5G8TdDmGJXcIjkJ3NF8cetQB8=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "365e1b3a859281cf11b94f87231adeabbdd878a2", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-22.05-small", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-2003": { + "locked": { + "lastModified": 1620055814, + "narHash": "sha256-8LEHoYSJiL901bTMVatq+rf8y7QtWuZhwwpKE2fyaRY=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "1db42b7fe3878f3f5f7a4f2dc210772fd080e205", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-20.03-darwin", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-2105": { + "locked": { + "lastModified": 1659914493, + "narHash": "sha256-lkA5X3VNMKirvA+SUzvEhfA7XquWLci+CGi505YFAIs=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "022caabb5f2265ad4006c1fa5b1ebe69fb0c3faf", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-21.05-darwin", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-2111": { + "locked": { + "lastModified": 1659446231, + "narHash": "sha256-hekabNdTdgR/iLsgce5TGWmfIDZ86qjPhxDg/8TlzhE=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "eabc38219184cc3e04a974fe31857d8e0eac098d", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-21.11-darwin", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-2205": { + "locked": { + "lastModified": 1685573264, + "narHash": "sha256-Zffu01pONhs/pqH07cjlF10NnMDLok8ix5Uk4rhOnZQ=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "380be19fbd2d9079f677978361792cb25e8a3635", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-22.05-darwin", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-2211": { + "locked": { + "lastModified": 1688392541, + "narHash": "sha256-lHrKvEkCPTUO+7tPfjIcb7Trk6k31rz18vkyqmkeJfY=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "ea4c80b39be4c09702b0cb3b42eab59e2ba4f24b", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-22.11-darwin", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-2305": { + "locked": { + "lastModified": 1701362232, + "narHash": "sha256-GVdzxL0lhEadqs3hfRLuj+L1OJFGiL/L7gCcelgBlsw=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "d2332963662edffacfddfad59ff4f709dde80ffe", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-23.05-darwin", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-2311": { + "locked": { + "lastModified": 1701386440, + "narHash": "sha256-xI0uQ9E7JbmEy/v8kR9ZQan6389rHug+zOtZeZFiDJk=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "293822e55ec1872f715a66d0eda9e592dc14419f", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-23.11-darwin", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-regression": { + "locked": { + "lastModified": 1643052045, + "narHash": "sha256-uGJ0VXIhWKGXxkeNnq4TvV3CIOkUJ3PAoLZ3HMzNVMw=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "215d4d0fd80ca5163643b03a33fde804a29cc1e2", + "type": "github" + }, + "original": { + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "215d4d0fd80ca5163643b03a33fde804a29cc1e2", + "type": "github" + } + }, + "nixpkgs-unstable": { + "locked": { + "lastModified": 1694822471, + "narHash": "sha256-6fSDCj++lZVMZlyqOe9SIOL8tYSBz1bI8acwovRwoX8=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "47585496bcb13fb72e4a90daeea2f434e2501998", + "type": "github" + }, + "original": { + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "47585496bcb13fb72e4a90daeea2f434e2501998", + "type": "github" + } + }, + "nixpkgs_2": { + "locked": { + "lastModified": 1708276637, + "narHash": "sha256-+gICdImzDvxULC/+iqsmLsvwEv5LQuFglxn2fk/VyQM=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "ec841889d30aabad381acfa9529fe6045268bdbd", + "type": "github" + }, + "original": { + "owner": "NixOS", + "repo": "nixpkgs", + "type": "github" + } + }, + "old-ghc-nix": { + "flake": false, + "locked": { + "lastModified": 1631092763, + "narHash": "sha256-sIKgO+z7tj4lw3u6oBZxqIhDrzSkvpHtv0Kki+lh9Fg=", + "owner": "angerman", + "repo": "old-ghc-nix", + "rev": "af48a7a7353e418119b6dfe3cd1463a657f342b8", + "type": "github" + }, + "original": { + "owner": "angerman", + "ref": "master", + "repo": "old-ghc-nix", + "type": "github" + } + }, + "pre-commit-hooks-nix": { + "inputs": { + "flake-compat": "flake-compat_2", + "flake-utils": "flake-utils", + "gitignore": "gitignore", + "nixpkgs": [ + "nixpkgs" + ], + "nixpkgs-stable": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1708018599, + "narHash": "sha256-M+Ng6+SePmA8g06CmUZWi1AjG2tFBX9WCXElBHEKnyM=", + "owner": "cachix", + "repo": "pre-commit-hooks.nix", + "rev": "5df5a70ad7575f6601d91f0efec95dd9bc619431", + "type": "github" + }, + "original": { + "owner": "cachix", + "repo": "pre-commit-hooks.nix", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-parts": "flake-parts", + "haskell-nix": "haskell-nix", + "hci-effects": "hci-effects", + "nixpkgs": "nixpkgs_2", + "pre-commit-hooks-nix": "pre-commit-hooks-nix" + } + }, + "stackage": { + "flake": false, + "locked": { + "lastModified": 1708214991, + "narHash": "sha256-PCVnVqnBctf/qkpTBnBxwDHvfZaxXeq0bO98LxoKfhY=", + "owner": "input-output-hk", + "repo": "stackage.nix", + "rev": "0a279134ea4ae6269b93f76638c4ed9ccd9a496a", + "type": "github" + }, + "original": { + "owner": "input-output-hk", + "repo": "stackage.nix", + "type": "github" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 000000000..555cfe2e7 --- /dev/null +++ b/flake.nix @@ -0,0 +1,86 @@ +{ + description = "uplc-benchmark"; + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs"; + flake-parts = { + url = "github:hercules-ci/flake-parts"; + inputs.nixpkgs-lib.follows = "nixpkgs"; + }; + pre-commit-hooks-nix = { + url = "github:cachix/pre-commit-hooks.nix"; + inputs.nixpkgs.follows = "nixpkgs"; + inputs.nixpkgs-stable.follows = "nixpkgs"; + }; + hci-effects = { + url = "github:hercules-ci/hercules-ci-effects"; + inputs.nixpkgs.follows = "nixpkgs"; + inputs.flake-parts.follows = "flake-parts"; + }; + haskell-nix = { + url = "github:input-output-hk/haskell.nix"; + }; + }; + outputs = inputs: + let + flakeModules = { + haskell = ./nix/haskell; + utils = ./nix/utils; + }; + in + inputs.flake-parts.lib.mkFlake { inherit inputs; } ({ self, ... }: { + imports = [ + inputs.pre-commit-hooks-nix.flakeModule + inputs.hci-effects.flakeModule + ./. + ] ++ (builtins.attrValues flakeModules); + + # `nix flake show --impure` hack + systems = + if builtins.hasAttr "currentSystem" builtins + then [ builtins.currentSystem ] + else inputs.nixpkgs.lib.systems.flakeExposed; + + herculesCI.ciSystems = [ "x86_64-linux" ]; + + flake.flakeModules = flakeModules; + + perSystem = + { config + , pkgs + , lib + , system + , self' + , ... + }: { + _module.args.pkgs = import self.inputs.nixpkgs { + inherit system; + config.allowBroken = true; + }; + + pre-commit.settings = { + hooks = { + deadnix.enable = true; + # TODO: Enable in separate PR, causes mass changes. + # fourmolu.enable = true; + nixpkgs-fmt.enable = true; + }; + + tools = { + fourmolu = lib.mkForce (pkgs.callPackage ./nix/fourmolu { + mkHaskellPackage = config.libHaskell.mkPackage; + }); + }; + }; + + devShells = { + default = pkgs.mkShell { + shellHook = config.pre-commit.installationScript; + + inputsFrom = [ + self'.devShells.purus + ]; + }; + }; + }; + }); +} diff --git a/fourmolu.yaml b/fourmolu.yaml new file mode 100644 index 000000000..ed2de01bd --- /dev/null +++ b/fourmolu.yaml @@ -0,0 +1,8 @@ +indentation: 2 +comma-style: leading +record-brace-space: true +indent-wheres: true +diff-friendly-import-export: true +respectful: true +haddock-style: multi-line +newlines-between-decls: 1 diff --git a/hie.yaml b/hie.yaml new file mode 100644 index 000000000..397604162 --- /dev/null +++ b/hie.yaml @@ -0,0 +1,43 @@ +cradle: + cabal: + - path: "src" + component: "lib:purescript" + + - path: "app/Main.hs" + component: "purescript:exe:purs" + + - path: "app/Command/Bundle.hs" + component: "purescript:exe:purs" + + - path: "app/Command/Compile.hs" + component: "purescript:exe:purs" + + - path: "app/Command/Docs.hs" + component: "purescript:exe:purs" + + - path: "app/Command/Docs/Html.hs" + component: "purescript:exe:purs" + + - path: "app/Command/Docs/Markdown.hs" + component: "purescript:exe:purs" + + - path: "app/Command/Graph.hs" + component: "purescript:exe:purs" + + - path: "app/Command/Hierarchy.hs" + component: "purescript:exe:purs" + + - path: "app/Command/Ide.hs" + component: "purescript:exe:purs" + + - path: "app/Command/Publish.hs" + component: "purescript:exe:purs" + + - path: "app/Command/REPL.hs" + component: "purescript:exe:purs" + + - path: "app/Version.hs" + component: "purescript:exe:purs" + + - path: "tests" + component: "purescript:test:tests" diff --git a/nix/fourmolu/default.nix b/nix/fourmolu/default.nix new file mode 100644 index 000000000..954cbfaa0 --- /dev/null +++ b/nix/fourmolu/default.nix @@ -0,0 +1,13 @@ +{ mkHaskellPackage +, fetchFromGitHub +}: + +(mkHaskellPackage { + name = "fourmolu"; + src = fetchFromGitHub { + owner = "fourmolu"; + repo = "fourmolu"; + rev = "v0.13.1.0"; + hash = "sha256-abUK9KdvVI7di84X/L3vHZM97pOsciyx503aDjUnoc4="; + }; +}).packages."fourmolu:exe:fourmolu" diff --git a/nix/haskell/default.nix b/nix/haskell/default.nix new file mode 100644 index 000000000..fc5dd7400 --- /dev/null +++ b/nix/haskell/default.nix @@ -0,0 +1,36 @@ +{ self +, lib +, flake-parts-lib +, ... +}: +let + inherit (flake-parts-lib) mkPerSystemOption; + inherit (lib) types mkOption; +in +{ + options = { + perSystem = mkPerSystemOption ({ config, system, pkgs, ... }: { + options = { + libHaskell = mkOption { + type = types.anything; + default = { }; + }; + }; + + config = + let + mkHaskellPackage = pkgs.callPackage ./lib.nix { + inherit lib system; + haskellNixNixpkgs = self.inputs.haskell-nix.inputs.nixpkgs; + haskellNixOverlay = self.inputs.haskell-nix.overlay; + }; + + in + { + libHaskell = { + mkPackage = mkHaskellPackage; + }; + }; + }); + }; +} diff --git a/nix/haskell/lib.nix b/nix/haskell/lib.nix new file mode 100644 index 000000000..2dcbb208b --- /dev/null +++ b/nix/haskell/lib.nix @@ -0,0 +1,91 @@ +{ lib +, fetchFromGitHub + # e.g. "x86_64-linux" +, system # : string +, haskellNixNixpkgs # : nixpkgs +, haskellNixOverlay # : overlay +}: + +let + iohk-nix = fetchFromGitHub { + owner = "input-output-hk"; + repo = "iohk-nix"; + rev = "4848df60660e21fbb3fe157d996a8bac0a9cf2d6"; + hash = "sha256-ediFkDOBP7yVquw1XtHiYfuXKoEnvKGjTIAk9mC6qxo="; + }; + + pkgs = import haskellNixNixpkgs { + inherit system; + overlays = [ + (import "${iohk-nix}/overlays/crypto") + haskellNixOverlay + ]; + }; +in + +{ name # : string +, src # : path +, ghcVersion ? "ghc928" # : string +, haskellModules ? [ ] +, externalDependencies ? [ ] +, externalRepositories ? { } +}: +let + mkHackage = pkgs.callPackage ./mk-hackage.nix { + nix-tools = pkgs.haskell-nix.nix-tools-set { + compiler-nix-name = ghcVersion; + }; + }; + + # This looks like a noop but without it haskell.nix throws a runtime + # error about `pkgs` attribute not being present which is nonsense + # https://input-output-hk.github.io/haskell.nix/reference/library.html?highlight=cabalProject#modules + fixedHaskellModules = map (m: args @ { ... }: m args) haskellModules; + + flatExternalDependencies = + lib.lists.concatMap + (dep: [ (dep.passthru or { }).src or dep ] ++ + (flatExternalDependencies (dep.passthru or { }).externalDependencies or [ ])); + + flattenedExternalDependencies = flatExternalDependencies externalDependencies; + + customHackages = mkHackage { + srcs = map toString flattenedExternalDependencies; + inherit name; + }; + + project = pkgs.haskell-nix.cabalProject' { + inherit src; + name = name; + + compiler-nix-name = ghcVersion; + inputMap = lib.mapAttrs (_: toString) externalRepositories; + + modules = customHackages.modules ++ fixedHaskellModules; + inherit (customHackages) extra-hackages extra-hackage-tarballs; + + shell = { + withHoogle = true; + exactDeps = true; + + tools = { + cabal = { }; + haskell-language-server = { }; + }; + }; + }; + + projectFlake = project.flake { }; + + augmentedPackages = builtins.mapAttrs + (_: package: + package // { + passthru = (package.passthru or { }) // { + inherit src externalDependencies; + }; + }) + (projectFlake.packages or { }); +in +projectFlake // { + packages = augmentedPackages; +} diff --git a/nix/haskell/mk-hackage.nix b/nix/haskell/mk-hackage.nix new file mode 100644 index 000000000..fc89862f6 --- /dev/null +++ b/nix/haskell/mk-hackage.nix @@ -0,0 +1,134 @@ +# Adapted from https://github.com/mlabs-haskell/mlabs-tooling.nix/blob/cd0cf0d29f17980befe384248c16937589912c69/mk-hackage.nix + +{ gzip +, runCommand +, lib +, nix-tools +}: +let + mkPackageSpec = src: + with lib; + let + cabalFiles = concatLists (mapAttrsToList + (name: type: if type == "regular" && hasSuffix ".cabal" name then [ name ] else [ ]) + (builtins.readDir src)); + + cabalPath = + if length cabalFiles == 1 + then src + "/${builtins.head cabalFiles}" + else builtins.abort "Could not find unique file with .cabal suffix in source: ${src}"; + cabalFile = builtins.readFile cabalPath; + parse = field: + let + lines = filter (s: builtins.match "^${field} *:.*$" (toLower s) != null) (splitString "\n" cabalFile); + line = + if lines != [ ] + then head lines + else builtins.abort "Could not find line with prefix ''${field}:' in ${cabalPath}"; + in + replaceStrings [ " " ] [ "" ] (head (tail (splitString ":" line))); + pname = parse "name"; + version = parse "version"; + in + { inherit src pname version; }; + + mkHackageDir = { pname, version, src }: + runCommand "${pname}-${version}-hackage" + { } '' + set -e + mkdir -p $out/${pname}/${version} + md5=11111111111111111111111111111111 + sha256=1111111111111111111111111111111111111111111111111111111111111111 + length=1 + cat < $out/"${pname}"/"${version}"/package.json + { + "signatures" : [], + "signed" : { + "_type" : "Targets", + "expires" : null, + "targets" : { + "/package/${pname}-${version}.tar.gz" : { + "hashes" : { + "md5" : "$md5", + "sha256" : "$sha256" + }, + "length" : $length + } + }, + "version" : 0 + } + } + EOF + cp ${src}/*.cabal $out/"${pname}"/"${version}"/ + ''; + + mkHackageTarballFromDirs = name: hackageDirs: + runCommand "${name}-hackage-index.tar.gz" { } '' + mkdir hackage + ${builtins.concatStringsSep "" (map (dir: '' + echo ${dir} + ln -sf ${dir}/* hackage/ + '') hackageDirs)} + cd hackage + tar --sort=name --owner=root:0 --group=root:0 --mtime='UTC 2009-01-01' -hczvf $out */*/* + ''; + + mkHackageTarball = name: pkg-specs: + mkHackageTarballFromDirs name (map mkHackageDir pkg-specs); + + mkHackageNix = name: hackageTarball: + runCommand "${name}-hackage-nix" + { + nativeBuildInputs = [ + gzip + nix-tools + ]; + } '' + set -e + export LC_CTYPE=C.UTF-8 + export LC_ALL=C.UTF-8 + export LANG=C.UTF-8 + cp ${hackageTarball} 01-index.tar.gz + gunzip 01-index.tar.gz + hackage-to-nix $out 01-index.tar "https://mkHackageNix/" + ''; + + mkModule = extraHackagePackages: { + packages = lib.listToAttrs (map + (spec: { + name = spec.pname; + value = { + inherit (spec) src; + }; + }) + extraHackagePackages); + }; + + mkHackageFromSpec = name: extraHackagePackages: rec { + extra-hackage-tarball = mkHackageTarball name extraHackagePackages; + extra-hackage = mkHackageNix name extra-hackage-tarball; + module = mkModule extraHackagePackages; + }; + +in +{ srcs # : [string] +, name # : string +}: + +if builtins.length srcs == 0 +then { + modules = [ ]; + extra-hackage-tarballs = { }; + extra-hackages = [ ]; +} +else + let + hackage = mkHackageFromSpec name (map mkPackageSpec srcs); + in + { + modules = [ hackage.module ]; + extra-hackage-tarballs = { + "${name}-hackage-tarball" = hackage.extra-hackage-tarball; + }; + extra-hackages = [ (import hackage.extra-hackage) ]; + } diff --git a/nix/utils/default.nix b/nix/utils/default.nix new file mode 100644 index 000000000..851ab543a --- /dev/null +++ b/nix/utils/default.nix @@ -0,0 +1,22 @@ +{ lib +, flake-parts-lib +, ... +}: +let + inherit (flake-parts-lib) mkPerSystemOption; + inherit (lib) types mkOption; +in +{ + options = { + perSystem = mkPerSystemOption ({ config, pkgs, ... }: { + options = { + libUtils = mkOption { + type = types.anything; + default = { }; + }; + }; + + config.libUtils = pkgs.callPackage ./lib.nix { }; + }); + }; +} diff --git a/nix/utils/lib.nix b/nix/utils/lib.nix new file mode 100644 index 000000000..c5b2f51b4 --- /dev/null +++ b/nix/utils/lib.nix @@ -0,0 +1,39 @@ +{ stdenv +, lib +}: + +let + applyPatches = args @ { patches, ... }: stdenv.mkDerivation ({ + inherit patches; + + dontConfigure = true; + dontBuild = true; + + installPhase = '' + mkdir -p "$out" + cp -r * "$out" + ''; + + dontFixup = true; + } // args); + + mkFlag = flag: value: "--${flag}=${value}"; + + mkFlags = flag: values: builtins.concatStringsSep " " (map (mkFlag flag) values); + + mkCli = args: + builtins.concatStringsSep " " + (lib.attrsets.mapAttrsToList + (flag: value: + if builtins.isList value + then mkFlags flag value + else if builtins.isBool value then (if value then "--${flag}" else "") + else mkFlag flag "${value}" + ) + args); + + withNameAttr = f: name: args: f (args // { inherit name; }); +in +{ + inherit applyPatches mkCli withNameAttr; +} diff --git a/npm-package/.gitignore b/npm-package/.gitignore deleted file mode 100644 index 059fb4c54..000000000 --- a/npm-package/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -purs.bin -package-lock.json diff --git a/npm-package/LICENSE b/npm-package/LICENSE deleted file mode 100644 index d99869e6a..000000000 --- a/npm-package/LICENSE +++ /dev/null @@ -1,6 +0,0 @@ -ISC License (ISC) -Copyright 2017 - 2019 Watanabe Shinnosuke - -Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/npm-package/README.md b/npm-package/README.md deleted file mode 100644 index de5495598..000000000 --- a/npm-package/README.md +++ /dev/null @@ -1,62 +0,0 @@ -# PureScript npm package - -[![npm version](http://img.shields.io/npm/v/purescript.svg)](https://www.npmjs.com/package/purescript) -[![Build Status](https://travis-ci.org/purescript-contrib/node-purescript.svg?branch=master)](https://travis-ci.org/purescript-contrib/node-purescript) - -[PureScript](https://github.com/purescript/purescript) binary wrapper that makes it seamlessly available via [npm](https://www.npmjs.com/) - -## Prerequisites - -This package makes maximum use of `postinstall` [script](https://docs.npmjs.com/misc/scripts), so please make sure that [`ignore-scripts` npm-config](https://docs.npmjs.com/misc/config#ignore-scripts) is not enabled before installation. - -```console -$ npm config get ignore-scripts -false -``` - -## Installation - -[Use](https://docs.npmjs.com/cli/install) [npm](https://docs.npmjs.com/about-npm/). - -``` -npm install purescript -``` - -Once the command above is executed, - -__1.__ First, it checks if a PureScript binary has been already cached, and restores that if available. - -__2.__ The second plan: if no cache is available, it downloads a prebuilt binary from [the PureScript release page](https://github.com/purescript/purescript/releases). - -__3.__ The last resort: if no prebuilt binary is provided for your platform or the downloaded binary doesn't work correctly, it downloads [the PureScript source code](https://github.com/purescript/purescript/tree/master) and compile it with [Stack](https://docs.haskellstack.org/). - -## API - -### `require('purescript')` - -Type: `string` - -An absolute path to the installed PureScript binary, which can be used with [`child_process`](https://nodejs.org/api/child_process.html) functions. - -```javascript -const {execFile} = require('child_process'); -const purs = require('purescript'); //=> '/Users/you/example/node_modules/purescript/purs.bin' - -execFile(purs, ['compile', 'input.purs', '--output', 'output.purs'], () => { - console.log('Compiled.'); -}); -``` - -## CLI - -You can use it via CLI by installing it [globally](https://docs.npmjs.com/files/folders#global-installation). - -``` -npm install --global purescript - -purs --help -``` - -## License - -[ISC License](./LICENSE) © 2017 - 2019 Watanabe Shinnosuke diff --git a/npm-package/index.js b/npm-package/index.js deleted file mode 100644 index b4fec3cf5..000000000 --- a/npm-package/index.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require.resolve('./purs.bin'); diff --git a/npm-package/package.json b/npm-package/package.json deleted file mode 100644 index b24866695..000000000 --- a/npm-package/package.json +++ /dev/null @@ -1,49 +0,0 @@ -{ - "name": "purescript", - "version": "0.15.13", - "license": "ISC", - "description": "PureScript wrapper that makes it available as a local dependency", - "author": { - "name": "Watanabe Shinnosuke", - "url": "http://github.com/shinnn" - }, - "files": [ - "index.js", - "purs.bin" - ], - "bin": { - "purs": "purs.bin" - }, - "dependencies": { - "purescript-installer": "^0.3.5" - }, - "homepage": "https://github.com/purescript/purescript", - "repository": { - "type": "git", - "url": "git+https://github.com/purescript/purescript.git" - }, - "bugs": { - "url": "https://github.com/purescript/npm-installer/issues" - }, - "keywords": [ - "cli", - "build", - "install", - "installation", - "fallback", - "purs", - "purescript", - "haskell", - "language", - "compile", - "compiler", - "bin", - "binary", - "wrapper" - ], - "scripts": { - "prepublishOnly": "node -e \"require('fs').copyFileSync('purs.bin.placeholder', 'purs.bin');\"", - "postinstall": "install-purescript --purs-ver=0.15.13", - "test": "echo 'Error: no test specified' && exit 1" - } -} diff --git a/npm-package/purs.bin.placeholder b/npm-package/purs.bin.placeholder deleted file mode 100755 index ca25a635f..000000000 --- a/npm-package/purs.bin.placeholder +++ /dev/null @@ -1,7 +0,0 @@ -# This is a placeholder file of a PureScript binary installed with npm. If you -# see this file, that means the installation has failed and the placeholder has -# not been replaced with a valid binary. Try installing the `purescript` npm -# package again. - -echo >&2 "purescript npm installer: installation failed; please try installing again" -exit 1 diff --git a/purescript.cabal b/purescript.cabal index a608c61ca..aa422fbf6 100644 --- a/purescript.cabal +++ b/purescript.cabal @@ -1,4 +1,4 @@ -cabal-version: 2.4 +cabal-version: 3.0 name: purescript -- Note: don't add prerelease identifiers here! Add them in app/Version.hs and npm-package/package.json instead. @@ -34,7 +34,7 @@ extra-source-files: tests/support/pscide/src/**/*.purs tests/support/pscide/src/**/*.js tests/support/pscide/src/**/*.fail - stack.yaml + -- stack.yaml README.md INSTALL.md CONTRIBUTORS.md @@ -86,6 +86,9 @@ common defaults -Wno-missing-export-lists -Wno-missing-kind-signatures -Wno-partial-fields + + -- TODO: Remove + -O0 default-language: Haskell2010 default-extensions: BangPatterns @@ -119,7 +122,7 @@ common defaults TypeFamilies ViewPatterns build-tool-depends: - happy:happy ==1.20.0 + happy:happy ^>= 1.20.0 build-depends: -- NOTE: Please do not edit these version constraints manually. They are -- deliberately made narrow because changing the dependency versions in @@ -155,15 +158,18 @@ common defaults -- specific version. aeson >=2.0.3.0 && <2.1, aeson-better-errors >=0.9.1.1 && <0.10, + algebraic-graphs ==0.7, ansi-terminal >=0.11.3 && <0.12, array >=0.5.4.0 && <0.6, - base >=4.16.2.0 && <4.17, + base ==4.16.4.0, blaze-html >=0.9.1.2 && <0.10, bower-json >=1.1.0.0 && <1.2, boxes >=0.1.5 && <0.2, + bound ==2.0.7, bytestring >=0.11.3.1 && <0.12, Cabal >=3.6.3.0 && <3.7, cborg >=0.2.7.0 && <0.3, + deriving-compat ==0.6.5, serialise >=0.2.5.0 && <0.3, cheapskate >=0.1.1.2 && <0.2, clock >=0.8.3 && <0.9, @@ -179,7 +185,7 @@ common defaults Glob >=0.10.2 && <0.11, haskeline >=0.8.2 && <0.9, language-javascript ==0.7.0.0, - lens >=5.1.1 && <5.2, + lens ==5.2.3, lifted-async >=0.10.2.2 && <0.11, lifted-base >=0.2.3.12 && <0.3, memory >=0.17.0 && <0.18, @@ -191,6 +197,7 @@ common defaults parsec >=3.1.15.0 && <3.2, pattern-arrows >=0.0.2 && <0.1, process ==1.6.13.1, + prettyprinter ==1.7.1, protolude >=0.3.1 && <0.4, regex-tdfa >=1.3.1.2 && <1.4, safe >=0.3.19 && <0.4, @@ -198,17 +205,21 @@ common defaults semigroups ==0.20.*, semialign >=1.2.0.1 && <1.3, sourcemap >=0.1.7 && <0.2, + random ==1.2.1.2, stm >=2.5.0.2 && <2.6, stringsearch >=0.3.6.6 && <0.4, template-haskell >=2.18.0.0 && <2.19, - text >=1.2.5.0 && <1.3, + text >=1.2.5.0 && <2.3, + th-abstraction ==0.4.5.0, these >=1.1.1.1 && <1.2, time >=1.11.1.1 && <1.12, transformers >=0.5.6.2 && <0.6, transformers-base >=0.4.6 && <0.5, utf8-string >=1.0.2 && <1.1, vector >=0.12.3.1 && <0.13, - witherable >=0.4.2 && <0.5 + witherable >=0.4.2 && <0.5, + plutus-core, + plutus-core:plutus-ir library import: defaults @@ -230,23 +241,26 @@ library Language.PureScript.AST.Utils Language.PureScript.Bundle Language.PureScript.CodeGen - Language.PureScript.CodeGen.JS - Language.PureScript.CodeGen.JS.Common - Language.PureScript.CodeGen.JS.Printer + Language.PureScript.CodeGen.UPLC Language.PureScript.Constants.Libs + Language.PureScript.Constants.Purus + Language.PureScript.Constants.PLC + Language.PureScript.Constants.PLC.TH Language.PureScript.CoreFn Language.PureScript.CoreFn.Ann Language.PureScript.CoreFn.Binders Language.PureScript.CoreFn.CSE Language.PureScript.CoreFn.Desugar + Language.PureScript.CoreFn.Desugar.Utils Language.PureScript.CoreFn.Expr Language.PureScript.CoreFn.FromJSON - Language.PureScript.CoreFn.Laziness Language.PureScript.CoreFn.Meta Language.PureScript.CoreFn.Module Language.PureScript.CoreFn.Optimizer Language.PureScript.CoreFn.ToJSON Language.PureScript.CoreFn.Traversals + Language.PureScript.CoreFn.TypeLike + Language.PureScript.CoreFn.Utils Language.PureScript.CoreImp Language.PureScript.CoreImp.AST Language.PureScript.CoreImp.Module @@ -389,6 +403,38 @@ library Language.PureScript.TypeClassDictionaries Language.PureScript.Types System.IO.UTF8 + + Language.Purus.Config + Language.Purus.Debug + Language.Purus.Eval + Language.Purus.IR + Language.Purus.TH + Language.Purus.IR.Utils + Language.Purus.Make + Language.Purus.Pipeline.Monad + Language.Purus.Pipeline.CompileToPIR + Language.Purus.Pipeline.CompileToPIR.Utils + Language.Purus.Pipeline.DesugarCore + Language.Purus.Pipeline.DesugarObjects + Language.Purus.Pipeline.EliminateCases + Language.Purus.Pipeline.GenerateDatatypes + Language.Purus.Pipeline.GenerateDatatypes.Utils + Language.Purus.Pipeline.Inline + Language.Purus.Pipeline.Inline.Types + Language.Purus.Pipeline.Instantiate + Language.Purus.Pipeline.Lift + Language.Purus.Pipeline.Lift.Types + Language.Purus.Pretty + Language.Purus.Pretty.Common + Language.Purus.Pretty.Expr + Language.Purus.Pretty.Types + Language.Purus.Prim.Data + Language.Purus.Prim.Ledger + Language.Purus.Prim.LedgerData + Language.Purus.Prim.Utils + Language.Purus.Types + Language.Purus.Utils + other-modules: Data.Text.PureScript Language.PureScript.Constants.TH @@ -406,13 +452,35 @@ executable purs exceptions >=0.10.4 && <0.11, network >=3.1.2.7 && <3.2, optparse-applicative >=0.17.0.0 && <0.18, - purescript + purescript, + purs-lib if flag(release) cpp-options: -DRELEASE else build-depends: gitrev >=1.2.0 && <1.4 other-modules: + Paths_purescript + autogen-modules: + Paths_purescript + +library purs-lib + import: defaults + hs-source-dirs: purs-lib + -- main-is: Main.hs + ghc-options: -fno-warn-unused-do-bind -threaded -rtsopts -with-rtsopts=-N -Wno-unused-packages + build-depends: + ansi-wl-pprint >=0.6.9 && <0.7, + exceptions >=0.10.4 && <0.11, + network >=3.1.2.7 && <3.2, + optparse-applicative >=0.17.0.0 && <0.18, + purescript + if flag(release) + cpp-options: -DRELEASE + else + build-depends: + gitrev >=1.2.0 && <1.4 + exposed-modules: Command.Bundle Command.Compile Command.Docs @@ -437,14 +505,18 @@ test-suite tests ghc-options: -Wno-incomplete-uni-patterns -Wno-unused-packages build-depends: purescript, + purs-lib, + flat ==0.6, generic-random >=1.5.0.1 && <1.6, hspec >= 2.10.7 && < 3, HUnit >=1.6.2.0 && <1.7, newtype >=0.2.2.0 && <0.3, QuickCheck >=2.14.2 && <2.15, + plutus-core ==1.7.0.0, regex-base >=0.94.0.2 && <0.95, split >=0.2.3.4 && <0.3, - typed-process >=0.2.10.1 && <0.3 + typed-process >=0.2.10.1 && <0.3, + tasty ==1.5 build-tool-depends: hspec-discover:hspec-discover -any -- we need the compiler's executable available for the ide tests @@ -477,6 +549,7 @@ test-suite tests TestPsci.EvalTest TestPsci.TestEnv TestPscPublish + TestPurus TestSourceMaps TestUtils Paths_purescript diff --git a/app/Command/Bundle.hs b/purs-lib/Command/Bundle.hs similarity index 100% rename from app/Command/Bundle.hs rename to purs-lib/Command/Bundle.hs diff --git a/app/Command/Compile.hs b/purs-lib/Command/Compile.hs similarity index 83% rename from app/Command/Compile.hs rename to purs-lib/Command/Compile.hs index 8f348da9d..9cd29b37f 100644 --- a/app/Command/Compile.hs +++ b/purs-lib/Command/Compile.hs @@ -1,4 +1,4 @@ -module Command.Compile (command) where +module Command.Compile where import Prelude @@ -31,7 +31,7 @@ data PSCMakeOptions = PSCMakeOptions , pscmOpts :: P.Options , pscmUsePrefix :: Bool , pscmJSONErrors :: Bool - } + } deriving Show -- | Arguments: verbose, use JSON, warnings, errors printWarningsAndErrors :: Bool -> Bool -> [(FilePath, T.Text)] -> P.MultipleErrors -> Either P.MultipleErrors a -> IO () @@ -72,6 +72,25 @@ compile PSCMakeOptions{..} = do printWarningsAndErrors (P.optionsVerboseErrors pscmOpts) pscmJSONErrors moduleFiles makeWarnings makeErrors exitSuccess +compileForTests :: PSCMakeOptions -> IO () +compileForTests PSCMakeOptions{..} = do + included <- globWarningOnMisses warnFileTypeNotFound pscmInput + excluded <- globWarningOnMisses warnFileTypeNotFound pscmExclude + let input = included \\ excluded + if (null input) then do + hPutStr stderr $ unlines [ "purs compile: No input files." + , "Usage: For basic information, try the `--help' option." + ] + else do + moduleFiles <- readUTF8FilesT input + (makeErrors, makeWarnings) <- runMake pscmOpts $ do + ms <- CST.parseModulesFromFiles id moduleFiles + let filePathMap = M.fromList $ map (\(fp, pm) -> (P.getModuleName $ CST.resPartial pm, Right fp)) ms + foreigns <- inferForeignModules filePathMap + let makeActions = buildMakeActions pscmOutputDir filePathMap foreigns pscmUsePrefix + P.make makeActions (map snd ms) + printWarningsAndErrors (P.optionsVerboseErrors pscmOpts) pscmJSONErrors moduleFiles makeWarnings makeErrors + warnFileTypeNotFound :: String -> IO () warnFileTypeNotFound = hPutStrLn stderr . ("purs compile: No files found using pattern: " ++) @@ -130,11 +149,11 @@ codegenTargets :: Opts.Parser [P.CodegenTarget] codegenTargets = Opts.option targetParser $ Opts.short 'g' <> Opts.long "codegen" - <> Opts.value [P.JS] + <> Opts.value [P.CoreFn] <> Opts.help ( "Specifies comma-separated codegen targets to include. " <> targetsMessage - <> " The default target is 'js', but if this option is used only the targets specified will be used." + <> " The default target is 'coreFn', but if this option is used only the targets specified will be used." ) targetsMessage :: String @@ -158,7 +177,7 @@ options = where -- Ensure that the JS target is included if sourcemaps are handleTargets :: [P.CodegenTarget] -> S.Set P.CodegenTarget - handleTargets ts = S.fromList (if P.JSSourceMap `elem` ts then P.JS : ts else ts) + handleTargets ts = S.fromList ts pscMakeOptions :: Opts.Parser PSCMakeOptions pscMakeOptions = PSCMakeOptions <$> many inputFile diff --git a/app/Command/Docs.hs b/purs-lib/Command/Docs.hs similarity index 100% rename from app/Command/Docs.hs rename to purs-lib/Command/Docs.hs diff --git a/app/Command/Docs/Html.hs b/purs-lib/Command/Docs/Html.hs similarity index 100% rename from app/Command/Docs/Html.hs rename to purs-lib/Command/Docs/Html.hs diff --git a/app/Command/Docs/Markdown.hs b/purs-lib/Command/Docs/Markdown.hs similarity index 100% rename from app/Command/Docs/Markdown.hs rename to purs-lib/Command/Docs/Markdown.hs diff --git a/app/Command/Graph.hs b/purs-lib/Command/Graph.hs similarity index 100% rename from app/Command/Graph.hs rename to purs-lib/Command/Graph.hs diff --git a/app/Command/Hierarchy.hs b/purs-lib/Command/Hierarchy.hs similarity index 100% rename from app/Command/Hierarchy.hs rename to purs-lib/Command/Hierarchy.hs diff --git a/app/Command/Ide.hs b/purs-lib/Command/Ide.hs similarity index 100% rename from app/Command/Ide.hs rename to purs-lib/Command/Ide.hs diff --git a/app/Command/Publish.hs b/purs-lib/Command/Publish.hs similarity index 100% rename from app/Command/Publish.hs rename to purs-lib/Command/Publish.hs diff --git a/app/Command/REPL.hs b/purs-lib/Command/REPL.hs similarity index 100% rename from app/Command/REPL.hs rename to purs-lib/Command/REPL.hs diff --git a/app/Version.hs b/purs-lib/Version.hs similarity index 100% rename from app/Version.hs rename to purs-lib/Version.hs diff --git a/src/Control/Monad/Logger.hs b/src/Control/Monad/Logger.hs index a3ed57b0d..e0f40e21f 100644 --- a/src/Control/Monad/Logger.hs +++ b/src/Control/Monad/Logger.hs @@ -1,20 +1,20 @@ --- | --- A replacement for WriterT IO which uses mutable references. --- +{- | +A replacement for WriterT IO which uses mutable references. +-} module Control.Monad.Logger where import Prelude import Control.Monad (ap) -import Control.Monad.Base (MonadBase(..)) -import Control.Monad.IO.Class (MonadIO(..)) -import Control.Monad.Trans.Control (MonadBaseControl(..)) -import Control.Monad.Writer.Class (MonadWriter(..)) +import Control.Monad.Base (MonadBase (..)) +import Control.Monad.IO.Class (MonadIO (..)) +import Control.Monad.Trans.Control (MonadBaseControl (..)) +import Control.Monad.Writer.Class (MonadWriter (..)) import Data.IORef (IORef, atomicModifyIORef', newIORef, readIORef) -- | A replacement for WriterT IO which uses mutable references. -newtype Logger w a = Logger { runLogger :: IORef w -> IO a } +newtype Logger w a = Logger {runLogger :: IORef w -> IO a} -- | Run a Logger computation, starting with an empty log. runLogger' :: (Monoid w) => Logger w a -> IO (a, w) diff --git a/src/Control/Monad/Supply.hs b/src/Control/Monad/Supply.hs index 8c64fd252..75bfb1ec1 100644 --- a/src/Control/Monad/Supply.hs +++ b/src/Control/Monad/Supply.hs @@ -1,19 +1,19 @@ --- | --- Fresh variable supply --- +{- | +Fresh variable supply +-} module Control.Monad.Supply where import Prelude import Control.Applicative (Alternative) -import Control.Monad.Error.Class (MonadError(..)) +import Control.Monad.Error.Class (MonadError (..)) import Control.Monad.Reader (MonadPlus, MonadReader, MonadTrans) -import Control.Monad.State (StateT(..)) +import Control.Monad.State (StateT (..)) import Control.Monad.Writer (MonadWriter) -import Data.Functor.Identity (Identity(..)) +import Data.Functor.Identity (Identity (..)) -newtype SupplyT m a = SupplyT { unSupplyT :: StateT Integer m a } +newtype SupplyT m a = SupplyT {unSupplyT :: StateT Integer m a} deriving (Functor, Applicative, Monad, MonadTrans, MonadError e, MonadWriter w, MonadReader r, Alternative, MonadPlus) runSupplyT :: Integer -> SupplyT m a -> m (a, Integer) diff --git a/src/Control/Monad/Supply/Class.hs b/src/Control/Monad/Supply/Class.hs index e8656f0c6..3fb520dc8 100644 --- a/src/Control/Monad/Supply/Class.hs +++ b/src/Control/Monad/Supply/Class.hs @@ -1,18 +1,17 @@ --- | --- A class for monads supporting a supply of fresh names --- - +{- | +A class for monads supporting a supply of fresh names +-} module Control.Monad.Supply.Class where import Prelude -import Control.Monad.RWS (MonadState(..), MonadTrans(..), RWST) +import Control.Monad.RWS (MonadState (..), MonadTrans (..), RWST) import Control.Monad.State (StateT) -import Control.Monad.Supply (SupplyT(..)) +import Control.Monad.Supply (SupplyT (..)) import Control.Monad.Writer (WriterT) import Data.Text (Text, pack) -class Monad m => MonadSupply m where +class (Monad m) => MonadSupply m where fresh :: m Integer peek :: m Integer default fresh :: (MonadTrans t, MonadSupply n, m ~ t n) => m Integer @@ -20,16 +19,16 @@ class Monad m => MonadSupply m where default peek :: (MonadTrans t, MonadSupply n, m ~ t n) => m Integer peek = lift peek -instance Monad m => MonadSupply (SupplyT m) where +instance (Monad m) => MonadSupply (SupplyT m) where fresh = SupplyT $ do n <- get put (n + 1) return n peek = SupplyT get -instance MonadSupply m => MonadSupply (StateT s m) +instance (MonadSupply m) => MonadSupply (StateT s m) instance (Monoid w, MonadSupply m) => MonadSupply (WriterT w m) instance (Monoid w, MonadSupply m) => MonadSupply (RWST r w s m) -freshName :: MonadSupply m => m Text -freshName = fmap (("$" <> ) . pack . show) fresh +freshName :: (MonadSupply m) => m Text +freshName = fmap (("$" <>) . pack . show) fresh diff --git a/src/Data/Text/PureScript.hs b/src/Data/Text/PureScript.hs index 65751bff6..c19979a7d 100644 --- a/src/Data/Text/PureScript.hs +++ b/src/Data/Text/PureScript.hs @@ -1,23 +1,27 @@ --- | --- This module contains internal extensions to Data.Text. --- +{- | +This module contains internal extensions to Data.Text. +-} module Data.Text.PureScript (spanUpTo) where import Prelude -import Data.Text.Internal (Text(..), text) -import Data.Text.Unsafe (Iter(..), iter) +import Data.Text.Internal (Text (..), text) +import Data.Text.Unsafe (Iter (..), iter) --- | /O(n)/ 'spanUpTo', applied to a number @n@, predicate @p@, and text @t@, --- returns a pair whose first element is the longest prefix (possibly empty) of --- @t@ of length less than or equal to @n@ of elements that satisfy @p@, and --- whose second is the remainder of the text. +{- | /O(n)/ 'spanUpTo', applied to a number @n@, predicate @p@, and text @t@, +returns a pair whose first element is the longest prefix (possibly empty) of +@t@ of length less than or equal to @n@ of elements that satisfy @p@, and +whose second is the remainder of the text. +-} {-# INLINE spanUpTo #-} spanUpTo :: Int -> (Char -> Bool) -> Text -> (Text, Text) spanUpTo n p t@(Text arr off len) = (hd, tl) - where hd = text arr off k - tl = text arr (off + k) (len - k) - !k = loop n 0 - loop !n' !i | n' > 0 && i < len && p c = loop (n' - 1) (i + d) - | otherwise = i - where Iter c d = iter t i + where + hd = text arr off k + tl = text arr (off + k) (len - k) + !k = loop n 0 + loop !n' !i + | n' > 0 && i < len && p c = loop (n' - 1) (i + d) + | otherwise = i + where + Iter c d = iter t i diff --git a/src/Language/PureScript.hs b/src/Language/PureScript.hs index f2309f354..4019e7f65 100644 --- a/src/Language/PureScript.hs +++ b/src/Language/PureScript.hs @@ -1,11 +1,10 @@ --- | --- The main compiler module --- -module Language.PureScript - ( module P - , version - ) where - +{- | +The main compiler module +-} +module Language.PureScript ( + module P, + version, +) where import Control.Monad.Supply as P diff --git a/src/Language/PureScript/AST.hs b/src/Language/PureScript/AST.hs index fe82e2720..e53675cab 100644 --- a/src/Language/PureScript/AST.hs +++ b/src/Language/PureScript/AST.hs @@ -1,8 +1,8 @@ --- | --- The initial PureScript AST --- +{- | +The initial PureScript AST +-} module Language.PureScript.AST ( - module AST + module AST, ) where import Language.PureScript.AST.Binders as AST diff --git a/src/Language/PureScript/AST/Binders.hs b/src/Language/PureScript/AST/Binders.hs index 6d88ff3d9..6cd4e2fa9 100644 --- a/src/Language/PureScript/AST/Binders.hs +++ b/src/Language/PureScript/AST/Binders.hs @@ -1,66 +1,56 @@ --- | --- Case binders --- +{- | +Case binders +-} module Language.PureScript.AST.Binders where import Prelude +import Language.PureScript.AST.Literals (Literal (..)) import Language.PureScript.AST.SourcePos (SourceSpan) -import Language.PureScript.AST.Literals (Literal(..)) -import Language.PureScript.Names (Ident, OpName, OpNameType(..), ProperName, ProperNameType(..), Qualified) import Language.PureScript.Comments (Comment) +import Language.PureScript.Names (Ident, OpName, OpNameType (..), ProperName, ProperNameType (..), Qualified) import Language.PureScript.Types (SourceType) --- | --- Data type for binders --- +{- | +Data type for binders +-} data Binder - -- | - -- Wildcard binder - -- - = NullBinder - -- | - -- A binder which matches a literal - -- - | LiteralBinder SourceSpan (Literal Binder) - -- | - -- A binder which binds an identifier - -- - | VarBinder SourceSpan Ident - -- | - -- A binder which matches a data constructor - -- - | ConstructorBinder SourceSpan (Qualified (ProperName 'ConstructorName)) [Binder] - -- | - -- A operator alias binder. During the rebracketing phase of desugaring, - -- this data constructor will be removed. - -- - | OpBinder SourceSpan (Qualified (OpName 'ValueOpName)) - -- | - -- Binary operator application. During the rebracketing phase of desugaring, - -- this data constructor will be removed. - -- - | BinaryNoParensBinder Binder Binder Binder - -- | - -- Explicit parentheses. During the rebracketing phase of desugaring, this - -- data constructor will be removed. - -- - -- Note: although it seems this constructor is not used, it _is_ useful, - -- since it prevents certain traversals from matching. - -- - | ParensInBinder Binder - -- | - -- A binder which binds its input to an identifier - -- - | NamedBinder SourceSpan Ident Binder - -- | - -- A binder with source position information - -- - | PositionedBinder SourceSpan [Comment] Binder - -- | - -- A binder with a type annotation - -- - | TypedBinder SourceType Binder + = -- | + -- Wildcard binder + NullBinder + | -- | + -- A binder which matches a literal + LiteralBinder SourceSpan (Literal Binder) + | -- | + -- A binder which binds an identifier + VarBinder SourceSpan Ident + | -- | + -- A binder which matches a data constructor + ConstructorBinder SourceSpan (Qualified (ProperName 'ConstructorName)) [Binder] + | -- | + -- A operator alias binder. During the rebracketing phase of desugaring, + -- this data constructor will be removed. + OpBinder SourceSpan (Qualified (OpName 'ValueOpName)) + | -- | + -- Binary operator application. During the rebracketing phase of desugaring, + -- this data constructor will be removed. + BinaryNoParensBinder Binder Binder Binder + | -- | + -- Explicit parentheses. During the rebracketing phase of desugaring, this + -- data constructor will be removed. + -- + -- Note: although it seems this constructor is not used, it _is_ useful, + -- since it prevents certain traversals from matching. + ParensInBinder Binder + | -- | + -- A binder which binds its input to an identifier + NamedBinder SourceSpan Ident Binder + | -- | + -- A binder with source position information + PositionedBinder SourceSpan [Comment] Binder + | -- | + -- A binder with a type annotation + TypedBinder SourceType Binder deriving (Show) -- Manual Eq and Ord instances for `Binder` were added on 2018-03-05. Comparing @@ -115,41 +105,40 @@ instance Ord Binder where compare ty ty' <> compare b b' compare binder binder' = compare (orderOf binder) (orderOf binder') - where - orderOf :: Binder -> Int - orderOf NullBinder = 0 - orderOf LiteralBinder{} = 1 - orderOf VarBinder{} = 2 - orderOf ConstructorBinder{} = 3 - orderOf OpBinder{} = 4 - orderOf BinaryNoParensBinder{} = 5 - orderOf ParensInBinder{} = 6 - orderOf NamedBinder{} = 7 - orderOf PositionedBinder{} = 8 - orderOf TypedBinder{} = 9 + where + orderOf :: Binder -> Int + orderOf NullBinder = 0 + orderOf LiteralBinder {} = 1 + orderOf VarBinder {} = 2 + orderOf ConstructorBinder {} = 3 + orderOf OpBinder {} = 4 + orderOf BinaryNoParensBinder {} = 5 + orderOf ParensInBinder {} = 6 + orderOf NamedBinder {} = 7 + orderOf PositionedBinder {} = 8 + orderOf TypedBinder {} = 9 --- | --- Collect all names introduced in binders in an expression --- +{- | +Collect all names introduced in binders in an expression +-} binderNames :: Binder -> [Ident] binderNames = map snd . binderNamesWithSpans binderNamesWithSpans :: Binder -> [(SourceSpan, Ident)] binderNamesWithSpans = go [] where - go ns (LiteralBinder _ b) = lit ns b - go ns (VarBinder ss name) = (ss, name) : ns - go ns (ConstructorBinder _ _ bs) = foldl go ns bs - go ns (BinaryNoParensBinder b1 b2 b3) = foldl go ns [b1, b2, b3] - go ns (ParensInBinder b) = go ns b - go ns (NamedBinder ss name b) = go ((ss, name) : ns) b - go ns (PositionedBinder _ _ b) = go ns b - go ns (TypedBinder _ b) = go ns b - go ns _ = ns - lit ns (ObjectLiteral bs) = foldl go ns (map snd bs) - lit ns (ArrayLiteral bs) = foldl go ns bs - lit ns _ = ns - + go ns (LiteralBinder _ b) = lit ns b + go ns (VarBinder ss name) = (ss, name) : ns + go ns (ConstructorBinder _ _ bs) = foldl go ns bs + go ns (BinaryNoParensBinder b1 b2 b3) = foldl go ns [b1, b2, b3] + go ns (ParensInBinder b) = go ns b + go ns (NamedBinder ss name b) = go ((ss, name) : ns) b + go ns (PositionedBinder _ _ b) = go ns b + go ns (TypedBinder _ b) = go ns b + go ns _ = ns + lit ns (ObjectLiteral bs) = foldl go ns (map snd bs) + lit ns (ListLiteral bs) = foldl go ns bs + lit ns _ = ns isIrrefutable :: Binder -> Bool isIrrefutable NullBinder = True diff --git a/src/Language/PureScript/AST/Declarations.hs b/src/Language/PureScript/AST/Declarations.hs index e6d13c74a..49e556af9 100644 --- a/src/Language/PureScript/AST/Declarations.hs +++ b/src/Language/PureScript/AST/Declarations.hs @@ -1,56 +1,58 @@ {-# LANGUAGE DeriveAnyClass #-} {-# LANGUAGE TemplateHaskell #-} --- | --- Data types for modules and declarations --- +{- | +Data types for modules and declarations +-} module Language.PureScript.AST.Declarations where -import Prelude import Protolude.Exceptions (hush) +import Prelude import Codec.Serialise (Serialise) import Control.DeepSeq (NFData) -import Data.Functor.Identity (Identity(..)) +import Data.Functor.Identity (Identity (..)) -import Data.Aeson.TH (Options(..), SumEncoding(..), defaultOptions, deriveJSON) +import Data.Aeson.TH (Options (..), SumEncoding (..), defaultOptions, deriveJSON) +import Data.List.NonEmpty qualified as NEL import Data.Map qualified as M import Data.Text (Text) -import Data.List.NonEmpty qualified as NEL import GHC.Generics (Generic) +import Data.Aeson (FromJSON, ToJSON) import Language.PureScript.AST.Binders (Binder) -import Language.PureScript.AST.Literals (Literal(..)) +import Language.PureScript.AST.Declarations.ChainId (ChainId) +import Language.PureScript.AST.Literals (Literal (..)) import Language.PureScript.AST.Operators (Fixity) import Language.PureScript.AST.SourcePos (SourceAnn, SourceSpan) -import Language.PureScript.AST.Declarations.ChainId (ChainId) -import Language.PureScript.Types (SourceConstraint, SourceType) -import Language.PureScript.PSString (PSString) +import Language.PureScript.Comments (Comment) +import Language.PureScript.Constants.Prim qualified as C +import Language.PureScript.Constants.Purus as PLC +import Language.PureScript.Environment (DataDeclType, Environment, FunctionalDependency, NameKind) import Language.PureScript.Label (Label) -import Language.PureScript.Names (pattern ByNullSourcePos, Ident(..), ModuleName(..), Name(..), OpName, OpNameType(..), ProperName, ProperNameType(..), Qualified(..), QualifiedBy(..), toMaybeModuleName) +import Language.PureScript.Names (Ident (..), ModuleName (..), Name (..), OpName, OpNameType (..), ProperName, ProperNameType (..), Qualified (..), QualifiedBy (..), toMaybeModuleName, pattern ByNullSourcePos) +import Language.PureScript.PSString (PSString) import Language.PureScript.Roles (Role) import Language.PureScript.TypeClassDictionaries (NamedDict) -import Language.PureScript.Comments (Comment) -import Language.PureScript.Environment (DataDeclType, Environment, FunctionalDependency, NameKind) -import Language.PureScript.Constants.Prim qualified as C +import Language.PureScript.Types (SourceConstraint, SourceType) -- | A map of locally-bound names in scope. type Context = [(Ident, SourceType)] -- | Holds the data necessary to do type directed search for typed holes data TypeSearch - = TSBefore Environment - -- ^ An Environment captured for later consumption by type directed search - | TSAfter - -- ^ Results of applying type directed search to the previously captured - -- Environment - { tsAfterIdentifiers :: [(Qualified Text, SourceType)] - -- ^ The identifiers that fully satisfy the subsumption check - , tsAfterRecordFields :: Maybe [(Label, SourceType)] - -- ^ Record fields that are available on the first argument to the typed - -- hole - } - deriving Show + = -- | An Environment captured for later consumption by type directed search + TSBefore Environment + | -- | Results of applying type directed search to the previously captured + -- Environment + TSAfter + { tsAfterIdentifiers :: [(Qualified Text, SourceType)] + -- ^ The identifiers that fully satisfy the subsumption check + , tsAfterRecordFields :: Maybe [(Label, SourceType)] + -- ^ Record fields that are available on the first argument to the typed + -- hole + } + deriving (Show) onTypeSearchTypes :: (SourceType -> SourceType) -> TypeSearch -> TypeSearch onTypeSearchTypes f = runIdentity . onTypeSearchTypesM (Identity . f) @@ -103,22 +105,23 @@ data HintCategory | OtherHint deriving (Show, Eq) --- | --- In constraint solving, indicates whether there were `TypeUnknown`s that prevented --- an instance from being found, and whether VTAs are required --- due to type class members not referencing all the type class --- head's type variables. +{- | +In constraint solving, indicates whether there were `TypeUnknown`s that prevented +an instance from being found, and whether VTAs are required +due to type class members not referencing all the type class +head's type variables. +-} data UnknownsHint = NoUnknowns | Unknowns | UnknownsWithVtaRequiringArgs (NEL.NonEmpty (Qualified Ident, [[Text]])) deriving (Show) --- | --- A module declaration, consisting of comments about the module, a module name, --- a list of declarations, and a list of the declarations that are --- explicitly exported. If the export list is Nothing, everything is exported. --- +{- | +A module declaration, consisting of comments about the module, a module name, +a list of declarations, and a list of the declarations that are +explicitly exported. If the export list is Nothing, everything is exported. +-} data Module = Module SourceSpan [Comment] ModuleName [Declaration] (Maybe [DeclarationRef]) deriving (Show) @@ -134,76 +137,74 @@ getModuleSourceSpan (Module ss _ _ _ _) = ss getModuleDeclarations :: Module -> [Declaration] getModuleDeclarations (Module _ _ _ declarations _) = declarations --- | --- Add an import declaration for a module if it does not already explicitly import it. --- --- Will not import an unqualified module if that module has already been imported qualified. --- (See #2197) --- +{- | +Add an import declaration for a module if it does not already explicitly import it. + +Will not import an unqualified module if that module has already been imported qualified. +(See #2197) +-} addDefaultImport :: Qualified ModuleName -> Module -> Module addDefaultImport (Qualified toImportAs toImport) m@(Module ss coms mn decls exps) = - if isExistingImport `any` decls || mn == toImport then m - else Module ss coms mn (ImportDeclaration (ss, []) toImport Implicit toImportAs' : decls) exps + if isExistingImport `any` decls || mn == toImport + then m + else Module ss coms mn (ImportDeclaration (ss, []) toImport Implicit toImportAs' : decls) exps where - toImportAs' = toMaybeModuleName toImportAs - - isExistingImport (ImportDeclaration _ mn' _ as') - | mn' == toImport = - case toImportAs' of - Nothing -> True - _ -> as' == toImportAs' - isExistingImport _ = False - --- | Adds import declarations to a module for an implicit Prim import and Prim --- | qualified as Prim, as necessary. + toImportAs' = toMaybeModuleName toImportAs + + isExistingImport (ImportDeclaration _ mn' _ as') + | mn' == toImport = + case toImportAs' of + Nothing -> True + _ -> as' == toImportAs' + isExistingImport _ = False + +{- | Adds import declarations to a module for an implicit Prim import and Prim +| qualified as Prim, as necessary. NOTE: We also add PLC builtins at this stage +-} importPrim :: Module -> Module importPrim = let primModName = C.M_Prim - in + builtinModName = PLC.M_Builtin + in addDefaultImport (Qualified (ByModuleName primModName) primModName) . addDefaultImport (Qualified ByNullSourcePos primModName) + . addDefaultImport (Qualified (ByModuleName builtinModName) builtinModName) + +-- . addDefaultImport (Qualified ByNullSourcePos builtinModName) data NameSource = UserNamed | CompilerNamed deriving (Show, Generic, NFData, Serialise) --- | --- An item in a list of explicit imports or exports --- +{- | +An item in a list of explicit imports or exports +-} data DeclarationRef - -- | - -- A type class - -- - = TypeClassRef SourceSpan (ProperName 'ClassName) - -- | - -- A type operator - -- - | TypeOpRef SourceSpan (OpName 'TypeOpName) - -- | - -- A type constructor with data constructors - -- - | TypeRef SourceSpan (ProperName 'TypeName) (Maybe [ProperName 'ConstructorName]) - -- | - -- A value - -- - | ValueRef SourceSpan Ident - -- | - -- A value-level operator - -- - | ValueOpRef SourceSpan (OpName 'ValueOpName) - -- | - -- A type class instance, created during typeclass desugaring - -- - | TypeInstanceRef SourceSpan Ident NameSource - -- | - -- A module, in its entirety - -- - | ModuleRef SourceSpan ModuleName - -- | - -- A value re-exported from another module. These will be inserted during - -- elaboration in name desugaring. - -- - | ReExportRef SourceSpan ExportSource DeclarationRef + = -- | + -- A type class + TypeClassRef SourceSpan (ProperName 'ClassName) + | -- | + -- A type operator + TypeOpRef SourceSpan (OpName 'TypeOpName) + | -- | + -- A type constructor with data constructors + TypeRef SourceSpan (ProperName 'TypeName) (Maybe [ProperName 'ConstructorName]) + | -- | + -- A value + ValueRef SourceSpan Ident + | -- | + -- A value-level operator + ValueOpRef SourceSpan (OpName 'ValueOpName) + | -- | + -- A type class instance, created during typeclass desugaring + TypeInstanceRef SourceSpan Ident NameSource + | -- | + -- A module, in its entirety + ModuleRef SourceSpan ModuleName + | -- | + -- A value re-exported from another module. These will be inserted during + -- elaboration in name desugaring. + ReExportRef SourceSpan ExportSource DeclarationRef deriving (Show, Generic, NFData, Serialise) instance Eq DeclarationRef where @@ -228,19 +229,18 @@ instance Ord DeclarationRef where ReExportRef _ mn ref `compare` ReExportRef _ mn' ref' = compare mn mn' <> compare ref ref' compare ref ref' = compare (orderOf ref) (orderOf ref') - where - orderOf :: DeclarationRef -> Int - orderOf TypeClassRef{} = 0 - orderOf TypeOpRef{} = 1 - orderOf TypeRef{} = 2 - orderOf ValueRef{} = 3 - orderOf ValueOpRef{} = 4 - orderOf TypeInstanceRef{} = 5 - orderOf ModuleRef{} = 6 - orderOf ReExportRef{} = 7 - -data ExportSource = - ExportSource + where + orderOf :: DeclarationRef -> Int + orderOf TypeClassRef {} = 0 + orderOf TypeOpRef {} = 1 + orderOf TypeRef {} = 2 + orderOf ValueRef {} = 3 + orderOf ValueOpRef {} = 4 + orderOf TypeInstanceRef {} = 5 + orderOf ModuleRef {} = 6 + orderOf ReExportRef {} = 7 + +data ExportSource = ExportSource { exportSourceImportedFrom :: Maybe ModuleName , exportSourceDefinedIn :: ModuleName } @@ -287,54 +287,55 @@ getTypeClassRef (TypeClassRef _ name) = Just name getTypeClassRef _ = Nothing isModuleRef :: DeclarationRef -> Bool -isModuleRef ModuleRef{} = True +isModuleRef ModuleRef {} = True isModuleRef _ = False --- | --- The data type which specifies type of import declaration --- +{- | +The data type which specifies type of import declaration +-} data ImportDeclarationType - -- | - -- An import with no explicit list: `import M`. - -- - = Implicit - -- | - -- An import with an explicit list of references to import: `import M (foo)` - -- - | Explicit [DeclarationRef] - -- | - -- An import with a list of references to hide: `import M hiding (foo)` - -- - | Hiding [DeclarationRef] + = -- | + -- An import with no explicit list: `import M`. + Implicit + | -- | + -- An import with an explicit list of references to import: `import M (foo)` + Explicit [DeclarationRef] + | -- | + -- An import with a list of references to hide: `import M hiding (foo)` + Hiding [DeclarationRef] deriving (Eq, Show, Generic, Serialise) isExplicit :: ImportDeclarationType -> Bool isExplicit (Explicit _) = True isExplicit _ = False --- | A role declaration assigns a list of roles to a type constructor's --- parameters, e.g.: --- --- @type role T representational phantom@ --- --- In this example, @T@ is the identifier and @[representational, phantom]@ is --- the list of roles (@T@ presumably having two parameters). +{- | A role declaration assigns a list of roles to a type constructor's +parameters, e.g.: + +@type role T representational phantom@ + +In this example, @T@ is the identifier and @[representational, phantom]@ is +the list of roles (@T@ presumably having two parameters). +-} data RoleDeclarationData = RoleDeclarationData { rdeclSourceAnn :: !SourceAnn , rdeclIdent :: !(ProperName 'TypeName) , rdeclRoles :: ![Role] - } deriving (Show, Eq) + } + deriving (Show, Eq) --- | A type declaration assigns a type to an identifier, eg: --- --- @identity :: forall a. a -> a@ --- --- In this example @identity@ is the identifier and @forall a. a -> a@ the type. +{- | A type declaration assigns a type to an identifier, eg: + +@identity :: forall a. a -> a@ + +In this example @identity@ is the identifier and @forall a. a -> a@ the type. +-} data TypeDeclarationData = TypeDeclarationData { tydeclSourceAnn :: !SourceAnn , tydeclIdent :: !Ident , tydeclType :: !SourceType - } deriving (Show, Eq) + } + deriving (Show, Eq) getTypeDeclaration :: Declaration -> Maybe TypeDeclarationData getTypeDeclaration (TypeDeclaration d) = Just d @@ -343,11 +344,12 @@ getTypeDeclaration _ = Nothing unwrapTypeDeclaration :: TypeDeclarationData -> (Ident, SourceType) unwrapTypeDeclaration td = (tydeclIdent td, tydeclType td) --- | A value declaration assigns a name and potential binders, to an expression (or multiple guarded expressions). --- --- @double x = x + x@ --- --- In this example @double@ is the identifier, @x@ is a binder and @x + x@ is the expression. +{- | A value declaration assigns a name and potential binders, to an expression (or multiple guarded expressions). + +@double x = x + x@ + +In this example @double@ is the identifier, @x@ is a binder and @x + x@ is the expression. +-} data ValueDeclarationData a = ValueDeclarationData { valdeclSourceAnn :: !SourceAnn , valdeclIdent :: !Ident @@ -356,95 +358,87 @@ data ValueDeclarationData a = ValueDeclarationData -- ^ Whether or not this value is exported/visible , valdeclBinders :: ![Binder] , valdeclExpression :: !a - } deriving (Show, Functor, Foldable, Traversable) + } + deriving (Show, Functor, Foldable, Traversable) getValueDeclaration :: Declaration -> Maybe (ValueDeclarationData [GuardedExpr]) getValueDeclaration (ValueDeclaration d) = Just d getValueDeclaration _ = Nothing pattern ValueDecl :: SourceAnn -> Ident -> NameKind -> [Binder] -> [GuardedExpr] -> Declaration -pattern ValueDecl sann ident name binders expr - = ValueDeclaration (ValueDeclarationData sann ident name binders expr) +pattern ValueDecl sann ident name binders expr = + ValueDeclaration (ValueDeclarationData sann ident name binders expr) data DataConstructorDeclaration = DataConstructorDeclaration { dataCtorAnn :: !SourceAnn , dataCtorName :: !(ProperName 'ConstructorName) , dataCtorFields :: ![(Ident, SourceType)] - } deriving (Show, Eq) + } + deriving (Show, Eq, Generic) + +instance ToJSON DataConstructorDeclaration +instance FromJSON DataConstructorDeclaration mapDataCtorFields :: ([(Ident, SourceType)] -> [(Ident, SourceType)]) -> DataConstructorDeclaration -> DataConstructorDeclaration -mapDataCtorFields f DataConstructorDeclaration{..} = DataConstructorDeclaration { dataCtorFields = f dataCtorFields, .. } +mapDataCtorFields f DataConstructorDeclaration {..} = DataConstructorDeclaration {dataCtorFields = f dataCtorFields, ..} -traverseDataCtorFields :: Monad m => ([(Ident, SourceType)] -> m [(Ident, SourceType)]) -> DataConstructorDeclaration -> m DataConstructorDeclaration -traverseDataCtorFields f DataConstructorDeclaration{..} = DataConstructorDeclaration dataCtorAnn dataCtorName <$> f dataCtorFields +traverseDataCtorFields :: (Monad m) => ([(Ident, SourceType)] -> m [(Ident, SourceType)]) -> DataConstructorDeclaration -> m DataConstructorDeclaration +traverseDataCtorFields f DataConstructorDeclaration {..} = DataConstructorDeclaration dataCtorAnn dataCtorName <$> f dataCtorFields --- | --- The data type of declarations --- +{- | +The data type of declarations +-} data Declaration - -- | - -- A data type declaration (data or newtype, name, arguments, data constructors) - -- - = DataDeclaration SourceAnn DataDeclType (ProperName 'TypeName) [(Text, Maybe SourceType)] [DataConstructorDeclaration] - -- | - -- A minimal mutually recursive set of data type declarations - -- - | DataBindingGroupDeclaration (NEL.NonEmpty Declaration) - -- | - -- A type synonym declaration (name, arguments, type) - -- - | TypeSynonymDeclaration SourceAnn (ProperName 'TypeName) [(Text, Maybe SourceType)] SourceType - -- | - -- A kind signature declaration - -- - | KindDeclaration SourceAnn KindSignatureFor (ProperName 'TypeName) SourceType - -- | - -- A role declaration (name, roles) - -- - | RoleDeclaration {-# UNPACK #-} !RoleDeclarationData - -- | - -- A type declaration for a value (name, ty) - -- - | TypeDeclaration {-# UNPACK #-} !TypeDeclarationData - -- | - -- A value declaration (name, top-level binders, optional guard, value) - -- - | ValueDeclaration {-# UNPACK #-} !(ValueDeclarationData [GuardedExpr]) - -- | - -- A declaration paired with pattern matching in let-in expression (binder, optional guard, value) - | BoundValueDeclaration SourceAnn Binder Expr - -- | - -- A minimal mutually recursive set of value declarations - -- - | BindingGroupDeclaration (NEL.NonEmpty ((SourceAnn, Ident), NameKind, Expr)) - -- | - -- A foreign import declaration (name, type) - -- - | ExternDeclaration SourceAnn Ident SourceType - -- | - -- A data type foreign import (name, kind) - -- - | ExternDataDeclaration SourceAnn (ProperName 'TypeName) SourceType - -- | - -- A fixity declaration - -- - | FixityDeclaration SourceAnn (Either ValueFixity TypeFixity) - -- | - -- A module import (module name, qualified/unqualified/hiding, optional "qualified as" name) - -- - | ImportDeclaration SourceAnn ModuleName ImportDeclarationType (Maybe ModuleName) - -- | - -- A type class declaration (name, argument, implies, member declarations) - -- - | TypeClassDeclaration SourceAnn (ProperName 'ClassName) [(Text, Maybe SourceType)] [SourceConstraint] [FunctionalDependency] [Declaration] - -- | - -- A type instance declaration (instance chain, chain index, name, - -- dependencies, class name, instance types, member declarations) - -- - -- The first @SourceAnn@ serves as the annotation for the entire - -- declaration, while the second @SourceAnn@ serves as the - -- annotation for the type class and its arguments. - | TypeInstanceDeclaration SourceAnn SourceAnn ChainId Integer (Either Text Ident) [SourceConstraint] (Qualified (ProperName 'ClassName)) [SourceType] TypeInstanceBody + = -- | + -- A data type declaration (data or newtype, name, arguments, data constructors) + DataDeclaration SourceAnn DataDeclType (ProperName 'TypeName) [(Text, SourceType)] [DataConstructorDeclaration] + | -- | + -- A minimal mutually recursive set of data type declarations + DataBindingGroupDeclaration (NEL.NonEmpty Declaration) + | -- | + -- A type synonym declaration (name, arguments, type) + TypeSynonymDeclaration SourceAnn (ProperName 'TypeName) [(Text, SourceType)] SourceType + | -- | + -- A kind signature declaration + KindDeclaration SourceAnn KindSignatureFor (ProperName 'TypeName) SourceType + | -- | + -- A role declaration (name, roles) + RoleDeclaration {-# UNPACK #-} !RoleDeclarationData + | -- | + -- A type declaration for a value (name, ty) + TypeDeclaration {-# UNPACK #-} !TypeDeclarationData + | -- | + -- A value declaration (name, top-level binders, optional guard, value) + ValueDeclaration {-# UNPACK #-} !(ValueDeclarationData [GuardedExpr]) + | -- | + -- A declaration paired with pattern matching in let-in expression (binder, optional guard, value) + BoundValueDeclaration SourceAnn Binder Expr + | -- | + -- A minimal mutually recursive set of value declarations + BindingGroupDeclaration (NEL.NonEmpty ((SourceAnn, Ident), NameKind, Expr)) + | -- | + -- A foreign import declaration (name, type) + ExternDeclaration SourceAnn Ident SourceType + | -- | + -- A data type foreign import (name, kind) + ExternDataDeclaration SourceAnn (ProperName 'TypeName) SourceType + | -- | + -- A fixity declaration + FixityDeclaration SourceAnn (Either ValueFixity TypeFixity) + | -- | + -- A module import (module name, qualified/unqualified/hiding, optional "qualified as" name) + ImportDeclaration SourceAnn ModuleName ImportDeclarationType (Maybe ModuleName) + | -- | + -- A type class declaration (name, argument, implies, member declarations) + TypeClassDeclaration SourceAnn (ProperName 'ClassName) [(Text, SourceType)] [SourceConstraint] [FunctionalDependency] [Declaration] + | -- | + -- A type instance declaration (instance chain, chain index, name, + -- dependencies, class name, instance types, member declarations) + -- + -- The first @SourceAnn@ serves as the annotation for the entire + -- declaration, while the second @SourceAnn@ serves as the + -- annotation for the type class and its arguments. + TypeInstanceDeclaration SourceAnn SourceAnn ChainId Integer (Either Text Ident) [SourceConstraint] (Qualified (ProperName 'ClassName)) [SourceType] TypeInstanceBody deriving (Show) data ValueFixity = ValueFixity Fixity (Qualified (Either Ident (ProperName 'ConstructorName))) (OpName 'ValueOpName) @@ -466,12 +460,12 @@ data InstanceDerivationStrategy -- | The members of a type class instance declaration data TypeInstanceBody - = DerivedInstance - -- ^ This is a derived instance - | NewtypeInstance - -- ^ This is an instance derived from a newtype - | ExplicitInstance [Declaration] - -- ^ This is a regular (explicit) instance + = -- | This is a derived instance + DerivedInstance + | -- | This is an instance derived from a newtype + NewtypeInstance + | -- | This is a regular (explicit) instance + ExplicitInstance [Declaration] deriving (Show) mapTypeInstanceBody :: ([Declaration] -> [Declaration]) -> TypeInstanceBody -> TypeInstanceBody @@ -525,298 +519,270 @@ declName (FixityDeclaration _ (Left (ValueFixity _ _ n))) = Just (ValOpName n) declName (FixityDeclaration _ (Right (TypeFixity _ _ n))) = Just (TyOpName n) declName (TypeClassDeclaration _ n _ _ _ _) = Just (TyClassName n) declName (TypeInstanceDeclaration _ _ _ _ n _ _ _ _) = IdentName <$> hush n -declName (RoleDeclaration RoleDeclarationData{..}) = Just (TyName rdeclIdent) -declName ImportDeclaration{} = Nothing -declName BindingGroupDeclaration{} = Nothing -declName DataBindingGroupDeclaration{} = Nothing -declName BoundValueDeclaration{} = Nothing -declName KindDeclaration{} = Nothing -declName TypeDeclaration{} = Nothing - --- | --- Test if a declaration is a value declaration --- +declName (RoleDeclaration RoleDeclarationData {..}) = Just (TyName rdeclIdent) +declName ImportDeclaration {} = Nothing +declName BindingGroupDeclaration {} = Nothing +declName DataBindingGroupDeclaration {} = Nothing +declName BoundValueDeclaration {} = Nothing +declName KindDeclaration {} = Nothing +declName TypeDeclaration {} = Nothing + +{- | +Test if a declaration is a value declaration +-} isValueDecl :: Declaration -> Bool -isValueDecl ValueDeclaration{} = True +isValueDecl ValueDeclaration {} = True isValueDecl _ = False --- | --- Test if a declaration is a data type declaration --- +{- | +Test if a declaration is a data type declaration +-} isDataDecl :: Declaration -> Bool -isDataDecl DataDeclaration{} = True +isDataDecl DataDeclaration {} = True isDataDecl _ = False --- | --- Test if a declaration is a type synonym declaration --- +{- | +Test if a declaration is a type synonym declaration +-} isTypeSynonymDecl :: Declaration -> Bool -isTypeSynonymDecl TypeSynonymDeclaration{} = True +isTypeSynonymDecl TypeSynonymDeclaration {} = True isTypeSynonymDecl _ = False --- | --- Test if a declaration is a module import --- +{- | +Test if a declaration is a module import +-} isImportDecl :: Declaration -> Bool -isImportDecl ImportDeclaration{} = True +isImportDecl ImportDeclaration {} = True isImportDecl _ = False --- | --- Test if a declaration is a role declaration --- +{- | +Test if a declaration is a role declaration +-} isRoleDecl :: Declaration -> Bool -isRoleDecl RoleDeclaration{} = True +isRoleDecl RoleDeclaration {} = True isRoleDecl _ = False --- | --- Test if a declaration is a data type foreign import --- +{- | +Test if a declaration is a data type foreign import +-} isExternDataDecl :: Declaration -> Bool -isExternDataDecl ExternDataDeclaration{} = True +isExternDataDecl ExternDataDeclaration {} = True isExternDataDecl _ = False --- | --- Test if a declaration is a fixity declaration --- +{- | +Test if a declaration is a fixity declaration +-} isFixityDecl :: Declaration -> Bool -isFixityDecl FixityDeclaration{} = True +isFixityDecl FixityDeclaration {} = True isFixityDecl _ = False getFixityDecl :: Declaration -> Maybe (Either ValueFixity TypeFixity) getFixityDecl (FixityDeclaration _ fixity) = Just fixity getFixityDecl _ = Nothing --- | --- Test if a declaration is a foreign import --- +{- | +Test if a declaration is a foreign import +-} isExternDecl :: Declaration -> Bool -isExternDecl ExternDeclaration{} = True +isExternDecl ExternDeclaration {} = True isExternDecl _ = False --- | --- Test if a declaration is a type class instance declaration --- +{- | +Test if a declaration is a type class instance declaration +-} isTypeClassInstanceDecl :: Declaration -> Bool -isTypeClassInstanceDecl TypeInstanceDeclaration{} = True +isTypeClassInstanceDecl TypeInstanceDeclaration {} = True isTypeClassInstanceDecl _ = False --- | --- Test if a declaration is a type class declaration --- +{- | +Test if a declaration is a type class declaration +-} isTypeClassDecl :: Declaration -> Bool -isTypeClassDecl TypeClassDeclaration{} = True +isTypeClassDecl TypeClassDeclaration {} = True isTypeClassDecl _ = False --- | --- Test if a declaration is a kind signature declaration. --- +{- | +Test if a declaration is a kind signature declaration. +-} isKindDecl :: Declaration -> Bool -isKindDecl KindDeclaration{} = True +isKindDecl KindDeclaration {} = True isKindDecl _ = False --- | --- Recursively flatten data binding groups in the list of declarations +{- | +Recursively flatten data binding groups in the list of declarations +-} flattenDecls :: [Declaration] -> [Declaration] flattenDecls = concatMap flattenOne - where flattenOne :: Declaration -> [Declaration] - flattenOne (DataBindingGroupDeclaration decls) = concatMap flattenOne decls - flattenOne d = [d] - --- | --- A guard is just a boolean-valued expression that appears alongside a set of binders --- -data Guard = ConditionGuard Expr - | PatternGuard Binder Expr - deriving (Show) + where + flattenOne :: Declaration -> [Declaration] + flattenOne (DataBindingGroupDeclaration decls) = concatMap flattenOne decls + flattenOne d = [d] + +{- | +A guard is just a boolean-valued expression that appears alongside a set of binders +-} +data Guard + = ConditionGuard Expr + | PatternGuard Binder Expr + deriving (Show) --- | --- The right hand side of a binder in value declarations --- and case expressions. +{- | +The right hand side of a binder in value declarations +and case expressions. +-} data GuardedExpr = GuardedExpr [Guard] Expr - deriving (Show) + deriving (Show) pattern MkUnguarded :: Expr -> GuardedExpr pattern MkUnguarded e = GuardedExpr [] e --- | --- Data type for expressions and terms --- +{- | +Data type for expressions and terms +-} data Expr - -- | - -- A literal value - -- - = Literal SourceSpan (Literal Expr) - -- | - -- A prefix -, will be desugared - -- - | UnaryMinus SourceSpan Expr - -- | - -- Binary operator application. During the rebracketing phase of desugaring, this data constructor - -- will be removed. - -- - | BinaryNoParens Expr Expr Expr - -- | - -- Explicit parentheses. During the rebracketing phase of desugaring, this data constructor - -- will be removed. - -- - -- Note: although it seems this constructor is not used, it _is_ useful, since it prevents - -- certain traversals from matching. - -- - | Parens Expr - -- | - -- An record property accessor expression (e.g. `obj.x` or `_.x`). - -- Anonymous arguments will be removed during desugaring and expanded - -- into a lambda that reads a property from a record. - -- - | Accessor PSString Expr - -- | - -- Partial record update - -- - | ObjectUpdate Expr [(PSString, Expr)] - -- | - -- Object updates with nested support: `x { foo { bar = e } }` - -- Replaced during desugaring into a `Let` and nested `ObjectUpdate`s - -- - | ObjectUpdateNested Expr (PathTree Expr) - -- | - -- Function introduction - -- - | Abs Binder Expr - -- | - -- Function application - -- - | App Expr Expr - -- | - -- A type application (e.g. `f @Int`) - -- - | VisibleTypeApp Expr SourceType - -- | - -- Hint that an expression is unused. - -- This is used to ignore type class dictionaries that are necessarily empty. - -- The inner expression lets us solve subgoals before eliminating the whole expression. - -- The code gen will render this as `undefined`, regardless of what the inner expression is. - | Unused Expr - -- | - -- Variable - -- - | Var SourceSpan (Qualified Ident) - -- | - -- An operator. This will be desugared into a function during the "operators" - -- phase of desugaring. - -- - | Op SourceSpan (Qualified (OpName 'ValueOpName)) - -- | - -- Conditional (if-then-else expression) - -- - | IfThenElse Expr Expr Expr - -- | - -- A data constructor - -- - | Constructor SourceSpan (Qualified (ProperName 'ConstructorName)) - -- | - -- A case expression. During the case expansion phase of desugaring, top-level binders will get - -- desugared into case expressions, hence the need for guards and multiple binders per branch here. - -- - | Case [Expr] [CaseAlternative] - -- | - -- A value with a type annotation - -- - | TypedValue Bool Expr SourceType - -- | - -- A let binding - -- - | Let WhereProvenance [Declaration] Expr - -- | - -- A do-notation block - -- - | Do (Maybe ModuleName) [DoNotationElement] - -- | - -- An ado-notation block - -- - | Ado (Maybe ModuleName) [DoNotationElement] Expr - -- | - -- A placeholder for a type class dictionary to be inserted later. At the end of type checking, these - -- placeholders will be replaced with actual expressions representing type classes dictionaries which - -- can be evaluated at runtime. The constructor arguments represent (in order): whether or not to look - -- at superclass implementations when searching for a dictionary, the type class name and - -- instance type, and the type class dictionaries in scope. - -- - | TypeClassDictionary SourceConstraint - (M.Map QualifiedBy (M.Map (Qualified (ProperName 'ClassName)) (M.Map (Qualified Ident) (NEL.NonEmpty NamedDict)))) - [ErrorMessageHint] - -- | - -- A placeholder for a superclass dictionary to be turned into a TypeClassDictionary during typechecking - -- - | DeferredDictionary (Qualified (ProperName 'ClassName)) [SourceType] - -- | - -- A placeholder for a type class instance to be derived during typechecking - -- - | DerivedInstancePlaceholder (Qualified (ProperName 'ClassName)) InstanceDerivationStrategy - -- | - -- A placeholder for an anonymous function argument - -- - | AnonymousArgument - -- | - -- A typed hole that will be turned into a hint/error during typechecking - -- - | Hole Text - -- | - -- A value with source position information - -- - | PositionedValue SourceSpan [Comment] Expr + = -- | + -- A literal value + Literal SourceSpan (Literal Expr) + | -- | + -- A prefix -, will be desugared + UnaryMinus SourceSpan Expr + | -- | + -- Binary operator application. During the rebracketing phase of desugaring, this data constructor + -- will be removed. + BinaryNoParens Expr Expr Expr + | -- | + -- Explicit parentheses. During the rebracketing phase of desugaring, this data constructor + -- will be removed. + -- + -- Note: although it seems this constructor is not used, it _is_ useful, since it prevents + -- certain traversals from matching. + Parens Expr + | -- | + -- An record property accessor expression (e.g. `obj.x` or `_.x`). + -- Anonymous arguments will be removed during desugaring and expanded + -- into a lambda that reads a property from a record. + Accessor PSString Expr + | -- | + -- Partial record update + ObjectUpdate Expr [(PSString, Expr)] + | -- | + -- Object updates with nested support: `x { foo { bar = e } }` + -- Replaced during desugaring into a `Let` and nested `ObjectUpdate`s + ObjectUpdateNested Expr (PathTree Expr) + | -- | + -- Function introduction + Abs Binder Expr + | -- | + -- Function application + App Expr Expr + | -- | + -- A type application (e.g. `f @Int`) + VisibleTypeApp Expr SourceType + | -- | + -- Hint that an expression is unused. + -- This is used to ignore type class dictionaries that are necessarily empty. + -- The inner expression lets us solve subgoals before eliminating the whole expression. + -- The code gen will render this as `undefined`, regardless of what the inner expression is. + Unused Expr + | -- | + -- Variable + Var SourceSpan (Qualified Ident) + | -- | + -- An operator. This will be desugared into a function during the "operators" + -- phase of desugaring. + Op SourceSpan (Qualified (OpName 'ValueOpName)) + | -- | + -- Conditional (if-then-else expression) + IfThenElse Expr Expr Expr + | -- | + -- A data constructor + Constructor SourceSpan (Qualified (ProperName 'ConstructorName)) + | -- | + -- A case expression. During the case expansion phase of desugaring, top-level binders will get + -- desugared into case expressions, hence the need for guards and multiple binders per branch here. + Case [Expr] [CaseAlternative] + | -- | + -- A value with a type annotation + TypedValue Bool Expr SourceType + | -- | + -- A let binding + Let WhereProvenance [Declaration] Expr + | -- | + -- A do-notation block + Do (Maybe ModuleName) [DoNotationElement] + | -- | + -- An ado-notation block + Ado (Maybe ModuleName) [DoNotationElement] Expr + | -- | + -- A placeholder for a type class dictionary to be inserted later. At the end of type checking, these + -- placeholders will be replaced with actual expressions representing type classes dictionaries which + -- can be evaluated at runtime. The constructor arguments represent (in order): whether or not to look + -- at superclass implementations when searching for a dictionary, the type class name and + -- instance type, and the type class dictionaries in scope. + TypeClassDictionary + SourceConstraint + (M.Map QualifiedBy (M.Map (Qualified (ProperName 'ClassName)) (M.Map (Qualified Ident) (NEL.NonEmpty NamedDict)))) + [ErrorMessageHint] + | -- | + -- A placeholder for a superclass dictionary to be turned into a TypeClassDictionary during typechecking + DeferredDictionary (Qualified (ProperName 'ClassName)) [SourceType] + | -- | + -- A placeholder for a type class instance to be derived during typechecking + DerivedInstancePlaceholder (Qualified (ProperName 'ClassName)) InstanceDerivationStrategy + | -- | + -- A placeholder for an anonymous function argument + AnonymousArgument + | -- | + -- A typed hole that will be turned into a hint/error during typechecking + Hole Text + | -- | + -- A value with source position information + PositionedValue SourceSpan [Comment] Expr deriving (Show) --- | --- Metadata that tells where a let binding originated --- +{- | +Metadata that tells where a let binding originated +-} data WhereProvenance - -- | - -- The let binding was originally a where clause - -- - = FromWhere - -- | - -- The let binding was always a let binding - -- - | FromLet + = -- | + -- The let binding was originally a where clause + FromWhere + | -- | + -- The let binding was always a let binding + FromLet deriving (Show) --- | --- An alternative in a case statement --- +{- | +An alternative in a case statement +-} data CaseAlternative = CaseAlternative - { -- | - -- A collection of binders with which to match the inputs - -- - caseAlternativeBinders :: [Binder] - -- | - -- The result expression or a collect of guarded expressions - -- + { caseAlternativeBinders :: [Binder] + -- ^ + -- A collection of binders with which to match the inputs , caseAlternativeResult :: [GuardedExpr] - } deriving (Show) + -- ^ + -- The result expression or a collect of guarded expressions + } + deriving (Show) --- | --- A statement in a do-notation block --- +{- | +A statement in a do-notation block +-} data DoNotationElement - -- | - -- A monadic value without a binder - -- - = DoNotationValue Expr - -- | - -- A monadic value with a binder - -- - | DoNotationBind Binder Expr - -- | - -- A let statement, i.e. a pure value with a binder - -- - | DoNotationLet [Declaration] - -- | - -- A do notation element with source position information - -- - | PositionedDoNotationElement SourceSpan [Comment] DoNotationElement + = -- | + -- A monadic value without a binder + DoNotationValue Expr + | -- | + -- A monadic value with a binder + DoNotationBind Binder Expr + | -- | + -- A let statement, i.e. a pure value with a binder + DoNotationLet [Declaration] + | -- | + -- A do notation element with source position information + PositionedDoNotationElement SourceSpan [Comment] DoNotationElement deriving (Show) - -- For a record update such as: -- -- x { foo = 0 @@ -846,16 +812,15 @@ newtype PathTree t = PathTree (AssocList PSString (PathNode t)) data PathNode t = Leaf t | Branch (PathTree t) deriving (Show, Eq, Ord, Functor, Foldable, Traversable) -newtype AssocList k t = AssocList { runAssocList :: [(k, t)] } +newtype AssocList k t = AssocList {runAssocList :: [(k, t)]} deriving (Show, Eq, Ord, Foldable, Functor, Traversable) -$(deriveJSON (defaultOptions { sumEncoding = ObjectWithSingleField }) ''NameSource) -$(deriveJSON (defaultOptions { sumEncoding = ObjectWithSingleField }) ''ExportSource) -$(deriveJSON (defaultOptions { sumEncoding = ObjectWithSingleField }) ''DeclarationRef) -$(deriveJSON (defaultOptions { sumEncoding = ObjectWithSingleField }) ''ImportDeclarationType) +$(deriveJSON (defaultOptions {sumEncoding = ObjectWithSingleField}) ''NameSource) +$(deriveJSON (defaultOptions {sumEncoding = ObjectWithSingleField}) ''ExportSource) +$(deriveJSON (defaultOptions {sumEncoding = ObjectWithSingleField}) ''DeclarationRef) +$(deriveJSON (defaultOptions {sumEncoding = ObjectWithSingleField}) ''ImportDeclarationType) isTrueExpr :: Expr -> Bool -isTrueExpr (Literal _ (BooleanLiteral True)) = True isTrueExpr (Var _ (Qualified (ByModuleName (ModuleName "Prelude")) (Ident "otherwise"))) = True isTrueExpr (Var _ (Qualified (ByModuleName (ModuleName "Data.Boolean")) (Ident "otherwise"))) = True isTrueExpr (TypedValue _ e _) = isTrueExpr e diff --git a/src/Language/PureScript/AST/Declarations/ChainId.hs b/src/Language/PureScript/AST/Declarations/ChainId.hs index aacfc11fe..f8ccfb0ee 100644 --- a/src/Language/PureScript/AST/Declarations/ChainId.hs +++ b/src/Language/PureScript/AST/Declarations/ChainId.hs @@ -1,18 +1,19 @@ -module Language.PureScript.AST.Declarations.ChainId - ( ChainId - , mkChainId - ) where +module Language.PureScript.AST.Declarations.ChainId ( + ChainId, + mkChainId, +) where -import Prelude -import Language.PureScript.AST.SourcePos qualified as Pos -import Control.DeepSeq (NFData) import Codec.Serialise (Serialise) +import Control.DeepSeq (NFData) +import Language.PureScript.AST.SourcePos qualified as Pos +import Prelude --- | --- For a given instance chain, stores the chain's file name and --- the starting source pos of the first instance in the chain. --- This data is used to determine which instances are part of --- the same instance chain. +{- | +For a given instance chain, stores the chain's file name and +the starting source pos of the first instance in the chain. +This data is used to determine which instances are part of +the same instance chain. +-} newtype ChainId = ChainId (String, Pos.SourcePos) deriving (Eq, Ord, Show, NFData, Serialise) diff --git a/src/Language/PureScript/AST/Exported.hs b/src/Language/PureScript/AST/Exported.hs index 8ca960bb9..b71cf44db 100644 --- a/src/Language/PureScript/AST/Exported.hs +++ b/src/Language/PureScript/AST/Exported.hs @@ -1,173 +1,173 @@ -module Language.PureScript.AST.Exported - ( exportedDeclarations - , isExported - ) where +module Language.PureScript.AST.Exported ( + exportedDeclarations, + isExported, +) where -import Prelude import Protolude (sortOn) +import Prelude -import Control.Category ((>>>)) import Control.Applicative ((<|>)) +import Control.Category ((>>>)) -import Data.Maybe (mapMaybe) import Data.Map qualified as M +import Data.Maybe (mapMaybe) + +import Language.PureScript.AST.Declarations (DataConstructorDeclaration (..), Declaration (..), DeclarationRef (..), Module (..), declName, declRefName, flattenDecls) +import Language.PureScript.Names (ModuleName, Name (..), ProperName, ProperNameType (..), Qualified, coerceProperName, disqualify, isQualified, isQualifiedWith) +import Language.PureScript.Types (Constraint (..), Type (..), everythingOnTypes) + +{- | +Return a list of all declarations which are exported from a module. +This function descends into data declarations to filter out unexported +data constructors, and also filters out type instance declarations if +they refer to classes or types which are not themselves exported. -import Language.PureScript.AST.Declarations (DataConstructorDeclaration(..), Declaration(..), DeclarationRef(..), Module(..), declName, declRefName, flattenDecls) -import Language.PureScript.Types (Constraint(..), Type(..), everythingOnTypes) -import Language.PureScript.Names (ModuleName, Name(..), ProperName, ProperNameType(..), Qualified, coerceProperName, disqualify, isQualified, isQualifiedWith) - --- | --- Return a list of all declarations which are exported from a module. --- This function descends into data declarations to filter out unexported --- data constructors, and also filters out type instance declarations if --- they refer to classes or types which are not themselves exported. --- --- Note that this function assumes that the module has already had its imports --- desugared using 'Language.PureScript.Sugar.Names.desugarImports'. It will --- produce incorrect results if this is not the case - for example, type class --- instances will be incorrectly removed in some cases. --- --- The returned declarations are in the same order as they appear in the export --- list, unless there is no export list, in which case they appear in the same --- order as they do in the source file. --- --- Kind signatures declarations are also exported if their associated --- declaration is exported. +Note that this function assumes that the module has already had its imports +desugared using 'Language.PureScript.Sugar.Names.desugarImports'. It will +produce incorrect results if this is not the case - for example, type class +instances will be incorrectly removed in some cases. + +The returned declarations are in the same order as they appear in the export +list, unless there is no export list, in which case they appear in the same +order as they do in the source file. + +Kind signatures declarations are also exported if their associated +declaration is exported. +-} exportedDeclarations :: Module -> [Declaration] exportedDeclarations (Module _ _ mn decls exps) = go decls where - go = flattenDecls + go = + flattenDecls >>> filter (isExported exps) >>> map (filterDataConstructors exps) >>> filterInstances mn exps >>> maybe id reorder exps --- | --- Filter out all data constructors from a declaration which are not exported. --- If the supplied declaration is not a data declaration, this function returns --- it unchanged. --- +{- | +Filter out all data constructors from a declaration which are not exported. +If the supplied declaration is not a data declaration, this function returns +it unchanged. +-} filterDataConstructors :: Maybe [DeclarationRef] -> Declaration -> Declaration filterDataConstructors exps (DataDeclaration sa dType tyName tyArgs dctors) = DataDeclaration sa dType tyName tyArgs $ filter (isDctorExported tyName exps . dataCtorName) dctors filterDataConstructors _ other = other --- | --- Filter out all the type instances from a list of declarations which --- reference a type or type class which is both local and not exported. --- --- Note that this function assumes that the module has already had its imports --- desugared using "Language.PureScript.Sugar.Names.desugarImports". It will --- produce incorrect results if this is not the case - for example, type class --- instances will be incorrectly removed in some cases. --- -filterInstances - :: ModuleName - -> Maybe [DeclarationRef] - -> [Declaration] - -> [Declaration] +{- | +Filter out all the type instances from a list of declarations which +reference a type or type class which is both local and not exported. + +Note that this function assumes that the module has already had its imports +desugared using "Language.PureScript.Sugar.Names.desugarImports". It will +produce incorrect results if this is not the case - for example, type class +instances will be incorrectly removed in some cases. +-} +filterInstances :: + ModuleName -> + Maybe [DeclarationRef] -> + [Declaration] -> + [Declaration] filterInstances _ Nothing = id filterInstances mn (Just exps) = - let refs = Left `map` mapMaybe typeClassName exps + let refs = + Left `map` mapMaybe typeClassName exps ++ Right `map` mapMaybe typeName exps - in filter (all (visibleOutside refs) . typeInstanceConstituents) + in filter (all (visibleOutside refs) . typeInstanceConstituents) where - -- Given a Qualified ProperName, and a list of all exported types and type - -- classes, returns whether the supplied Qualified ProperName is visible - -- outside this module. This is true if one of the following hold: - -- - -- * the name is defined in the same module and is exported, - -- * the name is defined in a different module (and must be exported from - -- that module; the code would fail to compile otherwise). - visibleOutside - :: [Either (ProperName 'ClassName) (ProperName 'TypeName)] - -> Either (Qualified (ProperName 'ClassName)) (Qualified (ProperName 'TypeName)) - -> Bool - visibleOutside refs q - | either checkQual checkQual q = True - | otherwise = either (Left . disqualify) (Right . disqualify) q `elem` refs - - -- Check that a qualified name is qualified for a different module - checkQual :: Qualified a -> Bool - checkQual q = isQualified q && not (isQualifiedWith mn q) - - typeName :: DeclarationRef -> Maybe (ProperName 'TypeName) - typeName (TypeRef _ n _) = Just n - typeName _ = Nothing - - typeClassName :: DeclarationRef -> Maybe (ProperName 'ClassName) - typeClassName (TypeClassRef _ n) = Just n - typeClassName _ = Nothing - --- | --- Get all type and type class names referenced by a type instance declaration. --- + -- Given a Qualified ProperName, and a list of all exported types and type + -- classes, returns whether the supplied Qualified ProperName is visible + -- outside this module. This is true if one of the following hold: + -- + -- * the name is defined in the same module and is exported, + -- * the name is defined in a different module (and must be exported from + -- that module; the code would fail to compile otherwise). + visibleOutside :: + [Either (ProperName 'ClassName) (ProperName 'TypeName)] -> + Either (Qualified (ProperName 'ClassName)) (Qualified (ProperName 'TypeName)) -> + Bool + visibleOutside refs q + | either checkQual checkQual q = True + | otherwise = either (Left . disqualify) (Right . disqualify) q `elem` refs + + -- Check that a qualified name is qualified for a different module + checkQual :: Qualified a -> Bool + checkQual q = isQualified q && not (isQualifiedWith mn q) + + typeName :: DeclarationRef -> Maybe (ProperName 'TypeName) + typeName (TypeRef _ n _) = Just n + typeName _ = Nothing + + typeClassName :: DeclarationRef -> Maybe (ProperName 'ClassName) + typeClassName (TypeClassRef _ n) = Just n + typeClassName _ = Nothing + +{- | +Get all type and type class names referenced by a type instance declaration. +-} typeInstanceConstituents :: Declaration -> [Either (Qualified (ProperName 'ClassName)) (Qualified (ProperName 'TypeName))] typeInstanceConstituents (TypeInstanceDeclaration _ _ _ _ _ constraints className tys _) = Left className : (concatMap fromConstraint constraints ++ concatMap fromType tys) where - - fromConstraint c = Left (constraintClass c) : concatMap fromType (constraintArgs c) - fromType = everythingOnTypes (++) go - - -- Note that type synonyms are disallowed in instance declarations, so - -- we don't need to handle them here. - go (TypeConstructor _ n) = [Right n] - go (ConstrainedType _ c _) = fromConstraint c - go _ = [] - + fromConstraint c = Left (constraintClass c) : concatMap fromType (constraintArgs c) + fromType = everythingOnTypes (++) go + + -- Note that type synonyms are disallowed in instance declarations, so + -- we don't need to handle them here. + go (TypeConstructor _ n) = [Right n] + go (ConstrainedType _ c _) = fromConstraint c + go _ = [] typeInstanceConstituents _ = [] - --- | --- Test if a declaration is exported, given a module's export list. Note that --- this function does not account for type instance declarations of --- non-exported types, or non-exported data constructors. Therefore, you should --- prefer 'exportedDeclarations' to this function, where possible. --- +{- | +Test if a declaration is exported, given a module's export list. Note that +this function does not account for type instance declarations of +non-exported types, or non-exported data constructors. Therefore, you should +prefer 'exportedDeclarations' to this function, where possible. +-} isExported :: Maybe [DeclarationRef] -> Declaration -> Bool isExported Nothing _ = True -isExported _ TypeInstanceDeclaration{} = True +isExported _ TypeInstanceDeclaration {} = True isExported (Just exps) (KindDeclaration _ _ n _) = any matches exps where - matches declRef = do - let refName = declRefName declRef - TyName n == refName || TyClassName (tyToClassName n) == refName + matches declRef = do + let refName = declRefName declRef + TyName n == refName || TyClassName (tyToClassName n) == refName isExported (Just exps) decl = any matches exps where - matches declRef = declName decl == Just (declRefName declRef) + matches declRef = declName decl == Just (declRefName declRef) --- | --- Test if a data constructor for a given type is exported, given a module's --- export list. Prefer 'exportedDeclarations' to this function, where possible. --- +{- | +Test if a data constructor for a given type is exported, given a module's +export list. Prefer 'exportedDeclarations' to this function, where possible. +-} isDctorExported :: ProperName 'TypeName -> Maybe [DeclarationRef] -> ProperName 'ConstructorName -> Bool isDctorExported _ Nothing _ = True isDctorExported ident (Just exps) ctor = test `any` exps where - test (TypeRef _ ident' Nothing) = ident == ident' - test (TypeRef _ ident' (Just ctors)) = ident == ident' && ctor `elem` ctors - test _ = False - --- | --- Reorder declarations based on the order they appear in the given export --- list. --- + test (TypeRef _ ident' Nothing) = ident == ident' + test (TypeRef _ ident' (Just ctors)) = ident == ident' && ctor `elem` ctors + test _ = False + +{- | +Reorder declarations based on the order they appear in the given export +list. +-} reorder :: [DeclarationRef] -> [Declaration] -> [Declaration] reorder refs = sortOn refIndex where - refIndices = - M.fromList $ zip (map declRefName refs) [(0::Int)..] - refIndex = \case - KindDeclaration _ _ n _ -> - M.lookup (TyName n) refIndices <|> M.lookup (TyClassName (tyToClassName n)) refIndices - - decl -> declName decl >>= flip M.lookup refIndices - --- | --- Workaround to the fact that a `KindDeclaration`'s name's `ProperNameType` --- isn't the same as the corresponding `TypeClassDeclaration`'s `ProperNameType` + refIndices = + M.fromList $ zip (map declRefName refs) [(0 :: Int) ..] + refIndex = \case + KindDeclaration _ _ n _ -> + M.lookup (TyName n) refIndices <|> M.lookup (TyClassName (tyToClassName n)) refIndices + decl -> declName decl >>= flip M.lookup refIndices + +{- | +Workaround to the fact that a `KindDeclaration`'s name's `ProperNameType` +isn't the same as the corresponding `TypeClassDeclaration`'s `ProperNameType` +-} tyToClassName :: ProperName 'TypeName -> ProperName 'ClassName tyToClassName = coerceProperName diff --git a/src/Language/PureScript/AST/Literals.hs b/src/Language/PureScript/AST/Literals.hs index cfa2e880e..991d08fc9 100644 --- a/src/Language/PureScript/AST/Literals.hs +++ b/src/Language/PureScript/AST/Literals.hs @@ -1,38 +1,48 @@ --- | --- The core functional representation for literal values. --- +{- | +The core functional representation for literal values. +-} module Language.PureScript.AST.Literals where -import Prelude import Language.PureScript.PSString (PSString) +import Prelude + +-- For serializing/deserializing Typed CoreFn + +import Data.Aeson (FromJSON, ToJSON) +import GHC.Generics (Generic) + +{- | +Data type for literal values. Parameterised so it can be used for Exprs and +Binders. +-} +data Literal a -- a ~ Expr Ann + = -- | + -- A numeric literal + NumericLiteral (Either Integer Double) + | -- | + -- A string literal + StringLiteral PSString + | -- | + -- A character literal + CharLiteral Char + | -- | + -- A boolean literal + BooleanLiteral Bool + | -- | + -- An array literal + ListLiteral [a] + | -- | ListLiteral [Literal Void] + -- | + -- An object literal + ObjectLiteral [(PSString, a)] + deriving stock (Eq, Ord, Show, Functor, Generic, Traversable) + +instance (FromJSON a) => FromJSON (Literal a) +instance (ToJSON a) => ToJSON (Literal a) --- | --- Data type for literal values. Parameterised so it can be used for Exprs and --- Binders. --- -data Literal a - -- | - -- A numeric literal - -- - = NumericLiteral (Either Integer Double) - -- | - -- A string literal - -- - | StringLiteral PSString - -- | - -- A character literal - -- - | CharLiteral Char - -- | - -- A boolean literal - -- - | BooleanLiteral Bool - -- | - -- An array literal - -- - | ArrayLiteral [a] - -- | - -- An object literal - -- - | ObjectLiteral [(PSString, a)] - deriving (Eq, Ord, Show, Functor) +instance Foldable Literal where + {-# INLINEABLE foldMap #-} + foldMap f = \case + ListLiteral lits -> foldMap f lits + ObjectLiteral lits -> foldMap (f . snd) lits + _ -> mempty diff --git a/src/Language/PureScript/AST/Operators.hs b/src/Language/PureScript/AST/Operators.hs index eb217a244..5e2f6f2dd 100644 --- a/src/Language/PureScript/AST/Operators.hs +++ b/src/Language/PureScript/AST/Operators.hs @@ -1,26 +1,26 @@ --- | --- Operators fixity and associativity --- +{- | +Operators fixity and associativity +-} module Language.PureScript.AST.Operators where import Prelude import Codec.Serialise (Serialise) -import GHC.Generics (Generic) import Control.DeepSeq (NFData) import Data.Aeson ((.=)) import Data.Aeson qualified as A +import GHC.Generics (Generic) import Language.PureScript.Crash (internalError) --- | --- A precedence level for an infix operator --- +{- | +A precedence level for an infix operator +-} type Precedence = Integer --- | --- Associativity for infix operators --- +{- | +Associativity for infix operators +-} data Associativity = Infixl | Infixr | Infix deriving (Show, Eq, Ord, Generic) @@ -30,12 +30,12 @@ instance Serialise Associativity showAssoc :: Associativity -> String showAssoc Infixl = "infixl" showAssoc Infixr = "infixr" -showAssoc Infix = "infix" +showAssoc Infix = "infix" readAssoc :: String -> Associativity readAssoc "infixl" = Infixl readAssoc "infixr" = Infixr -readAssoc "infix" = Infix +readAssoc "infix" = Infix readAssoc _ = internalError "readAssoc: no parse" instance A.ToJSON Associativity where @@ -44,9 +44,9 @@ instance A.ToJSON Associativity where instance A.FromJSON Associativity where parseJSON = fmap readAssoc . A.parseJSON --- | --- Fixity data for infix operators --- +{- | +Fixity data for infix operators +-} data Fixity = Fixity Associativity Precedence deriving (Show, Eq, Ord, Generic) @@ -55,6 +55,7 @@ instance Serialise Fixity instance A.ToJSON Fixity where toJSON (Fixity associativity precedence) = - A.object [ "associativity" .= associativity - , "precedence" .= precedence - ] + A.object + [ "associativity" .= associativity + , "precedence" .= precedence + ] diff --git a/src/Language/PureScript/AST/SourcePos.hs b/src/Language/PureScript/AST/SourcePos.hs index 262d44b6a..cf038b5b0 100644 --- a/src/Language/PureScript/AST/SourcePos.hs +++ b/src/Language/PureScript/AST/SourcePos.hs @@ -1,19 +1,20 @@ {-# LANGUAGE DeriveAnyClass #-} --- | --- Source position information --- + +{- | +Source position information +-} module Language.PureScript.AST.SourcePos where import Prelude import Codec.Serialise (Serialise) import Control.DeepSeq (NFData) -import Data.Aeson ((.=), (.:)) +import Data.Aeson ((.:), (.=)) +import Data.Aeson qualified as A import Data.Text (Text) +import Data.Text qualified as T import GHC.Generics (Generic) import Language.PureScript.Comments (Comment) -import Data.Aeson qualified as A -import Data.Text qualified as T import System.FilePath (makeRelative) -- | Source annotation - position information and comments. @@ -22,23 +23,27 @@ type SourceAnn = (SourceSpan, [Comment]) -- | Source position information data SourcePos = SourcePos { sourcePosLine :: Int - -- ^ Line number + -- ^ Line number , sourcePosColumn :: Int - -- ^ Column number - } deriving (Show, Eq, Ord, Generic, NFData, Serialise) + -- ^ Column number + } + deriving (Show, Eq, Ord, Generic, NFData, Serialise) displaySourcePos :: SourcePos -> Text displaySourcePos sp = - "line " <> T.pack (show (sourcePosLine sp)) <> - ", column " <> T.pack (show (sourcePosColumn sp)) + "line " + <> T.pack (show (sourcePosLine sp)) + <> ", column " + <> T.pack (show (sourcePosColumn sp)) displaySourcePosShort :: SourcePos -> Text displaySourcePosShort sp = - T.pack (show (sourcePosLine sp)) <> - ":" <> T.pack (show (sourcePosColumn sp)) + T.pack (show (sourcePosLine sp)) + <> ":" + <> T.pack (show (sourcePosColumn sp)) instance A.ToJSON SourcePos where - toJSON SourcePos{..} = + toJSON SourcePos {..} = A.toJSON [sourcePosLine, sourcePosColumn] instance A.FromJSON SourcePos where @@ -48,43 +53,50 @@ instance A.FromJSON SourcePos where data SourceSpan = SourceSpan { spanName :: String - -- ^ Source name + -- ^ Source name , spanStart :: SourcePos - -- ^ Start of the span + -- ^ Start of the span , spanEnd :: SourcePos - -- ^ End of the span - } deriving (Show, Eq, Ord, Generic, NFData, Serialise) + -- ^ End of the span + } + deriving (Show, Eq, Ord, Generic, NFData, Serialise) displayStartEndPos :: SourceSpan -> Text displayStartEndPos sp = - "(" <> - displaySourcePos (spanStart sp) <> " - " <> - displaySourcePos (spanEnd sp) <> ")" + "(" + <> displaySourcePos (spanStart sp) + <> " - " + <> displaySourcePos (spanEnd sp) + <> ")" displayStartEndPosShort :: SourceSpan -> Text displayStartEndPosShort sp = - displaySourcePosShort (spanStart sp) <> " - " <> - displaySourcePosShort (spanEnd sp) + displaySourcePosShort (spanStart sp) + <> " - " + <> displaySourcePosShort (spanEnd sp) displaySourceSpan :: FilePath -> SourceSpan -> Text displaySourceSpan relPath sp = - T.pack (makeRelative relPath (spanName sp)) <> ":" <> - displayStartEndPosShort sp <> " " <> - displayStartEndPos sp + T.pack (makeRelative relPath (spanName sp)) + <> ":" + <> displayStartEndPosShort sp + <> " " + <> displayStartEndPos sp instance A.ToJSON SourceSpan where - toJSON SourceSpan{..} = - A.object [ "name" .= spanName - , "start" .= spanStart - , "end" .= spanEnd - ] + toJSON SourceSpan {..} = + A.object + [ "name" .= spanName + , "start" .= spanStart + , "end" .= spanEnd + ] instance A.FromJSON SourceSpan where parseJSON = A.withObject "SourceSpan" $ \o -> - SourceSpan <$> - o .: "name" <*> - o .: "start" <*> - o .: "end" + SourceSpan + <$> o .: "name" + <*> o .: "start" + <*> o .: "end" internalModuleSourceSpan :: String -> SourceSpan internalModuleSourceSpan name = SourceSpan name (SourcePos 0 0) (SourcePos 0 0) @@ -111,8 +123,9 @@ widenSourceSpan a NullSourceSpan = a widenSourceSpan (SourceSpan n1 s1 e1) (SourceSpan n2 s2 e2) = SourceSpan n (min s1 s2) (max e1 e2) where - n | n1 == "" = n2 - | otherwise = n1 + n + | n1 == "" = n2 + | otherwise = n1 widenSourceAnn :: SourceAnn -> SourceAnn -> SourceAnn widenSourceAnn (s1, _) (s2, _) = (widenSourceSpan s1 s2, []) diff --git a/src/Language/PureScript/AST/Traversals.hs b/src/Language/PureScript/AST/Traversals.hs index abbe6e5a1..daac4b0a0 100644 --- a/src/Language/PureScript/AST/Traversals.hs +++ b/src/Language/PureScript/AST/Traversals.hs @@ -1,542 +1,542 @@ --- | --- AST traversal helpers --- +{- | +AST traversal helpers +-} module Language.PureScript.AST.Traversals where -import Prelude import Protolude (swap) +import Prelude import Control.Monad ((<=<), (>=>)) -import Control.Monad.Trans.State (StateT(..)) +import Control.Monad.Trans.State (StateT (..)) import Data.Foldable (fold) import Data.Functor.Identity (runIdentity) import Data.List (mapAccumL) -import Data.Maybe (mapMaybe) import Data.List.NonEmpty qualified as NEL import Data.Map qualified as M +import Data.Maybe (mapMaybe) import Data.Set qualified as S -import Language.PureScript.AST.Binders (Binder(..), binderNames) -import Language.PureScript.AST.Declarations (CaseAlternative(..), DataConstructorDeclaration(..), Declaration(..), DoNotationElement(..), Expr(..), Guard(..), GuardedExpr(..), TypeDeclarationData(..), TypeInstanceBody(..), pattern ValueDecl, ValueDeclarationData(..), mapTypeInstanceBody, traverseTypeInstanceBody) -import Language.PureScript.AST.Literals (Literal(..)) -import Language.PureScript.Names (pattern ByNullSourcePos, Ident) +import Language.PureScript.AST.Binders (Binder (..), binderNames) +import Language.PureScript.AST.Declarations (CaseAlternative (..), DataConstructorDeclaration (..), Declaration (..), DoNotationElement (..), Expr (..), Guard (..), GuardedExpr (..), TypeDeclarationData (..), TypeInstanceBody (..), ValueDeclarationData (..), mapTypeInstanceBody, traverseTypeInstanceBody, pattern ValueDecl) +import Language.PureScript.AST.Literals (Literal (..)) +import Language.PureScript.Names (Ident, pattern ByNullSourcePos) import Language.PureScript.Traversals (sndM, sndM', thirdM) -import Language.PureScript.TypeClassDictionaries (TypeClassDictionaryInScope(..)) -import Language.PureScript.Types (Constraint(..), SourceType, mapConstraintArgs) - -guardedExprM :: Applicative m - => (Guard -> m Guard) - -> (Expr -> m Expr) - -> GuardedExpr - -> m GuardedExpr +import Language.PureScript.TypeClassDictionaries (TypeClassDictionaryInScope (..)) +import Language.PureScript.Types (Constraint (..), SourceType, mapConstraintArgs) + +guardedExprM :: + (Applicative m) => + (Guard -> m Guard) -> + (Expr -> m Expr) -> + GuardedExpr -> + m GuardedExpr guardedExprM f g (GuardedExpr guards rhs) = GuardedExpr <$> traverse f guards <*> g rhs -mapGuardedExpr :: (Guard -> Guard) - -> (Expr -> Expr) - -> GuardedExpr - -> GuardedExpr +mapGuardedExpr :: + (Guard -> Guard) -> + (Expr -> Expr) -> + GuardedExpr -> + GuardedExpr mapGuardedExpr f g (GuardedExpr guards rhs) = GuardedExpr (fmap f guards) (g rhs) -litM :: Monad m => (a -> m a) -> Literal a -> m (Literal a) +litM :: (Monad m) => (a -> m a) -> Literal a -> m (Literal a) litM go (ObjectLiteral as) = ObjectLiteral <$> traverse (sndM go) as -litM go (ArrayLiteral as) = ArrayLiteral <$> traverse go as +litM go (ListLiteral as) = ListLiteral <$> traverse go as litM _ other = pure other -everywhereOnValues - :: (Declaration -> Declaration) - -> (Expr -> Expr) - -> (Binder -> Binder) - -> ( Declaration -> Declaration - , Expr -> Expr - , Binder -> Binder - ) +everywhereOnValues :: + (Declaration -> Declaration) -> + (Expr -> Expr) -> + (Binder -> Binder) -> + ( Declaration -> Declaration + , Expr -> Expr + , Binder -> Binder + ) everywhereOnValues f g h = (f', g', h') where - f' :: Declaration -> Declaration - f' (DataBindingGroupDeclaration ds) = f (DataBindingGroupDeclaration (fmap f' ds)) - f' (ValueDecl sa name nameKind bs val) = - f (ValueDecl sa name nameKind (fmap h' bs) (fmap (mapGuardedExpr handleGuard g') val)) - f' (BoundValueDeclaration sa b expr) = f (BoundValueDeclaration sa (h' b) (g' expr)) - f' (BindingGroupDeclaration ds) = f (BindingGroupDeclaration (fmap (\(name, nameKind, val) -> (name, nameKind, g' val)) ds)) - f' (TypeClassDeclaration sa name args implies deps ds) = f (TypeClassDeclaration sa name args implies deps (fmap f' ds)) - f' (TypeInstanceDeclaration sa na ch idx name cs className args ds) = f (TypeInstanceDeclaration sa na ch idx name cs className args (mapTypeInstanceBody (fmap f') ds)) - f' other = f other - - g' :: Expr -> Expr - g' (Literal ss l) = g (Literal ss (lit g' l)) - g' (UnaryMinus ss v) = g (UnaryMinus ss (g' v)) - g' (BinaryNoParens op v1 v2) = g (BinaryNoParens (g' op) (g' v1) (g' v2)) - g' (Parens v) = g (Parens (g' v)) - g' (Accessor prop v) = g (Accessor prop (g' v)) - g' (ObjectUpdate obj vs) = g (ObjectUpdate (g' obj) (fmap (fmap g') vs)) - g' (ObjectUpdateNested obj vs) = g (ObjectUpdateNested (g' obj) (fmap g' vs)) - g' (Abs binder v) = g (Abs (h' binder) (g' v)) - g' (App v1 v2) = g (App (g' v1) (g' v2)) - g' (VisibleTypeApp v ty) = g (VisibleTypeApp (g' v) ty) - g' (Unused v) = g (Unused (g' v)) - g' (IfThenElse v1 v2 v3) = g (IfThenElse (g' v1) (g' v2) (g' v3)) - g' (Case vs alts) = g (Case (fmap g' vs) (fmap handleCaseAlternative alts)) - g' (TypedValue check v ty) = g (TypedValue check (g' v) ty) - g' (Let w ds v) = g (Let w (fmap f' ds) (g' v)) - g' (Do m es) = g (Do m (fmap handleDoNotationElement es)) - g' (Ado m es v) = g (Ado m (fmap handleDoNotationElement es) (g' v)) - g' (PositionedValue pos com v) = g (PositionedValue pos com (g' v)) - g' other = g other - - h' :: Binder -> Binder - h' (ConstructorBinder ss ctor bs) = h (ConstructorBinder ss ctor (fmap h' bs)) - h' (BinaryNoParensBinder b1 b2 b3) = h (BinaryNoParensBinder (h' b1) (h' b2) (h' b3)) - h' (ParensInBinder b) = h (ParensInBinder (h' b)) - h' (LiteralBinder ss l) = h (LiteralBinder ss (lit h' l)) - h' (NamedBinder ss name b) = h (NamedBinder ss name (h' b)) - h' (PositionedBinder pos com b) = h (PositionedBinder pos com (h' b)) - h' (TypedBinder t b) = h (TypedBinder t (h' b)) - h' other = h other - - lit :: (a -> a) -> Literal a -> Literal a - lit go (ArrayLiteral as) = ArrayLiteral (fmap go as) - lit go (ObjectLiteral as) = ObjectLiteral (fmap (fmap go) as) - lit _ other = other - - handleCaseAlternative :: CaseAlternative -> CaseAlternative - handleCaseAlternative ca = - ca { caseAlternativeBinders = fmap h' (caseAlternativeBinders ca) - , caseAlternativeResult = fmap (mapGuardedExpr handleGuard g') (caseAlternativeResult ca) - } - - handleDoNotationElement :: DoNotationElement -> DoNotationElement - handleDoNotationElement (DoNotationValue v) = DoNotationValue (g' v) - handleDoNotationElement (DoNotationBind b v) = DoNotationBind (h' b) (g' v) - handleDoNotationElement (DoNotationLet ds) = DoNotationLet (fmap f' ds) - handleDoNotationElement (PositionedDoNotationElement pos com e) = PositionedDoNotationElement pos com (handleDoNotationElement e) - - handleGuard :: Guard -> Guard - handleGuard (ConditionGuard e) = ConditionGuard (g' e) - handleGuard (PatternGuard b e) = PatternGuard (h' b) (g' e) - -everywhereOnValuesTopDownM - :: forall m - . (Monad m) - => (Declaration -> m Declaration) - -> (Expr -> m Expr) - -> (Binder -> m Binder) - -> ( Declaration -> m Declaration - , Expr -> m Expr - , Binder -> m Binder - ) + f' :: Declaration -> Declaration + f' (DataBindingGroupDeclaration ds) = f (DataBindingGroupDeclaration (fmap f' ds)) + f' (ValueDecl sa name nameKind bs val) = + f (ValueDecl sa name nameKind (fmap h' bs) (fmap (mapGuardedExpr handleGuard g') val)) + f' (BoundValueDeclaration sa b expr) = f (BoundValueDeclaration sa (h' b) (g' expr)) + f' (BindingGroupDeclaration ds) = f (BindingGroupDeclaration (fmap (\(name, nameKind, val) -> (name, nameKind, g' val)) ds)) + f' (TypeClassDeclaration sa name args implies deps ds) = f (TypeClassDeclaration sa name args implies deps (fmap f' ds)) + f' (TypeInstanceDeclaration sa na ch idx name cs className args ds) = f (TypeInstanceDeclaration sa na ch idx name cs className args (mapTypeInstanceBody (fmap f') ds)) + f' other = f other + + g' :: Expr -> Expr + g' (Literal ss l) = g (Literal ss (lit g' l)) + g' (UnaryMinus ss v) = g (UnaryMinus ss (g' v)) + g' (BinaryNoParens op v1 v2) = g (BinaryNoParens (g' op) (g' v1) (g' v2)) + g' (Parens v) = g (Parens (g' v)) + g' (Accessor prop v) = g (Accessor prop (g' v)) + g' (ObjectUpdate obj vs) = g (ObjectUpdate (g' obj) (fmap (fmap g') vs)) + g' (ObjectUpdateNested obj vs) = g (ObjectUpdateNested (g' obj) (fmap g' vs)) + g' (Abs binder v) = g (Abs (h' binder) (g' v)) + g' (App v1 v2) = g (App (g' v1) (g' v2)) + g' (VisibleTypeApp v ty) = g (VisibleTypeApp (g' v) ty) + g' (Unused v) = g (Unused (g' v)) + g' (IfThenElse v1 v2 v3) = g (IfThenElse (g' v1) (g' v2) (g' v3)) + g' (Case vs alts) = g (Case (fmap g' vs) (fmap handleCaseAlternative alts)) + g' (TypedValue check v ty) = g (TypedValue check (g' v) ty) + g' (Let w ds v) = g (Let w (fmap f' ds) (g' v)) + g' (Do m es) = g (Do m (fmap handleDoNotationElement es)) + g' (Ado m es v) = g (Ado m (fmap handleDoNotationElement es) (g' v)) + g' (PositionedValue pos com v) = g (PositionedValue pos com (g' v)) + g' other = g other + + h' :: Binder -> Binder + h' (ConstructorBinder ss ctor bs) = h (ConstructorBinder ss ctor (fmap h' bs)) + h' (BinaryNoParensBinder b1 b2 b3) = h (BinaryNoParensBinder (h' b1) (h' b2) (h' b3)) + h' (ParensInBinder b) = h (ParensInBinder (h' b)) + h' (LiteralBinder ss l) = h (LiteralBinder ss (lit h' l)) + h' (NamedBinder ss name b) = h (NamedBinder ss name (h' b)) + h' (PositionedBinder pos com b) = h (PositionedBinder pos com (h' b)) + h' (TypedBinder t b) = h (TypedBinder t (h' b)) + h' other = h other + + lit :: (a -> a) -> Literal a -> Literal a + lit go (ListLiteral as) = ListLiteral (fmap go as) + lit go (ObjectLiteral as) = ObjectLiteral (fmap (fmap go) as) + lit _ other = other + + handleCaseAlternative :: CaseAlternative -> CaseAlternative + handleCaseAlternative ca = + ca + { caseAlternativeBinders = fmap h' (caseAlternativeBinders ca) + , caseAlternativeResult = fmap (mapGuardedExpr handleGuard g') (caseAlternativeResult ca) + } + + handleDoNotationElement :: DoNotationElement -> DoNotationElement + handleDoNotationElement (DoNotationValue v) = DoNotationValue (g' v) + handleDoNotationElement (DoNotationBind b v) = DoNotationBind (h' b) (g' v) + handleDoNotationElement (DoNotationLet ds) = DoNotationLet (fmap f' ds) + handleDoNotationElement (PositionedDoNotationElement pos com e) = PositionedDoNotationElement pos com (handleDoNotationElement e) + + handleGuard :: Guard -> Guard + handleGuard (ConditionGuard e) = ConditionGuard (g' e) + handleGuard (PatternGuard b e) = PatternGuard (h' b) (g' e) + +everywhereOnValuesTopDownM :: + forall m. + (Monad m) => + (Declaration -> m Declaration) -> + (Expr -> m Expr) -> + (Binder -> m Binder) -> + ( Declaration -> m Declaration + , Expr -> m Expr + , Binder -> m Binder + ) everywhereOnValuesTopDownM f g h = (f' <=< f, g' <=< g, h' <=< h) where - - f' :: Declaration -> m Declaration - f' (DataBindingGroupDeclaration ds) = DataBindingGroupDeclaration <$> traverse (f' <=< f) ds - f' (ValueDecl sa name nameKind bs val) = - ValueDecl sa name nameKind <$> traverse (h' <=< h) bs <*> traverse (guardedExprM handleGuard (g' <=< g)) val - f' (BindingGroupDeclaration ds) = BindingGroupDeclaration <$> traverse (\(name, nameKind, val) -> (name, nameKind, ) <$> (g val >>= g')) ds - f' (TypeClassDeclaration sa name args implies deps ds) = TypeClassDeclaration sa name args implies deps <$> traverse (f' <=< f) ds - f' (TypeInstanceDeclaration sa na ch idx name cs className args ds) = TypeInstanceDeclaration sa na ch idx name cs className args <$> traverseTypeInstanceBody (traverse (f' <=< f)) ds - f' (BoundValueDeclaration sa b expr) = BoundValueDeclaration sa <$> (h' <=< h) b <*> (g' <=< g) expr - f' other = f other - - g' :: Expr -> m Expr - g' (Literal ss l) = Literal ss <$> litM (g >=> g') l - g' (UnaryMinus ss v) = UnaryMinus ss <$> (g v >>= g') - g' (BinaryNoParens op v1 v2) = BinaryNoParens <$> (g op >>= g') <*> (g v1 >>= g') <*> (g v2 >>= g') - g' (Parens v) = Parens <$> (g v >>= g') - g' (Accessor prop v) = Accessor prop <$> (g v >>= g') - g' (ObjectUpdate obj vs) = ObjectUpdate <$> (g obj >>= g') <*> traverse (sndM (g' <=< g)) vs - g' (ObjectUpdateNested obj vs) = ObjectUpdateNested <$> (g obj >>= g') <*> traverse (g' <=< g) vs - g' (Abs binder v) = Abs <$> (h binder >>= h') <*> (g v >>= g') - g' (App v1 v2) = App <$> (g v1 >>= g') <*> (g v2 >>= g') - g' (VisibleTypeApp v ty) = VisibleTypeApp <$> (g v >>= g') <*> pure ty - g' (Unused v) = Unused <$> (g v >>= g') - g' (IfThenElse v1 v2 v3) = IfThenElse <$> (g v1 >>= g') <*> (g v2 >>= g') <*> (g v3 >>= g') - g' (Case vs alts) = Case <$> traverse (g' <=< g) vs <*> traverse handleCaseAlternative alts - g' (TypedValue check v ty) = TypedValue check <$> (g v >>= g') <*> pure ty - g' (Let w ds v) = Let w <$> traverse (f' <=< f) ds <*> (g v >>= g') - g' (Do m es) = Do m <$> traverse handleDoNotationElement es - g' (Ado m es v) = Ado m <$> traverse handleDoNotationElement es <*> (g v >>= g') - g' (PositionedValue pos com v) = PositionedValue pos com <$> (g v >>= g') - g' other = g other - - h' :: Binder -> m Binder - h' (LiteralBinder ss l) = LiteralBinder ss <$> litM (h >=> h') l - h' (ConstructorBinder ss ctor bs) = ConstructorBinder ss ctor <$> traverse (h' <=< h) bs - h' (BinaryNoParensBinder b1 b2 b3) = BinaryNoParensBinder <$> (h b1 >>= h') <*> (h b2 >>= h') <*> (h b3 >>= h') - h' (ParensInBinder b) = ParensInBinder <$> (h b >>= h') - h' (NamedBinder ss name b) = NamedBinder ss name <$> (h b >>= h') - h' (PositionedBinder pos com b) = PositionedBinder pos com <$> (h b >>= h') - h' (TypedBinder t b) = TypedBinder t <$> (h b >>= h') - h' other = h other - - handleCaseAlternative :: CaseAlternative -> m CaseAlternative - handleCaseAlternative (CaseAlternative bs val) = - CaseAlternative - <$> traverse (h' <=< h) bs - <*> traverse (guardedExprM handleGuard (g' <=< g)) val - - handleDoNotationElement :: DoNotationElement -> m DoNotationElement - handleDoNotationElement (DoNotationValue v) = DoNotationValue <$> (g' <=< g) v - handleDoNotationElement (DoNotationBind b v) = DoNotationBind <$> (h' <=< h) b <*> (g' <=< g) v - handleDoNotationElement (DoNotationLet ds) = DoNotationLet <$> traverse (f' <=< f) ds - handleDoNotationElement (PositionedDoNotationElement pos com e) = PositionedDoNotationElement pos com <$> handleDoNotationElement e - - handleGuard :: Guard -> m Guard - handleGuard (ConditionGuard e) = ConditionGuard <$> (g' <=< g) e - handleGuard (PatternGuard b e) = PatternGuard <$> (h' <=< h) b <*> (g' <=< g) e - -everywhereOnValuesM - :: forall m - . (Monad m) - => (Declaration -> m Declaration) - -> (Expr -> m Expr) - -> (Binder -> m Binder) - -> ( Declaration -> m Declaration - , Expr -> m Expr - , Binder -> m Binder - ) + f' :: Declaration -> m Declaration + f' (DataBindingGroupDeclaration ds) = DataBindingGroupDeclaration <$> traverse (f' <=< f) ds + f' (ValueDecl sa name nameKind bs val) = + ValueDecl sa name nameKind <$> traverse (h' <=< h) bs <*> traverse (guardedExprM handleGuard (g' <=< g)) val + f' (BindingGroupDeclaration ds) = BindingGroupDeclaration <$> traverse (\(name, nameKind, val) -> (name,nameKind,) <$> (g val >>= g')) ds + f' (TypeClassDeclaration sa name args implies deps ds) = TypeClassDeclaration sa name args implies deps <$> traverse (f' <=< f) ds + f' (TypeInstanceDeclaration sa na ch idx name cs className args ds) = TypeInstanceDeclaration sa na ch idx name cs className args <$> traverseTypeInstanceBody (traverse (f' <=< f)) ds + f' (BoundValueDeclaration sa b expr) = BoundValueDeclaration sa <$> (h' <=< h) b <*> (g' <=< g) expr + f' other = f other + + g' :: Expr -> m Expr + g' (Literal ss l) = Literal ss <$> litM (g >=> g') l + g' (UnaryMinus ss v) = UnaryMinus ss <$> (g v >>= g') + g' (BinaryNoParens op v1 v2) = BinaryNoParens <$> (g op >>= g') <*> (g v1 >>= g') <*> (g v2 >>= g') + g' (Parens v) = Parens <$> (g v >>= g') + g' (Accessor prop v) = Accessor prop <$> (g v >>= g') + g' (ObjectUpdate obj vs) = ObjectUpdate <$> (g obj >>= g') <*> traverse (sndM (g' <=< g)) vs + g' (ObjectUpdateNested obj vs) = ObjectUpdateNested <$> (g obj >>= g') <*> traverse (g' <=< g) vs + g' (Abs binder v) = Abs <$> (h binder >>= h') <*> (g v >>= g') + g' (App v1 v2) = App <$> (g v1 >>= g') <*> (g v2 >>= g') + g' (VisibleTypeApp v ty) = VisibleTypeApp <$> (g v >>= g') <*> pure ty + g' (Unused v) = Unused <$> (g v >>= g') + g' (IfThenElse v1 v2 v3) = IfThenElse <$> (g v1 >>= g') <*> (g v2 >>= g') <*> (g v3 >>= g') + g' (Case vs alts) = Case <$> traverse (g' <=< g) vs <*> traverse handleCaseAlternative alts + g' (TypedValue check v ty) = TypedValue check <$> (g v >>= g') <*> pure ty + g' (Let w ds v) = Let w <$> traverse (f' <=< f) ds <*> (g v >>= g') + g' (Do m es) = Do m <$> traverse handleDoNotationElement es + g' (Ado m es v) = Ado m <$> traverse handleDoNotationElement es <*> (g v >>= g') + g' (PositionedValue pos com v) = PositionedValue pos com <$> (g v >>= g') + g' other = g other + + h' :: Binder -> m Binder + h' (LiteralBinder ss l) = LiteralBinder ss <$> litM (h >=> h') l + h' (ConstructorBinder ss ctor bs) = ConstructorBinder ss ctor <$> traverse (h' <=< h) bs + h' (BinaryNoParensBinder b1 b2 b3) = BinaryNoParensBinder <$> (h b1 >>= h') <*> (h b2 >>= h') <*> (h b3 >>= h') + h' (ParensInBinder b) = ParensInBinder <$> (h b >>= h') + h' (NamedBinder ss name b) = NamedBinder ss name <$> (h b >>= h') + h' (PositionedBinder pos com b) = PositionedBinder pos com <$> (h b >>= h') + h' (TypedBinder t b) = TypedBinder t <$> (h b >>= h') + h' other = h other + + handleCaseAlternative :: CaseAlternative -> m CaseAlternative + handleCaseAlternative (CaseAlternative bs val) = + CaseAlternative + <$> traverse (h' <=< h) bs + <*> traverse (guardedExprM handleGuard (g' <=< g)) val + + handleDoNotationElement :: DoNotationElement -> m DoNotationElement + handleDoNotationElement (DoNotationValue v) = DoNotationValue <$> (g' <=< g) v + handleDoNotationElement (DoNotationBind b v) = DoNotationBind <$> (h' <=< h) b <*> (g' <=< g) v + handleDoNotationElement (DoNotationLet ds) = DoNotationLet <$> traverse (f' <=< f) ds + handleDoNotationElement (PositionedDoNotationElement pos com e) = PositionedDoNotationElement pos com <$> handleDoNotationElement e + + handleGuard :: Guard -> m Guard + handleGuard (ConditionGuard e) = ConditionGuard <$> (g' <=< g) e + handleGuard (PatternGuard b e) = PatternGuard <$> (h' <=< h) b <*> (g' <=< g) e + +everywhereOnValuesM :: + forall m. + (Monad m) => + (Declaration -> m Declaration) -> + (Expr -> m Expr) -> + (Binder -> m Binder) -> + ( Declaration -> m Declaration + , Expr -> m Expr + , Binder -> m Binder + ) everywhereOnValuesM f g h = (f', g', h') where - - f' :: Declaration -> m Declaration - f' (DataBindingGroupDeclaration ds) = (DataBindingGroupDeclaration <$> traverse f' ds) >>= f - f' (ValueDecl sa name nameKind bs val) = - ValueDecl sa name nameKind <$> traverse h' bs <*> traverse (guardedExprM handleGuard g') val >>= f - f' (BindingGroupDeclaration ds) = (BindingGroupDeclaration <$> traverse (\(name, nameKind, val) -> (name, nameKind, ) <$> g' val) ds) >>= f - f' (BoundValueDeclaration sa b expr) = (BoundValueDeclaration sa <$> h' b <*> g' expr) >>= f - f' (TypeClassDeclaration sa name args implies deps ds) = (TypeClassDeclaration sa name args implies deps <$> traverse f' ds) >>= f - f' (TypeInstanceDeclaration sa na ch idx name cs className args ds) = (TypeInstanceDeclaration sa na ch idx name cs className args <$> traverseTypeInstanceBody (traverse f') ds) >>= f - f' other = f other - - g' :: Expr -> m Expr - g' (Literal ss l) = (Literal ss <$> litM g' l) >>= g - g' (UnaryMinus ss v) = (UnaryMinus ss <$> g' v) >>= g - g' (BinaryNoParens op v1 v2) = (BinaryNoParens <$> g' op <*> g' v1 <*> g' v2) >>= g - g' (Parens v) = (Parens <$> g' v) >>= g - g' (Accessor prop v) = (Accessor prop <$> g' v) >>= g - g' (ObjectUpdate obj vs) = (ObjectUpdate <$> g' obj <*> traverse (sndM g') vs) >>= g - g' (ObjectUpdateNested obj vs) = (ObjectUpdateNested <$> g' obj <*> traverse g' vs) >>= g - g' (Abs binder v) = (Abs <$> h' binder <*> g' v) >>= g - g' (App v1 v2) = (App <$> g' v1 <*> g' v2) >>= g - g' (VisibleTypeApp v ty) = (VisibleTypeApp <$> g' v <*> pure ty) >>= g - g' (Unused v) = (Unused <$> g' v) >>= g - g' (IfThenElse v1 v2 v3) = (IfThenElse <$> g' v1 <*> g' v2 <*> g' v3) >>= g - g' (Case vs alts) = (Case <$> traverse g' vs <*> traverse handleCaseAlternative alts) >>= g - g' (TypedValue check v ty) = (TypedValue check <$> g' v <*> pure ty) >>= g - g' (Let w ds v) = (Let w <$> traverse f' ds <*> g' v) >>= g - g' (Do m es) = (Do m <$> traverse handleDoNotationElement es) >>= g - g' (Ado m es v) = (Ado m <$> traverse handleDoNotationElement es <*> g' v) >>= g - g' (PositionedValue pos com v) = (PositionedValue pos com <$> g' v) >>= g - g' other = g other - - h' :: Binder -> m Binder - h' (LiteralBinder ss l) = (LiteralBinder ss <$> litM h' l) >>= h - h' (ConstructorBinder ss ctor bs) = (ConstructorBinder ss ctor <$> traverse h' bs) >>= h - h' (BinaryNoParensBinder b1 b2 b3) = (BinaryNoParensBinder <$> h' b1 <*> h' b2 <*> h' b3) >>= h - h' (ParensInBinder b) = (ParensInBinder <$> h' b) >>= h - h' (NamedBinder ss name b) = (NamedBinder ss name <$> h' b) >>= h - h' (PositionedBinder pos com b) = (PositionedBinder pos com <$> h' b) >>= h - h' (TypedBinder t b) = (TypedBinder t <$> h' b) >>= h - h' other = h other - - handleCaseAlternative :: CaseAlternative -> m CaseAlternative - handleCaseAlternative (CaseAlternative bs val) = - CaseAlternative - <$> traverse h' bs - <*> traverse (guardedExprM handleGuard g') val - - handleDoNotationElement :: DoNotationElement -> m DoNotationElement - handleDoNotationElement (DoNotationValue v) = DoNotationValue <$> g' v - handleDoNotationElement (DoNotationBind b v) = DoNotationBind <$> h' b <*> g' v - handleDoNotationElement (DoNotationLet ds) = DoNotationLet <$> traverse f' ds - handleDoNotationElement (PositionedDoNotationElement pos com e) = PositionedDoNotationElement pos com <$> handleDoNotationElement e - - handleGuard :: Guard -> m Guard - handleGuard (ConditionGuard e) = ConditionGuard <$> g' e - handleGuard (PatternGuard b e) = PatternGuard <$> h' b <*> g' e - -everythingOnValues - :: forall r - . (r -> r -> r) - -> (Declaration -> r) - -> (Expr -> r) - -> (Binder -> r) - -> (CaseAlternative -> r) - -> (DoNotationElement -> r) - -> ( Declaration -> r - , Expr -> r - , Binder -> r - , CaseAlternative -> r - , DoNotationElement -> r - ) + f' :: Declaration -> m Declaration + f' (DataBindingGroupDeclaration ds) = (DataBindingGroupDeclaration <$> traverse f' ds) >>= f + f' (ValueDecl sa name nameKind bs val) = + ValueDecl sa name nameKind <$> traverse h' bs <*> traverse (guardedExprM handleGuard g') val >>= f + f' (BindingGroupDeclaration ds) = (BindingGroupDeclaration <$> traverse (\(name, nameKind, val) -> (name,nameKind,) <$> g' val) ds) >>= f + f' (BoundValueDeclaration sa b expr) = (BoundValueDeclaration sa <$> h' b <*> g' expr) >>= f + f' (TypeClassDeclaration sa name args implies deps ds) = (TypeClassDeclaration sa name args implies deps <$> traverse f' ds) >>= f + f' (TypeInstanceDeclaration sa na ch idx name cs className args ds) = (TypeInstanceDeclaration sa na ch idx name cs className args <$> traverseTypeInstanceBody (traverse f') ds) >>= f + f' other = f other + + g' :: Expr -> m Expr + g' (Literal ss l) = (Literal ss <$> litM g' l) >>= g + g' (UnaryMinus ss v) = (UnaryMinus ss <$> g' v) >>= g + g' (BinaryNoParens op v1 v2) = (BinaryNoParens <$> g' op <*> g' v1 <*> g' v2) >>= g + g' (Parens v) = (Parens <$> g' v) >>= g + g' (Accessor prop v) = (Accessor prop <$> g' v) >>= g + g' (ObjectUpdate obj vs) = (ObjectUpdate <$> g' obj <*> traverse (sndM g') vs) >>= g + g' (ObjectUpdateNested obj vs) = (ObjectUpdateNested <$> g' obj <*> traverse g' vs) >>= g + g' (Abs binder v) = (Abs <$> h' binder <*> g' v) >>= g + g' (App v1 v2) = (App <$> g' v1 <*> g' v2) >>= g + g' (VisibleTypeApp v ty) = (VisibleTypeApp <$> g' v <*> pure ty) >>= g + g' (Unused v) = (Unused <$> g' v) >>= g + g' (IfThenElse v1 v2 v3) = (IfThenElse <$> g' v1 <*> g' v2 <*> g' v3) >>= g + g' (Case vs alts) = (Case <$> traverse g' vs <*> traverse handleCaseAlternative alts) >>= g + g' (TypedValue check v ty) = (TypedValue check <$> g' v <*> pure ty) >>= g + g' (Let w ds v) = (Let w <$> traverse f' ds <*> g' v) >>= g + g' (Do m es) = (Do m <$> traverse handleDoNotationElement es) >>= g + g' (Ado m es v) = (Ado m <$> traverse handleDoNotationElement es <*> g' v) >>= g + g' (PositionedValue pos com v) = (PositionedValue pos com <$> g' v) >>= g + g' other = g other + + h' :: Binder -> m Binder + h' (LiteralBinder ss l) = (LiteralBinder ss <$> litM h' l) >>= h + h' (ConstructorBinder ss ctor bs) = (ConstructorBinder ss ctor <$> traverse h' bs) >>= h + h' (BinaryNoParensBinder b1 b2 b3) = (BinaryNoParensBinder <$> h' b1 <*> h' b2 <*> h' b3) >>= h + h' (ParensInBinder b) = (ParensInBinder <$> h' b) >>= h + h' (NamedBinder ss name b) = (NamedBinder ss name <$> h' b) >>= h + h' (PositionedBinder pos com b) = (PositionedBinder pos com <$> h' b) >>= h + h' (TypedBinder t b) = (TypedBinder t <$> h' b) >>= h + h' other = h other + + handleCaseAlternative :: CaseAlternative -> m CaseAlternative + handleCaseAlternative (CaseAlternative bs val) = + CaseAlternative + <$> traverse h' bs + <*> traverse (guardedExprM handleGuard g') val + + handleDoNotationElement :: DoNotationElement -> m DoNotationElement + handleDoNotationElement (DoNotationValue v) = DoNotationValue <$> g' v + handleDoNotationElement (DoNotationBind b v) = DoNotationBind <$> h' b <*> g' v + handleDoNotationElement (DoNotationLet ds) = DoNotationLet <$> traverse f' ds + handleDoNotationElement (PositionedDoNotationElement pos com e) = PositionedDoNotationElement pos com <$> handleDoNotationElement e + + handleGuard :: Guard -> m Guard + handleGuard (ConditionGuard e) = ConditionGuard <$> g' e + handleGuard (PatternGuard b e) = PatternGuard <$> h' b <*> g' e + +everythingOnValues :: + forall r. + (r -> r -> r) -> + (Declaration -> r) -> + (Expr -> r) -> + (Binder -> r) -> + (CaseAlternative -> r) -> + (DoNotationElement -> r) -> + ( Declaration -> r + , Expr -> r + , Binder -> r + , CaseAlternative -> r + , DoNotationElement -> r + ) everythingOnValues (<>.) f g h i j = (f', g', h', i', j') where - - f' :: Declaration -> r - f' d@(DataBindingGroupDeclaration ds) = foldl (<>.) (f d) (fmap f' ds) - f' d@(ValueDeclaration vd) = foldl (<>.) (f d) (fmap h' (valdeclBinders vd) ++ concatMap (\(GuardedExpr grd v) -> fmap k' grd ++ [g' v]) (valdeclExpression vd)) - f' d@(BindingGroupDeclaration ds) = foldl (<>.) (f d) (fmap (\(_, _, val) -> g' val) ds) - f' d@(TypeClassDeclaration _ _ _ _ _ ds) = foldl (<>.) (f d) (fmap f' ds) - f' d@(TypeInstanceDeclaration _ _ _ _ _ _ _ _ (ExplicitInstance ds)) = foldl (<>.) (f d) (fmap f' ds) - f' d@(BoundValueDeclaration _ b expr) = f d <>. h' b <>. g' expr - f' d = f d - - g' :: Expr -> r - g' v@(Literal _ l) = lit (g v) g' l - g' v@(UnaryMinus _ v1) = g v <>. g' v1 - g' v@(BinaryNoParens op v1 v2) = g v <>. g' op <>. g' v1 <>. g' v2 - g' v@(Parens v1) = g v <>. g' v1 - g' v@(Accessor _ v1) = g v <>. g' v1 - g' v@(ObjectUpdate obj vs) = foldl (<>.) (g v <>. g' obj) (fmap (g' . snd) vs) - g' v@(ObjectUpdateNested obj vs) = foldl (<>.) (g v <>. g' obj) (fmap g' vs) - g' v@(Abs b v1) = g v <>. h' b <>. g' v1 - g' v@(App v1 v2) = g v <>. g' v1 <>. g' v2 - g' v@(VisibleTypeApp v' _) = g v <>. g' v' - g' v@(Unused v1) = g v <>. g' v1 - g' v@(IfThenElse v1 v2 v3) = g v <>. g' v1 <>. g' v2 <>. g' v3 - g' v@(Case vs alts) = foldl (<>.) (foldl (<>.) (g v) (fmap g' vs)) (fmap i' alts) - g' v@(TypedValue _ v1 _) = g v <>. g' v1 - g' v@(Let _ ds v1) = foldl (<>.) (g v) (fmap f' ds) <>. g' v1 - g' v@(Do _ es) = foldl (<>.) (g v) (fmap j' es) - g' v@(Ado _ es v1) = foldl (<>.) (g v) (fmap j' es) <>. g' v1 - g' v@(PositionedValue _ _ v1) = g v <>. g' v1 - g' v = g v - - h' :: Binder -> r - h' b@(LiteralBinder _ l) = lit (h b) h' l - h' b@(ConstructorBinder _ _ bs) = foldl (<>.) (h b) (fmap h' bs) - h' b@(BinaryNoParensBinder b1 b2 b3) = h b <>. h' b1 <>. h' b2 <>. h' b3 - h' b@(ParensInBinder b1) = h b <>. h' b1 - h' b@(NamedBinder _ _ b1) = h b <>. h' b1 - h' b@(PositionedBinder _ _ b1) = h b <>. h' b1 - h' b@(TypedBinder _ b1) = h b <>. h' b1 - h' b = h b - - lit :: r -> (a -> r) -> Literal a -> r - lit r go (ArrayLiteral as) = foldl (<>.) r (fmap go as) - lit r go (ObjectLiteral as) = foldl (<>.) r (fmap (go . snd) as) - lit r _ _ = r - - i' :: CaseAlternative -> r - i' ca@(CaseAlternative bs gs) = - foldl (<>.) (i ca) (fmap h' bs ++ concatMap (\(GuardedExpr grd val) -> fmap k' grd ++ [g' val]) gs) - - j' :: DoNotationElement -> r - j' e@(DoNotationValue v) = j e <>. g' v - j' e@(DoNotationBind b v) = j e <>. h' b <>. g' v - j' e@(DoNotationLet ds) = foldl (<>.) (j e) (fmap f' ds) - j' e@(PositionedDoNotationElement _ _ e1) = j e <>. j' e1 - - k' :: Guard -> r - k' (ConditionGuard e) = g' e - k' (PatternGuard b e) = h' b <>. g' e - -everythingWithContextOnValues - :: forall s r - . s - -> r - -> (r -> r -> r) - -> (s -> Declaration -> (s, r)) - -> (s -> Expr -> (s, r)) - -> (s -> Binder -> (s, r)) - -> (s -> CaseAlternative -> (s, r)) - -> (s -> DoNotationElement -> (s, r)) - -> ( Declaration -> r - , Expr -> r - , Binder -> r - , CaseAlternative -> r - , DoNotationElement -> r) + f' :: Declaration -> r + f' d@(DataBindingGroupDeclaration ds) = foldl (<>.) (f d) (fmap f' ds) + f' d@(ValueDeclaration vd) = foldl (<>.) (f d) (fmap h' (valdeclBinders vd) ++ concatMap (\(GuardedExpr grd v) -> fmap k' grd ++ [g' v]) (valdeclExpression vd)) + f' d@(BindingGroupDeclaration ds) = foldl (<>.) (f d) (fmap (\(_, _, val) -> g' val) ds) + f' d@(TypeClassDeclaration _ _ _ _ _ ds) = foldl (<>.) (f d) (fmap f' ds) + f' d@(TypeInstanceDeclaration _ _ _ _ _ _ _ _ (ExplicitInstance ds)) = foldl (<>.) (f d) (fmap f' ds) + f' d@(BoundValueDeclaration _ b expr) = f d <>. h' b <>. g' expr + f' d = f d + + g' :: Expr -> r + g' v@(Literal _ l) = lit (g v) g' l + g' v@(UnaryMinus _ v1) = g v <>. g' v1 + g' v@(BinaryNoParens op v1 v2) = g v <>. g' op <>. g' v1 <>. g' v2 + g' v@(Parens v1) = g v <>. g' v1 + g' v@(Accessor _ v1) = g v <>. g' v1 + g' v@(ObjectUpdate obj vs) = foldl (<>.) (g v <>. g' obj) (fmap (g' . snd) vs) + g' v@(ObjectUpdateNested obj vs) = foldl (<>.) (g v <>. g' obj) (fmap g' vs) + g' v@(Abs b v1) = g v <>. h' b <>. g' v1 + g' v@(App v1 v2) = g v <>. g' v1 <>. g' v2 + g' v@(VisibleTypeApp v' _) = g v <>. g' v' + g' v@(Unused v1) = g v <>. g' v1 + g' v@(IfThenElse v1 v2 v3) = g v <>. g' v1 <>. g' v2 <>. g' v3 + g' v@(Case vs alts) = foldl (<>.) (foldl (<>.) (g v) (fmap g' vs)) (fmap i' alts) + g' v@(TypedValue _ v1 _) = g v <>. g' v1 + g' v@(Let _ ds v1) = foldl (<>.) (g v) (fmap f' ds) <>. g' v1 + g' v@(Do _ es) = foldl (<>.) (g v) (fmap j' es) + g' v@(Ado _ es v1) = foldl (<>.) (g v) (fmap j' es) <>. g' v1 + g' v@(PositionedValue _ _ v1) = g v <>. g' v1 + g' v = g v + + h' :: Binder -> r + h' b@(LiteralBinder _ l) = lit (h b) h' l + h' b@(ConstructorBinder _ _ bs) = foldl (<>.) (h b) (fmap h' bs) + h' b@(BinaryNoParensBinder b1 b2 b3) = h b <>. h' b1 <>. h' b2 <>. h' b3 + h' b@(ParensInBinder b1) = h b <>. h' b1 + h' b@(NamedBinder _ _ b1) = h b <>. h' b1 + h' b@(PositionedBinder _ _ b1) = h b <>. h' b1 + h' b@(TypedBinder _ b1) = h b <>. h' b1 + h' b = h b + + lit :: r -> (a -> r) -> Literal a -> r + lit r go (ListLiteral as) = foldl (<>.) r (fmap go as) + lit r go (ObjectLiteral as) = foldl (<>.) r (fmap (go . snd) as) + lit r _ _ = r + + i' :: CaseAlternative -> r + i' ca@(CaseAlternative bs gs) = + foldl (<>.) (i ca) (fmap h' bs ++ concatMap (\(GuardedExpr grd val) -> fmap k' grd ++ [g' val]) gs) + + j' :: DoNotationElement -> r + j' e@(DoNotationValue v) = j e <>. g' v + j' e@(DoNotationBind b v) = j e <>. h' b <>. g' v + j' e@(DoNotationLet ds) = foldl (<>.) (j e) (fmap f' ds) + j' e@(PositionedDoNotationElement _ _ e1) = j e <>. j' e1 + + k' :: Guard -> r + k' (ConditionGuard e) = g' e + k' (PatternGuard b e) = h' b <>. g' e + +everythingWithContextOnValues :: + forall s r. + s -> + r -> + (r -> r -> r) -> + (s -> Declaration -> (s, r)) -> + (s -> Expr -> (s, r)) -> + (s -> Binder -> (s, r)) -> + (s -> CaseAlternative -> (s, r)) -> + (s -> DoNotationElement -> (s, r)) -> + ( Declaration -> r + , Expr -> r + , Binder -> r + , CaseAlternative -> r + , DoNotationElement -> r + ) everythingWithContextOnValues s0 r0 (<>.) f g h i j = (f'' s0, g'' s0, h'' s0, i'' s0, j'' s0) where - - f'' :: s -> Declaration -> r - f'' s d = let (s', r) = f s d in r <>. f' s' d - - f' :: s -> Declaration -> r - f' s (DataBindingGroupDeclaration ds) = foldl (<>.) r0 (fmap (f'' s) ds) - f' s (ValueDeclaration vd) = foldl (<>.) r0 (fmap (h'' s) (valdeclBinders vd) ++ concatMap (\(GuardedExpr grd v) -> fmap (k' s) grd ++ [g'' s v]) (valdeclExpression vd)) - f' s (BindingGroupDeclaration ds) = foldl (<>.) r0 (fmap (\(_, _, val) -> g'' s val) ds) - f' s (TypeClassDeclaration _ _ _ _ _ ds) = foldl (<>.) r0 (fmap (f'' s) ds) - f' s (TypeInstanceDeclaration _ _ _ _ _ _ _ _ (ExplicitInstance ds)) = foldl (<>.) r0 (fmap (f'' s) ds) - f' _ _ = r0 - - g'' :: s -> Expr -> r - g'' s v = let (s', r) = g s v in r <>. g' s' v - - g' :: s -> Expr -> r - g' s (Literal _ l) = lit g'' s l - g' s (UnaryMinus _ v1) = g'' s v1 - g' s (BinaryNoParens op v1 v2) = g'' s op <>. g'' s v1 <>. g'' s v2 - g' s (Parens v1) = g'' s v1 - g' s (Accessor _ v1) = g'' s v1 - g' s (ObjectUpdate obj vs) = foldl (<>.) (g'' s obj) (fmap (g'' s . snd) vs) - g' s (ObjectUpdateNested obj vs) = foldl (<>.) (g'' s obj) (fmap (g'' s) vs) - g' s (Abs binder v1) = h'' s binder <>. g'' s v1 - g' s (App v1 v2) = g'' s v1 <>. g'' s v2 - g' s (VisibleTypeApp v _) = g'' s v - g' s (Unused v) = g'' s v - g' s (IfThenElse v1 v2 v3) = g'' s v1 <>. g'' s v2 <>. g'' s v3 - g' s (Case vs alts) = foldl (<>.) (foldl (<>.) r0 (fmap (g'' s) vs)) (fmap (i'' s) alts) - g' s (TypedValue _ v1 _) = g'' s v1 - g' s (Let _ ds v1) = foldl (<>.) r0 (fmap (f'' s) ds) <>. g'' s v1 - g' s (Do _ es) = foldl (<>.) r0 (fmap (j'' s) es) - g' s (Ado _ es v1) = foldl (<>.) r0 (fmap (j'' s) es) <>. g'' s v1 - g' s (PositionedValue _ _ v1) = g'' s v1 - g' _ _ = r0 - - h'' :: s -> Binder -> r - h'' s b = let (s', r) = h s b in r <>. h' s' b - - h' :: s -> Binder -> r - h' s (LiteralBinder _ l) = lit h'' s l - h' s (ConstructorBinder _ _ bs) = foldl (<>.) r0 (fmap (h'' s) bs) - h' s (BinaryNoParensBinder b1 b2 b3) = h'' s b1 <>. h'' s b2 <>. h'' s b3 - h' s (ParensInBinder b) = h'' s b - h' s (NamedBinder _ _ b1) = h'' s b1 - h' s (PositionedBinder _ _ b1) = h'' s b1 - h' s (TypedBinder _ b1) = h'' s b1 - h' _ _ = r0 - - lit :: (s -> a -> r) -> s -> Literal a -> r - lit go s (ArrayLiteral as) = foldl (<>.) r0 (fmap (go s) as) - lit go s (ObjectLiteral as) = foldl (<>.) r0 (fmap (go s . snd) as) - lit _ _ _ = r0 - - i'' :: s -> CaseAlternative -> r - i'' s ca = let (s', r) = i s ca in r <>. i' s' ca - - i' :: s -> CaseAlternative -> r - i' s (CaseAlternative bs gs) = foldl (<>.) r0 (fmap (h'' s) bs ++ concatMap (\(GuardedExpr grd val) -> fmap (k' s) grd ++ [g'' s val]) gs) - - j'' :: s -> DoNotationElement -> r - j'' s e = let (s', r) = j s e in r <>. j' s' e - - j' :: s -> DoNotationElement -> r - j' s (DoNotationValue v) = g'' s v - j' s (DoNotationBind b v) = h'' s b <>. g'' s v - j' s (DoNotationLet ds) = foldl (<>.) r0 (fmap (f'' s) ds) - j' s (PositionedDoNotationElement _ _ e1) = j'' s e1 - - k' :: s -> Guard -> r - k' s (ConditionGuard e) = g'' s e - k' s (PatternGuard b e) = h'' s b <>. g'' s e - -everywhereWithContextOnValues - :: forall s - . s - -> (s -> Declaration -> (s, Declaration)) - -> (s -> Expr -> (s, Expr)) - -> (s -> Binder -> (s, Binder)) - -> (s -> CaseAlternative -> (s, CaseAlternative)) - -> (s -> DoNotationElement -> (s, DoNotationElement)) - -> (s -> Guard -> (s, Guard)) - -> ( Declaration -> Declaration - , Expr -> Expr - , Binder -> Binder - , CaseAlternative -> CaseAlternative - , DoNotationElement -> DoNotationElement - , Guard -> Guard - ) + f'' :: s -> Declaration -> r + f'' s d = let (s', r) = f s d in r <>. f' s' d + + f' :: s -> Declaration -> r + f' s (DataBindingGroupDeclaration ds) = foldl (<>.) r0 (fmap (f'' s) ds) + f' s (ValueDeclaration vd) = foldl (<>.) r0 (fmap (h'' s) (valdeclBinders vd) ++ concatMap (\(GuardedExpr grd v) -> fmap (k' s) grd ++ [g'' s v]) (valdeclExpression vd)) + f' s (BindingGroupDeclaration ds) = foldl (<>.) r0 (fmap (\(_, _, val) -> g'' s val) ds) + f' s (TypeClassDeclaration _ _ _ _ _ ds) = foldl (<>.) r0 (fmap (f'' s) ds) + f' s (TypeInstanceDeclaration _ _ _ _ _ _ _ _ (ExplicitInstance ds)) = foldl (<>.) r0 (fmap (f'' s) ds) + f' _ _ = r0 + + g'' :: s -> Expr -> r + g'' s v = let (s', r) = g s v in r <>. g' s' v + + g' :: s -> Expr -> r + g' s (Literal _ l) = lit g'' s l + g' s (UnaryMinus _ v1) = g'' s v1 + g' s (BinaryNoParens op v1 v2) = g'' s op <>. g'' s v1 <>. g'' s v2 + g' s (Parens v1) = g'' s v1 + g' s (Accessor _ v1) = g'' s v1 + g' s (ObjectUpdate obj vs) = foldl (<>.) (g'' s obj) (fmap (g'' s . snd) vs) + g' s (ObjectUpdateNested obj vs) = foldl (<>.) (g'' s obj) (fmap (g'' s) vs) + g' s (Abs binder v1) = h'' s binder <>. g'' s v1 + g' s (App v1 v2) = g'' s v1 <>. g'' s v2 + g' s (VisibleTypeApp v _) = g'' s v + g' s (Unused v) = g'' s v + g' s (IfThenElse v1 v2 v3) = g'' s v1 <>. g'' s v2 <>. g'' s v3 + g' s (Case vs alts) = foldl (<>.) (foldl (<>.) r0 (fmap (g'' s) vs)) (fmap (i'' s) alts) + g' s (TypedValue _ v1 _) = g'' s v1 + g' s (Let _ ds v1) = foldl (<>.) r0 (fmap (f'' s) ds) <>. g'' s v1 + g' s (Do _ es) = foldl (<>.) r0 (fmap (j'' s) es) + g' s (Ado _ es v1) = foldl (<>.) r0 (fmap (j'' s) es) <>. g'' s v1 + g' s (PositionedValue _ _ v1) = g'' s v1 + g' _ _ = r0 + + h'' :: s -> Binder -> r + h'' s b = let (s', r) = h s b in r <>. h' s' b + + h' :: s -> Binder -> r + h' s (LiteralBinder _ l) = lit h'' s l + h' s (ConstructorBinder _ _ bs) = foldl (<>.) r0 (fmap (h'' s) bs) + h' s (BinaryNoParensBinder b1 b2 b3) = h'' s b1 <>. h'' s b2 <>. h'' s b3 + h' s (ParensInBinder b) = h'' s b + h' s (NamedBinder _ _ b1) = h'' s b1 + h' s (PositionedBinder _ _ b1) = h'' s b1 + h' s (TypedBinder _ b1) = h'' s b1 + h' _ _ = r0 + + lit :: (s -> a -> r) -> s -> Literal a -> r + lit go s (ListLiteral as) = foldl (<>.) r0 (fmap (go s) as) + lit go s (ObjectLiteral as) = foldl (<>.) r0 (fmap (go s . snd) as) + lit _ _ _ = r0 + + i'' :: s -> CaseAlternative -> r + i'' s ca = let (s', r) = i s ca in r <>. i' s' ca + + i' :: s -> CaseAlternative -> r + i' s (CaseAlternative bs gs) = foldl (<>.) r0 (fmap (h'' s) bs ++ concatMap (\(GuardedExpr grd val) -> fmap (k' s) grd ++ [g'' s val]) gs) + + j'' :: s -> DoNotationElement -> r + j'' s e = let (s', r) = j s e in r <>. j' s' e + + j' :: s -> DoNotationElement -> r + j' s (DoNotationValue v) = g'' s v + j' s (DoNotationBind b v) = h'' s b <>. g'' s v + j' s (DoNotationLet ds) = foldl (<>.) r0 (fmap (f'' s) ds) + j' s (PositionedDoNotationElement _ _ e1) = j'' s e1 + + k' :: s -> Guard -> r + k' s (ConditionGuard e) = g'' s e + k' s (PatternGuard b e) = h'' s b <>. g'' s e + +everywhereWithContextOnValues :: + forall s. + s -> + (s -> Declaration -> (s, Declaration)) -> + (s -> Expr -> (s, Expr)) -> + (s -> Binder -> (s, Binder)) -> + (s -> CaseAlternative -> (s, CaseAlternative)) -> + (s -> DoNotationElement -> (s, DoNotationElement)) -> + (s -> Guard -> (s, Guard)) -> + ( Declaration -> Declaration + , Expr -> Expr + , Binder -> Binder + , CaseAlternative -> CaseAlternative + , DoNotationElement -> DoNotationElement + , Guard -> Guard + ) everywhereWithContextOnValues s f g h i j k = (runIdentity . f', runIdentity . g', runIdentity . h', runIdentity . i', runIdentity . j', runIdentity . k') where - (f', g', h', i', j', k') = everywhereWithContextOnValuesM s (wrap f) (wrap g) (wrap h) (wrap i) (wrap j) (wrap k) - wrap = ((pure .) .) - -everywhereWithContextOnValuesM - :: forall m s - . (Monad m) - => s - -> (s -> Declaration -> m (s, Declaration)) - -> (s -> Expr -> m (s, Expr)) - -> (s -> Binder -> m (s, Binder)) - -> (s -> CaseAlternative -> m (s, CaseAlternative)) - -> (s -> DoNotationElement -> m (s, DoNotationElement)) - -> (s -> Guard -> m (s, Guard)) - -> ( Declaration -> m Declaration - , Expr -> m Expr - , Binder -> m Binder - , CaseAlternative -> m CaseAlternative - , DoNotationElement -> m DoNotationElement - , Guard -> m Guard - ) + (f', g', h', i', j', k') = everywhereWithContextOnValuesM s (wrap f) (wrap g) (wrap h) (wrap i) (wrap j) (wrap k) + wrap = ((pure .) .) + +everywhereWithContextOnValuesM :: + forall m s. + (Monad m) => + s -> + (s -> Declaration -> m (s, Declaration)) -> + (s -> Expr -> m (s, Expr)) -> + (s -> Binder -> m (s, Binder)) -> + (s -> CaseAlternative -> m (s, CaseAlternative)) -> + (s -> DoNotationElement -> m (s, DoNotationElement)) -> + (s -> Guard -> m (s, Guard)) -> + ( Declaration -> m Declaration + , Expr -> m Expr + , Binder -> m Binder + , CaseAlternative -> m CaseAlternative + , DoNotationElement -> m DoNotationElement + , Guard -> m Guard + ) everywhereWithContextOnValuesM s0 f g h i j k = (f'' s0, g'' s0, h'' s0, i'' s0, j'' s0, k'' s0) where - f'' s = uncurry f' <=< f s - - f' s (DataBindingGroupDeclaration ds) = DataBindingGroupDeclaration <$> traverse (f'' s) ds - f' s (ValueDecl sa name nameKind bs val) = - ValueDecl sa name nameKind <$> traverse (h'' s) bs <*> traverse (guardedExprM (k' s) (g'' s)) val - f' s (BindingGroupDeclaration ds) = BindingGroupDeclaration <$> traverse (thirdM (g'' s)) ds - f' s (TypeClassDeclaration sa name args implies deps ds) = TypeClassDeclaration sa name args implies deps <$> traverse (f'' s) ds - f' s (TypeInstanceDeclaration sa na ch idx name cs className args ds) = TypeInstanceDeclaration sa na ch idx name cs className args <$> traverseTypeInstanceBody (traverse (f'' s)) ds - f' _ other = return other - - g'' s = uncurry g' <=< g s - - g' s (Literal ss l) = Literal ss <$> lit g'' s l - g' s (UnaryMinus ss v) = UnaryMinus ss <$> g'' s v - g' s (BinaryNoParens op v1 v2) = BinaryNoParens <$> g'' s op <*> g'' s v1 <*> g'' s v2 - g' s (Parens v) = Parens <$> g'' s v - g' s (Accessor prop v) = Accessor prop <$> g'' s v - g' s (ObjectUpdate obj vs) = ObjectUpdate <$> g'' s obj <*> traverse (sndM (g'' s)) vs - g' s (ObjectUpdateNested obj vs) = ObjectUpdateNested <$> g'' s obj <*> traverse (g'' s) vs - g' s (Abs binder v) = Abs <$> h' s binder <*> g'' s v - g' s (App v1 v2) = App <$> g'' s v1 <*> g'' s v2 - g' s (VisibleTypeApp v ty) = VisibleTypeApp <$> g'' s v <*> pure ty - g' s (Unused v) = Unused <$> g'' s v - g' s (IfThenElse v1 v2 v3) = IfThenElse <$> g'' s v1 <*> g'' s v2 <*> g'' s v3 - g' s (Case vs alts) = Case <$> traverse (g'' s) vs <*> traverse (i'' s) alts - g' s (TypedValue check v ty) = TypedValue check <$> g'' s v <*> pure ty - g' s (Let w ds v) = Let w <$> traverse (f'' s) ds <*> g'' s v - g' s (Do m es) = Do m <$> traverse (j'' s) es - g' s (Ado m es v) = Ado m <$> traverse (j'' s) es <*> g'' s v - g' s (PositionedValue pos com v) = PositionedValue pos com <$> g'' s v - g' _ other = return other - - h'' s = uncurry h' <=< h s - - h' s (LiteralBinder ss l) = LiteralBinder ss <$> lit h'' s l - h' s (ConstructorBinder ss ctor bs) = ConstructorBinder ss ctor <$> traverse (h'' s) bs - h' s (BinaryNoParensBinder b1 b2 b3) = BinaryNoParensBinder <$> h'' s b1 <*> h'' s b2 <*> h'' s b3 - h' s (ParensInBinder b) = ParensInBinder <$> h'' s b - h' s (NamedBinder ss name b) = NamedBinder ss name <$> h'' s b - h' s (PositionedBinder pos com b) = PositionedBinder pos com <$> h'' s b - h' s (TypedBinder t b) = TypedBinder t <$> h'' s b - h' _ other = return other - - lit :: (s -> a -> m a) -> s -> Literal a -> m (Literal a) - lit go s (ArrayLiteral as) = ArrayLiteral <$> traverse (go s) as - lit go s (ObjectLiteral as) = ObjectLiteral <$> traverse (sndM (go s)) as - lit _ _ other = return other - - i'' s = uncurry i' <=< i s - - i' s (CaseAlternative bs val) = CaseAlternative <$> traverse (h'' s) bs <*> traverse (guardedExprM' s) val - - -- A specialized `guardedExprM` that keeps track of the context `s` - -- after traversing `guards`, such that it's also exposed to `expr`. - guardedExprM' :: s -> GuardedExpr -> m GuardedExpr - guardedExprM' s (GuardedExpr guards expr) = do - (guards', s') <- runStateT (traverse (StateT . goGuard) guards) s - GuardedExpr guards' <$> g'' s' expr - - -- Like k'', but `s` is tracked. - goGuard :: Guard -> s -> m (Guard, s) - goGuard x s = k s x >>= fmap swap . sndM' k' - - j'' s = uncurry j' <=< j s - - j' s (DoNotationValue v) = DoNotationValue <$> g'' s v - j' s (DoNotationBind b v) = DoNotationBind <$> h'' s b <*> g'' s v - j' s (DoNotationLet ds) = DoNotationLet <$> traverse (f'' s) ds - j' s (PositionedDoNotationElement pos com e1) = PositionedDoNotationElement pos com <$> j'' s e1 - - k'' s = uncurry k' <=< k s - - k' s (ConditionGuard e) = ConditionGuard <$> g'' s e - k' s (PatternGuard b e) = PatternGuard <$> h'' s b <*> g'' s e + f'' s = uncurry f' <=< f s + + f' s (DataBindingGroupDeclaration ds) = DataBindingGroupDeclaration <$> traverse (f'' s) ds + f' s (ValueDecl sa name nameKind bs val) = + ValueDecl sa name nameKind <$> traverse (h'' s) bs <*> traverse (guardedExprM (k' s) (g'' s)) val + f' s (BindingGroupDeclaration ds) = BindingGroupDeclaration <$> traverse (thirdM (g'' s)) ds + f' s (TypeClassDeclaration sa name args implies deps ds) = TypeClassDeclaration sa name args implies deps <$> traverse (f'' s) ds + f' s (TypeInstanceDeclaration sa na ch idx name cs className args ds) = TypeInstanceDeclaration sa na ch idx name cs className args <$> traverseTypeInstanceBody (traverse (f'' s)) ds + f' _ other = return other + + g'' s = uncurry g' <=< g s + + g' s (Literal ss l) = Literal ss <$> lit g'' s l + g' s (UnaryMinus ss v) = UnaryMinus ss <$> g'' s v + g' s (BinaryNoParens op v1 v2) = BinaryNoParens <$> g'' s op <*> g'' s v1 <*> g'' s v2 + g' s (Parens v) = Parens <$> g'' s v + g' s (Accessor prop v) = Accessor prop <$> g'' s v + g' s (ObjectUpdate obj vs) = ObjectUpdate <$> g'' s obj <*> traverse (sndM (g'' s)) vs + g' s (ObjectUpdateNested obj vs) = ObjectUpdateNested <$> g'' s obj <*> traverse (g'' s) vs + g' s (Abs binder v) = Abs <$> h' s binder <*> g'' s v + g' s (App v1 v2) = App <$> g'' s v1 <*> g'' s v2 + g' s (VisibleTypeApp v ty) = VisibleTypeApp <$> g'' s v <*> pure ty + g' s (Unused v) = Unused <$> g'' s v + g' s (IfThenElse v1 v2 v3) = IfThenElse <$> g'' s v1 <*> g'' s v2 <*> g'' s v3 + g' s (Case vs alts) = Case <$> traverse (g'' s) vs <*> traverse (i'' s) alts + g' s (TypedValue check v ty) = TypedValue check <$> g'' s v <*> pure ty + g' s (Let w ds v) = Let w <$> traverse (f'' s) ds <*> g'' s v + g' s (Do m es) = Do m <$> traverse (j'' s) es + g' s (Ado m es v) = Ado m <$> traverse (j'' s) es <*> g'' s v + g' s (PositionedValue pos com v) = PositionedValue pos com <$> g'' s v + g' _ other = return other + + h'' s = uncurry h' <=< h s + + h' s (LiteralBinder ss l) = LiteralBinder ss <$> lit h'' s l + h' s (ConstructorBinder ss ctor bs) = ConstructorBinder ss ctor <$> traverse (h'' s) bs + h' s (BinaryNoParensBinder b1 b2 b3) = BinaryNoParensBinder <$> h'' s b1 <*> h'' s b2 <*> h'' s b3 + h' s (ParensInBinder b) = ParensInBinder <$> h'' s b + h' s (NamedBinder ss name b) = NamedBinder ss name <$> h'' s b + h' s (PositionedBinder pos com b) = PositionedBinder pos com <$> h'' s b + h' s (TypedBinder t b) = TypedBinder t <$> h'' s b + h' _ other = return other + + lit :: (s -> a -> m a) -> s -> Literal a -> m (Literal a) + lit go s (ListLiteral as) = ListLiteral <$> traverse (go s) as + lit go s (ObjectLiteral as) = ObjectLiteral <$> traverse (sndM (go s)) as + lit _ _ other = return other + + i'' s = uncurry i' <=< i s + + i' s (CaseAlternative bs val) = CaseAlternative <$> traverse (h'' s) bs <*> traverse (guardedExprM' s) val + + -- A specialized `guardedExprM` that keeps track of the context `s` + -- after traversing `guards`, such that it's also exposed to `expr`. + guardedExprM' :: s -> GuardedExpr -> m GuardedExpr + guardedExprM' s (GuardedExpr guards expr) = do + (guards', s') <- runStateT (traverse (StateT . goGuard) guards) s + GuardedExpr guards' <$> g'' s' expr + + -- Like k'', but `s` is tracked. + goGuard :: Guard -> s -> m (Guard, s) + goGuard x s = k s x >>= fmap swap . sndM' k' + + j'' s = uncurry j' <=< j s + + j' s (DoNotationValue v) = DoNotationValue <$> g'' s v + j' s (DoNotationBind b v) = DoNotationBind <$> h'' s b <*> g'' s v + j' s (DoNotationLet ds) = DoNotationLet <$> traverse (f'' s) ds + j' s (PositionedDoNotationElement pos com e1) = PositionedDoNotationElement pos com <$> j'' s e1 + + k'' s = uncurry k' <=< k s + + k' s (ConditionGuard e) = ConditionGuard <$> g'' s e + k' s (PatternGuard b e) = PatternGuard <$> h'' s b <*> g'' s e data ScopedIdent = LocalIdent Ident | ToplevelIdent Ident deriving (Show, Eq, Ord) @@ -544,178 +544,178 @@ data ScopedIdent = LocalIdent Ident | ToplevelIdent Ident inScope :: Ident -> S.Set ScopedIdent -> Bool inScope i s = (LocalIdent i `S.member` s) || (ToplevelIdent i `S.member` s) -everythingWithScope - :: forall r - . (Monoid r) - => (S.Set ScopedIdent -> Declaration -> r) - -> (S.Set ScopedIdent -> Expr -> r) - -> (S.Set ScopedIdent -> Binder -> r) - -> (S.Set ScopedIdent -> CaseAlternative -> r) - -> (S.Set ScopedIdent -> DoNotationElement -> r) - -> ( S.Set ScopedIdent -> Declaration -> r - , S.Set ScopedIdent -> Expr -> r - , S.Set ScopedIdent -> Binder -> r - , S.Set ScopedIdent -> CaseAlternative -> r - , S.Set ScopedIdent -> DoNotationElement -> r - ) +everythingWithScope :: + forall r. + (Monoid r) => + (S.Set ScopedIdent -> Declaration -> r) -> + (S.Set ScopedIdent -> Expr -> r) -> + (S.Set ScopedIdent -> Binder -> r) -> + (S.Set ScopedIdent -> CaseAlternative -> r) -> + (S.Set ScopedIdent -> DoNotationElement -> r) -> + ( S.Set ScopedIdent -> Declaration -> r + , S.Set ScopedIdent -> Expr -> r + , S.Set ScopedIdent -> Binder -> r + , S.Set ScopedIdent -> CaseAlternative -> r + , S.Set ScopedIdent -> DoNotationElement -> r + ) everythingWithScope f g h i j = (f'', g'', h'', i'', \s -> snd . j'' s) where - f'' :: S.Set ScopedIdent -> Declaration -> r - f'' s a = f s a <> f' s a - - f' :: S.Set ScopedIdent -> Declaration -> r - f' s (DataBindingGroupDeclaration ds) = - let s' = S.union s (S.fromList (map ToplevelIdent (mapMaybe getDeclIdent (NEL.toList ds)))) - in foldMap (f'' s') ds - f' s (ValueDecl _ name _ bs val) = - let s' = S.insert (ToplevelIdent name) s - s'' = S.union s' (S.fromList (concatMap localBinderNames bs)) - in foldMap (h'' s') bs <> foldMap (l' s'') val - f' s (BindingGroupDeclaration ds) = - let s' = S.union s (S.fromList (NEL.toList (fmap (\((_, name), _, _) -> ToplevelIdent name) ds))) - in foldMap (\(_, _, val) -> g'' s' val) ds - f' s (TypeClassDeclaration _ _ _ _ _ ds) = foldMap (f'' s) ds - f' s (TypeInstanceDeclaration _ _ _ _ _ _ _ _ (ExplicitInstance ds)) = foldMap (f'' s) ds - f' _ _ = mempty - - g'' :: S.Set ScopedIdent -> Expr -> r - g'' s a = g s a <> g' s a - - g' :: S.Set ScopedIdent -> Expr -> r - g' s (Literal _ l) = lit g'' s l - g' s (UnaryMinus _ v1) = g'' s v1 - g' s (BinaryNoParens op v1 v2) = g'' s op <> g'' s v1 <> g'' s v2 - g' s (Parens v1) = g'' s v1 - g' s (Accessor _ v1) = g'' s v1 - g' s (ObjectUpdate obj vs) = g'' s obj <> foldMap (g'' s . snd) vs - g' s (ObjectUpdateNested obj vs) = g'' s obj <> foldMap (g'' s) vs - g' s (Abs b v1) = - let s' = S.union (S.fromList (localBinderNames b)) s - in h'' s b <> g'' s' v1 - g' s (App v1 v2) = g'' s v1 <> g'' s v2 - g' s (VisibleTypeApp v _) = g'' s v - g' s (Unused v) = g'' s v - g' s (IfThenElse v1 v2 v3) = g'' s v1 <> g'' s v2 <> g'' s v3 - g' s (Case vs alts) = foldMap (g'' s) vs <> foldMap (i'' s) alts - g' s (TypedValue _ v1 _) = g'' s v1 - g' s (Let _ ds v1) = - let s' = S.union s (S.fromList (map LocalIdent (mapMaybe getDeclIdent ds))) - in foldMap (f'' s') ds <> g'' s' v1 - g' s (Do _ es) = fold . snd . mapAccumL j'' s $ es - g' s (Ado _ es v1) = - let s' = S.union s (foldMap (fst . j'' s) es) - in g'' s' v1 - g' s (PositionedValue _ _ v1) = g'' s v1 - g' _ _ = mempty - - h'' :: S.Set ScopedIdent -> Binder -> r - h'' s a = h s a <> h' s a - - h' :: S.Set ScopedIdent -> Binder -> r - h' s (LiteralBinder _ l) = lit h'' s l - h' s (ConstructorBinder _ _ bs) = foldMap (h'' s) bs - h' s (BinaryNoParensBinder b1 b2 b3) = foldMap (h'' s) [b1, b2, b3] - h' s (ParensInBinder b) = h'' s b - h' s (NamedBinder _ name b1) = h'' (S.insert (LocalIdent name) s) b1 - h' s (PositionedBinder _ _ b1) = h'' s b1 - h' s (TypedBinder _ b1) = h'' s b1 - h' _ _ = mempty - - lit :: (S.Set ScopedIdent -> a -> r) -> S.Set ScopedIdent -> Literal a -> r - lit go s (ArrayLiteral as) = foldMap (go s) as - lit go s (ObjectLiteral as) = foldMap (go s . snd) as - lit _ _ _ = mempty - - i'' :: S.Set ScopedIdent -> CaseAlternative -> r - i'' s a = i s a <> i' s a - - i' :: S.Set ScopedIdent -> CaseAlternative -> r - i' s (CaseAlternative bs gs) = - let s' = S.union s (S.fromList (concatMap localBinderNames bs)) - in foldMap (h'' s) bs <> foldMap (l' s') gs - - j'' :: S.Set ScopedIdent -> DoNotationElement -> (S.Set ScopedIdent, r) - j'' s a = let (s', r) = j' s a in (s', j s a <> r) - - j' :: S.Set ScopedIdent -> DoNotationElement -> (S.Set ScopedIdent, r) - j' s (DoNotationValue v) = (s, g'' s v) - j' s (DoNotationBind b v) = - let s' = S.union (S.fromList (localBinderNames b)) s - in (s', h'' s b <> g'' s v) - j' s (DoNotationLet ds) = - let s' = S.union s (S.fromList (map LocalIdent (mapMaybe getDeclIdent ds))) - in (s', foldMap (f'' s') ds) - j' s (PositionedDoNotationElement _ _ e1) = j'' s e1 - - k' :: S.Set ScopedIdent -> Guard -> (S.Set ScopedIdent, r) - k' s (ConditionGuard e) = (s, g'' s e) - k' s (PatternGuard b e) = - let s' = S.union (S.fromList (localBinderNames b)) s - in (s', h'' s b <> g'' s' e) - - l' s (GuardedExpr [] e) = g'' s e - l' s (GuardedExpr (grd:gs) e) = - let (s', r) = k' s grd - in r <> l' s' (GuardedExpr gs e) - - getDeclIdent :: Declaration -> Maybe Ident - getDeclIdent (ValueDeclaration vd) = Just (valdeclIdent vd) - getDeclIdent (TypeDeclaration td) = Just (tydeclIdent td) - getDeclIdent _ = Nothing - - localBinderNames = map LocalIdent . binderNames - -accumTypes - :: (Monoid r) - => (SourceType -> r) - -> ( Declaration -> r - , Expr -> r - , Binder -> r - , CaseAlternative -> r - , DoNotationElement -> r - ) + f'' :: S.Set ScopedIdent -> Declaration -> r + f'' s a = f s a <> f' s a + + f' :: S.Set ScopedIdent -> Declaration -> r + f' s (DataBindingGroupDeclaration ds) = + let s' = S.union s (S.fromList (map ToplevelIdent (mapMaybe getDeclIdent (NEL.toList ds)))) + in foldMap (f'' s') ds + f' s (ValueDecl _ name _ bs val) = + let s' = S.insert (ToplevelIdent name) s + s'' = S.union s' (S.fromList (concatMap localBinderNames bs)) + in foldMap (h'' s') bs <> foldMap (l' s'') val + f' s (BindingGroupDeclaration ds) = + let s' = S.union s (S.fromList (NEL.toList (fmap (\((_, name), _, _) -> ToplevelIdent name) ds))) + in foldMap (\(_, _, val) -> g'' s' val) ds + f' s (TypeClassDeclaration _ _ _ _ _ ds) = foldMap (f'' s) ds + f' s (TypeInstanceDeclaration _ _ _ _ _ _ _ _ (ExplicitInstance ds)) = foldMap (f'' s) ds + f' _ _ = mempty + + g'' :: S.Set ScopedIdent -> Expr -> r + g'' s a = g s a <> g' s a + + g' :: S.Set ScopedIdent -> Expr -> r + g' s (Literal _ l) = lit g'' s l + g' s (UnaryMinus _ v1) = g'' s v1 + g' s (BinaryNoParens op v1 v2) = g'' s op <> g'' s v1 <> g'' s v2 + g' s (Parens v1) = g'' s v1 + g' s (Accessor _ v1) = g'' s v1 + g' s (ObjectUpdate obj vs) = g'' s obj <> foldMap (g'' s . snd) vs + g' s (ObjectUpdateNested obj vs) = g'' s obj <> foldMap (g'' s) vs + g' s (Abs b v1) = + let s' = S.union (S.fromList (localBinderNames b)) s + in h'' s b <> g'' s' v1 + g' s (App v1 v2) = g'' s v1 <> g'' s v2 + g' s (VisibleTypeApp v _) = g'' s v + g' s (Unused v) = g'' s v + g' s (IfThenElse v1 v2 v3) = g'' s v1 <> g'' s v2 <> g'' s v3 + g' s (Case vs alts) = foldMap (g'' s) vs <> foldMap (i'' s) alts + g' s (TypedValue _ v1 _) = g'' s v1 + g' s (Let _ ds v1) = + let s' = S.union s (S.fromList (map LocalIdent (mapMaybe getDeclIdent ds))) + in foldMap (f'' s') ds <> g'' s' v1 + g' s (Do _ es) = fold . snd . mapAccumL j'' s $ es + g' s (Ado _ es v1) = + let s' = S.union s (foldMap (fst . j'' s) es) + in g'' s' v1 + g' s (PositionedValue _ _ v1) = g'' s v1 + g' _ _ = mempty + + h'' :: S.Set ScopedIdent -> Binder -> r + h'' s a = h s a <> h' s a + + h' :: S.Set ScopedIdent -> Binder -> r + h' s (LiteralBinder _ l) = lit h'' s l + h' s (ConstructorBinder _ _ bs) = foldMap (h'' s) bs + h' s (BinaryNoParensBinder b1 b2 b3) = foldMap (h'' s) [b1, b2, b3] + h' s (ParensInBinder b) = h'' s b + h' s (NamedBinder _ name b1) = h'' (S.insert (LocalIdent name) s) b1 + h' s (PositionedBinder _ _ b1) = h'' s b1 + h' s (TypedBinder _ b1) = h'' s b1 + h' _ _ = mempty + + lit :: (S.Set ScopedIdent -> a -> r) -> S.Set ScopedIdent -> Literal a -> r + lit go s (ListLiteral as) = foldMap (go s) as + lit go s (ObjectLiteral as) = foldMap (go s . snd) as + lit _ _ _ = mempty + + i'' :: S.Set ScopedIdent -> CaseAlternative -> r + i'' s a = i s a <> i' s a + + i' :: S.Set ScopedIdent -> CaseAlternative -> r + i' s (CaseAlternative bs gs) = + let s' = S.union s (S.fromList (concatMap localBinderNames bs)) + in foldMap (h'' s) bs <> foldMap (l' s') gs + + j'' :: S.Set ScopedIdent -> DoNotationElement -> (S.Set ScopedIdent, r) + j'' s a = let (s', r) = j' s a in (s', j s a <> r) + + j' :: S.Set ScopedIdent -> DoNotationElement -> (S.Set ScopedIdent, r) + j' s (DoNotationValue v) = (s, g'' s v) + j' s (DoNotationBind b v) = + let s' = S.union (S.fromList (localBinderNames b)) s + in (s', h'' s b <> g'' s v) + j' s (DoNotationLet ds) = + let s' = S.union s (S.fromList (map LocalIdent (mapMaybe getDeclIdent ds))) + in (s', foldMap (f'' s') ds) + j' s (PositionedDoNotationElement _ _ e1) = j'' s e1 + + k' :: S.Set ScopedIdent -> Guard -> (S.Set ScopedIdent, r) + k' s (ConditionGuard e) = (s, g'' s e) + k' s (PatternGuard b e) = + let s' = S.union (S.fromList (localBinderNames b)) s + in (s', h'' s b <> g'' s' e) + + l' s (GuardedExpr [] e) = g'' s e + l' s (GuardedExpr (grd : gs) e) = + let (s', r) = k' s grd + in r <> l' s' (GuardedExpr gs e) + + getDeclIdent :: Declaration -> Maybe Ident + getDeclIdent (ValueDeclaration vd) = Just (valdeclIdent vd) + getDeclIdent (TypeDeclaration td) = Just (tydeclIdent td) + getDeclIdent _ = Nothing + + localBinderNames = map LocalIdent . binderNames + +accumTypes :: + (Monoid r) => + (SourceType -> r) -> + ( Declaration -> r + , Expr -> r + , Binder -> r + , CaseAlternative -> r + , DoNotationElement -> r + ) accumTypes f = everythingOnValues mappend forDecls forValues forBinders (const mempty) (const mempty) where - forDecls (DataDeclaration _ _ _ args dctors) = - foldMap (foldMap f . snd) args <> - foldMap (foldMap (f . snd) . dataCtorFields) dctors - forDecls (ExternDataDeclaration _ _ ty) = f ty - forDecls (ExternDeclaration _ _ ty) = f ty - forDecls (TypeClassDeclaration _ _ args implies _ _) = - foldMap (foldMap (foldMap f)) args <> - foldMap (foldMap f . constraintArgs) implies - forDecls (TypeInstanceDeclaration _ _ _ _ _ cs _ tys _) = - foldMap (foldMap f . constraintArgs) cs <> foldMap f tys - forDecls (TypeSynonymDeclaration _ _ args ty) = - foldMap (foldMap f . snd) args <> - f ty - forDecls (KindDeclaration _ _ _ ty) = f ty - forDecls (TypeDeclaration td) = f (tydeclType td) - forDecls _ = mempty - - forValues (TypeClassDictionary c _ _) = foldMap f (constraintArgs c) - forValues (DeferredDictionary _ tys) = foldMap f tys - forValues (TypedValue _ _ ty) = f ty - forValues (VisibleTypeApp _ ty) = f ty - forValues _ = mempty - - forBinders (TypedBinder ty _) = f ty - forBinders _ = mempty - --- | --- Map a function over type annotations appearing inside a value --- + forDecls (DataDeclaration _ _ _ args dctors) = + foldMap (f . snd) args + <> foldMap (foldMap (f . snd) . dataCtorFields) dctors + forDecls (ExternDataDeclaration _ _ ty) = f ty + forDecls (ExternDeclaration _ _ ty) = f ty + forDecls (TypeClassDeclaration _ _ args implies _ _) = + foldMap (foldMap f) args + <> foldMap (foldMap f . constraintArgs) implies + forDecls (TypeInstanceDeclaration _ _ _ _ _ cs _ tys _) = + foldMap (foldMap f . constraintArgs) cs <> foldMap f tys + forDecls (TypeSynonymDeclaration _ _ args ty) = + foldMap (f . snd) args + <> f ty + forDecls (KindDeclaration _ _ _ ty) = f ty + forDecls (TypeDeclaration td) = f (tydeclType td) + forDecls _ = mempty + + forValues (TypeClassDictionary c _ _) = foldMap f (constraintArgs c) + forValues (DeferredDictionary _ tys) = foldMap f tys + forValues (TypedValue _ _ ty) = f ty + forValues (VisibleTypeApp _ ty) = f ty + forValues _ = mempty + + forBinders (TypedBinder ty _) = f ty + forBinders _ = mempty + +{- | +Map a function over type annotations appearing inside a value +-} overTypes :: (SourceType -> SourceType) -> Expr -> Expr overTypes f = let (_, f', _) = everywhereOnValues id g id in f' where - g :: Expr -> Expr - g (TypedValue checkTy val t) = TypedValue checkTy val (f t) - g (TypeClassDictionary c sco hints) = - TypeClassDictionary - (mapConstraintArgs (fmap f) c) - (updateCtx sco) - hints - g other = other - updateDict fn dict = dict { tcdInstanceTypes = fn (tcdInstanceTypes dict) } - updateScope = fmap . fmap . fmap . fmap $ updateDict $ fmap f - updateCtx = M.alter updateScope ByNullSourcePos + g :: Expr -> Expr + g (TypedValue checkTy val t) = TypedValue checkTy val (f t) + g (TypeClassDictionary c sco hints) = + TypeClassDictionary + (mapConstraintArgs (fmap f) c) + (updateCtx sco) + hints + g other = other + updateDict fn dict = dict {tcdInstanceTypes = fn (tcdInstanceTypes dict)} + updateScope = fmap . fmap . fmap . fmap $ updateDict $ fmap f + updateCtx = M.alter updateScope ByNullSourcePos diff --git a/src/Language/PureScript/AST/Utils.hs b/src/Language/PureScript/AST/Utils.hs index d768a884f..e80d3ad8d 100644 --- a/src/Language/PureScript/AST/Utils.hs +++ b/src/Language/PureScript/AST/Utils.hs @@ -2,9 +2,9 @@ module Language.PureScript.AST.Utils where import Protolude -import Language.PureScript.AST (Binder(..), CaseAlternative, Expr(..), GuardedExpr, Literal, pattern MkUnguarded, nullSourceSpan) -import Language.PureScript.Names (Ident, ModuleName, ProperName, ProperNameType(..), Qualified(..), QualifiedBy(..), byMaybeModuleName) -import Language.PureScript.Types (SourceType, Type(..)) +import Language.PureScript.AST (Binder (..), CaseAlternative, Expr (..), GuardedExpr, Literal, nullSourceSpan, pattern MkUnguarded) +import Language.PureScript.Names (Ident, ModuleName, ProperName, ProperNameType (..), Qualified (..), QualifiedBy (..), byMaybeModuleName) +import Language.PureScript.Types (SourceType, Type (..)) lam :: Ident -> Expr -> Expr lam = Abs . mkBinder @@ -47,13 +47,13 @@ data UnwrappedTypeConstructor = UnwrappedTypeConstructor } utcQTyCon :: UnwrappedTypeConstructor -> Qualified (ProperName 'TypeName) -utcQTyCon UnwrappedTypeConstructor{..} = Qualified (ByModuleName utcModuleName) utcTyCon +utcQTyCon UnwrappedTypeConstructor {..} = Qualified (ByModuleName utcModuleName) utcTyCon unwrapTypeConstructor :: SourceType -> Maybe UnwrappedTypeConstructor unwrapTypeConstructor = go [] [] where - go kargs args = \case - TypeConstructor _ (Qualified (ByModuleName mn) tyCon) -> Just (UnwrappedTypeConstructor mn tyCon kargs args) - TypeApp _ ty arg -> go kargs (arg : args) ty - KindApp _ ty karg -> go (karg : kargs) args ty - _ -> Nothing + go kargs args = \case + TypeConstructor _ (Qualified (ByModuleName mn) tyCon) -> Just (UnwrappedTypeConstructor mn tyCon kargs args) + TypeApp _ ty arg -> go kargs (arg : args) ty + KindApp _ ty karg -> go (karg : kargs) args ty + _ -> Nothing diff --git a/src/Language/PureScript/Bundle.hs b/src/Language/PureScript/Bundle.hs index 26b932323..e60410678 100644 --- a/src/Language/PureScript/Bundle.hs +++ b/src/Language/PureScript/Bundle.hs @@ -1,38 +1,40 @@ --- | --- Bundles compiled PureScript modules for the browser. --- --- This module takes as input the individual generated modules from 'Language.PureScript.Make' and --- performs dead code elimination, filters empty modules, --- and generates the final JavaScript bundle. -module Language.PureScript.Bundle - ( ModuleIdentifier(..) - , ModuleType(..) - , ErrorMessage(..) - , printErrorMessage - , ForeignModuleExports(..) - , getExportedIdentifiers - , ForeignModuleImports(..) - , getImportedModules - , Module - ) where +{- | +Bundles compiled PureScript modules for the browser. + +This module takes as input the individual generated modules from 'Language.PureScript.Make' and +performs dead code elimination, filters empty modules, +and generates the final JavaScript bundle. +-} +module Language.PureScript.Bundle ( + ModuleIdentifier (..), + ModuleType (..), + ErrorMessage (..), + printErrorMessage, + ForeignModuleExports (..), + getExportedIdentifiers, + ForeignModuleImports (..), + getImportedModules, + Module, +) where import Prelude -import Control.Monad.Error.Class (MonadError(..)) +import Control.Monad.Error.Class (MonadError (..)) import Data.Aeson ((.=)) +import Data.Aeson qualified as A import Data.Char (chr, digitToInt) import Data.Foldable (fold) import Data.Maybe (mapMaybe, maybeToList) -import Data.Aeson qualified as A import Data.Text.Lazy qualified as LT -import Language.JavaScript.Parser (JSAST(..), JSAnnot(..), JSAssignOp(..), JSExpression(..), JSStatement(..), renderToText) -import Language.JavaScript.Parser.AST (JSCommaList(..), JSCommaTrailingList(..), JSExportClause(..), JSExportDeclaration(..), JSExportSpecifier(..), JSFromClause(..), JSIdent(..), JSImportDeclaration(..), JSModuleItem(..), JSObjectProperty(..), JSObjectPropertyList, JSPropertyName(..), JSVarInitializer(..)) +import Language.JavaScript.Parser (JSAST (..), JSAnnot (..), JSAssignOp (..), JSExpression (..), JSStatement (..), renderToText) +import Language.JavaScript.Parser.AST (JSCommaList (..), JSCommaTrailingList (..), JSExportClause (..), JSExportDeclaration (..), JSExportSpecifier (..), JSFromClause (..), JSIdent (..), JSImportDeclaration (..), JSModuleItem (..), JSObjectProperty (..), JSObjectPropertyList, JSPropertyName (..), JSVarInitializer (..)) import Language.JavaScript.Process.Minify (minifyJS) --- | The type of error messages. We separate generation and rendering of errors using a data --- type, in case we need to match on error types later. +{- | The type of error messages. We separate generation and rendering of errors using a data +type, in case we need to match on error types later. +-} data ErrorMessage = UnsupportedModulePath String | InvalidTopLevel @@ -44,8 +46,9 @@ data ErrorMessage | MissingMainModule String deriving (Show) --- | Modules are either "regular modules" (i.e. those generated by the PureScript compiler) or --- foreign modules. +{- | Modules are either "regular modules" (i.e. those generated by the PureScript compiler) or +foreign modules. +-} data ModuleType = Regular | Foreign @@ -60,37 +63,41 @@ data ModuleIdentifier = ModuleIdentifier String ModuleType deriving (Show, Eq, O instance A.ToJSON ModuleIdentifier where toJSON (ModuleIdentifier name mt) = - A.object [ "name" .= name - , "type" .= show mt - ] + A.object + [ "name" .= name + , "type" .= show mt + ] data Visibility = Public | Internal deriving (Show, Eq, Ord) --- | A piece of code is identified by its module, its name, and whether it is an internal variable --- or a public member. These keys are used to label vertices in the dependency graph. +{- | A piece of code is identified by its module, its name, and whether it is an internal variable +or a public member. These keys are used to label vertices in the dependency graph. +-} type Key = (ModuleIdentifier, String, Visibility) --- | An export is either a "regular export", which exports a name from the regular module we are in, --- or a reexport of a declaration in the corresponding foreign module. --- --- Regular exports are labelled, since they might re-export an operator with another name. +{- | An export is either a "regular export", which exports a name from the regular module we are in, +or a reexport of a declaration in the corresponding foreign module. + +Regular exports are labelled, since they might re-export an operator with another name. +-} data ExportType = RegularExport String | ForeignReexport deriving (Show, Eq, Ord) --- | There are four types of module element we are interested in: --- --- 1) Import declarations and require statements --- 2) Member declarations --- 3) Export lists --- 4) Everything else --- --- Each is labelled with the original AST node which generated it, so that we can dump it back --- into the output during codegen. +{- | There are four types of module element we are interested in: + +1) Import declarations and require statements +2) Member declarations +3) Export lists +4) Everything else + +Each is labelled with the original AST node which generated it, so that we can dump it back +into the output during codegen. +-} data ModuleElement = Import JSModuleItem String (Either String ModuleIdentifier) | Member JSStatement Visibility String JSExpression [Key] @@ -102,68 +109,76 @@ data ModuleElement instance A.ToJSON ModuleElement where toJSON = \case (Import _ name (Right target)) -> - A.object [ "type" .= A.String "Import" - , "name" .= name - , "target" .= target - ] + A.object + [ "type" .= A.String "Import" + , "name" .= name + , "target" .= target + ] (Import _ name (Left targetPath)) -> - A.object [ "type" .= A.String "Import" - , "name" .= name - , "targetPath" .= targetPath - ] + A.object + [ "type" .= A.String "Import" + , "name" .= name + , "targetPath" .= targetPath + ] (Member _ visibility name _ dependsOn) -> - A.object [ "type" .= A.String "Member" - , "name" .= name - , "visibility" .= show visibility - , "dependsOn" .= map keyToJSON dependsOn - ] + A.object + [ "type" .= A.String "Member" + , "name" .= name + , "visibility" .= show visibility + , "dependsOn" .= map keyToJSON dependsOn + ] (ExportsList exports) -> - A.object [ "type" .= A.String "ExportsList" - , "exports" .= map exportToJSON exports - ] + A.object + [ "type" .= A.String "ExportsList" + , "exports" .= map exportToJSON exports + ] (Other stmt) -> - A.object [ "type" .= A.String "Other" - , "js" .= getFragment (JSAstStatement stmt JSNoAnnot) - ] + A.object + [ "type" .= A.String "Other" + , "js" .= getFragment (JSAstStatement stmt JSNoAnnot) + ] (Skip item) -> - A.object [ "type" .= A.String "Skip" - , "js" .= getFragment (JSAstModule [item] JSNoAnnot) - ] - + A.object + [ "type" .= A.String "Skip" + , "js" .= getFragment (JSAstModule [item] JSNoAnnot) + ] where - - keyToJSON (mid, member, visibility) = - A.object [ "module" .= mid - , "member" .= member - , "visibility" .= show visibility - ] - - exportToJSON (RegularExport sourceName, name, _, dependsOn) = - A.object [ "type" .= A.String "RegularExport" - , "name" .= name - , "sourceName" .= sourceName - , "dependsOn" .= map keyToJSON dependsOn - ] - exportToJSON (ForeignReexport, name, _, dependsOn) = - A.object [ "type" .= A.String "ForeignReexport" - , "name" .= name - , "dependsOn" .= map keyToJSON dependsOn - ] - - getFragment = ellipsize . renderToText . minifyJS - where - ellipsize text = if LT.compareLength text 20 == GT then LT.take 19 text `LT.snoc` ellipsis else text - ellipsis = '\x2026' + keyToJSON (mid, member, visibility) = + A.object + [ "module" .= mid + , "member" .= member + , "visibility" .= show visibility + ] + + exportToJSON (RegularExport sourceName, name, _, dependsOn) = + A.object + [ "type" .= A.String "RegularExport" + , "name" .= name + , "sourceName" .= sourceName + , "dependsOn" .= map keyToJSON dependsOn + ] + exportToJSON (ForeignReexport, name, _, dependsOn) = + A.object + [ "type" .= A.String "ForeignReexport" + , "name" .= name + , "dependsOn" .= map keyToJSON dependsOn + ] + + getFragment = ellipsize . renderToText . minifyJS + where + ellipsize text = if LT.compareLength text 20 == GT then LT.take 19 text `LT.snoc` ellipsis else text + ellipsis = '\x2026' -- | A module is just a list of elements of the types listed above. data Module = Module ModuleIdentifier (Maybe FilePath) [ModuleElement] deriving (Show) instance A.ToJSON Module where toJSON (Module moduleId filePath elements) = - A.object [ "moduleId" .= moduleId - , "filePath" .= filePath - , "elements" .= elements - ] + A.object + [ "moduleId" .= moduleId + , "filePath" .= filePath + , "elements" .= elements + ] -- | Prepare an error message for consumption by humans. printErrorMessage :: ErrorMessage -> [String] @@ -175,7 +190,7 @@ printErrorMessage (UnsupportedModulePath s) = , " 3) foreign.cjs (PureScript CommonJS foreign modules)" ] printErrorMessage InvalidTopLevel = - [ "Expected a list of source elements at the top level." ] + ["Expected a list of source elements at the top level."] printErrorMessage (UnableToParseModule err) = [ "The module could not be parsed:" , err @@ -201,8 +216,8 @@ printErrorMessage UnsupportedExport = ] printErrorMessage (ErrorInModule mid e) = ("Error in module " ++ displayIdentifier mid ++ ":") - : "" - : map (" " ++) (printErrorMessage e) + : "" + : map (" " ++) (printErrorMessage e) where displayIdentifier (ModuleIdentifier name ty) = name ++ " (" ++ showModuleType ty ++ ")" @@ -221,28 +236,28 @@ fromStringLiteral _ = Nothing strValue :: String -> String strValue str = go $ drop 1 str where - go ('\\' : 'b' : xs) = '\b' : go xs - go ('\\' : 'f' : xs) = '\f' : go xs - go ('\\' : 'n' : xs) = '\n' : go xs - go ('\\' : 'r' : xs) = '\r' : go xs - go ('\\' : 't' : xs) = '\t' : go xs - go ('\\' : 'v' : xs) = '\v' : go xs - go ('\\' : '0' : xs) = '\0' : go xs - go ('\\' : 'x' : a : b : xs) = chr (a' + b') : go xs - where - a' = 16 * digitToInt a - b' = digitToInt b - go ('\\' : 'u' : a : b : c : d : xs) = chr (a' + b' + c' + d') : go xs - where - a' = 16 * 16 * 16 * digitToInt a - b' = 16 * 16 * digitToInt b - c' = 16 * digitToInt c - d' = digitToInt d - go ('\\' : x : xs) = x : go xs - go "\"" = "" - go "'" = "" - go (x : xs) = x : go xs - go "" = "" + go ('\\' : 'b' : xs) = '\b' : go xs + go ('\\' : 'f' : xs) = '\f' : go xs + go ('\\' : 'n' : xs) = '\n' : go xs + go ('\\' : 'r' : xs) = '\r' : go xs + go ('\\' : 't' : xs) = '\t' : go xs + go ('\\' : 'v' : xs) = '\v' : go xs + go ('\\' : '0' : xs) = '\0' : go xs + go ('\\' : 'x' : a : b : xs) = chr (a' + b') : go xs + where + a' = 16 * digitToInt a + b' = digitToInt b + go ('\\' : 'u' : a : b : c : d : xs) = chr (a' + b' + c' + d') : go xs + where + a' = 16 * 16 * 16 * digitToInt a + b' = 16 * 16 * digitToInt b + c' = 16 * digitToInt c + d' = digitToInt d + go ('\\' : x : xs) = x : go xs + go "\"" = "" + go "'" = "" + go (x : xs) = x : go xs + go "" = "" commaList :: JSCommaList a -> [a] commaList JSLNil = [] @@ -275,14 +290,14 @@ exportStatementIdentifiers _ = [] varNames :: JSCommaList JSExpression -> [String] varNames = mapMaybe varName . commaList where - varName (JSVarInitExpression (JSIdentifier _ ident) _) = Just ident - varName _ = Nothing + varName (JSVarInitExpression (JSIdentifier _ ident) _) = Just ident + varName _ = Nothing -data ForeignModuleExports = - ForeignModuleExports - { cjsExports :: [String] - , esExports :: [String] - } deriving (Show) +data ForeignModuleExports = ForeignModuleExports + { cjsExports :: [String] + , esExports :: [String] + } + deriving (Show) instance Semigroup ForeignModuleExports where (ForeignModuleExports cjsExports esExports) <> (ForeignModuleExports cjsExports' esExports') = @@ -294,54 +309,57 @@ instance Monoid ForeignModuleExports where -- -- TODO: what if we assign to exports.foo and then later assign to -- module.exports (presumably overwriting exports.foo)? -getExportedIdentifiers :: forall m. (MonadError ErrorMessage m) - => String - -> JSAST - -> m ForeignModuleExports +getExportedIdentifiers :: + forall m. + (MonadError ErrorMessage m) => + String -> + JSAST -> + m ForeignModuleExports getExportedIdentifiers mname top | JSAstModule jsModuleItems _ <- top = fold <$> traverse go jsModuleItems | otherwise = err InvalidTopLevel where - err :: ErrorMessage -> m a - err = throwError . ErrorInModule (ModuleIdentifier mname Foreign) - - go (JSModuleStatementListItem jsStatement) - | Just props <- matchExportsAssignment jsStatement - = do cjsExports <- traverse toIdent (trailingCommaList props) - pure ForeignModuleExports{ cjsExports, esExports = [] } - | Just (Public, name, _) <- matchMember jsStatement - = pure ForeignModuleExports{ cjsExports = [name], esExports = [] } - | otherwise - = pure mempty - go (JSModuleExportDeclaration _ jsExportDeclaration) = - pure ForeignModuleExports{ cjsExports = [], esExports = exportDeclarationIdentifiers jsExportDeclaration } - go _ = pure mempty - - toIdent (JSPropertyNameandValue name _ [_]) = - extractLabel' name - toIdent _ = - err UnsupportedExport - - extractLabel' = maybe (err UnsupportedExport) pure . extractLabel - - exportDeclarationIdentifiers (JSExportFrom jsExportClause _ _) = - exportClauseIdentifiers jsExportClause - exportDeclarationIdentifiers (JSExportLocals jsExportClause _) = - exportClauseIdentifiers jsExportClause - exportDeclarationIdentifiers (JSExport jsStatement _) = - exportStatementIdentifiers jsStatement - - exportClauseIdentifiers (JSExportClause _ jsExportsSpecifiers _) = - mapMaybe exportSpecifierName $ commaList jsExportsSpecifiers - - exportSpecifierName (JSExportSpecifier jsIdent) = identName jsIdent - exportSpecifierName (JSExportSpecifierAs _ _ jsIdentAs) = identName jsIdentAs - -data ForeignModuleImports = - ForeignModuleImports - { cjsImports :: [String] - , esImports :: [String] - } deriving (Show) + err :: ErrorMessage -> m a + err = throwError . ErrorInModule (ModuleIdentifier mname Foreign) + + go (JSModuleStatementListItem jsStatement) + | Just props <- matchExportsAssignment jsStatement = + do + cjsExports <- traverse toIdent (trailingCommaList props) + pure ForeignModuleExports {cjsExports, esExports = []} + | Just (Public, name, _) <- matchMember jsStatement = + pure ForeignModuleExports {cjsExports = [name], esExports = []} + | otherwise = + pure mempty + go (JSModuleExportDeclaration _ jsExportDeclaration) = + pure ForeignModuleExports {cjsExports = [], esExports = exportDeclarationIdentifiers jsExportDeclaration} + go _ = pure mempty + + toIdent (JSPropertyNameandValue name _ [_]) = + extractLabel' name + toIdent _ = + err UnsupportedExport + + extractLabel' = maybe (err UnsupportedExport) pure . extractLabel + + exportDeclarationIdentifiers (JSExportFrom jsExportClause _ _) = + exportClauseIdentifiers jsExportClause + exportDeclarationIdentifiers (JSExportLocals jsExportClause _) = + exportClauseIdentifiers jsExportClause + exportDeclarationIdentifiers (JSExport jsStatement _) = + exportStatementIdentifiers jsStatement + + exportClauseIdentifiers (JSExportClause _ jsExportsSpecifiers _) = + mapMaybe exportSpecifierName $ commaList jsExportsSpecifiers + + exportSpecifierName (JSExportSpecifier jsIdent) = identName jsIdent + exportSpecifierName (JSExportSpecifierAs _ _ jsIdentAs) = identName jsIdentAs + +data ForeignModuleImports = ForeignModuleImports + { cjsImports :: [String] + , esImports :: [String] + } + deriving (Show) instance Semigroup ForeignModuleImports where (ForeignModuleImports cjsImports esImports) <> (ForeignModuleImports cjsImports' esImports') = @@ -350,26 +368,28 @@ instance Monoid ForeignModuleImports where mempty = ForeignModuleImports [] [] -- Get a list of all the imported module identifiers from a foreign module. -getImportedModules :: forall m. (MonadError ErrorMessage m) - => String - -> JSAST - -> m ForeignModuleImports +getImportedModules :: + forall m. + (MonadError ErrorMessage m) => + String -> + JSAST -> + m ForeignModuleImports getImportedModules mname top | JSAstModule jsModuleItems _ <- top = pure $ foldMap go jsModuleItems | otherwise = err InvalidTopLevel where - err :: ErrorMessage -> m a - err = throwError . ErrorInModule (ModuleIdentifier mname Foreign) + err :: ErrorMessage -> m a + err = throwError . ErrorInModule (ModuleIdentifier mname Foreign) - go (JSModuleStatementListItem jsStatement) - | Just (_, mid) <- matchRequire jsStatement - = ForeignModuleImports{ cjsImports = [mid], esImports = [] } - go (JSModuleImportDeclaration _ jsImportDeclaration) = - ForeignModuleImports{ cjsImports = [], esImports = [importDeclarationModuleId jsImportDeclaration] } - go _ = mempty + go (JSModuleStatementListItem jsStatement) + | Just (_, mid) <- matchRequire jsStatement = + ForeignModuleImports {cjsImports = [mid], esImports = []} + go (JSModuleImportDeclaration _ jsImportDeclaration) = + ForeignModuleImports {cjsImports = [], esImports = [importDeclarationModuleId jsImportDeclaration]} + go _ = mempty - importDeclarationModuleId (JSImportDeclaration _ (JSFromClause _ _ mid) _) = mid - importDeclarationModuleId (JSImportDeclarationBare _ mid _) = mid + importDeclarationModuleId (JSImportDeclaration _ (JSFromClause _ _ mid) _) = mid + importDeclarationModuleId (JSImportDeclarationBare _ mid _) = mid -- Matches JS statements like this: -- var ModuleName = require("file"); @@ -381,22 +401,22 @@ matchRequire stmt , JSVarInit _ jsInitEx <- varInit , JSMemberExpression req _ argsE _ <- jsInitEx , JSIdentifier _ "require" <- req - , [ Just importPath ] <- map fromStringLiteral (commaList argsE) - = Just (importName, importPath) - | otherwise - = Nothing + , [Just importPath] <- map fromStringLiteral (commaList argsE) = + Just (importName, importPath) + | otherwise = + Nothing -- Matches JS member declarations. matchMember :: JSStatement -> Maybe (Visibility, String, JSExpression) matchMember stmt - | Just (name, decl) <- matchInternalMember stmt - = pure (Internal, name, decl) + | Just (name, decl) <- matchInternalMember stmt = + pure (Internal, name, decl) -- exports.foo = expr; exports["foo"] = expr; | JSAssignStatement e (JSAssign _) decl _ <- stmt - , Just name <- exportsAccessor e - = Just (Public, name, decl) - | otherwise - = Nothing + , Just name <- exportsAccessor e = + Just (Public, name, decl) + | otherwise = + Nothing matchInternalMember :: JSStatement -> Maybe (String, JSExpression) matchInternalMember stmt @@ -404,25 +424,25 @@ matchInternalMember stmt | JSVariable _ jsInit _ <- stmt , [JSVarInitExpression var varInit] <- commaList jsInit , JSIdentifier _ name <- var - , JSVarInit _ decl <- varInit - = pure (name, decl) + , JSVarInit _ decl <- varInit = + pure (name, decl) -- function foo(...args) { body } | JSFunction a0 jsIdent a1 args a2 body _ <- stmt - , JSIdentName _ name <- jsIdent - = pure (name, JSFunctionExpression a0 jsIdent a1 args a2 body) - | otherwise - = Nothing + , JSIdentName _ name <- jsIdent = + pure (name, JSFunctionExpression a0 jsIdent a1 args a2 body) + | otherwise = + Nothing -- Matches exports.* or exports["*"] expressions and returns the property name. exportsAccessor :: JSExpression -> Maybe String exportsAccessor (JSMemberDot exports _ nm) | JSIdentifier _ "exports" <- exports - , JSIdentifier _ name <- nm - = Just name + , JSIdentifier _ name <- nm = + Just name exportsAccessor (JSMemberSquare exports _ nm _) | JSIdentifier _ "exports" <- exports - , Just name <- fromStringLiteral nm - = Just name + , Just name <- fromStringLiteral nm = + Just name exportsAccessor _ = Nothing -- Matches assignments to module.exports, like this: @@ -433,10 +453,10 @@ matchExportsAssignment stmt , JSMemberDot module' _ exports <- e , JSIdentifier _ "module" <- module' , JSIdentifier _ "exports" <- exports - , JSObjectLiteral _ props _ <- decl - = Just props - | otherwise - = Nothing + , JSObjectLiteral _ props _ <- decl = + Just props + | otherwise = + Nothing extractLabel :: JSPropertyName -> Maybe String extractLabel (JSPropertyString _ nm) = Just $ strValue nm diff --git a/src/Language/PureScript/CST.hs b/src/Language/PureScript/CST.hs index b8e895fb2..1883a1134 100644 --- a/src/Language/PureScript/CST.hs +++ b/src/Language/PureScript/CST.hs @@ -1,60 +1,60 @@ -module Language.PureScript.CST - ( parseFromFile - , parseFromFiles - , parseModuleFromFile - , parseModulesFromFiles - , unwrapParserError - , toMultipleErrors - , toMultipleWarnings - , toPositionedError - , toPositionedWarning - , pureResult - , module Language.PureScript.CST.Convert - , module Language.PureScript.CST.Errors - , module Language.PureScript.CST.Lexer - , module Language.PureScript.CST.Monad - , module Language.PureScript.CST.Parser - , module Language.PureScript.CST.Print - , module Language.PureScript.CST.Types - ) where +module Language.PureScript.CST ( + parseFromFile, + parseFromFiles, + parseModuleFromFile, + parseModulesFromFiles, + unwrapParserError, + toMultipleErrors, + toMultipleWarnings, + toPositionedError, + toPositionedWarning, + pureResult, + module Language.PureScript.CST.Convert, + module Language.PureScript.CST.Errors, + module Language.PureScript.CST.Lexer, + module Language.PureScript.CST.Monad, + module Language.PureScript.CST.Parser, + module Language.PureScript.CST.Print, + module Language.PureScript.CST.Types, +) where import Prelude hiding (lex) -import Control.Monad.Error.Class (MonadError(..)) -import Control.Parallel.Strategies (withStrategy, parList, evalTuple2, r0, rseq) +import Control.Monad.Error.Class (MonadError (..)) +import Control.Parallel.Strategies (evalTuple2, parList, r0, rseq, withStrategy) import Data.List.NonEmpty qualified as NE import Data.Text (Text) import Language.PureScript.AST qualified as AST -import Language.PureScript.Errors qualified as E import Language.PureScript.CST.Convert import Language.PureScript.CST.Errors import Language.PureScript.CST.Lexer -import Language.PureScript.CST.Monad (Parser, ParserM(..), ParserState(..), LexResult, runParser, runTokenParser) +import Language.PureScript.CST.Monad (LexResult, Parser, ParserM (..), ParserState (..), runParser, runTokenParser) import Language.PureScript.CST.Parser import Language.PureScript.CST.Print import Language.PureScript.CST.Types +import Language.PureScript.Errors qualified as E pureResult :: a -> PartialResult a pureResult a = PartialResult a ([], pure a) -parseModulesFromFiles - :: forall m k - . MonadError E.MultipleErrors m - => (k -> FilePath) - -> [(k, Text)] - -> m [(k, PartialResult AST.Module)] +parseModulesFromFiles :: + forall m k. + (MonadError E.MultipleErrors m) => + (k -> FilePath) -> + [(k, Text)] -> + m [(k, PartialResult AST.Module)] parseModulesFromFiles toFilePath input = flip E.parU (handleParserError toFilePath) . inParallel . flip fmap input $ \(k, a) -> (k, parseModuleFromFile (toFilePath k) a) -parseFromFiles - :: forall m k - . MonadError E.MultipleErrors m - => (k -> FilePath) - -> [(k, Text)] - -> m [(k, ([ParserWarning], AST.Module))] +parseFromFiles :: + forall m k. + (MonadError E.MultipleErrors m) => + (k -> FilePath) -> + [(k, Text)] -> + m [(k, ([ParserWarning], AST.Module))] parseFromFiles toFilePath input = flip E.parU (handleParserError toFilePath) . inParallel @@ -67,21 +67,21 @@ parseModuleFromFile fp content = fmap (convertModule fp) <$> parseModule (lexMod parseFromFile :: FilePath -> Text -> ([ParserWarning], Either (NE.NonEmpty ParserError) AST.Module) parseFromFile fp content = fmap (convertModule fp) <$> parse content -handleParserError - :: forall m k a - . MonadError E.MultipleErrors m - => (k -> FilePath) - -> (k, Either (NE.NonEmpty ParserError) a) - -> m (k, a) +handleParserError :: + forall m k a. + (MonadError E.MultipleErrors m) => + (k -> FilePath) -> + (k, Either (NE.NonEmpty ParserError) a) -> + m (k, a) handleParserError toFilePath (k, res) = (k,) <$> unwrapParserError (toFilePath k) res -unwrapParserError - :: forall m a - . MonadError E.MultipleErrors m - => FilePath - -> Either (NE.NonEmpty ParserError) a - -> m a +unwrapParserError :: + forall m a. + (MonadError E.MultipleErrors m) => + FilePath -> + Either (NE.NonEmpty ParserError) a -> + m a unwrapParserError fp = either (throwError . toMultipleErrors fp) pure diff --git a/src/Language/PureScript/CST/Convert.hs b/src/Language/PureScript/CST/Convert.hs index c75d333dc..9e6868163 100644 --- a/src/Language/PureScript/CST/Convert.hs +++ b/src/Language/PureScript/CST/Convert.hs @@ -1,42 +1,129 @@ --- | This module contains functions for converting the CST into the core AST. It --- is mostly boilerplate, and does the job of resolving ranges for all the nodes --- and attaching comments. - -module Language.PureScript.CST.Convert - ( convertType - , convertExpr - , convertBinder - , convertDeclaration - , convertImportDecl - , convertModule - , sourcePos - , sourceSpan - , comment - , comments - ) where +{- | This module contains functions for converting the CST into the core AST. It +is mostly boilerplate, and does the job of resolving ranges for all the nodes +and attaching comments. +-} +module Language.PureScript.CST.Convert ( + convertType, + convertExpr, + convertBinder, + convertDeclaration, + convertImportDecl, + convertModule, + sourcePos, + sourceSpan, + comment, + comments, + runConvert, +) where import Prelude hiding (take) -import Data.Bifunctor (bimap, first) +import Control.Monad.State +import Data.Bifunctor (bimap, first, second) +import Data.Bitraversable (Bitraversable (..)) import Data.Char (toLower) -import Data.Foldable (foldl', toList) +import Data.Foldable (foldl', foldrM, toList, traverse_) import Data.Functor (($>)) import Data.List.NonEmpty qualified as NE -import Data.Maybe (isJust, fromJust, mapMaybe) +import Data.Map (Map) +import Data.Map qualified as M +import Data.Maybe (fromJust, isJust, mapMaybe) +import Data.Text (Text) import Data.Text qualified as Text import Language.PureScript.AST qualified as AST import Language.PureScript.AST.Declarations.ChainId (mkChainId) import Language.PureScript.AST.SourcePos qualified as Pos +import Language.PureScript.CST.Positions +import Language.PureScript.CST.Print (printToken) +import Language.PureScript.CST.Types import Language.PureScript.Comments qualified as C import Language.PureScript.Crash (internalError) import Language.PureScript.Environment qualified as Env import Language.PureScript.Label qualified as L +import Language.PureScript.Names (coerceProperName, runProperName) import Language.PureScript.Names qualified as N import Language.PureScript.PSString (mkString, prettyPrintStringJS) import Language.PureScript.Types qualified as T -import Language.PureScript.CST.Positions -import Language.PureScript.CST.Print (printToken) -import Language.PureScript.CST.Types + +import Data.List (partition) +import Debug.Trace (trace) + +type ConvertM a = State (Map Text T.SourceType) a + +runConvert :: ConvertM a -> a +runConvert ma = evalState ma M.empty + +tvKind :: SourceToken -> Text -> ConvertM T.SourceType +tvKind srcTok nm = do + cxt <- get + case M.lookup nm cxt of + Nothing -> + internalError $ + "Error: Missing kind annotation for TyVar " + <> Text.unpack nm + <> "\n at (or near): " + <> prettyRange (srcTokenRange srcTok) + Just t -> pure t + +prettyRange :: SourceRange -> String +prettyRange (SourceRange start end) = goPos start <> "-" <> goPos end + where + goPos (SourcePos line col) = show line <> ":" <> show col + +bindTv :: Text -> T.SourceType -> ConvertM () +bindTv nm ty = modify' (M.insert nm ty) + +srcTokenRange :: SourceToken -> SourceRange +srcTokenRange = tokRange . tokAnn + +{- Our new way of handling kinds introduces an annoying problem: + + We need to have the kinds of tyvars bound the decl kind signature or + type signature in scope when we convert the declaration. + +-} +groupSignaturesAndDeclarations :: (Show a) => [Declaration a] -> [[Declaration a]] +groupSignaturesAndDeclarations [] = [] +groupSignaturesAndDeclarations decls = + trace ("DECLARATIONS (grouping): \n" <> concatMap ((<> "\n\n") . show) decls) $ + go kindSigs typeSigs decls' + where + ((kindSigs, typeSigs), decls') = + foldr + ( \x acc -> case x of + ksig@(DeclKindSignature _ _ (Labeled (nameValue -> nm) _ _)) -> first (first $ M.insert nm ksig) acc + tsig@(DeclSignature _ (Labeled (nameValue -> nm) _ _)) -> first (second (M.insert nm tsig)) acc + other -> second (other :) acc + ) + ((M.empty, M.empty), []) + decls + + go _ _ [] = [] + go ksigs tsigs (d : ds) = case d of + dataDecl@(DeclData _ (DataHead _ (nameValue -> nm) _) _) -> case M.lookup nm ksigs of + Just sigDecl -> [sigDecl, dataDecl] : go ksigs tsigs ds + Nothing -> [dataDecl] : go ksigs tsigs ds + tyDecl@(DeclType _ (DataHead _ (nameValue -> nm) _) _ _) -> case M.lookup nm ksigs of + Just sigDecl -> [sigDecl, tyDecl] : go ksigs tsigs ds + Nothing -> [tyDecl] : go ksigs tsigs ds + newtypeDecl@(DeclNewtype _ (DataHead _ (nameValue -> nm) _) _ _ _) -> case M.lookup nm ksigs of + Just sigDecl -> [sigDecl, newtypeDecl] : go ksigs tsigs ds + Nothing -> [newtypeDecl] : go ksigs tsigs ds + classDecl@(DeclClass _ (clsName -> nm) _) -> case M.lookup (coerceProperName $ nameValue nm) ksigs of + Just sigDecl -> [sigDecl, classDecl] : go ksigs tsigs ds + Nothing -> [classDecl] : go ksigs tsigs ds + valDecl@(DeclValue _ (valName -> nm)) -> + let (valDecls', ds') = partition (valDecWithName nm) ds + valDecls = valDecl : valDecls' + in case M.lookup (nameValue nm) tsigs of + Just sigDecl -> (sigDecl : valDecls) : go ksigs tsigs ds' + Nothing -> valDecls : go ksigs tsigs ds' + -- I don't think anything else can have a type/kind sig but I could be wrong... + other -> [other] : go ksigs tsigs ds + where + valDecWithName :: Name Ident -> Declaration a -> Bool + valDecWithName nm (DeclValue _ (valName -> nm')) = nameValue nm == nameValue nm' + valDecWithName _ _ = False comment :: Comment a -> Maybe C.Comment comment = \case @@ -86,147 +173,178 @@ moduleName = \case TokOperator as _ -> go as _ -> Nothing where - go [] = Nothing - go ns = Just $ N.ModuleName $ Text.intercalate "." ns + go [] = Nothing + go ns = Just $ N.ModuleName $ Text.intercalate "." ns qualified :: QualifiedName a -> N.Qualified a qualified q = N.Qualified qb (qualName q) where - qb = maybe N.ByNullSourcePos N.ByModuleName $ qualModule q + qb = maybe N.ByNullSourcePos N.ByModuleName $ qualModule q ident :: Ident -> N.Ident ident = N.Ident . getIdent -convertType :: String -> Type a -> T.SourceType +convertType :: String -> Type a -> ConvertM T.SourceType convertType = convertType' False -convertVtaType :: String -> Type a -> T.SourceType +convertVtaType :: String -> Type a -> ConvertM T.SourceType convertVtaType = convertType' True -convertType' :: Bool -> String -> Type a -> T.SourceType +convertType' :: Bool -> String -> Type a -> ConvertM T.SourceType convertType' withinVta fileName = go where - goRow (Row labels tl) b = do - let - rowTail = case tl of - Just (_, ty) -> go ty - Nothing -> T.REmpty $ sourceAnnCommented fileName b b - rowCons (Labeled a _ ty) c = do - let ann = sourceAnnCommented fileName (lblTok a) (snd $ typeRange ty) - T.RCons ann (L.Label $ lblName a) (go ty) c - case labels of - Just (Separated h t) -> - rowCons h $ foldr (rowCons . snd) rowTail t - Nothing -> - rowTail - - go = \case - TypeVar _ a -> - T.TypeVar (sourceName fileName a) . getIdent $ nameValue a - TypeConstructor _ a -> - T.TypeConstructor (sourceQualName fileName a) $ qualified a - TypeWildcard _ a -> - T.TypeWildcard (sourceAnnCommented fileName a a) $ if withinVta then T.IgnoredWildcard else T.UnnamedWildcard - TypeHole _ a -> - T.TypeWildcard (sourceName fileName a) . T.HoleWildcard . getIdent $ nameValue a - TypeString _ a b -> - T.TypeLevelString (sourceAnnCommented fileName a a) b - TypeInt _ _ a b -> - T.TypeLevelInt (sourceAnnCommented fileName a a) b - TypeRow _ (Wrapped _ row b) -> - goRow row b - TypeRecord _ (Wrapped a row b) -> do - let - ann = sourceAnnCommented fileName a b - annRec = sourceAnn fileName a a - T.TypeApp ann (Env.tyRecord $> annRec) $ goRow row b - TypeForall _ kw bindings _ ty -> do + goRow :: Row a -> SourceToken -> ConvertM T.SourceType + goRow (Row labels tl) b = do let - mkForAll a b v t = do - let ann' = widenLeft (tokAnn $ nameTok a) $ T.getAnnForType t - T.ForAll ann' (maybe T.TypeVarInvisible (const T.TypeVarVisible) v) (getIdent $ nameValue a) b t Nothing - k (TypeVarKinded (Wrapped _ (Labeled (v, a) _ b) _)) = mkForAll a (Just (go b)) v - k (TypeVarName (v, a)) = mkForAll a Nothing v - ty' = foldr k (go ty) bindings - ann = widenLeft (tokAnn kw) $ T.getAnnForType ty' - T.setAnnForType ann ty' - TypeKinded _ ty _ kd -> do - let - ty' = go ty - kd' = go kd - ann = Pos.widenSourceAnn (T.getAnnForType ty') (T.getAnnForType kd') - T.KindedType ann ty' kd' - TypeApp _ a b -> do - let - a' = go a - b' = go b - ann = Pos.widenSourceAnn (T.getAnnForType a') (T.getAnnForType b') - T.TypeApp ann a' b' - ty@(TypeOp _ _ _ _) -> do - let - reassoc op b' a = do - let - a' = go a - op' = T.TypeOp (sourceQualName fileName op) $ qualified op + rowTail = case tl of + Just (_, ty) -> go ty + Nothing -> pure $ T.REmpty $ sourceAnnCommented fileName b b + rowCons (Labeled a _ ty) c = do + let ann = sourceAnnCommented fileName (lblTok a) (snd $ typeRange ty) + ty' <- go ty + pure $ T.RCons ann (L.Label $ lblName a) ty' c + case labels of + Just (Separated h t) -> do + rtail <- rowTail + rowCons h =<< foldrM (rowCons . snd) rtail t + Nothing -> + rowTail + go :: forall a. Type a -> ConvertM T.SourceType + go = \case + TypeKinded _ (TypeVar _ a) _ kd -> do + kd' <- go kd + let nm = getIdent (nameValue a) + bindTv nm kd' + pure $ T.TypeVar (sourceName fileName a) (getIdent $ nameValue a) kd' + TypeVar _ a -> do + kd <- tvKind (nameTok a) (getIdent $ nameValue a) + pure $ T.TypeVar (sourceName fileName a) (getIdent $ nameValue a) kd + TypeConstructor _ a -> + pure $ T.TypeConstructor (sourceQualName fileName a) $ qualified a + TypeWildcard _ a -> + pure $ T.TypeWildcard (sourceAnnCommented fileName a a) $ if withinVta then T.IgnoredWildcard else T.UnnamedWildcard + TypeHole _ a -> + pure $ T.TypeWildcard (sourceName fileName a) . T.HoleWildcard . getIdent $ nameValue a + TypeString _ a b -> + pure $ T.TypeLevelString (sourceAnnCommented fileName a a) b + TypeInt _ _ a b -> + pure $ T.TypeLevelInt (sourceAnnCommented fileName a a) b + TypeRow _ (Wrapped _ row b) -> + goRow row b + TypeRecord _ (Wrapped a row b) -> do + let + ann = sourceAnnCommented fileName a b + annRec = sourceAnn fileName a a + T.TypeApp ann (Env.tyRecord $> annRec) <$> goRow row b + TypeForall _ kw bindings _ ty -> do + -- TODO: Refactor this (if it works) + let + doBind (TypeVarKinded (Wrapped _ (Labeled (v, a) _ b) _)) = do + let nm = getIdent (nameValue a) + b' <- go b + bindTv nm b' + doBind (TypeVarName (v, a)) = internalError $ "Error: Universally quantified type variable without kind annotation: " <> (Text.unpack . getIdent . nameValue $ a) <> "\nat: " <> show v + + mkForAll a b v t = do + let ann' = widenLeft (tokAnn $ nameTok a) $ T.getAnnForType t + T.ForAll ann' (maybe T.TypeVarInvisible (const T.TypeVarVisible) v) (getIdent $ nameValue a) b t Nothing + + k (TypeVarKinded (Wrapped _ (Labeled (v, a) _ b) _)) t = do + let nm = getIdent (nameValue a) + b' <- go b + bindTv nm b' + pure $ mkForAll a b' v t + -- TODO: Fix this better + k (TypeVarName (v, a)) t = internalError $ "Error: Universally quantified type variable without kind annotation: " <> (Text.unpack . getIdent . nameValue $ a) <> "\nat: " <> show v + traverse_ doBind bindings + inner <- go ty + ty' <- foldrM k inner bindings + let ann = widenLeft (tokAnn kw) $ T.getAnnForType ty' + pure $ T.setAnnForType ann ty' + TypeKinded _ ty _ kd -> do + ty' <- go ty + kd' <- go kd + let ann = Pos.widenSourceAnn (T.getAnnForType ty') (T.getAnnForType kd') + pure $ T.KindedType ann ty' kd' + TypeApp _ a b -> do + a' <- go a + b' <- go b + let ann = Pos.widenSourceAnn (T.getAnnForType a') (T.getAnnForType b') + pure $ T.TypeApp ann a' b' + ty@(TypeOp {}) -> do + let + reassoc op b' a = do + a' <- go a + let + op' = T.TypeOp (sourceQualName fileName op) $ qualified op + ann = Pos.widenSourceAnn (T.getAnnForType a') (T.getAnnForType b') + pure $ T.BinaryNoParensType ann op' a' b' + loop :: (Type a -> ConvertM T.SourceType) -> Type a -> ConvertM T.SourceType + loop k = \case + TypeOp _ a op b -> do + b' <- k b + loop (reassoc op b') a + expr' -> k expr' + loop go ty + TypeOpName _ op -> do + let rng = qualRange op + pure $ T.TypeOp (uncurry (sourceAnnCommented fileName) rng) (qualified op) + TypeArr _ a arr b -> do + a' <- go a + b' <- go b + let arr' = Env.tyFunction $> sourceAnnCommented fileName arr arr ann = Pos.widenSourceAnn (T.getAnnForType a') (T.getAnnForType b') - T.BinaryNoParensType ann op' (go a) b' - loop k = \case - TypeOp _ a op b -> loop (reassoc op (k b)) a - expr' -> k expr' - loop go ty - TypeOpName _ op -> do - let rng = qualRange op - T.TypeOp (uncurry (sourceAnnCommented fileName) rng) (qualified op) - TypeArr _ a arr b -> do - let - a' = go a - b' = go b - arr' = Env.tyFunction $> sourceAnnCommented fileName arr arr - ann = Pos.widenSourceAnn (T.getAnnForType a') (T.getAnnForType b') - T.TypeApp ann (T.TypeApp ann arr' a') b' - TypeArrName _ a -> - Env.tyFunction $> sourceAnnCommented fileName a a - TypeConstrained _ a _ b -> do - let - a' = convertConstraint withinVta fileName a - b' = go b - ann = Pos.widenSourceAnn (T.constraintAnn a') (T.getAnnForType b') - T.ConstrainedType ann a' b' - TypeParens _ (Wrapped a ty b) -> - T.ParensInType (sourceAnnCommented fileName a b) $ go ty - ty@(TypeUnaryRow _ _ a) -> do - let - a' = go a - rng = typeRange ty - ann = uncurry (sourceAnnCommented fileName) rng - T.setAnnForType ann $ Env.kindRow a' - -convertConstraint :: Bool -> String -> Constraint a -> T.SourceConstraint + pure $ T.TypeApp ann (T.TypeApp ann arr' a') b' + TypeArrName _ a -> + pure $ Env.tyFunction $> sourceAnnCommented fileName a a + TypeConstrained _ a _ b -> do + a' <- convertConstraint withinVta fileName a + b' <- go b + let ann = Pos.widenSourceAnn (T.constraintAnn a') (T.getAnnForType b') + pure $ T.ConstrainedType ann a' b' + TypeParens _ (Wrapped a ty b) -> do + ty' <- go ty + pure $ T.ParensInType (sourceAnnCommented fileName a b) ty' + ty@(TypeUnaryRow _ _ a) -> do + a' <- go a + let rng = typeRange ty + ann = uncurry (sourceAnnCommented fileName) rng + pure $ T.setAnnForType ann $ Env.kindRow a' + +convertConstraint :: Bool -> String -> Constraint a -> ConvertM T.SourceConstraint convertConstraint withinVta fileName = go where - go = \case - cst@(Constraint _ name args) -> do - let ann = uncurry (sourceAnnCommented fileName) $ constraintRange cst - T.Constraint ann (qualified name) [] (convertType' withinVta fileName <$> args) Nothing - ConstraintParens _ (Wrapped _ c _) -> go c - -convertGuarded :: String -> Guarded a -> [AST.GuardedExpr] + go = \case + cst@(Constraint _ name args) -> do + let ann = uncurry (sourceAnnCommented fileName) $ constraintRange cst + args' <- traverse (convertType' withinVta fileName) args + pure $ T.Constraint ann (qualified name) [] args' Nothing + ConstraintParens _ (Wrapped _ c _) -> go c + +convertGuarded :: String -> Guarded a -> ConvertM [AST.GuardedExpr] convertGuarded fileName = \case - Unconditional _ x -> [AST.GuardedExpr [] (convertWhere fileName x)] - Guarded gs -> (\(GuardedExpr _ ps _ x) -> AST.GuardedExpr (p <$> toList ps) (convertWhere fileName x)) <$> NE.toList gs + Unconditional _ x -> do + where' <- convertWhere fileName x + pure [AST.GuardedExpr [] where'] + Guarded gs -> traverse uh $ NE.toList gs where - go = convertExpr fileName - p (PatternGuard Nothing x) = AST.ConditionGuard (go x) - p (PatternGuard (Just (b, _)) x) = AST.PatternGuard (convertBinder fileName b) (go x) - -convertWhere :: String -> Where a -> AST.Expr + uh (GuardedExpr _ ps _ x) = do + ps' <- traverse p (toList ps) + where' <- convertWhere fileName x + pure $ AST.GuardedExpr ps' where' + go = convertExpr fileName + p (PatternGuard Nothing x) = AST.ConditionGuard <$> go x + p (PatternGuard (Just (b, _)) x) = AST.PatternGuard <$> convertBinder fileName b <*> go x + +convertWhere :: String -> Where a -> ConvertM AST.Expr convertWhere fileName = \case Where expr Nothing -> convertExpr fileName expr Where expr (Just (_, bs)) -> do let ann = uncurry (sourceAnnCommented fileName) $ exprRange expr - uncurry AST.PositionedValue ann . AST.Let AST.FromWhere (convertLetBinding fileName <$> NE.toList bs) $ convertExpr fileName expr + letExp <- AST.Let AST.FromWhere <$> traverse (convertLetBinding fileName) (NE.toList bs) + uncurry AST.PositionedValue ann . letExp <$> convertExpr fileName expr -convertLetBinding :: String -> LetBinding a -> AST.Declaration +convertLetBinding :: String -> LetBinding a -> ConvertM AST.Declaration convertLetBinding fileName = \case LetBindingSignature _ lbl -> convertSignature fileName lbl @@ -235,266 +353,358 @@ convertLetBinding fileName = \case convertValueBindingFields fileName ann fields binding@(LetBindingPattern _ a _ b) -> do let ann = uncurry (sourceAnnCommented fileName) $ letBindingRange binding - AST.BoundValueDeclaration ann (convertBinder fileName a) (convertWhere fileName b) + binder' <- convertBinder fileName a + where' <- convertWhere fileName b + pure $ AST.BoundValueDeclaration ann binder' where' -convertExpr :: forall a. String -> Expr a -> AST.Expr +convertExpr :: forall a. String -> Expr a -> ConvertM AST.Expr convertExpr fileName = go where - positioned = - uncurry AST.PositionedValue - - goDoStatement = \case - stmt@(DoLet _ as) -> do - let ann = uncurry (sourceAnnCommented fileName) $ doStatementRange stmt - uncurry AST.PositionedDoNotationElement ann . AST.DoNotationLet $ convertLetBinding fileName <$> NE.toList as - stmt@(DoDiscard a) -> do - let ann = uncurry (sourceAnn fileName) $ doStatementRange stmt - uncurry AST.PositionedDoNotationElement ann . AST.DoNotationValue $ go a - stmt@(DoBind a _ b) -> do - let - ann = uncurry (sourceAnn fileName) $ doStatementRange stmt - a' = convertBinder fileName a - b' = go b - uncurry AST.PositionedDoNotationElement ann $ AST.DoNotationBind a' b' - - go = \case - ExprHole _ a -> - positioned (sourceName fileName a) . AST.Hole . getIdent $ nameValue a - ExprSection _ a -> - positioned (sourceAnnCommented fileName a a) AST.AnonymousArgument - ExprIdent _ a -> do - let ann = sourceQualName fileName a - positioned ann . AST.Var (fst ann) . qualified $ fmap ident a - ExprConstructor _ a -> do - let ann = sourceQualName fileName a - positioned ann . AST.Constructor (fst ann) $ qualified a - ExprBoolean _ a b -> do - let ann = sourceAnnCommented fileName a a - positioned ann . AST.Literal (fst ann) $ AST.BooleanLiteral b - ExprChar _ a b -> do - let ann = sourceAnnCommented fileName a a - positioned ann . AST.Literal (fst ann) $ AST.CharLiteral b - ExprString _ a b -> do - let ann = sourceAnnCommented fileName a a - positioned ann . AST.Literal (fst ann) . AST.StringLiteral $ b - ExprNumber _ a b -> do - let ann = sourceAnnCommented fileName a a - positioned ann . AST.Literal (fst ann) $ AST.NumericLiteral b - ExprArray _ (Wrapped a bs c) -> do - let - ann = sourceAnnCommented fileName a c - vals = case bs of - Just (Separated x xs) -> go x : (go . snd <$> xs) - Nothing -> [] - positioned ann . AST.Literal (fst ann) $ AST.ArrayLiteral vals - ExprRecord z (Wrapped a bs c) -> do - let - ann = sourceAnnCommented fileName a c - lbl = \case - RecordPun f -> (mkString . getIdent $ nameValue f, go . ExprIdent z $ QualifiedName (nameTok f) Nothing (nameValue f)) - RecordField f _ v -> (lblName f, go v) - vals = case bs of - Just (Separated x xs) -> lbl x : (lbl . snd <$> xs) - Nothing -> [] - positioned ann . AST.Literal (fst ann) $ AST.ObjectLiteral vals - ExprParens _ (Wrapped a b c) -> - positioned (sourceAnnCommented fileName a c) . AST.Parens $ go b - expr@(ExprTyped _ a _ b) -> do - let - a' = go a - b' = convertType fileName b - ann = (sourceSpan fileName . toSourceRange $ exprRange expr, []) - positioned ann $ AST.TypedValue True a' b' - expr@(ExprInfix _ a (Wrapped _ b _) c) -> do - let ann = (sourceSpan fileName . toSourceRange $ exprRange expr, []) - positioned ann $ AST.BinaryNoParens (go b) (go a) (go c) - expr@(ExprOp _ _ _ _) -> do - let - ann = uncurry (sourceAnn fileName) $ exprRange expr - reassoc op b a = do - let op' = AST.Op (sourceSpan fileName . toSourceRange $ qualRange op) $ qualified op - AST.BinaryNoParens op' (go a) b - loop k = \case - ExprOp _ a op b -> loop (reassoc op (k b)) a - expr' -> k expr' - positioned ann $ loop go expr - ExprOpName _ op -> do - let - rng = qualRange op - op' = AST.Op (sourceSpan fileName $ toSourceRange rng) $ qualified op - positioned (uncurry (sourceAnnCommented fileName) rng) op' - expr@(ExprNegate _ _ b) -> do - let ann = uncurry (sourceAnnCommented fileName) $ exprRange expr - positioned ann . AST.UnaryMinus (fst ann) $ go b - expr@(ExprRecordAccessor _ (RecordAccessor a _ (Separated h t))) -> do - let - ann = uncurry (sourceAnnCommented fileName) $ exprRange expr - field x f = AST.Accessor (lblName f) x - positioned ann $ foldl' (\x (_, f) -> field x f) (field (go a) h) t - expr@(ExprRecordUpdate _ a b) -> do - let - ann = uncurry (sourceAnnCommented fileName) $ exprRange expr - k (RecordUpdateLeaf f _ x) = (lblName f, AST.Leaf $ go x) - k (RecordUpdateBranch f xs) = (lblName f, AST.Branch $ toTree xs) - toTree (Wrapped _ xs _) = AST.PathTree . AST.AssocList . map k $ toList xs - positioned ann . AST.ObjectUpdateNested (go a) $ toTree b - expr@(ExprApp _ a b) -> do - let ann = uncurry (sourceAnn fileName) $ exprRange expr - positioned ann $ AST.App (go a) (go b) - expr@(ExprVisibleTypeApp _ a _ b) -> do - let ann = uncurry (sourceAnn fileName) $ exprRange expr - positioned ann $ AST.VisibleTypeApp (go a) (convertVtaType fileName b) - expr@(ExprLambda _ (Lambda _ as _ b)) -> do - let ann = uncurry (sourceAnnCommented fileName) $ exprRange expr - positioned ann - . AST.Abs (convertBinder fileName (NE.head as)) - . foldr (AST.Abs . convertBinder fileName) (go b) - $ NE.tail as - expr@(ExprIf _ (IfThenElse _ a _ b _ c)) -> do - let ann = uncurry (sourceAnnCommented fileName) $ exprRange expr - positioned ann $ AST.IfThenElse (go a) (go b) (go c) - expr@(ExprCase _ (CaseOf _ as _ bs)) -> do - let - ann = uncurry (sourceAnnCommented fileName) $ exprRange expr - as' = go <$> toList as - bs' = uncurry AST.CaseAlternative . bimap (map (convertBinder fileName) . toList) (convertGuarded fileName) <$> NE.toList bs - positioned ann $ AST.Case as' bs' - expr@(ExprLet _ (LetIn _ as _ b)) -> do - let ann = uncurry (sourceAnnCommented fileName) $ exprRange expr - positioned ann . AST.Let AST.FromLet (convertLetBinding fileName <$> NE.toList as) $ go b - -- expr@(ExprWhere _ (Where a _ bs)) -> do - -- let ann = uncurry (sourceAnnCommented fileName) $ exprRange expr - -- positioned ann . AST.Let AST.FromWhere (goLetBinding <$> bs) $ go a - expr@(ExprDo _ (DoBlock kw stmts)) -> do - let ann = uncurry (sourceAnnCommented fileName) $ exprRange expr - positioned ann . AST.Do (moduleName $ tokValue kw) $ goDoStatement <$> NE.toList stmts - expr@(ExprAdo _ (AdoBlock kw stms _ a)) -> do - let ann = uncurry (sourceAnnCommented fileName) $ exprRange expr - positioned ann . AST.Ado (moduleName $ tokValue kw) (goDoStatement <$> stms) $ go a - -convertBinder :: String -> Binder a -> AST.Binder + positioned = + uncurry AST.PositionedValue + + goDoStatement = \case + stmt@(DoLet _ as) -> do + let ann = uncurry (sourceAnnCommented fileName) $ doStatementRange stmt + bindings <- traverse (convertLetBinding fileName) (NE.toList as) + pure $ uncurry AST.PositionedDoNotationElement ann . AST.DoNotationLet $ bindings + stmt@(DoDiscard a) -> do + let ann = uncurry (sourceAnn fileName) $ doStatementRange stmt + uncurry AST.PositionedDoNotationElement ann . AST.DoNotationValue <$> go a + stmt@(DoBind a _ b) -> do + let ann = uncurry (sourceAnn fileName) $ doStatementRange stmt + a' <- convertBinder fileName a + b' <- go b + pure $ uncurry AST.PositionedDoNotationElement ann $ AST.DoNotationBind a' b' + + go :: Expr a -> ConvertM AST.Expr + go = \case + ExprHole _ a -> + pure $ positioned (sourceName fileName a) . AST.Hole . getIdent $ nameValue a + ExprSection _ a -> + pure $ positioned (sourceAnnCommented fileName a a) AST.AnonymousArgument + ExprIdent _ a -> do + let ann = sourceQualName fileName a + pure $ positioned ann . AST.Var (fst ann) . qualified $ fmap ident a + ExprConstructor _ a -> do + let ann = sourceQualName fileName a + pure $ positioned ann . AST.Constructor (fst ann) $ qualified a + ExprBoolean _ a b -> do + let ann = sourceAnnCommented fileName a a + pure $ positioned ann . AST.Literal (fst ann) $ AST.BooleanLiteral b + ExprChar _ a b -> do + let ann = sourceAnnCommented fileName a a + pure $ positioned ann . AST.Literal (fst ann) $ AST.CharLiteral b + ExprString _ a b -> do + let ann = sourceAnnCommented fileName a a + pure $ positioned ann . AST.Literal (fst ann) . AST.StringLiteral $ b + ExprNumber _ a b -> do + let ann = sourceAnnCommented fileName a a + pure $ positioned ann . AST.Literal (fst ann) $ AST.NumericLiteral b + ExprList _ (Wrapped a bs c) -> do + let + ann = sourceAnnCommented fileName a c + vals = case bs of + Just (Separated x xs) -> do + xs' <- traverse (go . snd) xs + x' <- go x + pure $ x' : xs' + Nothing -> pure [] + positioned ann . AST.Literal (fst ann) . AST.ListLiteral <$> vals + ExprRecord z (Wrapped a bs c) -> do + let + ann = sourceAnnCommented fileName a c + lbl = \case + RecordPun f -> do + exp' <- go . ExprIdent z $ QualifiedName (nameTok f) Nothing (nameValue f) + pure (mkString . getIdent $ nameValue f, exp') + RecordField f _ v -> (lblName f,) <$> go v + vals = case bs of + Just (Separated x xs) -> do + lx <- lbl x + lxs <- traverse (lbl . snd) xs + pure $ lx : lxs + Nothing -> pure [] + positioned ann . AST.Literal (fst ann) . AST.ObjectLiteral <$> vals + ExprParens _ (Wrapped a b c) -> + positioned (sourceAnnCommented fileName a c) . AST.Parens <$> go b + expr@(ExprTyped _ a _ b) -> do + a' <- go a + b' <- convertType fileName b + let ann = (sourceSpan fileName . toSourceRange $ exprRange expr, []) + pure $ positioned ann $ AST.TypedValue True a' b' + expr@(ExprInfix _ a (Wrapped _ b _) c) -> do + let ann = (sourceSpan fileName . toSourceRange $ exprRange expr, []) + a' <- go a + b' <- go b + c' <- go c + pure $ positioned ann $ AST.BinaryNoParens b' a' c' + expr@(ExprOp {}) -> do + let + ann = uncurry (sourceAnn fileName) $ exprRange expr + reassoc op b a = do + a' <- go a + let op' = AST.Op (sourceSpan fileName . toSourceRange $ qualRange op) $ qualified op + pure $ AST.BinaryNoParens op' a' b + loop k = \case + ExprOp _ a op b -> do + b' <- k b + loop (reassoc op b') a + expr' -> k expr' + positioned ann <$> loop go expr + ExprOpName _ op -> do + let + rng = qualRange op + op' = AST.Op (sourceSpan fileName $ toSourceRange rng) $ qualified op + pure $ positioned (uncurry (sourceAnnCommented fileName) rng) op' + expr@(ExprNegate _ _ b) -> do + let ann = uncurry (sourceAnnCommented fileName) $ exprRange expr + positioned ann . AST.UnaryMinus (fst ann) <$> go b + expr@(ExprRecordAccessor _ (RecordAccessor a _ (Separated h t))) -> do + let + ann = uncurry (sourceAnnCommented fileName) $ exprRange expr + field x f = AST.Accessor (lblName f) x + a' <- go a + pure $ positioned ann $ foldl (\x (_, f) -> field x f) (field a' h) t + expr@(ExprRecordUpdate _ a b) -> do + let + ann = uncurry (sourceAnnCommented fileName) $ exprRange expr + k (RecordUpdateLeaf f _ x) = go x >>= \x' -> pure (lblName f, AST.Leaf x') + k (RecordUpdateBranch f xs) = toTree xs >>= \xs' -> pure (lblName f, AST.Branch xs') + toTree (Wrapped _ xs _) = do + xs' <- traverse k $ toList xs + pure $ AST.PathTree . AST.AssocList $ xs' + a' <- go a + positioned ann . AST.ObjectUpdateNested a' <$> toTree b + expr@(ExprApp _ a b) -> do + let ann = uncurry (sourceAnn fileName) $ exprRange expr + a' <- go a + b' <- go b + pure $ positioned ann $ AST.App a' b' + expr@(ExprVisibleTypeApp _ a _ b) -> do + let ann = uncurry (sourceAnn fileName) $ exprRange expr + a' <- go a + b' <- convertVtaType fileName b + pure $ positioned ann $ AST.VisibleTypeApp a' b' + expr@(ExprLambda _ (Lambda _ as _ b)) -> do + let ann = uncurry (sourceAnnCommented fileName) $ exprRange expr + a' <- convertBinder fileName (NE.head as) + b' <- go b + let goAbs = + foldrM + ( \x acc -> do + x' <- convertBinder fileName x + pure $ AST.Abs x' acc + ) + inner <- goAbs b' (NE.tail as) + pure + $ positioned ann + . AST.Abs a' + $ inner + expr@(ExprIf _ (IfThenElse _ a _ b _ c)) -> do + let ann = uncurry (sourceAnnCommented fileName) $ exprRange expr + a' <- go a + b' <- go b + c' <- go c + pure $ positioned ann $ AST.IfThenElse a' b' c' + expr@(ExprCase _ (CaseOf _ as _ bs)) -> do + let ann = uncurry (sourceAnnCommented fileName) $ exprRange expr + as' <- traverse go $ toList as + let bss = NE.toList bs + bs' <- traverse (bitraverse (traverse (convertBinder fileName) . toList) (convertGuarded fileName)) bss + let bss' = uncurry AST.CaseAlternative <$> bs' + pure $ positioned ann $ AST.Case as' bss' + expr@(ExprLet _ (LetIn _ as _ b)) -> do + let ann = uncurry (sourceAnnCommented fileName) $ exprRange expr + as' <- traverse (convertLetBinding fileName) $ NE.toList as + b' <- go b + pure $ positioned ann $ AST.Let AST.FromLet as' b' + -- expr@(ExprWhere _ (Where a _ bs)) -> do + -- let ann = uncurry (sourceAnnCommented fileName) $ exprRange expr + -- positioned ann . AST.Let AST.FromWhere (goLetBinding <$> bs) $ go a + expr@(ExprDo _ (DoBlock kw stmts)) -> do + let ann = uncurry (sourceAnnCommented fileName) $ exprRange expr + stmts' <- traverse goDoStatement (NE.toList stmts) + pure $ positioned ann . AST.Do (moduleName $ tokValue kw) $ stmts' + expr@(ExprAdo _ (AdoBlock kw stms _ a)) -> do + let ann = uncurry (sourceAnnCommented fileName) $ exprRange expr + stmts <- traverse goDoStatement stms + a' <- go a + pure $ positioned ann $ AST.Ado (moduleName $ tokValue kw) stmts a' + +convertBinder :: String -> Binder a -> ConvertM AST.Binder convertBinder fileName = go where - positioned = - uncurry AST.PositionedBinder - - go = \case - BinderWildcard _ a -> - positioned (sourceAnnCommented fileName a a) AST.NullBinder - BinderVar _ a -> do - let ann = sourceName fileName a - positioned ann . AST.VarBinder (fst ann) . ident $ nameValue a - binder@(BinderNamed _ a _ b) -> do - let ann = uncurry (sourceAnnCommented fileName) $ binderRange binder - positioned ann . AST.NamedBinder (fst ann) (ident $ nameValue a) $ go b - binder@(BinderConstructor _ a bs) -> do - let ann = uncurry (sourceAnnCommented fileName) $ binderRange binder - positioned ann . AST.ConstructorBinder (fst ann) (qualified a) $ go <$> bs - BinderBoolean _ a b -> do - let ann = sourceAnnCommented fileName a a - positioned ann . AST.LiteralBinder (fst ann) $ AST.BooleanLiteral b - BinderChar _ a b -> do - let ann = sourceAnnCommented fileName a a - positioned ann . AST.LiteralBinder (fst ann) $ AST.CharLiteral b - BinderString _ a b -> do - let ann = sourceAnnCommented fileName a a - positioned ann . AST.LiteralBinder (fst ann) . AST.StringLiteral $ b - BinderNumber _ n a b -> do - let - ann = sourceAnnCommented fileName a a - b' - | isJust n = bimap negate negate b - | otherwise = b - positioned ann . AST.LiteralBinder (fst ann) $ AST.NumericLiteral b' - BinderArray _ (Wrapped a bs c) -> do - let - ann = sourceAnnCommented fileName a c - vals = case bs of - Just (Separated x xs) -> go x : (go . snd <$> xs) - Nothing -> [] - positioned ann . AST.LiteralBinder (fst ann) $ AST.ArrayLiteral vals - BinderRecord z (Wrapped a bs c) -> do - let - ann = sourceAnnCommented fileName a c - lbl = \case - RecordPun f -> (mkString . getIdent $ nameValue f, go $ BinderVar z f) - RecordField f _ v -> (lblName f, go v) - vals = case bs of - Just (Separated x xs) -> lbl x : (lbl . snd <$> xs) - Nothing -> [] - positioned ann . AST.LiteralBinder (fst ann) $ AST.ObjectLiteral vals - BinderParens _ (Wrapped a b c) -> - positioned (sourceAnnCommented fileName a c) . AST.ParensInBinder $ go b - binder@(BinderTyped _ a _ b) -> do - let - a' = go a - b' = convertType fileName b - ann = (sourceSpan fileName . toSourceRange $ binderRange binder, []) - positioned ann $ AST.TypedBinder b' a' - binder@(BinderOp _ _ _ _) -> do - let - ann = uncurry (sourceAnn fileName) $ binderRange binder - reassoc op b a = do - let op' = AST.OpBinder (sourceSpan fileName . toSourceRange $ qualRange op) $ qualified op - AST.BinaryNoParensBinder op' (go a) b - loop k = \case - BinderOp _ a op b -> loop (reassoc op (k b)) a - binder' -> k binder' - positioned ann $ loop go binder - -convertDeclaration :: String -> Declaration a -> [AST.Declaration] + positioned = + uncurry AST.PositionedBinder + + go :: Binder a -> ConvertM AST.Binder + go = \case + BinderWildcard _ a -> + pure $ positioned (sourceAnnCommented fileName a a) AST.NullBinder + BinderVar _ a -> do + let ann = sourceName fileName a + pure $ positioned ann . AST.VarBinder (fst ann) . ident $ nameValue a + binder@(BinderNamed _ a _ b) -> do + let ann = uncurry (sourceAnnCommented fileName) $ binderRange binder + positioned ann . AST.NamedBinder (fst ann) (ident $ nameValue a) <$> go b + binder@(BinderConstructor _ a bs) -> do + let ann = uncurry (sourceAnnCommented fileName) $ binderRange binder + positioned ann . AST.ConstructorBinder (fst ann) (qualified a) <$> traverse go bs + BinderBoolean _ a b -> do + let ann = sourceAnnCommented fileName a a + pure $ positioned ann . AST.LiteralBinder (fst ann) $ AST.BooleanLiteral b + BinderChar _ a b -> do + let ann = sourceAnnCommented fileName a a + pure $ positioned ann . AST.LiteralBinder (fst ann) $ AST.CharLiteral b + BinderString _ a b -> do + let ann = sourceAnnCommented fileName a a + pure $ positioned ann . AST.LiteralBinder (fst ann) . AST.StringLiteral $ b + BinderNumber _ n a b -> do + let + ann = sourceAnnCommented fileName a a + b' + | isJust n = bimap negate negate b + | otherwise = b + pure $ positioned ann . AST.LiteralBinder (fst ann) $ AST.NumericLiteral b' + BinderList _ (Wrapped a bs c) -> do + let + ann = sourceAnnCommented fileName a c + vals = case bs of + Just (Separated x xs) -> do + x' <- go x + xs' <- traverse (go . snd) xs + pure $ x' : xs' + Nothing -> pure [] + positioned ann . AST.LiteralBinder (fst ann) . AST.ListLiteral <$> vals + BinderRecord z (Wrapped a bs c) -> do + let + ann = sourceAnnCommented fileName a c + lbl = \case + RecordPun f -> (mkString . getIdent $ nameValue f,) <$> go (BinderVar z f) + RecordField f _ v -> (lblName f,) <$> go v + vals = case bs of + Just (Separated x xs) -> do + x' <- lbl x + xs' <- traverse (lbl . snd) xs + pure $ x' : xs' + Nothing -> pure [] + positioned ann . AST.LiteralBinder (fst ann) . AST.ObjectLiteral <$> vals + BinderParens _ (Wrapped a b c) -> + positioned (sourceAnnCommented fileName a c) . AST.ParensInBinder <$> go b + binder@(BinderTyped _ a _ b) -> do + a' <- go a + b' <- convertType fileName b + let ann = (sourceSpan fileName . toSourceRange $ binderRange binder, []) + pure $ positioned ann $ AST.TypedBinder b' a' + binder@(BinderOp {}) -> do + let + ann = uncurry (sourceAnn fileName) $ binderRange binder + reassoc op b a = do + let op' = AST.OpBinder (sourceSpan fileName . toSourceRange $ qualRange op) $ qualified op + a' <- go a + pure $ AST.BinaryNoParensBinder op' a' b + loop k = \case + BinderOp _ a op b -> do + b' <- k b + loop (reassoc op b') a + binder' -> k binder' + positioned ann <$> loop go binder + +convertDeclaration :: String -> Declaration a -> ConvertM [AST.Declaration] convertDeclaration fileName decl = case decl of DeclData _ (DataHead _ a vars) bd -> do + vars' <- traverse goTypeVar vars let - ctrs :: SourceToken -> DataCtor a -> [(SourceToken, DataCtor a)] -> [AST.DataConstructorDeclaration] - ctrs st (DataCtor _ name fields) tl - = AST.DataConstructorDeclaration (sourceAnnCommented fileName st (nameTok name)) (nameValue name) (zip ctrFields $ convertType fileName <$> fields) - : (case tl of - [] -> [] - (st', ctor) : tl' -> ctrs st' ctor tl' - ) - pure $ AST.DataDeclaration ann Env.Data (nameValue a) (goTypeVar <$> vars) (maybe [] (\(st, Separated hd tl) -> ctrs st hd tl) bd) - DeclType _ (DataHead _ a vars) _ bd -> - pure $ AST.TypeSynonymDeclaration ann - (nameValue a) - (goTypeVar <$> vars) - (convertType fileName bd) + ctrs :: SourceToken -> DataCtor a -> [(SourceToken, DataCtor a)] -> ConvertM [AST.DataConstructorDeclaration] + ctrs st (DataCtor _ name fields) tl = do + fields' <- traverse (convertType fileName) fields + case tl of + [] -> + pure [AST.DataConstructorDeclaration (sourceAnnCommented fileName st (nameTok name)) (nameValue name) (zip ctrFields fields')] + (st', ctor) : tl' -> do + rest <- ctrs st' ctor tl' + pure $ + AST.DataConstructorDeclaration (sourceAnnCommented fileName st (nameTok name)) (nameValue name) (zip ctrFields fields') + : rest + + ctorDecls <- maybe (pure []) (\(st, Separated hd tl) -> ctrs st hd tl) bd + pure [AST.DataDeclaration ann Env.Data (nameValue a) vars' ctorDecls] + DeclType _ (DataHead _ a vars) _ bd -> do + vars' <- traverse goTypeVar vars + bd' <- convertType fileName bd + pure . pure $ + AST.TypeSynonymDeclaration + ann + (nameValue a) + vars' + bd' DeclNewtype _ (DataHead _ a vars) st x ys -> do - let ctrs = [AST.DataConstructorDeclaration (sourceAnnCommented fileName st (snd $ declRange decl)) (nameValue x) [(head ctrFields, convertType fileName ys)]] - pure $ AST.DataDeclaration ann Env.Newtype (nameValue a) (goTypeVar <$> vars) ctrs + vars' <- traverse goTypeVar vars + ys' <- convertType fileName ys + let ctrs = [AST.DataConstructorDeclaration (sourceAnnCommented fileName st (snd $ declRange decl)) (nameValue x) [(head ctrFields, ys')]] + pure [AST.DataDeclaration ann Env.Newtype (nameValue a) vars' ctrs] DeclClass _ (ClassHead _ sup name vars fdeps) bd -> do let goTyVar (TypeVarKinded (Wrapped _ (Labeled (_, a) _ _) _)) = nameValue a goTyVar (TypeVarName (_, a)) = nameValue a - vars' = zip (toList $ goTyVar <$> vars) [0..] + vars' = zip (toList $ goTyVar <$> vars) [0 ..] goName = fromJust . flip lookup vars' . nameValue goFundep (FundepDetermined _ bs) = Env.FunctionalDependency [] (goName <$> NE.toList bs) goFundep (FundepDetermines as _ bs) = Env.FunctionalDependency (goName <$> NE.toList as) (goName <$> NE.toList bs) goSig (Labeled n _ ty) = do - let - ty' = convertType fileName ty - ann' = widenLeft (tokAnn $ nameTok n) $ T.getAnnForType ty' - AST.TypeDeclaration $ AST.TypeDeclarationData ann' (ident $ nameValue n) ty' - pure $ AST.TypeClassDeclaration ann - (nameValue name) - (goTypeVar <$> vars) - (convertConstraint False fileName <$> maybe [] (toList . fst) sup) - (goFundep <$> maybe [] (toList . snd) fdeps) - (goSig <$> maybe [] (NE.toList . snd) bd) + ty' <- convertType fileName ty + let ann' = widenLeft (tokAnn $ nameTok n) $ T.getAnnForType ty' + pure [AST.TypeDeclaration $ AST.TypeDeclarationData ann' (ident $ nameValue n) ty'] + argVars <- traverse goTypeVar vars + cstrnt <- traverse (convertConstraint False fileName) $ maybe [] (toList . fst) sup + sig' <- traverse goSig $ maybe [] (NE.toList . snd) bd + pure . pure $ + AST.TypeClassDeclaration + ann + (nameValue name) + argVars + cstrnt + (goFundep <$> maybe [] (toList . snd) fdeps) + (concat sig') DeclInstanceChain _ insts -> do let chainId = mkChainId fileName $ startSourcePos $ instKeyword $ instHead $ sepHead insts - goInst ix inst@(Instance (InstanceHead _ nameSep ctrs cls args) bd) = do + bindTypeVariables Nothing = pure () + bindTypeVariables (Just (stok, bindings)) = traverse_ (goTvBind stok) (NE.toList bindings) + goTvBind stok = \case + TypeVarKinded (Wrapped _ (Labeled (_, nm) _ ki) _) -> do + let nm' = getIdent (nameValue nm) + ki' <- convertType fileName ki + bindTv nm' ki' + TypeVarName (_, nm) -> do + let nm' = Text.unpack . getIdent . nameValue $ nm + internalError $ + "Error in instance declaration near " + <> prettyRange (srcTokenRange stok) + <> "\n Missing kind annotation for Type Var '" + <> nm' + <> "'" + goInst ix inst@(Instance (InstanceHead _ _todo nameSep ctrs cls args) bd) = do + bindTypeVariables _todo let ann' = uncurry (sourceAnnCommented fileName) $ instanceRange inst clsAnn = findInstanceAnn cls args - AST.TypeInstanceDeclaration ann' clsAnn chainId ix - (mkPartialInstanceName nameSep cls args) - (convertConstraint False fileName <$> maybe [] (toList . fst) ctrs) - (qualified cls) - (convertType fileName <$> args) - (AST.ExplicitInstance $ goInstanceBinding <$> maybe [] (NE.toList . snd) bd) - uncurry goInst <$> zip [0..] (toList insts) - DeclDerive _ _ new (InstanceHead kw nameSep ctrs cls args) -> do + cstrnt <- traverse (convertConstraint False fileName) $ maybe [] (toList . fst) ctrs + args' <- traverse (convertType fileName) args + instBinding <- traverse goInstanceBinding $ maybe [] (NE.toList . snd) bd + pure $ + AST.TypeInstanceDeclaration + ann' + clsAnn + chainId + ix + (mkPartialInstanceName nameSep cls args) + cstrnt + (qualified cls) + args' + (AST.ExplicitInstance instBinding) + pure $ runConvert . uncurry goInst <$> zip [0 ..] (toList insts) + DeclDerive _ _ new (InstanceHead kw _todo nameSep ctrs cls args) -> do let chainId = mkChainId fileName $ startSourcePos kw name' = mkPartialInstanceName nameSep cls args @@ -502,12 +712,24 @@ convertDeclaration fileName decl = case decl of | isJust new = AST.NewtypeInstance | otherwise = AST.DerivedInstance clsAnn = findInstanceAnn cls args - pure $ AST.TypeInstanceDeclaration ann clsAnn chainId 0 name' - (convertConstraint False fileName <$> maybe [] (toList . fst) ctrs) - (qualified cls) - (convertType fileName <$> args) - instTy + cstrnt <- traverse (convertConstraint False fileName) $ maybe [] (toList . fst) ctrs + args' <- traverse (convertType fileName) args + pure + [ AST.TypeInstanceDeclaration + ann + clsAnn + chainId + 0 + name' + cstrnt + (qualified cls) + args' + instTy + ] DeclKindSignature _ kw (Labeled name _ ty) -> do + let nm = runProperName (nameValue name) + ty' <- convertType fileName ty + bindTv nm ty' let kindFor = case tokValue kw of TokLowerName [] "data" -> AST.DataSig @@ -515,145 +737,148 @@ convertDeclaration fileName decl = case decl of TokLowerName [] "type" -> AST.TypeSynonymSig TokLowerName [] "class" -> AST.ClassSig tok -> internalError $ "Invalid kind signature keyword " <> Text.unpack (printToken tok) - pure . AST.KindDeclaration ann kindFor (nameValue name) $ convertType fileName ty + pure [AST.KindDeclaration ann kindFor (nameValue name) ty'] DeclSignature _ lbl -> - pure $ convertSignature fileName lbl + pure <$> convertSignature fileName lbl DeclValue _ fields -> - pure $ convertValueBindingFields fileName ann fields + pure <$> convertValueBindingFields fileName ann fields DeclFixity _ (FixityFields (_, kw) (_, prec) fxop) -> do let - assoc = case kw of - Infix -> AST.Infix + assoc = case kw of + Infix -> AST.Infix Infixr -> AST.Infixr Infixl -> AST.Infixl fixity = AST.Fixity assoc prec - pure $ AST.FixityDeclaration ann $ case fxop of - FixityValue name _ op -> do - Left $ AST.ValueFixity fixity (first ident <$> qualified name) (nameValue op) + pure . pure $ AST.FixityDeclaration ann $ case fxop of + FixityValue name _ op -> Left $ AST.ValueFixity fixity (first ident <$> qualified name) (nameValue op) FixityType _ name _ op -> Right $ AST.TypeFixity fixity (qualified name) (nameValue op) DeclForeign _ _ _ frn -> - pure $ case frn of + pure <$> case frn of ForeignValue (Labeled a _ b) -> - AST.ExternDeclaration ann (ident $ nameValue a) $ convertType fileName b + AST.ExternDeclaration ann (ident $ nameValue a) <$> convertType fileName b ForeignData _ (Labeled a _ b) -> - AST.ExternDataDeclaration ann (nameValue a) $ convertType fileName b + AST.ExternDataDeclaration ann (nameValue a) <$> convertType fileName b ForeignKind _ a -> - AST.DataDeclaration ann Env.Data (nameValue a) [] [] + pure $ AST.DataDeclaration ann Env.Data (nameValue a) [] [] DeclRole _ _ _ name roles -> - pure $ AST.RoleDeclaration $ - AST.RoleDeclarationData ann (nameValue name) (roleValue <$> NE.toList roles) + pure . pure $ + AST.RoleDeclaration $ + AST.RoleDeclarationData ann (nameValue name) (roleValue <$> NE.toList roles) where - ann = - uncurry (sourceAnnCommented fileName) $ declRange decl - - startSourcePos :: SourceToken -> Pos.SourcePos - startSourcePos = sourcePos . srcStart . tokRange . tokAnn - - mkPartialInstanceName :: Maybe (Name Ident, SourceToken) -> QualifiedName (N.ProperName 'N.ClassName) -> [Type a] -> Either Text.Text N.Ident - mkPartialInstanceName nameSep cls args = - maybe (Left genName) (Right . ident . nameValue . fst) nameSep - where - -- truncate to 25 chars to reduce verbosity - -- of name and still keep it readable - -- name will be used to create a GenIdent - -- in desugaring process - genName :: Text.Text - genName = Text.take 25 (className <> typeArgs) - - className :: Text.Text - className - = foldMap (uncurry Text.cons . first toLower) - . Text.uncons - . N.runProperName - $ qualName cls - - typeArgs :: Text.Text - typeArgs = foldMap argName args - - argName :: Type a -> Text.Text - argName = \case - -- These are only useful to disambiguate between overlapping instances - -- but they’re disallowed outside of instance chains. Since we’re - -- avoiding name collisions with unique identifiers anyway, - -- we don't need to render this constructor. - TypeVar{} -> "" - TypeConstructor _ qn -> N.runProperName $ qualName qn - TypeOpName _ qn -> N.runOpName $ qualName qn - TypeString _ _ ps -> prettyPrintStringJS ps - TypeInt _ _ _ nt -> Text.pack $ show nt - - -- Typed holes are disallowed in instance heads - TypeHole{} -> "" - TypeParens _ t -> argName $ wrpValue t - TypeKinded _ t1 _ t2 -> argName t1 <> argName t2 - TypeRecord _ _ -> "Record" - TypeRow _ _ -> "Row" - TypeArrName _ _ -> "Function" - TypeWildcard{} -> "_" - - -- Polytypes are disallowed in instance heads - TypeForall{} -> "" - TypeApp _ t1 t2 -> argName t1 <> argName t2 - TypeOp _ t1 op t2 -> - argName t1 <> N.runOpName (qualName op) <> argName t2 - TypeArr _ t1 _ t2 -> argName t1 <> "Function" <> argName t2 - TypeConstrained{} -> "" - TypeUnaryRow{} -> "Row" - - goTypeVar = \case - TypeVarKinded (Wrapped _ (Labeled (_, x) _ y) _) -> (getIdent $ nameValue x, Just $ convertType fileName y) - TypeVarName (_, x) -> (getIdent $ nameValue x, Nothing) - - goInstanceBinding = \case - InstanceBindingSignature _ lbl -> - convertSignature fileName lbl - binding@(InstanceBindingName _ fields) -> do - let ann' = uncurry (sourceAnnCommented fileName) $ instanceBindingRange binding - convertValueBindingFields fileName ann' fields - - findInstanceAnn cls args = uncurry (sourceAnnCommented fileName) $ - if null args then - qualRange cls - else - (fst $ qualRange cls, snd $ typeRange $ last args) - -convertSignature :: String -> Labeled (Name Ident) (Type a) -> AST.Declaration + ann = + uncurry (sourceAnnCommented fileName) $ declRange decl + + startSourcePos :: SourceToken -> Pos.SourcePos + startSourcePos = sourcePos . srcStart . tokRange . tokAnn + + mkPartialInstanceName :: Maybe (Name Ident, SourceToken) -> QualifiedName (N.ProperName 'N.ClassName) -> [Type a] -> Either Text.Text N.Ident + mkPartialInstanceName nameSep cls args = + maybe (Left genName) (Right . ident . nameValue . fst) nameSep + where + -- truncate to 25 chars to reduce verbosity + -- of name and still keep it readable + -- name will be used to create a GenIdent + -- in desugaring process + genName :: Text.Text + genName = Text.take 25 (className <> typeArgs) + + className :: Text.Text + className = + foldMap (uncurry Text.cons . first toLower) + . Text.uncons + . N.runProperName + $ qualName cls + + typeArgs :: Text.Text + typeArgs = foldMap argName args + + argName :: Type a -> Text.Text + argName = \case + -- These are only useful to disambiguate between overlapping instances + -- but they’re disallowed outside of instance chains. Since we’re + -- avoiding name collisions with unique identifiers anyway, + -- we don't need to render this constructor. + TypeVar {} -> "" + TypeConstructor _ qn -> N.runProperName $ qualName qn + TypeOpName _ qn -> N.runOpName $ qualName qn + TypeString _ _ ps -> prettyPrintStringJS ps + TypeInt _ _ _ nt -> Text.pack $ show nt + -- Typed holes are disallowed in instance heads + TypeHole {} -> "" + TypeParens _ t -> argName $ wrpValue t + TypeKinded _ t1 _ t2 -> argName t1 <> argName t2 + TypeRecord _ _ -> "Record" + TypeRow _ _ -> "Row" + TypeArrName _ _ -> "Function" + TypeWildcard {} -> "_" + -- Polytypes are disallowed in instance heads + TypeForall {} -> "" + TypeApp _ t1 t2 -> argName t1 <> argName t2 + TypeOp _ t1 op t2 -> + argName t1 <> N.runOpName (qualName op) <> argName t2 + TypeArr _ t1 _ t2 -> argName t1 <> "Function" <> argName t2 + TypeConstrained {} -> "" + TypeUnaryRow {} -> "Row" + + goTypeVar = \case + TypeVarKinded (Wrapped _ (Labeled (_, x) _ y) _) -> do + let nm = getIdent (nameValue x) + k <- convertType fileName y + bindTv nm k + pure (nm, k) + TypeVarName (_, x) -> do + let nm = getIdent (nameValue x) + ki <- tvKind (nameTok x) nm + pure (nm, ki) + + goInstanceBinding = \case + InstanceBindingSignature _ lbl -> + convertSignature fileName lbl + binding@(InstanceBindingName _ fields) -> do + let ann' = uncurry (sourceAnnCommented fileName) $ instanceBindingRange binding + convertValueBindingFields fileName ann' fields + + findInstanceAnn cls args = + uncurry (sourceAnnCommented fileName) $ + if null args + then qualRange cls + else (fst $ qualRange cls, snd $ typeRange $ last args) + +convertSignature :: String -> Labeled (Name Ident) (Type a) -> ConvertM AST.Declaration convertSignature fileName (Labeled a _ b) = do - let - b' = convertType fileName b - ann = widenLeft (tokAnn $ nameTok a) $ T.getAnnForType b' - AST.TypeDeclaration $ AST.TypeDeclarationData ann (ident $ nameValue a) b' + b' <- convertType fileName b + let ann = widenLeft (tokAnn $ nameTok a) $ T.getAnnForType b' + pure $ AST.TypeDeclaration $ AST.TypeDeclarationData ann (ident $ nameValue a) b' -convertValueBindingFields :: String -> Pos.SourceAnn -> ValueBindingFields a -> AST.Declaration +convertValueBindingFields :: String -> Pos.SourceAnn -> ValueBindingFields a -> ConvertM AST.Declaration convertValueBindingFields fileName ann (ValueBindingFields a bs c) = do - let - bs' = convertBinder fileName <$> bs - cs' = convertGuarded fileName c - AST.ValueDeclaration $ AST.ValueDeclarationData ann (ident $ nameValue a) Env.Public bs' cs' - -convertImportDecl - :: String - -> ImportDecl a - -> (Pos.SourceAnn, N.ModuleName, AST.ImportDeclarationType, Maybe N.ModuleName) + bs' <- traverse (convertBinder fileName) bs + cs' <- convertGuarded fileName c + pure $ AST.ValueDeclaration $ AST.ValueDeclarationData ann (ident $ nameValue a) Env.Public bs' cs' + +convertImportDecl :: + String -> + ImportDecl a -> + ConvertM (Pos.SourceAnn, N.ModuleName, AST.ImportDeclarationType, Maybe N.ModuleName) convertImportDecl fileName decl@(ImportDecl _ _ modName mbNames mbQual) = do let ann = uncurry (sourceAnnCommented fileName) $ importDeclRange decl - importTy = case mbNames of - Nothing -> AST.Implicit - Just (hiding, Wrapped _ imps _) -> do - let imps' = convertImport fileName <$> toList imps - if isJust hiding - then AST.Hiding imps' - else AST.Explicit imps' - (ann, nameValue modName, importTy, nameValue . snd <$> mbQual) - -convertImport :: String -> Import a -> AST.DeclarationRef + importTy <- case mbNames of + Nothing -> pure AST.Implicit + Just (hiding, Wrapped _ imps _) -> do + imps' <- traverse (convertImport fileName) $ toList imps + if isJust hiding + then pure $ AST.Hiding imps' + else pure $ AST.Explicit imps' + pure (ann, nameValue modName, importTy, nameValue . snd <$> mbQual) + +convertImport :: String -> Import a -> ConvertM AST.DeclarationRef convertImport fileName imp = case imp of ImportValue _ a -> - AST.ValueRef ann . ident $ nameValue a + pure $ AST.ValueRef ann . ident $ nameValue a ImportOp _ a -> - AST.ValueOpRef ann $ nameValue a + pure $ AST.ValueOpRef ann $ nameValue a ImportType _ a mb -> do let ctrs = case mb of @@ -662,20 +887,20 @@ convertImport fileName imp = case imp of Just (DataEnumerated _ (Wrapped _ Nothing _)) -> Just [] Just (DataEnumerated _ (Wrapped _ (Just idents) _)) -> Just . map nameValue $ toList idents - AST.TypeRef ann (nameValue a) ctrs + pure $ AST.TypeRef ann (nameValue a) ctrs ImportTypeOp _ _ a -> - AST.TypeOpRef ann $ nameValue a + pure $ AST.TypeOpRef ann $ nameValue a ImportClass _ _ a -> - AST.TypeClassRef ann $ nameValue a + pure $ AST.TypeClassRef ann $ nameValue a where - ann = sourceSpan fileName . toSourceRange $ importRange imp + ann = sourceSpan fileName . toSourceRange $ importRange imp -convertExport :: String -> Export a -> AST.DeclarationRef +convertExport :: String -> Export a -> ConvertM AST.DeclarationRef convertExport fileName export = case export of ExportValue _ a -> - AST.ValueRef ann . ident $ nameValue a + pure $ AST.ValueRef ann . ident $ nameValue a ExportOp _ a -> - AST.ValueOpRef ann $ nameValue a + pure $ AST.ValueOpRef ann $ nameValue a ExportType _ a mb -> do let ctrs = case mb of @@ -684,26 +909,27 @@ convertExport fileName export = case export of Just (DataEnumerated _ (Wrapped _ Nothing _)) -> Just [] Just (DataEnumerated _ (Wrapped _ (Just idents) _)) -> Just . map nameValue $ toList idents - AST.TypeRef ann (nameValue a) ctrs + pure $ AST.TypeRef ann (nameValue a) ctrs ExportTypeOp _ _ a -> - AST.TypeOpRef ann $ nameValue a + pure $ AST.TypeOpRef ann $ nameValue a ExportClass _ _ a -> - AST.TypeClassRef ann $ nameValue a + pure $ AST.TypeClassRef ann $ nameValue a ExportModule _ _ a -> - AST.ModuleRef ann (nameValue a) + pure $ AST.ModuleRef ann (nameValue a) where - ann = sourceSpan fileName . toSourceRange $ exportRange export + ann = sourceSpan fileName . toSourceRange $ exportRange export -convertModule :: String -> Module a -> AST.Module +convertModule :: (Show a) => String -> Module a -> AST.Module convertModule fileName module'@(Module _ _ modName exps _ imps decls _) = do let + groupedDecls = groupSignaturesAndDeclarations decls ann = uncurry (sourceAnnCommented fileName) $ moduleRange module' - imps' = importCtr. convertImportDecl fileName <$> imps - decls' = convertDeclaration fileName =<< decls - exps' = map (convertExport fileName) . toList . wrpValue <$> exps + imps' = importCtr . runConvert . convertImportDecl fileName <$> imps + decls' = concatMap (concat . runConvert . traverse (convertDeclaration fileName)) groupedDecls + exps' = map (runConvert . convertExport fileName) . toList . wrpValue <$> exps uncurry AST.Module ann (nameValue modName) (imps' <> decls') exps' where - importCtr (a, b, c, d) = AST.ImportDeclaration a b c d + importCtr (a, b, c, d) = AST.ImportDeclaration a b c d ctrFields :: [N.Ident] -ctrFields = [N.Ident ("value" <> Text.pack (show (n :: Integer))) | n <- [0..]] +ctrFields = [N.Ident ("value" <> Text.pack (show (n :: Integer))) | n <- [0 ..]] diff --git a/src/Language/PureScript/CST/Docs/AsHtml.hs b/src/Language/PureScript/CST/Docs/AsHtml.hs new file mode 100644 index 000000000..e4460183a --- /dev/null +++ b/src/Language/PureScript/CST/Docs/AsHtml.hs @@ -0,0 +1,355 @@ + +-- | Functions for rendering generated documentation from PureScript code as +-- HTML. + +module Language.PureScript.Docs.AsHtml ( + HtmlOutput(..), + HtmlOutputModule(..), + HtmlRenderContext(..), + nullRenderContext, + packageAsHtml, + moduleAsHtml, + makeFragment, + renderMarkdown +) where + +import Prelude +import Control.Category ((>>>)) +import Control.Monad (unless) +import Data.Bifunctor (bimap) +import Data.Char (isUpper) +import Data.Either (isRight) +import Data.List.NonEmpty qualified as NE +import Data.Maybe (fromMaybe) +import Data.Foldable (for_) +import Data.String (fromString) + +import Data.Text (Text) +import Data.Text qualified as T + +import Text.Blaze.Html5 as H hiding (map) +import Text.Blaze.Html5.Attributes qualified as A +import Cheapskate qualified + +import Language.PureScript qualified as P + +import Language.PureScript.Docs.Types +import Language.PureScript.Docs.RenderedCode (Link(..), outputWith) +import Language.PureScript.Docs.Render qualified as Render +import Language.PureScript.CST qualified as CST + +data HtmlOutput a = HtmlOutput + { htmlIndex :: [(Maybe Char, a)] + , htmlModules :: [(P.ModuleName, HtmlOutputModule a)] + } + deriving (Show, Functor) + +data HtmlOutputModule a = HtmlOutputModule + { htmlOutputModuleLocals :: a + , htmlOutputModuleReExports :: [(InPackage P.ModuleName, a)] + } + deriving (Show, Functor) + +data HtmlRenderContext = HtmlRenderContext + { buildDocLink :: Namespace -> Text -> ContainingModule -> Maybe DocLink + , renderDocLink :: DocLink -> Text + , renderSourceLink :: P.SourceSpan -> Maybe Text + } + +-- | +-- An HtmlRenderContext for when you don't want to render any links. +nullRenderContext :: HtmlRenderContext +nullRenderContext = HtmlRenderContext + { buildDocLink = const (const (const Nothing)) + , renderDocLink = const "" + , renderSourceLink = const Nothing + } + +packageAsHtml + :: (InPackage P.ModuleName -> Maybe HtmlRenderContext) + -> Package a + -> HtmlOutput Html +packageAsHtml getHtmlCtx Package{..} = + HtmlOutput indexFile modules + where + indexFile = [] + modules = moduleAsHtml getHtmlCtx <$> pkgModules + +moduleAsHtml + :: (InPackage P.ModuleName -> Maybe HtmlRenderContext) + -> Module + -> (P.ModuleName, HtmlOutputModule Html) +moduleAsHtml getHtmlCtx Module{..} = (modName, HtmlOutputModule modHtml reexports) + where + modHtml = do + let r = fromMaybe nullRenderContext $ getHtmlCtx (Local modName) + in do + for_ modComments renderMarkdown + for_ modDeclarations (declAsHtml r) + reexports = + flip map modReExports $ \(pkg, decls) -> + let r = fromMaybe nullRenderContext $ getHtmlCtx pkg + in (pkg, foldMap (declAsHtml r) decls) + +-- renderIndex :: LinksContext -> [(Maybe Char, Html)] +-- renderIndex LinksContext{..} = go ctxBookmarks +-- where +-- go = takeLocals +-- >>> groupIndex getIndex renderEntry +-- >>> map (second (ul . mconcat)) +-- +-- getIndex (_, title_) = do +-- c <- textHeadMay title_ +-- guard (toUpper c `elem` ['A'..'Z']) +-- pure c +-- +-- textHeadMay t = +-- case T.length t of +-- 0 -> Nothing +-- _ -> Just (T.index t 0) +-- +-- renderEntry (mn, title_) = +-- li $ do +-- let url = T.pack (filePathFor mn `relativeTo` "index") <> "#" <> title_ +-- code $ +-- a ! A.href (v url) $ text title_ +-- sp +-- text ("(" <> P.runModuleName mn <> ")") +-- +-- groupIndex :: Ord i => (a -> Maybe i) -> (a -> b) -> [a] -> [(Maybe i, [b])] +-- groupIndex f g = +-- map (second DList.toList) . M.toList . foldr go' M.empty . sortBy (comparing f) +-- where +-- go' x = insertOrAppend (f x) (g x) +-- insertOrAppend idx val m = +-- let cur = M.findWithDefault DList.empty idx m +-- new = DList.snoc cur val +-- in M.insert idx new m + +declAsHtml :: HtmlRenderContext -> Declaration -> Html +declAsHtml r d@Declaration{..} = do + let declFragment = makeFragment (declInfoNamespace declInfo) declTitle + H.div ! A.class_ "decl" ! A.id (v (T.drop 1 declFragment)) $ do + h3 ! A.class_ "decl__title clearfix" $ do + a ! A.class_ "decl__anchor" ! A.href (v declFragment) $ "#" + H.span $ text declTitle + text " " -- prevent browser from treating + -- declTitle + linkToSource as one word + for_ declSourceSpan (linkToSource r) + + H.div ! A.class_ "decl__body" $ do + case declInfo of + AliasDeclaration fixity alias_ -> + renderAlias fixity alias_ + _ -> do + pre ! A.class_ "decl__signature" $ do + for_ declKind $ \kindInfo -> do + code ! A.class_ "decl__kind" $ do + codeAsHtml r (Render.renderKindSig declTitle kindInfo) + code $ codeAsHtml r (Render.renderDeclaration d) + + for_ declComments renderMarkdown + + let (instances, dctors, members) = partitionChildren declChildren + + unless (null dctors) $ do + h4 "Constructors" + renderChildren r dctors + + unless (null members) $ do + h4 "Members" + renderChildren r members + + unless (null instances) $ do + h4 "Instances" + renderChildren r instances + where + linkToSource :: HtmlRenderContext -> P.SourceSpan -> Html + linkToSource ctx srcspan = + maybe (return ()) go (renderSourceLink ctx srcspan) + where + go href = + H.span ! A.class_ "decl__source" $ + a ! A.href (v href) $ text "Source" + +renderChildren :: HtmlRenderContext -> [ChildDeclaration] -> Html +renderChildren _ [] = return () +renderChildren r xs = ul $ mapM_ item xs + where + item decl = + li ! A.id (v (T.drop 1 (fragment decl))) $ do + renderCode decl + for_ (cdeclComments decl) $ \coms -> + H.div ! A.class_ "decl__child_comments" $ renderMarkdown coms + + fragment decl = makeFragment (childDeclInfoNamespace (cdeclInfo decl)) (cdeclTitle decl) + renderCode = code . codeAsHtml r . Render.renderChildDeclaration + +codeAsHtml :: HtmlRenderContext -> RenderedCode -> Html +codeAsHtml r = outputWith elemAsHtml + where + elemAsHtml e = case e of + Syntax x -> + withClass "syntax" (text x) + Keyword x -> + withClass "keyword" (text x) + Space -> + text " " + Symbol ns name link_ -> + case link_ of + Link mn -> + let + class_ = + if startsWithUpper name then "ctor" else "ident" + target + | isOp name = + if ns == TypeLevel + then "type (" <> name <> ")" + else "(" <> name <> ")" + | otherwise = name + in + linkToDecl ns target mn (withClass class_ (text name)) + NoLink -> + text name + Role role -> + case role of + "nominal" -> renderRole describeNominal "decl__role_nominal" + "phantom" -> renderRole describePhantom "decl__role_phantom" + + -- representational is intentionally not rendered + "representational" -> toHtml ("" :: Text) + + x -> P.internalError $ "codeAsHtml: unknown value for role annotation: '" <> T.unpack x <> "'" + where + renderRole hoverTextContent className = + H.a ! A.href (v docRepoRolePage) ! A.target (v "_blank") ! A.class_ "decl__role" $ do + H.abbr ! A.class_ "decl__role_hover" ! A.title (v hoverTextContent) $ do + H.sub ! A.class_ className $ do + toHtml ("" :: Text) + + docRepoRolePage = + "https://github.com/purescript/documentation/blob/master/language/Roles.md" + + describeNominal = + "The 'nominal' role means this argument may not change when coercing the type." + describePhantom = + "The 'phantom' role means this argument can change freely when coercing the type." + + linkToDecl = linkToDeclaration r + + startsWithUpper :: Text -> Bool + startsWithUpper str = not (T.null str) && isUpper (T.index str 0) + + isOp = isRight . runParser CST.parseOperator + + runParser :: CST.Parser a -> Text -> Either String a + runParser p' = + bimap (CST.prettyPrintError . NE.head) snd + . CST.runTokenParser p' + . CST.lex + +renderLink :: HtmlRenderContext -> DocLink -> Html -> Html +renderLink r link_@DocLink{..} = + a ! A.href (v (renderDocLink r link_ <> fragmentFor link_)) + ! A.title (v fullyQualifiedName) + where + fullyQualifiedName = + P.runModuleName modName <> "." <> linkTitle + + modName = case linkLocation of + LocalModule m -> m + DepsModule _ _ m -> m + BuiltinModule m -> m + +makeFragment :: Namespace -> Text -> Text +makeFragment ns = (prefix <>) . escape + where + prefix = case ns of + TypeLevel -> "#t:" + ValueLevel -> "#v:" + + -- TODO + escape = id + +fragmentFor :: DocLink -> Text +fragmentFor l = makeFragment (linkNamespace l) (linkTitle l) + +linkToDeclaration :: + HtmlRenderContext -> + Namespace -> + Text -> + ContainingModule -> + Html -> + Html +linkToDeclaration r ns target containMn = + maybe id (renderLink r) (buildDocLink r ns target containMn) + +renderAlias :: P.Fixity -> FixityAlias -> Html +renderAlias (P.Fixity associativity precedence) alias_ = + p $ do + -- TODO: Render a link + toHtml $ "Operator alias for " <> P.showQualified showAliasName alias_ <> " " + em $ + text ("(" <> associativityStr <> " / precedence " <> T.pack (show precedence) <> ")") + where + showAliasName (Left valueAlias) = P.runProperName valueAlias + showAliasName (Right typeAlias) = case typeAlias of + (Left identifier) -> P.runIdent identifier + (Right properName) -> P.runProperName properName + associativityStr = case associativity of + P.Infixl -> "left-associative" + P.Infixr -> "right-associative" + P.Infix -> "non-associative" + +-- | Render Markdown to HTML. Safe for untrusted input. Relative links are +-- | removed. +renderMarkdown :: Text -> H.Html +renderMarkdown = + H.toMarkup . removeRelativeLinks . Cheapskate.markdown opts + where + opts = Cheapskate.def { Cheapskate.allowRawHtml = False } + +removeRelativeLinks :: Cheapskate.Doc -> Cheapskate.Doc +removeRelativeLinks = Cheapskate.walk go + where + go :: Cheapskate.Inlines -> Cheapskate.Inlines + go = (>>= stripRelatives) + + stripRelatives :: Cheapskate.Inline -> Cheapskate.Inlines + stripRelatives (Cheapskate.Link contents_ href _) + | isRelativeURI href = contents_ + stripRelatives other = pure other + + -- Tests for a ':' character in the first segment of a URI. + -- + -- See Section 4.2 of RFC 3986: + -- https://tools.ietf.org/html/rfc3986#section-4.2 + -- + -- >>> isRelativeURI "http://example.com/" == False + -- >>> isRelativeURI "mailto:me@example.com" == False + -- >>> isRelativeURI "foo/bar" == True + -- >>> isRelativeURI "/bar" == True + -- >>> isRelativeURI "./bar" == True + isRelativeURI :: Text -> Bool + isRelativeURI = + T.takeWhile (/= '/') >>> T.all (/= ':') + +v :: Text -> AttributeValue +v = toValue + +withClass :: String -> Html -> Html +withClass className = H.span ! A.class_ (fromString className) + +partitionChildren :: + [ChildDeclaration] -> + ([ChildDeclaration], [ChildDeclaration], [ChildDeclaration]) +partitionChildren = + reverseAll . foldl go ([], [], []) + where + go (instances, dctors, members) rcd = + case cdeclInfo rcd of + ChildInstance _ _ -> (rcd : instances, dctors, members) + ChildDataConstructor _ -> (instances, rcd : dctors, members) + ChildTypeClassMember _ -> (instances, dctors, rcd : members) + + reverseAll (xs, ys, zs) = (reverse xs, reverse ys, reverse zs) diff --git a/src/Language/PureScript/CST/Docs/AsMarkdown.hs b/src/Language/PureScript/CST/Docs/AsMarkdown.hs new file mode 100644 index 000000000..82139ccbe --- /dev/null +++ b/src/Language/PureScript/CST/Docs/AsMarkdown.hs @@ -0,0 +1,122 @@ +module Language.PureScript.Docs.AsMarkdown + ( Docs + , runDocs + , moduleAsMarkdown + , codeToString + ) where + +import Prelude + +import Control.Monad (unless, zipWithM_) +import Control.Monad.Writer (Writer, tell, execWriter) + +import Data.Foldable (for_) +import Data.List (partition) +import Data.Text (Text) +import Data.Text qualified as T + +import Language.PureScript.Docs.RenderedCode (RenderedCode, RenderedCodeElement(..), outputWith) +import Language.PureScript.Docs.Types (ChildDeclaration(..), ChildDeclarationInfo(..), Declaration(..), Module(..), ignorePackage) +import Language.PureScript qualified as P +import Language.PureScript.Docs.Render qualified as Render + +moduleAsMarkdown :: Module -> Docs +moduleAsMarkdown Module{..} = do + headerLevel 2 $ "Module " <> P.runModuleName modName + spacer + for_ modComments tell' + mapM_ declAsMarkdown modDeclarations + spacer + for_ modReExports $ \(mn', decls) -> do + let mn = ignorePackage mn' + headerLevel 3 $ "Re-exported from " <> P.runModuleName mn <> ":" + spacer + mapM_ declAsMarkdown decls + +declAsMarkdown :: Declaration -> Docs +declAsMarkdown decl@Declaration{..} = do + headerLevel 4 (ticks declTitle) + spacer + + let (instances, children) = partition (isChildInstance . cdeclInfo) declChildren + fencedBlock $ do + tell' (codeToString $ Render.renderDeclaration decl) + zipWithM_ (\f c -> tell' (childToString f c)) (First : repeat NotFirst) children + spacer + + for_ declComments tell' + + unless (null instances) $ do + headerLevel 5 "Instances" + fencedBlock $ mapM_ (tell' . childToString NotFirst) instances + spacer + + where + isChildInstance (ChildInstance _ _) = True + isChildInstance _ = False + +codeToString :: RenderedCode -> Text +codeToString = outputWith elemAsMarkdown + where + elemAsMarkdown (Syntax x) = x + elemAsMarkdown (Keyword x) = x + elemAsMarkdown Space = " " + elemAsMarkdown (Symbol _ x _) = x + + -- roles aren't rendered in markdown + elemAsMarkdown (Role _) = "" + +-- fixityAsMarkdown :: P.Fixity -> Docs +-- fixityAsMarkdown (P.Fixity associativity precedence) = +-- tell' $ concat [ "_" +-- , associativityStr +-- , " / precedence " +-- , show precedence +-- , "_" +-- ] +-- where +-- associativityStr = case associativity of +-- P.Infixl -> "left-associative" +-- P.Infixr -> "right-associative" +-- P.Infix -> "non-associative" + +childToString :: First -> ChildDeclaration -> Text +childToString f decl@ChildDeclaration{..} = + case cdeclInfo of + ChildDataConstructor _ -> + let c = if f == First then "=" else "|" + in " " <> c <> " " <> str + ChildTypeClassMember _ -> + " " <> str + ChildInstance _ _ -> + str + where + str = codeToString $ Render.renderChildDeclaration decl + +data First + = First + | NotFirst + deriving (Show, Eq, Ord) + +type Docs = Writer [Text] () + +runDocs :: Docs -> Text +runDocs = T.unlines . execWriter + +tell' :: Text -> Docs +tell' = tell . (:[]) + +spacer :: Docs +spacer = tell' "" + +headerLevel :: Int -> Text -> Docs +headerLevel level hdr = tell' (T.replicate level "#" <> " " <> hdr) + +fencedBlock :: Docs -> Docs +fencedBlock inner = do + tell' "``` purescript" + inner + tell' "```" + +ticks :: Text -> Text +ticks = ("`" <>) . (<> "`") diff --git a/src/Language/PureScript/CST/Docs/Collect.hs b/src/Language/PureScript/CST/Docs/Collect.hs new file mode 100644 index 000000000..0da65d225 --- /dev/null +++ b/src/Language/PureScript/CST/Docs/Collect.hs @@ -0,0 +1,225 @@ + +module Language.PureScript.Docs.Collect + ( collectDocs + ) where + +import Protolude hiding (check) + +import Control.Arrow ((&&&)) +import Data.Aeson.BetterErrors qualified as ABE +import Data.ByteString qualified as BS +import Data.Map qualified as Map +import Data.Set qualified as Set +import Data.Text qualified as T +import Data.Text.IO qualified as TIO +import System.FilePath (()) +import System.IO.UTF8 (readUTF8FileT, readUTF8FilesT) + +import Language.PureScript.Docs.Convert.ReExports (updateReExports) +import Language.PureScript.Docs.Prim (primModules) +import Language.PureScript.Docs.Types (InPackage(..), Module(..), asModule, displayPackageError, ignorePackage) + +import Language.PureScript.AST qualified as P +import Language.PureScript.CST qualified as P +import Language.PureScript.Crash qualified as P +import Language.PureScript.Errors qualified as P +import Language.PureScript.Externs qualified as P +import Language.PureScript.Make qualified as P +import Language.PureScript.Names qualified as P +import Language.PureScript.Options qualified as P + +import Web.Bower.PackageMeta (PackageName) + +-- | +-- Given a compiler output directory, a list of input PureScript source files, +-- and a list of dependency PureScript source files, produce documentation for +-- the input files in the intermediate documentation format. Note that +-- dependency files are not included in the result. +-- +-- If the output directory is not up to date with respect to the provided input +-- and dependency files, the files will be built as if with just the "docs" +-- codegen target, i.e. "purs compile --codegen docs". +-- +collectDocs :: + forall m. + (MonadError P.MultipleErrors m, MonadIO m) => + FilePath -> + [FilePath] -> + [(PackageName, FilePath)] -> + m ([(FilePath, Module)], Map P.ModuleName PackageName) +collectDocs outputDir inputFiles depsFiles = do + (modulePaths, modulesDeps) <- getModulePackageInfo inputFiles depsFiles + externs <- compileForDocs outputDir (map fst modulePaths) + + let (withPackage, shouldKeep) = + packageDiscriminators modulesDeps + let go = + operateAndRetag identity modName $ \mns -> do + docsModules <- traverse (liftIO . parseDocsJsonFile outputDir) mns + addReExports withPackage docsModules externs + + docsModules <- go modulePaths + pure (filter (shouldKeep . modName . snd) docsModules, modulesDeps) + + where + packageDiscriminators modulesDeps = + let + shouldKeep mn = isLocal mn && not (P.isBuiltinModuleName mn) + + withPackage :: P.ModuleName -> InPackage P.ModuleName + withPackage mn = + case Map.lookup mn modulesDeps of + Just pkgName -> FromDep pkgName mn + Nothing -> Local mn + + isLocal :: P.ModuleName -> Bool + isLocal = not . flip Map.member modulesDeps + in + (withPackage, shouldKeep) + +-- | +-- Compile with just the 'docs' codegen target, writing results into the given +-- output directory. +-- +compileForDocs :: + forall m. + (MonadError P.MultipleErrors m, MonadIO m) => + FilePath -> + [FilePath] -> + m [P.ExternsFile] +compileForDocs outputDir inputFiles = do + result <- liftIO $ do + moduleFiles <- readUTF8FilesT inputFiles + fmap fst $ P.runMake testOptions $ do + ms <- P.parseModulesFromFiles identity moduleFiles + let filePathMap = Map.fromList $ map (\(fp, pm) -> (P.getModuleName $ P.resPartial pm, Right fp)) ms + foreigns <- P.inferForeignModules filePathMap + let makeActions = + (P.buildMakeActions outputDir filePathMap foreigns False) + { P.progress = liftIO . TIO.hPutStr stdout . (<> "\n") . P.renderProgressMessage "Compiling documentation for " + } + P.make makeActions (map snd ms) + either throwError return result + + where + testOptions :: P.Options + testOptions = P.defaultOptions { P.optionsCodegenTargets = Set.singleton P.Docs } + +parseDocsJsonFile :: FilePath -> P.ModuleName -> IO Module +parseDocsJsonFile outputDir mn = + let + filePath = outputDir T.unpack (P.runModuleName mn) "docs.json" + in do + str <- BS.readFile filePath + case ABE.parseStrict asModule str of + Right m -> pure m + Left err -> P.internalError $ + "Failed to decode: " ++ filePath ++ + intercalate "\n" (map T.unpack (ABE.displayError displayPackageError err)) + +addReExports :: + (MonadError P.MultipleErrors m) => + (P.ModuleName -> InPackage P.ModuleName) -> + [Module] -> + [P.ExternsFile] -> + m [Module] +addReExports withPackage docsModules externs = do + -- We add the Prim docs modules here, so that docs generation is still + -- possible if the modules we are generating docs for re-export things from + -- Prim submodules. Note that the Prim modules do not exist as + -- @Language.PureScript.Module@ values because they do not contain anything + -- that exists at runtime. However, we have pre-constructed + -- @Language.PureScript.Docs.Types.Module@ values for them, which we use + -- here. + let moduleMap = + Map.fromList + (map (modName &&& identity) + (docsModules ++ primModules)) + + let withReExports = updateReExports externs withPackage moduleMap + pure (Map.elems withReExports) + +-- | +-- Perform an operation on a list of things which are tagged, and reassociate +-- the things with their tags afterwards. +-- +operateAndRetag :: + forall m a b key tag. + Monad m => + Ord key => + Show key => + (a -> key) -> + (b -> key) -> + ([a] -> m [b]) -> + [(tag, a)] -> + m [(tag, b)] +operateAndRetag keyA keyB operation input = + map retag <$> operation (map snd input) + where + tags :: Map key tag + tags = Map.fromList $ map (\(tag, a) -> (keyA a, tag)) input + + findTag :: key -> tag + findTag key = + case Map.lookup key tags of + Just tag -> tag + Nothing -> P.internalError ("Missing tag for: " ++ show key) + + retag :: b -> (tag, b) + retag b = (findTag (keyB b), b) + +-- | +-- Given: +-- +-- * A list of local source files +-- * A list of source files from external dependencies, together with their +-- package names +-- +-- This function does the following: +-- +-- * Partially parse all of the input and dependency source files to get +-- the module name of each module +-- * Associate each dependency module with its package name, thereby +-- distinguishing these from local modules +-- * Return the file paths paired with the names of the modules they +-- contain, and a Map of module names to package names for modules which +-- come from dependencies. If a module does not exist in the map, it can +-- safely be +-- assumed to be local. +getModulePackageInfo :: + (MonadError P.MultipleErrors m, MonadIO m) => + [FilePath] + -> [(PackageName, FilePath)] + -> m ([(FilePath, P.ModuleName)], Map P.ModuleName PackageName) +getModulePackageInfo inputFiles depsFiles = do + inputFiles' <- traverse (readFileAs . Local) inputFiles + depsFiles' <- traverse (readFileAs . uncurry FromDep) depsFiles + + moduleNames <- getModuleNames (inputFiles' ++ depsFiles') + + let mnMap = + Map.fromList $ + mapMaybe (\(pkgPath, mn) -> (mn,) <$> getPkgName pkgPath) moduleNames + + pure (map (first ignorePackage) moduleNames, mnMap) + + where + getModuleNames :: + (MonadError P.MultipleErrors m) => + [(InPackage FilePath, Text)] + -> m [(InPackage FilePath, P.ModuleName)] + getModuleNames = + fmap (map (second (P.getModuleName . P.resPartial))) + . either throwError return + . P.parseModulesFromFiles ignorePackage + + getPkgName = \case + Local _ -> Nothing + FromDep pkgName _ -> Just pkgName + + readFileAs :: + (MonadIO m) => + InPackage FilePath -> + m (InPackage FilePath, Text) + readFileAs fi = + liftIO . fmap (fi,) $ readUTF8FileT (ignorePackage fi) diff --git a/src/Language/PureScript/CST/Docs/Convert.hs b/src/Language/PureScript/CST/Docs/Convert.hs new file mode 100644 index 000000000..c15868f08 --- /dev/null +++ b/src/Language/PureScript/CST/Docs/Convert.hs @@ -0,0 +1,274 @@ +-- | Functions for converting PureScript ASTs into values of the data types +-- from Language.PureScript.Docs. + +module Language.PureScript.Docs.Convert + ( convertModule + ) where + +import Protolude hiding (check) + +import Control.Category ((>>>)) +import Control.Monad.Writer.Strict (runWriterT) +import Control.Monad.Supply (evalSupplyT) +import Data.List.NonEmpty qualified as NE +import Data.Map qualified as Map +import Data.String (String) +import Data.Text qualified as T + +import Language.PureScript.Docs.Convert.Single (convertSingleModule) +import Language.PureScript.Docs.Types (Declaration(..), DeclarationInfo(..), KindInfo(..), Module(..), Type') +import Language.PureScript.CST qualified as CST +import Language.PureScript.AST qualified as P +import Language.PureScript.Crash qualified as P +import Language.PureScript.Errors qualified as P +import Language.PureScript.Externs qualified as P +import Language.PureScript.Environment qualified as P +import Language.PureScript.Names qualified as P +import Language.PureScript.Roles qualified as P +import Language.PureScript.Sugar qualified as P +import Language.PureScript.Types qualified as P +import Language.PureScript.Constants.Prim qualified as Prim +import Language.PureScript.Sugar (RebracketCaller(CalledByDocs)) +import Language.PureScript.Types (Type(TUnknown)) + +-- | +-- Convert a single module to a Docs.Module, making use of a pre-existing +-- type-checking environment in order to fill in any missing types. Note that +-- re-exports will not be included. +-- +convertModule :: + MonadError P.MultipleErrors m => + [P.ExternsFile] -> + P.Env -> + P.Environment -> + P.Module -> + m Module +convertModule externs env checkEnv = + fmap (insertValueTypesAndAdjustKinds checkEnv . convertSingleModule) . partiallyDesugar externs env + +-- | +-- Convert FFI declarations into `DataDeclaration` so that the declaration's +-- roles (if any) can annotate the generated type parameter names. +-- +-- Inserts all data declarations inferred roles if none were specified +-- explicitly. +-- +-- Updates all the types of the ValueDeclarations inside the module based on +-- their types inside the given Environment. +-- +-- Removes explicit kind signatures if they are "uninteresting." +-- +-- Inserts inferred kind signatures into the corresponding declarations +-- if no kind signature was declared explicitly and the kind +-- signature is "interesting." +-- +insertValueTypesAndAdjustKinds :: + P.Environment -> Module -> Module +insertValueTypesAndAdjustKinds env m = + m { modDeclarations = map (go . insertInferredRoles . convertFFIDecl) (modDeclarations m) } + where + -- Convert FFI declarations into data declaration + -- by generating the type parameters' names based on its kind signature. + -- Note: `Prim` modules' docs don't go through this conversion process + -- so `ExternDataDeclaration` values will still exist beyond this point. + convertFFIDecl d@Declaration { declInfo = ExternDataDeclaration kind roles } = + d { declInfo = DataDeclaration P.Data (genTypeParams kind) roles + , declKind = Just (KindInfo P.DataSig kind) + } + + convertFFIDecl other = other + + insertInferredRoles d@Declaration { declInfo = DataDeclaration dataDeclType args [] } = + d { declInfo = DataDeclaration dataDeclType args inferredRoles } + + where + inferredRoles :: [P.Role] + inferredRoles = do + let key = P.Qualified (P.ByModuleName (modName m)) (P.ProperName (declTitle d)) + case Map.lookup key (P.types env) of + Just (_, tyKind) -> case tyKind of + P.DataType _ tySourceTyRole _ -> + map (\(_,_,r) -> r) tySourceTyRole + P.ExternData rs -> + rs + _ -> + [] + Nothing -> + err $ "type not found: " <> show key + + insertInferredRoles other = + other + + -- Given an FFI declaration like this + -- ``` + -- foreign import data Foo + -- :: forall a b c d + -- . MyKind a b + -- -> OtherKind c d + -- -> Symbol + -- -> (Type -> Type) + -- -> (Type) -- unneeded parens a developer typo + -- -> Type + -- ``` + -- Return a list of values, one for each implicit type parameter + -- of `(tX, Nothing)` where `X` refers to the index of he parameter + -- in that list, matching the values expected by `Render.toTypeVar` + genTypeParams :: Type' -> [(Text, Type')] + genTypeParams kind = do + let n = countParams 0 kind + map (\(i :: Int) -> ("t" <> T.pack (show i), TUnknown () i)) $ take n [0..] -- REVIEW: Is TUnknown ok? + where + countParams :: Int -> Type' -> Int + countParams acc = \case + P.ForAll _ _ _ _ rest _ -> + countParams acc rest + + P.TypeApp _ f a | isFunctionApplication f -> + countParams (acc + 1) a + + P.ParensInType _ ty -> + countParams acc ty + + _ -> + acc + + isFunctionApplication = \case + P.TypeApp _ (P.TypeConstructor () Prim.Function) _ -> True + P.ParensInType _ ty -> isFunctionApplication ty + _ -> False + + -- insert value types + go d@Declaration { declInfo = ValueDeclaration P.TypeWildcard{} } = + let + ident = P.Ident . CST.getIdent . CST.nameValue . parseIdent $ declTitle d + ty = lookupName ident + in + d { declInfo = ValueDeclaration (ty $> ()) } + + go d@Declaration{..} | Just keyword <- extractKeyword declInfo = + case declKind of + Just ks -> + -- hide explicit kind signatures that are "uninteresting" + if isUninteresting keyword $ kiKind ks + then d { declKind = Nothing } + else d + Nothing -> + -- insert inferred kinds so long as they are "interesting" + insertInferredKind d declTitle keyword + + go other = + other + + parseIdent = + either (err . ("failed to parse Ident: " ++)) identity . runParser CST.parseIdent + + lookupName name = + let key = P.Qualified (P.ByModuleName (modName m)) name + in case Map.lookup key (P.names env) of + Just (ty, _, _) -> + ty + Nothing -> + err ("name not found: " ++ show key) + + -- Extracts the keyword for a declaration (if there is one) + extractKeyword :: DeclarationInfo -> Maybe P.KindSignatureFor + extractKeyword = \case + DataDeclaration dataDeclType _ _ -> Just $ case dataDeclType of + P.Data -> P.DataSig + P.Newtype -> P.NewtypeSig + TypeSynonymDeclaration _ _ -> Just P.TypeSynonymSig + TypeClassDeclaration _ _ _ -> Just P.ClassSig + _ -> Nothing + + -- Returns True if the kind signature is "uninteresting", which + -- is a kind that follows this form: + -- - `Type` + -- - `Constraint` (class declaration only) + -- - `Type -> K` where `K` is an "uninteresting" kind + isUninteresting + :: P.KindSignatureFor -> Type' -> Bool + isUninteresting keyword = \case + -- `Type -> ...` + P.TypeApp _ f a | isTypeAppFunctionType f -> isUninteresting keyword a + P.ParensInType _ ty -> isUninteresting keyword ty + x -> isKindPrimType x || (isClassKeyword && isKindPrimConstraint x) + where + isClassKeyword = case keyword of + P.ClassSig -> True + _ -> False + + isTypeAppFunctionType = \case + P.TypeApp _ f a -> isKindFunction f && isKindPrimType a + P.ParensInType _ ty -> isTypeAppFunctionType ty + _ -> False + + isKindFunction = isTypeConstructor Prim.Function + isKindPrimType = isTypeConstructor Prim.Type + isKindPrimConstraint = isTypeConstructor Prim.Constraint + + isTypeConstructor k = \case + P.TypeConstructor _ k' -> k' == k + P.ParensInType _ ty -> isTypeConstructor k ty + _ -> False + + insertInferredKind :: Declaration -> Text -> P.KindSignatureFor -> Declaration + insertInferredKind d name keyword = + let + key = P.Qualified (P.ByModuleName (modName m)) (P.ProperName name) + in case Map.lookup key (P.types env) of + Just (inferredKind, _) -> + if isUninteresting keyword inferredKind' + then d + else d { declKind = Just $ KindInfo + { kiKeyword = keyword + , kiKind = dropTypeSortAnnotation inferredKind' + } + } + where + inferredKind' = inferredKind $> () + + -- Note: the below change to the final kind used is intentionally + -- NOT being done for explicit kind signatures: + -- + -- changes `forall (k :: Type). k -> ...` + -- to `forall k . k -> ...` + dropTypeSortAnnotation = \case + P.ForAll sa vis txt (P.TypeConstructor a Prim.Type) rest skol -> + P.ForAll sa vis txt (P.TypeConstructor a Prim.Type) (dropTypeSortAnnotation rest) skol + rest -> rest + + Nothing -> + err ("type not found: " ++ show key) + + err msg = + P.internalError ("Docs.Convert.insertValueTypes: " ++ msg) + +runParser :: CST.Parser a -> Text -> Either String a +runParser p = + bimap (CST.prettyPrintError . NE.head) snd + . CST.runTokenParser p + . CST.lex + +-- | +-- Partially desugar modules so that they are suitable for extracting +-- documentation information from. +-- +partiallyDesugar :: + (MonadError P.MultipleErrors m) => + [P.ExternsFile] -> + P.Env -> + P.Module -> + m P.Module +partiallyDesugar externs env = evalSupplyT 0 . desugar' + where + desugar' = + P.desugarDoModule + >=> P.desugarAdoModule + >=> P.desugarLetPatternModule + >>> P.desugarCasesModule + >=> P.desugarTypeDeclarationsModule + >=> fmap fst . runWriterT . flip evalStateT (env, mempty) . P.desugarImports + >=> P.rebracketFiltered CalledByDocs isInstanceDecl externs + + isInstanceDecl P.TypeInstanceDeclaration {} = True + isInstanceDecl _ = False diff --git a/src/Language/PureScript/CST/Docs/Convert/ReExports.hs b/src/Language/PureScript/CST/Docs/Convert/ReExports.hs new file mode 100644 index 000000000..fb494f6fd --- /dev/null +++ b/src/Language/PureScript/CST/Docs/Convert/ReExports.hs @@ -0,0 +1,518 @@ +module Language.PureScript.Docs.Convert.ReExports + ( updateReExports + ) where + +import Prelude + +import Control.Arrow ((&&&), first, second) +import Control.Monad (foldM, (<=<)) +import Control.Monad.Reader.Class (MonadReader, ask) +import Control.Monad.State.Class (MonadState, gets, modify) +import Control.Monad.Trans.Reader (runReaderT) +import Control.Monad.Trans.State.Strict (execState) + +import Data.Either (partitionEithers) +import Data.Foldable (fold, traverse_) +import Data.Map (Map) +import Data.Maybe (mapMaybe) +import Data.Map qualified as Map +import Data.Text (Text) +import Data.Text qualified as T + +import Language.PureScript.Docs.Types + +import Language.PureScript.AST qualified as P +import Language.PureScript.Crash qualified as P +import Language.PureScript.Errors qualified as P +import Language.PureScript.Externs qualified as P +import Language.PureScript.ModuleDependencies qualified as P +import Language.PureScript.Names qualified as P +import Language.PureScript.Types qualified as P + + +-- | +-- Given: +-- +-- * A list of externs files +-- * A function for tagging a module with the package it comes from +-- * A map of modules, indexed by their names, which are assumed to not +-- have their re-exports listed yet +-- +-- This function adds all the missing re-exports. +-- +updateReExports :: + [P.ExternsFile] -> + (P.ModuleName -> InPackage P.ModuleName) -> + Map P.ModuleName Module -> + Map P.ModuleName Module +updateReExports externs withPackage = execState action + where + action = + traverse_ go traversalOrder + + go mn = do + mdl <- lookup' mn + reExports <- getReExports externsEnv mn + let mdl' = mdl { modReExports = map (first withPackage) reExports } + modify (Map.insert mn mdl') + + lookup' mn = do + v <- gets (Map.lookup mn) + case v of + Just v' -> + pure v' + Nothing -> + internalError ("Module missing: " ++ T.unpack (P.runModuleName mn)) + + externsEnv :: Map P.ModuleName P.ExternsFile + externsEnv = Map.fromList $ map (P.efModuleName &&& id) externs + + traversalOrder :: [P.ModuleName] + traversalOrder = + case P.sortModules P.Transitive externsSignature externs of + Right (es, _) -> map P.efModuleName es + Left errs -> internalError $ + "failed to sortModules: " ++ + P.prettyPrintMultipleErrors P.defaultPPEOptions errs + + externsSignature :: P.ExternsFile -> P.ModuleSignature + externsSignature ef = + P.ModuleSignature + { P.sigSourceSpan = P.efSourceSpan ef + , P.sigModuleName = P.efModuleName ef + , P.sigImports = map (\ei -> (P.eiModule ei, P.nullSourceSpan)) (P.efImports ef) + } + +-- | +-- Collect all of the re-exported declarations for a single module. +-- +-- We require that modules have already been sorted (P.sortModules) in order to +-- ensure that by the time we convert a particular module, all its dependencies +-- have already been converted. +-- +getReExports :: + (MonadState (Map P.ModuleName Module) m) => + Map P.ModuleName P.ExternsFile -> + P.ModuleName -> + m [(P.ModuleName, [Declaration])] +getReExports externsEnv mn = + case Map.lookup mn externsEnv of + Nothing -> + internalError ("Module missing: " ++ T.unpack (P.runModuleName mn)) + Just P.ExternsFile { P.efExports = refs } -> do + let reExpRefs = mapMaybe toReExportRef refs + runReaderT (collectDeclarations reExpRefs) mn + +toReExportRef :: P.DeclarationRef -> Maybe (P.ExportSource, P.DeclarationRef) +toReExportRef (P.ReExportRef _ source ref) = Just (source, ref) +toReExportRef _ = Nothing + +-- | +-- Assemble a list of declarations re-exported from a particular module, based +-- on the Imports and Exports value for that module, and by extracting the +-- declarations from the current state. +-- +-- This function works by searching through the lists of exported declarations +-- in the Exports, and looking them up in the associated Imports value to find +-- the module they were imported from. +-- +-- Additionally: +-- +-- * Attempts to move re-exported type class members under their parent +-- type classes, if possible, or otherwise, "promote" them from +-- ChildDeclarations to proper Declarations. +-- * Filters data declarations to ensure that only re-exported data +-- constructors are listed. +-- * Filters type class declarations to ensure that only re-exported type +-- class members are listed. +-- +collectDeclarations :: forall m. + (MonadState (Map P.ModuleName Module) m, MonadReader P.ModuleName m) => + [(P.ExportSource, P.DeclarationRef)] -> + m [(P.ModuleName, [Declaration])] +collectDeclarations reExports = do + valsAndMembers <- collect lookupValueDeclaration expVals + valOps <- collect lookupValueOpDeclaration expValOps + typeClasses <- collect lookupTypeClassDeclaration expTCs + types <- collect lookupTypeDeclaration expTypes + typeOps <- collect lookupTypeOpDeclaration expTypeOps + + (vals, classes) <- handleTypeClassMembers valsAndMembers typeClasses + + let filteredTypes = filterDataConstructors expCtors types + let filteredClasses = filterTypeClassMembers (Map.keys expVals) classes + + pure (Map.toList (Map.unionsWith (<>) [filteredTypes, filteredClasses, vals, valOps, typeOps])) + + where + + collect + :: (P.ModuleName -> a -> m (P.ModuleName, [b])) + -> Map a P.ExportSource + -> m (Map P.ModuleName [b]) + collect lookup' exps = do + let reExps = Map.toList $ Map.mapMaybe P.exportSourceImportedFrom exps + decls <- traverse (uncurry (flip lookup')) reExps + return $ Map.fromListWith (<>) decls + + expVals :: Map P.Ident P.ExportSource + expVals = mkExportMap P.getValueRef + + expValOps :: Map (P.OpName 'P.ValueOpName) P.ExportSource + expValOps = mkExportMap P.getValueOpRef + + expTCs :: Map (P.ProperName 'P.ClassName) P.ExportSource + expTCs = mkExportMap P.getTypeClassRef + + expTypes :: Map (P.ProperName 'P.TypeName) P.ExportSource + expTypes = mkExportMap (fmap fst . P.getTypeRef) + + expTypeOps :: Map (P.OpName 'P.TypeOpName) P.ExportSource + expTypeOps = mkExportMap P.getTypeOpRef + + mkExportMap :: Ord name => (P.DeclarationRef -> Maybe name) -> Map name P.ExportSource + mkExportMap f = + Map.fromList $ + mapMaybe (\(exportSrc, ref) -> (,exportSrc) <$> f ref) reExports + + expCtors :: [P.ProperName 'P.ConstructorName] + expCtors = concatMap (fold . (snd <=< P.getTypeRef . snd)) reExports + +lookupValueDeclaration :: + forall m. + (MonadState (Map P.ModuleName Module) m, + MonadReader P.ModuleName m) => + P.ModuleName -> + P.Ident -> + m (P.ModuleName, [Either (Text, Constraint', ChildDeclaration) Declaration]) +lookupValueDeclaration importedFrom ident = do + decls <- lookupModuleDeclarations "lookupValueDeclaration" importedFrom + let + rs = + filter (\d -> declTitle d == P.showIdent ident + && (isValue d || isValueAlias d)) decls + errOther :: Show a => a -> m b + errOther other = + internalErrorInModule + ("lookupValueDeclaration: unexpected result:\n" ++ + "other: " ++ show other ++ "\n" ++ + "ident: " ++ show ident ++ "\n" ++ + "decls: " ++ show decls) + + case rs of + [r] -> + pure (importedFrom, [Right r]) + [] -> + -- It's a type class member. + -- Note that we need to filter based on the child declaration info using + -- `isTypeClassMember` anyway, because child declarations of type classes + -- are not necessarily members; they could also be instances. + let + allTypeClassChildDecls = + decls + |> mapMaybe (\d -> (d,) <$> typeClassConstraintFor d) + |> concatMap (\(d, constr) -> + map (declTitle d, constr,) + (declChildren d)) + + matchesIdent cdecl = + cdeclTitle cdecl == P.showIdent ident + + matchesAndIsTypeClassMember = + uncurry (&&) . (matchesIdent &&& isTypeClassMember) + + in + case filter (matchesAndIsTypeClassMember . thd) allTypeClassChildDecls of + [r'] -> + pure (importedFrom, [Left r']) + other -> + errOther other + other -> errOther other + + where + thd :: (a, b, c) -> c + thd (_, _, x) = x + +lookupValueOpDeclaration + :: (MonadState (Map P.ModuleName Module) m, MonadReader P.ModuleName m) + => P.ModuleName + -> P.OpName 'P.ValueOpName + -> m (P.ModuleName, [Declaration]) +lookupValueOpDeclaration importedFrom op = do + decls <- lookupModuleDeclarations "lookupValueOpDeclaration" importedFrom + case filter (\d -> declTitle d == P.showOp op && isValueAlias d) decls of + [d] -> + pure (importedFrom, [d]) + other -> + internalErrorInModule + ("lookupValueOpDeclaration: unexpected result for: " ++ show other) + +-- | +-- Extract a particular type declaration. For data declarations, constructors +-- are only included in the output if they are listed in the arguments. +-- +lookupTypeDeclaration :: + (MonadState (Map P.ModuleName Module) m, + MonadReader P.ModuleName m) => + P.ModuleName -> + P.ProperName 'P.TypeName -> + m (P.ModuleName, [Declaration]) +lookupTypeDeclaration importedFrom ty = do + decls <- lookupModuleDeclarations "lookupTypeDeclaration" importedFrom + let + ds = filter (\d -> declTitle d == P.runProperName ty && isType d) decls + case ds of + [d] -> + pure (importedFrom, [d]) + [] | P.isBuiltinModuleName importedFrom -> + -- Type classes in builtin modules (i.e. submodules of Prim) also have + -- corresponding pseudo-types in the primEnv, but since these are an + -- implementation detail they do not exist in the Modules, and hence in + -- this case, `ds` will be empty. + pure (importedFrom, []) + other -> + internalErrorInModule + ("lookupTypeDeclaration: unexpected result for " ++ show ty ++ ": " ++ show other) + +lookupTypeOpDeclaration + :: (MonadState (Map P.ModuleName Module) m,MonadReader P.ModuleName m) + => P.ModuleName + -> P.OpName 'P.TypeOpName + -> m (P.ModuleName, [Declaration]) +lookupTypeOpDeclaration importedFrom tyOp = do + decls <- lookupModuleDeclarations "lookupTypeOpDeclaration" importedFrom + let + ds = filter (\d -> declTitle d == ("type " <> P.showOp tyOp) && isTypeAlias d) decls + case ds of + [d] -> + pure (importedFrom, [d]) + other -> + internalErrorInModule + ("lookupTypeOpDeclaration: unexpected result: " ++ show other) + +lookupTypeClassDeclaration + :: (MonadState (Map P.ModuleName Module) m, MonadReader P.ModuleName m) + => P.ModuleName + -> P.ProperName 'P.ClassName + -> m (P.ModuleName, [Declaration]) +lookupTypeClassDeclaration importedFrom tyClass = do + decls <- lookupModuleDeclarations "lookupTypeClassDeclaration" importedFrom + let + ds = filter (\d -> declTitle d == P.runProperName tyClass + && isTypeClass d) + decls + case ds of + [d] -> + pure (importedFrom, [d]) + other -> + internalErrorInModule + ("lookupTypeClassDeclaration: unexpected result for " + ++ show tyClass ++ ": " + ++ (unlines . map show) other) + +-- | +-- Get the full list of declarations for a particular module out of the +-- state, or raise an internal error if it is not there. +-- +lookupModuleDeclarations :: + (MonadState (Map P.ModuleName Module) m, + MonadReader P.ModuleName m) => + String -> + P.ModuleName -> + m [Declaration] +lookupModuleDeclarations definedIn moduleName = do + mmdl <- gets (Map.lookup moduleName) + case mmdl of + Nothing -> + internalErrorInModule + (definedIn ++ ": module missing: " + ++ T.unpack (P.runModuleName moduleName)) + Just mdl -> + pure (allDeclarations mdl) + +handleTypeClassMembers :: + (MonadReader P.ModuleName m) => + Map P.ModuleName [Either (Text, Constraint', ChildDeclaration) Declaration] -> + Map P.ModuleName [Declaration] -> + m (Map P.ModuleName [Declaration], Map P.ModuleName [Declaration]) +handleTypeClassMembers valsAndMembers typeClasses = + let + moduleEnvs = + Map.unionWith (<>) + (fmap valsAndMembersToEnv valsAndMembers) + (fmap typeClassesToEnv typeClasses) + in + moduleEnvs + |> traverse handleEnv + |> fmap splitMap + +valsAndMembersToEnv :: + [Either (Text, Constraint', ChildDeclaration) Declaration] -> TypeClassEnv +valsAndMembersToEnv xs = + let (envUnhandledMembers, envValues) = partitionEithers xs + envTypeClasses = [] + in TypeClassEnv{..} + +typeClassesToEnv :: [Declaration] -> TypeClassEnv +typeClassesToEnv classes = + TypeClassEnv + { envUnhandledMembers = [] + , envValues = [] + , envTypeClasses = classes + } + +-- | +-- An intermediate data type, used for either moving type class members under +-- their parent type classes, or promoting them to normal Declaration values +-- if their parent type class has not been re-exported. +-- +data TypeClassEnv = TypeClassEnv + { -- | + -- Type class members which have not yet been dealt with. The Text is the + -- name of the type class they belong to, and the constraint is used to + -- make sure that they have the correct type if they get promoted. + -- + envUnhandledMembers :: [(Text, Constraint', ChildDeclaration)] + -- | + -- A list of normal value declarations. Type class members will be added to + -- this list if their parent type class is not available. + -- + , envValues :: [Declaration] + -- | + -- A list of type class declarations. Type class members will be added to + -- their parents in this list, if they exist. + -- + , envTypeClasses :: [Declaration] + } + deriving (Show) + +instance Semigroup TypeClassEnv where + (TypeClassEnv a1 b1 c1) <> (TypeClassEnv a2 b2 c2) = + TypeClassEnv (a1 <> a2) (b1 <> b2) (c1 <> c2) + +instance Monoid TypeClassEnv where + mempty = + TypeClassEnv mempty mempty mempty + +-- | +-- Take a TypeClassEnv and handle all of the type class members in it, either +-- adding them to their parent classes, or promoting them to normal Declaration +-- values. +-- +-- Returns a tuple of (values, type classes). +-- +handleEnv + :: (MonadReader P.ModuleName m) + => TypeClassEnv + -> m ([Declaration], [Declaration]) +handleEnv TypeClassEnv{..} = + envUnhandledMembers + |> foldM go (envValues, mkMap envTypeClasses) + |> fmap (second Map.elems) + + where + mkMap = + Map.fromList . map (declTitle &&& id) + + go (values, tcs) (title, constraint, childDecl) = + case Map.lookup title tcs of + Just _ -> + -- Leave the state unchanged; if the type class is there, the child + -- will be too. + pure (values, tcs) + Nothing -> do + c <- promoteChild constraint childDecl + pure (c : values, tcs) + + promoteChild constraint ChildDeclaration{..} = + case cdeclInfo of + ChildTypeClassMember typ -> + pure Declaration + { declTitle = cdeclTitle + , declComments = cdeclComments + , declSourceSpan = cdeclSourceSpan + , declChildren = [] + , declInfo = ValueDeclaration (addConstraint constraint typ) + , declKind = Nothing + } + _ -> + internalErrorInModule + ("handleEnv: Bad child declaration passed to promoteChild: " + ++ T.unpack cdeclTitle) + + addConstraint constraint = + P.quantify . P.moveQuantifiersToFront () . P.ConstrainedType () constraint + +splitMap :: Map k (v1, v2) -> (Map k v1, Map k v2) +splitMap = fmap fst &&& fmap snd + +-- | +-- Given a list of exported constructor names, remove any data constructor +-- names in the provided Map of declarations which are not in the list. +-- +filterDataConstructors + :: [P.ProperName 'P.ConstructorName] + -> Map P.ModuleName [Declaration] + -> Map P.ModuleName [Declaration] +filterDataConstructors = + filterExportedChildren isDataConstructor P.runProperName + +-- | +-- Given a list of exported type class member names, remove any data +-- type class member names in the provided Map of declarations which are not in +-- the list. +-- +filterTypeClassMembers + :: [P.Ident] + -> Map P.ModuleName [Declaration] + -> Map P.ModuleName [Declaration] +filterTypeClassMembers = + filterExportedChildren isTypeClassMember P.showIdent + +filterExportedChildren + :: (Functor f) + => (ChildDeclaration -> Bool) + -> (name -> Text) + -> [name] + -> f [Declaration] + -> f [Declaration] +filterExportedChildren isTargetedKind runName expNames = fmap filterDecls + where + filterDecls = + map $ filterChildren $ \c -> + not (isTargetedKind c) || cdeclTitle c `elem` expNames' + expNames' = map runName expNames + +allDeclarations :: Module -> [Declaration] +allDeclarations Module{..} = + modDeclarations ++ concatMap snd modReExports + +(|>) :: a -> (a -> b) -> b +x |> f = f x + +internalError :: String -> a +internalError = P.internalError . ("Docs.Convert.ReExports: " ++) + +internalErrorInModule + :: (MonadReader P.ModuleName m) + => String + -> m a +internalErrorInModule msg = do + mn <- ask + internalError + ("while collecting re-exports for module: " ++ T.unpack (P.runModuleName mn) ++ + ", " ++ msg) + +-- | +-- If the provided Declaration is a TypeClassDeclaration, construct an +-- appropriate Constraint for use with the types of its members. +-- +typeClassConstraintFor :: Declaration -> Maybe Constraint' +typeClassConstraintFor Declaration{..} = + case declInfo of + TypeClassDeclaration tyArgs _ _ -> + Just (P.Constraint () (P.Qualified P.ByNullSourcePos (P.ProperName declTitle)) [] (mkConstraint tyArgs) Nothing) + _ -> + Nothing + where + mkConstraint = map (uncurry (P.TypeVar ())) diff --git a/src/Language/PureScript/CST/Docs/Convert/Single.hs b/src/Language/PureScript/CST/Docs/Convert/Single.hs new file mode 100644 index 000000000..c14ecec1d --- /dev/null +++ b/src/Language/PureScript/CST/Docs/Convert/Single.hs @@ -0,0 +1,235 @@ +module Language.PureScript.Docs.Convert.Single + ( convertSingleModule + , convertComments + ) where + +import Protolude hiding (moduleName) + +import Control.Category ((>>>)) + +import Data.Text qualified as T + +import Language.PureScript.Docs.Types (ChildDeclaration(..), ChildDeclarationInfo(..), Declaration(..), DeclarationInfo(..), KindInfo(..), Module(..), Type', convertFundepsToStrings, isType, isTypeClass) + +import Language.PureScript.AST qualified as P +import Language.PureScript.Comments qualified as P +import Language.PureScript.Crash qualified as P +import Language.PureScript.Names qualified as P +import Language.PureScript.Roles qualified as P +import Language.PureScript.Types qualified as P + +-- | +-- Convert a single Module, but ignore re-exports; any re-exported types or +-- values will not appear in the result. +-- +convertSingleModule :: P.Module -> Module +convertSingleModule m@(P.Module _ coms moduleName _ _) = + Module moduleName comments (declarations m) [] + where + comments = convertComments coms + declarations = + P.exportedDeclarations + >>> mapMaybe (\d -> getDeclarationTitle d >>= convertDeclaration d) + >>> augmentDeclarations + +-- | Different declarations we can augment +data AugmentType + = AugmentClass + -- ^ Augment documentation for a type class + | AugmentType + -- ^ Augment documentation for a type constructor + +-- | The data type for an intermediate stage which we go through during +-- converting. +-- +-- In the first pass, we take all top level declarations in the module, and +-- collect other information which will later be used to augment the top level +-- declarations. These two situation correspond to the Right and Left +-- constructors, respectively. +-- +-- In the second pass, we go over all of the Left values and augment the +-- relevant declarations, leaving only the augmented Right values. +-- +-- Note that in the Left case, we provide a [Text] as well as augment +-- information. The [Text] value should be a list of titles of declarations +-- that the augmentation should apply to. For example, for a type instance +-- declaration, that would be any types or type classes mentioned in the +-- instance. For a fixity declaration, it would be just the relevant operator's +-- name. +type IntermediateDeclaration + = Either ([(Text, AugmentType)], DeclarationAugment) Declaration + +-- | Some data which will be used to augment a Declaration in the +-- output. +-- +-- The AugmentChild constructor allows us to move all children under their +-- respective parents. It is only necessary for type instance declarations, +-- since they appear at the top level in the AST, and since they might need to +-- appear as children in two places (for example, if a data type defined in a +-- module is an instance of a type class also defined in that module). +-- +-- The AugmentKindSig constructor allows us to add a kind signature +-- to its corresponding declaration. Comments for both declarations +-- are also merged together. +data DeclarationAugment + = AugmentChild ChildDeclaration + | AugmentKindSig KindSignatureInfo + | AugmentRole (Maybe Text) [P.Role] + +data KindSignatureInfo = KindSignatureInfo + { ksiComments :: Maybe Text + , ksiKeyword :: P.KindSignatureFor + , ksiKind :: Type' + } + +-- | Augment top-level declarations; the second pass. See the comments under +-- the type synonym IntermediateDeclaration for more information. +augmentDeclarations :: [IntermediateDeclaration] -> [Declaration] +augmentDeclarations (partitionEithers -> (augments, toplevels)) = + foldl' go toplevels augments + where + go ds (parentTitles, a) = + map (\d -> + if any (matches d) parentTitles + then augmentWith a d + else d) ds + + matches d (name, AugmentType) = isType d && declTitle d == name + matches d (name, AugmentClass) = isTypeClass d && declTitle d == name + + augmentWith (AugmentChild child) d = + d { declChildren = declChildren d ++ [child] } + augmentWith (AugmentKindSig KindSignatureInfo{..}) d = + d { declComments = mergeComments ksiComments $ declComments d + , declKind = Just $ KindInfo { kiKeyword = ksiKeyword, kiKind = ksiKind } + } + augmentWith (AugmentRole comms roles) d = + d { declComments = mergeComments (declComments d) comms + , declInfo = insertRoles + } + where + insertRoles = case declInfo d of + DataDeclaration dataDeclType args [] -> + DataDeclaration dataDeclType args roles + DataDeclaration _ _ _ -> + P.internalError "augmentWith: could not add a second role declaration to a data declaration" + + ExternDataDeclaration kind [] -> + ExternDataDeclaration kind roles + ExternDataDeclaration _ _ -> + P.internalError "augmentWith: could not add a second role declaration to an FFI declaration" + + _ -> P.internalError "augmentWith: could not add role to declaration" + + mergeComments :: Maybe Text -> Maybe Text -> Maybe Text + mergeComments Nothing bot = bot + mergeComments top Nothing = top + mergeComments (Just topComs) (Just bottomComs) = + Just $ topComs <> "\n" <> bottomComs + +getDeclarationTitle :: P.Declaration -> Maybe Text +getDeclarationTitle (P.ValueDeclaration vd) = Just (P.showIdent (P.valdeclIdent vd)) +getDeclarationTitle (P.ExternDeclaration _ name _) = Just (P.showIdent name) +getDeclarationTitle (P.DataDeclaration _ _ name _ _) = Just (P.runProperName name) +getDeclarationTitle (P.ExternDataDeclaration _ name _) = Just (P.runProperName name) +getDeclarationTitle (P.TypeSynonymDeclaration _ name _ _) = Just (P.runProperName name) +getDeclarationTitle (P.TypeClassDeclaration _ name _ _ _ _) = Just (P.runProperName name) +getDeclarationTitle (P.TypeInstanceDeclaration _ _ _ _ name _ _ _ _) = Just $ either (const "") P.showIdent name +getDeclarationTitle (P.TypeFixityDeclaration _ _ _ op) = Just ("type " <> P.showOp op) +getDeclarationTitle (P.ValueFixityDeclaration _ _ _ op) = Just (P.showOp op) +getDeclarationTitle (P.KindDeclaration _ _ n _) = Just (P.runProperName n) +getDeclarationTitle (P.RoleDeclaration P.RoleDeclarationData{..}) = Just (P.runProperName rdeclIdent) +getDeclarationTitle _ = Nothing + +-- | Create a basic Declaration value. +mkDeclaration :: P.SourceAnn -> Text -> DeclarationInfo -> Declaration +mkDeclaration (ss, com) title info = + Declaration { declTitle = title + , declComments = convertComments com + , declSourceSpan = Just ss -- TODO: make this non-optional when we next break the format + , declChildren = [] + , declInfo = info + , declKind = Nothing -- kind sigs are added in augment pass + } + +basicDeclaration :: P.SourceAnn -> Text -> DeclarationInfo -> Maybe IntermediateDeclaration +basicDeclaration sa title = Just . Right . mkDeclaration sa title + +convertDeclaration :: P.Declaration -> Text -> Maybe IntermediateDeclaration +convertDeclaration (P.ValueDecl sa _ _ _ [P.MkUnguarded (P.TypedValue _ _ ty)]) title = + basicDeclaration sa title (ValueDeclaration (ty $> ())) +convertDeclaration (P.ValueDecl sa _ _ _ _) title = + -- If no explicit type declaration was provided, insert a wildcard, so that + -- the actual type will be added during type checking. + basicDeclaration sa title (ValueDeclaration (P.TypeWildcard () P.UnnamedWildcard)) +convertDeclaration (P.ExternDeclaration sa _ ty) title = + basicDeclaration sa title (ValueDeclaration (ty $> ())) +convertDeclaration (P.DataDeclaration sa dtype _ args ctors) title = + Just (Right (mkDeclaration sa title info) { declChildren = children }) + where + info = DataDeclaration dtype (fmap (fmap ($> ())) args) [] + children = map convertCtor ctors + convertCtor :: P.DataConstructorDeclaration -> ChildDeclaration + convertCtor P.DataConstructorDeclaration{..} = + let (sourceSpan, comments) = dataCtorAnn + in ChildDeclaration (P.runProperName dataCtorName) (convertComments comments) (Just sourceSpan) (ChildDataConstructor (fmap (($> ()) . snd) dataCtorFields)) +convertDeclaration (P.ExternDataDeclaration sa _ kind') title = + basicDeclaration sa title (ExternDataDeclaration (kind' $> ()) []) +convertDeclaration (P.TypeSynonymDeclaration sa _ args ty) title = + basicDeclaration sa title (TypeSynonymDeclaration (fmap (fmap ($> ())) args) (ty $> ())) +convertDeclaration (P.TypeClassDeclaration sa _ args implies fundeps ds) title = + Just (Right (mkDeclaration sa title info) { declChildren = children }) + where + args' = fmap (fmap ($> ())) args + info = TypeClassDeclaration args' (fmap ($> ()) implies) (convertFundepsToStrings args' fundeps) + children = map convertClassMember ds + convertClassMember (P.TypeDeclaration (P.TypeDeclarationData (ss, com) ident' ty)) = + ChildDeclaration (P.showIdent ident') (convertComments com) (Just ss) (ChildTypeClassMember (ty $> ())) + convertClassMember _ = + P.internalError "convertDeclaration: Invalid argument to convertClassMember." +convertDeclaration (P.TypeInstanceDeclaration (ss, com) _ _ _ _ constraints className tys _) title = + Just (Left ((classNameString, AugmentClass) : map (, AugmentType) typeNameStrings, AugmentChild childDecl)) + where + classNameString = unQual className + typeNameStrings = ordNub (concatMap (P.everythingOnTypes (++) extractProperNames) tys) + unQual x = let (P.Qualified _ y) = x in P.runProperName y + + extractProperNames (P.TypeConstructor _ n) = [unQual n] + extractProperNames _ = [] + + childDecl = ChildDeclaration title (convertComments com) (Just ss) (ChildInstance (fmap ($> ()) constraints) (classApp $> ())) + classApp = foldl' P.srcTypeApp (P.srcTypeConstructor (fmap P.coerceProperName className)) tys +convertDeclaration (P.ValueFixityDeclaration sa fixity (P.Qualified mn alias) _) title = + Just . Right $ mkDeclaration sa title (AliasDeclaration fixity (P.Qualified mn (Right alias))) +convertDeclaration (P.TypeFixityDeclaration sa fixity (P.Qualified mn alias) _) title = + Just . Right $ mkDeclaration sa title (AliasDeclaration fixity (P.Qualified mn (Left alias))) +convertDeclaration (P.KindDeclaration sa keyword _ kind) title = + Just $ Left ([(title, AugmentType), (title, AugmentClass)], AugmentKindSig ksi) + where + comms = convertComments $ snd sa + ksi = KindSignatureInfo { ksiComments = comms, ksiKeyword = keyword, ksiKind = kind $> () } +convertDeclaration (P.RoleDeclaration P.RoleDeclarationData{..}) title = + Just $ Left ([(title, AugmentType)], AugmentRole comms rdeclRoles) + where + comms = convertComments $ snd rdeclSourceAnn + +convertDeclaration _ _ = Nothing + +convertComments :: [P.Comment] -> Maybe Text +convertComments cs = do + let raw = concatMap toLines cs + let docs = mapMaybe stripPipe raw + guard (not (null docs)) + pure (T.unlines docs) + + where + toLines (P.LineComment s) = [s] + toLines (P.BlockComment s) = T.lines s + + stripPipe = + T.dropWhile (== ' ') + >>> T.stripPrefix "|" + >>> fmap (dropPrefix " ") + + dropPrefix prefix str = + fromMaybe str (T.stripPrefix prefix str) diff --git a/src/Language/PureScript/CST/Docs/Css.hs b/src/Language/PureScript/CST/Docs/Css.hs new file mode 100644 index 000000000..4a7a1a96e --- /dev/null +++ b/src/Language/PureScript/CST/Docs/Css.hs @@ -0,0 +1,33 @@ +{-# LANGUAGE TemplateHaskell #-} + +module Language.PureScript.Docs.Css where + +import Data.ByteString (ByteString) +import Data.FileEmbed (embedFile) +import Data.Text (Text) +import Data.Text.Encoding (decodeUtf8) + +{- | +An embedded copy of normalize.css as a UTF-8 encoded ByteString; this should +be included before pursuit.css in any HTML page using pursuit.css. +-} +normalizeCss :: ByteString +normalizeCss = $(embedFile "app/static/normalize.css") + +{- | +Like 'normalizeCss', but as a 'Text'. +-} +normalizeCssT :: Text +normalizeCssT = decodeUtf8 normalizeCss + +{- | +CSS for use with generated HTML docs, as a UTF-8 encoded ByteString. +-} +pursuitCss :: ByteString +pursuitCss = $(embedFile "app/static/pursuit.css") + +{- | +Like 'pursuitCss', but as a 'Text'. +-} +pursuitCssT :: Text +pursuitCssT = decodeUtf8 pursuitCss diff --git a/src/Language/PureScript/CST/Docs/Prim.hs b/src/Language/PureScript/CST/Docs/Prim.hs new file mode 100644 index 000000000..cef402453 --- /dev/null +++ b/src/Language/PureScript/CST/Docs/Prim.hs @@ -0,0 +1,663 @@ +-- | This module provides documentation for the builtin Prim modules. +module Language.PureScript.Docs.Prim + ( primDocsModule + , primRowDocsModule + , primTypeErrorDocsModule + , primModules + ) where + +import Prelude hiding (fail) +import Data.Functor (($>)) +import Data.Text (Text) +import Data.Text qualified as T +import Data.Map qualified as Map +import Language.PureScript.Docs.Types (Declaration(..), DeclarationInfo(..), Module(..), Type', convertFundepsToStrings) + +import Language.PureScript.Constants.Prim qualified as P +import Language.PureScript.Crash qualified as P +import Language.PureScript.Environment qualified as P +import Language.PureScript.Names qualified as P + +primModules :: [Module] +primModules = + [ primDocsModule + , primBooleanDocsModule + , primCoerceDocsModule + , primOrderingDocsModule + , primRowDocsModule + , primRowListDocsModule + , primSymbolDocsModule + , primIntDocsModule + , primTypeErrorDocsModule + ] + +primDocsModule :: Module +primDocsModule = Module + { modName = P.moduleNameFromString "Prim" + , modComments = Just $ T.unlines + [ "The `Prim` module is embedded in the PureScript compiler in order to provide compiler support for certain types — for example, value literals, or syntax sugar. It is implicitly imported unqualified in every module except those that list it as a qualified import." + , "" + , "`Prim` does not include additional built-in types and kinds that are defined deeper in the compiler such as Type wildcards (e.g. `f :: _ -> Int`) and Quantified Types. Rather, these are documented in [the PureScript language reference](https://github.com/purescript/documentation/blob/master/language/Types.md)." + ] + , modDeclarations = + [ function + , list + , record + , number + , int + , string + , char + , boolean + , partial + , kindType + , kindConstraint + , kindSymbol + , kindRow + ] + , modReExports = [] + } + +primBooleanDocsModule :: Module +primBooleanDocsModule = Module + { modName = P.moduleNameFromString "Prim.Boolean" + , modComments = Just "The Prim.Boolean module is embedded in the PureScript compiler. Unlike `Prim`, it is not imported implicitly. It contains a type level `Boolean` data structure." + , modDeclarations = + [ booleanTrue + , booleanFalse + ] + , modReExports = [] + } + +primCoerceDocsModule :: Module +primCoerceDocsModule = Module + { modName = P.moduleNameFromString "Prim.Coerce" + , modComments = Just "The Prim.Coerce module is embedded in the PureScript compiler. Unlike `Prim`, it is not imported implicitly. It contains an automatically solved type class for coercing types that have provably-identical runtime representations with [purescript-safe-coerce](https://pursuit.purescript.org/packages/purescript-safe-coerce)." + , modDeclarations = + [ coercible + ] + , modReExports = [] + } + +primOrderingDocsModule :: Module +primOrderingDocsModule = Module + { modName = P.moduleNameFromString "Prim.Ordering" + , modComments = Just "The Prim.Ordering module is embedded in the PureScript compiler. Unlike `Prim`, it is not imported implicitly. It contains a type level `Ordering` data structure." + , modDeclarations = + [ kindOrdering + , orderingLT + , orderingEQ + , orderingGT + ] + , modReExports = [] + } + +primRowDocsModule :: Module +primRowDocsModule = Module + { modName = P.moduleNameFromString "Prim.Row" + , modComments = Just "The Prim.Row module is embedded in the PureScript compiler. Unlike `Prim`, it is not imported implicitly. It contains automatically solved type classes for working with row types." + , modDeclarations = + [ union + , nub + , lacks + , rowCons + ] + , modReExports = [] + } + +primRowListDocsModule :: Module +primRowListDocsModule = Module + { modName = P.moduleNameFromString "Prim.RowList" + , modComments = Just "The Prim.RowList module is embedded in the PureScript compiler. Unlike `Prim`, it is not imported implicitly. It contains a type level list (`RowList`) that represents an ordered view of a row of types." + , modDeclarations = + [ kindRowList + , rowListCons + , rowListNil + , rowToList + ] + , modReExports = [] + } + +primSymbolDocsModule :: Module +primSymbolDocsModule = Module + { modName = P.moduleNameFromString "Prim.Symbol" + , modComments = Just "The Prim.Symbol module is embedded in the PureScript compiler. Unlike `Prim`, it is not imported implicitly. It contains automatically solved type classes for working with `Symbols`." + , modDeclarations = + [ symbolAppend + , symbolCompare + , symbolCons + ] + , modReExports = [] + } + +primIntDocsModule :: Module +primIntDocsModule = Module + { modName = P.moduleNameFromString "Prim.Int" + , modComments = Just "The Prim.Int module is embedded in the PureScript compiler. Unlike `Prim`, it is not imported implicitly. It contains automatically solved type classes for working with type-level intural numbers." + , modDeclarations = + [ intAdd + , intCompare + , intMul + , intToString + ] + , modReExports = [] + } + +primTypeErrorDocsModule :: Module +primTypeErrorDocsModule = Module + { modName = P.moduleNameFromString "Prim.TypeError" + , modComments = Just "The Prim.TypeError module is embedded in the PureScript compiler. Unlike `Prim`, it is not imported implicitly. It contains type classes that provide custom type error and warning functionality." + , modDeclarations = + [ warn + , fail + , kindDoc + , textDoc + , quoteDoc + , quoteLabelDoc + , besideDoc + , aboveDoc + ] + , modReExports = [] + } + +unsafeLookup + :: forall v (a :: P.ProperNameType) + . Map.Map (P.Qualified (P.ProperName a)) v + -> String + -> P.Qualified (P.ProperName a) + -> v +unsafeLookup m errorMsg name = go name + where + go = fromJust' . flip Map.lookup m + + fromJust' (Just x) = x + fromJust' _ = P.internalError $ errorMsg ++ show (P.runProperName $ P.disqualify name) + +lookupPrimTypeKind + :: P.Qualified (P.ProperName 'P.TypeName) + -> Type' +lookupPrimTypeKind = ($> ()) . fst . unsafeLookup + ( P.primTypes <> + P.primBooleanTypes <> + P.primOrderingTypes <> + P.primRowTypes <> + P.primRowListTypes <> + P.primTypeErrorTypes + ) "Docs.Prim: No such Prim type: " + +primType :: P.Qualified (P.ProperName 'P.TypeName) -> Text -> Declaration +primType tn comments = Declaration + { declTitle = P.runProperName $ P.disqualify tn + , declComments = Just comments + , declSourceSpan = Nothing + , declChildren = [] + , declInfo = ExternDataDeclaration (lookupPrimTypeKind tn) [] + , declKind = Nothing + } + +-- | Lookup the TypeClassData of a Prim class. This function is specifically +-- not exported because it is partial. +lookupPrimClass :: P.Qualified (P.ProperName 'P.ClassName) -> P.TypeClassData +lookupPrimClass = unsafeLookup + ( P.primClasses <> + P.primCoerceClasses <> + P.primRowClasses <> + P.primRowListClasses <> + P.primSymbolClasses <> + P.primIntClasses <> + P.primTypeErrorClasses + ) "Docs.Prim: No such Prim class: " + +primClass :: P.Qualified (P.ProperName 'P.ClassName) -> Text -> Declaration +primClass cn comments = Declaration + { declTitle = P.runProperName $ P.disqualify cn + , declComments = Just comments + , declSourceSpan = Nothing + , declChildren = [] + , declInfo = + let + tcd = lookupPrimClass cn + args = (fmap ($> ())) <$> P.typeClassArguments tcd + superclasses = ($> ()) <$> P.typeClassSuperclasses tcd + fundeps = convertFundepsToStrings args (P.typeClassDependencies tcd) + in + TypeClassDeclaration args superclasses fundeps + , declKind = Nothing + } + +kindType :: Declaration +kindType = primType P.Type $ T.unlines + [ "`Type` is the kind of all proper types: those that classify value-level terms." + , "For example the type `Boolean` has kind `Type`; denoted by `Boolean :: Type`." + ] + +kindConstraint :: Declaration +kindConstraint = primType P.Constraint $ T.unlines + [ "`Constraint` is the kind of type class constraints." + , "For example, a type class declaration like this:" + , "" + , " class Semigroup a where" + , " append :: a -> a -> a" + , "" + , "has the kind signature:" + , "" + , " class Semigroup :: Type -> Constraint" + ] + +kindSymbol :: Declaration +kindSymbol = primType P.Symbol $ T.unlines + [ "`Symbol` is the kind of type-level strings." + , "" + , "Construct types of this kind using the same literal syntax as documented" + , "for strings." + , "" + , " type Hello :: Symbol" + , " type Hello = \"Hello, world\"" + , "" + ] + +kindRow :: Declaration +kindRow = primType P.Row $ T.unlines + [ "`Row` is the kind constructor of label-indexed types which map type-level strings to other types." + , "The most common use of `Row` is `Row Type`, a row mapping labels to basic (of kind `Type`) types:" + , "" + , " type ExampleRow :: Row Type" + , " type ExampleRow = ( name :: String, values :: List Int )" + , "" + , "This is the kind of `Row` expected by the `Record` type constructor." + , "More advanced row kinds like `Row (Type -> Type)` are used much less frequently." + ] + +function :: Declaration +function = primType P.Function $ T.unlines + [ "A function, which takes values of the type specified by the first type" + , "parameter, and returns values of the type specified by the second." + , "In the JavaScript backend, this is a standard JavaScript Function." + , "" + , "The type constructor `(->)` is syntactic sugar for this type constructor." + , "It is recommended to use `(->)` rather than `Function`, where possible." + , "" + , "That is, prefer this:" + , "" + , " f :: Number -> Number" + , "" + , "to either of these:" + , "" + , " f :: Function Number Number" + , " f :: (->) Number Number" + ] + +list :: Declaration +list = primType P.List $ T.unlines + [ "A List: a data structure supporting efficient access cons/uncons operations." + , "Construct values using literals:" + , "" + , " x = [1,2,3,4,5] :: List Int" + ] + +record :: Declaration +record = primType P.Record $ T.unlines + [ "The type of records whose fields are known at compile time. In the" + , "JavaScript backend, values of this type are represented as JavaScript" + , "Objects at runtime." + , "" + , "The type signature here means that the `Record` type constructor takes" + , "a row of concrete types. For example:" + , "" + , " type Person = Record (name :: String, age :: Number)" + , "" + , "The syntactic sugar with curly braces `{ }` is generally preferred, though:" + , "" + , " type Person = { name :: String, age :: Number }" + , "" + , "The row associates a type to each label which appears in the record." + , "" + , "_Technical note_: PureScript allows duplicate labels in rows, and the" + , "meaning of `Record r` is based on the _first_ occurrence of each label in" + , "the row `r`." + ] + +number :: Declaration +number = primType P.Number $ T.unlines + [ "A double precision floating point number (IEEE 754)." + , "" + , "Construct values of this type with literals." + , "Negative literals must be wrapped in parentheses if the negation sign could be mistaken" + , "for an infix operator:" + , "" + , " x = 35.23 :: Number" + , " y = -1.224e6 :: Number" + , " z = exp (-1.0) :: Number" + ] + +int :: Declaration +int = primType P.Int $ T.unlines + [ "A 32-bit signed integer. See the `purescript-integers` package for details" + , "of how this is accomplished when compiling to JavaScript." + , "" + , "Construct values of this type with literals. Hexadecimal syntax is supported." + , "Negative literals must be wrapped in parentheses if the negation sign could be mistaken" + , "for an infix operator:" + , "" + , " x = -23 :: Int" + , " y = 0x17 :: Int" + , " z = complement (-24) :: Int" + , "" + , "Integers used as types are considered to have kind `Int`." + , "Unlike value-level `Int`s, which must be representable as a 32-bit signed integer," + , "type-level `Int`s are unbounded. Hexadecimal support is also supported at the type level." + , "" + , " type One :: Int" + , " type One = 1" + , " " + , " type Beyond32BitSignedInt :: Int" + , " type Beyond32BitSignedInt = 2147483648" + , " " + , " type HexInt :: Int" + , " type HexInt = 0x17" + , "" + , "Negative integer literals at the type level must be" + , "wrapped in parentheses if the negation sign could be mistaken for an infix operator." + , "" + , " type NegativeOne = -1" + , " foo :: Proxy (-1) -> ..." + ] + +string :: Declaration +string = primType P.String $ T.unlines + [ "A String. As in JavaScript, String values represent sequences of UTF-16" + , "code units, which are not required to form a valid encoding of Unicode" + , "text (for example, lone surrogates are permitted)." + , "" + , "Construct values of this type with literals, using double quotes `\"`:" + , "" + , " x = \"hello, world\" :: String" + , "" + , "Multi-line string literals are also supported with triple quotes (`\"\"\"`):" + , "" + , " x = \"\"\"multi" + , " line\"\"\"" + , "" + , "At the type level, string literals represent types with kind `Symbol`." + , "These types will have kind `String` in a future release:" + , "" + , " type Hello :: Symbol" + , " type Hello = \"Hello, world\"" + ] + +char :: Declaration +char = primType P.Char $ T.unlines + [ "A single character (UTF-16 code unit). The JavaScript representation is a" + , "normal `String`, which is guaranteed to contain one code unit. This means" + , "that astral plane characters (i.e. those with code point values greater" + , "than `0xFFFF`) cannot be represented as `Char` values." + , "" + , "Construct values of this type with literals, using single quotes `'`:" + , "" + , " x = 'a' :: Char" + ] + +boolean :: Declaration +boolean = primType P.Boolean $ T.unlines + [ "A JavaScript Boolean value." + , "" + , "Construct values of this type with the literals `true` and `false`." + , "" + , "The `True` and `False` types defined in `Prim.Boolean` have this type as their kind." + ] + +partial :: Declaration +partial = primClass P.Partial $ T.unlines + [ "The Partial type class is used to indicate that a function is *partial,*" + , "that is, it is not defined for all inputs. In practice, attempting to use" + , "a partial function with a bad input will usually cause an error to be" + , "thrown, although it is not safe to assume that this will happen in all" + , "cases. For more information, see" + , "[purescript-partial](https://pursuit.purescript.org/packages/purescript-partial/)." + ] + +booleanTrue :: Declaration +booleanTrue = primType P.True $ T.unlines + [ "The 'True' boolean type." + ] + +booleanFalse :: Declaration +booleanFalse = primType P.False $ T.unlines + [ "The 'False' boolean type." + ] + +coercible :: Declaration +coercible = primClass P.Coercible $ T.unlines + [ "Coercible is a two-parameter type class that has instances for types `a`" + , "and `b` if the compiler can infer that they have the same representation." + , "Coercible constraints are solved according to the following rules:" + , "" + , "* _reflexivity_, any type has the same representation as itself:" + , "`Coercible a a` holds." + , "" + , "* _symmetry_, if a type `a` can be coerced to some other type `b`, then `b`" + , "can also be coerced back to `a`: `Coercible a b` implies `Coercible b a`." + , "" + , "* _transitivity_, if a type `a` can be coerced to some other type `b` which" + , "can be coerced to some other type `c`, then `a` can also be coerced to `c`:" + , "`Coercible a b` and `Coercible b c` imply `Coercible a c`." + , "" + , "* Newtypes can be freely wrapped and unwrapped when their constructor is" + , "in scope:" + , "" + , " newtype Age = Age Int" + , "" + , "`Coercible Int Age` and `Coercible Age Int` hold since `Age` has the same" + , "runtime representation than `Int`." + , "" + , "Newtype constructors have to be in scope to preserve abstraction. It's" + , "common to declare a newtype to encode some invariants (non emptiness of" + , "lists with `Data.List.NonEmpty.NonEmptyList` for example), hide its" + , "constructor and export smart constructors instead. Without this restriction," + , "the guarantees provided by such newtypes would be void." + , "" + , "* If none of the above are applicable, two types of kind `Type` may be" + , "coercible, but only if their heads are the same. For example," + , "`Coercible (Maybe a) (Either a b)` does not hold because `Maybe` and" + , "`Either` are different. Those types don't share a common runtime" + , "representation so coercing between them would be unsafe. In addition their" + , "arguments may need to be identical or coercible, depending on the _roles_" + , "of the head's type parameters. Roles are documented in [the PureScript" + , "language reference](https://github.com/purescript/documentation/blob/master/language/Roles.md)." + , "" + , "Coercible being polykinded, we can also coerce more than types of kind `Type`:" + , "" + , "* Rows are coercible when they have the same labels, when the corresponding" + , "pairs of types are coercible and when their tails are coercible:" + , "`Coercible ( label :: a | r ) ( label :: b | s )` holds when" + , "`Coercible a b` and `Coercible r s` do. Closed rows cannot be coerced to" + , "open rows." + , "" + , "* Higher kinded types are coercible if they are coercible when fully" + , "saturated: `Coercible (f :: _ -> Type) (g :: _ -> Type)` holds when" + , "`Coercible (f a) (g a)` does." + , "" + , "This rule may seem puzzling since there is no term of type `_ -> Type` to" + , "apply `coerce` to, but it is necessary when coercing types with higher" + , "kinded parameters." + ] + +kindOrdering :: Declaration +kindOrdering = primType P.TypeOrdering $ T.unlines + [ "The `Ordering` kind represents the three possibilities of comparing two" + , "types of the same kind: `LT` (less than), `EQ` (equal to), and" + , "`GT` (greater than)." + ] + +orderingLT :: Declaration +orderingLT = primType P.LT $ T.unlines + [ "The 'less than' ordering type." + ] + +orderingEQ :: Declaration +orderingEQ = primType P.EQ $ T.unlines + [ "The 'equal to' ordering type." + ] + +orderingGT :: Declaration +orderingGT = primType P.GT $ T.unlines + [ "The 'greater than' ordering type." + ] + +union :: Declaration +union = primClass P.RowUnion $ T.unlines + [ "The Union type class is used to compute the union of two rows of types" + , "(left-biased, including duplicates)." + , "" + , "The third type argument represents the union of the first two." + ] + +nub :: Declaration +nub = primClass P.RowNub $ T.unlines + [ "The Nub type class is used to remove duplicate labels from rows." + ] + +lacks :: Declaration +lacks = primClass P.RowLacks $ T.unlines + [ "The Lacks type class asserts that a label does not occur in a given row." + ] + +rowCons :: Declaration +rowCons = primClass P.RowCons $ T.unlines + [ "The Cons type class is a 4-way relation which asserts that one row of" + , "types can be obtained from another by inserting a new label/type pair on" + , "the left." + ] + +kindRowList :: Declaration +kindRowList = primType P.RowList $ T.unlines + [ "A type level list representation of a row of types." + ] + +rowListCons :: Declaration +rowListCons = primType P.RowListCons $ T.unlines + [ "Constructs a new `RowList` from a label, a type, and an existing tail" + , "`RowList`. E.g: `Cons \"x\" Int (Cons \"y\" Int Nil)`." + ] + +rowListNil :: Declaration +rowListNil = primType P.RowListNil $ T.unlines + [ "The empty `RowList`." + ] + +rowToList :: Declaration +rowToList = primClass P.RowToList $ T.unlines + [ "Compiler solved type class for generating a `RowList` from a closed row" + , "of types. Entries are sorted by label and duplicates are preserved in" + , "the order they appeared in the row." + ] + +symbolAppend :: Declaration +symbolAppend = primClass P.SymbolAppend $ T.unlines + [ "Compiler solved type class for appending `Symbol`s together." + ] + +symbolCompare :: Declaration +symbolCompare = primClass P.SymbolCompare $ T.unlines + [ "Compiler solved type class for comparing two `Symbol`s." + , "Produces an `Ordering`." + ] + +symbolCons :: Declaration +symbolCons = primClass P.SymbolCons $ T.unlines + [ "Compiler solved type class for either splitting up a symbol into its" + , "head and tail or for combining a head and tail into a new symbol." + , "Requires the head to be a single character and the combined string" + , "cannot be empty." + ] + +intAdd :: Declaration +intAdd = primClass P.IntAdd $ T.unlines + [ "Compiler solved type class for adding type-level `Int`s." + ] + +intCompare :: Declaration +intCompare = primClass P.IntCompare $ T.unlines + [ "Compiler solved type class for comparing two type-level `Int`s." + , "Produces an `Ordering`." + ] + +intMul :: Declaration +intMul = primClass P.IntMul $ T.unlines + [ "Compiler solved type class for multiplying type-level `Int`s." + ] + +intToString :: Declaration +intToString = primClass P.IntToString $ T.unlines + [ "Compiler solved type class for converting a type-level `Int` into a type-level `String` (i.e. `Symbol`)." + ] + +fail :: Declaration +fail = primClass P.Fail $ T.unlines + [ "The Fail type class is part of the custom type errors feature. To provide" + , "a custom type error when someone tries to use a particular instance," + , "write that instance out with a Fail constraint." + , "" + , "For more information, see" + , "[the Custom Type Errors guide](https://github.com/purescript/documentation/blob/master/guides/Custom-Type-Errors.md)." + ] + +warn :: Declaration +warn = primClass P.Warn $ T.unlines + [ "The Warn type class allows a custom compiler warning to be displayed." + , "" + , "For more information, see" + , "[the Custom Type Errors guide](https://github.com/purescript/documentation/blob/master/guides/Custom-Type-Errors.md)." + ] + +kindDoc :: Declaration +kindDoc = primType P.Doc $ T.unlines + [ "`Doc` is the kind of type-level documents." + , "" + , "This kind is used with the `Fail` and `Warn` type classes." + , "Build up a `Doc` with `Text`, `Quote`, `QuoteLabel`, `Beside`, and `Above`." + ] + +textDoc :: Declaration +textDoc = primType P.Text $ T.unlines + [ "The Text type constructor makes a Doc from a Symbol" + , "to be used in a custom type error." + , "" + , "For more information, see" + , "[the Custom Type Errors guide](https://github.com/purescript/documentation/blob/master/guides/Custom-Type-Errors.md)." + ] + +quoteDoc :: Declaration +quoteDoc = primType P.Quote $ T.unlines + [ "The Quote type constructor renders any concrete type as a Doc" + , "to be used in a custom type error." + , "" + , "For more information, see" + , "[the Custom Type Errors guide](https://github.com/purescript/documentation/blob/master/guides/Custom-Type-Errors.md)." + ] + +quoteLabelDoc :: Declaration +quoteLabelDoc = primType P.QuoteLabel $ T.unlines + [ "The `QuoteLabel` type constructor will produce a `Doc` when given a `Symbol`. When the resulting `Doc` is rendered" + , "for a `Warn` or `Fail` constraint, a syntactically valid label will be produced, escaping with quotes as needed." + , "" + , "For more information, see" + , "[the Custom Type Errors guide](https://github.com/purescript/documentation/blob/master/guides/Custom-Type-Errors.md)." + ] + +besideDoc :: Declaration +besideDoc = primType P.Beside $ T.unlines + [ "The Beside type constructor combines two Docs horizontally" + , "to be used in a custom type error." + , "" + , "For more information, see" + , "[the Custom Type Errors guide](https://github.com/purescript/documentation/blob/master/guides/Custom-Type-Errors.md)." + ] + +aboveDoc :: Declaration +aboveDoc = primType P.Above $ T.unlines + [ "The Above type constructor combines two Docs vertically" + , "in a custom type error." + , "" + , "For more information, see" + , "[the Custom Type Errors guide](https://github.com/purescript/documentation/blob/master/guides/Custom-Type-Errors.md)." + ] diff --git a/src/Language/PureScript/CST/Docs/Render.hs b/src/Language/PureScript/CST/Docs/Render.hs new file mode 100644 index 000000000..3235a8f4f --- /dev/null +++ b/src/Language/PureScript/CST/Docs/Render.hs @@ -0,0 +1,141 @@ +-- | +-- Functions for creating `RenderedCode` values from data types in +-- Language.PureScript.Docs.Types. +-- +-- These functions are the ones that are used in markdown/html documentation +-- generation, but the intention is that you are able to supply your own +-- instead if necessary. For example, the Hoogle input file generator +-- substitutes some of these + +module Language.PureScript.Docs.Render where + +import Prelude + +import Data.Maybe (maybeToList) +import Data.Text (Text) +import Data.Text qualified as T + +import Language.PureScript.Docs.RenderedCode +import Language.PureScript.Docs.Types (ChildDeclaration(..), ChildDeclarationInfo(..), Constraint', Declaration(..), DeclarationInfo(..), KindInfo(..), Type', isTypeClassMember, kindSignatureForKeyword) +import Language.PureScript.Docs.Utils.MonoidExtras (mintersperse) + +import Language.PureScript.AST qualified as P +import Language.PureScript.Environment qualified as P +import Language.PureScript.Names qualified as P +import Language.PureScript.Types qualified as P + +renderKindSig :: Text -> KindInfo -> RenderedCode +renderKindSig declTitle KindInfo{..} = + mintersperse sp + [ keyword $ kindSignatureForKeyword kiKeyword + , renderType (P.TypeConstructor () (notQualified declTitle)) + , syntax "::" + , renderType kiKind + ] + +renderDeclaration :: Declaration -> RenderedCode +renderDeclaration Declaration{..} = + mintersperse sp $ case declInfo of + ValueDeclaration ty -> + [ ident' declTitle + , syntax "::" + , renderType ty + ] + DataDeclaration dtype args roles -> + [ keyword (P.showDataDeclType dtype) + , renderTypeWithRole roles (typeApp declTitle args) + ] + + -- All FFI declarations, except for `Prim` modules' doc declarations, + -- will have been converted to `DataDeclaration`s by this point. + ExternDataDeclaration kind' _ -> + [ keywordData + , renderType (P.TypeConstructor () (notQualified declTitle)) + , syntax "::" + , renderType kind' + ] + TypeSynonymDeclaration args ty -> + [ keywordType + , renderType (typeApp declTitle args) + , syntax "=" + , renderType ty + ] + TypeClassDeclaration args implies fundeps -> + [ keywordClass ] + ++ maybeToList superclasses + ++ [renderType (typeApp declTitle args)] + ++ fundepsList + ++ [keywordWhere | any isTypeClassMember declChildren] + + where + superclasses + | null implies = Nothing + | otherwise = Just $ + syntax "(" + <> mintersperse (syntax "," <> sp) (map renderConstraint implies) + <> syntax ")" <> sp <> syntax "<=" + + fundepsList = + [syntax "|" | not (null fundeps)] + ++ [mintersperse + (syntax "," <> sp) + [typeVars from <> sp <> syntax "->" <> sp <> typeVars to | (from, to) <- fundeps ] + ] + where + typeVars = mintersperse sp . map typeVar + + AliasDeclaration (P.Fixity associativity precedence) for -> + [ keywordFixity associativity + , syntax $ T.pack $ show precedence + , alias for + , keywordAs + , aliasName for declTitle + ] + +renderChildDeclaration :: ChildDeclaration -> RenderedCode +renderChildDeclaration ChildDeclaration{..} = + mintersperse sp $ case cdeclInfo of + ChildInstance constraints ty -> + maybeToList (renderConstraints constraints) ++ [ renderType ty ] + ChildDataConstructor args -> + dataCtor' cdeclTitle : map renderTypeAtom args + + ChildTypeClassMember ty -> + [ ident' cdeclTitle + , syntax "::" + , renderType ty + ] + +renderConstraint :: Constraint' -> RenderedCode +renderConstraint (P.Constraint ann pn kinds tys _) = + renderType $ foldl (P.TypeApp ann) (foldl (P.KindApp ann) (P.TypeConstructor ann (fmap P.coerceProperName pn)) kinds) tys + +renderConstraints :: [Constraint'] -> Maybe RenderedCode +renderConstraints constraints + | null constraints = Nothing + | otherwise = Just $ + syntax "(" + <> renderedConstraints + <> syntax ")" <> sp <> syntax "=>" + where + renderedConstraints = + mintersperse (syntax "," <> sp) + (map renderConstraint constraints) + +notQualified :: Text -> P.Qualified (P.ProperName a) +notQualified = P.Qualified P.ByNullSourcePos . P.ProperName + +ident' :: Text -> RenderedCode +ident' = ident . P.Qualified P.ByNullSourcePos . P.Ident + +dataCtor' :: Text -> RenderedCode +dataCtor' = dataCtor . notQualified + +typeApp :: Text -> [(Text, Type')] -> Type' +typeApp title typeArgs = + foldl (P.TypeApp ()) + (P.TypeConstructor () (notQualified title)) + (map toTypeVar typeArgs) + +toTypeVar :: (Text, Type') -> Type' +toTypeVar (s, k) = P.TypeVar () s k diff --git a/src/Language/PureScript/CST/Docs/RenderedCode.hs b/src/Language/PureScript/CST/Docs/RenderedCode.hs new file mode 100644 index 000000000..2162e76b5 --- /dev/null +++ b/src/Language/PureScript/CST/Docs/RenderedCode.hs @@ -0,0 +1,7 @@ +{- | Data types and functions for representing a simplified form of PureScript +code, intended for use in e.g. HTML documentation. +-} +module Language.PureScript.Docs.RenderedCode (module RenderedCode) where + +import Language.PureScript.Docs.RenderedCode.RenderType as RenderedCode +import Language.PureScript.Docs.RenderedCode.Types as RenderedCode diff --git a/src/Language/PureScript/CST/Docs/RenderedCode/RenderType.hs b/src/Language/PureScript/CST/Docs/RenderedCode/RenderType.hs new file mode 100644 index 000000000..b30a08a34 --- /dev/null +++ b/src/Language/PureScript/CST/Docs/RenderedCode/RenderType.hs @@ -0,0 +1,250 @@ +-- HLint is confused by the identifier `pattern` if PatternSynonyms is enabled. +{-# LANGUAGE NoPatternSynonyms #-} + +-- | Functions for producing RenderedCode values from PureScript Type values. +module Language.PureScript.Docs.RenderedCode.RenderType ( + renderType, + renderTypeWithRole, + renderType', + renderTypeAtom, + renderTypeAtom', + renderRow, +) where + +import Prelude + +import Data.List (uncons) +import Data.Maybe (fromMaybe) +import Data.Text (Text, pack) + +import Control.Arrow ((<+>)) +import Control.PatternArrows as PA + +import Language.PureScript.Crash (internalError) +import Language.PureScript.Label (Label) +import Language.PureScript.Names (coerceProperName) +import Language.PureScript.PSString (prettyPrintString) +import Language.PureScript.Pretty.Types (PrettyPrintConstraint, PrettyPrintType (..), convertPrettyPrintType, prettyPrintLabel) +import Language.PureScript.Roles (Role, displayRole) +import Language.PureScript.Types (Type, TypeVarVisibility, typeVarVisibilityPrefix) + +import Language.PureScript.Docs.RenderedCode.Types (RenderedCode, keywordForall, roleAnn, sp, syntax, typeCtor, typeOp, typeVar) +import Language.PureScript.Docs.Utils.MonoidExtras (mintersperse) + +typeLiterals :: Pattern () PrettyPrintType RenderedCode +typeLiterals = mkPattern match + where + match (PPTypeWildcard name) = + Just $ syntax $ maybe "_" ("?" <>) name + match (PPTypeVar var role) = + Just $ typeVar var <> roleAnn role + match (PPRecord labels tail_) = + Just $ + mintersperse + sp + [ syntax "{" + , renderRow labels tail_ + , syntax "}" + ] + match (PPTypeConstructor n) = + Just (typeCtor n) + match (PPRow labels tail_) = + Just (syntax "(" <> renderRow labels tail_ <> syntax ")") + match (PPBinaryNoParensType op l r) = + Just $ renderTypeAtom' l <> sp <> renderTypeAtom' op <> sp <> renderTypeAtom' r + match (PPTypeOp n) = + Just (typeOp n) + match (PPTypeLevelString str) = + Just (syntax (prettyPrintString str)) + match (PPTypeLevelInt nat) = + Just (syntax $ pack $ show nat) + match _ = + Nothing + +renderConstraint :: PrettyPrintConstraint -> RenderedCode +renderConstraint (pn, ks, tys) = + let instApp = foldl PPTypeApp (foldl (\a b -> PPTypeApp a (PPKindArg b)) (PPTypeConstructor (fmap coerceProperName pn)) ks) tys + in renderType' instApp + +renderConstraints :: PrettyPrintConstraint -> RenderedCode -> RenderedCode +renderConstraints con ty = + mintersperse + sp + [ renderConstraint con + , syntax "=>" + , ty + ] + +{- | +Render code representing a Row +-} +renderRow :: [(Label, PrettyPrintType)] -> Maybe PrettyPrintType -> RenderedCode +renderRow h t = renderHead h <> renderTail t + +renderHead :: [(Label, PrettyPrintType)] -> RenderedCode +renderHead = mintersperse (syntax "," <> sp) . map renderLabel + +renderLabel :: (Label, PrettyPrintType) -> RenderedCode +renderLabel (label, ty) = + mintersperse + sp + [ typeVar $ prettyPrintLabel label + , syntax "::" + , renderType' ty + ] + +renderTail :: Maybe PrettyPrintType -> RenderedCode +renderTail Nothing = mempty +renderTail (Just other) = sp <> syntax "|" <> sp <> renderType' other + +typeApp :: Pattern () PrettyPrintType (PrettyPrintType, PrettyPrintType) +typeApp = mkPattern match + where + match (PPTypeApp f x) = Just (f, x) + match _ = Nothing + +kindArg :: Pattern () PrettyPrintType ((), PrettyPrintType) +kindArg = mkPattern match + where + match (PPKindArg ty) = Just ((), ty) + match _ = Nothing + +appliedFunction :: Pattern () PrettyPrintType (PrettyPrintType, PrettyPrintType) +appliedFunction = mkPattern match + where + match (PPFunction arg ret) = Just (arg, ret) + match _ = Nothing + +kinded :: Pattern () PrettyPrintType (PrettyPrintType, PrettyPrintType) +kinded = mkPattern match + where + match (PPKindedType t k) = Just (t, k) + match _ = Nothing + +constrained :: Pattern () PrettyPrintType (PrettyPrintConstraint, PrettyPrintType) +constrained = mkPattern match + where + match (PPConstrainedType con ty) = Just (con, ty) + match _ = Nothing + +explicitParens :: Pattern () PrettyPrintType ((), PrettyPrintType) +explicitParens = mkPattern match + where + match (PPParensInType ty) = Just ((), ty) + match _ = Nothing + +matchTypeAtom :: Pattern () PrettyPrintType RenderedCode +matchTypeAtom = typeLiterals <+> fmap parens_ matchType + where + parens_ x = syntax "(" <> x <> syntax ")" + +matchType :: Pattern () PrettyPrintType RenderedCode +matchType = buildPrettyPrinter operators matchTypeAtom + where + operators :: OperatorTable () PrettyPrintType RenderedCode + operators = + OperatorTable + [ [Wrap kindArg $ \_ ty -> syntax "@" <> ty] + , [AssocL typeApp $ \f x -> f <> sp <> x] + , [AssocR appliedFunction $ \arg ret -> mintersperse sp [arg, syntax "->", ret]] + , [Wrap constrained $ \deps ty -> renderConstraints deps ty] + , [Wrap forall_ $ \tyVars ty -> mconcat [keywordForall, sp, renderTypeVars tyVars, syntax ".", sp, ty]] + , [Wrap kinded $ \ty k -> mintersperse sp [renderType' ty, syntax "::", k]] + , [Wrap explicitParens $ \_ ty -> ty] + ] + +forall_ :: Pattern () PrettyPrintType ([(TypeVarVisibility, Text, PrettyPrintType)], PrettyPrintType) +forall_ = mkPattern match + where + match (PPForAll mbKindedIdents ty) = Just (mbKindedIdents, ty) + match _ = Nothing + +renderTypeInternal :: (PrettyPrintType -> PrettyPrintType) -> Type a -> RenderedCode +renderTypeInternal insertRolesIfAny = + renderType' . insertRolesIfAny . convertPrettyPrintType maxBound + +{- | +Render code representing a Type +-} +renderType :: Type a -> RenderedCode +renderType = renderTypeInternal id + +{- | +Render code representing a Type +but augment the `TypeVar`s with their `Role` if they have one +-} +renderTypeWithRole :: [Role] -> Type a -> RenderedCode +renderTypeWithRole = \case + [] -> renderType + roleList -> renderTypeInternal (addRole roleList [] . Left) + where + -- `data Foo first second = Foo` will produce + -- ``` + -- PPTypeApp + -- (PPTypeApp (PPTypeConstructor fooName) (PPTypeVar "first" Nothing)) + -- (PPTypeVar "second" Nothing) + -- ``` + -- So, we recurse down the left side of `TypeApp` first before + -- recursing down the right side. To make this stack-safe, + -- we use a tail-recursive function with its own stack. + -- - Left = values that have not yet been examined and need + -- a role added to them (if any). There's still work "left" to do. + -- - Right = values that have been examined and now need to be + -- reassembled into their original value + addRole :: + [Role] -> + [Either PrettyPrintType PrettyPrintType] -> + Either PrettyPrintType PrettyPrintType -> + PrettyPrintType + addRole roles stack pp = case pp of + Left next -> case next of + PPTypeVar t Nothing + | Just (x, xs) <- uncons roles -> + addRole xs stack (Right $ PPTypeVar t (Just $ displayRole x)) + | otherwise -> + internalError "addRole: invalid arguments - number of roles doesn't match number of type parameters" + PPTypeVar _ (Just _) -> + internalError "addRole: attempted to add a second role to a type parameter that already has one" + PPTypeApp leftSide rightSide -> do + -- push right-side to stack and continue recursing on left-side + addRole roles (Left rightSide : stack) (Left leftSide) + other -> + -- nothing to check, so move on + addRole roles stack (Right other) + pendingAssembly@(Right rightSideOrFinalValue) -> case stack of + (unfinishedRightSide@(Left _) : remaining) -> + -- We've finished recursing through the left-side of a `TypeApp`. + -- Now we'll recurse through the right-side. + -- We push `pendingAssembly` onto the stack so we can assemble + -- the `PPTypeApp` together once it's right-side is done. + addRole roles (pendingAssembly : remaining) unfinishedRightSide + (Right leftSide : remaining) -> + -- We've finished recursing through the right-side of a `TypeApp` + -- We'll rebulid it and wrap it in `Right` so any other higher-level + -- `TypeApp`s can be reassembled now, too. + addRole roles remaining (Right (PPTypeApp leftSide rightSideOrFinalValue)) + [] -> + -- We've reassembled everything. It's time to return. + rightSideOrFinalValue + +renderType' :: PrettyPrintType -> RenderedCode +renderType' = + fromMaybe (internalError "Incomplete pattern") + . PA.pattern matchType () + +renderTypeVars :: [(TypeVarVisibility, Text, PrettyPrintType)] -> RenderedCode +renderTypeVars tyVars = mintersperse sp (map renderTypeVar tyVars) + +renderTypeVar :: (TypeVarVisibility, Text, PrettyPrintType) -> RenderedCode +renderTypeVar (vis, v, k) = mintersperse sp [mconcat [syntax "(", syntax $ typeVarVisibilityPrefix vis, typeVar v], syntax "::", mconcat [renderType' k, syntax ")"]] + +{- | +Render code representing a Type, as it should appear inside parentheses +-} +renderTypeAtom :: Type a -> RenderedCode +renderTypeAtom = renderTypeAtom' . convertPrettyPrintType maxBound + +renderTypeAtom' :: PrettyPrintType -> RenderedCode +renderTypeAtom' = + fromMaybe (internalError "Incomplete pattern") + . PA.pattern matchTypeAtom () diff --git a/src/Language/PureScript/CST/Docs/RenderedCode/Types.hs b/src/Language/PureScript/CST/Docs/RenderedCode/Types.hs new file mode 100644 index 000000000..c1374899f --- /dev/null +++ b/src/Language/PureScript/CST/Docs/RenderedCode/Types.hs @@ -0,0 +1,315 @@ +-- | Data types and functions for representing a simplified form of PureScript +-- code, intended for use in e.g. HTML documentation. + +module Language.PureScript.Docs.RenderedCode.Types + ( RenderedCodeElement(..) + , ContainingModule(..) + , asContainingModule + , maybeToContainingModule + , fromQualified + , Namespace(..) + , Link(..) + , FixityAlias + , RenderedCode + , outputWith + , sp + , syntax + , keyword + , keywordForall + , keywordData + , keywordType + , keywordClass + , keywordWhere + , keywordFixity + , keywordAs + , ident + , dataCtor + , typeCtor + , typeOp + , typeVar + , roleAnn + , alias + , aliasName + ) where + +import Prelude +import GHC.Generics (Generic) + +import Control.DeepSeq (NFData) +import Control.Monad.Error.Class (MonadError(..)) + +import Data.Aeson.BetterErrors (Parse, nth, withText, withValue, toAesonParser, perhaps, asText) +import Data.Aeson qualified as A +import Data.Text (Text) +import Data.Text qualified as T +import Data.ByteString.Lazy qualified as BS +import Data.Text.Encoding qualified as TE + +import Language.PureScript.Names (pattern ByNullSourcePos, Ident(..), ModuleName, OpName(..), OpNameType(..), ProperName(..), ProperNameType(..), Qualified(..), QualifiedBy(..), moduleNameFromString, runIdent, runModuleName) +import Language.PureScript.AST (Associativity(..)) + +-- | Given a list of actions, attempt them all, returning the first success. +-- If all the actions fail, 'tryAll' returns the first argument. +tryAll :: MonadError e m => m a -> [m a] -> m a +tryAll = foldr $ \x y -> catchError x (const y) + +firstEq :: Text -> Parse Text a -> Parse Text a +firstEq str p = nth 0 (withText (eq str)) *> p + where + eq s s' = if s == s' then Right () else Left "" + +-- | +-- Try the given parsers in sequence. If all fail, fail with the given message, +-- and include the JSON in the error. +-- +tryParse :: Text -> [Parse Text a] -> Parse Text a +tryParse msg = + tryAll (withValue (Left . (fullMsg <>) . showJSON)) + + where + fullMsg = "Invalid " <> msg <> ": " + + showJSON :: A.Value -> Text + showJSON = TE.decodeUtf8 . BS.toStrict . A.encode + +-- | +-- This type is isomorphic to 'Maybe' 'ModuleName'. It makes code a bit +-- easier to read, as the meaning is more explicit. +-- +data ContainingModule + = ThisModule + | OtherModule ModuleName + deriving (Show, Eq, Ord) + +instance A.ToJSON ContainingModule where + toJSON = A.toJSON . go + where + go = \case + ThisModule -> ["ThisModule"] + OtherModule mn -> ["OtherModule", runModuleName mn] + +instance A.FromJSON ContainingModule where + parseJSON = toAesonParser id asContainingModule + +asContainingModule :: Parse Text ContainingModule +asContainingModule = + tryParse "containing module" $ + current ++ backwardsCompat + where + current = + [ firstEq "ThisModule" (pure ThisModule) + , firstEq "OtherModule" (OtherModule <$> nth 1 asModuleName) + ] + + -- For JSON produced by compilers up to 0.10.5. + backwardsCompat = + [ maybeToContainingModule <$> perhaps asModuleName + ] + + asModuleName = moduleNameFromString <$> asText + +-- | +-- Convert a 'Maybe' 'ModuleName' to a 'ContainingModule', using the obvious +-- isomorphism. +-- +maybeToContainingModule :: Maybe ModuleName -> ContainingModule +maybeToContainingModule Nothing = ThisModule +maybeToContainingModule (Just mn) = OtherModule mn + +fromQualified :: Qualified a -> (ContainingModule, a) +fromQualified (Qualified (ByModuleName mn) x) = (OtherModule mn, x) +fromQualified (Qualified _ x) = (ThisModule, x) + +data Link + = NoLink + | Link ContainingModule + deriving (Show, Eq, Ord) + +instance A.ToJSON Link where + toJSON = \case + NoLink -> A.toJSON ["NoLink" :: Text] + Link mn -> A.toJSON ["Link", A.toJSON mn] + +asLink :: Parse Text Link +asLink = + tryParse "link" + [ firstEq "NoLink" (pure NoLink) + , firstEq "Link" (Link <$> nth 1 asContainingModule) + ] + +instance A.FromJSON Link where + parseJSON = toAesonParser id asLink + +data Namespace + = ValueLevel + | TypeLevel + deriving (Show, Eq, Ord, Generic) + +instance NFData Namespace + +instance A.ToJSON Namespace where + toJSON = A.toJSON . show + +asNamespace :: Parse Text Namespace +asNamespace = + tryParse "namespace" + [ withText $ \case + "ValueLevel" -> Right ValueLevel + "TypeLevel" -> Right TypeLevel + _ -> Left "" + ] + +instance A.FromJSON Namespace where + parseJSON = toAesonParser id asNamespace + +-- | +-- A single element in a rendered code fragment. The intention is to support +-- multiple output formats. For example, plain text, or highlighted HTML. +-- +data RenderedCodeElement + = Syntax Text + | Keyword Text + | Space + -- | Any symbol which you might or might not want to link to, in any + -- namespace (value, type, or kind). Note that this is not related to the + -- kind called Symbol for type-level strings. + | Symbol Namespace Text Link + | Role Text + deriving (Show, Eq, Ord) + +instance A.ToJSON RenderedCodeElement where + toJSON (Syntax str) = + A.toJSON ["syntax", str] + toJSON (Keyword str) = + A.toJSON ["keyword", str] + toJSON Space = + A.toJSON ["space" :: Text] + toJSON (Symbol ns str link) = + A.toJSON ["symbol", A.toJSON ns, A.toJSON str, A.toJSON link] + toJSON (Role role) = + A.toJSON ["role", role] + +-- | +-- A type representing a highly simplified version of PureScript code, intended +-- for use in output formats like plain text or HTML. +-- +newtype RenderedCode + = RC { unRC :: [RenderedCodeElement] } + deriving (Show, Eq, Ord, Semigroup, Monoid) + +instance A.ToJSON RenderedCode where + toJSON (RC elems) = A.toJSON elems + +-- | +-- This function allows conversion of a 'RenderedCode' value into a value of +-- some other type (for example, plain text, or HTML). The first argument +-- is a function specifying how each individual 'RenderedCodeElement' should be +-- rendered. +-- +outputWith :: Monoid a => (RenderedCodeElement -> a) -> RenderedCode -> a +outputWith f = foldMap f . unRC + +-- | +-- A 'RenderedCode' fragment representing a space. +-- +sp :: RenderedCode +sp = RC [Space] + +-- possible TODO: instead of this function, export RenderedCode values for +-- each syntax element, eg syntaxArr (== syntax "->"), syntaxLBrace, +-- syntaxRBrace, etc. +syntax :: Text -> RenderedCode +syntax x = RC [Syntax x] + +keyword :: Text -> RenderedCode +keyword kw = RC [Keyword kw] + +keywordForall :: RenderedCode +keywordForall = keyword "forall" + +keywordData :: RenderedCode +keywordData = keyword "data" + +keywordType :: RenderedCode +keywordType = keyword "type" + +keywordClass :: RenderedCode +keywordClass = keyword "class" + +keywordWhere :: RenderedCode +keywordWhere = keyword "where" + +keywordFixity :: Associativity -> RenderedCode +keywordFixity Infixl = keyword "infixl" +keywordFixity Infixr = keyword "infixr" +keywordFixity Infix = keyword "infix" + +keywordAs :: RenderedCode +keywordAs = keyword "as" + +ident :: Qualified Ident -> RenderedCode +ident (fromQualified -> (mn, name)) = + RC [Symbol ValueLevel (runIdent name) (Link mn)] + +dataCtor :: Qualified (ProperName 'ConstructorName) -> RenderedCode +dataCtor (fromQualified -> (mn, name)) = + RC [Symbol ValueLevel (runProperName name) (Link mn)] + +typeCtor :: Qualified (ProperName 'TypeName) -> RenderedCode +typeCtor (fromQualified -> (mn, name)) = + RC [Symbol TypeLevel (runProperName name) (Link mn)] + +typeOp :: Qualified (OpName 'TypeOpName) -> RenderedCode +typeOp (fromQualified -> (mn, name)) = + RC [Symbol TypeLevel (runOpName name) (Link mn)] + +typeVar :: Text -> RenderedCode +typeVar x = RC [Symbol TypeLevel x NoLink] + +roleAnn :: Maybe Text -> RenderedCode +roleAnn = RC . maybe [] renderRole + where + renderRole = \case + "nominal" -> [Role "nominal"] + "phantom" -> [Role "phantom"] + _ -> [] + +type FixityAlias = Qualified (Either (ProperName 'TypeName) (Either Ident (ProperName 'ConstructorName))) + +alias :: FixityAlias -> RenderedCode +alias for = + prefix <> RC [Symbol ns name (Link mn)] + where + (ns, name, mn) = unpackFixityAlias for + prefix = case ns of + TypeLevel -> + keywordType <> sp + _ -> + mempty + +aliasName :: FixityAlias -> Text -> RenderedCode +aliasName for name' = + let + (ns, _, _) = unpackFixityAlias for + unParen = T.tail . T.init + name = unParen name' + in + case ns of + ValueLevel -> + ident (Qualified ByNullSourcePos (Ident name)) + TypeLevel -> + typeCtor (Qualified ByNullSourcePos (ProperName name)) + +-- | Converts a FixityAlias into a different representation which is more +-- useful to other functions in this module. +unpackFixityAlias :: FixityAlias -> (Namespace, Text, ContainingModule) +unpackFixityAlias (fromQualified -> (mn, x)) = + case x of + -- We add some seemingly superfluous type signatures here just to be extra + -- sure we are not mixing up our namespaces. + Left (n :: ProperName 'TypeName) -> + (TypeLevel, runProperName n, mn) + Right (Left n) -> + (ValueLevel, runIdent n, mn) + Right (Right (n :: ProperName 'ConstructorName)) -> + (ValueLevel, runProperName n, mn) diff --git a/src/Language/PureScript/CST/Docs/Tags.hs b/src/Language/PureScript/CST/Docs/Tags.hs new file mode 100644 index 000000000..e3651c9fa --- /dev/null +++ b/src/Language/PureScript/CST/Docs/Tags.hs @@ -0,0 +1,53 @@ +module Language.PureScript.Docs.Tags + ( tags + , dumpCtags + , dumpEtags + ) where + +import Prelude + +import Control.Arrow (first) +import Data.List (sort) +import Data.Maybe (mapMaybe) +import Data.Text qualified as T +import Language.PureScript.AST (SourceSpan, sourcePosLine, spanStart) +import Language.PureScript.Docs.Types (ChildDeclaration(..), Declaration(..), Module(..)) + +tags :: Module -> [(String, Int)] +tags = map (first T.unpack) . concatMap dtags . modDeclarations + where + dtags :: Declaration -> [(T.Text, Int)] + dtags decl = case declSourceSpan decl of + Just ss -> (declTitle decl, pos ss):mapMaybe subtag (declChildren decl) + Nothing -> mapMaybe subtag $ declChildren decl + + subtag :: ChildDeclaration -> Maybe (T.Text, Int) + subtag cdecl = case cdeclSourceSpan cdecl of + Just ss -> Just (cdeclTitle cdecl, pos ss) + Nothing -> Nothing + + pos :: SourceSpan -> Int + pos = sourcePosLine . spanStart + +-- etags files appear to be sorted on module file name: +-- from emacs source, `emacs/lib-src/etags.c`: +-- "In etags mode, sort by file name." +dumpEtags :: [(String, Module)] -> [String] +dumpEtags = concatMap renderModEtags . sort + +renderModEtags :: (String, Module) -> [String] +renderModEtags (path, mdl) = ["\x0c", path ++ "," ++ show tagsLen] ++ tagLines + where tagsLen = sum $ map length tagLines + tagLines = map tagLine $ tags mdl + tagLine (name, line) = "\x7f" ++ name ++ "\x01" ++ show line ++ "," + +-- ctags files are required to be sorted: http://ctags.sourceforge.net/FORMAT +-- "The tags file is sorted on {tagname}. This allows for a binary search in +-- the file." +dumpCtags :: [(String, Module)] -> [String] +dumpCtags = sort . concatMap renderModCtags + +renderModCtags :: (String, Module) -> [String] +renderModCtags (path, mdl) = sort tagLines + where tagLines = map tagLine $ tags mdl + tagLine (name, line) = name ++ "\t" ++ path ++ "\t" ++ show line diff --git a/src/Language/PureScript/CST/Docs/Types.hs b/src/Language/PureScript/CST/Docs/Types.hs new file mode 100644 index 000000000..2a23cd9e4 --- /dev/null +++ b/src/Language/PureScript/CST/Docs/Types.hs @@ -0,0 +1,882 @@ +module Language.PureScript.Docs.Types + ( module Language.PureScript.Docs.Types + , module ReExports + ) + where + +import Protolude hiding (to, from, unlines) +import Prelude (String, unlines, lookup) + +import Control.Arrow ((***)) + +import Data.Aeson ((.=)) +import Data.Aeson.Key qualified as A.Key +import Data.Aeson.BetterErrors + (Parse, keyOrDefault, throwCustomError, key, asText, + keyMay, withString, eachInArray, asNull, (.!), toAesonParser, toAesonParser', + fromAesonParser, perhaps, withText, asIntegral, nth, eachInObjectWithKey, + asString) +import Data.Map qualified as Map +import Data.Time.Clock (UTCTime) +import Data.Time.Format qualified as TimeFormat +import Data.Version (Version(..), showVersion) +import Data.Aeson qualified as A +import Data.Text qualified as T +import Data.Vector qualified as V + +import Language.PureScript.AST qualified as P +import Language.PureScript.CoreFn.FromJSON qualified as P +import Language.PureScript.Crash qualified as P +import Language.PureScript.Environment qualified as P +import Language.PureScript.Names qualified as P +import Language.PureScript.Roles qualified as P +import Language.PureScript.Types qualified as P +import Paths_purescript qualified as Paths + +import Web.Bower.PackageMeta (BowerError, PackageMeta(..), PackageName, asPackageMeta, parsePackageName, runPackageName, showBowerError) + +import Language.PureScript.Docs.RenderedCode as ReExports + (RenderedCode, + ContainingModule(..), asContainingModule, + RenderedCodeElement(..), + Namespace(..), FixityAlias) +import Language.PureScript.Publish.Registry.Compat (PursJsonError, showPursJsonError) + +type Type' = P.Type () +type Constraint' = P.Constraint () + +-------------------- +-- Types + +data Package a = Package + { pkgMeta :: PackageMeta + , pkgVersion :: Version + , pkgVersionTag :: Text + -- TODO: When this field was introduced, it was given the Maybe type for the + -- sake of backwards compatibility, as older JSON blobs will not include the + -- field. It should eventually be changed to just UTCTime. + , pkgTagTime :: Maybe UTCTime + , pkgModules :: [Module] + , pkgModuleMap :: Map P.ModuleName PackageName + , pkgResolvedDependencies :: [(PackageName, Version)] + , pkgGithub :: (GithubUser, GithubRepo) + , pkgUploader :: a + , pkgCompilerVersion :: Version + -- ^ The version of the PureScript compiler which was used to generate + -- this data. We store this in order to reject packages which are too old. + } + deriving (Show, Eq, Ord, Generic) + +instance NFData a => NFData (Package a) + +data NotYetKnown = NotYetKnown + deriving (Show, Eq, Ord, Generic) + +instance NFData NotYetKnown + +type UploadedPackage = Package NotYetKnown +type VerifiedPackage = Package GithubUser + +data ManifestError + = BowerManifest BowerError + | PursManifest PursJsonError + deriving (Show, Eq, Ord, Generic) + +instance NFData ManifestError + +showManifestError :: ManifestError -> Text +showManifestError = \case + BowerManifest err -> showBowerError err + PursManifest err -> showPursJsonError err + +verifyPackage :: GithubUser -> UploadedPackage -> VerifiedPackage +verifyPackage verifiedUser Package{..} = + Package pkgMeta + pkgVersion + pkgVersionTag + pkgTagTime + pkgModules + pkgModuleMap + pkgResolvedDependencies + pkgGithub + verifiedUser + pkgCompilerVersion + +packageName :: Package a -> PackageName +packageName = bowerName . pkgMeta + +-- | +-- The time format used for serializing package tag times in the JSON format. +-- This is the ISO 8601 date format which includes a time and a timezone. +-- +jsonTimeFormat :: String +jsonTimeFormat = "%Y-%m-%dT%H:%M:%S%z" + +-- | +-- Convenience function for formatting a time in the format expected by this +-- module. +-- +formatTime :: UTCTime -> String +formatTime = + TimeFormat.formatTime TimeFormat.defaultTimeLocale jsonTimeFormat + +-- | +-- Convenience function for parsing a time in the format expected by this +-- module. +-- +parseTime :: String -> Maybe UTCTime +parseTime = + TimeFormat.parseTimeM False TimeFormat.defaultTimeLocale jsonTimeFormat + +data Module = Module + { modName :: P.ModuleName + , modComments :: Maybe Text + , modDeclarations :: [Declaration] + -- Re-exported values from other modules + , modReExports :: [(InPackage P.ModuleName, [Declaration])] + } + deriving (Show, Eq, Ord, Generic) + +instance NFData Module + +data Declaration = Declaration + { declTitle :: Text + , declComments :: Maybe Text + , declSourceSpan :: Maybe P.SourceSpan + , declChildren :: [ChildDeclaration] + , declInfo :: DeclarationInfo + , declKind :: Maybe KindInfo + } + deriving (Show, Eq, Ord, Generic) + +instance NFData Declaration + +-- | +-- A value of this type contains information that is specific to a particular +-- kind of declaration (as opposed to information which exists in all kinds of +-- declarations, which goes into the 'Declaration' type directly). +-- +-- Many of the constructors are very similar to their equivalents in the real +-- PureScript AST, except that they have their name elided, since this is +-- already available via the rdTitle field of 'Declaration'. +-- +data DeclarationInfo + -- | + -- A value declaration, with its type. + -- + = ValueDeclaration Type' + + -- | + -- A data/newtype declaration, with the kind of declaration (data or + -- newtype) and its type arguments. Constructors are represented as child + -- declarations. + -- + | DataDeclaration P.DataDeclType [(Text, Type')] [P.Role] + + -- | + -- A data type foreign import, with its kind. + -- + | ExternDataDeclaration Type' [P.Role] + + -- | + -- A type synonym, with its type arguments and its type. + -- + | TypeSynonymDeclaration [(Text, Type')] Type' + + -- | + -- A type class, with its type arguments, its superclasses and functional + -- dependencies. Instances and members are represented as child declarations. + -- + | TypeClassDeclaration [(Text, Type')] [Constraint'] [([Text], [Text])] + + -- | + -- An operator alias declaration, with the member the alias is for and the + -- operator's fixity. + -- + | AliasDeclaration P.Fixity FixityAlias + deriving (Show, Eq, Ord, Generic) + +instance NFData DeclarationInfo + +-- | +-- Wraps enough information to properly render the kind signature +-- of a data/newtype/type/class declaration. +data KindInfo = KindInfo + { kiKeyword :: P.KindSignatureFor + , kiKind :: Type' + } + deriving (Show, Eq, Ord, Generic) + +instance NFData KindInfo + +convertFundepsToStrings :: [(Text, Type')] -> [P.FunctionalDependency] -> [([Text], [Text])] +convertFundepsToStrings args fundeps = + map (\(P.FunctionalDependency from to) -> toArgs from to) fundeps + where + argsVec = V.fromList (map fst args) + getArg i = + fromMaybe + (P.internalError $ unlines + [ "convertDeclaration: Functional dependency index" + , show i + , "is bigger than arguments list" + , show (map fst args) + , "Functional dependencies are" + , show fundeps + ] + ) $ argsVec V.!? i + toArgs from to = (map getArg from, map getArg to) + +declInfoToString :: DeclarationInfo -> Text +declInfoToString (ValueDeclaration _) = "value" +declInfoToString (DataDeclaration _ _ _) = "data" +declInfoToString (ExternDataDeclaration _ _) = "externData" +declInfoToString (TypeSynonymDeclaration _ _) = "typeSynonym" +declInfoToString (TypeClassDeclaration _ _ _) = "typeClass" +declInfoToString (AliasDeclaration _ _) = "alias" + +declInfoNamespace :: DeclarationInfo -> Namespace +declInfoNamespace = \case + ValueDeclaration{} -> + ValueLevel + DataDeclaration{} -> + TypeLevel + ExternDataDeclaration{} -> + TypeLevel + TypeSynonymDeclaration{} -> + TypeLevel + TypeClassDeclaration{} -> + TypeLevel + AliasDeclaration _ alias -> + either (const TypeLevel) (const ValueLevel) (P.disqualify alias) + +isTypeClass :: Declaration -> Bool +isTypeClass Declaration{..} = + case declInfo of + TypeClassDeclaration{} -> True + _ -> False + +isValue :: Declaration -> Bool +isValue Declaration{..} = + case declInfo of + ValueDeclaration{} -> True + _ -> False + +isType :: Declaration -> Bool +isType Declaration{..} = + case declInfo of + TypeSynonymDeclaration{} -> True + DataDeclaration{} -> True + ExternDataDeclaration{} -> True + _ -> False + +isValueAlias :: Declaration -> Bool +isValueAlias Declaration{..} = + case declInfo of + AliasDeclaration _ (P.Qualified _ d) -> isRight d + _ -> False + +isTypeAlias :: Declaration -> Bool +isTypeAlias Declaration{..} = + case declInfo of + AliasDeclaration _ (P.Qualified _ d) -> isLeft d + _ -> False + +-- | Discard any children which do not satisfy the given predicate. +filterChildren :: (ChildDeclaration -> Bool) -> Declaration -> Declaration +filterChildren p decl = + decl { declChildren = filter p (declChildren decl) } + +data ChildDeclaration = ChildDeclaration + { cdeclTitle :: Text + , cdeclComments :: Maybe Text + , cdeclSourceSpan :: Maybe P.SourceSpan + , cdeclInfo :: ChildDeclarationInfo + } + deriving (Show, Eq, Ord, Generic) + +instance NFData ChildDeclaration + +data ChildDeclarationInfo + -- | + -- A type instance declaration, with its dependencies and its type. + -- + = ChildInstance [Constraint'] Type' + + -- | + -- A data constructor, with its type arguments. + -- + | ChildDataConstructor [Type'] + + -- | + -- A type class member, with its type. Note that the type does not include + -- the type class constraint; this may be added manually if desired. For + -- example, `pure` from `Applicative` would be `forall a. a -> f a`. + -- + | ChildTypeClassMember Type' + deriving (Show, Eq, Ord, Generic) + +instance NFData ChildDeclarationInfo + +childDeclInfoToString :: ChildDeclarationInfo -> Text +childDeclInfoToString (ChildInstance _ _) = "instance" +childDeclInfoToString (ChildDataConstructor _) = "dataConstructor" +childDeclInfoToString (ChildTypeClassMember _) = "typeClassMember" + +childDeclInfoNamespace :: ChildDeclarationInfo -> Namespace +childDeclInfoNamespace = + -- We could just write this as `const ValueLevel` but by doing it this way, + -- if another constructor is added, we get a warning which acts as a prompt + -- to update this, instead of having this function (possibly incorrectly) + -- just return ValueLevel for the new constructor. + \case + ChildInstance{} -> + ValueLevel + ChildDataConstructor{} -> + ValueLevel + ChildTypeClassMember{} -> + ValueLevel + +isTypeClassMember :: ChildDeclaration -> Bool +isTypeClassMember ChildDeclaration{..} = + case cdeclInfo of + ChildTypeClassMember{} -> True + _ -> False + +isDataConstructor :: ChildDeclaration -> Bool +isDataConstructor ChildDeclaration{..} = + case cdeclInfo of + ChildDataConstructor{} -> True + _ -> False + +newtype GithubUser + = GithubUser { runGithubUser :: Text } + deriving (Show, Eq, Ord, Generic) + +instance NFData GithubUser + +newtype GithubRepo + = GithubRepo { runGithubRepo :: Text } + deriving (Show, Eq, Ord, Generic) + +instance NFData GithubRepo + +data PackageError + = CompilerTooOld Version Version + -- ^ Minimum allowable version for generating data with the current + -- parser, and actual version used. + | ErrorInPackageMeta ManifestError + | InvalidVersion + | InvalidDeclarationType Text + | InvalidChildDeclarationType Text + | InvalidFixity + | InvalidKind Text + | InvalidDataDeclType Text + | InvalidKindSignatureFor Text + | InvalidTime + | InvalidRole Text + deriving (Show, Eq, Ord, Generic) + +instance NFData PackageError + +data InPackage a + = Local a + | FromDep PackageName a + deriving (Show, Eq, Ord, Generic) + +instance NFData a => NFData (InPackage a) + +instance Functor InPackage where + fmap f (Local x) = Local (f x) + fmap f (FromDep pkgName x) = FromDep pkgName (f x) + +ignorePackage :: InPackage a -> a +ignorePackage (Local x) = x +ignorePackage (FromDep _ x) = x + +---------------------------------------------------- +-- Types for links between declarations + +data LinksContext = LinksContext + { ctxGithub :: (GithubUser, GithubRepo) + , ctxModuleMap :: Map P.ModuleName PackageName + , ctxResolvedDependencies :: [(PackageName, Version)] + , ctxPackageName :: PackageName + , ctxVersion :: Version + , ctxVersionTag :: Text + } + deriving (Show, Eq, Ord, Generic) + +instance NFData LinksContext + +data DocLink = DocLink + { linkLocation :: LinkLocation + , linkTitle :: Text + , linkNamespace :: Namespace + } + deriving (Show, Eq, Ord, Generic) + +instance NFData DocLink + +data LinkLocation + -- | A link to a declaration in the current package. + = LocalModule P.ModuleName + + -- | A link to a declaration in a different package. The arguments represent + -- the name of the other package, the version of the other package, and the + -- name of the module in the other package that the declaration is in. + | DepsModule PackageName Version P.ModuleName + + -- | A link to a declaration that is built in to the compiler, e.g. the Prim + -- module. In this case we only need to store the module that the builtin + -- comes from. Note that all builtin modules begin with "Prim", and that the + -- compiler rejects attempts to define modules whose names start with "Prim". + | BuiltinModule P.ModuleName + deriving (Show, Eq, Ord, Generic) + +instance NFData LinkLocation + +-- | Given a links context, the current module name, the namespace of a thing +-- to link to, its title, and its containing module, attempt to create a +-- DocLink. +getLink :: LinksContext -> P.ModuleName -> Namespace -> Text -> ContainingModule -> Maybe DocLink +getLink LinksContext{..} curMn namespace target containingMod = do + location <- getLinkLocation + return DocLink + { linkLocation = location + , linkTitle = target + , linkNamespace = namespace + } + + where + getLinkLocation = builtinLinkLocation <|> normalLinkLocation + + normalLinkLocation = do + case containingMod of + ThisModule -> + return $ LocalModule curMn + OtherModule destMn -> + case Map.lookup destMn ctxModuleMap of + Nothing -> + return $ LocalModule destMn + Just pkgName -> do + pkgVersion <- lookup pkgName ctxResolvedDependencies + return $ DepsModule pkgName pkgVersion destMn + + builtinLinkLocation = + case containingMod of + OtherModule mn | P.isBuiltinModuleName mn -> + pure $ BuiltinModule mn + _ -> + empty + +getLinksContext :: Package a -> LinksContext +getLinksContext Package{..} = + LinksContext + { ctxGithub = pkgGithub + , ctxModuleMap = pkgModuleMap + , ctxResolvedDependencies = pkgResolvedDependencies + , ctxPackageName = bowerName pkgMeta + , ctxVersion = pkgVersion + , ctxVersionTag = pkgVersionTag + } + +---------------------- +-- Parsing + +asPackage :: Version -> (forall e. Parse e a) -> Parse PackageError (Package a) +asPackage minimumVersion uploader = do + -- If the compilerVersion key is missing, we can be sure that it was produced + -- with 0.7.0.0, since that is the only released version that included the + -- `psc-publish` tool (now `purs publish`) before this key was added. + compilerVersion <- keyOrDefault "compilerVersion" (Version [0,7,0,0] []) asVersion + when (compilerVersion < minimumVersion) + (throwCustomError $ CompilerTooOld minimumVersion compilerVersion) + + Package <$> key "packageMeta" asPackageMeta .! (ErrorInPackageMeta . BowerManifest) + <*> key "version" asVersion + <*> key "versionTag" asText + <*> keyMay "tagTime" (withString parseTimeEither) + <*> key "modules" (eachInArray asModule) + <*> moduleMap + <*> key "resolvedDependencies" asResolvedDependencies + <*> key "github" asGithub + <*> key "uploader" uploader + <*> pure compilerVersion + where + moduleMap = + key "moduleMap" asModuleMap + `pOr` (key "bookmarks" bookmarksAsModuleMap .! ErrorInPackageMeta) + +parseTimeEither :: String -> Either PackageError UTCTime +parseTimeEither = + maybe (Left InvalidTime) Right . parseTime + +asUploadedPackage :: Version -> Parse PackageError UploadedPackage +asUploadedPackage minVersion = asPackage minVersion asNotYetKnown + +asNotYetKnown :: Parse e NotYetKnown +asNotYetKnown = NotYetKnown <$ asNull + +instance A.FromJSON NotYetKnown where + parseJSON = toAesonParser' asNotYetKnown + +displayPackageError :: PackageError -> Text +displayPackageError e = case e of + CompilerTooOld minV usedV -> + "Expecting data produced by at least version " <> T.pack (showVersion minV) + <> " of the compiler, but it appears that " <> T.pack (showVersion usedV) + <> " was used." + ErrorInPackageMeta err -> + "Error in package metadata: " <> showManifestError err + InvalidVersion -> + "Invalid version" + InvalidDeclarationType str -> + "Invalid declaration type: \"" <> str <> "\"" + InvalidChildDeclarationType str -> + "Invalid child declaration type: \"" <> str <> "\"" + InvalidFixity -> + "Invalid fixity" + InvalidKind str -> + "Invalid kind: \"" <> str <> "\"" + InvalidDataDeclType str -> + "Invalid data declaration type: \"" <> str <> "\"" + InvalidKindSignatureFor str -> + "Invalid kind signature keyword: \"" <> str <> "\"" + InvalidTime -> + "Invalid time" + InvalidRole str -> + "Invalid role keyword: \"" <> str <> "\"" + +instance A.FromJSON a => A.FromJSON (Package a) where + parseJSON = toAesonParser displayPackageError + (asPackage (Version [0,0,0,0] []) fromAesonParser) + +asGithubUser :: Parse e GithubUser +asGithubUser = GithubUser <$> asText + +instance A.FromJSON GithubUser where + parseJSON = toAesonParser' asGithubUser + +asVersion :: Parse PackageError Version +asVersion = withString (maybe (Left InvalidVersion) Right . P.parseVersion') + +asModule :: Parse PackageError Module +asModule = + Module <$> key "name" (P.moduleNameFromString <$> asText) + <*> key "comments" (perhaps asText) + <*> key "declarations" (eachInArray asDeclaration) + <*> key "reExports" (eachInArray asReExport) + +asDeclaration :: Parse PackageError Declaration +asDeclaration = + Declaration <$> key "title" asText + <*> key "comments" (perhaps asText) + <*> key "sourceSpan" (perhaps asSourceSpan) + <*> key "children" (eachInArray asChildDeclaration) + <*> key "info" asDeclarationInfo + <*> keyOrDefault "kind" Nothing (perhaps asKindInfo) + +asReExport :: Parse PackageError (InPackage P.ModuleName, [Declaration]) +asReExport = + (,) <$> key "moduleName" asReExportModuleName + <*> key "declarations" (eachInArray asDeclaration) + where + -- This is to preserve backwards compatibility with 0.10.3 and earlier versions + -- of the compiler, where the modReExports field had the type + -- [(P.ModuleName, [Declaration])]. This should eventually be removed, + -- possibly at the same time as the next breaking change to this JSON format. + asReExportModuleName :: Parse PackageError (InPackage P.ModuleName) + asReExportModuleName = + asInPackage fromAesonParser .! ErrorInPackageMeta + `pOr` fmap Local fromAesonParser + +pOr :: Parse e a -> Parse e a -> Parse e a +p `pOr` q = catchError p (const q) + +asInPackage :: Parse ManifestError a -> Parse ManifestError (InPackage a) +asInPackage inner = + build <$> key "package" (perhaps (withText (mapLeft BowerManifest . parsePackageName))) + <*> key "item" inner + where + build Nothing = Local + build (Just pn) = FromDep pn + +asFixity :: Parse PackageError P.Fixity +asFixity = + P.Fixity <$> key "associativity" asAssociativity + <*> key "precedence" asIntegral + +asFixityAlias :: Parse PackageError FixityAlias +asFixityAlias = fromAesonParser + +parseAssociativity :: String -> Maybe P.Associativity +parseAssociativity str = case str of + "infix" -> Just P.Infix + "infixl" -> Just P.Infixl + "infixr" -> Just P.Infixr + _ -> Nothing + +asAssociativity :: Parse PackageError P.Associativity +asAssociativity = withString (maybe (Left InvalidFixity) Right . parseAssociativity) + +asDeclarationInfo :: Parse PackageError DeclarationInfo +asDeclarationInfo = do + ty <- key "declType" asText + case ty of + "value" -> + ValueDeclaration <$> key "type" asType + "data" -> + DataDeclaration <$> key "dataDeclType" asDataDeclType + <*> key "typeArguments" asTypeArguments + <*> keyOrDefault "roles" [] (eachInArray asRole) + "externData" -> + ExternDataDeclaration <$> key "kind" asType + <*> keyOrDefault "roles" [] (eachInArray asRole) + "typeSynonym" -> + TypeSynonymDeclaration <$> key "arguments" asTypeArguments + <*> key "type" asType + "typeClass" -> + TypeClassDeclaration <$> key "arguments" asTypeArguments + <*> key "superclasses" (eachInArray asConstraint) + <*> keyOrDefault "fundeps" [] asFunDeps + "alias" -> + AliasDeclaration <$> key "fixity" asFixity + <*> key "alias" asFixityAlias + -- Backwards compat: kinds are extern data + "kind" -> + pure $ ExternDataDeclaration (P.kindType $> ()) [] + other -> + throwCustomError (InvalidDeclarationType other) + +asKindInfo :: Parse PackageError KindInfo +asKindInfo = + KindInfo <$> key "keyword" asKindSignatureFor + <*> key "kind" asType + +asKindSignatureFor :: Parse PackageError P.KindSignatureFor +asKindSignatureFor = + withText $ \case + "data" -> Right P.DataSig + "newtype" -> Right P.NewtypeSig + "class" -> Right P.ClassSig + "type" -> Right P.TypeSynonymSig + x -> Left (InvalidKindSignatureFor x) + +asTypeArguments :: Parse PackageError [(Text, Type')] +asTypeArguments = eachInArray asTypeArgument + where + asTypeArgument = (,) <$> nth 0 asText <*> nth 1 asType + +asRole :: Parse PackageError P.Role +asRole = + withText $ \case + "Representational" -> Right P.Representational + "Nominal" -> Right P.Nominal + "Phantom" -> Right P.Phantom + other -> Left (InvalidRole other) + +asType :: Parse e Type' +asType = fromAesonParser + +asFunDeps :: Parse PackageError [([Text], [Text])] +asFunDeps = eachInArray asFunDep + where + asFunDep = (,) <$> nth 0 (eachInArray asText) <*> nth 1 (eachInArray asText) + +asDataDeclType :: Parse PackageError P.DataDeclType +asDataDeclType = + withText $ \case + "data" -> Right P.Data + "newtype" -> Right P.Newtype + other -> Left (InvalidDataDeclType other) + +asChildDeclaration :: Parse PackageError ChildDeclaration +asChildDeclaration = + ChildDeclaration <$> key "title" asText + <*> key "comments" (perhaps asText) + <*> key "sourceSpan" (perhaps asSourceSpan) + <*> key "info" asChildDeclarationInfo + +asChildDeclarationInfo :: Parse PackageError ChildDeclarationInfo +asChildDeclarationInfo = do + ty <- key "declType" asText + case ty of + "instance" -> + ChildInstance <$> key "dependencies" (eachInArray asConstraint) + <*> key "type" asType + "dataConstructor" -> + ChildDataConstructor <$> key "arguments" (eachInArray asType) + "typeClassMember" -> + ChildTypeClassMember <$> key "type" asType + other -> + throwCustomError $ InvalidChildDeclarationType other + +asSourcePos :: Parse e P.SourcePos +asSourcePos = P.SourcePos <$> nth 0 asIntegral + <*> nth 1 asIntegral + +asConstraint :: Parse PackageError Constraint' +asConstraint = P.Constraint () <$> key "constraintClass" asQualifiedProperName + <*> keyOrDefault "constraintKindArgs" [] (eachInArray asType) + <*> key "constraintArgs" (eachInArray asType) + <*> pure Nothing + +asQualifiedProperName :: Parse e (P.Qualified (P.ProperName a)) +asQualifiedProperName = fromAesonParser + +asModuleMap :: Parse PackageError (Map P.ModuleName PackageName) +asModuleMap = + Map.fromList <$> + eachInObjectWithKey (Right . P.moduleNameFromString) + (withText parsePackageName') + +-- This is here to preserve backwards compatibility with compilers which used +-- to generate a 'bookmarks' field in the JSON (i.e. up to 0.10.5). We should +-- remove this after the next breaking change to the JSON. +bookmarksAsModuleMap :: Parse ManifestError (Map P.ModuleName PackageName) +bookmarksAsModuleMap = + convert <$> + eachInArray (asInPackage (nth 0 (P.moduleNameFromString <$> asText))) + + where + convert :: [InPackage P.ModuleName] -> Map P.ModuleName PackageName + convert = Map.fromList . mapMaybe toTuple + + toTuple (Local _) = Nothing + toTuple (FromDep pkgName mn) = Just (mn, pkgName) + +asResolvedDependencies :: Parse PackageError [(PackageName, Version)] +asResolvedDependencies = + eachInObjectWithKey parsePackageName' asVersion + +parsePackageName' :: Text -> Either PackageError PackageName +parsePackageName' = + mapLeft ErrorInPackageMeta . (mapLeft BowerManifest . parsePackageName) + +mapLeft :: (a -> a') -> Either a b -> Either a' b +mapLeft f (Left x) = Left (f x) +mapLeft _ (Right x) = Right x + +asGithub :: Parse e (GithubUser, GithubRepo) +asGithub = (,) <$> nth 0 (GithubUser <$> asText) + <*> nth 1 (GithubRepo <$> asText) + +asSourceSpan :: Parse e P.SourceSpan +asSourceSpan = P.SourceSpan <$> key "name" asString + <*> key "start" asSourcePos + <*> key "end" asSourcePos + +--------------------- +-- ToJSON instances + +instance A.ToJSON a => A.ToJSON (Package a) where + toJSON Package{..} = + A.object $ + [ "packageMeta" .= pkgMeta + , "version" .= showVersion pkgVersion + , "versionTag" .= pkgVersionTag + , "modules" .= pkgModules + , "moduleMap" .= assocListToJSON (A.Key.fromText . P.runModuleName) + runPackageName + (Map.toList pkgModuleMap) + , "resolvedDependencies" .= assocListToJSON (A.Key.fromText . runPackageName) + (T.pack . showVersion) + pkgResolvedDependencies + , "github" .= pkgGithub + , "uploader" .= pkgUploader + , "compilerVersion" .= showVersion Paths.version + ] ++ + fmap (\t -> "tagTime" .= formatTime t) (maybeToList pkgTagTime) + +instance A.ToJSON NotYetKnown where + toJSON _ = A.Null + +instance A.ToJSON Module where + toJSON Module{..} = + A.object [ "name" .= P.runModuleName modName + , "comments" .= modComments + , "declarations" .= modDeclarations + , "reExports" .= map toObj modReExports + ] + where + toObj (mn, decls) = A.object [ "moduleName" .= mn + , "declarations" .= decls + ] + +instance A.ToJSON Declaration where + toJSON Declaration{..} = + A.object [ "title" .= declTitle + , "comments" .= declComments + , "sourceSpan" .= declSourceSpan + , "children" .= declChildren + , "info" .= declInfo + , "kind" .= declKind + ] + +instance A.ToJSON KindInfo where + toJSON KindInfo{..} = + A.object [ "keyword" .= kindSignatureForKeyword kiKeyword + , "kind" .= kiKind + ] + +kindSignatureForKeyword :: P.KindSignatureFor -> Text +kindSignatureForKeyword = \case + P.DataSig -> "data" + P.NewtypeSig -> "newtype" + P.TypeSynonymSig -> "type" + P.ClassSig -> "class" + +instance A.ToJSON ChildDeclaration where + toJSON ChildDeclaration{..} = + A.object [ "title" .= cdeclTitle + , "comments" .= cdeclComments + , "sourceSpan" .= cdeclSourceSpan + , "info" .= cdeclInfo + ] + +instance A.ToJSON DeclarationInfo where + toJSON info = A.object $ "declType" .= declInfoToString info : props + where + props = case info of + ValueDeclaration ty -> ["type" .= ty] + DataDeclaration ty args roles -> ["dataDeclType" .= ty, "typeArguments" .= args, "roles" .= roles] + ExternDataDeclaration kind roles -> ["kind" .= kind, "roles" .= roles] + TypeSynonymDeclaration args ty -> ["arguments" .= args, "type" .= ty] + TypeClassDeclaration args super fundeps -> ["arguments" .= args, "superclasses" .= super, "fundeps" .= fundeps] + AliasDeclaration fixity alias -> ["fixity" .= fixity, "alias" .= alias] + +instance A.ToJSON ChildDeclarationInfo where + toJSON info = A.object $ "declType" .= childDeclInfoToString info : props + where + props = case info of + ChildInstance deps ty -> ["dependencies" .= deps, "type" .= ty] + ChildDataConstructor args -> ["arguments" .= args] + ChildTypeClassMember ty -> ["type" .= ty] + +instance A.ToJSON GithubUser where + toJSON = A.toJSON . runGithubUser + +instance A.ToJSON GithubRepo where + toJSON = A.toJSON . runGithubRepo + +-- | Given a function for turning association list keys into JSON object keys, +-- and a function for turning association list values to JSON string values, +-- turns an association list into a JSON object. +-- +-- For example: +-- @assocListToJSON T.pack T.pack [("a", "b")]@ will give @{"a": "b"}@. +assocListToJSON :: (a -> A.Key) -> (b -> Text) -> [(a, b)] -> A.Value +assocListToJSON f g xs = A.object (map (uncurry (.=) . (f *** g)) xs) + +instance A.ToJSON a => A.ToJSON (InPackage a) where + toJSON x = + case x of + Local y -> withPackage (Nothing :: Maybe ()) y + FromDep pn y -> withPackage (Just pn) y + where + withPackage :: (A.ToJSON p, A.ToJSON x) => p -> x -> A.Value + withPackage p y = + A.object [ "package" .= p + , "item" .= y + ] diff --git a/src/Language/PureScript/CST/Docs/Utils/MonoidExtras.hs b/src/Language/PureScript/CST/Docs/Utils/MonoidExtras.hs new file mode 100644 index 000000000..3f3e231ed --- /dev/null +++ b/src/Language/PureScript/CST/Docs/Utils/MonoidExtras.hs @@ -0,0 +1,8 @@ +module Language.PureScript.Docs.Utils.MonoidExtras where + +import Data.Monoid (Monoid (..), (<>)) + +mintersperse :: (Monoid m) => m -> [m] -> m +mintersperse _ [] = mempty +mintersperse _ [x] = x +mintersperse sep (x : xs) = x <> sep <> mintersperse sep xs diff --git a/src/Language/PureScript/CST/Errors.hs b/src/Language/PureScript/CST/Errors.hs index 5cdea343e..e697dc068 100644 --- a/src/Language/PureScript/CST/Errors.hs +++ b/src/Language/PureScript/CST/Errors.hs @@ -1,21 +1,21 @@ -module Language.PureScript.CST.Errors - ( ParserErrorInfo(..) - , ParserErrorType(..) - , ParserWarningType(..) - , ParserError - , ParserWarning - , prettyPrintError - , prettyPrintErrorMessage - , prettyPrintWarningMessage - ) where +module Language.PureScript.CST.Errors ( + ParserErrorInfo (..), + ParserErrorType (..), + ParserWarningType (..), + ParserError, + ParserWarning, + prettyPrintError, + prettyPrintErrorMessage, + prettyPrintWarningMessage, +) where import Prelude -import Data.Text qualified as Text import Data.Char (isSpace, toUpper) +import Data.Text qualified as Text import Language.PureScript.CST.Layout (LayoutStack) import Language.PureScript.CST.Print (printToken) -import Language.PureScript.CST.Types (SourcePos(..), SourceRange(..), SourceToken(..), Token(..)) +import Language.PureScript.CST.Types (SourcePos (..), SourceRange (..), SourceToken (..), Token (..)) import Text.Printf (printf) data ParserErrorType @@ -71,18 +71,19 @@ data ParserErrorInfo a = ParserErrorInfo , errToks :: [SourceToken] , errStack :: LayoutStack , errType :: a - } deriving (Show, Eq) + } + deriving (Show, Eq) type ParserError = ParserErrorInfo ParserErrorType type ParserWarning = ParserErrorInfo ParserWarningType prettyPrintError :: ParserError -> String -prettyPrintError pe@ParserErrorInfo { errRange } = +prettyPrintError pe@ParserErrorInfo {errRange} = prettyPrintErrorMessage pe <> " at " <> errPos where - errPos = case errRange of - SourceRange (SourcePos line col) _ -> - "line " <> show line <> ", column " <> show col + errPos = case errRange of + SourceRange (SourcePos line col) _ -> + "line " <> show line <> ", column " <> show col prettyPrintErrorMessage :: ParserError -> String prettyPrintErrorMessage ParserErrorInfo {..} = case errType of @@ -126,8 +127,9 @@ prettyPrintErrorMessage ParserErrorInfo {..} = case errType of "Unexpected quoted label in record pun, perhaps due to a missing ':'" ErrEof -> "Unexpected end of input" - ErrLexeme (Just (hd : _)) _ | isSpace hd -> - "Illegal whitespace character " <> displayCodePoint hd + ErrLexeme (Just (hd : _)) _ + | isSpace hd -> + "Illegal whitespace character " <> displayCodePoint hd ErrLexeme (Just a) _ -> "Unexpected " <> a ErrLineFeedInString -> @@ -167,22 +169,21 @@ prettyPrintErrorMessage ParserErrorInfo {..} = case errType of basicError ErrCustom err -> err - where - basicError = case errToks of - tok : _ -> basicTokError (tokValue tok) - [] -> "Unexpected input" + basicError = case errToks of + tok : _ -> basicTokError (tokValue tok) + [] -> "Unexpected input" - basicTokError = \case - TokLayoutStart -> "Unexpected or mismatched indentation" - TokLayoutSep -> "Unexpected or mismatched indentation" - TokLayoutEnd -> "Unexpected or mismatched indentation" - TokEof -> "Unexpected end of input" - tok -> "Unexpected token '" <> Text.unpack (printToken tok) <> "'" + basicTokError = \case + TokLayoutStart -> "Unexpected or mismatched indentation" + TokLayoutSep -> "Unexpected or mismatched indentation" + TokLayoutEnd -> "Unexpected or mismatched indentation" + TokEof -> "Unexpected end of input" + tok -> "Unexpected token '" <> Text.unpack (printToken tok) <> "'" - displayCodePoint :: Char -> String - displayCodePoint x = - "U+" <> map toUpper (printf "%0.4x" (fromEnum x)) + displayCodePoint :: Char -> String + displayCodePoint x = + "U+" <> map toUpper (printf "%0.4x" (fromEnum x)) prettyPrintWarningMessage :: ParserWarning -> String prettyPrintWarningMessage ParserErrorInfo {..} = case errType of diff --git a/src/Language/PureScript/CST/Flatten.hs b/src/Language/PureScript/CST/Flatten.hs index 890614070..f41b06a77 100644 --- a/src/Language/PureScript/CST/Flatten.hs +++ b/src/Language/PureScript/CST/Flatten.hs @@ -3,18 +3,18 @@ module Language.PureScript.CST.Flatten where import Prelude import Data.DList (DList) -import Language.PureScript.CST.Types import Language.PureScript.CST.Positions (advanceLeading, moduleRange, srcRange) +import Language.PureScript.CST.Types flattenModule :: Module a -> DList SourceToken flattenModule m@(Module _ a b c d e f g) = - pure a <> - flattenName b <> - foldMap (flattenWrapped (flattenSeparated flattenExport)) c <> - pure d <> - foldMap flattenImportDecl e <> - foldMap flattenDeclaration f <> - pure (SourceToken (TokenAnn eofRange g []) TokEof) + pure a + <> flattenName b + <> foldMap (flattenWrapped (flattenSeparated flattenExport)) c + <> pure d + <> foldMap flattenImportDecl e + <> foldMap flattenDeclaration f + <> pure (SourceToken (TokenAnn eofRange g []) TokEof) where (_, endTkn) = moduleRange m eofPos = advanceLeading (srcEnd (srcRange endTkn)) g @@ -28,11 +28,11 @@ flattenDataCtor (DataCtor _ a b) = flattenName a <> foldMap flattenType b flattenClassHead :: ClassHead a -> DList SourceToken flattenClassHead (ClassHead a b c d e) = - pure a <> - foldMap (\(f, g) -> flattenOneOrDelimited flattenConstraint f <> pure g) b <> - flattenName c <> - foldMap flattenTypeVarBinding d <> - foldMap (\(f, g) -> pure f <> flattenSeparated flattenClassFundep g) e + pure a + <> foldMap (\(f, g) -> flattenOneOrDelimited flattenConstraint f <> pure g) b + <> flattenName c + <> foldMap flattenTypeVarBinding d + <> foldMap (\(f, g) -> pure f <> flattenSeparated flattenClassFundep g) e flattenClassFundep :: ClassFundep -> DList SourceToken flattenClassFundep = \case @@ -46,12 +46,13 @@ flattenInstance (Instance a b) = flattenInstanceHead a <> foldMap (\(c, d) -> pure c <> foldMap flattenInstanceBinding d) b flattenInstanceHead :: InstanceHead a -> DList SourceToken -flattenInstanceHead (InstanceHead a b c d e) = - pure a <> - foldMap (\(n, s) -> flattenName n <> pure s) b <> - foldMap (\(g, h) -> flattenOneOrDelimited flattenConstraint g <> pure h) c <> - flattenQualifiedName d <> - foldMap flattenType e +flattenInstanceHead (InstanceHead a b c d e f) = + pure a + <> foldMap (\(s, bs) -> pure s <> foldMap flattenTypeVarBinding bs) b + <> foldMap (\(n, s) -> flattenName n <> pure s) c + <> foldMap (\(g, h) -> flattenOneOrDelimited flattenConstraint g <> pure h) d + <> flattenQualifiedName e + <> foldMap flattenType f flattenInstanceBinding :: InstanceBinding a -> DList SourceToken flattenInstanceBinding = \case @@ -60,9 +61,9 @@ flattenInstanceBinding = \case flattenValueBindingFields :: ValueBindingFields a -> DList SourceToken flattenValueBindingFields (ValueBindingFields a b c) = - flattenName a <> - foldMap flattenBinder b <> - flattenGuarded c + flattenName a + <> foldMap flattenBinder b + <> flattenGuarded c flattenBinder :: Binder a -> DList SourceToken flattenBinder = \case @@ -74,7 +75,7 @@ flattenBinder = \case BinderChar _ a _ -> pure a BinderString _ a _ -> pure a BinderNumber _ a b _ -> foldMap pure a <> pure b - BinderArray _ a -> flattenWrapped (foldMap (flattenSeparated flattenBinder)) a + BinderList _ a -> flattenWrapped (foldMap (flattenSeparated flattenBinder)) a BinderRecord _ a -> flattenWrapped (foldMap (flattenSeparated (flattenRecordLabeled flattenBinder))) a BinderParens _ a -> flattenWrapped flattenBinder a @@ -106,10 +107,10 @@ flattenIfThenElse (IfThenElse a b c d e f) = flattenCaseOf :: CaseOf a -> DList SourceToken flattenCaseOf (CaseOf a b c d) = - pure a <> - flattenSeparated flattenExpr b <> - pure c <> - foldMap (\(e, f) -> flattenSeparated flattenBinder e <> flattenGuarded f) d + pure a + <> flattenSeparated flattenExpr b + <> pure c + <> foldMap (\(e, f) -> flattenSeparated flattenBinder e <> flattenGuarded f) d flattenLetIn :: LetIn a -> DList SourceToken flattenLetIn (LetIn a b c d) = @@ -139,7 +140,7 @@ flattenExpr = \case ExprChar _ a _ -> pure a ExprString _ a _ -> pure a ExprNumber _ a _ -> pure a - ExprArray _ a -> flattenWrapped (foldMap (flattenSeparated flattenExpr)) a + ExprList _ a -> flattenWrapped (foldMap (flattenSeparated flattenExpr)) a ExprRecord _ a -> flattenWrapped (foldMap (flattenSeparated (flattenRecordLabeled flattenExpr))) a ExprParens _ a -> flattenWrapped flattenExpr a @@ -151,7 +152,7 @@ flattenExpr = \case ExprRecordAccessor _ a -> flattenRecordAccessor a ExprRecordUpdate _ a b -> flattenExpr a <> flattenWrapped (flattenSeparated flattenRecordUpdate) b ExprApp _ a b -> flattenExpr a <> flattenExpr b - ExprVisibleTypeApp _ a b c -> flattenExpr a <> pure b <> flattenType c + ExprVisibleTypeApp _ a b c -> flattenExpr a <> pure b <> flattenType c ExprLambda _ a -> flattenLambda a ExprIf _ a -> flattenIfThenElse a ExprCase _ a -> flattenCaseOf a @@ -175,10 +176,10 @@ flattenPatternGuard (PatternGuard a b) = flattenGuardedExpr :: GuardedExpr a -> DList SourceToken flattenGuardedExpr (GuardedExpr a b c d) = - pure a <> - flattenSeparated flattenPatternGuard b <> - pure c <> - flattenWhere d + pure a + <> flattenSeparated flattenPatternGuard b + <> pure c + <> flattenWhere d flattenGuarded :: Guarded a -> DList SourceToken flattenGuarded = \case @@ -206,13 +207,13 @@ flattenRole = pure . roleTok flattenDeclaration :: Declaration a -> DList SourceToken flattenDeclaration = \case DeclData _ a b -> - flattenDataHead a <> - foldMap (\(t, cs) -> pure t <> flattenSeparated flattenDataCtor cs) b - DeclType _ a b c ->flattenDataHead a <> pure b <> flattenType c + flattenDataHead a + <> foldMap (\(t, cs) -> pure t <> flattenSeparated flattenDataCtor cs) b + DeclType _ a b c -> flattenDataHead a <> pure b <> flattenType c DeclNewtype _ a b c d -> flattenDataHead a <> pure b <> flattenName c <> flattenType d DeclClass _ a b -> - flattenClassHead a <> - foldMap (\(c, d) -> pure c <> foldMap (flattenLabeled flattenName flattenType) d) b + flattenClassHead a + <> foldMap (\(c, d) -> pure c <> foldMap (flattenLabeled flattenName flattenType) d) b DeclInstanceChain _ a -> flattenSeparated flattenInstance a DeclDerive _ a b c -> pure a <> foldMap pure b <> flattenInstanceHead c DeclKindSignature _ a b -> pure a <> flattenLabeled flattenName flattenType b @@ -247,11 +248,14 @@ flattenDataMembers = \case flattenImportDecl :: ImportDecl a -> DList SourceToken flattenImportDecl (ImportDecl _ a b c d) = - pure a <> - flattenName b <> - foldMap (\(mt, is) -> - foldMap pure mt <> flattenWrapped (flattenSeparated flattenImport) is) c <> - foldMap (\(t, n) -> pure t <> flattenName n) d + pure a + <> flattenName b + <> foldMap + ( \(mt, is) -> + foldMap pure mt <> flattenWrapped (flattenSeparated flattenImport) is + ) + c + <> foldMap (\(t, n) -> pure t <> flattenName n) d flattenImport :: Import a -> DList SourceToken flattenImport = \case @@ -267,8 +271,8 @@ flattenWrapped k (Wrapped a b c) = pure a <> k b <> pure c flattenSeparated :: (a -> DList SourceToken) -> Separated a -> DList SourceToken flattenSeparated k (Separated a b) = k a <> foldMap (\(c, d) -> pure c <> k d) b -flattenOneOrDelimited - :: (a -> DList SourceToken) -> OneOrDelimited a -> DList SourceToken +flattenOneOrDelimited :: + (a -> DList SourceToken) -> OneOrDelimited a -> DList SourceToken flattenOneOrDelimited f = \case One a -> f a Many a -> flattenWrapped (flattenSeparated f) a @@ -278,7 +282,7 @@ flattenLabeled ka kc (Labeled a b c) = ka a <> pure b <> kc c flattenType :: Type a -> DList SourceToken flattenType = \case - TypeVar _ a -> pure $ nameTok a + TypeVar _ a -> pure (nameTok a) TypeConstructor _ a -> pure $ qualTok a TypeWildcard _ a -> pure a TypeHole _ a -> pure $ nameTok a @@ -307,7 +311,7 @@ flattenTypeVarBinding = \case TypeVarKinded a -> flattenWrapped (flattenLabeled go flattenType) a TypeVarName a -> go a where - go (a, b) = maybe mempty pure a <> pure (nameTok b) + go (a, b) = maybe mempty pure a <> pure (nameTok b) flattenConstraint :: Constraint a -> DList SourceToken flattenConstraint = \case diff --git a/src/Language/PureScript/CST/Layout.hs b/src/Language/PureScript/CST/Layout.hs index 989cf1563..0b0196b42 100644 --- a/src/Language/PureScript/CST/Layout.hs +++ b/src/Language/PureScript/CST/Layout.hs @@ -1,171 +1,171 @@ --- | --- ## High-Level Summary --- --- This section provides a high-level summary of this file. For those who --- know more about compiler-development, the below explanation is likely enough. --- For everyone else, see the next section. --- --- The parser itself is unaware of indentation, and instead only parses explicit --- delimiters which are inserted by this layout algorithm (much like Haskell). --- This is convenient because the actual grammar can be specified apart from the --- indentation rules. Haskell has a few problematic productions which make it --- impossible to implement a purely lexical layout algorithm, so it also has an --- additional (and somewhat contentious) parser error side condition. PureScript --- does not have these problematic productions (particularly foo, bar :: --- SomeType syntax in declarations), but it does have a few gotchas of it's own. --- The algorithm is "non-trivial" to say the least, but it is implemented as a --- purely lexical delimiter parser on a token-by-token basis, which is highly --- convenient, since it can be replicated in any language or toolchain. There is --- likely room to simplify it, but there are some seemingly innocuous things --- that complicate it. --- --- "Naked" commas (case, patterns, guards, fundeps) are a constant source of --- complexity, and indeed too much of this is what prevents Haskell from having --- such an algorithm. Unquoted properties for layout keywords introduce a domino --- effect of complexity since we have to mask and unmask any usage of . (also in --- foralls!) or labels in record literals. --- --- ## Detailed Summary --- --- ### The Problem --- --- The parser itself is unaware of indentation or other such layout concerns. --- Rather than dealing with it explicitly, the parser and its --- grammar rules are only aware of normal tokens (e.g. @TokLowerName@) and --- three special zero-width tokens, @TokLayoutStart@, @TokLayoutSep@, --- and @TokLayoutEnd@. This is convenient because the actual grammar --- can be specified apart from the indentation rules and other such --- layout concerns. --- --- For a simple example, the parser parses all three examples of the code below --- using the exact same grammar rules for the @let@ keyword despite --- each example using different indentations levels: --- --- @ --- -- Example 1 --- let foo = 5 --- x = 2 in foo --- --- -- Example 2 --- let --- bar = 5 --- y = 2 --- in bar --- --- -- Example 3 --- let baz --- = --- 5 --- z= 2 in baz --- @ --- --- Each block of code might appear to the parser as a stream of the --- following source tokens where the @\{@ sequence represents --- @TokLayoutStart@, the @\;@ sequence represents @TokLayoutSep@, --- and the @\}@ sequence represents @TokLayoutEnd@: --- - @let \{foo = 5\;x = 2\} in foo@ --- - @let \{bar = 5\;y = 2\} in bar@ --- - @let \{baz = 5\;z = 2\} in baz@ --- --- --- For a more complex example, consider commas: --- --- @ --- case one, { twoA, twoB }, [ three1 --- , three2 --- , do --- { three3, three4 } <- case arg1, arg2 of --- Nothing, _ -> { three3: 1, three4: 2 } --- Just _, Nothing -> { three3: 2, three4: 3 } --- _, _ -> { three3: 3, three4: 4 } --- pure $ three3 + three4 --- ] of --- @ --- --- Which of the above 13 commas function as the separators between the --- case binders (e.g. @one@) in the outermost @case ... of@ context? --- --- ### The Solution --- --- The parser doesn't have to care about layout concerns (e.g. indentation --- or what starts and ends a context, such as a case binder) because the --- lexer solves that problem instead. --- --- So, how does the lexer solve this problem? It follows this general algorithm: --- 1. Lex the source code text into an initial stream of `SourceToken`s --- that do not have any of the three special tokens mentioned previously. --- 2. On a token-by-token basis, determine whether the lexer should --- 1. insert one of the three special tokens, --- 2. modify the current context (e.g. are we within a case binder? --- Are we in a record expression?) --- --- Step 2 is handled via 'insertLayout' and is essentially a state machine. --- The layout delimiters, (e.g. 'LytCase', 'LytBrace', 'LytProperty', --- and 'LytOf' in the next section's example) either stop certain "rules" --- from applying or ensure that certain "rules" now apply. By "rules", --- we mean whether and where one of the three special tokens are added. --- The comments in the source code for the 'insertLayout' algorithm call --- pushing these delimiters onto the stack "masking" and popping them off --- as "unmasking". Seeing when a layout delimiter is pushed and popped --- are the keys to understanding this algorithm. --- --- ### Walking Through an Example --- --- Before showing an example, let's remember a few things. --- 1. The @TokLowerName "case"@ token (i.e. a "case" keyword) indicates the start --- of a @case ... of@ context. That context includes case binders (like the --- example shown previously) that can get quite complex. When encountered, --- we may need to insert one or more of the three special tokens here --- until we encounter the terminating @TokLowerName "of"@ token that --- signifies its end. --- 2. "case" and "of" can also appear as a record field's name. In such a context, --- they would not start or end a @case ... of@ block. --- --- Given the below source code... --- --- @ --- case { case: "foo", of: "bar" } of --- @ --- --- the lexer would go through something like the following states: --- 1. Encountered @TokLowerName "case"@. Update current context to --- "within a case of expression" by pushing the 'LytCase' delimiter --- onto the layout delimiter stack. Insert the @case@ token --- into the stream of source tokens. --- 2. Encountered @TokLeftBrace@. Update current context to --- "within a record expression" by pushing the 'LytBrace' delimiter. --- Since we expect a field name to be the next token we see, --- which may include a reserved keyword, update the current context again to --- "expecting a field name" by pushing the `LytProperty`. --- delimiter. Insert the @{@ token into the stream of source tokens. --- 3. Encountered @TokLowerName "case"@. Check the current context. --- Since it's a `LytProperty`, this is a field name and we shouldn't --- assume that the next few tokens will be case binders. However, --- since this might be a record with no more fields, update the --- current context back to "within a record expression" by popping --- the `LytProperty` off the layout delimiter stack. Insert the @case@ token --- 4. Encountered @TokColon@. Insert the @:@ token --- 5. Encountered @TokLowerName "foo"@. Insert the @foo@ token. --- 6. Encountered @TokComma@. Check the current context. Since it's a `LytBrace`, --- we're in a record expression and there is another field. Update the --- current context by pushing `LytProperty` as we expect a field name again. --- 7. Encountered @TokLowerName "of"@. Check the current context. --- Since it's a `LytProperty`, this is a field name rather --- than the end of a case binder. Thus, we don't expect the next tokens --- to be the @body@ in a @case ... of body@ expression. However, since --- this might be a record with no more fields, update the current context --- back to "within a record expression" by popping the `LytProperty` --- off the stack. Insert the @of@ token. --- 8. Encountered @TokRightBrace@. Check the current context. --- Since it's a `LytBrace`, this is the end of a record expression. --- Update the current context to "within a case of expression" --- by popping the `LytBrace` off the stack. Insert the @}@ token. --- 9. Encountered @TokLowername "of"@. Check the current context. --- Since it's a 'LytCase', this is the end of a @case ... of@ expression --- and the body will follow. Update the current context to --- "body of a case of expression" by pushing 'LytOf' onto the layout stack. --- Insert the @of@ token into the stream of tokens. --- +{- | +## High-Level Summary + +This section provides a high-level summary of this file. For those who +know more about compiler-development, the below explanation is likely enough. +For everyone else, see the next section. + +The parser itself is unaware of indentation, and instead only parses explicit +delimiters which are inserted by this layout algorithm (much like Haskell). +This is convenient because the actual grammar can be specified apart from the +indentation rules. Haskell has a few problematic productions which make it +impossible to implement a purely lexical layout algorithm, so it also has an +additional (and somewhat contentious) parser error side condition. PureScript +does not have these problematic productions (particularly foo, bar :: +SomeType syntax in declarations), but it does have a few gotchas of it's own. +The algorithm is "non-trivial" to say the least, but it is implemented as a +purely lexical delimiter parser on a token-by-token basis, which is highly +convenient, since it can be replicated in any language or toolchain. There is +likely room to simplify it, but there are some seemingly innocuous things +that complicate it. + +"Naked" commas (case, patterns, guards, fundeps) are a constant source of +complexity, and indeed too much of this is what prevents Haskell from having +such an algorithm. Unquoted properties for layout keywords introduce a domino +effect of complexity since we have to mask and unmask any usage of . (also in +foralls!) or labels in record literals. + +## Detailed Summary + +### The Problem + +The parser itself is unaware of indentation or other such layout concerns. +Rather than dealing with it explicitly, the parser and its +grammar rules are only aware of normal tokens (e.g. @TokLowerName@) and +three special zero-width tokens, @TokLayoutStart@, @TokLayoutSep@, +and @TokLayoutEnd@. This is convenient because the actual grammar +can be specified apart from the indentation rules and other such +layout concerns. + +For a simple example, the parser parses all three examples of the code below +using the exact same grammar rules for the @let@ keyword despite +each example using different indentations levels: + +@ +-- Example 1 +let foo = 5 + x = 2 in foo + +-- Example 2 +let + bar = 5 + y = 2 +in bar + +-- Example 3 +let baz + = + 5 + z= 2 in baz +@ + +Each block of code might appear to the parser as a stream of the +following source tokens where the @\{@ sequence represents +@TokLayoutStart@, the @\;@ sequence represents @TokLayoutSep@, +and the @\}@ sequence represents @TokLayoutEnd@: +- @let \{foo = 5\;x = 2\} in foo@ +- @let \{bar = 5\;y = 2\} in bar@ +- @let \{baz = 5\;z = 2\} in baz@ + + +For a more complex example, consider commas: + +@ +case one, { twoA, twoB }, [ three1 + , three2 + , do + { three3, three4 } <- case arg1, arg2 of + Nothing, _ -> { three3: 1, three4: 2 } + Just _, Nothing -> { three3: 2, three4: 3 } + _, _ -> { three3: 3, three4: 4 } + pure $ three3 + three4 + ] of +@ + +Which of the above 13 commas function as the separators between the +case binders (e.g. @one@) in the outermost @case ... of@ context? + +### The Solution + +The parser doesn't have to care about layout concerns (e.g. indentation +or what starts and ends a context, such as a case binder) because the +lexer solves that problem instead. + +So, how does the lexer solve this problem? It follows this general algorithm: +1. Lex the source code text into an initial stream of `SourceToken`s + that do not have any of the three special tokens mentioned previously. +2. On a token-by-token basis, determine whether the lexer should + 1. insert one of the three special tokens, + 2. modify the current context (e.g. are we within a case binder? + Are we in a record expression?) + +Step 2 is handled via 'insertLayout' and is essentially a state machine. +The layout delimiters, (e.g. 'LytCase', 'LytBrace', 'LytProperty', +and 'LytOf' in the next section's example) either stop certain "rules" +from applying or ensure that certain "rules" now apply. By "rules", +we mean whether and where one of the three special tokens are added. +The comments in the source code for the 'insertLayout' algorithm call +pushing these delimiters onto the stack "masking" and popping them off +as "unmasking". Seeing when a layout delimiter is pushed and popped +are the keys to understanding this algorithm. + +### Walking Through an Example + +Before showing an example, let's remember a few things. + 1. The @TokLowerName "case"@ token (i.e. a "case" keyword) indicates the start + of a @case ... of@ context. That context includes case binders (like the + example shown previously) that can get quite complex. When encountered, + we may need to insert one or more of the three special tokens here + until we encounter the terminating @TokLowerName "of"@ token that + signifies its end. + 2. "case" and "of" can also appear as a record field's name. In such a context, + they would not start or end a @case ... of@ block. + +Given the below source code... + +@ +case { case: "foo", of: "bar" } of +@ + +the lexer would go through something like the following states: +1. Encountered @TokLowerName "case"@. Update current context to + "within a case of expression" by pushing the 'LytCase' delimiter + onto the layout delimiter stack. Insert the @case@ token + into the stream of source tokens. +2. Encountered @TokLeftBrace@. Update current context to + "within a record expression" by pushing the 'LytBrace' delimiter. + Since we expect a field name to be the next token we see, + which may include a reserved keyword, update the current context again to + "expecting a field name" by pushing the `LytProperty`. + delimiter. Insert the @{@ token into the stream of source tokens. +3. Encountered @TokLowerName "case"@. Check the current context. + Since it's a `LytProperty`, this is a field name and we shouldn't + assume that the next few tokens will be case binders. However, + since this might be a record with no more fields, update the + current context back to "within a record expression" by popping + the `LytProperty` off the layout delimiter stack. Insert the @case@ token +4. Encountered @TokColon@. Insert the @:@ token +5. Encountered @TokLowerName "foo"@. Insert the @foo@ token. +6. Encountered @TokComma@. Check the current context. Since it's a `LytBrace`, + we're in a record expression and there is another field. Update the + current context by pushing `LytProperty` as we expect a field name again. +7. Encountered @TokLowerName "of"@. Check the current context. + Since it's a `LytProperty`, this is a field name rather + than the end of a case binder. Thus, we don't expect the next tokens + to be the @body@ in a @case ... of body@ expression. However, since + this might be a record with no more fields, update the current context + back to "within a record expression" by popping the `LytProperty` + off the stack. Insert the @of@ token. +8. Encountered @TokRightBrace@. Check the current context. + Since it's a `LytBrace`, this is the end of a record expression. + Update the current context to "within a case of expression" + by popping the `LytBrace` off the stack. Insert the @}@ token. +9. Encountered @TokLowername "of"@. Check the current context. + Since it's a 'LytCase', this is the end of a @case ... of@ expression + and the body will follow. Update the current context to + "body of a case of expression" by pushing 'LytOf' onto the layout stack. + Insert the @of@ token into the stream of tokens. +-} module Language.PureScript.CST.Layout where import Prelude @@ -174,7 +174,7 @@ import Data.DList (snoc) import Data.DList qualified as DList import Data.Foldable (find) import Data.Function ((&)) -import Language.PureScript.CST.Types (Comment, LineFeed, SourcePos(..), SourceRange(..), SourceToken(..), Token(..), TokenAnn(..)) +import Language.PureScript.CST.Types (Comment, LineFeed, SourcePos (..), SourceRange (..), SourceToken (..), Token (..), TokenAnn (..)) type LayoutStack = [(SourcePos, LayoutDelim)] @@ -205,13 +205,13 @@ data LayoutDelim isIndented :: LayoutDelim -> Bool isIndented = \case - LytLet -> True + LytLet -> True LytLetStmt -> True - LytWhere -> True - LytOf -> True - LytDo -> True - LytAdo -> True - _ -> False + LytWhere -> True + LytOf -> True + LytDo -> True + LytAdo -> True + _ -> False isTopDecl :: SourcePos -> LayoutStack -> Bool isTopDecl tokPos = \case @@ -222,328 +222,310 @@ isTopDecl tokPos = \case lytToken :: SourcePos -> Token -> SourceToken lytToken pos = SourceToken ann where - ann = TokenAnn - { tokRange = SourceRange pos pos - , tokLeadingComments = [] - , tokTrailingComments = [] - } + ann = + TokenAnn + { tokRange = SourceRange pos pos + , tokLeadingComments = [] + , tokTrailingComments = [] + } insertLayout :: SourceToken -> SourcePos -> LayoutStack -> (LayoutStack, [SourceToken]) insertLayout src@(SourceToken tokAnn tok) nextPos stack = DList.toList <$> insert (stack, mempty) where - tokPos = - srcStart $ tokRange tokAnn + tokPos = + srcStart $ tokRange tokAnn + + insert state@(stk, acc) = case tok of + -- `data` declarations need masking (LytTopDecl) because the usage of `|` + -- should not introduce a LytDeclGard context. + TokLowerName [] "data" -> + case state & insertDefault of + state'@(stk', _) + | isTopDecl tokPos stk' -> + state' & pushStack tokPos LytTopDecl + state' -> + state' & popStack (== LytProperty) + -- `class` declaration heads need masking (LytTopDeclHead) because the + -- usage of commas in functional dependencies. + TokLowerName [] "class" -> + case state & insertDefault of + state'@(stk', _) + | isTopDecl tokPos stk' -> + state' & pushStack tokPos LytTopDeclHead + state' -> + state' & popStack (== LytProperty) + TokLowerName [] "where" -> + case stk of + (_, LytTopDeclHead) : stk' -> + (stk', acc) & insertToken src & insertStart LytWhere + (_, LytProperty) : stk' -> + (stk', acc) & insertToken src + _ -> + state & collapse whereP & insertToken src & insertStart LytWhere + where + -- `where` always closes do blocks: + -- example = do do do do foo where foo = ... + -- + -- `where` closes layout contexts even when indented at the same level: + -- example = case + -- Foo -> ... + -- Bar -> ... + -- where foo = ... + whereP _ LytDo = True + whereP lytPos lyt = offsideEndP lytPos lyt + TokLowerName [] "in" -> + case collapse inP state of + -- `let/in` is not allowed in `ado` syntax. `in` is treated as a + -- delimiter and must always close the `ado`. + -- example = ado + -- foo <- ... + -- let bar = ... + -- in ... + ((_, LytLetStmt) : (_, LytAdo) : stk', acc') -> + (stk', acc') & insertEnd & insertEnd & insertToken src + ((_, lyt) : stk', acc') + | isIndented lyt -> + (stk', acc') & insertEnd & insertToken src + _ -> + state & insertDefault & popStack (== LytProperty) + where + inP _ LytLet = False + inP _ LytAdo = False + inP _ lyt = isIndented lyt + TokLowerName [] "let" -> + state & insertKwProperty next + where + next state'@(stk', _) = case stk' of + (p, LytDo) : _ + | srcColumn p == srcColumn tokPos -> + state' & insertStart LytLetStmt + (p, LytAdo) : _ + | srcColumn p == srcColumn tokPos -> + state' & insertStart LytLetStmt + _ -> + state' & insertStart LytLet + TokLowerName _ "do" -> + state & insertKwProperty (insertStart LytDo) + TokLowerName _ "ado" -> + state & insertKwProperty (insertStart LytAdo) + -- `case` heads need masking due to commas. + TokLowerName [] "case" -> + state & insertKwProperty (pushStack tokPos LytCase) + TokLowerName [] "of" -> + case collapse indentedP state of + -- When `of` is matched with a `case`, we are in a case block, and we + -- need to mask additional contexts (LytCaseBinders, LytCaseGuards) + -- due to commas. + ((_, LytCase) : stk', acc') -> + (stk', acc') & insertToken src & insertStart LytOf & pushStack nextPos LytCaseBinders + state' -> + state' & insertDefault & popStack (== LytProperty) + -- `if/then/else` is considered a delimiter context. This allows us to + -- write chained expressions in `do` blocks without stair-stepping: + -- example = do + -- foo + -- if ... then + -- ... + -- else if ... then + -- ... + -- else + -- ... + TokLowerName [] "if" -> + state & insertKwProperty (pushStack tokPos LytIf) + TokLowerName [] "then" -> + case state & collapse indentedP of + ((_, LytIf) : stk', acc') -> + (stk', acc') & insertToken src & pushStack tokPos LytThen + _ -> + state & insertDefault & popStack (== LytProperty) + TokLowerName [] "else" -> + case state & collapse indentedP of + ((_, LytThen) : stk', acc') -> + (stk', acc') & insertToken src + _ -> + -- We don't want to insert a layout separator for top-level `else` in + -- instance chains. + case state & collapse offsideP of + state'@(stk', _) + | isTopDecl tokPos stk' -> + state' & insertToken src + state' -> + state' & insertSep & insertToken src & popStack (== LytProperty) + -- `forall` binders need masking because the usage of `.` should not + -- introduce a LytProperty context. + TokForall _ -> + state & insertKwProperty (pushStack tokPos LytForall) + -- Lambdas need masking because the usage of `->` should not close a + -- LytDeclGuard or LytCaseGuard context. + TokBackslash -> + state & insertDefault & pushStack tokPos LytLambdaBinders + TokRightArrow _ -> + state & collapse arrowP & popStack guardP & insertToken src + where + arrowP _ LytDo = True + arrowP _ LytOf = False + arrowP lytPos lyt = offsideEndP lytPos lyt + + guardP LytCaseBinders = True + guardP LytCaseGuard = True + guardP LytLambdaBinders = True + guardP _ = False + TokEquals -> + case state & collapse equalsP of + ((_, LytDeclGuard) : stk', acc') -> + (stk', acc') & insertToken src + _ -> + state & insertDefault + where + equalsP _ LytWhere = True + equalsP _ LytLet = True + equalsP _ LytLetStmt = True + equalsP _ _ = False + + -- Guards need masking because of commas. + TokPipe -> + case collapse offsideEndP state of + state'@((_, LytOf) : _, _) -> + state' & pushStack tokPos LytCaseGuard & insertToken src + state'@((_, LytLet) : _, _) -> + state' & pushStack tokPos LytDeclGuard & insertToken src + state'@((_, LytLetStmt) : _, _) -> + state' & pushStack tokPos LytDeclGuard & insertToken src + state'@((_, LytWhere) : _, _) -> + state' & pushStack tokPos LytDeclGuard & insertToken src + _ -> + state & insertDefault + -- Ticks can either start or end an infix expression. We preemptively + -- collapse all indentation contexts in search of a starting delimiter, + -- and backtrack if we don't find one. + TokTick -> + case state & collapse indentedP of + ((_, LytTick) : stk', acc') -> + (stk', acc') & insertToken src + _ -> + state & collapse offsideEndP & insertSep & insertToken src & pushStack tokPos LytTick + -- In general, commas should close all indented contexts. + -- example = [ do foo + -- bar, baz ] + TokComma -> + case state & collapse indentedP of + -- If we see a LytBrace, then we are in a record type or literal. + -- Record labels need masking so we can use unquoted keywords as labels + -- without accidentally littering layout delimiters. + state'@((_, LytBrace) : _, _) -> + state' & insertToken src & pushStack tokPos LytProperty + state' -> + state' & insertToken src + -- TokDot tokens usually entail property access, which need masking so we + -- can use unquoted keywords as labels. + TokDot -> + case state & insertDefault of + ((_, LytForall) : stk', acc') -> + (stk', acc') + state' -> + state' & pushStack tokPos LytProperty + TokLeftParen -> + state & insertDefault & pushStack tokPos LytParen + TokLeftBrace -> + state & insertDefault & pushStack tokPos LytBrace & pushStack tokPos LytProperty + TokLeftSquare -> + state & insertDefault & pushStack tokPos LytSquare + TokRightParen -> + state & collapse indentedP & popStack (== LytParen) & insertToken src + TokRightBrace -> + state & collapse indentedP & popStack (== LytProperty) & popStack (== LytBrace) & insertToken src + TokRightSquare -> + state & collapse indentedP & popStack (== LytSquare) & insertToken src + TokString _ _ -> + state & insertDefault & popStack (== LytProperty) + TokLowerName [] _ -> + state & insertDefault & popStack (== LytProperty) + TokOperator _ _ -> + state & collapse offsideEndP & insertSep & insertToken src + _ -> + state & insertDefault + + insertDefault state = + state & collapse offsideP & insertSep & insertToken src + + insertStart lyt state@(stk, _) = + -- We only insert a new layout start when it's going to increase indentation. + -- This prevents things like the following from parsing: + -- instance foo :: Foo where + -- foo = 42 + case find (isIndented . snd) stk of + Just (pos, _) | srcColumn nextPos <= srcColumn pos -> state + _ -> state & pushStack nextPos lyt & insertToken (lytToken nextPos TokLayoutStart) + + insertSep state@(stk, acc) = case stk of + -- LytTopDecl is closed by a separator. + (lytPos, LytTopDecl) : stk' + | sepP lytPos -> + (stk', acc) & insertToken sepTok + -- LytTopDeclHead can be closed by a separator if there is no `where`. + (lytPos, LytTopDeclHead) : stk' + | sepP lytPos -> + (stk', acc) & insertToken sepTok + (lytPos, lyt) : _ | indentSepP lytPos lyt -> + case lyt of + -- If a separator is inserted in a case block, we need to push an + -- additional LytCaseBinders context for comma masking. + LytOf -> state & insertToken sepTok & pushStack tokPos LytCaseBinders + _ -> state & insertToken sepTok + _ -> state + where + sepTok = lytToken tokPos TokLayoutSep - insert state@(stk, acc) = case tok of - -- `data` declarations need masking (LytTopDecl) because the usage of `|` - -- should not introduce a LytDeclGard context. - TokLowerName [] "data" -> + insertKwProperty k state = case state & insertDefault of - state'@(stk', _) | isTopDecl tokPos stk' -> - state' & pushStack tokPos LytTopDecl + ((_, LytProperty) : stk', acc') -> + (stk', acc') state' -> - state' & popStack (== LytProperty) + k state' - -- `class` declaration heads need masking (LytTopDeclHead) because the - -- usage of commas in functional dependencies. - TokLowerName [] "class" -> - case state & insertDefault of - state'@(stk', _) | isTopDecl tokPos stk' -> - state' & pushStack tokPos LytTopDeclHead - state' -> - state' & popStack (== LytProperty) - - TokLowerName [] "where" -> - case stk of - (_, LytTopDeclHead) : stk' -> - (stk', acc) & insertToken src & insertStart LytWhere - (_, LytProperty) : stk' -> - (stk', acc) & insertToken src - _ -> - state & collapse whereP & insertToken src & insertStart LytWhere - where - -- `where` always closes do blocks: - -- example = do do do do foo where foo = ... - -- - -- `where` closes layout contexts even when indented at the same level: - -- example = case - -- Foo -> ... - -- Bar -> ... - -- where foo = ... - whereP _ LytDo = True - whereP lytPos lyt = offsideEndP lytPos lyt - - TokLowerName [] "in" -> - case collapse inP state of - -- `let/in` is not allowed in `ado` syntax. `in` is treated as a - -- delimiter and must always close the `ado`. - -- example = ado - -- foo <- ... - -- let bar = ... - -- in ... - ((_, LytLetStmt) : (_, LytAdo) : stk', acc') -> - (stk', acc') & insertEnd & insertEnd & insertToken src - ((_, lyt) : stk', acc') | isIndented lyt -> - (stk', acc') & insertEnd & insertToken src - _ -> - state & insertDefault & popStack (== LytProperty) - where - inP _ LytLet = False - inP _ LytAdo = False - inP _ lyt = isIndented lyt + insertEnd = + insertToken (lytToken tokPos TokLayoutEnd) - TokLowerName [] "let" -> - state & insertKwProperty next - where - next state'@(stk', _) = case stk' of - (p, LytDo) : _ | srcColumn p == srcColumn tokPos -> - state' & insertStart LytLetStmt - (p, LytAdo) : _ | srcColumn p == srcColumn tokPos -> - state' & insertStart LytLetStmt - _ -> - state' & insertStart LytLet - - TokLowerName _ "do" -> - state & insertKwProperty (insertStart LytDo) - - TokLowerName _ "ado" -> - state & insertKwProperty (insertStart LytAdo) - - -- `case` heads need masking due to commas. - TokLowerName [] "case" -> - state & insertKwProperty (pushStack tokPos LytCase) - - TokLowerName [] "of" -> - case collapse indentedP state of - -- When `of` is matched with a `case`, we are in a case block, and we - -- need to mask additional contexts (LytCaseBinders, LytCaseGuards) - -- due to commas. - ((_, LytCase) : stk', acc') -> - (stk', acc') & insertToken src & insertStart LytOf & pushStack nextPos LytCaseBinders - state' -> - state' & insertDefault & popStack (== LytProperty) - - -- `if/then/else` is considered a delimiter context. This allows us to - -- write chained expressions in `do` blocks without stair-stepping: - -- example = do - -- foo - -- if ... then - -- ... - -- else if ... then - -- ... - -- else - -- ... - TokLowerName [] "if" -> - state & insertKwProperty (pushStack tokPos LytIf) - - TokLowerName [] "then" -> - case state & collapse indentedP of - ((_, LytIf) : stk', acc') -> - (stk', acc') & insertToken src & pushStack tokPos LytThen - _ -> - state & insertDefault & popStack (== LytProperty) - - TokLowerName [] "else" -> - case state & collapse indentedP of - ((_, LytThen) : stk', acc') -> - (stk', acc') & insertToken src - _ -> - -- We don't want to insert a layout separator for top-level `else` in - -- instance chains. - case state & collapse offsideP of - state'@(stk', _) | isTopDecl tokPos stk' -> - state' & insertToken src - state' -> - state' & insertSep & insertToken src & popStack (== LytProperty) - - -- `forall` binders need masking because the usage of `.` should not - -- introduce a LytProperty context. - TokForall _ -> - state & insertKwProperty (pushStack tokPos LytForall) - - -- Lambdas need masking because the usage of `->` should not close a - -- LytDeclGuard or LytCaseGuard context. - TokBackslash -> - state & insertDefault & pushStack tokPos LytLambdaBinders - - TokRightArrow _ -> - state & collapse arrowP & popStack guardP & insertToken src - where - arrowP _ LytDo = True - arrowP _ LytOf = False - arrowP lytPos lyt = offsideEndP lytPos lyt - - guardP LytCaseBinders = True - guardP LytCaseGuard = True - guardP LytLambdaBinders = True - guardP _ = False - - TokEquals -> - case state & collapse equalsP of - ((_, LytDeclGuard) : stk', acc') -> - (stk', acc') & insertToken src - _ -> - state & insertDefault + insertToken token (stk, acc) = + (stk, acc `snoc` token) + + pushStack lytPos lyt (stk, acc) = + ((lytPos, lyt) : stk, acc) + + popStack p ((_, lyt) : stk', acc) + | p lyt = (stk', acc) + popStack _ state = state + + collapse p = uncurry go where - equalsP _ LytWhere = True - equalsP _ LytLet = True - equalsP _ LytLetStmt = True - equalsP _ _ = False - - -- Guards need masking because of commas. - TokPipe -> - case collapse offsideEndP state of - state'@((_, LytOf) : _, _) -> - state' & pushStack tokPos LytCaseGuard & insertToken src - state'@((_, LytLet) : _, _) -> - state' & pushStack tokPos LytDeclGuard & insertToken src - state'@((_, LytLetStmt) : _, _) -> - state' & pushStack tokPos LytDeclGuard & insertToken src - state'@((_, LytWhere) : _, _) -> - state' & pushStack tokPos LytDeclGuard & insertToken src - _ -> - state & insertDefault - - -- Ticks can either start or end an infix expression. We preemptively - -- collapse all indentation contexts in search of a starting delimiter, - -- and backtrack if we don't find one. - TokTick -> - case state & collapse indentedP of - ((_, LytTick) : stk', acc') -> - (stk', acc') & insertToken src - _ -> - state & collapse offsideEndP & insertSep & insertToken src & pushStack tokPos LytTick - - -- In general, commas should close all indented contexts. - -- example = [ do foo - -- bar, baz ] - TokComma -> - case state & collapse indentedP of - -- If we see a LytBrace, then we are in a record type or literal. - -- Record labels need masking so we can use unquoted keywords as labels - -- without accidentally littering layout delimiters. - state'@((_, LytBrace) : _, _) -> - state' & insertToken src & pushStack tokPos LytProperty - state' -> - state' & insertToken src + go ((lytPos, lyt) : stk) acc + | p lytPos lyt = + go stk $ + if isIndented lyt + then acc `snoc` lytToken tokPos TokLayoutEnd + else acc + go stk acc = (stk, acc) - -- TokDot tokens usually entail property access, which need masking so we - -- can use unquoted keywords as labels. - TokDot -> - case state & insertDefault of - ((_, LytForall) : stk', acc') -> - (stk', acc') - state' -> - state' & pushStack tokPos LytProperty - - TokLeftParen -> - state & insertDefault & pushStack tokPos LytParen - - TokLeftBrace -> - state & insertDefault & pushStack tokPos LytBrace & pushStack tokPos LytProperty - - TokLeftSquare -> - state & insertDefault & pushStack tokPos LytSquare - - TokRightParen -> - state & collapse indentedP & popStack (== LytParen) & insertToken src - - TokRightBrace -> - state & collapse indentedP & popStack (== LytProperty) & popStack (== LytBrace) & insertToken src - - TokRightSquare -> - state & collapse indentedP & popStack (== LytSquare) & insertToken src - - TokString _ _ -> - state & insertDefault & popStack (== LytProperty) - - TokLowerName [] _ -> - state & insertDefault & popStack (== LytProperty) - - TokOperator _ _ -> - state & collapse offsideEndP & insertSep & insertToken src - - _ -> - state & insertDefault - - insertDefault state = - state & collapse offsideP & insertSep & insertToken src - - insertStart lyt state@(stk, _) = - -- We only insert a new layout start when it's going to increase indentation. - -- This prevents things like the following from parsing: - -- instance foo :: Foo where - -- foo = 42 - case find (isIndented . snd) stk of - Just (pos, _) | srcColumn nextPos <= srcColumn pos -> state - _ -> state & pushStack nextPos lyt & insertToken (lytToken nextPos TokLayoutStart) - - insertSep state@(stk, acc) = case stk of - -- LytTopDecl is closed by a separator. - (lytPos, LytTopDecl) : stk' | sepP lytPos -> - (stk', acc) & insertToken sepTok - -- LytTopDeclHead can be closed by a separator if there is no `where`. - (lytPos, LytTopDeclHead) : stk' | sepP lytPos -> - (stk', acc) & insertToken sepTok - (lytPos, lyt) : _ | indentSepP lytPos lyt -> - case lyt of - -- If a separator is inserted in a case block, we need to push an - -- additional LytCaseBinders context for comma masking. - LytOf -> state & insertToken sepTok & pushStack tokPos LytCaseBinders - _ -> state & insertToken sepTok - _ -> state - where - sepTok = lytToken tokPos TokLayoutSep - - insertKwProperty k state = - case state & insertDefault of - ((_, LytProperty) : stk', acc') -> - (stk', acc') - state' -> - k state' - - insertEnd = - insertToken (lytToken tokPos TokLayoutEnd) - - insertToken token (stk, acc) = - (stk, acc `snoc` token) - - pushStack lytPos lyt (stk, acc) = - ((lytPos, lyt) : stk, acc) - - popStack p ((_, lyt) : stk', acc) - | p lyt = (stk', acc) - popStack _ state = state - - collapse p = uncurry go - where - go ((lytPos, lyt) : stk) acc - | p lytPos lyt = - go stk $ if isIndented lyt - then acc `snoc` lytToken tokPos TokLayoutEnd - else acc - go stk acc = (stk, acc) - - indentedP = - const isIndented - - offsideP lytPos lyt = - isIndented lyt && srcColumn tokPos < srcColumn lytPos - - offsideEndP lytPos lyt = - isIndented lyt && srcColumn tokPos <= srcColumn lytPos - - indentSepP lytPos lyt = - isIndented lyt && sepP lytPos - - sepP lytPos = - srcColumn tokPos == srcColumn lytPos && srcLine tokPos /= srcLine lytPos + indentedP = + const isIndented + + offsideP lytPos lyt = + isIndented lyt && srcColumn tokPos < srcColumn lytPos + + offsideEndP lytPos lyt = + isIndented lyt && srcColumn tokPos <= srcColumn lytPos + + indentSepP lytPos lyt = + isIndented lyt && sepP lytPos + + sepP lytPos = + srcColumn tokPos == srcColumn lytPos && srcLine tokPos /= srcLine lytPos unwindLayout :: SourcePos -> [Comment LineFeed] -> LayoutStack -> [SourceToken] unwindLayout pos leading = go where - go [] = [] - go ((_, LytRoot) : _) = [SourceToken (TokenAnn (SourceRange pos pos) leading []) TokEof] - go ((_, lyt) : stk) | isIndented lyt = lytToken pos TokLayoutEnd : go stk - go (_ : stk) = go stk + go [] = [] + go ((_, LytRoot) : _) = [SourceToken (TokenAnn (SourceRange pos pos) leading []) TokEof] + go ((_, lyt) : stk) | isIndented lyt = lytToken pos TokLayoutEnd : go stk + go (_ : stk) = go stk diff --git a/src/Language/PureScript/CST/Lexer.hs b/src/Language/PureScript/CST/Lexer.hs index 726a76f26..c71af14a2 100644 --- a/src/Language/PureScript/CST/Lexer.hs +++ b/src/Language/PureScript/CST/Lexer.hs @@ -1,13 +1,13 @@ -module Language.PureScript.CST.Lexer - ( lenient - , lexModule - , lex - , lexTopLevel - , lexWithState - , isUnquotedKey - ) where +module Language.PureScript.CST.Lexer ( + lenient, + lexModule, + lex, + lexTopLevel, + lexWithState, + isUnquotedKey, +) where -import Prelude hiding (lex, exp, exponent, lines) +import Prelude hiding (exp, exponent, lex, lines) import Control.Monad (join) import Data.Char qualified as Char @@ -19,24 +19,25 @@ import Data.String (fromString) import Data.Text (Text) import Data.Text qualified as Text import Data.Text.PureScript qualified as Text -import Language.PureScript.CST.Errors (ParserErrorInfo(..), ParserErrorType(..)) -import Language.PureScript.CST.Monad (LexResult, LexState(..), ParserM(..), throw) -import Language.PureScript.CST.Layout (LayoutDelim(..), insertLayout, lytToken, unwindLayout) +import Language.PureScript.CST.Errors (ParserErrorInfo (..), ParserErrorType (..)) +import Language.PureScript.CST.Layout (LayoutDelim (..), insertLayout, lytToken, unwindLayout) +import Language.PureScript.CST.Monad (LexResult, LexState (..), ParserM (..), throw) import Language.PureScript.CST.Positions (advanceLeading, advanceToken, advanceTrailing, applyDelta, textDelta) -import Language.PureScript.CST.Types (Comment(..), LineFeed(..), SourcePos(..), SourceRange(..), SourceStyle(..), SourceToken(..), Token(..), TokenAnn(..)) +import Language.PureScript.CST.Types (Comment (..), LineFeed (..), SourcePos (..), SourceRange (..), SourceStyle (..), SourceToken (..), Token (..), TokenAnn (..)) --- | Stops at the first lexing error and replaces it with TokEof. Otherwise, --- the parser will fail when it attempts to draw a lookahead token. +{- | Stops at the first lexing error and replaces it with TokEof. Otherwise, +the parser will fail when it attempts to draw a lookahead token. +-} lenient :: [LexResult] -> [LexResult] lenient = go where - go [] = [] - go (Right a : as) = Right a : go as - go (Left (st, _) : _) = do - let - pos = lexPos st - ann = TokenAnn (SourceRange pos pos) (lexLeading st) [] - [Right (SourceToken ann TokEof)] + go [] = [] + go (Right a : as) = Right a : go as + go (Left (st, _) : _) = do + let + pos = lexPos st + ann = TokenAnn (SourceRange pos pos) (lexLeading st) [] + [Right (SourceToken ann TokEof)] lexModule :: Text -> [LexResult] lexModule = lex' shebangThenComments @@ -49,12 +50,13 @@ lex' :: (Text -> ([Comment LineFeed], Text)) -> Text -> [LexResult] lex' lexComments src = do let (leading, src') = lexComments src - lexWithState $ LexState - { lexPos = advanceLeading (SourcePos 1 1) leading - , lexLeading = leading - , lexSource = src' - , lexStack = [(SourcePos 0 0, LytRoot)] - } + lexWithState $ + LexState + { lexPos = advanceLeading (SourcePos 1 1) leading + , lexLeading = leading + , lexSource = src' + , lexStack = [(SourcePos 0 0, LytRoot)] + } -- | Lexes according to top-level declaration context rules. lexTopLevel :: Text -> [LexResult] @@ -63,59 +65,64 @@ lexTopLevel src = do (leading, src') = comments src lexPos = advanceLeading (SourcePos 1 1) leading hd = Right $ lytToken lexPos TokLayoutStart - tl = lexWithState $ LexState - { lexPos = lexPos - , lexLeading = leading - , lexSource = src' - , lexStack = [(lexPos, LytWhere), (SourcePos 0 0, LytRoot)] - } + tl = + lexWithState $ + LexState + { lexPos = lexPos + , lexLeading = leading + , lexSource = src' + , lexStack = [(lexPos, LytWhere), (SourcePos 0 0, LytRoot)] + } hd : tl -- | Lexes according to some LexState. lexWithState :: LexState -> [LexResult] lexWithState = go where - Parser lexK = - tokenAndComments - - go state@LexState {..} = - lexK lexSource onError onSuccess - where - onError lexSource' err = do - let - len1 = Text.length lexSource - len2 = Text.length lexSource' - chunk = Text.take (max 0 (len1 - len2)) lexSource - chunkDelta = textDelta chunk - pos = applyDelta lexPos chunkDelta - pure $ Left - ( state { lexSource = lexSource' } - , ParserErrorInfo (SourceRange pos $ applyDelta pos (0, 1)) [] lexStack err - ) - - onSuccess _ (TokEof, _) = - Right <$> unwindLayout lexPos lexLeading lexStack - onSuccess lexSource' (tok, (trailing, lexLeading')) = do - let - endPos = advanceToken lexPos tok - lexPos' = advanceLeading (advanceTrailing endPos trailing) lexLeading' - tokenAnn = TokenAnn - { tokRange = SourceRange lexPos endPos - , tokLeadingComments = lexLeading - , tokTrailingComments = trailing - } - (lexStack', toks) = - insertLayout (SourceToken tokenAnn tok) lexPos' lexStack - state' = LexState - { lexPos = lexPos' - , lexLeading = lexLeading' - , lexSource = lexSource' - , lexStack = lexStack' - } - go2 state' toks + Parser lexK = + tokenAndComments - go2 state [] = go state - go2 state (t : ts) = Right t : go2 state ts + go state@LexState {..} = + lexK lexSource onError onSuccess + where + onError lexSource' err = do + let + len1 = Text.length lexSource + len2 = Text.length lexSource' + chunk = Text.take (max 0 (len1 - len2)) lexSource + chunkDelta = textDelta chunk + pos = applyDelta lexPos chunkDelta + pure $ + Left + ( state {lexSource = lexSource'} + , ParserErrorInfo (SourceRange pos $ applyDelta pos (0, 1)) [] lexStack err + ) + + onSuccess _ (TokEof, _) = + Right <$> unwindLayout lexPos lexLeading lexStack + onSuccess lexSource' (tok, (trailing, lexLeading')) = do + let + endPos = advanceToken lexPos tok + lexPos' = advanceLeading (advanceTrailing endPos trailing) lexLeading' + tokenAnn = + TokenAnn + { tokRange = SourceRange lexPos endPos + , tokLeadingComments = lexLeading + , tokTrailingComments = trailing + } + (lexStack', toks) = + insertLayout (SourceToken tokenAnn tok) lexPos' lexStack + state' = + LexState + { lexPos = lexPos' + , lexLeading = lexLeading' + , lexSource = lexSource' + , lexStack = lexStack' + } + go2 state' toks + + go2 state [] = go state + go2 state (t : ts) = Right t : go2 state ts type Lexer = ParserM ParserErrorType Text @@ -160,125 +167,128 @@ shebangThenComments src = do shebang :: Text -> ([Comment LineFeed], Text) shebang = \src -> k src (\_ _ -> ([], src)) (\inp a -> (a, inp)) where - Parser k = breakShebang + Parser k = breakShebang comments :: Text -> ([Comment LineFeed], Text) comments = \src -> k src (\_ _ -> ([], src)) (\inp (a, b) -> (a <> b, inp)) where - Parser k = breakComments + Parser k = breakComments breakComments :: Lexer ([Comment void], [Comment LineFeed]) breakComments = k0 [] where - k0 acc = do - spaces <- nextWhile (== ' ') - lines <- nextWhile isLineFeed - let - acc' - | Text.null spaces = acc - | otherwise = Space (Text.length spaces) : acc - if Text.null lines - then do - mbComm <- comment - case mbComm of - Just comm -> k0 (comm : acc') - Nothing -> pure (reverse acc', []) - else - k1 acc' (goWs [] $ Text.unpack lines) - - k1 trl acc = do - ws <- nextWhile (\c -> c == ' ' || isLineFeed c) - let acc' = goWs acc $ Text.unpack ws - mbComm <- comment - case mbComm of - Just comm -> k1 trl (comm : acc') - Nothing -> pure (reverse trl, reverse acc') - - goWs a ('\r' : '\n' : ls) = goWs (Line CRLF : a) ls - goWs a ('\r' : ls) = goWs (Line CRLF : a) ls - goWs a ('\n' : ls) = goWs (Line LF : a) ls - goWs a (' ' : ls) = goSpace a 1 ls - goWs a _ = a - - goSpace a !n (' ' : ls) = goSpace a (n + 1) ls - goSpace a n ls = goWs (Space n : a) ls - - isBlockComment = Parser $ \inp _ ksucc -> - case Text.uncons inp of - Just ('-', inp2) -> - case Text.uncons inp2 of - Just ('-', inp3) -> - ksucc inp3 $ Just False - _ -> - ksucc inp Nothing - Just ('{', inp2) -> - case Text.uncons inp2 of - Just ('-', inp3) -> - ksucc inp3 $ Just True - _ -> - ksucc inp Nothing - _ -> - ksucc inp Nothing - - comment = isBlockComment >>= \case - Just True -> Just <$> blockComment "{-" - Just False -> Just <$> lineComment "--" - Nothing -> pure Nothing - - blockComment acc = do - chs <- nextWhile (/= '-') - dashes <- nextWhile (== '-') - if Text.null dashes - then pure $ Comment $ acc <> chs - else peek >>= \case - Just '}' -> next $> Comment (acc <> chs <> dashes <> "}") - _ -> blockComment (acc <> chs <> dashes) + k0 acc = do + spaces <- nextWhile (== ' ') + lines <- nextWhile isLineFeed + let + acc' + | Text.null spaces = acc + | otherwise = Space (Text.length spaces) : acc + if Text.null lines + then do + mbComm <- comment + case mbComm of + Just comm -> k0 (comm : acc') + Nothing -> pure (reverse acc', []) + else k1 acc' (goWs [] $ Text.unpack lines) + + k1 trl acc = do + ws <- nextWhile (\c -> c == ' ' || isLineFeed c) + let acc' = goWs acc $ Text.unpack ws + mbComm <- comment + case mbComm of + Just comm -> k1 trl (comm : acc') + Nothing -> pure (reverse trl, reverse acc') + + goWs a ('\r' : '\n' : ls) = goWs (Line CRLF : a) ls + goWs a ('\r' : ls) = goWs (Line CRLF : a) ls + goWs a ('\n' : ls) = goWs (Line LF : a) ls + goWs a (' ' : ls) = goSpace a 1 ls + goWs a _ = a + + goSpace a !n (' ' : ls) = goSpace a (n + 1) ls + goSpace a n ls = goWs (Space n : a) ls + + isBlockComment = Parser $ \inp _ ksucc -> + case Text.uncons inp of + Just ('-', inp2) -> + case Text.uncons inp2 of + Just ('-', inp3) -> + ksucc inp3 $ Just False + _ -> + ksucc inp Nothing + Just ('{', inp2) -> + case Text.uncons inp2 of + Just ('-', inp3) -> + ksucc inp3 $ Just True + _ -> + ksucc inp Nothing + _ -> + ksucc inp Nothing + + comment = + isBlockComment >>= \case + Just True -> Just <$> blockComment "{-" + Just False -> Just <$> lineComment "--" + Nothing -> pure Nothing + + blockComment acc = do + chs <- nextWhile (/= '-') + dashes <- nextWhile (== '-') + if Text.null dashes + then pure $ Comment $ acc <> chs + else + peek >>= \case + Just '}' -> next $> Comment (acc <> chs <> dashes <> "}") + _ -> blockComment (acc <> chs <> dashes) breakShebang :: ParserM ParserErrorType Text [Comment LineFeed] -breakShebang = shebangComment >>= \case - Just comm -> k0 [comm] - Nothing -> pure [] +breakShebang = + shebangComment >>= \case + Just comm -> k0 [comm] + Nothing -> pure [] where - k0 acc = lineFeedShebang >>= \case - Just (lf, sb) -> do - comm <- lineComment sb - k0 (comm : lf : acc) - Nothing -> - pure $ reverse acc - - lineFeedShebang = Parser $ \inp _ ksucc -> - case unconsLineFeed inp of - Just (lf, inp2) - | Just (sb, inp3) <- unconsShebang inp2 -> - ksucc inp3 $ Just (lf, sb) - _ -> - ksucc inp Nothing - - unconsLineFeed :: Text -> Maybe (Comment LineFeed, Text) - unconsLineFeed inp = - case Text.uncons inp of - Just ('\r', inp2) -> - case Text.uncons inp2 of - Just ('\n', inp3) -> - Just (Line CRLF, inp3) - _ -> - Just (Line CRLF, inp2) - Just ('\n', inp2) -> - Just (Line LF, inp2) - _ -> - Nothing - - unconsShebang :: Text -> Maybe (Text, Text) - unconsShebang = fmap ("#!",) . Text.stripPrefix "#!" - - shebangComment = isShebang >>= traverse lineComment - - isShebang = Parser $ \inp _ ksucc -> - case unconsShebang inp of - Just (sb, inp3) -> - ksucc inp3 $ Just sb - _ -> - ksucc inp Nothing + k0 acc = + lineFeedShebang >>= \case + Just (lf, sb) -> do + comm <- lineComment sb + k0 (comm : lf : acc) + Nothing -> + pure $ reverse acc + + lineFeedShebang = Parser $ \inp _ ksucc -> + case unconsLineFeed inp of + Just (lf, inp2) + | Just (sb, inp3) <- unconsShebang inp2 -> + ksucc inp3 $ Just (lf, sb) + _ -> + ksucc inp Nothing + + unconsLineFeed :: Text -> Maybe (Comment LineFeed, Text) + unconsLineFeed inp = + case Text.uncons inp of + Just ('\r', inp2) -> + case Text.uncons inp2 of + Just ('\n', inp3) -> + Just (Line CRLF, inp3) + _ -> + Just (Line CRLF, inp2) + Just ('\n', inp2) -> + Just (Line LF, inp2) + _ -> + Nothing + + unconsShebang :: Text -> Maybe (Text, Text) + unconsShebang = fmap ("#!",) . Text.stripPrefix "#!" + + shebangComment = isShebang >>= traverse lineComment + + isShebang = Parser $ \inp _ ksucc -> + case unconsShebang inp of + Just (sb, inp3) -> + ksucc inp3 $ Just sb + _ -> + ksucc inp Nothing lineComment :: forall lf. Text -> ParserM ParserErrorType Text (Comment lf) lineComment acc = do @@ -288,432 +298,452 @@ lineComment acc = do token :: Lexer Token token = peek >>= maybe (pure TokEof) k0 where - k0 ch1 = case ch1 of - '(' -> next *> leftParen - ')' -> next $> TokRightParen - '{' -> next $> TokLeftBrace - '}' -> next $> TokRightBrace - '[' -> next $> TokLeftSquare - ']' -> next $> TokRightSquare - '`' -> next $> TokTick - ',' -> next $> TokComma - '∷' -> next *> orOperator1 (TokDoubleColon Unicode) ch1 - '←' -> next *> orOperator1 (TokLeftArrow Unicode) ch1 - '→' -> next *> orOperator1 (TokRightArrow Unicode) ch1 - '⇒' -> next *> orOperator1 (TokRightFatArrow Unicode) ch1 - '∀' -> next *> orOperator1 (TokForall Unicode) ch1 - '|' -> next *> orOperator1 TokPipe ch1 - '.' -> next *> orOperator1 TokDot ch1 - '\\' -> next *> orOperator1 TokBackslash ch1 - '<' -> next *> orOperator2 (TokLeftArrow ASCII) ch1 '-' - '-' -> next *> orOperator2 (TokRightArrow ASCII) ch1 '>' - '=' -> next *> orOperator2' TokEquals (TokRightFatArrow ASCII) ch1 '>' - ':' -> next *> orOperator2' (TokOperator [] ":") (TokDoubleColon ASCII) ch1 ':' - '?' -> next *> hole - '\'' -> next *> char - '"' -> next *> string - _ | Char.isDigit ch1 -> restore (== ErrNumberOutOfRange) (next *> number ch1) - | Char.isUpper ch1 -> next *> upper [] ch1 - | isIdentStart ch1 -> next *> lower [] ch1 - | isSymbolChar ch1 -> next *> operator [] [ch1] - | otherwise -> throw $ ErrLexeme (Just [ch1]) [] - - {-# INLINE orOperator1 #-} - orOperator1 :: Token -> Char -> Lexer Token - orOperator1 tok ch1 = join $ Parser $ \inp _ ksucc -> - case Text.uncons inp of - Just (ch2, inp2) | isSymbolChar ch2 -> - ksucc inp2 $ operator [] [ch1, ch2] - _ -> - ksucc inp $ pure tok - - {-# INLINE orOperator2 #-} - orOperator2 :: Token -> Char -> Char -> Lexer Token - orOperator2 tok ch1 ch2 = join $ Parser $ \inp _ ksucc -> - case Text.uncons inp of - Just (ch2', inp2) | ch2 == ch2' -> - case Text.uncons inp2 of - Just (ch3, inp3) | isSymbolChar ch3 -> - ksucc inp3 $ operator [] [ch1, ch2, ch3] - _ -> - ksucc inp2 $ pure tok - _ -> - ksucc inp $ operator [] [ch1] - - {-# INLINE orOperator2' #-} - orOperator2' :: Token -> Token -> Char -> Char -> Lexer Token - orOperator2' tok1 tok2 ch1 ch2 = join $ Parser $ \inp _ ksucc -> - case Text.uncons inp of - Just (ch2', inp2) | ch2 == ch2' -> - case Text.uncons inp2 of - Just (ch3, inp3) | isSymbolChar ch3 -> - ksucc inp3 $ operator [] [ch1, ch2, ch3] - _ -> - ksucc inp2 $ pure tok2 - Just (ch2', inp2) | isSymbolChar ch2' -> - ksucc inp2 $ operator [] [ch1, ch2'] - _ -> - ksucc inp $ pure tok1 - - {- - leftParen - : '(' '→' ')' - | '(' '->' ')' - | '(' symbolChar+ ')' - | '(' - -} - leftParen :: Lexer Token - leftParen = Parser $ \inp kerr ksucc -> - case Text.span isSymbolChar inp of - (chs, inp2) - | Text.null chs -> ksucc inp TokLeftParen - | otherwise -> - case Text.uncons inp2 of - Just (')', inp3) -> - case chs of - "→" -> ksucc inp3 $ TokSymbolArr Unicode - "->" -> ksucc inp3 $ TokSymbolArr ASCII - _ | isReservedSymbol chs -> kerr inp ErrReservedSymbol - | otherwise -> ksucc inp3 $ TokSymbolName [] chs - _ -> ksucc inp TokLeftParen - - {- - symbol - : '(' symbolChar+ ')' - -} - symbol :: [Text] -> Lexer Token - symbol qual = restore isReservedSymbolError $ peek >>= \case - Just ch | isSymbolChar ch -> - nextWhile isSymbolChar >>= \chs -> + k0 ch1 = case ch1 of + '(' -> next *> leftParen + ')' -> next $> TokRightParen + '{' -> next $> TokLeftBrace + '}' -> next $> TokRightBrace + '[' -> next $> TokLeftSquare + ']' -> next $> TokRightSquare + '`' -> next $> TokTick + ',' -> next $> TokComma + '∷' -> next *> orOperator1 (TokDoubleColon Unicode) ch1 + '←' -> next *> orOperator1 (TokLeftArrow Unicode) ch1 + '→' -> next *> orOperator1 (TokRightArrow Unicode) ch1 + '⇒' -> next *> orOperator1 (TokRightFatArrow Unicode) ch1 + '∀' -> next *> orOperator1 (TokForall Unicode) ch1 + '|' -> next *> orOperator1 TokPipe ch1 + '.' -> next *> orOperator1 TokDot ch1 + '\\' -> next *> orOperator1 TokBackslash ch1 + '<' -> next *> orOperator2 (TokLeftArrow ASCII) ch1 '-' + '-' -> next *> orOperator2 (TokRightArrow ASCII) ch1 '>' + '=' -> next *> orOperator2' TokEquals (TokRightFatArrow ASCII) ch1 '>' + ':' -> next *> orOperator2' (TokOperator [] ":") (TokDoubleColon ASCII) ch1 ':' + '?' -> next *> hole + '\'' -> next *> char + '"' -> next *> string + _ + | Char.isDigit ch1 -> restore (== ErrNumberOutOfRange) (next *> number ch1) + | Char.isUpper ch1 -> next *> upper [] ch1 + | isIdentStart ch1 -> next *> lower [] ch1 + | isSymbolChar ch1 -> next *> operator [] [ch1] + | otherwise -> throw $ ErrLexeme (Just [ch1]) [] + + {-# INLINE orOperator1 #-} + orOperator1 :: Token -> Char -> Lexer Token + orOperator1 tok ch1 = join $ Parser $ \inp _ ksucc -> + case Text.uncons inp of + Just (ch2, inp2) + | isSymbolChar ch2 -> + ksucc inp2 $ operator [] [ch1, ch2] + _ -> + ksucc inp $ pure tok + + {-# INLINE orOperator2 #-} + orOperator2 :: Token -> Char -> Char -> Lexer Token + orOperator2 tok ch1 ch2 = join $ Parser $ \inp _ ksucc -> + case Text.uncons inp of + Just (ch2', inp2) | ch2 == ch2' -> + case Text.uncons inp2 of + Just (ch3, inp3) + | isSymbolChar ch3 -> + ksucc inp3 $ operator [] [ch1, ch2, ch3] + _ -> + ksucc inp2 $ pure tok + _ -> + ksucc inp $ operator [] [ch1] + + {-# INLINE orOperator2' #-} + orOperator2' :: Token -> Token -> Char -> Char -> Lexer Token + orOperator2' tok1 tok2 ch1 ch2 = join $ Parser $ \inp _ ksucc -> + case Text.uncons inp of + Just (ch2', inp2) | ch2 == ch2' -> + case Text.uncons inp2 of + Just (ch3, inp3) + | isSymbolChar ch3 -> + ksucc inp3 $ operator [] [ch1, ch2, ch3] + _ -> + ksucc inp2 $ pure tok2 + Just (ch2', inp2) + | isSymbolChar ch2' -> + ksucc inp2 $ operator [] [ch1, ch2'] + _ -> + ksucc inp $ pure tok1 + + {- + leftParen + : '(' '→' ')' + | '(' '->' ')' + | '(' symbolChar+ ')' + | '(' + -} + leftParen :: Lexer Token + leftParen = Parser $ \inp kerr ksucc -> + case Text.span isSymbolChar inp of + (chs, inp2) + | Text.null chs -> ksucc inp TokLeftParen + | otherwise -> + case Text.uncons inp2 of + Just (')', inp3) -> + case chs of + "→" -> ksucc inp3 $ TokSymbolArr Unicode + "->" -> ksucc inp3 $ TokSymbolArr ASCII + _ + | isReservedSymbol chs -> kerr inp ErrReservedSymbol + | otherwise -> ksucc inp3 $ TokSymbolName [] chs + _ -> ksucc inp TokLeftParen + + {- + symbol + : '(' symbolChar+ ')' + -} + symbol :: [Text] -> Lexer Token + symbol qual = + restore isReservedSymbolError $ + peek >>= \case + Just ch + | isSymbolChar ch -> + nextWhile isSymbolChar >>= \chs -> + peek >>= \case + Just ')' + | isReservedSymbol chs -> throw ErrReservedSymbol + | otherwise -> next $> TokSymbolName (reverse qual) chs + Just ch2 -> throw $ ErrLexeme (Just [ch2]) [] + Nothing -> throw ErrEof + Just ch -> throw $ ErrLexeme (Just [ch]) [] + Nothing -> throw ErrEof + + {- + operator + : symbolChar+ + -} + operator :: [Text] -> String -> Lexer Token + operator qual pre = do + rest <- nextWhile isSymbolChar + pure . TokOperator (reverse qual) $ Text.pack pre <> rest + + {- + moduleName + : upperChar alphaNumChar* + + qualifier + : (moduleName '.')* moduleName + + upper + : (qualifier '.')? upperChar identChar* + | qualifier '.' lowerQualified + | qualifier '.' operator + | qualifier '.' symbol + -} + upper :: [Text] -> Char -> Lexer Token + upper qual pre = do + rest <- nextWhile isIdentChar + ch1 <- peek + let name = Text.cons pre rest + case ch1 of + Just '.' -> do + let qual' = name : qual + next *> peek >>= \case + Just '(' -> next *> symbol qual' + Just ch2 + | Char.isUpper ch2 -> next *> upper qual' ch2 + | isIdentStart ch2 -> next *> lower qual' ch2 + | isSymbolChar ch2 -> next *> operator qual' [ch2] + | otherwise -> throw $ ErrLexeme (Just [ch2]) [] + Nothing -> + throw ErrEof + _ -> + pure $ TokUpperName (reverse qual) name + + {- + lower + : '_' + | 'forall' + | lowerChar identChar* + + lowerQualified + : lowerChar identChar* + -} + lower :: [Text] -> Char -> Lexer Token + lower qual pre = do + rest <- nextWhile isIdentChar + case pre of + '_' + | Text.null rest -> + if null qual + then pure TokUnderscore + else throw $ ErrLexeme (Just [pre]) [] + _ -> + case Text.cons pre rest of + "forall" | null qual -> pure $ TokForall ASCII + name -> pure $ TokLowerName (reverse qual) name + + {- + hole + : '?' identChar+ + -} + hole :: Lexer Token + hole = do + name <- nextWhile isIdentChar + if Text.null name + then operator [] ['?'] + else pure $ TokHole name + + {- + char + : "'" '\' escape "'" + | "'" [^'] "'" + -} + char :: Lexer Token + char = do + (raw, ch) <- peek >>= \case - Just ')' - | isReservedSymbol chs -> throw ErrReservedSymbol - | otherwise -> next $> TokSymbolName (reverse qual) chs - Just ch2 -> throw $ ErrLexeme (Just [ch2]) [] - Nothing -> throw ErrEof - Just ch -> throw $ ErrLexeme (Just [ch]) [] - Nothing -> throw ErrEof - - {- - operator - : symbolChar+ - -} - operator :: [Text] -> String -> Lexer Token - operator qual pre = do - rest <- nextWhile isSymbolChar - pure . TokOperator (reverse qual) $ Text.pack pre <> rest - - {- - moduleName - : upperChar alphaNumChar* - - qualifier - : (moduleName '.')* moduleName - - upper - : (qualifier '.')? upperChar identChar* - | qualifier '.' lowerQualified - | qualifier '.' operator - | qualifier '.' symbol - -} - upper :: [Text] -> Char -> Lexer Token - upper qual pre = do - rest <- nextWhile isIdentChar - ch1 <- peek - let name = Text.cons pre rest - case ch1 of - Just '.' -> do - let qual' = name : qual - next *> peek >>= \case - Just '(' -> next *> symbol qual' - Just ch2 - | Char.isUpper ch2 -> next *> upper qual' ch2 - | isIdentStart ch2 -> next *> lower qual' ch2 - | isSymbolChar ch2 -> next *> operator qual' [ch2] - | otherwise -> throw $ ErrLexeme (Just [ch2]) [] + Just '\\' -> do + (raw, ch2) <- next *> escape + pure (Text.cons '\\' raw, ch2) + Just ch -> + next $> (Text.singleton ch, ch) Nothing -> throw ErrEof - _ -> - pure $ TokUpperName (reverse qual) name - - {- - lower - : '_' - | 'forall' - | lowerChar identChar* - - lowerQualified - : lowerChar identChar* - -} - lower :: [Text] -> Char -> Lexer Token - lower qual pre = do - rest <- nextWhile isIdentChar - case pre of - '_' | Text.null rest -> - if null qual - then pure TokUnderscore - else throw $ ErrLexeme (Just [pre]) [] - _ -> - case Text.cons pre rest of - "forall" | null qual -> pure $ TokForall ASCII - name -> pure $ TokLowerName (reverse qual) name - - {- - hole - : '?' identChar+ - -} - hole :: Lexer Token - hole = do - name <- nextWhile isIdentChar - if Text.null name - then operator [] ['?'] - else pure $ TokHole name - - {- - char - : "'" '\' escape "'" - | "'" [^'] "'" - -} - char :: Lexer Token - char = do - (raw, ch) <- peek >>= \case - Just '\\' -> do - (raw, ch2) <- next *> escape - pure (Text.cons '\\' raw, ch2) - Just ch -> - next $> (Text.singleton ch, ch) - Nothing -> - throw ErrEof - peek >>= \case - Just '\'' - | fromEnum ch > 0xFFFF -> throw ErrAstralCodePointInChar - | otherwise -> next $> TokChar raw ch - Just ch2 -> - throw $ ErrLexeme (Just [ch2]) [] - _ -> - throw ErrEof - - {- - stringPart - : '\' escape - | '\' [ \r\n]+ '\' - | [^"] - - string - : '"' stringPart* '"' - | '"""' '"'{0,2} ([^"]+ '"'{1,2})* [^"]* '"""' - - A raw string literal can't contain any sequence of 3 or more quotes, - although sequences of 1 or 2 quotes are allowed anywhere, including at the - beginning or the end. - -} - string :: Lexer Token - string = do - quotes1 <- nextWhile' 7 (== '"') - case Text.length quotes1 of - 0 -> do - let - go raw acc = do - chs <- nextWhile isNormalStringChar - let - raw' = raw <> chs - acc' = acc <> DList.fromList (Text.unpack chs) - peek >>= \case - Just '"' -> next $> TokString raw' (fromString (DList.toList acc')) - Just '\\' -> next *> goEscape (raw' <> "\\") acc' - Just _ -> throw ErrLineFeedInString - Nothing -> throw ErrEof - - goEscape raw acc = do - mbCh <- peek - case mbCh of - Just ch1 | isStringGapChar ch1 -> do - gap <- nextWhile isStringGapChar - peek >>= \case - Just '"' -> next $> TokString (raw <> gap) (fromString (DList.toList acc)) - Just '\\' -> next *> go (raw <> gap <> "\\") acc - Just ch -> throw $ ErrCharInGap ch - Nothing -> throw ErrEof - _ -> do - (raw', ch) <- escape - go (raw <> raw') (acc <> DList.singleton ch) - go "" mempty - 1 -> - pure $ TokString "" "" - n | n >= 5 -> - pure $ TokRawString $ Text.drop 5 quotes1 - _ -> do - let - go acc = do - chs <- nextWhile (/= '"') - quotes2 <- nextWhile' 5 (== '"') - case Text.length quotes2 of - 0 -> throw ErrEof - n | n >= 3 -> pure $ TokRawString $ acc <> chs <> Text.drop 3 quotes2 - _ -> go (acc <> chs <> quotes2) - go $ Text.drop 2 quotes1 - - {- - escape - : 't' - | 'r' - | 'n' - | "'" - | '"' - | 'x' [0-9a-fA-F]{0,6} - -} - escape :: Lexer (Text, Char) - escape = do - ch <- peek - case ch of - Just 't' -> next $> ("t", '\t') - Just 'r' -> next $> ("r", '\r') - Just 'n' -> next $> ("n", '\n') - Just '"' -> next $> ("\"", '"') - Just '\'' -> next $> ("'", '\'') - Just '\\' -> next $> ("\\", '\\') - Just 'x' -> (*>) next $ Parser $ \inp kerr ksucc -> do - let - go n acc (ch' : chs) - | Char.isHexDigit ch' = go (n * 16 + Char.digitToInt ch') (ch' : acc) chs - go n acc _ - | n <= 0x10FFFF = - ksucc (Text.drop (length acc) inp) - ("x" <> Text.pack (reverse acc), Char.chr n) - | otherwise = - kerr inp ErrCharEscape -- TODO - go 0 [] $ Text.unpack $ Text.take 6 inp - _ -> throw ErrCharEscape - - {- - number - : hexadecimal - | integer ('.' fraction)? exponent? - -} - number :: Char -> Lexer Token - number ch1 = peek >>= \ch2 -> case (ch1, ch2) of - ('0', Just 'x') -> next *> hexadecimal - (_, _) -> do - mbInt <- integer1 ch1 - mbFraction <- fraction - case (mbInt, mbFraction) of - (Just (raw, int), Nothing) -> do - let int' = digitsToInteger int - exponent >>= \case - Just (raw', exp) -> - sciDouble (raw <> raw') $ Sci.scientific int' exp - Nothing -> - pure $ TokInt raw int' - (Just (raw, int), Just (raw', frac)) -> do - let sci = digitsToScientific int frac - exponent >>= \case - Just (raw'', exp) -> - sciDouble (raw <> raw' <> raw'') $ uncurry Sci.scientific $ (+ exp) <$> sci - Nothing -> - sciDouble (raw <> raw') $ uncurry Sci.scientific sci - (Nothing, Just (raw, frac)) -> do - let sci = digitsToScientific [] frac - exponent >>= \case - Just (raw', exp) -> - sciDouble (raw <> raw') $ uncurry Sci.scientific $ (+ exp) <$> sci - Nothing -> - sciDouble raw $ uncurry Sci.scientific sci - (Nothing, Nothing) -> - peek >>= \ch -> throw $ ErrLexeme (pure <$> ch) [] - - sciDouble :: Text -> Sci.Scientific -> Lexer Token - sciDouble raw sci = case Sci.toBoundedRealFloat sci of - Left _ -> throw ErrNumberOutOfRange - Right n -> pure $ TokNumber raw n - - {- - integer - : '0' - | [1-9] digits - -} - integer :: Lexer (Maybe (Text, String)) - integer = peek >>= \case - Just '0' -> next *> peek >>= \case - Just ch | isNumberChar ch -> throw ErrLeadingZero - _ -> pure $ Just ("0", "0") - Just ch | Char.isDigit ch -> Just <$> digits - _ -> pure Nothing - - {- - integer1 - : '0' - | [1-9] digits - - This is the same as 'integer', the only difference is that this expects the - first char to be consumed during dispatch. - -} - integer1 :: Char -> Lexer (Maybe (Text, String)) - integer1 = \case - '0' -> peek >>= \case - Just ch | isNumberChar ch -> throw ErrLeadingZero - _ -> pure $ Just ("0", "0") - ch | Char.isDigit ch -> do - (raw, chs) <- digits - pure $ Just (Text.cons ch raw, ch : chs) - _ -> pure Nothing - - {- - fraction - : '.' [0-9_]+ - -} - fraction :: Lexer (Maybe (Text, String)) - fraction = Parser $ \inp _ ksucc -> - -- We need more than a single char lookahead for things like `1..10`. - case Text.uncons inp of - Just ('.', inp') - | (raw, inp'') <- Text.span isNumberChar inp' - , not (Text.null raw) -> - ksucc inp'' $ Just ("." <> raw, filter (/= '_') $ Text.unpack raw) - _ -> - ksucc inp Nothing - - {- - digits - : [0-9_]* - - Digits can contain underscores, which are ignored. - -} - digits :: Lexer (Text, String) - digits = do - raw <- nextWhile isNumberChar - pure (raw, filter (/= '_') $ Text.unpack raw) - - {- - exponent - : 'e' ('+' | '-')? integer - -} - exponent :: Lexer (Maybe (Text, Int)) - exponent = peek >>= \case - Just 'e' -> do - (neg, sign) <- next *> peek >>= \case - Just '-' -> next $> (True, "-") - Just '+' -> next $> (False, "+") - _ -> pure (False, "") - integer >>= \case - Just (raw, chs) -> do + peek >>= \case + Just '\'' + | fromEnum ch > 0xFFFF -> throw ErrAstralCodePointInChar + | otherwise -> next $> TokChar raw ch + Just ch2 -> + throw $ ErrLexeme (Just [ch2]) [] + _ -> + throw ErrEof + + {- + stringPart + : '\' escape + | '\' [ \r\n]+ '\' + | [^"] + + string + : '"' stringPart* '"' + | '"""' '"'{0,2} ([^"]+ '"'{1,2})* [^"]* '"""' + + A raw string literal can't contain any sequence of 3 or more quotes, + although sequences of 1 or 2 quotes are allowed anywhere, including at the + beginning or the end. + -} + string :: Lexer Token + string = do + quotes1 <- nextWhile' 7 (== '"') + case Text.length quotes1 of + 0 -> do let - int | neg = negate $ digitsToInteger chs - | otherwise = digitsToInteger chs - pure $ Just ("e" <> sign <> raw, fromInteger int) - Nothing -> throw ErrExpectedExponent - _ -> - pure Nothing - - {- - hexadecimal - : '0x' [0-9a-fA-F]+ - -} - hexadecimal :: Lexer Token - hexadecimal = do - chs <- nextWhile Char.isHexDigit - if Text.null chs - then throw ErrExpectedHex - else pure $ TokInt ("0x" <> chs) $ digitsToIntegerBase 16 $ Text.unpack chs + go raw acc = do + chs <- nextWhile isNormalStringChar + let + raw' = raw <> chs + acc' = acc <> DList.fromList (Text.unpack chs) + peek >>= \case + Just '"' -> next $> TokString raw' (fromString (DList.toList acc')) + Just '\\' -> next *> goEscape (raw' <> "\\") acc' + Just _ -> throw ErrLineFeedInString + Nothing -> throw ErrEof + + goEscape raw acc = do + mbCh <- peek + case mbCh of + Just ch1 | isStringGapChar ch1 -> do + gap <- nextWhile isStringGapChar + peek >>= \case + Just '"' -> next $> TokString (raw <> gap) (fromString (DList.toList acc)) + Just '\\' -> next *> go (raw <> gap <> "\\") acc + Just ch -> throw $ ErrCharInGap ch + Nothing -> throw ErrEof + _ -> do + (raw', ch) <- escape + go (raw <> raw') (acc <> DList.singleton ch) + go "" mempty + 1 -> + pure $ TokString "" "" + n + | n >= 5 -> + pure $ TokRawString $ Text.drop 5 quotes1 + _ -> do + let + go acc = do + chs <- nextWhile (/= '"') + quotes2 <- nextWhile' 5 (== '"') + case Text.length quotes2 of + 0 -> throw ErrEof + n | n >= 3 -> pure $ TokRawString $ acc <> chs <> Text.drop 3 quotes2 + _ -> go (acc <> chs <> quotes2) + go $ Text.drop 2 quotes1 + + {- + escape + : 't' + | 'r' + | 'n' + | "'" + | '"' + | 'x' [0-9a-fA-F]{0,6} + -} + escape :: Lexer (Text, Char) + escape = do + ch <- peek + case ch of + Just 't' -> next $> ("t", '\t') + Just 'r' -> next $> ("r", '\r') + Just 'n' -> next $> ("n", '\n') + Just '"' -> next $> ("\"", '"') + Just '\'' -> next $> ("'", '\'') + Just '\\' -> next $> ("\\", '\\') + Just 'x' -> (*>) next $ Parser $ \inp kerr ksucc -> do + let + go n acc (ch' : chs) + | Char.isHexDigit ch' = go (n * 16 + Char.digitToInt ch') (ch' : acc) chs + go n acc _ + | n <= 0x10FFFF = + ksucc + (Text.drop (length acc) inp) + ("x" <> Text.pack (reverse acc), Char.chr n) + | otherwise = + kerr inp ErrCharEscape -- TODO + go 0 [] $ Text.unpack $ Text.take 6 inp + _ -> throw ErrCharEscape + + {- + number + : hexadecimal + | integer ('.' fraction)? exponent? + -} + number :: Char -> Lexer Token + number ch1 = + peek >>= \ch2 -> case (ch1, ch2) of + ('0', Just 'x') -> next *> hexadecimal + (_, _) -> do + mbInt <- integer1 ch1 + mbFraction <- fraction + case (mbInt, mbFraction) of + (Just (raw, int), Nothing) -> do + let int' = digitsToInteger int + exponent >>= \case + Just (raw', exp) -> + sciDouble (raw <> raw') $ Sci.scientific int' exp + Nothing -> + pure $ TokInt raw int' + (Just (raw, int), Just (raw', frac)) -> do + let sci = digitsToScientific int frac + exponent >>= \case + Just (raw'', exp) -> + sciDouble (raw <> raw' <> raw'') $ uncurry Sci.scientific $ (+ exp) <$> sci + Nothing -> + sciDouble (raw <> raw') $ uncurry Sci.scientific sci + (Nothing, Just (raw, frac)) -> do + let sci = digitsToScientific [] frac + exponent >>= \case + Just (raw', exp) -> + sciDouble (raw <> raw') $ uncurry Sci.scientific $ (+ exp) <$> sci + Nothing -> + sciDouble raw $ uncurry Sci.scientific sci + (Nothing, Nothing) -> + peek >>= \ch -> throw $ ErrLexeme (pure <$> ch) [] + + sciDouble :: Text -> Sci.Scientific -> Lexer Token + sciDouble raw sci = case Sci.toBoundedRealFloat sci of + Left _ -> throw ErrNumberOutOfRange + Right n -> pure $ TokNumber raw n + + {- + integer + : '0' + | [1-9] digits + -} + integer :: Lexer (Maybe (Text, String)) + integer = + peek >>= \case + Just '0' -> + next *> peek >>= \case + Just ch | isNumberChar ch -> throw ErrLeadingZero + _ -> pure $ Just ("0", "0") + Just ch | Char.isDigit ch -> Just <$> digits + _ -> pure Nothing + + {- + integer1 + : '0' + | [1-9] digits + + This is the same as 'integer', the only difference is that this expects the + first char to be consumed during dispatch. + -} + integer1 :: Char -> Lexer (Maybe (Text, String)) + integer1 = \case + '0' -> + peek >>= \case + Just ch | isNumberChar ch -> throw ErrLeadingZero + _ -> pure $ Just ("0", "0") + ch | Char.isDigit ch -> do + (raw, chs) <- digits + pure $ Just (Text.cons ch raw, ch : chs) + _ -> pure Nothing + + {- + fraction + : '.' [0-9_]+ + -} + fraction :: Lexer (Maybe (Text, String)) + fraction = Parser $ \inp _ ksucc -> + -- We need more than a single char lookahead for things like `1..10`. + case Text.uncons inp of + Just ('.', inp') + | (raw, inp'') <- Text.span isNumberChar inp' + , not (Text.null raw) -> + ksucc inp'' $ Just ("." <> raw, filter (/= '_') $ Text.unpack raw) + _ -> + ksucc inp Nothing + + {- + digits + : [0-9_]* + + Digits can contain underscores, which are ignored. + -} + digits :: Lexer (Text, String) + digits = do + raw <- nextWhile isNumberChar + pure (raw, filter (/= '_') $ Text.unpack raw) + + {- + exponent + : 'e' ('+' | '-')? integer + -} + exponent :: Lexer (Maybe (Text, Int)) + exponent = + peek >>= \case + Just 'e' -> do + (neg, sign) <- + next *> peek >>= \case + Just '-' -> next $> (True, "-") + Just '+' -> next $> (False, "+") + _ -> pure (False, "") + integer >>= \case + Just (raw, chs) -> do + let + int + | neg = negate $ digitsToInteger chs + | otherwise = digitsToInteger chs + pure $ Just ("e" <> sign <> raw, fromInteger int) + Nothing -> throw ErrExpectedExponent + _ -> + pure Nothing + + {- + hexadecimal + : '0x' [0-9a-fA-F]+ + -} + hexadecimal :: Lexer Token + hexadecimal = do + chs <- nextWhile Char.isHexDigit + if Text.null chs + then throw ErrExpectedHex + else pure $ TokInt ("0x" <> chs) $ digitsToIntegerBase 16 $ Text.unpack chs digitsToInteger :: String -> Integer digitsToInteger = digitsToIntegerBase 10 @@ -724,8 +754,8 @@ digitsToIntegerBase b = foldl' (\n c -> n * b + toInteger (Char.digitToInt c)) 0 digitsToScientific :: String -> String -> (Integer, Int) digitsToScientific = go 0 . reverse where - go !exp is [] = (digitsToInteger (reverse is), exp) - go exp is (f : fs) = go (exp - 1) (f : is) fs + go !exp is [] = (digitsToInteger (reverse is), exp) + go exp is (f : fs) = go (exp - 1) (f : is) fs isSymbolChar :: Char -> Bool isSymbolChar c = (c `elem` (":!#$%&*+./<=>?@\\^|-~" :: String)) || (not (Char.isAscii c) && Char.isSymbol c) @@ -736,21 +766,21 @@ isReservedSymbolError = (== ErrReservedSymbol) isReservedSymbol :: Text -> Bool isReservedSymbol = flip elem symbols where - symbols = - [ "::" - , "∷" - , "<-" - , "←" - , "->" - , "→" - , "=>" - , "⇒" - , "∀" - , "|" - , "." - , "\\" - , "=" - ] + symbols = + [ "::" + , "∷" + , "<-" + , "←" + , "->" + , "→" + , "=>" + , "⇒" + , "∀" + , "|" + , "." + , "\\" + , "=" + ] isIdentStart :: Char -> Bool isIdentStart c = Char.isLower c || c == '_' diff --git a/src/Language/PureScript/CST/Monad.hs b/src/Language/PureScript/CST/Monad.hs index 31887c890..32a2e24a6 100644 --- a/src/Language/PureScript/CST/Monad.hs +++ b/src/Language/PureScript/CST/Monad.hs @@ -6,10 +6,10 @@ import Data.List (sortOn) import Data.List.NonEmpty qualified as NE import Data.Ord (comparing) import Data.Text (Text) -import Language.PureScript.CST.Errors (ParserError, ParserErrorInfo(..), ParserErrorType(..), ParserWarning, ParserWarningType) +import Language.PureScript.CST.Errors (ParserError, ParserErrorInfo (..), ParserErrorType (..), ParserWarning, ParserWarningType) import Language.PureScript.CST.Layout (LayoutStack) import Language.PureScript.CST.Positions (widen) -import Language.PureScript.CST.Types (Comment, LineFeed, SourcePos(..), SourceRange(..), SourceToken(..), Token, TokenAnn(..)) +import Language.PureScript.CST.Types (Comment, LineFeed, SourcePos (..), SourceRange (..), SourceToken (..), Token, TokenAnn (..)) type LexResult = Either (LexState, ParserError) SourceToken @@ -18,17 +18,19 @@ data LexState = LexState , lexLeading :: [Comment LineFeed] , lexSource :: Text , lexStack :: LayoutStack - } deriving (Show) + } + deriving (Show) data ParserState = ParserState { parserBuff :: [LexResult] , parserErrors :: [ParserError] , parserWarnings :: [ParserWarning] - } deriving (Show) + } + deriving (Show) -- | A bare bones, CPS'ed `StateT s (Except e) a`. -newtype ParserM e s a = - Parser (forall r. s -> (s -> e -> r) -> (s -> a -> r) -> r) +newtype ParserM e s a + = Parser (forall r. s -> (s -> e -> r) -> (s -> a -> r) -> r) type Parser = ParserM ParserError ParserState @@ -61,24 +63,25 @@ instance Monad (ParserM e s) where runParser :: ParserState -> Parser a -> (ParserState, Either (NE.NonEmpty ParserError) a) runParser st (Parser k) = k st left right where - left st'@ParserState {..} err = - (st', Left $ NE.sortBy (comparing errRange) $ err NE.:| parserErrors) + left st'@ParserState {..} err = + (st', Left $ NE.sortBy (comparing errRange) $ err NE.:| parserErrors) - right st'@ParserState {..} res - | null parserErrors = (st', Right res) - | otherwise = (st', Left $ NE.fromList $ sortOn errRange parserErrors) + right st'@ParserState {..} res + | null parserErrors = (st', Right res) + | otherwise = (st', Left $ NE.fromList $ sortOn errRange parserErrors) runTokenParser :: Parser a -> [LexResult] -> Either (NE.NonEmpty ParserError) ([ParserWarning], a) runTokenParser p buff = fmap (warnings,) res where - (ParserState _ _ warnings, res) = - runParser initialState p + (ParserState _ _ warnings, res) = + runParser initialState p - initialState = ParserState - { parserBuff = buff - , parserErrors = [] - , parserWarnings = [] - } + initialState = + ParserState + { parserBuff = buff + , parserErrors = [] + , parserWarnings = [] + } {-# INLINE throw #-} throw :: e -> ParserM e s a @@ -86,29 +89,30 @@ throw e = Parser $ \st kerr _ -> kerr st e parseError :: SourceToken -> Parser a parseError tok = Parser $ \st kerr _ -> - kerr st $ ParserErrorInfo - { errRange = tokRange . tokAnn $ tok - , errToks = [tok] - , errStack = [] -- TODO parserStack st - , errType = ErrToken - } + kerr st $ + ParserErrorInfo + { errRange = tokRange . tokAnn $ tok + , errToks = [tok] + , errStack = [] -- TODO parserStack st + , errType = ErrToken + } mkParserError :: LayoutStack -> [SourceToken] -> a -> ParserErrorInfo a mkParserError stack toks ty = ParserErrorInfo - { errRange = range + { errRange = range , errToks = toks , errStack = stack , errType = ty } where - range = case toks of - [] -> SourceRange (SourcePos 0 0) (SourcePos 0 0) - _ -> widen (tokRange . tokAnn $ head toks) (tokRange . tokAnn $ last toks) + range = case toks of + [] -> SourceRange (SourcePos 0 0) (SourcePos 0 0) + _ -> widen (tokRange . tokAnn $ head toks) (tokRange . tokAnn $ last toks) addFailure :: [SourceToken] -> ParserErrorType -> Parser () addFailure toks ty = Parser $ \st _ ksucc -> - ksucc (st { parserErrors = mkParserError [] toks ty : parserErrors st }) () + ksucc (st {parserErrors = mkParserError [] toks ty : parserErrors st}) () parseFail' :: [SourceToken] -> ParserErrorType -> Parser a parseFail' toks msg = Parser $ \st kerr _ -> kerr st (mkParserError [] toks msg) @@ -118,22 +122,25 @@ parseFail = parseFail' . pure addWarning :: [SourceToken] -> ParserWarningType -> Parser () addWarning toks ty = Parser $ \st _ ksucc -> - ksucc (st { parserWarnings = mkParserError [] toks ty : parserWarnings st }) () + ksucc (st {parserWarnings = mkParserError [] toks ty : parserWarnings st}) () pushBack :: SourceToken -> Parser () pushBack tok = Parser $ \st _ ksucc -> - ksucc (st { parserBuff = Right tok : parserBuff st }) () + ksucc (st {parserBuff = Right tok : parserBuff st}) () {-# INLINE tryPrefix #-} tryPrefix :: Parser a -> Parser b -> Parser (Maybe a, b) tryPrefix (Parser lhs) rhs = Parser $ \st kerr ksucc -> - lhs st - (\_ _ -> do - let Parser k = (Nothing,) <$> rhs - k st kerr ksucc) - (\st' res -> do - let Parser k = (Just res,) <$> rhs - k st' kerr ksucc) + lhs + st + ( \_ _ -> do + let Parser k = (Nothing,) <$> rhs + k st kerr ksucc + ) + ( \st' res -> do + let Parser k = (Just res,) <$> rhs + k st' kerr ksucc + ) oneOf :: NE.NonEmpty (Parser a) -> Parser a oneOf parsers = Parser $ \st kerr ksucc -> do @@ -144,28 +151,30 @@ oneOf parsers = Parser $ \st kerr ksucc -> do go (st1, Left errs1) (st2, Left errs2) | errRange (NE.last errs2) > errRange (NE.last errs1) = (st2, Left errs2) | otherwise = (st1, Left errs1) - case foldr1 go $ runParser (st { parserErrors = [] }) <$> parsers of - (st', Left errs) -> kerr (st' { parserErrors = prevErrs <> NE.tail errs}) $ NE.head errs - (st', Right res) -> ksucc (st' { parserErrors = prevErrs }) res + case foldr1 go $ runParser (st {parserErrors = []}) <$> parsers of + (st', Left errs) -> kerr (st' {parserErrors = prevErrs <> NE.tail errs}) $ NE.head errs + (st', Right res) -> ksucc (st' {parserErrors = prevErrs}) res manyDelimited :: Token -> Token -> Token -> Parser a -> Parser [a] manyDelimited open close sep p = do - _ <- token open + _ <- token open res <- go1 - _ <- token close + _ <- token close pure res where - go1 = - oneOf $ NE.fromList - [ go2 . pure =<< p - , pure [] - ] - - go2 acc = - oneOf $ NE.fromList - [ token sep *> (go2 . (: acc) =<< p) - , pure (reverse acc) - ] + go1 = + oneOf $ + NE.fromList + [ go2 . pure =<< p + , pure [] + ] + + go2 acc = + oneOf $ + NE.fromList + [ token sep *> (go2 . (: acc) =<< p) + , pure (reverse acc) + ] token :: Token -> Parser SourceToken token t = do @@ -178,8 +187,8 @@ munch :: Parser SourceToken munch = Parser $ \state@ParserState {..} kerr ksucc -> case parserBuff of Right tok : parserBuff' -> - ksucc (state { parserBuff = parserBuff' }) tok - Left (_, err) : _ -> + ksucc (state {parserBuff = parserBuff'}) tok + Left (_, err) : _ -> kerr state err [] -> error "Empty input" diff --git a/src/Language/PureScript/CST/Parser.hs b/src/Language/PureScript/CST/Parser.hs new file mode 100644 index 000000000..dc40a7612 --- /dev/null +++ b/src/Language/PureScript/CST/Parser.hs @@ -0,0 +1,25082 @@ +{-# OPTIONS_GHC -w #-} + +module Language.PureScript.CST.Parser ( + parseType, + parseExpr, + parseDecl, + parseIdent, + parseOperator, + parseModule, + parseImportDeclP, + parseDeclP, + parseExprP, + parseTypeP, + parseModuleNameP, + parseQualIdentP, + parse, + PartialResult (..), +) where + +import Prelude hiding (lex) + +import Control.Applicative (Applicative (..)) +import Control.Monad (ap, when, (<=<)) +import Data.Array qualified as Happy_Data_Array +import Data.Bifunctor (second) +import Data.Bits qualified as Bits +import Data.Foldable (foldl', for_, toList) +import Data.List.NonEmpty qualified as NE +import Data.Text (Text) +import Data.Traversable (for, sequence) +import Language.PureScript.CST.Errors +import Language.PureScript.CST.Flatten (flattenType) +import Language.PureScript.CST.Lexer +import Language.PureScript.CST.Monad +import Language.PureScript.CST.Positions +import Language.PureScript.CST.Types +import Language.PureScript.CST.Utils +import Language.PureScript.Names qualified as N +import Language.PureScript.PSString (PSString) +import Language.PureScript.Roles qualified as R + +-- parser produced by Happy Version 1.20.1.1 + +data HappyAbsSyn + = HappyTerminal (SourceToken) + | HappyErrorToken Prelude.Int + | HappyAbsSyn26 (Name N.ModuleName) + | HappyAbsSyn27 (QualifiedProperName) + | HappyAbsSyn28 (ProperName) + | HappyAbsSyn29 (QualifiedName Ident) + | HappyAbsSyn30 (Name Ident) + | HappyAbsSyn31 (QualifiedOpName) + | HappyAbsSyn32 (OpName) + | HappyAbsSyn35 (Label) + | HappyAbsSyn37 ((SourceToken, PSString)) + | HappyAbsSyn38 ((SourceToken, Char)) + | HappyAbsSyn39 ((SourceToken, Either Integer Double)) + | HappyAbsSyn40 ((SourceToken, Integer)) + | HappyAbsSyn41 ((SourceToken, Bool)) + | HappyAbsSyn42 (Type ()) + | HappyAbsSyn53 (Row ()) + | HappyAbsSyn54 (Labeled Label (Type ())) + | HappyAbsSyn55 (TypeVarBinding ()) + | HappyAbsSyn57 (SourceToken) + | HappyAbsSyn58 (Where ()) + | HappyAbsSyn59 (Expr ()) + | HappyAbsSyn69 (RecordLabeled (Expr ())) + | HappyAbsSyn70 (Either (RecordLabeled (Expr ())) (RecordUpdate ())) + | HappyAbsSyn71 (RecordUpdate ()) + | HappyAbsSyn72 (LetBinding ()) + | HappyAbsSyn73 ((Separated (Binder ()), Guarded ())) + | HappyAbsSyn74 (Guarded ()) + | HappyAbsSyn75 (GuardedExpr ()) + | HappyAbsSyn78 (DoBlock ()) + | HappyAbsSyn79 ((SourceToken, [DoStatement ()])) + | HappyAbsSyn80 ([DoStatement ()]) + | HappyAbsSyn83 ((SourceToken, Separated (PatternGuard ()))) + | HappyAbsSyn84 ((PatternGuard (), [(SourceToken, PatternGuard ())])) + | HappyAbsSyn85 (Expr ()) + | HappyAbsSyn86 ([(SourceToken, PatternGuard ())]) + | HappyAbsSyn87 ((Binder (), SourceToken)) + | HappyAbsSyn88 (Binder ()) + | HappyAbsSyn92 (RecordLabeled (Binder ())) + | HappyAbsSyn93 (Module ()) + | HappyAbsSyn94 (([Declaration ()], [Comment LineFeed])) + | HappyAbsSyn95 ([ImportDecl ()]) + | HappyAbsSyn97 (([ImportDecl ()], [Declaration ()])) + | HappyAbsSyn98 (TmpModuleDecl ()) + | HappyAbsSyn100 (Maybe (DelimitedNonEmpty (Export ()))) + | HappyAbsSyn101 (Export ()) + | HappyAbsSyn102 ((DataMembers ())) + | HappyAbsSyn103 (ImportDecl ()) + | HappyAbsSyn104 (Maybe (Maybe SourceToken, DelimitedNonEmpty (Import ()))) + | HappyAbsSyn105 (Import ()) + | HappyAbsSyn106 (Declaration ()) + | HappyAbsSyn107 (DataHead ()) + | HappyAbsSyn110 (DataCtor ()) + | HappyAbsSyn111 (Either (Declaration ()) (ClassHead ())) + | HappyAbsSyn112 (Labeled (Name (N.ProperName 'N.TypeName)) (Type ())) + | HappyAbsSyn113 ((OneOrDelimited (Constraint ()), SourceToken)) + | HappyAbsSyn114 ((Name (N.ProperName 'N.ClassName), [TypeVarBinding ()], Maybe (SourceToken, Separated ClassFundep))) + | HappyAbsSyn115 (Maybe (SourceToken, Separated ClassFundep)) + | HappyAbsSyn116 (ClassFundep) + | HappyAbsSyn117 (Labeled (Name Ident) (Type ())) + | HappyAbsSyn118 (InstanceHead ()) + | HappyAbsSyn119 ((SourceToken, NE.NonEmpty (TypeVarBinding ()))) + | HappyAbsSyn120 (OneOrDelimited (Constraint ())) + | HappyAbsSyn121 (Constraint ()) + | HappyAbsSyn122 (InstanceBinding ()) + | HappyAbsSyn123 (FixityFields) + | HappyAbsSyn124 ((SourceToken, Fixity)) + | HappyAbsSyn125 (Role) + | HappyAbsSyn132 (Delimited (Binder ())) + | HappyAbsSyn133 (Delimited (Expr ())) + | HappyAbsSyn134 (Delimited (RecordLabeled (Binder ()))) + | HappyAbsSyn135 (Delimited (RecordLabeled (Expr ()))) + | HappyAbsSyn136 (NE.NonEmpty (Binder ())) + | HappyAbsSyn137 (NE.NonEmpty (GuardedExpr ())) + | HappyAbsSyn139 (NE.NonEmpty (Name Ident)) + | HappyAbsSyn140 (NE.NonEmpty (Role)) + | HappyAbsSyn141 (NE.NonEmpty (TypeVarBinding ())) + | HappyAbsSyn142 ([(Binder ())]) + | HappyAbsSyn143 ([(Type ())]) + | HappyAbsSyn144 ([(TypeVarBinding ())]) + | HappyAbsSyn146 (NE.NonEmpty ((Separated (Binder ()), Guarded ()))) + | HappyAbsSyn147 (NE.NonEmpty (Labeled (Name Ident) (Type ()))) + | HappyAbsSyn148 (NE.NonEmpty (InstanceBinding ())) + | HappyAbsSyn149 (NE.NonEmpty (LetBinding ())) + | HappyAbsSyn150 (NE.NonEmpty (TmpModuleDecl ())) + | HappyAbsSyn151 (Separated (Binder ())) + | HappyAbsSyn152 (Separated (Constraint ())) + | HappyAbsSyn153 (Separated (DataCtor ())) + | HappyAbsSyn154 (Separated (Declaration ())) + | HappyAbsSyn155 (Separated (Export ())) + | HappyAbsSyn156 (Separated (Expr ())) + | HappyAbsSyn157 (Separated (ClassFundep)) + | HappyAbsSyn158 (Separated (Import ())) + | HappyAbsSyn159 (Separated (Label)) + | HappyAbsSyn160 (Separated (ProperName)) + | HappyAbsSyn161 (Separated (RecordUpdate ())) + | HappyAbsSyn162 (Separated (Either (RecordLabeled (Expr ())) (RecordUpdate ()))) + | HappyAbsSyn163 (Separated (Labeled Label (Type ()))) + | HappyAbsSyn164 (NE.NonEmpty (Type ())) + | HappyAbsSyn178 (Separated (RecordLabeled (Binder ()))) + | HappyAbsSyn179 (Separated (RecordLabeled (Expr ()))) + | HappyAbsSyn180 ([(SourceToken, (Binder ()))]) + | HappyAbsSyn181 ([(SourceToken, (Constraint ()))]) + | HappyAbsSyn182 ([(SourceToken, (DataCtor ()))]) + | HappyAbsSyn183 ([(SourceToken, (Declaration ()))]) + | HappyAbsSyn184 ([(SourceToken, (Export ()))]) + | HappyAbsSyn185 ([(SourceToken, (Expr ()))]) + | HappyAbsSyn186 ([(SourceToken, (ClassFundep))]) + | HappyAbsSyn187 ([(SourceToken, (Import ()))]) + | HappyAbsSyn188 ([(SourceToken, (Label))]) + | HappyAbsSyn189 ([(SourceToken, (ProperName))]) + | HappyAbsSyn190 ([(SourceToken, (RecordUpdate ()))]) + | HappyAbsSyn191 ([(SourceToken, (Either (RecordLabeled (Expr ())) (RecordUpdate ())))]) + | HappyAbsSyn192 ([(SourceToken, (Labeled Label (Type ())))]) + | HappyAbsSyn196 ([(SourceToken, (RecordLabeled (Binder ())))]) + | HappyAbsSyn197 ([(SourceToken, (RecordLabeled (Expr ())))]) + +{- to allow type-synonyms as our monads (likely + - with explicitly-specified bind and return) + - in Haskell98, it seems that with + - /type M a = .../, then /(HappyReduction M)/ + - is not allowed. But Happy is a + - code-generator that can just substitute it. +type HappyReduction m = + Prelude.Int + -> (SourceToken) + -> HappyState (SourceToken) (HappyStk HappyAbsSyn -> m HappyAbsSyn) + -> [HappyState (SourceToken) (HappyStk HappyAbsSyn -> m HappyAbsSyn)] + -> HappyStk HappyAbsSyn + -> m HappyAbsSyn +-} + +action_0 + , action_1 + , action_2 + , action_3 + , action_4 + , action_5 + , action_6 + , action_7 + , action_8 + , action_9 + , action_10 + , action_11 + , action_12 + , action_13 + , action_14 + , action_15 + , action_16 + , action_17 + , action_18 + , action_19 + , action_20 + , action_21 + , action_22 + , action_23 + , action_24 + , action_25 + , action_26 + , action_27 + , action_28 + , action_29 + , action_30 + , action_31 + , action_32 + , action_33 + , action_34 + , action_35 + , action_36 + , action_37 + , action_38 + , action_39 + , action_40 + , action_41 + , action_42 + , action_43 + , action_44 + , action_45 + , action_46 + , action_47 + , action_48 + , action_49 + , action_50 + , action_51 + , action_52 + , action_53 + , action_54 + , action_55 + , action_56 + , action_57 + , action_58 + , action_59 + , action_60 + , action_61 + , action_62 + , action_63 + , action_64 + , action_65 + , action_66 + , action_67 + , action_68 + , action_69 + , action_70 + , action_71 + , action_72 + , action_73 + , action_74 + , action_75 + , action_76 + , action_77 + , action_78 + , action_79 + , action_80 + , action_81 + , action_82 + , action_83 + , action_84 + , action_85 + , action_86 + , action_87 + , action_88 + , action_89 + , action_90 + , action_91 + , action_92 + , action_93 + , action_94 + , action_95 + , action_96 + , action_97 + , action_98 + , action_99 + , action_100 + , action_101 + , action_102 + , action_103 + , action_104 + , action_105 + , action_106 + , action_107 + , action_108 + , action_109 + , action_110 + , action_111 + , action_112 + , action_113 + , action_114 + , action_115 + , action_116 + , action_117 + , action_118 + , action_119 + , action_120 + , action_121 + , action_122 + , action_123 + , action_124 + , action_125 + , action_126 + , action_127 + , action_128 + , action_129 + , action_130 + , action_131 + , action_132 + , action_133 + , action_134 + , action_135 + , action_136 + , action_137 + , action_138 + , action_139 + , action_140 + , action_141 + , action_142 + , action_143 + , action_144 + , action_145 + , action_146 + , action_147 + , action_148 + , action_149 + , action_150 + , action_151 + , action_152 + , action_153 + , action_154 + , action_155 + , action_156 + , action_157 + , action_158 + , action_159 + , action_160 + , action_161 + , action_162 + , action_163 + , action_164 + , action_165 + , action_166 + , action_167 + , action_168 + , action_169 + , action_170 + , action_171 + , action_172 + , action_173 + , action_174 + , action_175 + , action_176 + , action_177 + , action_178 + , action_179 + , action_180 + , action_181 + , action_182 + , action_183 + , action_184 + , action_185 + , action_186 + , action_187 + , action_188 + , action_189 + , action_190 + , action_191 + , action_192 + , action_193 + , action_194 + , action_195 + , action_196 + , action_197 + , action_198 + , action_199 + , action_200 + , action_201 + , action_202 + , action_203 + , action_204 + , action_205 + , action_206 + , action_207 + , action_208 + , action_209 + , action_210 + , action_211 + , action_212 + , action_213 + , action_214 + , action_215 + , action_216 + , action_217 + , action_218 + , action_219 + , action_220 + , action_221 + , action_222 + , action_223 + , action_224 + , action_225 + , action_226 + , action_227 + , action_228 + , action_229 + , action_230 + , action_231 + , action_232 + , action_233 + , action_234 + , action_235 + , action_236 + , action_237 + , action_238 + , action_239 + , action_240 + , action_241 + , action_242 + , action_243 + , action_244 + , action_245 + , action_246 + , action_247 + , action_248 + , action_249 + , action_250 + , action_251 + , action_252 + , action_253 + , action_254 + , action_255 + , action_256 + , action_257 + , action_258 + , action_259 + , action_260 + , action_261 + , action_262 + , action_263 + , action_264 + , action_265 + , action_266 + , action_267 + , action_268 + , action_269 + , action_270 + , action_271 + , action_272 + , action_273 + , action_274 + , action_275 + , action_276 + , action_277 + , action_278 + , action_279 + , action_280 + , action_281 + , action_282 + , action_283 + , action_284 + , action_285 + , action_286 + , action_287 + , action_288 + , action_289 + , action_290 + , action_291 + , action_292 + , action_293 + , action_294 + , action_295 + , action_296 + , action_297 + , action_298 + , action_299 + , action_300 + , action_301 + , action_302 + , action_303 + , action_304 + , action_305 + , action_306 + , action_307 + , action_308 + , action_309 + , action_310 + , action_311 + , action_312 + , action_313 + , action_314 + , action_315 + , action_316 + , action_317 + , action_318 + , action_319 + , action_320 + , action_321 + , action_322 + , action_323 + , action_324 + , action_325 + , action_326 + , action_327 + , action_328 + , action_329 + , action_330 + , action_331 + , action_332 + , action_333 + , action_334 + , action_335 + , action_336 + , action_337 + , action_338 + , action_339 + , action_340 + , action_341 + , action_342 + , action_343 + , action_344 + , action_345 + , action_346 + , action_347 + , action_348 + , action_349 + , action_350 + , action_351 + , action_352 + , action_353 + , action_354 + , action_355 + , action_356 + , action_357 + , action_358 + , action_359 + , action_360 + , action_361 + , action_362 + , action_363 + , action_364 + , action_365 + , action_366 + , action_367 + , action_368 + , action_369 + , action_370 + , action_371 + , action_372 + , action_373 + , action_374 + , action_375 + , action_376 + , action_377 + , action_378 + , action_379 + , action_380 + , action_381 + , action_382 + , action_383 + , action_384 + , action_385 + , action_386 + , action_387 + , action_388 + , action_389 + , action_390 + , action_391 + , action_392 + , action_393 + , action_394 + , action_395 + , action_396 + , action_397 + , action_398 + , action_399 + , action_400 + , action_401 + , action_402 + , action_403 + , action_404 + , action_405 + , action_406 + , action_407 + , action_408 + , action_409 + , action_410 + , action_411 + , action_412 + , action_413 + , action_414 + , action_415 + , action_416 + , action_417 + , action_418 + , action_419 + , action_420 + , action_421 + , action_422 + , action_423 + , action_424 + , action_425 + , action_426 + , action_427 + , action_428 + , action_429 + , action_430 + , action_431 + , action_432 + , action_433 + , action_434 + , action_435 + , action_436 + , action_437 + , action_438 + , action_439 + , action_440 + , action_441 + , action_442 + , action_443 + , action_444 + , action_445 + , action_446 + , action_447 + , action_448 + , action_449 + , action_450 + , action_451 + , action_452 + , action_453 + , action_454 + , action_455 + , action_456 + , action_457 + , action_458 + , action_459 + , action_460 + , action_461 + , action_462 + , action_463 + , action_464 + , action_465 + , action_466 + , action_467 + , action_468 + , action_469 + , action_470 + , action_471 + , action_472 + , action_473 + , action_474 + , action_475 + , action_476 + , action_477 + , action_478 + , action_479 + , action_480 + , action_481 + , action_482 + , action_483 + , action_484 + , action_485 + , action_486 + , action_487 + , action_488 + , action_489 + , action_490 + , action_491 + , action_492 + , action_493 + , action_494 + , action_495 + , action_496 + , action_497 + , action_498 + , action_499 + , action_500 + , action_501 + , action_502 + , action_503 + , action_504 + , action_505 + , action_506 + , action_507 + , action_508 + , action_509 + , action_510 + , action_511 + , action_512 + , action_513 + , action_514 + , action_515 + , action_516 + , action_517 + , action_518 + , action_519 + , action_520 + , action_521 + , action_522 + , action_523 + , action_524 + , action_525 + , action_526 + , action_527 + , action_528 + , action_529 + , action_530 + , action_531 + , action_532 + , action_533 + , action_534 + , action_535 + , action_536 + , action_537 + , action_538 + , action_539 + , action_540 + , action_541 + , action_542 + , action_543 + , action_544 + , action_545 + , action_546 + , action_547 + , action_548 + , action_549 + , action_550 + , action_551 + , action_552 + , action_553 + , action_554 + , action_555 + , action_556 + , action_557 + , action_558 + , action_559 + , action_560 + , action_561 + , action_562 + , action_563 + , action_564 + , action_565 + , action_566 + , action_567 + , action_568 + , action_569 + , action_570 + , action_571 + , action_572 + , action_573 + , action_574 + , action_575 + , action_576 + , action_577 + , action_578 + , action_579 + , action_580 + , action_581 + , action_582 + , action_583 + , action_584 + , action_585 + , action_586 + , action_587 + , action_588 + , action_589 + , action_590 + , action_591 + , action_592 + , action_593 + , action_594 + , action_595 + , action_596 + , action_597 + , action_598 + , action_599 + , action_600 + , action_601 + , action_602 + , action_603 + , action_604 + , action_605 + , action_606 + , action_607 + , action_608 + , action_609 + , action_610 + , action_611 + , action_612 + , action_613 + , action_614 + , action_615 + , action_616 + , action_617 + , action_618 + , action_619 + , action_620 + , action_621 + , action_622 + , action_623 + , action_624 + , action_625 + , action_626 + , action_627 + , action_628 + , action_629 + , action_630 + , action_631 + , action_632 + , action_633 + , action_634 + , action_635 + , action_636 + , action_637 + , action_638 + , action_639 + , action_640 + , action_641 + , action_642 + , action_643 + , action_644 + , action_645 + , action_646 + , action_647 + , action_648 + , action_649 + , action_650 + , action_651 + , action_652 + , action_653 + , action_654 + , action_655 + , action_656 + , action_657 + , action_658 + , action_659 + , action_660 + , action_661 + , action_662 + , action_663 + , action_664 + , action_665 + , action_666 + , action_667 + , action_668 + , action_669 + , action_670 + , action_671 + , action_672 + , action_673 + , action_674 + , action_675 + , action_676 + , action_677 + , action_678 + , action_679 + , action_680 + , action_681 + , action_682 + , action_683 + , action_684 + , action_685 + , action_686 + , action_687 + , action_688 + , action_689 + , action_690 + , action_691 + , action_692 + , action_693 + , action_694 + , action_695 + , action_696 + , action_697 + , action_698 + , action_699 + , action_700 + , action_701 + , action_702 + , action_703 + , action_704 + , action_705 + , action_706 + , action_707 :: + () => + Prelude.Int -> + ( {-HappyReduction (Parser) = -} + Prelude.Int -> + (SourceToken) -> + HappyState (SourceToken) (HappyStk HappyAbsSyn -> (Parser) HappyAbsSyn) -> + [HappyState (SourceToken) (HappyStk HappyAbsSyn -> (Parser) HappyAbsSyn)] -> + HappyStk HappyAbsSyn -> + (Parser) HappyAbsSyn + ) +happyReduce_23 + , happyReduce_24 + , happyReduce_25 + , happyReduce_26 + , happyReduce_27 + , happyReduce_28 + , happyReduce_29 + , happyReduce_30 + , happyReduce_31 + , happyReduce_32 + , happyReduce_33 + , happyReduce_34 + , happyReduce_35 + , happyReduce_36 + , happyReduce_37 + , happyReduce_38 + , happyReduce_39 + , happyReduce_40 + , happyReduce_41 + , happyReduce_42 + , happyReduce_43 + , happyReduce_44 + , happyReduce_45 + , happyReduce_46 + , happyReduce_47 + , happyReduce_48 + , happyReduce_49 + , happyReduce_50 + , happyReduce_51 + , happyReduce_52 + , happyReduce_53 + , happyReduce_54 + , happyReduce_55 + , happyReduce_56 + , happyReduce_57 + , happyReduce_58 + , happyReduce_59 + , happyReduce_60 + , happyReduce_61 + , happyReduce_62 + , happyReduce_63 + , happyReduce_64 + , happyReduce_65 + , happyReduce_66 + , happyReduce_67 + , happyReduce_68 + , happyReduce_69 + , happyReduce_70 + , happyReduce_71 + , happyReduce_72 + , happyReduce_73 + , happyReduce_74 + , happyReduce_75 + , happyReduce_76 + , happyReduce_77 + , happyReduce_78 + , happyReduce_79 + , happyReduce_80 + , happyReduce_81 + , happyReduce_82 + , happyReduce_83 + , happyReduce_84 + , happyReduce_85 + , happyReduce_86 + , happyReduce_87 + , happyReduce_88 + , happyReduce_89 + , happyReduce_90 + , happyReduce_91 + , happyReduce_92 + , happyReduce_93 + , happyReduce_94 + , happyReduce_95 + , happyReduce_96 + , happyReduce_97 + , happyReduce_98 + , happyReduce_99 + , happyReduce_100 + , happyReduce_101 + , happyReduce_102 + , happyReduce_103 + , happyReduce_104 + , happyReduce_105 + , happyReduce_106 + , happyReduce_107 + , happyReduce_108 + , happyReduce_109 + , happyReduce_110 + , happyReduce_111 + , happyReduce_112 + , happyReduce_113 + , happyReduce_114 + , happyReduce_115 + , happyReduce_116 + , happyReduce_117 + , happyReduce_118 + , happyReduce_119 + , happyReduce_120 + , happyReduce_121 + , happyReduce_122 + , happyReduce_123 + , happyReduce_124 + , happyReduce_125 + , happyReduce_126 + , happyReduce_127 + , happyReduce_128 + , happyReduce_129 + , happyReduce_130 + , happyReduce_131 + , happyReduce_132 + , happyReduce_133 + , happyReduce_134 + , happyReduce_135 + , happyReduce_136 + , happyReduce_137 + , happyReduce_138 + , happyReduce_139 + , happyReduce_140 + , happyReduce_141 + , happyReduce_142 + , happyReduce_143 + , happyReduce_144 + , happyReduce_145 + , happyReduce_146 + , happyReduce_147 + , happyReduce_148 + , happyReduce_149 + , happyReduce_150 + , happyReduce_151 + , happyReduce_152 + , happyReduce_153 + , happyReduce_154 + , happyReduce_155 + , happyReduce_156 + , happyReduce_157 + , happyReduce_158 + , happyReduce_159 + , happyReduce_160 + , happyReduce_161 + , happyReduce_162 + , happyReduce_163 + , happyReduce_164 + , happyReduce_165 + , happyReduce_166 + , happyReduce_167 + , happyReduce_168 + , happyReduce_169 + , happyReduce_170 + , happyReduce_171 + , happyReduce_172 + , happyReduce_173 + , happyReduce_174 + , happyReduce_175 + , happyReduce_176 + , happyReduce_177 + , happyReduce_178 + , happyReduce_179 + , happyReduce_180 + , happyReduce_181 + , happyReduce_182 + , happyReduce_183 + , happyReduce_184 + , happyReduce_185 + , happyReduce_186 + , happyReduce_187 + , happyReduce_188 + , happyReduce_189 + , happyReduce_190 + , happyReduce_191 + , happyReduce_192 + , happyReduce_193 + , happyReduce_194 + , happyReduce_195 + , happyReduce_196 + , happyReduce_197 + , happyReduce_198 + , happyReduce_199 + , happyReduce_200 + , happyReduce_201 + , happyReduce_202 + , happyReduce_203 + , happyReduce_204 + , happyReduce_205 + , happyReduce_206 + , happyReduce_207 + , happyReduce_208 + , happyReduce_209 + , happyReduce_210 + , happyReduce_211 + , happyReduce_212 + , happyReduce_213 + , happyReduce_214 + , happyReduce_215 + , happyReduce_216 + , happyReduce_217 + , happyReduce_218 + , happyReduce_219 + , happyReduce_220 + , happyReduce_221 + , happyReduce_222 + , happyReduce_223 + , happyReduce_224 + , happyReduce_225 + , happyReduce_226 + , happyReduce_227 + , happyReduce_228 + , happyReduce_229 + , happyReduce_230 + , happyReduce_231 + , happyReduce_232 + , happyReduce_233 + , happyReduce_234 + , happyReduce_235 + , happyReduce_236 + , happyReduce_237 + , happyReduce_238 + , happyReduce_239 + , happyReduce_240 + , happyReduce_241 + , happyReduce_242 + , happyReduce_243 + , happyReduce_244 + , happyReduce_245 + , happyReduce_246 + , happyReduce_247 + , happyReduce_248 + , happyReduce_249 + , happyReduce_250 + , happyReduce_251 + , happyReduce_252 + , happyReduce_253 + , happyReduce_254 + , happyReduce_255 + , happyReduce_256 + , happyReduce_257 + , happyReduce_258 + , happyReduce_259 + , happyReduce_260 + , happyReduce_261 + , happyReduce_262 + , happyReduce_263 + , happyReduce_264 + , happyReduce_265 + , happyReduce_266 + , happyReduce_267 + , happyReduce_268 + , happyReduce_269 + , happyReduce_270 + , happyReduce_271 + , happyReduce_272 + , happyReduce_273 + , happyReduce_274 + , happyReduce_275 + , happyReduce_276 + , happyReduce_277 + , happyReduce_278 + , happyReduce_279 + , happyReduce_280 + , happyReduce_281 + , happyReduce_282 + , happyReduce_283 + , happyReduce_284 + , happyReduce_285 + , happyReduce_286 + , happyReduce_287 + , happyReduce_288 + , happyReduce_289 + , happyReduce_290 + , happyReduce_291 + , happyReduce_292 + , happyReduce_293 + , happyReduce_294 + , happyReduce_295 + , happyReduce_296 + , happyReduce_297 + , happyReduce_298 + , happyReduce_299 + , happyReduce_300 + , happyReduce_301 + , happyReduce_302 + , happyReduce_303 + , happyReduce_304 + , happyReduce_305 + , happyReduce_306 + , happyReduce_307 + , happyReduce_308 + , happyReduce_309 + , happyReduce_310 + , happyReduce_311 + , happyReduce_312 + , happyReduce_313 + , happyReduce_314 + , happyReduce_315 + , happyReduce_316 + , happyReduce_317 + , happyReduce_318 + , happyReduce_319 + , happyReduce_320 + , happyReduce_321 + , happyReduce_322 + , happyReduce_323 + , happyReduce_324 + , happyReduce_325 + , happyReduce_326 + , happyReduce_327 + , happyReduce_328 + , happyReduce_329 + , happyReduce_330 + , happyReduce_331 + , happyReduce_332 + , happyReduce_333 + , happyReduce_334 + , happyReduce_335 + , happyReduce_336 + , happyReduce_337 + , happyReduce_338 + , happyReduce_339 + , happyReduce_340 + , happyReduce_341 + , happyReduce_342 + , happyReduce_343 + , happyReduce_344 + , happyReduce_345 + , happyReduce_346 + , happyReduce_347 + , happyReduce_348 + , happyReduce_349 + , happyReduce_350 + , happyReduce_351 + , happyReduce_352 + , happyReduce_353 + , happyReduce_354 + , happyReduce_355 + , happyReduce_356 + , happyReduce_357 + , happyReduce_358 + , happyReduce_359 + , happyReduce_360 + , happyReduce_361 + , happyReduce_362 + , happyReduce_363 + , happyReduce_364 + , happyReduce_365 + , happyReduce_366 + , happyReduce_367 + , happyReduce_368 + , happyReduce_369 + , happyReduce_370 + , happyReduce_371 + , happyReduce_372 + , happyReduce_373 + , happyReduce_374 + , happyReduce_375 + , happyReduce_376 + , happyReduce_377 + , happyReduce_378 + , happyReduce_379 + , happyReduce_380 + , happyReduce_381 + , happyReduce_382 + , happyReduce_383 + , happyReduce_384 + , happyReduce_385 + , happyReduce_386 + , happyReduce_387 + , happyReduce_388 + , happyReduce_389 + , happyReduce_390 + , happyReduce_391 + , happyReduce_392 + , happyReduce_393 + , happyReduce_394 + , happyReduce_395 + , happyReduce_396 + , happyReduce_397 + , happyReduce_398 + , happyReduce_399 + , happyReduce_400 + , happyReduce_401 + , happyReduce_402 + , happyReduce_403 + , happyReduce_404 + , happyReduce_405 + , happyReduce_406 + , happyReduce_407 + , happyReduce_408 + , happyReduce_409 + , happyReduce_410 + , happyReduce_411 + , happyReduce_412 + , happyReduce_413 + , happyReduce_414 + , happyReduce_415 + , happyReduce_416 + , happyReduce_417 + , happyReduce_418 + , happyReduce_419 + , happyReduce_420 + , happyReduce_421 + , happyReduce_422 + , happyReduce_423 + , happyReduce_424 + , happyReduce_425 + , happyReduce_426 + , happyReduce_427 + , happyReduce_428 + , happyReduce_429 + , happyReduce_430 + , happyReduce_431 + , happyReduce_432 + , happyReduce_433 + , happyReduce_434 + , happyReduce_435 + , happyReduce_436 + , happyReduce_437 + , happyReduce_438 + , happyReduce_439 + , happyReduce_440 + , happyReduce_441 + , happyReduce_442 + , happyReduce_443 + , happyReduce_444 + , happyReduce_445 :: + () => + ( {-HappyReduction (Parser) = -} + Prelude.Int -> + (SourceToken) -> + HappyState (SourceToken) (HappyStk HappyAbsSyn -> (Parser) HappyAbsSyn) -> + [HappyState (SourceToken) (HappyStk HappyAbsSyn -> (Parser) HappyAbsSyn)] -> + HappyStk HappyAbsSyn -> + (Parser) HappyAbsSyn + ) +happyExpList :: Happy_Data_Array.Array Prelude.Int Prelude.Int +happyExpList = + Happy_Data_Array.listArray + (0, 5747) + ( [ 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 672 + , 18944 + , 704 + , 57776 + , 3742 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 168 + , 15232 + , 33418 + , 61804 + , 2023 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 1024 + , 32 + , 2075 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 5120 + , 32 + , 0 + , 32768 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 1856 + , 47591 + , 137 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 49616 + , 28280 + , 34 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 16384 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 35869 + , 9959 + , 2 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 672 + , 60928 + , 2600 + , 50610 + , 8095 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 168 + , 4736 + , 176 + , 47212 + , 935 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 24576 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 256 + , 49160 + , 1542 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 1024 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 128 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 10752 + , 57344 + , 41614 + , 23328 + , 63996 + , 1 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 49152 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 672 + , 60928 + , 2600 + , 50610 + , 8095 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 64 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 2048 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 8192 + , 0 + , 0 + , 0 + , 1536 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 128 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 10752 + , 40960 + , 8708 + , 23296 + , 61544 + , 1 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 8 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 256 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 16384 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 16384 + , 515 + , 0 + , 0 + , 24 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 2688 + , 2048 + , 2177 + , 5824 + , 31770 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 672 + , 18944 + , 544 + , 34224 + , 7942 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 64 + , 63488 + , 65503 + , 10239 + , 384 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 106 + , 1184 + , 34 + , 26715 + , 496 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 24 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 2048 + , 0 + , 32788 + , 27648 + , 32 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 672 + , 16896 + , 512 + , 57776 + , 3742 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 4096 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 8192 + , 0 + , 0 + , 0 + , 1536 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 512 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 20480 + , 128 + , 0 + , 0 + , 6 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 1 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 43008 + , 32768 + , 35389 + , 27778 + , 59377 + , 7 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 128 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 32 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 64 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 2688 + , 47104 + , 10403 + , 5832 + , 32383 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 256 + , 57344 + , 65407 + , 40959 + , 1536 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 424 + , 15232 + , 33418 + , 61804 + , 2023 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 32768 + , 10 + , 33032 + , 49160 + , 6678 + , 124 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 40960 + , 2 + , 10478 + , 45578 + , 40901 + , 31 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 2 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 2688 + , 47104 + , 10403 + , 5832 + , 32383 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 2048 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 42 + , 36576 + , 8354 + , 64603 + , 505 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 32 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 53248 + , 128 + , 0 + , 0 + , 6 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 2 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 24 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 2048 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 32888 + , 0 + , 0 + , 1536 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 672 + , 16896 + , 512 + , 57776 + , 3742 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 2 + , 1280 + , 32 + , 2075 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 40960 + , 2 + , 49226 + , 45058 + , 40673 + , 14 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 2048 + , 57336 + , 65535 + , 32807 + , 1 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 512 + , 63486 + , 65535 + , 24585 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 2048 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 2688 + , 2080 + , 2177 + , 5824 + , 31770 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 4 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 1 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 16384 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 16 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 4 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 8192 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 8192 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 9216 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 4 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 32 + , 0 + , 192 + , 0 + , 6 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 32768 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 8208 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 384 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 4096 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 2 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 64 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 16384 + , 58119 + , 35257 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 2048 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 29696 + , 40560 + , 2203 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 8192 + , 0 + , 0 + , 2 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 2048 + , 512 + , 32784 + , 27648 + , 32 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 32 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 128 + , 32 + , 2049 + , 1728 + , 2 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 672 + , 16896 + , 512 + , 57776 + , 3742 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 8 + , 5120 + , 128 + , 8300 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 2 + , 0 + , 0 + , 24576 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 2048 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 576 + , 45058 + , 129 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 16 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 128 + , 32 + , 2049 + , 1728 + , 2 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 16384 + , 512 + , 35248 + , 7 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 512 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 128 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 2048 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 40960 + , 2 + , 49226 + , 45058 + , 40673 + , 14 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 128 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 192 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 672 + , 18944 + , 704 + , 57776 + , 3742 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 32768 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 16 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 2048 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 4096 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 2688 + , 10240 + , 2817 + , 34496 + , 14971 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 16 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 256 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 8 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 168 + , 4736 + , 176 + , 47212 + , 935 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 65026 + , 65527 + , 2559 + , 96 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 32768 + , 65408 + , 65533 + , 639 + , 24 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 512 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 32 + , 20480 + , 512 + , 33200 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 5120 + , 128 + , 8300 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 1024 + , 32 + , 2075 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 40960 + , 2 + , 74 + , 45058 + , 40673 + , 14 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 43008 + , 32768 + , 45074 + , 27648 + , 42936 + , 3 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 2688 + , 10240 + , 2817 + , 34496 + , 14971 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 8192 + , 0 + , 2 + , 0 + , 34304 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 2048 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 10752 + , 40960 + , 8708 + , 23296 + , 61544 + , 1 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 2688 + , 47104 + , 10403 + , 5832 + , 32383 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 672 + , 18944 + , 704 + , 57776 + , 3742 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 168 + , 4736 + , 136 + , 41324 + , 1985 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 32 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 4096 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 4096 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 16384 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 8192 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 64 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 5120 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 4096 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 1024 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 16 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 42 + , 36576 + , 8354 + , 64603 + , 505 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 65408 + , 65533 + , 639 + , 24 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 1 + , 32736 + , 65535 + , 159 + , 6 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 10752 + , 8192 + , 8196 + , 6912 + , 59886 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 2688 + , 47104 + , 10403 + , 5832 + , 32383 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 672 + , 18944 + , 704 + , 57776 + , 3742 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 16 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 4 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 4 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 8192 + , 0 + , 0 + , 0 + , 1536 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 168 + , 4224 + , 128 + , 47212 + , 935 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 32768 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 16384 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 1024 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 5 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 4 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 1 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 1024 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 672 + , 18944 + , 544 + , 34224 + , 7942 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 168 + , 4736 + , 176 + , 47212 + , 935 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 32768 + , 10 + , 33032 + , 49160 + , 6678 + , 124 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 57344 + , 65407 + , 40959 + , 1536 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 42 + , 1184 + , 34 + , 26715 + , 496 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 32768 + , 10 + , 33064 + , 49160 + , 6678 + , 124 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 40960 + , 2 + , 8266 + , 45058 + , 1669 + , 31 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 2 + , 2049 + , 1728 + , 2 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 16 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 2 + , 0 + , 0 + , 24576 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 33872 + , 0 + , 0 + , 1536 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 32 + , 5 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 4 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 1 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 128 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 65408 + , 65533 + , 639 + , 24 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 43008 + , 32768 + , 35387 + , 27778 + , 59377 + , 7 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 10752 + , 57344 + , 41614 + , 23328 + , 63996 + , 1 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 672 + , 60928 + , 2600 + , 50610 + , 8095 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 42 + , 36576 + , 8354 + , 64603 + , 505 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 32 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 40960 + , 2 + , 10478 + , 45578 + , 40901 + , 31 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 43008 + , 36352 + , 34836 + , 27648 + , 49569 + , 7 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 8276 + , 0 + , 0 + , 384 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 4096 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 2048 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 1 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 16 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 4 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 8212 + , 39744 + , 172 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 2050 + , 32 + , 0 + , 24576 + , 8 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 8192 + , 0 + , 2 + , 0 + , 34304 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 32768 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 256 + , 49160 + , 518 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 43008 + , 32768 + , 45074 + , 27648 + , 42936 + , 3 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 16384 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 1024 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 64 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 2 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 2 + , 32 + , 0 + , 24576 + , 8 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 63486 + , 65535 + , 24585 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 2688 + , 10240 + , 2817 + , 34496 + , 14971 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 168 + , 4736 + , 176 + , 47212 + , 935 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 1024 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 128 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 672 + , 60928 + , 2600 + , 50610 + , 8095 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 42 + , 1056 + , 32 + , 60955 + , 233 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 2048 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 2688 + , 2048 + , 2049 + , 34496 + , 14971 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 16384 + , 512 + , 33200 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 4096 + , 128 + , 8300 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 1024 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 256 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 1536 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 8 + , 4096 + , 128 + , 8300 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 1024 + , 32 + , 2075 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 32768 + , 10 + , 296 + , 49163 + , 31622 + , 58 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 512 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 32 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 24 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 672 + , 16896 + , 512 + , 57776 + , 3742 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 32768 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 8 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 43008 + , 32768 + , 45074 + , 27648 + , 42936 + , 3 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 2816 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 672 + , 18944 + , 704 + , 57776 + , 3742 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 4096 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 5120 + , 32 + , 44187 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 32768 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 2053 + , 9920 + , 43 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 32 + , 0 + , 0 + , 16384 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 16384 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 16384 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 32 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 33 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 24576 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 2816 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 1536 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 10752 + , 8192 + , 8196 + , 6912 + , 59886 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 32 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 672 + , 18944 + , 704 + , 57776 + , 3742 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 32768 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 64 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 320 + , 2 + , 0 + , 2048 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 32848 + , 0 + , 0 + , 512 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 2688 + , 2080 + , 2177 + , 5824 + , 31770 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 1024 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 512 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 8192 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 4 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 2 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 2 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 64 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 43008 + , 32768 + , 35387 + , 27778 + , 59377 + , 7 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 16 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 2 + , 32 + , 0 + , 24576 + , 8 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 32 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 32 + , 512 + , 0 + , 0 + , 134 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 16 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 32768 + , 0 + , 8 + , 0 + , 6144 + , 2 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 8192 + , 0 + , 0 + , 0 + , 64 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 64 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 64 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 8192 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 6144 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 2112 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 2 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 2688 + , 10240 + , 2177 + , 5824 + , 31770 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 4096 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 168 + , 15232 + , 33418 + , 61804 + , 2023 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 49152 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 40960 + , 2 + , 49226 + , 45058 + , 40673 + , 14 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 1024 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 10752 + , 40960 + , 8708 + , 23296 + , 61544 + , 1 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 32736 + , 65535 + , 159 + , 6 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 57336 + , 65535 + , 32807 + , 1 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 32768 + , 65023 + , 32767 + , 6146 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 672 + , 60928 + , 2600 + , 50610 + , 8095 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 168 + , 15232 + , 33418 + , 61804 + , 2023 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 42 + , 36576 + , 8354 + , 64603 + , 505 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 32768 + , 10 + , 41912 + , 51240 + , 32534 + , 126 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 2 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 4096 + , 128 + , 8300 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 16 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 256 + , 49160 + , 518 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 8192 + , 4096 + , 128 + , 8300 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 256 + , 49160 + , 518 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 128 + , 16 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 16 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 4 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 8212 + , 0 + , 0 + , 384 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 4096 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 9216 + , 8 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 512 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 4 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 40960 + , 2 + , 10478 + , 45578 + , 40901 + , 31 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 672 + , 60928 + , 2600 + , 50610 + , 8095 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 8212 + , 39744 + , 172 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 16 + , 0 + , 0 + , 32768 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 4096 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 512 + , 8192 + , 0 + , 0 + , 2144 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 256 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 128 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 64 + , 45058 + , 129 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 10752 + , 40960 + , 11268 + , 6912 + , 59886 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 2049 + , 1728 + , 2 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 12 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 42 + , 1184 + , 44 + , 60955 + , 233 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 320 + , 2 + , 0 + , 2048 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 512 + , 8192 + , 0 + , 0 + , 2144 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 672 + , 18944 + , 704 + , 57776 + , 3742 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 42 + , 1056 + , 32 + , 60955 + , 233 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 2053 + , 9920 + , 43 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 4 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 256 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 10752 + , 40960 + , 8708 + , 23296 + , 61544 + , 1 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 64 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 1 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 1 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 1024 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 32768 + , 10 + , 33064 + , 49160 + , 6678 + , 124 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 40960 + , 2 + , 8266 + , 45058 + , 1669 + , 31 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 2 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 8 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 2048 + , 2 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 32768 + , 74 + , 41912 + , 51240 + , 32534 + , 126 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 57336 + , 65535 + , 32807 + , 1 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 32768 + , 65023 + , 32767 + , 6146 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 672 + , 60928 + , 2600 + , 50610 + , 8095 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 1 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 2688 + , 47104 + , 10403 + , 5832 + , 32383 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 168 + , 15232 + , 33418 + , 61804 + , 2023 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 32768 + , 10 + , 41912 + , 51240 + , 32534 + , 126 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 2080 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 32848 + , 0 + , 0 + , 1536 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 49152 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 2 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 64 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + , 0 + ] + ) + +{-# NOINLINE happyExpListPerState #-} +happyExpListPerState st = + token_strs_expected + where + token_strs = ["error", "%dummy", "%start_parseType", "%start_parseExpr", "%start_parseIdent", "%start_parseOperator", "%start_parseModuleBody", "%start_parseDecl", "%start_parseImportDeclP", "%start_parseDeclP", "%start_parseExprP", "%start_parseTypeP", "%start_parseModuleNameP", "%start_parseQualIdentP", "%start_parseModuleHeader", "%start_parseDoStatement", "%start_parseDoExpr", "%start_parseDoNext", "%start_parseGuardExpr", "%start_parseGuardNext", "%start_parseGuardStatement", "%start_parseClassSignature", "%start_parseClassSuper", "%start_parseClassNameAndFundeps", "%start_parseBinderAndArrow", "moduleName", "qualProperName", "properName", "qualIdent", "ident", "qualOp", "op", "qualSymbol", "symbol", "label", "hole", "string", "char", "number", "int", "boolean", "kind", "kind1", "kindAtom", "type", "type1", "type2", "type3", "type4", "type5", "typeAtom", "typeKindedAtom", "row", "rowLabel", "typeVarBinding", "typeVarBindingPlain", "forall", "exprWhere", "expr", "expr1", "expr2", "exprBacktick", "expr3", "expr4", "expr5", "expr6", "expr7", "exprAtom", "recordLabel", "recordUpdateOrLabel", "recordUpdate", "letBinding", "caseBranch", "guardedDecl", "guardedDeclExpr", "guardedCase", "guardedCaseExpr", "doBlock", "adoBlock", "doStatement", "doExpr", "doNext", "guard", "guardStatement", "guardExpr", "guardNext", "binderAndArrow", "binder", "binder1", "binder2", "binderAtom", "recordBinder", "moduleHeader", "moduleBody", "moduleImports", "importDecls", "moduleDecls", "moduleDecl", "declElse", "exports", "export", "dataMembers", "importDecl", "imports", "import", "decl", "dataHead", "typeHead", "newtypeHead", "dataCtor", "classHead", "classSignature", "classSuper", "classNameAndFundeps", "fundeps", "fundep", "classMember", "instHead", "instForall", "constraints", "constraint", "instBinding", "fixity", "infix", "role", "importDeclP", "declP", "exprP", "typeP", "moduleNameP", "qualIdentP", "delim__'['__binder__','__']'__", "delim__'['__expr__','__']'__", "delim__'{'__recordBinder__','__'}'__", "delim__'{'__recordLabel__','__'}'__", "many__binderAtom__", "many__guardedCaseExpr__", "many__guardedDeclExpr__", "many__ident__", "many__role__", "many__typeVarBinding__", "manyOrEmpty__binderAtom__", "manyOrEmpty__typeAtom__", "manyOrEmpty__typeVarBinding__", "manyOrEmpty__typeVarBindingPlain__", "manySep__caseBranch__'\\;'__", "manySep__classMember__'\\;'__", "manySep__instBinding__'\\;'__", "manySep__letBinding__'\\;'__", "manySep__moduleDecl__'\\;'__", "sep__binder1__','__", "sep__constraint__','__", "sep__dataCtor__'|'__", "sep__decl__declElse__", "sep__export__','__", "sep__expr__','__", "sep__fundep__','__", "sep__import__','__", "sep__label__'.'__", "sep__properName__','__", "sep__recordUpdate__','__", "sep__recordUpdateOrLabel__','__", "sep__rowLabel__','__", "many__typeAtom__", "many__typeVarBindingPlain__", "many1__binderAtom__", "many1__guardedCaseExpr__", "many1__guardedDeclExpr__", "many1__ident__", "many1__role__", "many1__typeVarBinding__", "manySep1__caseBranch__'\\;'__", "manySep1__classMember__'\\;'__", "manySep1__instBinding__'\\;'__", "manySep1__letBinding__'\\;'__", "manySep1__moduleDecl__'\\;'__", "sep__binder__','__", "sep__recordBinder__','__", "sep__recordLabel__','__", "sep1__binder1__','__", "sep1__constraint__','__", "sep1__dataCtor__'|'__", "sep1__decl__declElse__", "sep1__export__','__", "sep1__expr__','__", "sep1__fundep__','__", "sep1__import__','__", "sep1__label__'.'__", "sep1__properName__','__", "sep1__recordUpdate__','__", "sep1__recordUpdateOrLabel__','__", "sep1__rowLabel__','__", "many1__typeAtom__", "many1__typeVarBindingPlain__", "sep1__binder__','__", "sep1__recordBinder__','__", "sep1__recordLabel__','__", "'('", "')'", "'{'", "'}'", "'['", "']'", "'\\{'", "'\\}'", "'\\;'", "'<-'", "'->'", "'<='", "'=>'", "':'", "'::'", "'='", "'|'", "'`'", "'.'", "','", "'_'", "'\\\\'", "'-'", "'@'", "'ado'", "'as'", "'case'", "'class'", "'data'", "'derive'", "'do'", "'else'", "'false'", "'forall'", "'forallu'", "'foreign'", "'hiding'", "'import'", "'if'", "'in'", "'infix'", "'infixl'", "'infixr'", "'instance'", "'let'", "'module'", "'newtype'", "'nominal'", "'phantom'", "'of'", "'representational'", "'role'", "'then'", "'true'", "'type'", "'where'", "'(->)'", "'(..)'", "LOWER", "QUAL_LOWER", "UPPER", "QUAL_UPPER", "SYMBOL", "QUAL_SYMBOL", "OPERATOR", "QUAL_OPERATOR", "LIT_HOLE", "LIT_CHAR", "LIT_STRING", "LIT_RAW_STRING", "LIT_INT", "LIT_NUMBER", "%eof"] + bit_start = st Prelude.* 270 + bit_end = (st Prelude.+ 1) Prelude.* 270 + read_bit = readArrayBit happyExpList + bits = Prelude.map read_bit [bit_start .. bit_end Prelude.- 1] + bits_indexed = Prelude.zip bits [0 .. 269] + token_strs_expected = Prelude.concatMap f bits_indexed + f (Prelude.False, _) = [] + f (Prelude.True, nr) = [token_strs Prelude.!! nr] + +action_0 (198) = happyShift action_148 +action_0 (200) = happyShift action_149 +action_0 (202) = happyShift action_150 +action_0 (218) = happyShift action_151 +action_0 (220) = happyShift action_152 +action_0 (223) = happyShift action_45 +action_0 (231) = happyShift action_153 +action_0 (232) = happyShift action_154 +action_0 (234) = happyShift action_47 +action_0 (245) = happyShift action_48 +action_0 (246) = happyShift action_49 +action_0 (248) = happyShift action_50 +action_0 (249) = happyShift action_51 +action_0 (254) = happyShift action_155 +action_0 (255) = happyShift action_112 +action_0 (256) = happyShift action_53 +action_0 (258) = happyShift action_54 +action_0 (259) = happyShift action_55 +action_0 (260) = happyShift action_115 +action_0 (261) = happyShift action_116 +action_0 (264) = happyShift action_117 +action_0 (266) = happyShift action_57 +action_0 (267) = happyShift action_58 +action_0 (268) = happyShift action_156 +action_0 (27) = happyGoto action_133 +action_0 (30) = happyGoto action_134 +action_0 (33) = happyGoto action_135 +action_0 (36) = happyGoto action_136 +action_0 (37) = happyGoto action_137 +action_0 (40) = happyGoto action_138 +action_0 (45) = happyGoto action_199 +action_0 (46) = happyGoto action_140 +action_0 (47) = happyGoto action_141 +action_0 (48) = happyGoto action_142 +action_0 (49) = happyGoto action_143 +action_0 (50) = happyGoto action_144 +action_0 (51) = happyGoto action_145 +action_0 (57) = happyGoto action_146 +action_0 _ = happyFail (happyExpListPerState 0) + +action_1 (198) = happyShift action_95 +action_1 (200) = happyShift action_96 +action_1 (202) = happyShift action_97 +action_1 (218) = happyShift action_98 +action_1 (219) = happyShift action_99 +action_1 (220) = happyShift action_100 +action_1 (222) = happyShift action_101 +action_1 (223) = happyShift action_102 +action_1 (224) = happyShift action_103 +action_1 (228) = happyShift action_104 +action_1 (230) = happyShift action_46 +action_1 (234) = happyShift action_105 +action_1 (236) = happyShift action_106 +action_1 (242) = happyShift action_107 +action_1 (245) = happyShift action_108 +action_1 (246) = happyShift action_109 +action_1 (248) = happyShift action_110 +action_1 (249) = happyShift action_111 +action_1 (251) = happyShift action_52 +action_1 (255) = happyShift action_112 +action_1 (256) = happyShift action_113 +action_1 (257) = happyShift action_114 +action_1 (258) = happyShift action_54 +action_1 (259) = happyShift action_55 +action_1 (260) = happyShift action_115 +action_1 (261) = happyShift action_116 +action_1 (264) = happyShift action_117 +action_1 (265) = happyShift action_56 +action_1 (266) = happyShift action_57 +action_1 (267) = happyShift action_58 +action_1 (268) = happyShift action_59 +action_1 (269) = happyShift action_60 +action_1 (27) = happyGoto action_74 +action_1 (29) = happyGoto action_75 +action_1 (33) = happyGoto action_76 +action_1 (36) = happyGoto action_77 +action_1 (37) = happyGoto action_78 +action_1 (38) = happyGoto action_79 +action_1 (39) = happyGoto action_80 +action_1 (41) = happyGoto action_81 +action_1 (59) = happyGoto action_198 +action_1 (60) = happyGoto action_122 +action_1 (61) = happyGoto action_83 +action_1 (63) = happyGoto action_84 +action_1 (64) = happyGoto action_85 +action_1 (65) = happyGoto action_86 +action_1 (66) = happyGoto action_87 +action_1 (67) = happyGoto action_88 +action_1 (68) = happyGoto action_89 +action_1 (78) = happyGoto action_90 +action_1 (79) = happyGoto action_91 +action_1 (133) = happyGoto action_93 +action_1 (135) = happyGoto action_94 +action_1 _ = happyFail (happyExpListPerState 1) + +action_2 (223) = happyShift action_45 +action_2 (234) = happyShift action_47 +action_2 (245) = happyShift action_48 +action_2 (246) = happyShift action_49 +action_2 (248) = happyShift action_50 +action_2 (249) = happyShift action_51 +action_2 (256) = happyShift action_53 +action_2 (30) = happyGoto action_197 +action_2 _ = happyFail (happyExpListPerState 2) + +action_3 (209) = happyShift action_193 +action_3 (211) = happyShift action_194 +action_3 (220) = happyShift action_195 +action_3 (262) = happyShift action_196 +action_3 (32) = happyGoto action_192 +action_3 _ = happyFail (happyExpListPerState 3) + +action_4 (223) = happyShift action_45 +action_4 (225) = happyShift action_169 +action_4 (226) = happyShift action_170 +action_4 (227) = happyShift action_171 +action_4 (233) = happyShift action_172 +action_4 (234) = happyShift action_47 +action_4 (235) = happyShift action_181 +action_4 (238) = happyShift action_173 +action_4 (239) = happyShift action_174 +action_4 (240) = happyShift action_175 +action_4 (241) = happyShift action_176 +action_4 (244) = happyShift action_177 +action_4 (245) = happyShift action_48 +action_4 (246) = happyShift action_49 +action_4 (248) = happyShift action_50 +action_4 (249) = happyShift action_51 +action_4 (252) = happyShift action_178 +action_4 (256) = happyShift action_53 +action_4 (30) = happyGoto action_159 +action_4 (94) = happyGoto action_183 +action_4 (97) = happyGoto action_184 +action_4 (98) = happyGoto action_185 +action_4 (103) = happyGoto action_186 +action_4 (106) = happyGoto action_187 +action_4 (107) = happyGoto action_161 +action_4 (108) = happyGoto action_162 +action_4 (109) = happyGoto action_163 +action_4 (111) = happyGoto action_164 +action_4 (118) = happyGoto action_165 +action_4 (123) = happyGoto action_166 +action_4 (124) = happyGoto action_167 +action_4 (150) = happyGoto action_188 +action_4 (154) = happyGoto action_189 +action_4 (176) = happyGoto action_190 +action_4 (183) = happyGoto action_191 +action_4 _ = happyReduce_257 + +action_5 (223) = happyShift action_45 +action_5 (225) = happyShift action_169 +action_5 (226) = happyShift action_170 +action_5 (227) = happyShift action_171 +action_5 (233) = happyShift action_172 +action_5 (234) = happyShift action_47 +action_5 (238) = happyShift action_173 +action_5 (239) = happyShift action_174 +action_5 (240) = happyShift action_175 +action_5 (241) = happyShift action_176 +action_5 (244) = happyShift action_177 +action_5 (245) = happyShift action_48 +action_5 (246) = happyShift action_49 +action_5 (248) = happyShift action_50 +action_5 (249) = happyShift action_51 +action_5 (252) = happyShift action_178 +action_5 (256) = happyShift action_53 +action_5 (30) = happyGoto action_159 +action_5 (106) = happyGoto action_182 +action_5 (107) = happyGoto action_161 +action_5 (108) = happyGoto action_162 +action_5 (109) = happyGoto action_163 +action_5 (111) = happyGoto action_164 +action_5 (118) = happyGoto action_165 +action_5 (123) = happyGoto action_166 +action_5 (124) = happyGoto action_167 +action_5 _ = happyFail (happyExpListPerState 5) + +action_6 (235) = happyShift action_181 +action_6 (103) = happyGoto action_179 +action_6 (126) = happyGoto action_180 +action_6 _ = happyFail (happyExpListPerState 6) + +action_7 (223) = happyShift action_45 +action_7 (225) = happyShift action_169 +action_7 (226) = happyShift action_170 +action_7 (227) = happyShift action_171 +action_7 (233) = happyShift action_172 +action_7 (234) = happyShift action_47 +action_7 (238) = happyShift action_173 +action_7 (239) = happyShift action_174 +action_7 (240) = happyShift action_175 +action_7 (241) = happyShift action_176 +action_7 (244) = happyShift action_177 +action_7 (245) = happyShift action_48 +action_7 (246) = happyShift action_49 +action_7 (248) = happyShift action_50 +action_7 (249) = happyShift action_51 +action_7 (252) = happyShift action_178 +action_7 (256) = happyShift action_53 +action_7 (30) = happyGoto action_159 +action_7 (106) = happyGoto action_160 +action_7 (107) = happyGoto action_161 +action_7 (108) = happyGoto action_162 +action_7 (109) = happyGoto action_163 +action_7 (111) = happyGoto action_164 +action_7 (118) = happyGoto action_165 +action_7 (123) = happyGoto action_166 +action_7 (124) = happyGoto action_167 +action_7 (127) = happyGoto action_168 +action_7 _ = happyFail (happyExpListPerState 7) + +action_8 (198) = happyShift action_95 +action_8 (200) = happyShift action_96 +action_8 (202) = happyShift action_97 +action_8 (218) = happyShift action_98 +action_8 (219) = happyShift action_99 +action_8 (220) = happyShift action_100 +action_8 (222) = happyShift action_101 +action_8 (223) = happyShift action_102 +action_8 (224) = happyShift action_103 +action_8 (228) = happyShift action_104 +action_8 (230) = happyShift action_46 +action_8 (234) = happyShift action_105 +action_8 (236) = happyShift action_106 +action_8 (242) = happyShift action_107 +action_8 (245) = happyShift action_108 +action_8 (246) = happyShift action_109 +action_8 (248) = happyShift action_110 +action_8 (249) = happyShift action_111 +action_8 (251) = happyShift action_52 +action_8 (255) = happyShift action_112 +action_8 (256) = happyShift action_113 +action_8 (257) = happyShift action_114 +action_8 (258) = happyShift action_54 +action_8 (259) = happyShift action_55 +action_8 (260) = happyShift action_115 +action_8 (261) = happyShift action_116 +action_8 (264) = happyShift action_117 +action_8 (265) = happyShift action_56 +action_8 (266) = happyShift action_57 +action_8 (267) = happyShift action_58 +action_8 (268) = happyShift action_59 +action_8 (269) = happyShift action_60 +action_8 (27) = happyGoto action_74 +action_8 (29) = happyGoto action_75 +action_8 (33) = happyGoto action_76 +action_8 (36) = happyGoto action_77 +action_8 (37) = happyGoto action_78 +action_8 (38) = happyGoto action_79 +action_8 (39) = happyGoto action_80 +action_8 (41) = happyGoto action_81 +action_8 (59) = happyGoto action_157 +action_8 (60) = happyGoto action_122 +action_8 (61) = happyGoto action_83 +action_8 (63) = happyGoto action_84 +action_8 (64) = happyGoto action_85 +action_8 (65) = happyGoto action_86 +action_8 (66) = happyGoto action_87 +action_8 (67) = happyGoto action_88 +action_8 (68) = happyGoto action_89 +action_8 (78) = happyGoto action_90 +action_8 (79) = happyGoto action_91 +action_8 (128) = happyGoto action_158 +action_8 (133) = happyGoto action_93 +action_8 (135) = happyGoto action_94 +action_8 _ = happyFail (happyExpListPerState 8) + +action_9 (198) = happyShift action_148 +action_9 (200) = happyShift action_149 +action_9 (202) = happyShift action_150 +action_9 (218) = happyShift action_151 +action_9 (220) = happyShift action_152 +action_9 (223) = happyShift action_45 +action_9 (231) = happyShift action_153 +action_9 (232) = happyShift action_154 +action_9 (234) = happyShift action_47 +action_9 (245) = happyShift action_48 +action_9 (246) = happyShift action_49 +action_9 (248) = happyShift action_50 +action_9 (249) = happyShift action_51 +action_9 (254) = happyShift action_155 +action_9 (255) = happyShift action_112 +action_9 (256) = happyShift action_53 +action_9 (258) = happyShift action_54 +action_9 (259) = happyShift action_55 +action_9 (260) = happyShift action_115 +action_9 (261) = happyShift action_116 +action_9 (264) = happyShift action_117 +action_9 (266) = happyShift action_57 +action_9 (267) = happyShift action_58 +action_9 (268) = happyShift action_156 +action_9 (27) = happyGoto action_133 +action_9 (30) = happyGoto action_134 +action_9 (33) = happyGoto action_135 +action_9 (36) = happyGoto action_136 +action_9 (37) = happyGoto action_137 +action_9 (40) = happyGoto action_138 +action_9 (45) = happyGoto action_139 +action_9 (46) = happyGoto action_140 +action_9 (47) = happyGoto action_141 +action_9 (48) = happyGoto action_142 +action_9 (49) = happyGoto action_143 +action_9 (50) = happyGoto action_144 +action_9 (51) = happyGoto action_145 +action_9 (57) = happyGoto action_146 +action_9 (129) = happyGoto action_147 +action_9 _ = happyFail (happyExpListPerState 9) + +action_10 (258) = happyShift action_24 +action_10 (259) = happyShift action_132 +action_10 (26) = happyGoto action_130 +action_10 (130) = happyGoto action_131 +action_10 _ = happyFail (happyExpListPerState 10) + +action_11 (223) = happyShift action_102 +action_11 (234) = happyShift action_105 +action_11 (245) = happyShift action_108 +action_11 (246) = happyShift action_109 +action_11 (248) = happyShift action_110 +action_11 (249) = happyShift action_111 +action_11 (256) = happyShift action_113 +action_11 (257) = happyShift action_114 +action_11 (29) = happyGoto action_128 +action_11 (131) = happyGoto action_129 +action_11 _ = happyFail (happyExpListPerState 11) + +action_12 (243) = happyShift action_127 +action_12 (93) = happyGoto action_126 +action_12 _ = happyFail (happyExpListPerState 12) + +action_13 (242) = happyShift action_125 +action_13 (80) = happyGoto action_124 +action_13 _ = happyReduce_220 + +action_14 (198) = happyShift action_95 +action_14 (200) = happyShift action_96 +action_14 (202) = happyShift action_97 +action_14 (218) = happyShift action_98 +action_14 (219) = happyShift action_99 +action_14 (220) = happyShift action_100 +action_14 (222) = happyShift action_101 +action_14 (223) = happyShift action_102 +action_14 (224) = happyShift action_103 +action_14 (228) = happyShift action_104 +action_14 (230) = happyShift action_46 +action_14 (234) = happyShift action_105 +action_14 (236) = happyShift action_106 +action_14 (242) = happyShift action_107 +action_14 (245) = happyShift action_108 +action_14 (246) = happyShift action_109 +action_14 (248) = happyShift action_110 +action_14 (249) = happyShift action_111 +action_14 (251) = happyShift action_52 +action_14 (255) = happyShift action_112 +action_14 (256) = happyShift action_113 +action_14 (257) = happyShift action_114 +action_14 (258) = happyShift action_54 +action_14 (259) = happyShift action_55 +action_14 (260) = happyShift action_115 +action_14 (261) = happyShift action_116 +action_14 (264) = happyShift action_117 +action_14 (265) = happyShift action_56 +action_14 (266) = happyShift action_57 +action_14 (267) = happyShift action_58 +action_14 (268) = happyShift action_59 +action_14 (269) = happyShift action_60 +action_14 (27) = happyGoto action_74 +action_14 (29) = happyGoto action_75 +action_14 (33) = happyGoto action_76 +action_14 (36) = happyGoto action_77 +action_14 (37) = happyGoto action_78 +action_14 (38) = happyGoto action_79 +action_14 (39) = happyGoto action_80 +action_14 (41) = happyGoto action_81 +action_14 (59) = happyGoto action_121 +action_14 (60) = happyGoto action_122 +action_14 (61) = happyGoto action_83 +action_14 (63) = happyGoto action_84 +action_14 (64) = happyGoto action_85 +action_14 (65) = happyGoto action_86 +action_14 (66) = happyGoto action_87 +action_14 (67) = happyGoto action_88 +action_14 (68) = happyGoto action_89 +action_14 (78) = happyGoto action_90 +action_14 (79) = happyGoto action_91 +action_14 (81) = happyGoto action_123 +action_14 (133) = happyGoto action_93 +action_14 (135) = happyGoto action_94 +action_14 _ = happyFail (happyExpListPerState 14) + +action_15 (205) = happyShift action_119 +action_15 (206) = happyShift action_120 +action_15 (82) = happyGoto action_118 +action_15 _ = happyFail (happyExpListPerState 15) + +action_16 (198) = happyShift action_95 +action_16 (200) = happyShift action_96 +action_16 (202) = happyShift action_97 +action_16 (218) = happyShift action_98 +action_16 (219) = happyShift action_99 +action_16 (220) = happyShift action_100 +action_16 (222) = happyShift action_101 +action_16 (223) = happyShift action_102 +action_16 (224) = happyShift action_103 +action_16 (228) = happyShift action_104 +action_16 (230) = happyShift action_46 +action_16 (234) = happyShift action_105 +action_16 (236) = happyShift action_106 +action_16 (242) = happyShift action_107 +action_16 (245) = happyShift action_108 +action_16 (246) = happyShift action_109 +action_16 (248) = happyShift action_110 +action_16 (249) = happyShift action_111 +action_16 (251) = happyShift action_52 +action_16 (255) = happyShift action_112 +action_16 (256) = happyShift action_113 +action_16 (257) = happyShift action_114 +action_16 (258) = happyShift action_54 +action_16 (259) = happyShift action_55 +action_16 (260) = happyShift action_115 +action_16 (261) = happyShift action_116 +action_16 (264) = happyShift action_117 +action_16 (265) = happyShift action_56 +action_16 (266) = happyShift action_57 +action_16 (267) = happyShift action_58 +action_16 (268) = happyShift action_59 +action_16 (269) = happyShift action_60 +action_16 (27) = happyGoto action_74 +action_16 (29) = happyGoto action_75 +action_16 (33) = happyGoto action_76 +action_16 (36) = happyGoto action_77 +action_16 (37) = happyGoto action_78 +action_16 (38) = happyGoto action_79 +action_16 (39) = happyGoto action_80 +action_16 (41) = happyGoto action_81 +action_16 (60) = happyGoto action_82 +action_16 (61) = happyGoto action_83 +action_16 (63) = happyGoto action_84 +action_16 (64) = happyGoto action_85 +action_16 (65) = happyGoto action_86 +action_16 (66) = happyGoto action_87 +action_16 (67) = happyGoto action_88 +action_16 (68) = happyGoto action_89 +action_16 (78) = happyGoto action_90 +action_16 (79) = happyGoto action_91 +action_16 (85) = happyGoto action_92 +action_16 (133) = happyGoto action_93 +action_16 (135) = happyGoto action_94 +action_16 _ = happyFail (happyExpListPerState 16) + +action_17 (217) = happyShift action_73 +action_17 (86) = happyGoto action_72 +action_17 _ = happyReduce_228 + +action_18 (84) = happyGoto action_71 +action_18 _ = happyReduce_225 + +action_19 (258) = happyShift action_63 +action_19 (28) = happyGoto action_69 +action_19 (112) = happyGoto action_70 +action_19 _ = happyFail (happyExpListPerState 19) + +action_20 (198) = happyShift action_68 +action_20 (258) = happyShift action_54 +action_20 (259) = happyShift action_55 +action_20 (27) = happyGoto action_64 +action_20 (113) = happyGoto action_65 +action_20 (120) = happyGoto action_66 +action_20 (121) = happyGoto action_67 +action_20 _ = happyFail (happyExpListPerState 20) + +action_21 (258) = happyShift action_63 +action_21 (28) = happyGoto action_61 +action_21 (114) = happyGoto action_62 +action_21 _ = happyFail (happyExpListPerState 21) + +action_22 (198) = happyShift action_40 +action_22 (200) = happyShift action_41 +action_22 (202) = happyShift action_42 +action_22 (218) = happyShift action_43 +action_22 (220) = happyShift action_44 +action_22 (223) = happyShift action_45 +action_22 (230) = happyShift action_46 +action_22 (234) = happyShift action_47 +action_22 (245) = happyShift action_48 +action_22 (246) = happyShift action_49 +action_22 (248) = happyShift action_50 +action_22 (249) = happyShift action_51 +action_22 (251) = happyShift action_52 +action_22 (256) = happyShift action_53 +action_22 (258) = happyShift action_54 +action_22 (259) = happyShift action_55 +action_22 (265) = happyShift action_56 +action_22 (266) = happyShift action_57 +action_22 (267) = happyShift action_58 +action_22 (268) = happyShift action_59 +action_22 (269) = happyShift action_60 +action_22 (27) = happyGoto action_25 +action_22 (30) = happyGoto action_26 +action_22 (37) = happyGoto action_27 +action_22 (38) = happyGoto action_28 +action_22 (39) = happyGoto action_29 +action_22 (41) = happyGoto action_30 +action_22 (87) = happyGoto action_31 +action_22 (88) = happyGoto action_32 +action_22 (89) = happyGoto action_33 +action_22 (90) = happyGoto action_34 +action_22 (91) = happyGoto action_35 +action_22 (132) = happyGoto action_36 +action_22 (134) = happyGoto action_37 +action_22 (136) = happyGoto action_38 +action_22 (166) = happyGoto action_39 +action_22 _ = happyFail (happyExpListPerState 22) + +action_23 (258) = happyShift action_24 +action_23 _ = happyFail (happyExpListPerState 23) + +action_24 _ = happyReduce_23 + +action_25 _ = happyReduce_239 + +action_26 (198) = happyReduce_237 +action_26 (199) = happyReduce_237 +action_26 (200) = happyReduce_237 +action_26 (201) = happyReduce_237 +action_26 (202) = happyReduce_237 +action_26 (203) = happyReduce_237 +action_26 (205) = happyReduce_237 +action_26 (207) = happyReduce_237 +action_26 (208) = happyReduce_237 +action_26 (209) = happyReduce_237 +action_26 (211) = happyReduce_237 +action_26 (212) = happyReduce_237 +action_26 (213) = happyReduce_237 +action_26 (214) = happyReduce_237 +action_26 (217) = happyReduce_237 +action_26 (218) = happyReduce_237 +action_26 (220) = happyReduce_237 +action_26 (221) = happyShift action_347 +action_26 (223) = happyReduce_237 +action_26 (230) = happyReduce_237 +action_26 (234) = happyReduce_237 +action_26 (245) = happyReduce_237 +action_26 (246) = happyReduce_237 +action_26 (248) = happyReduce_237 +action_26 (249) = happyReduce_237 +action_26 (251) = happyReduce_237 +action_26 (256) = happyReduce_237 +action_26 (258) = happyReduce_237 +action_26 (259) = happyReduce_237 +action_26 (262) = happyReduce_237 +action_26 (263) = happyReduce_237 +action_26 (265) = happyReduce_237 +action_26 (266) = happyReduce_237 +action_26 (267) = happyReduce_237 +action_26 (268) = happyReduce_237 +action_26 (269) = happyReduce_237 +action_26 _ = happyReduce_237 + +action_27 _ = happyReduce_242 + +action_28 _ = happyReduce_241 + +action_29 _ = happyReduce_243 + +action_30 _ = happyReduce_240 + +action_31 (1) = happyAccept +action_31 _ = happyFail (happyExpListPerState 31) + +action_32 (207) = happyShift action_346 +action_32 _ = happyFail (happyExpListPerState 32) + +action_33 (209) = happyShift action_286 +action_33 (211) = happyShift action_288 +action_33 (212) = happyShift action_345 +action_33 (220) = happyShift action_289 +action_33 (262) = happyShift action_290 +action_33 (263) = happyShift action_291 +action_33 (31) = happyGoto action_344 +action_33 _ = happyReduce_230 + +action_34 _ = happyReduce_232 + +action_35 _ = happyReduce_385 + +action_36 _ = happyReduce_244 + +action_37 _ = happyReduce_245 + +action_38 _ = happyReduce_234 + +action_39 (198) = happyShift action_40 +action_39 (199) = happyReduce_351 +action_39 (200) = happyShift action_41 +action_39 (201) = happyReduce_351 +action_39 (202) = happyShift action_42 +action_39 (203) = happyReduce_351 +action_39 (205) = happyReduce_351 +action_39 (207) = happyReduce_351 +action_39 (208) = happyReduce_351 +action_39 (209) = happyReduce_351 +action_39 (211) = happyReduce_351 +action_39 (212) = happyReduce_351 +action_39 (213) = happyReduce_351 +action_39 (214) = happyReduce_351 +action_39 (217) = happyReduce_351 +action_39 (218) = happyShift action_43 +action_39 (220) = happyReduce_351 +action_39 (223) = happyShift action_45 +action_39 (230) = happyShift action_46 +action_39 (234) = happyShift action_47 +action_39 (245) = happyShift action_48 +action_39 (246) = happyShift action_49 +action_39 (248) = happyShift action_50 +action_39 (249) = happyShift action_51 +action_39 (251) = happyShift action_52 +action_39 (256) = happyShift action_53 +action_39 (258) = happyShift action_54 +action_39 (259) = happyShift action_55 +action_39 (262) = happyReduce_351 +action_39 (263) = happyReduce_351 +action_39 (265) = happyShift action_56 +action_39 (266) = happyShift action_57 +action_39 (267) = happyShift action_58 +action_39 (268) = happyShift action_59 +action_39 (269) = happyShift action_60 +action_39 (27) = happyGoto action_25 +action_39 (30) = happyGoto action_26 +action_39 (37) = happyGoto action_27 +action_39 (38) = happyGoto action_28 +action_39 (39) = happyGoto action_29 +action_39 (41) = happyGoto action_30 +action_39 (91) = happyGoto action_343 +action_39 (132) = happyGoto action_36 +action_39 (134) = happyGoto action_37 +action_39 _ = happyReduce_351 + +action_40 (198) = happyShift action_40 +action_40 (200) = happyShift action_41 +action_40 (202) = happyShift action_42 +action_40 (218) = happyShift action_43 +action_40 (220) = happyShift action_44 +action_40 (223) = happyShift action_45 +action_40 (230) = happyShift action_46 +action_40 (234) = happyShift action_47 +action_40 (245) = happyShift action_48 +action_40 (246) = happyShift action_49 +action_40 (248) = happyShift action_50 +action_40 (249) = happyShift action_51 +action_40 (251) = happyShift action_52 +action_40 (256) = happyShift action_53 +action_40 (258) = happyShift action_54 +action_40 (259) = happyShift action_55 +action_40 (265) = happyShift action_56 +action_40 (266) = happyShift action_57 +action_40 (267) = happyShift action_58 +action_40 (268) = happyShift action_59 +action_40 (269) = happyShift action_60 +action_40 (27) = happyGoto action_25 +action_40 (30) = happyGoto action_26 +action_40 (37) = happyGoto action_27 +action_40 (38) = happyGoto action_28 +action_40 (39) = happyGoto action_29 +action_40 (41) = happyGoto action_30 +action_40 (88) = happyGoto action_342 +action_40 (89) = happyGoto action_33 +action_40 (90) = happyGoto action_34 +action_40 (91) = happyGoto action_35 +action_40 (132) = happyGoto action_36 +action_40 (134) = happyGoto action_37 +action_40 (136) = happyGoto action_38 +action_40 (166) = happyGoto action_39 +action_40 _ = happyFail (happyExpListPerState 40) + +action_41 (201) = happyShift action_341 +action_41 (222) = happyShift action_232 +action_41 (223) = happyShift action_233 +action_41 (224) = happyShift action_234 +action_41 (225) = happyShift action_235 +action_41 (226) = happyShift action_236 +action_41 (227) = happyShift action_237 +action_41 (228) = happyShift action_238 +action_41 (229) = happyShift action_239 +action_41 (230) = happyShift action_240 +action_41 (231) = happyShift action_241 +action_41 (233) = happyShift action_242 +action_41 (234) = happyShift action_243 +action_41 (235) = happyShift action_244 +action_41 (236) = happyShift action_245 +action_41 (237) = happyShift action_246 +action_41 (238) = happyShift action_247 +action_41 (239) = happyShift action_248 +action_41 (240) = happyShift action_249 +action_41 (241) = happyShift action_250 +action_41 (242) = happyShift action_251 +action_41 (243) = happyShift action_252 +action_41 (244) = happyShift action_253 +action_41 (245) = happyShift action_254 +action_41 (246) = happyShift action_255 +action_41 (247) = happyShift action_256 +action_41 (248) = happyShift action_257 +action_41 (249) = happyShift action_258 +action_41 (250) = happyShift action_259 +action_41 (251) = happyShift action_260 +action_41 (252) = happyShift action_261 +action_41 (253) = happyShift action_262 +action_41 (256) = happyShift action_263 +action_41 (266) = happyShift action_264 +action_41 (267) = happyShift action_265 +action_41 (35) = happyGoto action_337 +action_41 (92) = happyGoto action_338 +action_41 (178) = happyGoto action_339 +action_41 (196) = happyGoto action_340 +action_41 _ = happyFail (happyExpListPerState 41) + +action_42 (198) = happyShift action_40 +action_42 (200) = happyShift action_41 +action_42 (202) = happyShift action_42 +action_42 (203) = happyShift action_336 +action_42 (218) = happyShift action_43 +action_42 (220) = happyShift action_44 +action_42 (223) = happyShift action_45 +action_42 (230) = happyShift action_46 +action_42 (234) = happyShift action_47 +action_42 (245) = happyShift action_48 +action_42 (246) = happyShift action_49 +action_42 (248) = happyShift action_50 +action_42 (249) = happyShift action_51 +action_42 (251) = happyShift action_52 +action_42 (256) = happyShift action_53 +action_42 (258) = happyShift action_54 +action_42 (259) = happyShift action_55 +action_42 (265) = happyShift action_56 +action_42 (266) = happyShift action_57 +action_42 (267) = happyShift action_58 +action_42 (268) = happyShift action_59 +action_42 (269) = happyShift action_60 +action_42 (27) = happyGoto action_25 +action_42 (30) = happyGoto action_26 +action_42 (37) = happyGoto action_27 +action_42 (38) = happyGoto action_28 +action_42 (39) = happyGoto action_29 +action_42 (41) = happyGoto action_30 +action_42 (88) = happyGoto action_333 +action_42 (89) = happyGoto action_33 +action_42 (90) = happyGoto action_34 +action_42 (91) = happyGoto action_35 +action_42 (132) = happyGoto action_36 +action_42 (134) = happyGoto action_37 +action_42 (136) = happyGoto action_38 +action_42 (166) = happyGoto action_39 +action_42 (177) = happyGoto action_334 +action_42 (195) = happyGoto action_335 +action_42 _ = happyFail (happyExpListPerState 42) + +action_43 _ = happyReduce_236 + +action_44 (268) = happyShift action_59 +action_44 (269) = happyShift action_60 +action_44 (39) = happyGoto action_332 +action_44 _ = happyFail (happyExpListPerState 44) + +action_45 _ = happyReduce_37 + +action_46 _ = happyReduce_99 + +action_47 _ = happyReduce_38 + +action_48 _ = happyReduce_40 + +action_49 _ = happyReduce_42 + +action_50 _ = happyReduce_41 + +action_51 _ = happyReduce_39 + +action_52 _ = happyReduce_98 + +action_53 _ = happyReduce_36 + +action_54 _ = happyReduce_25 + +action_55 _ = happyReduce_26 + +action_56 _ = happyReduce_94 + +action_57 _ = happyReduce_92 + +action_58 _ = happyReduce_93 + +action_59 _ = happyReduce_95 + +action_60 _ = happyReduce_96 + +action_61 (198) = happyShift action_281 +action_61 (221) = happyShift action_282 +action_61 (223) = happyShift action_45 +action_61 (234) = happyShift action_47 +action_61 (245) = happyShift action_48 +action_61 (246) = happyShift action_49 +action_61 (248) = happyShift action_50 +action_61 (249) = happyShift action_51 +action_61 (256) = happyShift action_53 +action_61 (30) = happyGoto action_277 +action_61 (55) = happyGoto action_278 +action_61 (141) = happyGoto action_330 +action_61 (144) = happyGoto action_331 +action_61 (171) = happyGoto action_280 +action_61 _ = happyReduce_361 + +action_62 (1) = happyAccept +action_62 _ = happyFail (happyExpListPerState 62) + +action_63 _ = happyReduce_27 + +action_64 (198) = happyShift action_148 +action_64 (200) = happyShift action_149 +action_64 (202) = happyShift action_150 +action_64 (218) = happyShift action_151 +action_64 (223) = happyShift action_45 +action_64 (234) = happyShift action_47 +action_64 (245) = happyShift action_48 +action_64 (246) = happyShift action_49 +action_64 (248) = happyShift action_50 +action_64 (249) = happyShift action_51 +action_64 (254) = happyShift action_155 +action_64 (255) = happyShift action_112 +action_64 (256) = happyShift action_53 +action_64 (258) = happyShift action_54 +action_64 (259) = happyShift action_55 +action_64 (260) = happyShift action_115 +action_64 (261) = happyShift action_116 +action_64 (264) = happyShift action_117 +action_64 (266) = happyShift action_57 +action_64 (267) = happyShift action_58 +action_64 (268) = happyShift action_156 +action_64 (27) = happyGoto action_133 +action_64 (30) = happyGoto action_134 +action_64 (33) = happyGoto action_135 +action_64 (36) = happyGoto action_136 +action_64 (37) = happyGoto action_137 +action_64 (40) = happyGoto action_138 +action_64 (51) = happyGoto action_326 +action_64 (143) = happyGoto action_327 +action_64 (164) = happyGoto action_328 +action_64 (193) = happyGoto action_329 +action_64 _ = happyReduce_359 + +action_65 (1) = happyAccept +action_65 _ = happyFail (happyExpListPerState 65) + +action_66 (209) = happyShift action_325 +action_66 _ = happyFail (happyExpListPerState 66) + +action_67 _ = happyReduce_322 + +action_68 (198) = happyShift action_324 +action_68 (258) = happyShift action_54 +action_68 (259) = happyShift action_55 +action_68 (27) = happyGoto action_64 +action_68 (121) = happyGoto action_321 +action_68 (152) = happyGoto action_322 +action_68 (181) = happyGoto action_323 +action_68 _ = happyFail (happyExpListPerState 68) + +action_69 (212) = happyShift action_320 +action_69 _ = happyFail (happyExpListPerState 69) + +action_70 (1) = happyAccept +action_70 _ = happyFail (happyExpListPerState 70) + +action_71 (1) = happyAccept +action_71 _ = happyFail (happyExpListPerState 71) + +action_72 (1) = happyAccept +action_72 _ = happyFail (happyExpListPerState 72) + +action_73 _ = happyReduce_227 + +action_74 _ = happyReduce_187 + +action_75 _ = happyReduce_186 + +action_76 _ = happyReduce_188 + +action_77 _ = happyReduce_185 + +action_78 _ = happyReduce_191 + +action_79 _ = happyReduce_190 + +action_80 _ = happyReduce_192 + +action_81 _ = happyReduce_189 + +action_82 (209) = happyShift action_286 +action_82 (211) = happyShift action_288 +action_82 (220) = happyShift action_289 +action_82 (262) = happyShift action_290 +action_82 (263) = happyShift action_291 +action_82 (31) = happyGoto action_295 +action_82 _ = happyReduce_226 + +action_83 (1) = happyReduce_159 +action_83 (198) = happyReduce_159 +action_83 (199) = happyReduce_159 +action_83 (200) = happyReduce_159 +action_83 (201) = happyReduce_159 +action_83 (202) = happyReduce_159 +action_83 (203) = happyReduce_159 +action_83 (205) = happyReduce_159 +action_83 (206) = happyReduce_159 +action_83 (209) = happyReduce_159 +action_83 (211) = happyReduce_159 +action_83 (212) = happyReduce_159 +action_83 (214) = happyReduce_159 +action_83 (215) = happyShift action_319 +action_83 (217) = happyReduce_159 +action_83 (218) = happyReduce_159 +action_83 (219) = happyReduce_159 +action_83 (220) = happyReduce_159 +action_83 (221) = happyReduce_159 +action_83 (222) = happyReduce_159 +action_83 (223) = happyReduce_159 +action_83 (224) = happyReduce_159 +action_83 (228) = happyReduce_159 +action_83 (229) = happyReduce_159 +action_83 (230) = happyReduce_159 +action_83 (234) = happyReduce_159 +action_83 (236) = happyReduce_159 +action_83 (242) = happyReduce_159 +action_83 (245) = happyReduce_159 +action_83 (246) = happyReduce_159 +action_83 (247) = happyReduce_159 +action_83 (248) = happyReduce_159 +action_83 (249) = happyReduce_159 +action_83 (250) = happyReduce_159 +action_83 (251) = happyReduce_159 +action_83 (253) = happyReduce_159 +action_83 (255) = happyReduce_159 +action_83 (256) = happyReduce_159 +action_83 (257) = happyReduce_159 +action_83 (258) = happyReduce_159 +action_83 (259) = happyReduce_159 +action_83 (260) = happyReduce_159 +action_83 (261) = happyReduce_159 +action_83 (262) = happyReduce_159 +action_83 (263) = happyReduce_159 +action_83 (264) = happyReduce_159 +action_83 (265) = happyReduce_159 +action_83 (266) = happyReduce_159 +action_83 (267) = happyReduce_159 +action_83 (268) = happyReduce_159 +action_83 (269) = happyReduce_159 +action_83 (270) = happyReduce_159 +action_83 _ = happyReduce_159 + +action_84 _ = happyReduce_161 + +action_85 (1) = happyReduce_165 +action_85 (198) = happyShift action_95 +action_85 (199) = happyReduce_165 +action_85 (200) = happyShift action_96 +action_85 (201) = happyReduce_165 +action_85 (202) = happyShift action_97 +action_85 (203) = happyReduce_165 +action_85 (205) = happyReduce_165 +action_85 (206) = happyReduce_165 +action_85 (209) = happyReduce_165 +action_85 (211) = happyReduce_165 +action_85 (212) = happyReduce_165 +action_85 (214) = happyReduce_165 +action_85 (215) = happyReduce_165 +action_85 (217) = happyReduce_165 +action_85 (218) = happyShift action_98 +action_85 (219) = happyShift action_99 +action_85 (220) = happyReduce_165 +action_85 (221) = happyShift action_318 +action_85 (222) = happyShift action_101 +action_85 (223) = happyShift action_102 +action_85 (224) = happyShift action_103 +action_85 (228) = happyShift action_104 +action_85 (229) = happyReduce_165 +action_85 (230) = happyShift action_46 +action_85 (234) = happyShift action_105 +action_85 (236) = happyShift action_106 +action_85 (242) = happyShift action_107 +action_85 (245) = happyShift action_108 +action_85 (246) = happyShift action_109 +action_85 (247) = happyReduce_165 +action_85 (248) = happyShift action_110 +action_85 (249) = happyShift action_111 +action_85 (250) = happyReduce_165 +action_85 (251) = happyShift action_52 +action_85 (253) = happyReduce_165 +action_85 (255) = happyShift action_112 +action_85 (256) = happyShift action_113 +action_85 (257) = happyShift action_114 +action_85 (258) = happyShift action_54 +action_85 (259) = happyShift action_55 +action_85 (260) = happyShift action_115 +action_85 (261) = happyShift action_116 +action_85 (262) = happyReduce_165 +action_85 (263) = happyReduce_165 +action_85 (264) = happyShift action_117 +action_85 (265) = happyShift action_56 +action_85 (266) = happyShift action_57 +action_85 (267) = happyShift action_58 +action_85 (268) = happyShift action_59 +action_85 (269) = happyShift action_60 +action_85 (270) = happyReduce_165 +action_85 (27) = happyGoto action_74 +action_85 (29) = happyGoto action_75 +action_85 (33) = happyGoto action_76 +action_85 (36) = happyGoto action_77 +action_85 (37) = happyGoto action_78 +action_85 (38) = happyGoto action_79 +action_85 (39) = happyGoto action_80 +action_85 (41) = happyGoto action_81 +action_85 (65) = happyGoto action_317 +action_85 (66) = happyGoto action_87 +action_85 (67) = happyGoto action_88 +action_85 (68) = happyGoto action_89 +action_85 (78) = happyGoto action_90 +action_85 (79) = happyGoto action_91 +action_85 (133) = happyGoto action_93 +action_85 (135) = happyGoto action_94 +action_85 _ = happyReduce_165 + +action_86 _ = happyReduce_167 + +action_87 _ = happyReduce_170 + +action_88 (1) = happyReduce_179 +action_88 (198) = happyReduce_179 +action_88 (199) = happyReduce_179 +action_88 (200) = happyShift action_316 +action_88 (201) = happyReduce_179 +action_88 (202) = happyReduce_179 +action_88 (203) = happyReduce_179 +action_88 (205) = happyReduce_179 +action_88 (206) = happyReduce_179 +action_88 (209) = happyReduce_179 +action_88 (211) = happyReduce_179 +action_88 (212) = happyReduce_179 +action_88 (214) = happyReduce_179 +action_88 (215) = happyReduce_179 +action_88 (217) = happyReduce_179 +action_88 (218) = happyReduce_179 +action_88 (219) = happyReduce_179 +action_88 (220) = happyReduce_179 +action_88 (221) = happyReduce_179 +action_88 (222) = happyReduce_179 +action_88 (223) = happyReduce_179 +action_88 (224) = happyReduce_179 +action_88 (228) = happyReduce_179 +action_88 (229) = happyReduce_179 +action_88 (230) = happyReduce_179 +action_88 (234) = happyReduce_179 +action_88 (236) = happyReduce_179 +action_88 (242) = happyReduce_179 +action_88 (245) = happyReduce_179 +action_88 (246) = happyReduce_179 +action_88 (247) = happyReduce_179 +action_88 (248) = happyReduce_179 +action_88 (249) = happyReduce_179 +action_88 (250) = happyReduce_179 +action_88 (251) = happyReduce_179 +action_88 (253) = happyReduce_179 +action_88 (255) = happyReduce_179 +action_88 (256) = happyReduce_179 +action_88 (257) = happyReduce_179 +action_88 (258) = happyReduce_179 +action_88 (259) = happyReduce_179 +action_88 (260) = happyReduce_179 +action_88 (261) = happyReduce_179 +action_88 (262) = happyReduce_179 +action_88 (263) = happyReduce_179 +action_88 (264) = happyReduce_179 +action_88 (265) = happyReduce_179 +action_88 (266) = happyReduce_179 +action_88 (267) = happyReduce_179 +action_88 (268) = happyReduce_179 +action_88 (269) = happyReduce_179 +action_88 (270) = happyReduce_179 +action_88 _ = happyReduce_179 + +action_89 (216) = happyShift action_315 +action_89 _ = happyReduce_182 + +action_90 _ = happyReduce_172 + +action_91 (237) = happyShift action_314 +action_91 _ = happyFail (happyExpListPerState 91) + +action_92 (1) = happyAccept +action_92 _ = happyFail (happyExpListPerState 92) + +action_93 _ = happyReduce_193 + +action_94 _ = happyReduce_194 + +action_95 (198) = happyShift action_95 +action_95 (200) = happyShift action_96 +action_95 (202) = happyShift action_97 +action_95 (218) = happyShift action_98 +action_95 (219) = happyShift action_99 +action_95 (220) = happyShift action_100 +action_95 (222) = happyShift action_101 +action_95 (223) = happyShift action_102 +action_95 (224) = happyShift action_103 +action_95 (228) = happyShift action_104 +action_95 (230) = happyShift action_46 +action_95 (234) = happyShift action_105 +action_95 (236) = happyShift action_106 +action_95 (242) = happyShift action_107 +action_95 (245) = happyShift action_108 +action_95 (246) = happyShift action_109 +action_95 (248) = happyShift action_110 +action_95 (249) = happyShift action_111 +action_95 (251) = happyShift action_52 +action_95 (255) = happyShift action_112 +action_95 (256) = happyShift action_113 +action_95 (257) = happyShift action_114 +action_95 (258) = happyShift action_54 +action_95 (259) = happyShift action_55 +action_95 (260) = happyShift action_115 +action_95 (261) = happyShift action_116 +action_95 (264) = happyShift action_117 +action_95 (265) = happyShift action_56 +action_95 (266) = happyShift action_57 +action_95 (267) = happyShift action_58 +action_95 (268) = happyShift action_59 +action_95 (269) = happyShift action_60 +action_95 (27) = happyGoto action_74 +action_95 (29) = happyGoto action_75 +action_95 (33) = happyGoto action_76 +action_95 (36) = happyGoto action_77 +action_95 (37) = happyGoto action_78 +action_95 (38) = happyGoto action_79 +action_95 (39) = happyGoto action_80 +action_95 (41) = happyGoto action_81 +action_95 (59) = happyGoto action_313 +action_95 (60) = happyGoto action_122 +action_95 (61) = happyGoto action_83 +action_95 (63) = happyGoto action_84 +action_95 (64) = happyGoto action_85 +action_95 (65) = happyGoto action_86 +action_95 (66) = happyGoto action_87 +action_95 (67) = happyGoto action_88 +action_95 (68) = happyGoto action_89 +action_95 (78) = happyGoto action_90 +action_95 (79) = happyGoto action_91 +action_95 (133) = happyGoto action_93 +action_95 (135) = happyGoto action_94 +action_95 _ = happyFail (happyExpListPerState 95) + +action_96 (201) = happyShift action_312 +action_96 (222) = happyShift action_232 +action_96 (223) = happyShift action_233 +action_96 (224) = happyShift action_234 +action_96 (225) = happyShift action_235 +action_96 (226) = happyShift action_236 +action_96 (227) = happyShift action_237 +action_96 (228) = happyShift action_238 +action_96 (229) = happyShift action_239 +action_96 (230) = happyShift action_240 +action_96 (231) = happyShift action_241 +action_96 (233) = happyShift action_242 +action_96 (234) = happyShift action_243 +action_96 (235) = happyShift action_244 +action_96 (236) = happyShift action_245 +action_96 (237) = happyShift action_246 +action_96 (238) = happyShift action_247 +action_96 (239) = happyShift action_248 +action_96 (240) = happyShift action_249 +action_96 (241) = happyShift action_250 +action_96 (242) = happyShift action_251 +action_96 (243) = happyShift action_252 +action_96 (244) = happyShift action_253 +action_96 (245) = happyShift action_254 +action_96 (246) = happyShift action_255 +action_96 (247) = happyShift action_256 +action_96 (248) = happyShift action_257 +action_96 (249) = happyShift action_258 +action_96 (250) = happyShift action_259 +action_96 (251) = happyShift action_260 +action_96 (252) = happyShift action_261 +action_96 (253) = happyShift action_262 +action_96 (256) = happyShift action_263 +action_96 (266) = happyShift action_264 +action_96 (267) = happyShift action_265 +action_96 (35) = happyGoto action_308 +action_96 (69) = happyGoto action_309 +action_96 (179) = happyGoto action_310 +action_96 (197) = happyGoto action_311 +action_96 _ = happyFail (happyExpListPerState 96) + +action_97 (198) = happyShift action_95 +action_97 (200) = happyShift action_96 +action_97 (202) = happyShift action_97 +action_97 (203) = happyShift action_307 +action_97 (218) = happyShift action_98 +action_97 (219) = happyShift action_99 +action_97 (220) = happyShift action_100 +action_97 (222) = happyShift action_101 +action_97 (223) = happyShift action_102 +action_97 (224) = happyShift action_103 +action_97 (228) = happyShift action_104 +action_97 (230) = happyShift action_46 +action_97 (234) = happyShift action_105 +action_97 (236) = happyShift action_106 +action_97 (242) = happyShift action_107 +action_97 (245) = happyShift action_108 +action_97 (246) = happyShift action_109 +action_97 (248) = happyShift action_110 +action_97 (249) = happyShift action_111 +action_97 (251) = happyShift action_52 +action_97 (255) = happyShift action_112 +action_97 (256) = happyShift action_113 +action_97 (257) = happyShift action_114 +action_97 (258) = happyShift action_54 +action_97 (259) = happyShift action_55 +action_97 (260) = happyShift action_115 +action_97 (261) = happyShift action_116 +action_97 (264) = happyShift action_117 +action_97 (265) = happyShift action_56 +action_97 (266) = happyShift action_57 +action_97 (267) = happyShift action_58 +action_97 (268) = happyShift action_59 +action_97 (269) = happyShift action_60 +action_97 (27) = happyGoto action_74 +action_97 (29) = happyGoto action_75 +action_97 (33) = happyGoto action_76 +action_97 (36) = happyGoto action_77 +action_97 (37) = happyGoto action_78 +action_97 (38) = happyGoto action_79 +action_97 (39) = happyGoto action_80 +action_97 (41) = happyGoto action_81 +action_97 (59) = happyGoto action_300 +action_97 (60) = happyGoto action_122 +action_97 (61) = happyGoto action_83 +action_97 (63) = happyGoto action_84 +action_97 (64) = happyGoto action_85 +action_97 (65) = happyGoto action_86 +action_97 (66) = happyGoto action_87 +action_97 (67) = happyGoto action_88 +action_97 (68) = happyGoto action_89 +action_97 (78) = happyGoto action_90 +action_97 (79) = happyGoto action_91 +action_97 (133) = happyGoto action_93 +action_97 (135) = happyGoto action_94 +action_97 (156) = happyGoto action_306 +action_97 (185) = happyGoto action_302 +action_97 _ = happyFail (happyExpListPerState 97) + +action_98 _ = happyReduce_184 + +action_99 (198) = happyShift action_40 +action_99 (200) = happyShift action_41 +action_99 (202) = happyShift action_42 +action_99 (218) = happyShift action_43 +action_99 (223) = happyShift action_45 +action_99 (230) = happyShift action_46 +action_99 (234) = happyShift action_47 +action_99 (245) = happyShift action_48 +action_99 (246) = happyShift action_49 +action_99 (248) = happyShift action_50 +action_99 (249) = happyShift action_51 +action_99 (251) = happyShift action_52 +action_99 (256) = happyShift action_53 +action_99 (258) = happyShift action_54 +action_99 (259) = happyShift action_55 +action_99 (265) = happyShift action_56 +action_99 (266) = happyShift action_57 +action_99 (267) = happyShift action_58 +action_99 (268) = happyShift action_59 +action_99 (269) = happyShift action_60 +action_99 (27) = happyGoto action_25 +action_99 (30) = happyGoto action_26 +action_99 (37) = happyGoto action_27 +action_99 (38) = happyGoto action_28 +action_99 (39) = happyGoto action_29 +action_99 (41) = happyGoto action_30 +action_99 (91) = happyGoto action_35 +action_99 (132) = happyGoto action_36 +action_99 (134) = happyGoto action_37 +action_99 (136) = happyGoto action_305 +action_99 (166) = happyGoto action_39 +action_99 _ = happyFail (happyExpListPerState 99) + +action_100 (198) = happyShift action_95 +action_100 (200) = happyShift action_96 +action_100 (202) = happyShift action_97 +action_100 (218) = happyShift action_98 +action_100 (219) = happyShift action_99 +action_100 (220) = happyShift action_100 +action_100 (222) = happyShift action_101 +action_100 (223) = happyShift action_102 +action_100 (224) = happyShift action_103 +action_100 (228) = happyShift action_104 +action_100 (230) = happyShift action_46 +action_100 (234) = happyShift action_105 +action_100 (236) = happyShift action_106 +action_100 (242) = happyShift action_107 +action_100 (245) = happyShift action_108 +action_100 (246) = happyShift action_109 +action_100 (248) = happyShift action_110 +action_100 (249) = happyShift action_111 +action_100 (251) = happyShift action_52 +action_100 (255) = happyShift action_112 +action_100 (256) = happyShift action_113 +action_100 (257) = happyShift action_114 +action_100 (258) = happyShift action_54 +action_100 (259) = happyShift action_55 +action_100 (260) = happyShift action_115 +action_100 (261) = happyShift action_116 +action_100 (264) = happyShift action_117 +action_100 (265) = happyShift action_56 +action_100 (266) = happyShift action_57 +action_100 (267) = happyShift action_58 +action_100 (268) = happyShift action_59 +action_100 (269) = happyShift action_60 +action_100 (27) = happyGoto action_74 +action_100 (29) = happyGoto action_75 +action_100 (33) = happyGoto action_76 +action_100 (36) = happyGoto action_77 +action_100 (37) = happyGoto action_78 +action_100 (38) = happyGoto action_79 +action_100 (39) = happyGoto action_80 +action_100 (41) = happyGoto action_81 +action_100 (63) = happyGoto action_304 +action_100 (64) = happyGoto action_85 +action_100 (65) = happyGoto action_86 +action_100 (66) = happyGoto action_87 +action_100 (67) = happyGoto action_88 +action_100 (68) = happyGoto action_89 +action_100 (78) = happyGoto action_90 +action_100 (79) = happyGoto action_91 +action_100 (133) = happyGoto action_93 +action_100 (135) = happyGoto action_94 +action_100 _ = happyFail (happyExpListPerState 100) + +action_101 (204) = happyShift action_303 +action_101 _ = happyFail (happyExpListPerState 101) + +action_102 _ = happyReduce_30 + +action_103 (198) = happyShift action_95 +action_103 (200) = happyShift action_96 +action_103 (202) = happyShift action_97 +action_103 (218) = happyShift action_98 +action_103 (219) = happyShift action_99 +action_103 (220) = happyShift action_100 +action_103 (222) = happyShift action_101 +action_103 (223) = happyShift action_102 +action_103 (224) = happyShift action_103 +action_103 (228) = happyShift action_104 +action_103 (230) = happyShift action_46 +action_103 (234) = happyShift action_105 +action_103 (236) = happyShift action_106 +action_103 (242) = happyShift action_107 +action_103 (245) = happyShift action_108 +action_103 (246) = happyShift action_109 +action_103 (248) = happyShift action_110 +action_103 (249) = happyShift action_111 +action_103 (251) = happyShift action_52 +action_103 (255) = happyShift action_112 +action_103 (256) = happyShift action_113 +action_103 (257) = happyShift action_114 +action_103 (258) = happyShift action_54 +action_103 (259) = happyShift action_55 +action_103 (260) = happyShift action_115 +action_103 (261) = happyShift action_116 +action_103 (264) = happyShift action_117 +action_103 (265) = happyShift action_56 +action_103 (266) = happyShift action_57 +action_103 (267) = happyShift action_58 +action_103 (268) = happyShift action_59 +action_103 (269) = happyShift action_60 +action_103 (27) = happyGoto action_74 +action_103 (29) = happyGoto action_75 +action_103 (33) = happyGoto action_76 +action_103 (36) = happyGoto action_77 +action_103 (37) = happyGoto action_78 +action_103 (38) = happyGoto action_79 +action_103 (39) = happyGoto action_80 +action_103 (41) = happyGoto action_81 +action_103 (59) = happyGoto action_300 +action_103 (60) = happyGoto action_122 +action_103 (61) = happyGoto action_83 +action_103 (63) = happyGoto action_84 +action_103 (64) = happyGoto action_85 +action_103 (65) = happyGoto action_86 +action_103 (66) = happyGoto action_87 +action_103 (67) = happyGoto action_88 +action_103 (68) = happyGoto action_89 +action_103 (78) = happyGoto action_90 +action_103 (79) = happyGoto action_91 +action_103 (133) = happyGoto action_93 +action_103 (135) = happyGoto action_94 +action_103 (156) = happyGoto action_301 +action_103 (185) = happyGoto action_302 +action_103 _ = happyFail (happyExpListPerState 103) + +action_104 (204) = happyShift action_299 +action_104 _ = happyFail (happyExpListPerState 104) + +action_105 _ = happyReduce_31 + +action_106 (198) = happyShift action_95 +action_106 (200) = happyShift action_96 +action_106 (202) = happyShift action_97 +action_106 (218) = happyShift action_98 +action_106 (219) = happyShift action_99 +action_106 (220) = happyShift action_100 +action_106 (222) = happyShift action_101 +action_106 (223) = happyShift action_102 +action_106 (224) = happyShift action_103 +action_106 (228) = happyShift action_104 +action_106 (230) = happyShift action_46 +action_106 (234) = happyShift action_105 +action_106 (236) = happyShift action_106 +action_106 (242) = happyShift action_107 +action_106 (245) = happyShift action_108 +action_106 (246) = happyShift action_109 +action_106 (248) = happyShift action_110 +action_106 (249) = happyShift action_111 +action_106 (251) = happyShift action_52 +action_106 (255) = happyShift action_112 +action_106 (256) = happyShift action_113 +action_106 (257) = happyShift action_114 +action_106 (258) = happyShift action_54 +action_106 (259) = happyShift action_55 +action_106 (260) = happyShift action_115 +action_106 (261) = happyShift action_116 +action_106 (264) = happyShift action_117 +action_106 (265) = happyShift action_56 +action_106 (266) = happyShift action_57 +action_106 (267) = happyShift action_58 +action_106 (268) = happyShift action_59 +action_106 (269) = happyShift action_60 +action_106 (27) = happyGoto action_74 +action_106 (29) = happyGoto action_75 +action_106 (33) = happyGoto action_76 +action_106 (36) = happyGoto action_77 +action_106 (37) = happyGoto action_78 +action_106 (38) = happyGoto action_79 +action_106 (39) = happyGoto action_80 +action_106 (41) = happyGoto action_81 +action_106 (59) = happyGoto action_298 +action_106 (60) = happyGoto action_122 +action_106 (61) = happyGoto action_83 +action_106 (63) = happyGoto action_84 +action_106 (64) = happyGoto action_85 +action_106 (65) = happyGoto action_86 +action_106 (66) = happyGoto action_87 +action_106 (67) = happyGoto action_88 +action_106 (68) = happyGoto action_89 +action_106 (78) = happyGoto action_90 +action_106 (79) = happyGoto action_91 +action_106 (133) = happyGoto action_93 +action_106 (135) = happyGoto action_94 +action_106 _ = happyFail (happyExpListPerState 106) + +action_107 (204) = happyShift action_297 +action_107 _ = happyFail (happyExpListPerState 107) + +action_108 _ = happyReduce_33 + +action_109 _ = happyReduce_35 + +action_110 _ = happyReduce_34 + +action_111 _ = happyReduce_32 + +action_112 _ = happyReduce_54 + +action_113 _ = happyReduce_28 + +action_114 _ = happyReduce_29 + +action_115 _ = happyReduce_52 + +action_116 _ = happyReduce_53 + +action_117 _ = happyReduce_91 + +action_118 (1) = happyAccept +action_118 _ = happyFail (happyExpListPerState 118) + +action_119 _ = happyReduce_223 + +action_120 _ = happyReduce_222 + +action_121 _ = happyReduce_221 + +action_122 (1) = happyReduce_157 +action_122 (198) = happyReduce_157 +action_122 (199) = happyReduce_157 +action_122 (200) = happyReduce_157 +action_122 (201) = happyReduce_157 +action_122 (202) = happyReduce_157 +action_122 (203) = happyReduce_157 +action_122 (205) = happyReduce_157 +action_122 (206) = happyReduce_157 +action_122 (209) = happyShift action_286 +action_122 (211) = happyShift action_288 +action_122 (212) = happyShift action_296 +action_122 (214) = happyReduce_157 +action_122 (215) = happyReduce_157 +action_122 (217) = happyReduce_157 +action_122 (218) = happyReduce_157 +action_122 (219) = happyReduce_157 +action_122 (220) = happyShift action_289 +action_122 (221) = happyReduce_157 +action_122 (222) = happyReduce_157 +action_122 (223) = happyReduce_157 +action_122 (224) = happyReduce_157 +action_122 (228) = happyReduce_157 +action_122 (229) = happyReduce_157 +action_122 (230) = happyReduce_157 +action_122 (234) = happyReduce_157 +action_122 (236) = happyReduce_157 +action_122 (242) = happyReduce_157 +action_122 (245) = happyReduce_157 +action_122 (246) = happyReduce_157 +action_122 (247) = happyReduce_157 +action_122 (248) = happyReduce_157 +action_122 (249) = happyReduce_157 +action_122 (250) = happyReduce_157 +action_122 (251) = happyReduce_157 +action_122 (253) = happyReduce_157 +action_122 (255) = happyReduce_157 +action_122 (256) = happyReduce_157 +action_122 (257) = happyReduce_157 +action_122 (258) = happyReduce_157 +action_122 (259) = happyReduce_157 +action_122 (260) = happyReduce_157 +action_122 (261) = happyReduce_157 +action_122 (262) = happyShift action_290 +action_122 (263) = happyShift action_291 +action_122 (264) = happyReduce_157 +action_122 (265) = happyReduce_157 +action_122 (266) = happyReduce_157 +action_122 (267) = happyReduce_157 +action_122 (268) = happyReduce_157 +action_122 (269) = happyReduce_157 +action_122 (270) = happyReduce_157 +action_122 (31) = happyGoto action_295 +action_122 _ = happyReduce_157 + +action_123 (1) = happyAccept +action_123 _ = happyFail (happyExpListPerState 123) + +action_124 (1) = happyAccept +action_124 _ = happyFail (happyExpListPerState 124) + +action_125 (204) = happyShift action_294 +action_125 _ = happyFail (happyExpListPerState 125) + +action_126 (1) = happyAccept +action_126 _ = happyFail (happyExpListPerState 126) + +action_127 (258) = happyShift action_24 +action_127 (259) = happyShift action_132 +action_127 (26) = happyGoto action_293 +action_127 _ = happyFail (happyExpListPerState 127) + +action_128 _ = happyReduce_342 + +action_129 (1) = happyAccept +action_129 _ = happyFail (happyExpListPerState 129) + +action_130 _ = happyReduce_341 + +action_131 (1) = happyAccept +action_131 _ = happyFail (happyExpListPerState 131) + +action_132 _ = happyReduce_24 + +action_133 _ = happyReduce_123 + +action_134 _ = happyReduce_122 + +action_135 _ = happyReduce_124 + +action_136 _ = happyReduce_127 + +action_137 _ = happyReduce_125 + +action_138 _ = happyReduce_126 + +action_139 _ = happyReduce_340 + +action_140 (1) = happyReduce_108 +action_140 (198) = happyReduce_108 +action_140 (199) = happyReduce_108 +action_140 (200) = happyReduce_108 +action_140 (201) = happyReduce_108 +action_140 (202) = happyReduce_108 +action_140 (203) = happyReduce_108 +action_140 (205) = happyReduce_108 +action_140 (206) = happyReduce_108 +action_140 (207) = happyReduce_108 +action_140 (209) = happyReduce_108 +action_140 (211) = happyReduce_108 +action_140 (212) = happyShift action_292 +action_140 (214) = happyReduce_108 +action_140 (215) = happyReduce_108 +action_140 (217) = happyReduce_108 +action_140 (218) = happyReduce_108 +action_140 (219) = happyReduce_108 +action_140 (220) = happyReduce_108 +action_140 (221) = happyReduce_108 +action_140 (222) = happyReduce_108 +action_140 (223) = happyReduce_108 +action_140 (224) = happyReduce_108 +action_140 (228) = happyReduce_108 +action_140 (229) = happyReduce_108 +action_140 (230) = happyReduce_108 +action_140 (234) = happyReduce_108 +action_140 (236) = happyReduce_108 +action_140 (242) = happyReduce_108 +action_140 (245) = happyReduce_108 +action_140 (246) = happyReduce_108 +action_140 (247) = happyReduce_108 +action_140 (248) = happyReduce_108 +action_140 (249) = happyReduce_108 +action_140 (250) = happyReduce_108 +action_140 (251) = happyReduce_108 +action_140 (253) = happyReduce_108 +action_140 (255) = happyReduce_108 +action_140 (256) = happyReduce_108 +action_140 (257) = happyReduce_108 +action_140 (258) = happyReduce_108 +action_140 (259) = happyReduce_108 +action_140 (260) = happyReduce_108 +action_140 (261) = happyReduce_108 +action_140 (262) = happyReduce_108 +action_140 (263) = happyReduce_108 +action_140 (264) = happyReduce_108 +action_140 (265) = happyReduce_108 +action_140 (266) = happyReduce_108 +action_140 (267) = happyReduce_108 +action_140 (268) = happyReduce_108 +action_140 (269) = happyReduce_108 +action_140 (270) = happyReduce_108 +action_140 _ = happyReduce_108 + +action_141 _ = happyReduce_110 + +action_142 (1) = happyReduce_112 +action_142 (198) = happyReduce_112 +action_142 (199) = happyReduce_112 +action_142 (200) = happyReduce_112 +action_142 (201) = happyReduce_112 +action_142 (202) = happyReduce_112 +action_142 (203) = happyReduce_112 +action_142 (205) = happyReduce_112 +action_142 (206) = happyReduce_112 +action_142 (207) = happyReduce_112 +action_142 (208) = happyShift action_285 +action_142 (209) = happyShift action_286 +action_142 (210) = happyShift action_287 +action_142 (211) = happyShift action_288 +action_142 (212) = happyReduce_112 +action_142 (214) = happyReduce_112 +action_142 (215) = happyReduce_112 +action_142 (217) = happyReduce_112 +action_142 (218) = happyReduce_112 +action_142 (219) = happyReduce_112 +action_142 (220) = happyShift action_289 +action_142 (221) = happyReduce_112 +action_142 (222) = happyReduce_112 +action_142 (223) = happyReduce_112 +action_142 (224) = happyReduce_112 +action_142 (228) = happyReduce_112 +action_142 (229) = happyReduce_112 +action_142 (230) = happyReduce_112 +action_142 (234) = happyReduce_112 +action_142 (236) = happyReduce_112 +action_142 (242) = happyReduce_112 +action_142 (245) = happyReduce_112 +action_142 (246) = happyReduce_112 +action_142 (247) = happyReduce_112 +action_142 (248) = happyReduce_112 +action_142 (249) = happyReduce_112 +action_142 (250) = happyReduce_112 +action_142 (251) = happyReduce_112 +action_142 (253) = happyReduce_112 +action_142 (255) = happyReduce_112 +action_142 (256) = happyReduce_112 +action_142 (257) = happyReduce_112 +action_142 (258) = happyReduce_112 +action_142 (259) = happyReduce_112 +action_142 (260) = happyReduce_112 +action_142 (261) = happyReduce_112 +action_142 (262) = happyShift action_290 +action_142 (263) = happyShift action_291 +action_142 (264) = happyReduce_112 +action_142 (265) = happyReduce_112 +action_142 (266) = happyReduce_112 +action_142 (267) = happyReduce_112 +action_142 (268) = happyReduce_112 +action_142 (269) = happyReduce_112 +action_142 (270) = happyReduce_112 +action_142 (31) = happyGoto action_284 +action_142 _ = happyReduce_112 + +action_143 (1) = happyReduce_115 +action_143 (198) = happyReduce_115 +action_143 (199) = happyReduce_115 +action_143 (200) = happyReduce_115 +action_143 (201) = happyReduce_115 +action_143 (202) = happyReduce_115 +action_143 (203) = happyReduce_115 +action_143 (205) = happyReduce_115 +action_143 (206) = happyReduce_115 +action_143 (207) = happyReduce_115 +action_143 (208) = happyReduce_115 +action_143 (209) = happyReduce_115 +action_143 (210) = happyReduce_115 +action_143 (211) = happyReduce_115 +action_143 (212) = happyReduce_115 +action_143 (214) = happyReduce_115 +action_143 (215) = happyReduce_115 +action_143 (217) = happyReduce_115 +action_143 (218) = happyReduce_115 +action_143 (219) = happyReduce_115 +action_143 (220) = happyReduce_115 +action_143 (221) = happyReduce_115 +action_143 (222) = happyReduce_115 +action_143 (223) = happyReduce_115 +action_143 (224) = happyReduce_115 +action_143 (228) = happyReduce_115 +action_143 (229) = happyReduce_115 +action_143 (230) = happyReduce_115 +action_143 (234) = happyReduce_115 +action_143 (236) = happyReduce_115 +action_143 (242) = happyReduce_115 +action_143 (245) = happyReduce_115 +action_143 (246) = happyReduce_115 +action_143 (247) = happyReduce_115 +action_143 (248) = happyReduce_115 +action_143 (249) = happyReduce_115 +action_143 (250) = happyReduce_115 +action_143 (251) = happyReduce_115 +action_143 (253) = happyReduce_115 +action_143 (255) = happyReduce_115 +action_143 (256) = happyReduce_115 +action_143 (257) = happyReduce_115 +action_143 (258) = happyReduce_115 +action_143 (259) = happyReduce_115 +action_143 (260) = happyReduce_115 +action_143 (261) = happyReduce_115 +action_143 (262) = happyReduce_115 +action_143 (263) = happyReduce_115 +action_143 (264) = happyReduce_115 +action_143 (265) = happyReduce_115 +action_143 (266) = happyReduce_115 +action_143 (267) = happyReduce_115 +action_143 (268) = happyReduce_115 +action_143 (269) = happyReduce_115 +action_143 (270) = happyReduce_115 +action_143 _ = happyReduce_115 + +action_144 (1) = happyReduce_117 +action_144 (198) = happyShift action_148 +action_144 (199) = happyReduce_117 +action_144 (200) = happyShift action_149 +action_144 (201) = happyReduce_117 +action_144 (202) = happyShift action_150 +action_144 (203) = happyReduce_117 +action_144 (205) = happyReduce_117 +action_144 (206) = happyReduce_117 +action_144 (207) = happyReduce_117 +action_144 (208) = happyReduce_117 +action_144 (209) = happyReduce_117 +action_144 (210) = happyReduce_117 +action_144 (211) = happyReduce_117 +action_144 (212) = happyReduce_117 +action_144 (214) = happyReduce_117 +action_144 (215) = happyReduce_117 +action_144 (217) = happyReduce_117 +action_144 (218) = happyShift action_151 +action_144 (219) = happyReduce_117 +action_144 (220) = happyReduce_117 +action_144 (221) = happyReduce_117 +action_144 (222) = happyReduce_117 +action_144 (223) = happyShift action_45 +action_144 (224) = happyReduce_117 +action_144 (228) = happyReduce_117 +action_144 (229) = happyReduce_117 +action_144 (230) = happyReduce_117 +action_144 (234) = happyShift action_47 +action_144 (236) = happyReduce_117 +action_144 (242) = happyReduce_117 +action_144 (245) = happyShift action_48 +action_144 (246) = happyShift action_49 +action_144 (247) = happyReduce_117 +action_144 (248) = happyShift action_50 +action_144 (249) = happyShift action_51 +action_144 (250) = happyReduce_117 +action_144 (251) = happyReduce_117 +action_144 (253) = happyReduce_117 +action_144 (254) = happyShift action_155 +action_144 (255) = happyShift action_112 +action_144 (256) = happyShift action_53 +action_144 (257) = happyReduce_117 +action_144 (258) = happyShift action_54 +action_144 (259) = happyShift action_55 +action_144 (260) = happyShift action_115 +action_144 (261) = happyShift action_116 +action_144 (262) = happyReduce_117 +action_144 (263) = happyReduce_117 +action_144 (264) = happyShift action_117 +action_144 (265) = happyReduce_117 +action_144 (266) = happyShift action_57 +action_144 (267) = happyShift action_58 +action_144 (268) = happyShift action_156 +action_144 (269) = happyReduce_117 +action_144 (270) = happyReduce_117 +action_144 (27) = happyGoto action_133 +action_144 (30) = happyGoto action_134 +action_144 (33) = happyGoto action_135 +action_144 (36) = happyGoto action_136 +action_144 (37) = happyGoto action_137 +action_144 (40) = happyGoto action_138 +action_144 (51) = happyGoto action_283 +action_144 _ = happyReduce_117 + +action_145 _ = happyReduce_119 + +action_146 (198) = happyShift action_281 +action_146 (221) = happyShift action_282 +action_146 (223) = happyShift action_45 +action_146 (234) = happyShift action_47 +action_146 (245) = happyShift action_48 +action_146 (246) = happyShift action_49 +action_146 (248) = happyShift action_50 +action_146 (249) = happyShift action_51 +action_146 (256) = happyShift action_53 +action_146 (30) = happyGoto action_277 +action_146 (55) = happyGoto action_278 +action_146 (141) = happyGoto action_279 +action_146 (171) = happyGoto action_280 +action_146 _ = happyFail (happyExpListPerState 146) + +action_147 (1) = happyAccept +action_147 _ = happyFail (happyExpListPerState 147) + +action_148 (198) = happyShift action_273 +action_148 (200) = happyShift action_274 +action_148 (202) = happyShift action_275 +action_148 (218) = happyShift action_276 +action_148 (220) = happyShift action_152 +action_148 (223) = happyShift action_45 +action_148 (231) = happyShift action_153 +action_148 (232) = happyShift action_154 +action_148 (234) = happyShift action_47 +action_148 (245) = happyShift action_48 +action_148 (246) = happyShift action_49 +action_148 (248) = happyShift action_50 +action_148 (249) = happyShift action_51 +action_148 (254) = happyShift action_155 +action_148 (255) = happyShift action_112 +action_148 (256) = happyShift action_53 +action_148 (258) = happyShift action_54 +action_148 (259) = happyShift action_55 +action_148 (260) = happyShift action_115 +action_148 (261) = happyShift action_116 +action_148 (264) = happyShift action_117 +action_148 (266) = happyShift action_57 +action_148 (267) = happyShift action_58 +action_148 (268) = happyShift action_156 +action_148 (27) = happyGoto action_267 +action_148 (30) = happyGoto action_134 +action_148 (33) = happyGoto action_268 +action_148 (36) = happyGoto action_269 +action_148 (37) = happyGoto action_137 +action_148 (40) = happyGoto action_270 +action_148 (46) = happyGoto action_271 +action_148 (47) = happyGoto action_141 +action_148 (48) = happyGoto action_142 +action_148 (49) = happyGoto action_143 +action_148 (50) = happyGoto action_144 +action_148 (51) = happyGoto action_145 +action_148 (52) = happyGoto action_272 +action_148 (57) = happyGoto action_146 +action_148 _ = happyFail (happyExpListPerState 148) + +action_149 (214) = happyShift action_231 +action_149 (222) = happyShift action_232 +action_149 (223) = happyShift action_233 +action_149 (224) = happyShift action_234 +action_149 (225) = happyShift action_235 +action_149 (226) = happyShift action_236 +action_149 (227) = happyShift action_237 +action_149 (228) = happyShift action_238 +action_149 (229) = happyShift action_239 +action_149 (230) = happyShift action_240 +action_149 (231) = happyShift action_241 +action_149 (233) = happyShift action_242 +action_149 (234) = happyShift action_243 +action_149 (235) = happyShift action_244 +action_149 (236) = happyShift action_245 +action_149 (237) = happyShift action_246 +action_149 (238) = happyShift action_247 +action_149 (239) = happyShift action_248 +action_149 (240) = happyShift action_249 +action_149 (241) = happyShift action_250 +action_149 (242) = happyShift action_251 +action_149 (243) = happyShift action_252 +action_149 (244) = happyShift action_253 +action_149 (245) = happyShift action_254 +action_149 (246) = happyShift action_255 +action_149 (247) = happyShift action_256 +action_149 (248) = happyShift action_257 +action_149 (249) = happyShift action_258 +action_149 (250) = happyShift action_259 +action_149 (251) = happyShift action_260 +action_149 (252) = happyShift action_261 +action_149 (253) = happyShift action_262 +action_149 (256) = happyShift action_263 +action_149 (266) = happyShift action_264 +action_149 (267) = happyShift action_265 +action_149 (35) = happyGoto action_226 +action_149 (53) = happyGoto action_266 +action_149 (54) = happyGoto action_228 +action_149 (163) = happyGoto action_229 +action_149 (192) = happyGoto action_230 +action_149 _ = happyReduce_142 + +action_150 (214) = happyShift action_231 +action_150 (222) = happyShift action_232 +action_150 (223) = happyShift action_233 +action_150 (224) = happyShift action_234 +action_150 (225) = happyShift action_235 +action_150 (226) = happyShift action_236 +action_150 (227) = happyShift action_237 +action_150 (228) = happyShift action_238 +action_150 (229) = happyShift action_239 +action_150 (230) = happyShift action_240 +action_150 (231) = happyShift action_241 +action_150 (233) = happyShift action_242 +action_150 (234) = happyShift action_243 +action_150 (235) = happyShift action_244 +action_150 (236) = happyShift action_245 +action_150 (237) = happyShift action_246 +action_150 (238) = happyShift action_247 +action_150 (239) = happyShift action_248 +action_150 (240) = happyShift action_249 +action_150 (241) = happyShift action_250 +action_150 (242) = happyShift action_251 +action_150 (243) = happyShift action_252 +action_150 (244) = happyShift action_253 +action_150 (245) = happyShift action_254 +action_150 (246) = happyShift action_255 +action_150 (247) = happyShift action_256 +action_150 (248) = happyShift action_257 +action_150 (249) = happyShift action_258 +action_150 (250) = happyShift action_259 +action_150 (251) = happyShift action_260 +action_150 (252) = happyShift action_261 +action_150 (253) = happyShift action_262 +action_150 (256) = happyShift action_263 +action_150 (266) = happyShift action_264 +action_150 (267) = happyShift action_265 +action_150 (35) = happyGoto action_226 +action_150 (53) = happyGoto action_227 +action_150 (54) = happyGoto action_228 +action_150 (163) = happyGoto action_229 +action_150 (192) = happyGoto action_230 +action_150 _ = happyReduce_142 + +action_151 _ = happyReduce_121 + +action_152 (268) = happyShift action_156 +action_152 (40) = happyGoto action_225 +action_152 _ = happyFail (happyExpListPerState 152) + +action_153 _ = happyReduce_153 + +action_154 _ = happyReduce_154 + +action_155 _ = happyReduce_128 + +action_156 _ = happyReduce_97 + +action_157 _ = happyReduce_339 + +action_158 (1) = happyAccept +action_158 _ = happyFail (happyExpListPerState 158) + +action_159 (198) = happyShift action_40 +action_159 (200) = happyShift action_41 +action_159 (202) = happyShift action_42 +action_159 (212) = happyShift action_224 +action_159 (218) = happyShift action_43 +action_159 (223) = happyShift action_45 +action_159 (230) = happyShift action_46 +action_159 (234) = happyShift action_47 +action_159 (245) = happyShift action_48 +action_159 (246) = happyShift action_49 +action_159 (248) = happyShift action_50 +action_159 (249) = happyShift action_51 +action_159 (251) = happyShift action_52 +action_159 (256) = happyShift action_53 +action_159 (258) = happyShift action_54 +action_159 (259) = happyShift action_55 +action_159 (265) = happyShift action_56 +action_159 (266) = happyShift action_57 +action_159 (267) = happyShift action_58 +action_159 (268) = happyShift action_59 +action_159 (269) = happyShift action_60 +action_159 (27) = happyGoto action_25 +action_159 (30) = happyGoto action_26 +action_159 (37) = happyGoto action_27 +action_159 (38) = happyGoto action_28 +action_159 (39) = happyGoto action_29 +action_159 (41) = happyGoto action_30 +action_159 (91) = happyGoto action_35 +action_159 (132) = happyGoto action_36 +action_159 (134) = happyGoto action_37 +action_159 (136) = happyGoto action_222 +action_159 (142) = happyGoto action_223 +action_159 (166) = happyGoto action_39 +action_159 _ = happyReduce_357 + +action_160 _ = happyReduce_338 + +action_161 (213) = happyShift action_221 +action_161 _ = happyReduce_285 + +action_162 (213) = happyShift action_220 +action_162 _ = happyFail (happyExpListPerState 162) + +action_163 (213) = happyShift action_219 +action_163 _ = happyFail (happyExpListPerState 163) + +action_164 (253) = happyShift action_218 +action_164 _ = happyReduce_289 + +action_165 (253) = happyShift action_217 +action_165 _ = happyReduce_291 + +action_166 _ = happyReduce_300 + +action_167 (268) = happyShift action_156 +action_167 (40) = happyGoto action_216 +action_167 _ = happyFail (happyExpListPerState 167) + +action_168 (1) = happyAccept +action_168 _ = happyFail (happyExpListPerState 168) + +action_169 _ = happyReduce_308 + +action_170 (258) = happyShift action_63 +action_170 (28) = happyGoto action_215 +action_170 _ = happyFail (happyExpListPerState 170) + +action_171 (241) = happyShift action_176 +action_171 (244) = happyShift action_214 +action_171 (118) = happyGoto action_213 +action_171 _ = happyFail (happyExpListPerState 171) + +action_172 (235) = happyShift action_212 +action_172 _ = happyFail (happyExpListPerState 172) + +action_173 _ = happyReduce_331 + +action_174 _ = happyReduce_332 + +action_175 _ = happyReduce_333 + +action_176 (198) = happyShift action_68 +action_176 (231) = happyShift action_153 +action_176 (232) = happyShift action_154 +action_176 (258) = happyShift action_54 +action_176 (259) = happyShift action_55 +action_176 (27) = happyGoto action_208 +action_176 (57) = happyGoto action_209 +action_176 (119) = happyGoto action_210 +action_176 (120) = happyGoto action_211 +action_176 (121) = happyGoto action_67 +action_176 _ = happyFail (happyExpListPerState 176) + +action_177 (258) = happyShift action_63 +action_177 (28) = happyGoto action_207 +action_177 _ = happyFail (happyExpListPerState 177) + +action_178 (249) = happyShift action_206 +action_178 (258) = happyShift action_63 +action_178 (28) = happyGoto action_205 +action_178 _ = happyFail (happyExpListPerState 178) + +action_179 _ = happyReduce_337 + +action_180 (1) = happyAccept +action_180 _ = happyFail (happyExpListPerState 180) + +action_181 (258) = happyShift action_24 +action_181 (259) = happyShift action_132 +action_181 (26) = happyGoto action_204 +action_181 _ = happyFail (happyExpListPerState 181) + +action_182 (270) = happyAccept +action_182 _ = happyFail (happyExpListPerState 182) + +action_183 (270) = happyAccept +action_183 _ = happyFail (happyExpListPerState 183) + +action_184 (205) = happyShift action_203 +action_184 _ = happyFail (happyExpListPerState 184) + +action_185 _ = happyReduce_405 + +action_186 _ = happyReduce_258 + +action_187 (205) = happyReduce_416 +action_187 (206) = happyReduce_416 +action_187 (229) = happyReduce_416 +action_187 _ = happyReduce_416 + +action_188 _ = happyReduce_256 + +action_189 _ = happyReduce_259 + +action_190 (206) = happyShift action_202 +action_190 _ = happyReduce_369 + +action_191 (229) = happyShift action_201 +action_191 (99) = happyGoto action_200 +action_191 _ = happyReduce_373 + +action_192 (270) = happyAccept +action_192 _ = happyFail (happyExpListPerState 192) + +action_193 _ = happyReduce_49 + +action_194 _ = happyReduce_51 + +action_195 _ = happyReduce_50 + +action_196 _ = happyReduce_48 + +action_197 (270) = happyAccept +action_197 _ = happyFail (happyExpListPerState 197) + +action_198 (270) = happyAccept +action_198 _ = happyFail (happyExpListPerState 198) + +action_199 (270) = happyAccept +action_199 _ = happyFail (happyExpListPerState 199) + +action_200 (223) = happyShift action_45 +action_200 (225) = happyShift action_169 +action_200 (226) = happyShift action_170 +action_200 (227) = happyShift action_171 +action_200 (233) = happyShift action_172 +action_200 (234) = happyShift action_47 +action_200 (238) = happyShift action_173 +action_200 (239) = happyShift action_174 +action_200 (240) = happyShift action_175 +action_200 (241) = happyShift action_176 +action_200 (244) = happyShift action_177 +action_200 (245) = happyShift action_48 +action_200 (246) = happyShift action_49 +action_200 (248) = happyShift action_50 +action_200 (249) = happyShift action_51 +action_200 (252) = happyShift action_178 +action_200 (256) = happyShift action_53 +action_200 (30) = happyGoto action_159 +action_200 (106) = happyGoto action_470 +action_200 (107) = happyGoto action_161 +action_200 (108) = happyGoto action_162 +action_200 (109) = happyGoto action_163 +action_200 (111) = happyGoto action_164 +action_200 (118) = happyGoto action_165 +action_200 (123) = happyGoto action_166 +action_200 (124) = happyGoto action_167 +action_200 _ = happyFail (happyExpListPerState 200) + +action_201 (206) = happyShift action_469 +action_201 _ = happyReduce_260 + +action_202 (223) = happyShift action_45 +action_202 (225) = happyShift action_169 +action_202 (226) = happyShift action_170 +action_202 (227) = happyShift action_171 +action_202 (233) = happyShift action_172 +action_202 (234) = happyShift action_47 +action_202 (235) = happyShift action_181 +action_202 (238) = happyShift action_173 +action_202 (239) = happyShift action_174 +action_202 (240) = happyShift action_175 +action_202 (241) = happyShift action_176 +action_202 (244) = happyShift action_177 +action_202 (245) = happyShift action_48 +action_202 (246) = happyShift action_49 +action_202 (248) = happyShift action_50 +action_202 (249) = happyShift action_51 +action_202 (252) = happyShift action_178 +action_202 (256) = happyShift action_53 +action_202 (30) = happyGoto action_159 +action_202 (98) = happyGoto action_468 +action_202 (103) = happyGoto action_186 +action_202 (106) = happyGoto action_187 +action_202 (107) = happyGoto action_161 +action_202 (108) = happyGoto action_162 +action_202 (109) = happyGoto action_163 +action_202 (111) = happyGoto action_164 +action_202 (118) = happyGoto action_165 +action_202 (123) = happyGoto action_166 +action_202 (124) = happyGoto action_167 +action_202 (154) = happyGoto action_189 +action_202 (183) = happyGoto action_191 +action_202 _ = happyFail (happyExpListPerState 202) + +action_203 _ = happyReduce_251 + +action_204 (198) = happyShift action_466 +action_204 (234) = happyShift action_467 +action_204 (104) = happyGoto action_465 +action_204 _ = happyReduce_276 + +action_205 (198) = happyShift action_450 +action_205 (212) = happyShift action_464 +action_205 (223) = happyShift action_45 +action_205 (234) = happyShift action_47 +action_205 (245) = happyShift action_48 +action_205 (246) = happyShift action_49 +action_205 (248) = happyShift action_50 +action_205 (249) = happyShift action_51 +action_205 (256) = happyShift action_53 +action_205 (30) = happyGoto action_445 +action_205 (56) = happyGoto action_446 +action_205 (145) = happyGoto action_463 +action_205 (165) = happyGoto action_448 +action_205 (194) = happyGoto action_449 +action_205 _ = happyReduce_363 + +action_206 (258) = happyShift action_63 +action_206 (28) = happyGoto action_462 +action_206 _ = happyFail (happyExpListPerState 206) + +action_207 (198) = happyShift action_450 +action_207 (212) = happyShift action_461 +action_207 (223) = happyShift action_45 +action_207 (234) = happyShift action_47 +action_207 (245) = happyShift action_48 +action_207 (246) = happyShift action_49 +action_207 (248) = happyShift action_50 +action_207 (249) = happyShift action_51 +action_207 (256) = happyShift action_53 +action_207 (30) = happyGoto action_445 +action_207 (56) = happyGoto action_446 +action_207 (145) = happyGoto action_460 +action_207 (165) = happyGoto action_448 +action_207 (194) = happyGoto action_449 +action_207 _ = happyReduce_363 + +action_208 (198) = happyShift action_148 +action_208 (200) = happyShift action_149 +action_208 (202) = happyShift action_150 +action_208 (218) = happyShift action_151 +action_208 (223) = happyShift action_45 +action_208 (234) = happyShift action_47 +action_208 (245) = happyShift action_48 +action_208 (246) = happyShift action_49 +action_208 (248) = happyShift action_50 +action_208 (249) = happyShift action_51 +action_208 (254) = happyShift action_155 +action_208 (255) = happyShift action_112 +action_208 (256) = happyShift action_53 +action_208 (258) = happyShift action_54 +action_208 (259) = happyShift action_55 +action_208 (260) = happyShift action_115 +action_208 (261) = happyShift action_116 +action_208 (264) = happyShift action_117 +action_208 (266) = happyShift action_57 +action_208 (267) = happyShift action_58 +action_208 (268) = happyShift action_156 +action_208 (27) = happyGoto action_133 +action_208 (30) = happyGoto action_134 +action_208 (33) = happyGoto action_135 +action_208 (36) = happyGoto action_136 +action_208 (37) = happyGoto action_137 +action_208 (40) = happyGoto action_138 +action_208 (51) = happyGoto action_326 +action_208 (143) = happyGoto action_459 +action_208 (164) = happyGoto action_328 +action_208 (193) = happyGoto action_329 +action_208 _ = happyReduce_359 + +action_209 (198) = happyShift action_281 +action_209 (221) = happyShift action_282 +action_209 (223) = happyShift action_45 +action_209 (234) = happyShift action_47 +action_209 (245) = happyShift action_48 +action_209 (246) = happyShift action_49 +action_209 (248) = happyShift action_50 +action_209 (249) = happyShift action_51 +action_209 (256) = happyShift action_53 +action_209 (30) = happyGoto action_277 +action_209 (55) = happyGoto action_278 +action_209 (141) = happyGoto action_458 +action_209 (171) = happyGoto action_280 +action_209 _ = happyFail (happyExpListPerState 209) + +action_210 (198) = happyShift action_68 +action_210 (258) = happyShift action_54 +action_210 (259) = happyShift action_55 +action_210 (27) = happyGoto action_456 +action_210 (120) = happyGoto action_457 +action_210 (121) = happyGoto action_67 +action_210 _ = happyFail (happyExpListPerState 210) + +action_211 (210) = happyShift action_455 +action_211 _ = happyFail (happyExpListPerState 211) + +action_212 (223) = happyShift action_45 +action_212 (226) = happyShift action_454 +action_212 (234) = happyShift action_47 +action_212 (245) = happyShift action_48 +action_212 (246) = happyShift action_49 +action_212 (248) = happyShift action_50 +action_212 (249) = happyShift action_51 +action_212 (256) = happyShift action_53 +action_212 (30) = happyGoto action_453 +action_212 _ = happyFail (happyExpListPerState 212) + +action_213 _ = happyReduce_296 + +action_214 (241) = happyShift action_176 +action_214 (118) = happyGoto action_452 +action_214 _ = happyFail (happyExpListPerState 214) + +action_215 (198) = happyShift action_450 +action_215 (212) = happyShift action_451 +action_215 (223) = happyShift action_45 +action_215 (234) = happyShift action_47 +action_215 (245) = happyShift action_48 +action_215 (246) = happyShift action_49 +action_215 (248) = happyShift action_50 +action_215 (249) = happyShift action_51 +action_215 (256) = happyShift action_53 +action_215 (30) = happyGoto action_445 +action_215 (56) = happyGoto action_446 +action_215 (145) = happyGoto action_447 +action_215 (165) = happyGoto action_448 +action_215 (194) = happyGoto action_449 +action_215 _ = happyReduce_363 + +action_216 (223) = happyShift action_102 +action_216 (234) = happyShift action_105 +action_216 (245) = happyShift action_108 +action_216 (246) = happyShift action_109 +action_216 (248) = happyShift action_110 +action_216 (249) = happyShift action_111 +action_216 (252) = happyShift action_444 +action_216 (256) = happyShift action_113 +action_216 (257) = happyShift action_114 +action_216 (258) = happyShift action_54 +action_216 (259) = happyShift action_55 +action_216 (27) = happyGoto action_442 +action_216 (29) = happyGoto action_443 +action_216 _ = happyFail (happyExpListPerState 216) + +action_217 (204) = happyShift action_441 +action_217 _ = happyFail (happyExpListPerState 217) + +action_218 (204) = happyShift action_440 +action_218 _ = happyFail (happyExpListPerState 218) + +action_219 (258) = happyShift action_63 +action_219 (28) = happyGoto action_439 +action_219 _ = happyFail (happyExpListPerState 219) + +action_220 (198) = happyShift action_148 +action_220 (200) = happyShift action_149 +action_220 (202) = happyShift action_150 +action_220 (218) = happyShift action_151 +action_220 (220) = happyShift action_152 +action_220 (223) = happyShift action_45 +action_220 (231) = happyShift action_153 +action_220 (232) = happyShift action_154 +action_220 (234) = happyShift action_47 +action_220 (245) = happyShift action_48 +action_220 (246) = happyShift action_49 +action_220 (248) = happyShift action_50 +action_220 (249) = happyShift action_51 +action_220 (254) = happyShift action_155 +action_220 (255) = happyShift action_112 +action_220 (256) = happyShift action_53 +action_220 (258) = happyShift action_54 +action_220 (259) = happyShift action_55 +action_220 (260) = happyShift action_115 +action_220 (261) = happyShift action_116 +action_220 (264) = happyShift action_117 +action_220 (266) = happyShift action_57 +action_220 (267) = happyShift action_58 +action_220 (268) = happyShift action_156 +action_220 (27) = happyGoto action_133 +action_220 (30) = happyGoto action_134 +action_220 (33) = happyGoto action_135 +action_220 (36) = happyGoto action_136 +action_220 (37) = happyGoto action_137 +action_220 (40) = happyGoto action_138 +action_220 (45) = happyGoto action_438 +action_220 (46) = happyGoto action_140 +action_220 (47) = happyGoto action_141 +action_220 (48) = happyGoto action_142 +action_220 (49) = happyGoto action_143 +action_220 (50) = happyGoto action_144 +action_220 (51) = happyGoto action_145 +action_220 (57) = happyGoto action_146 +action_220 _ = happyFail (happyExpListPerState 220) + +action_221 (258) = happyShift action_63 +action_221 (28) = happyGoto action_434 +action_221 (110) = happyGoto action_435 +action_221 (153) = happyGoto action_436 +action_221 (182) = happyGoto action_437 +action_221 _ = happyFail (happyExpListPerState 221) + +action_222 _ = happyReduce_358 + +action_223 (213) = happyShift action_432 +action_223 (214) = happyShift action_433 +action_223 (74) = happyGoto action_427 +action_223 (75) = happyGoto action_428 +action_223 (83) = happyGoto action_429 +action_223 (138) = happyGoto action_430 +action_223 (168) = happyGoto action_431 +action_223 _ = happyFail (happyExpListPerState 223) + +action_224 (198) = happyShift action_148 +action_224 (200) = happyShift action_149 +action_224 (202) = happyShift action_150 +action_224 (218) = happyShift action_151 +action_224 (220) = happyShift action_152 +action_224 (223) = happyShift action_45 +action_224 (231) = happyShift action_153 +action_224 (232) = happyShift action_154 +action_224 (234) = happyShift action_47 +action_224 (245) = happyShift action_48 +action_224 (246) = happyShift action_49 +action_224 (248) = happyShift action_50 +action_224 (249) = happyShift action_51 +action_224 (254) = happyShift action_155 +action_224 (255) = happyShift action_112 +action_224 (256) = happyShift action_53 +action_224 (258) = happyShift action_54 +action_224 (259) = happyShift action_55 +action_224 (260) = happyShift action_115 +action_224 (261) = happyShift action_116 +action_224 (264) = happyShift action_117 +action_224 (266) = happyShift action_57 +action_224 (267) = happyShift action_58 +action_224 (268) = happyShift action_156 +action_224 (27) = happyGoto action_133 +action_224 (30) = happyGoto action_134 +action_224 (33) = happyGoto action_135 +action_224 (36) = happyGoto action_136 +action_224 (37) = happyGoto action_137 +action_224 (40) = happyGoto action_138 +action_224 (45) = happyGoto action_426 +action_224 (46) = happyGoto action_140 +action_224 (47) = happyGoto action_141 +action_224 (48) = happyGoto action_142 +action_224 (49) = happyGoto action_143 +action_224 (50) = happyGoto action_144 +action_224 (51) = happyGoto action_145 +action_224 (57) = happyGoto action_146 +action_224 _ = happyFail (happyExpListPerState 224) + +action_225 _ = happyReduce_118 + +action_226 (212) = happyShift action_425 +action_226 _ = happyFail (happyExpListPerState 226) + +action_227 (203) = happyShift action_424 +action_227 _ = happyFail (happyExpListPerState 227) + +action_228 (201) = happyReduce_434 +action_228 (203) = happyReduce_434 +action_228 (214) = happyReduce_434 +action_228 (217) = happyReduce_434 +action_228 _ = happyReduce_434 + +action_229 (214) = happyShift action_423 +action_229 _ = happyReduce_144 + +action_230 (217) = happyShift action_422 +action_230 _ = happyReduce_382 + +action_231 (198) = happyShift action_148 +action_231 (200) = happyShift action_149 +action_231 (202) = happyShift action_150 +action_231 (218) = happyShift action_151 +action_231 (220) = happyShift action_152 +action_231 (223) = happyShift action_45 +action_231 (231) = happyShift action_153 +action_231 (232) = happyShift action_154 +action_231 (234) = happyShift action_47 +action_231 (245) = happyShift action_48 +action_231 (246) = happyShift action_49 +action_231 (248) = happyShift action_50 +action_231 (249) = happyShift action_51 +action_231 (254) = happyShift action_155 +action_231 (255) = happyShift action_112 +action_231 (256) = happyShift action_53 +action_231 (258) = happyShift action_54 +action_231 (259) = happyShift action_55 +action_231 (260) = happyShift action_115 +action_231 (261) = happyShift action_116 +action_231 (264) = happyShift action_117 +action_231 (266) = happyShift action_57 +action_231 (267) = happyShift action_58 +action_231 (268) = happyShift action_156 +action_231 (27) = happyGoto action_133 +action_231 (30) = happyGoto action_134 +action_231 (33) = happyGoto action_135 +action_231 (36) = happyGoto action_136 +action_231 (37) = happyGoto action_137 +action_231 (40) = happyGoto action_138 +action_231 (45) = happyGoto action_421 +action_231 (46) = happyGoto action_140 +action_231 (47) = happyGoto action_141 +action_231 (48) = happyGoto action_142 +action_231 (49) = happyGoto action_143 +action_231 (50) = happyGoto action_144 +action_231 (51) = happyGoto action_145 +action_231 (57) = happyGoto action_146 +action_231 _ = happyFail (happyExpListPerState 231) + +action_232 _ = happyReduce_60 + +action_233 _ = happyReduce_61 + +action_234 _ = happyReduce_62 + +action_235 _ = happyReduce_63 + +action_236 _ = happyReduce_64 + +action_237 _ = happyReduce_65 + +action_238 _ = happyReduce_66 + +action_239 _ = happyReduce_67 + +action_240 _ = happyReduce_68 + +action_241 _ = happyReduce_69 + +action_242 _ = happyReduce_70 + +action_243 _ = happyReduce_71 + +action_244 _ = happyReduce_72 + +action_245 _ = happyReduce_73 + +action_246 _ = happyReduce_74 + +action_247 _ = happyReduce_75 + +action_248 _ = happyReduce_76 + +action_249 _ = happyReduce_77 + +action_250 _ = happyReduce_78 + +action_251 _ = happyReduce_79 + +action_252 _ = happyReduce_80 + +action_253 _ = happyReduce_81 + +action_254 _ = happyReduce_82 + +action_255 _ = happyReduce_84 + +action_256 _ = happyReduce_83 + +action_257 _ = happyReduce_85 + +action_258 _ = happyReduce_86 + +action_259 _ = happyReduce_87 + +action_260 _ = happyReduce_88 + +action_261 _ = happyReduce_89 + +action_262 _ = happyReduce_90 + +action_263 _ = happyReduce_57 + +action_264 _ = happyReduce_58 + +action_265 _ = happyReduce_59 + +action_266 (201) = happyShift action_420 +action_266 _ = happyFail (happyExpListPerState 266) + +action_267 (212) = happyReduce_134 +action_267 _ = happyReduce_123 + +action_268 (212) = happyReduce_135 +action_268 _ = happyReduce_124 + +action_269 (212) = happyReduce_137 +action_269 _ = happyReduce_127 + +action_270 (212) = happyReduce_136 +action_270 _ = happyReduce_126 + +action_271 (199) = happyShift action_419 +action_271 _ = happyFail (happyExpListPerState 271) + +action_272 (212) = happyShift action_418 +action_272 _ = happyFail (happyExpListPerState 272) + +action_273 (198) = happyShift action_273 +action_273 (200) = happyShift action_274 +action_273 (202) = happyShift action_275 +action_273 (218) = happyShift action_276 +action_273 (220) = happyShift action_152 +action_273 (223) = happyShift action_45 +action_273 (231) = happyShift action_153 +action_273 (232) = happyShift action_154 +action_273 (234) = happyShift action_47 +action_273 (245) = happyShift action_48 +action_273 (246) = happyShift action_49 +action_273 (248) = happyShift action_50 +action_273 (249) = happyShift action_51 +action_273 (254) = happyShift action_155 +action_273 (255) = happyShift action_112 +action_273 (256) = happyShift action_53 +action_273 (258) = happyShift action_54 +action_273 (259) = happyShift action_55 +action_273 (260) = happyShift action_115 +action_273 (261) = happyShift action_116 +action_273 (264) = happyShift action_117 +action_273 (266) = happyShift action_57 +action_273 (267) = happyShift action_58 +action_273 (268) = happyShift action_156 +action_273 (27) = happyGoto action_267 +action_273 (30) = happyGoto action_134 +action_273 (33) = happyGoto action_268 +action_273 (36) = happyGoto action_269 +action_273 (37) = happyGoto action_137 +action_273 (40) = happyGoto action_270 +action_273 (46) = happyGoto action_416 +action_273 (47) = happyGoto action_141 +action_273 (48) = happyGoto action_142 +action_273 (49) = happyGoto action_143 +action_273 (50) = happyGoto action_144 +action_273 (51) = happyGoto action_145 +action_273 (52) = happyGoto action_417 +action_273 (57) = happyGoto action_146 +action_273 _ = happyFail (happyExpListPerState 273) + +action_274 (214) = happyShift action_231 +action_274 (222) = happyShift action_232 +action_274 (223) = happyShift action_233 +action_274 (224) = happyShift action_234 +action_274 (225) = happyShift action_235 +action_274 (226) = happyShift action_236 +action_274 (227) = happyShift action_237 +action_274 (228) = happyShift action_238 +action_274 (229) = happyShift action_239 +action_274 (230) = happyShift action_240 +action_274 (231) = happyShift action_241 +action_274 (233) = happyShift action_242 +action_274 (234) = happyShift action_243 +action_274 (235) = happyShift action_244 +action_274 (236) = happyShift action_245 +action_274 (237) = happyShift action_246 +action_274 (238) = happyShift action_247 +action_274 (239) = happyShift action_248 +action_274 (240) = happyShift action_249 +action_274 (241) = happyShift action_250 +action_274 (242) = happyShift action_251 +action_274 (243) = happyShift action_252 +action_274 (244) = happyShift action_253 +action_274 (245) = happyShift action_254 +action_274 (246) = happyShift action_255 +action_274 (247) = happyShift action_256 +action_274 (248) = happyShift action_257 +action_274 (249) = happyShift action_258 +action_274 (250) = happyShift action_259 +action_274 (251) = happyShift action_260 +action_274 (252) = happyShift action_261 +action_274 (253) = happyShift action_262 +action_274 (256) = happyShift action_263 +action_274 (266) = happyShift action_264 +action_274 (267) = happyShift action_265 +action_274 (35) = happyGoto action_226 +action_274 (53) = happyGoto action_415 +action_274 (54) = happyGoto action_228 +action_274 (163) = happyGoto action_229 +action_274 (192) = happyGoto action_230 +action_274 _ = happyReduce_142 + +action_275 (214) = happyShift action_231 +action_275 (222) = happyShift action_232 +action_275 (223) = happyShift action_233 +action_275 (224) = happyShift action_234 +action_275 (225) = happyShift action_235 +action_275 (226) = happyShift action_236 +action_275 (227) = happyShift action_237 +action_275 (228) = happyShift action_238 +action_275 (229) = happyShift action_239 +action_275 (230) = happyShift action_240 +action_275 (231) = happyShift action_241 +action_275 (233) = happyShift action_242 +action_275 (234) = happyShift action_243 +action_275 (235) = happyShift action_244 +action_275 (236) = happyShift action_245 +action_275 (237) = happyShift action_246 +action_275 (238) = happyShift action_247 +action_275 (239) = happyShift action_248 +action_275 (240) = happyShift action_249 +action_275 (241) = happyShift action_250 +action_275 (242) = happyShift action_251 +action_275 (243) = happyShift action_252 +action_275 (244) = happyShift action_253 +action_275 (245) = happyShift action_254 +action_275 (246) = happyShift action_255 +action_275 (247) = happyShift action_256 +action_275 (248) = happyShift action_257 +action_275 (249) = happyShift action_258 +action_275 (250) = happyShift action_259 +action_275 (251) = happyShift action_260 +action_275 (252) = happyShift action_261 +action_275 (253) = happyShift action_262 +action_275 (256) = happyShift action_263 +action_275 (266) = happyShift action_264 +action_275 (267) = happyShift action_265 +action_275 (35) = happyGoto action_226 +action_275 (53) = happyGoto action_414 +action_275 (54) = happyGoto action_228 +action_275 (163) = happyGoto action_229 +action_275 (192) = happyGoto action_230 +action_275 _ = happyReduce_142 + +action_276 (212) = happyReduce_133 +action_276 _ = happyReduce_121 + +action_277 _ = happyReduce_147 + +action_278 _ = happyReduce_395 + +action_279 (216) = happyShift action_413 +action_279 _ = happyFail (happyExpListPerState 279) + +action_280 (1) = happyReduce_356 +action_280 (198) = happyShift action_281 +action_280 (214) = happyReduce_356 +action_280 (216) = happyReduce_356 +action_280 (221) = happyShift action_282 +action_280 (223) = happyShift action_45 +action_280 (234) = happyShift action_47 +action_280 (245) = happyShift action_48 +action_280 (246) = happyShift action_49 +action_280 (248) = happyShift action_50 +action_280 (249) = happyShift action_51 +action_280 (256) = happyShift action_53 +action_280 (30) = happyGoto action_277 +action_280 (55) = happyGoto action_412 +action_280 _ = happyReduce_356 + +action_281 (221) = happyShift action_411 +action_281 (223) = happyShift action_45 +action_281 (234) = happyShift action_47 +action_281 (245) = happyShift action_48 +action_281 (246) = happyShift action_49 +action_281 (248) = happyShift action_50 +action_281 (249) = happyShift action_51 +action_281 (256) = happyShift action_53 +action_281 (30) = happyGoto action_410 +action_281 _ = happyFail (happyExpListPerState 281) + +action_282 (223) = happyShift action_45 +action_282 (234) = happyShift action_47 +action_282 (245) = happyShift action_48 +action_282 (246) = happyShift action_49 +action_282 (248) = happyShift action_50 +action_282 (249) = happyShift action_51 +action_282 (256) = happyShift action_53 +action_282 (30) = happyGoto action_409 +action_282 _ = happyFail (happyExpListPerState 282) + +action_283 _ = happyReduce_120 + +action_284 (198) = happyShift action_148 +action_284 (200) = happyShift action_149 +action_284 (202) = happyShift action_150 +action_284 (218) = happyShift action_151 +action_284 (220) = happyShift action_152 +action_284 (223) = happyShift action_45 +action_284 (234) = happyShift action_47 +action_284 (245) = happyShift action_48 +action_284 (246) = happyShift action_49 +action_284 (248) = happyShift action_50 +action_284 (249) = happyShift action_51 +action_284 (254) = happyShift action_155 +action_284 (255) = happyShift action_112 +action_284 (256) = happyShift action_53 +action_284 (258) = happyShift action_54 +action_284 (259) = happyShift action_55 +action_284 (260) = happyShift action_115 +action_284 (261) = happyShift action_116 +action_284 (264) = happyShift action_117 +action_284 (266) = happyShift action_57 +action_284 (267) = happyShift action_58 +action_284 (268) = happyShift action_156 +action_284 (27) = happyGoto action_133 +action_284 (30) = happyGoto action_134 +action_284 (33) = happyGoto action_135 +action_284 (36) = happyGoto action_136 +action_284 (37) = happyGoto action_137 +action_284 (40) = happyGoto action_138 +action_284 (49) = happyGoto action_408 +action_284 (50) = happyGoto action_144 +action_284 (51) = happyGoto action_145 +action_284 _ = happyFail (happyExpListPerState 284) + +action_285 (198) = happyShift action_148 +action_285 (200) = happyShift action_149 +action_285 (202) = happyShift action_150 +action_285 (218) = happyShift action_151 +action_285 (220) = happyShift action_152 +action_285 (223) = happyShift action_45 +action_285 (231) = happyShift action_153 +action_285 (232) = happyShift action_154 +action_285 (234) = happyShift action_47 +action_285 (245) = happyShift action_48 +action_285 (246) = happyShift action_49 +action_285 (248) = happyShift action_50 +action_285 (249) = happyShift action_51 +action_285 (254) = happyShift action_155 +action_285 (255) = happyShift action_112 +action_285 (256) = happyShift action_53 +action_285 (258) = happyShift action_54 +action_285 (259) = happyShift action_55 +action_285 (260) = happyShift action_115 +action_285 (261) = happyShift action_116 +action_285 (264) = happyShift action_117 +action_285 (266) = happyShift action_57 +action_285 (267) = happyShift action_58 +action_285 (268) = happyShift action_156 +action_285 (27) = happyGoto action_133 +action_285 (30) = happyGoto action_134 +action_285 (33) = happyGoto action_135 +action_285 (36) = happyGoto action_136 +action_285 (37) = happyGoto action_137 +action_285 (40) = happyGoto action_138 +action_285 (46) = happyGoto action_407 +action_285 (47) = happyGoto action_141 +action_285 (48) = happyGoto action_142 +action_285 (49) = happyGoto action_143 +action_285 (50) = happyGoto action_144 +action_285 (51) = happyGoto action_145 +action_285 (57) = happyGoto action_146 +action_285 _ = happyFail (happyExpListPerState 285) + +action_286 _ = happyReduce_45 + +action_287 (198) = happyShift action_148 +action_287 (200) = happyShift action_149 +action_287 (202) = happyShift action_150 +action_287 (218) = happyShift action_151 +action_287 (220) = happyShift action_152 +action_287 (223) = happyShift action_45 +action_287 (231) = happyShift action_153 +action_287 (232) = happyShift action_154 +action_287 (234) = happyShift action_47 +action_287 (245) = happyShift action_48 +action_287 (246) = happyShift action_49 +action_287 (248) = happyShift action_50 +action_287 (249) = happyShift action_51 +action_287 (254) = happyShift action_155 +action_287 (255) = happyShift action_112 +action_287 (256) = happyShift action_53 +action_287 (258) = happyShift action_54 +action_287 (259) = happyShift action_55 +action_287 (260) = happyShift action_115 +action_287 (261) = happyShift action_116 +action_287 (264) = happyShift action_117 +action_287 (266) = happyShift action_57 +action_287 (267) = happyShift action_58 +action_287 (268) = happyShift action_156 +action_287 (27) = happyGoto action_133 +action_287 (30) = happyGoto action_134 +action_287 (33) = happyGoto action_135 +action_287 (36) = happyGoto action_136 +action_287 (37) = happyGoto action_137 +action_287 (40) = happyGoto action_138 +action_287 (46) = happyGoto action_406 +action_287 (47) = happyGoto action_141 +action_287 (48) = happyGoto action_142 +action_287 (49) = happyGoto action_143 +action_287 (50) = happyGoto action_144 +action_287 (51) = happyGoto action_145 +action_287 (57) = happyGoto action_146 +action_287 _ = happyFail (happyExpListPerState 287) + +action_288 _ = happyReduce_47 + +action_289 _ = happyReduce_46 + +action_290 _ = happyReduce_43 + +action_291 _ = happyReduce_44 + +action_292 (198) = happyShift action_404 +action_292 (218) = happyShift action_405 +action_292 (258) = happyShift action_54 +action_292 (259) = happyShift action_55 +action_292 (264) = happyShift action_117 +action_292 (27) = happyGoto action_399 +action_292 (36) = happyGoto action_400 +action_292 (42) = happyGoto action_401 +action_292 (43) = happyGoto action_402 +action_292 (44) = happyGoto action_403 +action_292 _ = happyFail (happyExpListPerState 292) + +action_293 (198) = happyShift action_398 +action_293 (100) = happyGoto action_397 +action_293 _ = happyReduce_262 + +action_294 (198) = happyShift action_40 +action_294 (200) = happyShift action_41 +action_294 (202) = happyShift action_42 +action_294 (218) = happyShift action_43 +action_294 (220) = happyShift action_44 +action_294 (223) = happyShift action_45 +action_294 (230) = happyShift action_46 +action_294 (234) = happyShift action_47 +action_294 (245) = happyShift action_48 +action_294 (246) = happyShift action_49 +action_294 (248) = happyShift action_50 +action_294 (249) = happyShift action_51 +action_294 (251) = happyShift action_52 +action_294 (256) = happyShift action_53 +action_294 (258) = happyShift action_54 +action_294 (259) = happyShift action_55 +action_294 (265) = happyShift action_56 +action_294 (266) = happyShift action_57 +action_294 (267) = happyShift action_58 +action_294 (268) = happyShift action_59 +action_294 (269) = happyShift action_60 +action_294 (27) = happyGoto action_25 +action_294 (30) = happyGoto action_389 +action_294 (37) = happyGoto action_27 +action_294 (38) = happyGoto action_28 +action_294 (39) = happyGoto action_29 +action_294 (41) = happyGoto action_30 +action_294 (72) = happyGoto action_390 +action_294 (89) = happyGoto action_391 +action_294 (90) = happyGoto action_34 +action_294 (91) = happyGoto action_35 +action_294 (132) = happyGoto action_36 +action_294 (134) = happyGoto action_37 +action_294 (136) = happyGoto action_38 +action_294 (149) = happyGoto action_396 +action_294 (166) = happyGoto action_39 +action_294 (175) = happyGoto action_393 +action_294 _ = happyFail (happyExpListPerState 294) + +action_295 (198) = happyShift action_95 +action_295 (200) = happyShift action_96 +action_295 (202) = happyShift action_97 +action_295 (218) = happyShift action_98 +action_295 (219) = happyShift action_99 +action_295 (220) = happyShift action_100 +action_295 (222) = happyShift action_101 +action_295 (223) = happyShift action_102 +action_295 (224) = happyShift action_103 +action_295 (228) = happyShift action_104 +action_295 (230) = happyShift action_46 +action_295 (234) = happyShift action_105 +action_295 (236) = happyShift action_106 +action_295 (242) = happyShift action_107 +action_295 (245) = happyShift action_108 +action_295 (246) = happyShift action_109 +action_295 (248) = happyShift action_110 +action_295 (249) = happyShift action_111 +action_295 (251) = happyShift action_52 +action_295 (255) = happyShift action_112 +action_295 (256) = happyShift action_113 +action_295 (257) = happyShift action_114 +action_295 (258) = happyShift action_54 +action_295 (259) = happyShift action_55 +action_295 (260) = happyShift action_115 +action_295 (261) = happyShift action_116 +action_295 (264) = happyShift action_117 +action_295 (265) = happyShift action_56 +action_295 (266) = happyShift action_57 +action_295 (267) = happyShift action_58 +action_295 (268) = happyShift action_59 +action_295 (269) = happyShift action_60 +action_295 (27) = happyGoto action_74 +action_295 (29) = happyGoto action_75 +action_295 (33) = happyGoto action_76 +action_295 (36) = happyGoto action_77 +action_295 (37) = happyGoto action_78 +action_295 (38) = happyGoto action_79 +action_295 (39) = happyGoto action_80 +action_295 (41) = happyGoto action_81 +action_295 (61) = happyGoto action_395 +action_295 (63) = happyGoto action_84 +action_295 (64) = happyGoto action_85 +action_295 (65) = happyGoto action_86 +action_295 (66) = happyGoto action_87 +action_295 (67) = happyGoto action_88 +action_295 (68) = happyGoto action_89 +action_295 (78) = happyGoto action_90 +action_295 (79) = happyGoto action_91 +action_295 (133) = happyGoto action_93 +action_295 (135) = happyGoto action_94 +action_295 _ = happyFail (happyExpListPerState 295) + +action_296 (198) = happyShift action_148 +action_296 (200) = happyShift action_149 +action_296 (202) = happyShift action_150 +action_296 (218) = happyShift action_151 +action_296 (220) = happyShift action_152 +action_296 (223) = happyShift action_45 +action_296 (231) = happyShift action_153 +action_296 (232) = happyShift action_154 +action_296 (234) = happyShift action_47 +action_296 (245) = happyShift action_48 +action_296 (246) = happyShift action_49 +action_296 (248) = happyShift action_50 +action_296 (249) = happyShift action_51 +action_296 (254) = happyShift action_155 +action_296 (255) = happyShift action_112 +action_296 (256) = happyShift action_53 +action_296 (258) = happyShift action_54 +action_296 (259) = happyShift action_55 +action_296 (260) = happyShift action_115 +action_296 (261) = happyShift action_116 +action_296 (264) = happyShift action_117 +action_296 (266) = happyShift action_57 +action_296 (267) = happyShift action_58 +action_296 (268) = happyShift action_156 +action_296 (27) = happyGoto action_133 +action_296 (30) = happyGoto action_134 +action_296 (33) = happyGoto action_135 +action_296 (36) = happyGoto action_136 +action_296 (37) = happyGoto action_137 +action_296 (40) = happyGoto action_138 +action_296 (45) = happyGoto action_394 +action_296 (46) = happyGoto action_140 +action_296 (47) = happyGoto action_141 +action_296 (48) = happyGoto action_142 +action_296 (49) = happyGoto action_143 +action_296 (50) = happyGoto action_144 +action_296 (51) = happyGoto action_145 +action_296 (57) = happyGoto action_146 +action_296 _ = happyFail (happyExpListPerState 296) + +action_297 (198) = happyShift action_40 +action_297 (200) = happyShift action_41 +action_297 (202) = happyShift action_42 +action_297 (218) = happyShift action_43 +action_297 (220) = happyShift action_44 +action_297 (223) = happyShift action_45 +action_297 (230) = happyShift action_46 +action_297 (234) = happyShift action_47 +action_297 (245) = happyShift action_48 +action_297 (246) = happyShift action_49 +action_297 (248) = happyShift action_50 +action_297 (249) = happyShift action_51 +action_297 (251) = happyShift action_52 +action_297 (256) = happyShift action_53 +action_297 (258) = happyShift action_54 +action_297 (259) = happyShift action_55 +action_297 (265) = happyShift action_56 +action_297 (266) = happyShift action_57 +action_297 (267) = happyShift action_58 +action_297 (268) = happyShift action_59 +action_297 (269) = happyShift action_60 +action_297 (27) = happyGoto action_25 +action_297 (30) = happyGoto action_389 +action_297 (37) = happyGoto action_27 +action_297 (38) = happyGoto action_28 +action_297 (39) = happyGoto action_29 +action_297 (41) = happyGoto action_30 +action_297 (72) = happyGoto action_390 +action_297 (89) = happyGoto action_391 +action_297 (90) = happyGoto action_34 +action_297 (91) = happyGoto action_35 +action_297 (132) = happyGoto action_36 +action_297 (134) = happyGoto action_37 +action_297 (136) = happyGoto action_38 +action_297 (149) = happyGoto action_392 +action_297 (166) = happyGoto action_39 +action_297 (175) = happyGoto action_393 +action_297 _ = happyFail (happyExpListPerState 297) + +action_298 (250) = happyShift action_388 +action_298 _ = happyFail (happyExpListPerState 298) + +action_299 _ = happyReduce_216 + +action_300 (203) = happyReduce_420 +action_300 (217) = happyReduce_420 +action_300 (247) = happyReduce_420 +action_300 _ = happyReduce_420 + +action_301 (247) = happyShift action_387 +action_301 _ = happyFail (happyExpListPerState 301) + +action_302 (217) = happyShift action_386 +action_302 _ = happyReduce_375 + +action_303 (205) = happyShift action_385 +action_303 _ = happyReduce_218 + +action_304 _ = happyReduce_166 + +action_305 (208) = happyShift action_384 +action_305 _ = happyFail (happyExpListPerState 305) + +action_306 (203) = happyShift action_383 +action_306 _ = happyFail (happyExpListPerState 306) + +action_307 _ = happyReduce_345 + +action_308 (211) = happyShift action_381 +action_308 (213) = happyShift action_382 +action_308 _ = happyReduce_196 + +action_309 (201) = happyReduce_444 +action_309 (217) = happyReduce_444 +action_309 _ = happyReduce_444 + +action_310 (201) = happyShift action_380 +action_310 _ = happyFail (happyExpListPerState 310) + +action_311 (217) = happyShift action_379 +action_311 _ = happyReduce_409 + +action_312 _ = happyReduce_349 + +action_313 (199) = happyShift action_378 +action_313 _ = happyFail (happyExpListPerState 313) + +action_314 (198) = happyShift action_95 +action_314 (200) = happyShift action_96 +action_314 (202) = happyShift action_97 +action_314 (218) = happyShift action_98 +action_314 (219) = happyShift action_99 +action_314 (220) = happyShift action_100 +action_314 (222) = happyShift action_101 +action_314 (223) = happyShift action_102 +action_314 (224) = happyShift action_103 +action_314 (228) = happyShift action_104 +action_314 (230) = happyShift action_46 +action_314 (234) = happyShift action_105 +action_314 (236) = happyShift action_106 +action_314 (242) = happyShift action_107 +action_314 (245) = happyShift action_108 +action_314 (246) = happyShift action_109 +action_314 (248) = happyShift action_110 +action_314 (249) = happyShift action_111 +action_314 (251) = happyShift action_52 +action_314 (255) = happyShift action_112 +action_314 (256) = happyShift action_113 +action_314 (257) = happyShift action_114 +action_314 (258) = happyShift action_54 +action_314 (259) = happyShift action_55 +action_314 (260) = happyShift action_115 +action_314 (261) = happyShift action_116 +action_314 (264) = happyShift action_117 +action_314 (265) = happyShift action_56 +action_314 (266) = happyShift action_57 +action_314 (267) = happyShift action_58 +action_314 (268) = happyShift action_59 +action_314 (269) = happyShift action_60 +action_314 (27) = happyGoto action_74 +action_314 (29) = happyGoto action_75 +action_314 (33) = happyGoto action_76 +action_314 (36) = happyGoto action_77 +action_314 (37) = happyGoto action_78 +action_314 (38) = happyGoto action_79 +action_314 (39) = happyGoto action_80 +action_314 (41) = happyGoto action_81 +action_314 (59) = happyGoto action_377 +action_314 (60) = happyGoto action_122 +action_314 (61) = happyGoto action_83 +action_314 (63) = happyGoto action_84 +action_314 (64) = happyGoto action_85 +action_314 (65) = happyGoto action_86 +action_314 (66) = happyGoto action_87 +action_314 (67) = happyGoto action_88 +action_314 (68) = happyGoto action_89 +action_314 (78) = happyGoto action_90 +action_314 (79) = happyGoto action_91 +action_314 (133) = happyGoto action_93 +action_314 (135) = happyGoto action_94 +action_314 _ = happyFail (happyExpListPerState 314) + +action_315 (222) = happyShift action_232 +action_315 (223) = happyShift action_233 +action_315 (224) = happyShift action_234 +action_315 (225) = happyShift action_235 +action_315 (226) = happyShift action_236 +action_315 (227) = happyShift action_237 +action_315 (228) = happyShift action_238 +action_315 (229) = happyShift action_239 +action_315 (230) = happyShift action_240 +action_315 (231) = happyShift action_241 +action_315 (233) = happyShift action_242 +action_315 (234) = happyShift action_243 +action_315 (235) = happyShift action_244 +action_315 (236) = happyShift action_245 +action_315 (237) = happyShift action_246 +action_315 (238) = happyShift action_247 +action_315 (239) = happyShift action_248 +action_315 (240) = happyShift action_249 +action_315 (241) = happyShift action_250 +action_315 (242) = happyShift action_251 +action_315 (243) = happyShift action_252 +action_315 (244) = happyShift action_253 +action_315 (245) = happyShift action_254 +action_315 (246) = happyShift action_255 +action_315 (247) = happyShift action_256 +action_315 (248) = happyShift action_257 +action_315 (249) = happyShift action_258 +action_315 (250) = happyShift action_259 +action_315 (251) = happyShift action_260 +action_315 (252) = happyShift action_261 +action_315 (253) = happyShift action_262 +action_315 (256) = happyShift action_263 +action_315 (266) = happyShift action_264 +action_315 (267) = happyShift action_265 +action_315 (35) = happyGoto action_374 +action_315 (159) = happyGoto action_375 +action_315 (188) = happyGoto action_376 +action_315 _ = happyFail (happyExpListPerState 315) + +action_316 (201) = happyShift action_373 +action_316 (222) = happyShift action_232 +action_316 (223) = happyShift action_233 +action_316 (224) = happyShift action_234 +action_316 (225) = happyShift action_235 +action_316 (226) = happyShift action_236 +action_316 (227) = happyShift action_237 +action_316 (228) = happyShift action_238 +action_316 (229) = happyShift action_239 +action_316 (230) = happyShift action_240 +action_316 (231) = happyShift action_241 +action_316 (233) = happyShift action_242 +action_316 (234) = happyShift action_243 +action_316 (235) = happyShift action_244 +action_316 (236) = happyShift action_245 +action_316 (237) = happyShift action_246 +action_316 (238) = happyShift action_247 +action_316 (239) = happyShift action_248 +action_316 (240) = happyShift action_249 +action_316 (241) = happyShift action_250 +action_316 (242) = happyShift action_251 +action_316 (243) = happyShift action_252 +action_316 (244) = happyShift action_253 +action_316 (245) = happyShift action_254 +action_316 (246) = happyShift action_255 +action_316 (247) = happyShift action_256 +action_316 (248) = happyShift action_257 +action_316 (249) = happyShift action_258 +action_316 (250) = happyShift action_259 +action_316 (251) = happyShift action_260 +action_316 (252) = happyShift action_261 +action_316 (253) = happyShift action_262 +action_316 (256) = happyShift action_263 +action_316 (266) = happyShift action_264 +action_316 (267) = happyShift action_265 +action_316 (35) = happyGoto action_369 +action_316 (70) = happyGoto action_370 +action_316 (162) = happyGoto action_371 +action_316 (191) = happyGoto action_372 +action_316 _ = happyFail (happyExpListPerState 316) + +action_317 _ = happyReduce_168 + +action_318 (198) = happyShift action_148 +action_318 (200) = happyShift action_149 +action_318 (202) = happyShift action_150 +action_318 (218) = happyShift action_151 +action_318 (223) = happyShift action_45 +action_318 (234) = happyShift action_47 +action_318 (245) = happyShift action_48 +action_318 (246) = happyShift action_49 +action_318 (248) = happyShift action_50 +action_318 (249) = happyShift action_51 +action_318 (254) = happyShift action_155 +action_318 (255) = happyShift action_112 +action_318 (256) = happyShift action_53 +action_318 (258) = happyShift action_54 +action_318 (259) = happyShift action_55 +action_318 (260) = happyShift action_115 +action_318 (261) = happyShift action_116 +action_318 (264) = happyShift action_117 +action_318 (266) = happyShift action_57 +action_318 (267) = happyShift action_58 +action_318 (268) = happyShift action_156 +action_318 (27) = happyGoto action_133 +action_318 (30) = happyGoto action_134 +action_318 (33) = happyGoto action_135 +action_318 (36) = happyGoto action_136 +action_318 (37) = happyGoto action_137 +action_318 (40) = happyGoto action_138 +action_318 (51) = happyGoto action_368 +action_318 _ = happyFail (happyExpListPerState 318) + +action_319 (198) = happyShift action_95 +action_319 (200) = happyShift action_96 +action_319 (202) = happyShift action_97 +action_319 (218) = happyShift action_98 +action_319 (219) = happyShift action_99 +action_319 (220) = happyShift action_100 +action_319 (222) = happyShift action_101 +action_319 (223) = happyShift action_102 +action_319 (224) = happyShift action_103 +action_319 (228) = happyShift action_104 +action_319 (230) = happyShift action_46 +action_319 (234) = happyShift action_105 +action_319 (236) = happyShift action_106 +action_319 (242) = happyShift action_107 +action_319 (245) = happyShift action_108 +action_319 (246) = happyShift action_109 +action_319 (248) = happyShift action_110 +action_319 (249) = happyShift action_111 +action_319 (251) = happyShift action_52 +action_319 (255) = happyShift action_112 +action_319 (256) = happyShift action_113 +action_319 (257) = happyShift action_114 +action_319 (258) = happyShift action_54 +action_319 (259) = happyShift action_55 +action_319 (260) = happyShift action_115 +action_319 (261) = happyShift action_116 +action_319 (264) = happyShift action_117 +action_319 (265) = happyShift action_56 +action_319 (266) = happyShift action_57 +action_319 (267) = happyShift action_58 +action_319 (268) = happyShift action_59 +action_319 (269) = happyShift action_60 +action_319 (27) = happyGoto action_74 +action_319 (29) = happyGoto action_75 +action_319 (33) = happyGoto action_76 +action_319 (36) = happyGoto action_77 +action_319 (37) = happyGoto action_78 +action_319 (38) = happyGoto action_79 +action_319 (39) = happyGoto action_80 +action_319 (41) = happyGoto action_81 +action_319 (62) = happyGoto action_366 +action_319 (63) = happyGoto action_367 +action_319 (64) = happyGoto action_85 +action_319 (65) = happyGoto action_86 +action_319 (66) = happyGoto action_87 +action_319 (67) = happyGoto action_88 +action_319 (68) = happyGoto action_89 +action_319 (78) = happyGoto action_90 +action_319 (79) = happyGoto action_91 +action_319 (133) = happyGoto action_93 +action_319 (135) = happyGoto action_94 +action_319 _ = happyFail (happyExpListPerState 319) + +action_320 (198) = happyShift action_148 +action_320 (200) = happyShift action_149 +action_320 (202) = happyShift action_150 +action_320 (218) = happyShift action_151 +action_320 (220) = happyShift action_152 +action_320 (223) = happyShift action_45 +action_320 (231) = happyShift action_153 +action_320 (232) = happyShift action_154 +action_320 (234) = happyShift action_47 +action_320 (245) = happyShift action_48 +action_320 (246) = happyShift action_49 +action_320 (248) = happyShift action_50 +action_320 (249) = happyShift action_51 +action_320 (254) = happyShift action_155 +action_320 (255) = happyShift action_112 +action_320 (256) = happyShift action_53 +action_320 (258) = happyShift action_54 +action_320 (259) = happyShift action_55 +action_320 (260) = happyShift action_115 +action_320 (261) = happyShift action_116 +action_320 (264) = happyShift action_117 +action_320 (266) = happyShift action_57 +action_320 (267) = happyShift action_58 +action_320 (268) = happyShift action_156 +action_320 (27) = happyGoto action_133 +action_320 (30) = happyGoto action_134 +action_320 (33) = happyGoto action_135 +action_320 (36) = happyGoto action_136 +action_320 (37) = happyGoto action_137 +action_320 (40) = happyGoto action_138 +action_320 (45) = happyGoto action_365 +action_320 (46) = happyGoto action_140 +action_320 (47) = happyGoto action_141 +action_320 (48) = happyGoto action_142 +action_320 (49) = happyGoto action_143 +action_320 (50) = happyGoto action_144 +action_320 (51) = happyGoto action_145 +action_320 (57) = happyGoto action_146 +action_320 _ = happyFail (happyExpListPerState 320) + +action_321 (199) = happyShift action_364 +action_321 (217) = happyReduce_412 +action_321 _ = happyReduce_412 + +action_322 (199) = happyShift action_363 +action_322 _ = happyFail (happyExpListPerState 322) + +action_323 (217) = happyShift action_362 +action_323 _ = happyReduce_371 + +action_324 (198) = happyShift action_324 +action_324 (258) = happyShift action_54 +action_324 (259) = happyShift action_55 +action_324 (27) = happyGoto action_64 +action_324 (121) = happyGoto action_361 +action_324 _ = happyFail (happyExpListPerState 324) + +action_325 _ = happyReduce_310 + +action_326 _ = happyReduce_436 + +action_327 _ = happyReduce_324 + +action_328 _ = happyReduce_360 + +action_329 (1) = happyReduce_383 +action_329 (198) = happyShift action_148 +action_329 (199) = happyReduce_383 +action_329 (200) = happyShift action_149 +action_329 (202) = happyShift action_150 +action_329 (205) = happyReduce_383 +action_329 (206) = happyReduce_383 +action_329 (209) = happyReduce_383 +action_329 (210) = happyReduce_383 +action_329 (214) = happyReduce_383 +action_329 (217) = happyReduce_383 +action_329 (218) = happyShift action_151 +action_329 (223) = happyShift action_45 +action_329 (229) = happyReduce_383 +action_329 (234) = happyShift action_47 +action_329 (245) = happyShift action_48 +action_329 (246) = happyShift action_49 +action_329 (248) = happyShift action_50 +action_329 (249) = happyShift action_51 +action_329 (253) = happyReduce_383 +action_329 (254) = happyShift action_155 +action_329 (255) = happyShift action_112 +action_329 (256) = happyShift action_53 +action_329 (258) = happyShift action_54 +action_329 (259) = happyShift action_55 +action_329 (260) = happyShift action_115 +action_329 (261) = happyShift action_116 +action_329 (264) = happyShift action_117 +action_329 (266) = happyShift action_57 +action_329 (267) = happyShift action_58 +action_329 (268) = happyShift action_156 +action_329 (270) = happyReduce_383 +action_329 (27) = happyGoto action_133 +action_329 (30) = happyGoto action_134 +action_329 (33) = happyGoto action_135 +action_329 (36) = happyGoto action_136 +action_329 (37) = happyGoto action_137 +action_329 (40) = happyGoto action_138 +action_329 (51) = happyGoto action_360 +action_329 _ = happyReduce_383 + +action_330 _ = happyReduce_362 + +action_331 (214) = happyShift action_359 +action_331 (115) = happyGoto action_358 +action_331 _ = happyReduce_312 + +action_332 _ = happyReduce_235 + +action_333 (203) = happyReduce_440 +action_333 (217) = happyReduce_440 +action_333 _ = happyReduce_440 + +action_334 (203) = happyShift action_357 +action_334 _ = happyFail (happyExpListPerState 334) + +action_335 (217) = happyShift action_356 +action_335 _ = happyReduce_407 + +action_336 _ = happyReduce_343 + +action_337 (211) = happyShift action_354 +action_337 (213) = happyShift action_355 +action_337 _ = happyReduce_247 + +action_338 (201) = happyReduce_442 +action_338 (217) = happyReduce_442 +action_338 _ = happyReduce_442 + +action_339 (201) = happyShift action_353 +action_339 _ = happyFail (happyExpListPerState 339) + +action_340 (217) = happyShift action_352 +action_340 _ = happyReduce_408 + +action_341 _ = happyReduce_347 + +action_342 (199) = happyShift action_351 +action_342 _ = happyFail (happyExpListPerState 342) + +action_343 _ = happyReduce_386 + +action_344 (198) = happyShift action_40 +action_344 (200) = happyShift action_41 +action_344 (202) = happyShift action_42 +action_344 (218) = happyShift action_43 +action_344 (220) = happyShift action_44 +action_344 (223) = happyShift action_45 +action_344 (230) = happyShift action_46 +action_344 (234) = happyShift action_47 +action_344 (245) = happyShift action_48 +action_344 (246) = happyShift action_49 +action_344 (248) = happyShift action_50 +action_344 (249) = happyShift action_51 +action_344 (251) = happyShift action_52 +action_344 (256) = happyShift action_53 +action_344 (258) = happyShift action_54 +action_344 (259) = happyShift action_55 +action_344 (265) = happyShift action_56 +action_344 (266) = happyShift action_57 +action_344 (267) = happyShift action_58 +action_344 (268) = happyShift action_59 +action_344 (269) = happyShift action_60 +action_344 (27) = happyGoto action_25 +action_344 (30) = happyGoto action_26 +action_344 (37) = happyGoto action_27 +action_344 (38) = happyGoto action_28 +action_344 (39) = happyGoto action_29 +action_344 (41) = happyGoto action_30 +action_344 (90) = happyGoto action_350 +action_344 (91) = happyGoto action_35 +action_344 (132) = happyGoto action_36 +action_344 (134) = happyGoto action_37 +action_344 (136) = happyGoto action_38 +action_344 (166) = happyGoto action_39 +action_344 _ = happyFail (happyExpListPerState 344) + +action_345 (198) = happyShift action_148 +action_345 (200) = happyShift action_149 +action_345 (202) = happyShift action_150 +action_345 (218) = happyShift action_151 +action_345 (220) = happyShift action_152 +action_345 (223) = happyShift action_45 +action_345 (231) = happyShift action_153 +action_345 (232) = happyShift action_154 +action_345 (234) = happyShift action_47 +action_345 (245) = happyShift action_48 +action_345 (246) = happyShift action_49 +action_345 (248) = happyShift action_50 +action_345 (249) = happyShift action_51 +action_345 (254) = happyShift action_155 +action_345 (255) = happyShift action_112 +action_345 (256) = happyShift action_53 +action_345 (258) = happyShift action_54 +action_345 (259) = happyShift action_55 +action_345 (260) = happyShift action_115 +action_345 (261) = happyShift action_116 +action_345 (264) = happyShift action_117 +action_345 (266) = happyShift action_57 +action_345 (267) = happyShift action_58 +action_345 (268) = happyShift action_156 +action_345 (27) = happyGoto action_133 +action_345 (30) = happyGoto action_134 +action_345 (33) = happyGoto action_135 +action_345 (36) = happyGoto action_136 +action_345 (37) = happyGoto action_137 +action_345 (40) = happyGoto action_138 +action_345 (45) = happyGoto action_349 +action_345 (46) = happyGoto action_140 +action_345 (47) = happyGoto action_141 +action_345 (48) = happyGoto action_142 +action_345 (49) = happyGoto action_143 +action_345 (50) = happyGoto action_144 +action_345 (51) = happyGoto action_145 +action_345 (57) = happyGoto action_146 +action_345 _ = happyFail (happyExpListPerState 345) + +action_346 _ = happyReduce_229 + +action_347 (198) = happyShift action_40 +action_347 (200) = happyShift action_41 +action_347 (202) = happyShift action_42 +action_347 (218) = happyShift action_43 +action_347 (223) = happyShift action_45 +action_347 (230) = happyShift action_46 +action_347 (234) = happyShift action_47 +action_347 (245) = happyShift action_48 +action_347 (246) = happyShift action_49 +action_347 (248) = happyShift action_50 +action_347 (249) = happyShift action_51 +action_347 (251) = happyShift action_52 +action_347 (256) = happyShift action_53 +action_347 (258) = happyShift action_54 +action_347 (259) = happyShift action_55 +action_347 (265) = happyShift action_56 +action_347 (266) = happyShift action_57 +action_347 (267) = happyShift action_58 +action_347 (268) = happyShift action_59 +action_347 (269) = happyShift action_60 +action_347 (27) = happyGoto action_25 +action_347 (30) = happyGoto action_26 +action_347 (37) = happyGoto action_27 +action_347 (38) = happyGoto action_28 +action_347 (39) = happyGoto action_29 +action_347 (41) = happyGoto action_30 +action_347 (91) = happyGoto action_348 +action_347 (132) = happyGoto action_36 +action_347 (134) = happyGoto action_37 +action_347 _ = happyFail (happyExpListPerState 347) + +action_348 _ = happyReduce_238 + +action_349 _ = happyReduce_231 + +action_350 _ = happyReduce_233 + +action_351 _ = happyReduce_246 + +action_352 (222) = happyShift action_232 +action_352 (223) = happyShift action_233 +action_352 (224) = happyShift action_234 +action_352 (225) = happyShift action_235 +action_352 (226) = happyShift action_236 +action_352 (227) = happyShift action_237 +action_352 (228) = happyShift action_238 +action_352 (229) = happyShift action_239 +action_352 (230) = happyShift action_240 +action_352 (231) = happyShift action_241 +action_352 (233) = happyShift action_242 +action_352 (234) = happyShift action_243 +action_352 (235) = happyShift action_244 +action_352 (236) = happyShift action_245 +action_352 (237) = happyShift action_246 +action_352 (238) = happyShift action_247 +action_352 (239) = happyShift action_248 +action_352 (240) = happyShift action_249 +action_352 (241) = happyShift action_250 +action_352 (242) = happyShift action_251 +action_352 (243) = happyShift action_252 +action_352 (244) = happyShift action_253 +action_352 (245) = happyShift action_254 +action_352 (246) = happyShift action_255 +action_352 (247) = happyShift action_256 +action_352 (248) = happyShift action_257 +action_352 (249) = happyShift action_258 +action_352 (250) = happyShift action_259 +action_352 (251) = happyShift action_260 +action_352 (252) = happyShift action_261 +action_352 (253) = happyShift action_262 +action_352 (256) = happyShift action_263 +action_352 (266) = happyShift action_264 +action_352 (267) = happyShift action_265 +action_352 (35) = happyGoto action_337 +action_352 (92) = happyGoto action_575 +action_352 _ = happyFail (happyExpListPerState 352) + +action_353 _ = happyReduce_348 + +action_354 (198) = happyShift action_40 +action_354 (200) = happyShift action_41 +action_354 (202) = happyShift action_42 +action_354 (218) = happyShift action_43 +action_354 (220) = happyShift action_44 +action_354 (223) = happyShift action_45 +action_354 (230) = happyShift action_46 +action_354 (234) = happyShift action_47 +action_354 (245) = happyShift action_48 +action_354 (246) = happyShift action_49 +action_354 (248) = happyShift action_50 +action_354 (249) = happyShift action_51 +action_354 (251) = happyShift action_52 +action_354 (256) = happyShift action_53 +action_354 (258) = happyShift action_54 +action_354 (259) = happyShift action_55 +action_354 (265) = happyShift action_56 +action_354 (266) = happyShift action_57 +action_354 (267) = happyShift action_58 +action_354 (268) = happyShift action_59 +action_354 (269) = happyShift action_60 +action_354 (27) = happyGoto action_25 +action_354 (30) = happyGoto action_26 +action_354 (37) = happyGoto action_27 +action_354 (38) = happyGoto action_28 +action_354 (39) = happyGoto action_29 +action_354 (41) = happyGoto action_30 +action_354 (88) = happyGoto action_574 +action_354 (89) = happyGoto action_33 +action_354 (90) = happyGoto action_34 +action_354 (91) = happyGoto action_35 +action_354 (132) = happyGoto action_36 +action_354 (134) = happyGoto action_37 +action_354 (136) = happyGoto action_38 +action_354 (166) = happyGoto action_39 +action_354 _ = happyFail (happyExpListPerState 354) + +action_355 (198) = happyShift action_40 +action_355 (200) = happyShift action_41 +action_355 (202) = happyShift action_42 +action_355 (218) = happyShift action_43 +action_355 (220) = happyShift action_44 +action_355 (223) = happyShift action_45 +action_355 (230) = happyShift action_46 +action_355 (234) = happyShift action_47 +action_355 (245) = happyShift action_48 +action_355 (246) = happyShift action_49 +action_355 (248) = happyShift action_50 +action_355 (249) = happyShift action_51 +action_355 (251) = happyShift action_52 +action_355 (256) = happyShift action_53 +action_355 (258) = happyShift action_54 +action_355 (259) = happyShift action_55 +action_355 (265) = happyShift action_56 +action_355 (266) = happyShift action_57 +action_355 (267) = happyShift action_58 +action_355 (268) = happyShift action_59 +action_355 (269) = happyShift action_60 +action_355 (27) = happyGoto action_25 +action_355 (30) = happyGoto action_26 +action_355 (37) = happyGoto action_27 +action_355 (38) = happyGoto action_28 +action_355 (39) = happyGoto action_29 +action_355 (41) = happyGoto action_30 +action_355 (88) = happyGoto action_573 +action_355 (89) = happyGoto action_33 +action_355 (90) = happyGoto action_34 +action_355 (91) = happyGoto action_35 +action_355 (132) = happyGoto action_36 +action_355 (134) = happyGoto action_37 +action_355 (136) = happyGoto action_38 +action_355 (166) = happyGoto action_39 +action_355 _ = happyFail (happyExpListPerState 355) + +action_356 (198) = happyShift action_40 +action_356 (200) = happyShift action_41 +action_356 (202) = happyShift action_42 +action_356 (218) = happyShift action_43 +action_356 (220) = happyShift action_44 +action_356 (223) = happyShift action_45 +action_356 (230) = happyShift action_46 +action_356 (234) = happyShift action_47 +action_356 (245) = happyShift action_48 +action_356 (246) = happyShift action_49 +action_356 (248) = happyShift action_50 +action_356 (249) = happyShift action_51 +action_356 (251) = happyShift action_52 +action_356 (256) = happyShift action_53 +action_356 (258) = happyShift action_54 +action_356 (259) = happyShift action_55 +action_356 (265) = happyShift action_56 +action_356 (266) = happyShift action_57 +action_356 (267) = happyShift action_58 +action_356 (268) = happyShift action_59 +action_356 (269) = happyShift action_60 +action_356 (27) = happyGoto action_25 +action_356 (30) = happyGoto action_26 +action_356 (37) = happyGoto action_27 +action_356 (38) = happyGoto action_28 +action_356 (39) = happyGoto action_29 +action_356 (41) = happyGoto action_30 +action_356 (88) = happyGoto action_572 +action_356 (89) = happyGoto action_33 +action_356 (90) = happyGoto action_34 +action_356 (91) = happyGoto action_35 +action_356 (132) = happyGoto action_36 +action_356 (134) = happyGoto action_37 +action_356 (136) = happyGoto action_38 +action_356 (166) = happyGoto action_39 +action_356 _ = happyFail (happyExpListPerState 356) + +action_357 _ = happyReduce_344 + +action_358 _ = happyReduce_311 + +action_359 (208) = happyShift action_571 +action_359 (223) = happyShift action_45 +action_359 (234) = happyShift action_47 +action_359 (245) = happyShift action_48 +action_359 (246) = happyShift action_49 +action_359 (248) = happyShift action_50 +action_359 (249) = happyShift action_51 +action_359 (256) = happyShift action_53 +action_359 (30) = happyGoto action_565 +action_359 (116) = happyGoto action_566 +action_359 (139) = happyGoto action_567 +action_359 (157) = happyGoto action_568 +action_359 (169) = happyGoto action_569 +action_359 (186) = happyGoto action_570 +action_359 _ = happyFail (happyExpListPerState 359) + +action_360 _ = happyReduce_437 + +action_361 (199) = happyShift action_364 +action_361 _ = happyFail (happyExpListPerState 361) + +action_362 (198) = happyShift action_324 +action_362 (258) = happyShift action_54 +action_362 (259) = happyShift action_55 +action_362 (27) = happyGoto action_64 +action_362 (121) = happyGoto action_564 +action_362 _ = happyFail (happyExpListPerState 362) + +action_363 _ = happyReduce_323 + +action_364 _ = happyReduce_325 + +action_365 _ = happyReduce_309 + +action_366 (209) = happyShift action_286 +action_366 (211) = happyShift action_288 +action_366 (215) = happyShift action_563 +action_366 (220) = happyShift action_289 +action_366 (262) = happyShift action_290 +action_366 (263) = happyShift action_291 +action_366 (31) = happyGoto action_562 +action_366 _ = happyFail (happyExpListPerState 366) + +action_367 _ = happyReduce_163 + +action_368 _ = happyReduce_169 + +action_369 (200) = happyShift action_559 +action_369 (211) = happyShift action_560 +action_369 (213) = happyShift action_561 +action_369 _ = happyReduce_200 + +action_370 (201) = happyReduce_432 +action_370 (217) = happyReduce_432 +action_370 _ = happyReduce_432 + +action_371 (201) = happyShift action_558 +action_371 _ = happyFail (happyExpListPerState 371) + +action_372 (217) = happyShift action_557 +action_372 _ = happyReduce_381 + +action_373 _ = happyReduce_180 + +action_374 (1) = happyReduce_426 +action_374 (198) = happyReduce_426 +action_374 (199) = happyReduce_426 +action_374 (200) = happyReduce_426 +action_374 (201) = happyReduce_426 +action_374 (202) = happyReduce_426 +action_374 (203) = happyReduce_426 +action_374 (205) = happyReduce_426 +action_374 (206) = happyReduce_426 +action_374 (209) = happyReduce_426 +action_374 (211) = happyReduce_426 +action_374 (212) = happyReduce_426 +action_374 (214) = happyReduce_426 +action_374 (215) = happyReduce_426 +action_374 (216) = happyReduce_426 +action_374 (217) = happyReduce_426 +action_374 (218) = happyReduce_426 +action_374 (219) = happyReduce_426 +action_374 (220) = happyReduce_426 +action_374 (221) = happyReduce_426 +action_374 (222) = happyReduce_426 +action_374 (223) = happyReduce_426 +action_374 (224) = happyReduce_426 +action_374 (228) = happyReduce_426 +action_374 (229) = happyReduce_426 +action_374 (230) = happyReduce_426 +action_374 (234) = happyReduce_426 +action_374 (236) = happyReduce_426 +action_374 (242) = happyReduce_426 +action_374 (245) = happyReduce_426 +action_374 (246) = happyReduce_426 +action_374 (247) = happyReduce_426 +action_374 (248) = happyReduce_426 +action_374 (249) = happyReduce_426 +action_374 (250) = happyReduce_426 +action_374 (251) = happyReduce_426 +action_374 (253) = happyReduce_426 +action_374 (255) = happyReduce_426 +action_374 (256) = happyReduce_426 +action_374 (257) = happyReduce_426 +action_374 (258) = happyReduce_426 +action_374 (259) = happyReduce_426 +action_374 (260) = happyReduce_426 +action_374 (261) = happyReduce_426 +action_374 (262) = happyReduce_426 +action_374 (263) = happyReduce_426 +action_374 (264) = happyReduce_426 +action_374 (265) = happyReduce_426 +action_374 (266) = happyReduce_426 +action_374 (267) = happyReduce_426 +action_374 (268) = happyReduce_426 +action_374 (269) = happyReduce_426 +action_374 (270) = happyReduce_426 +action_374 _ = happyReduce_426 + +action_375 _ = happyReduce_183 + +action_376 (216) = happyShift action_556 +action_376 _ = happyReduce_378 + +action_377 _ = happyReduce_173 + +action_378 _ = happyReduce_195 + +action_379 (222) = happyShift action_232 +action_379 (223) = happyShift action_233 +action_379 (224) = happyShift action_234 +action_379 (225) = happyShift action_235 +action_379 (226) = happyShift action_236 +action_379 (227) = happyShift action_237 +action_379 (228) = happyShift action_238 +action_379 (229) = happyShift action_239 +action_379 (230) = happyShift action_240 +action_379 (231) = happyShift action_241 +action_379 (233) = happyShift action_242 +action_379 (234) = happyShift action_243 +action_379 (235) = happyShift action_244 +action_379 (236) = happyShift action_245 +action_379 (237) = happyShift action_246 +action_379 (238) = happyShift action_247 +action_379 (239) = happyShift action_248 +action_379 (240) = happyShift action_249 +action_379 (241) = happyShift action_250 +action_379 (242) = happyShift action_251 +action_379 (243) = happyShift action_252 +action_379 (244) = happyShift action_253 +action_379 (245) = happyShift action_254 +action_379 (246) = happyShift action_255 +action_379 (247) = happyShift action_256 +action_379 (248) = happyShift action_257 +action_379 (249) = happyShift action_258 +action_379 (250) = happyShift action_259 +action_379 (251) = happyShift action_260 +action_379 (252) = happyShift action_261 +action_379 (253) = happyShift action_262 +action_379 (256) = happyShift action_263 +action_379 (266) = happyShift action_264 +action_379 (267) = happyShift action_265 +action_379 (35) = happyGoto action_308 +action_379 (69) = happyGoto action_555 +action_379 _ = happyFail (happyExpListPerState 379) + +action_380 _ = happyReduce_350 + +action_381 (198) = happyShift action_95 +action_381 (200) = happyShift action_96 +action_381 (202) = happyShift action_97 +action_381 (218) = happyShift action_98 +action_381 (219) = happyShift action_99 +action_381 (220) = happyShift action_100 +action_381 (222) = happyShift action_101 +action_381 (223) = happyShift action_102 +action_381 (224) = happyShift action_103 +action_381 (228) = happyShift action_104 +action_381 (230) = happyShift action_46 +action_381 (234) = happyShift action_105 +action_381 (236) = happyShift action_106 +action_381 (242) = happyShift action_107 +action_381 (245) = happyShift action_108 +action_381 (246) = happyShift action_109 +action_381 (248) = happyShift action_110 +action_381 (249) = happyShift action_111 +action_381 (251) = happyShift action_52 +action_381 (255) = happyShift action_112 +action_381 (256) = happyShift action_113 +action_381 (257) = happyShift action_114 +action_381 (258) = happyShift action_54 +action_381 (259) = happyShift action_55 +action_381 (260) = happyShift action_115 +action_381 (261) = happyShift action_116 +action_381 (264) = happyShift action_117 +action_381 (265) = happyShift action_56 +action_381 (266) = happyShift action_57 +action_381 (267) = happyShift action_58 +action_381 (268) = happyShift action_59 +action_381 (269) = happyShift action_60 +action_381 (27) = happyGoto action_74 +action_381 (29) = happyGoto action_75 +action_381 (33) = happyGoto action_76 +action_381 (36) = happyGoto action_77 +action_381 (37) = happyGoto action_78 +action_381 (38) = happyGoto action_79 +action_381 (39) = happyGoto action_80 +action_381 (41) = happyGoto action_81 +action_381 (59) = happyGoto action_554 +action_381 (60) = happyGoto action_122 +action_381 (61) = happyGoto action_83 +action_381 (63) = happyGoto action_84 +action_381 (64) = happyGoto action_85 +action_381 (65) = happyGoto action_86 +action_381 (66) = happyGoto action_87 +action_381 (67) = happyGoto action_88 +action_381 (68) = happyGoto action_89 +action_381 (78) = happyGoto action_90 +action_381 (79) = happyGoto action_91 +action_381 (133) = happyGoto action_93 +action_381 (135) = happyGoto action_94 +action_381 _ = happyFail (happyExpListPerState 381) + +action_382 (198) = happyShift action_95 +action_382 (200) = happyShift action_96 +action_382 (202) = happyShift action_97 +action_382 (218) = happyShift action_98 +action_382 (219) = happyShift action_99 +action_382 (220) = happyShift action_100 +action_382 (222) = happyShift action_101 +action_382 (223) = happyShift action_102 +action_382 (224) = happyShift action_103 +action_382 (228) = happyShift action_104 +action_382 (230) = happyShift action_46 +action_382 (234) = happyShift action_105 +action_382 (236) = happyShift action_106 +action_382 (242) = happyShift action_107 +action_382 (245) = happyShift action_108 +action_382 (246) = happyShift action_109 +action_382 (248) = happyShift action_110 +action_382 (249) = happyShift action_111 +action_382 (251) = happyShift action_52 +action_382 (255) = happyShift action_112 +action_382 (256) = happyShift action_113 +action_382 (257) = happyShift action_114 +action_382 (258) = happyShift action_54 +action_382 (259) = happyShift action_55 +action_382 (260) = happyShift action_115 +action_382 (261) = happyShift action_116 +action_382 (264) = happyShift action_117 +action_382 (265) = happyShift action_56 +action_382 (266) = happyShift action_57 +action_382 (267) = happyShift action_58 +action_382 (268) = happyShift action_59 +action_382 (269) = happyShift action_60 +action_382 (27) = happyGoto action_74 +action_382 (29) = happyGoto action_75 +action_382 (33) = happyGoto action_76 +action_382 (36) = happyGoto action_77 +action_382 (37) = happyGoto action_78 +action_382 (38) = happyGoto action_79 +action_382 (39) = happyGoto action_80 +action_382 (41) = happyGoto action_81 +action_382 (59) = happyGoto action_553 +action_382 (60) = happyGoto action_122 +action_382 (61) = happyGoto action_83 +action_382 (63) = happyGoto action_84 +action_382 (64) = happyGoto action_85 +action_382 (65) = happyGoto action_86 +action_382 (66) = happyGoto action_87 +action_382 (67) = happyGoto action_88 +action_382 (68) = happyGoto action_89 +action_382 (78) = happyGoto action_90 +action_382 (79) = happyGoto action_91 +action_382 (133) = happyGoto action_93 +action_382 (135) = happyGoto action_94 +action_382 _ = happyFail (happyExpListPerState 382) + +action_383 _ = happyReduce_346 + +action_384 (198) = happyShift action_95 +action_384 (200) = happyShift action_96 +action_384 (202) = happyShift action_97 +action_384 (218) = happyShift action_98 +action_384 (219) = happyShift action_99 +action_384 (220) = happyShift action_100 +action_384 (222) = happyShift action_101 +action_384 (223) = happyShift action_102 +action_384 (224) = happyShift action_103 +action_384 (228) = happyShift action_104 +action_384 (230) = happyShift action_46 +action_384 (234) = happyShift action_105 +action_384 (236) = happyShift action_106 +action_384 (242) = happyShift action_107 +action_384 (245) = happyShift action_108 +action_384 (246) = happyShift action_109 +action_384 (248) = happyShift action_110 +action_384 (249) = happyShift action_111 +action_384 (251) = happyShift action_52 +action_384 (255) = happyShift action_112 +action_384 (256) = happyShift action_113 +action_384 (257) = happyShift action_114 +action_384 (258) = happyShift action_54 +action_384 (259) = happyShift action_55 +action_384 (260) = happyShift action_115 +action_384 (261) = happyShift action_116 +action_384 (264) = happyShift action_117 +action_384 (265) = happyShift action_56 +action_384 (266) = happyShift action_57 +action_384 (267) = happyShift action_58 +action_384 (268) = happyShift action_59 +action_384 (269) = happyShift action_60 +action_384 (27) = happyGoto action_74 +action_384 (29) = happyGoto action_75 +action_384 (33) = happyGoto action_76 +action_384 (36) = happyGoto action_77 +action_384 (37) = happyGoto action_78 +action_384 (38) = happyGoto action_79 +action_384 (39) = happyGoto action_80 +action_384 (41) = happyGoto action_81 +action_384 (59) = happyGoto action_552 +action_384 (60) = happyGoto action_122 +action_384 (61) = happyGoto action_83 +action_384 (63) = happyGoto action_84 +action_384 (64) = happyGoto action_85 +action_384 (65) = happyGoto action_86 +action_384 (66) = happyGoto action_87 +action_384 (67) = happyGoto action_88 +action_384 (68) = happyGoto action_89 +action_384 (78) = happyGoto action_90 +action_384 (79) = happyGoto action_91 +action_384 (133) = happyGoto action_93 +action_384 (135) = happyGoto action_94 +action_384 _ = happyFail (happyExpListPerState 384) + +action_385 _ = happyReduce_217 + +action_386 (198) = happyShift action_95 +action_386 (200) = happyShift action_96 +action_386 (202) = happyShift action_97 +action_386 (218) = happyShift action_98 +action_386 (219) = happyShift action_99 +action_386 (220) = happyShift action_100 +action_386 (222) = happyShift action_101 +action_386 (223) = happyShift action_102 +action_386 (224) = happyShift action_103 +action_386 (228) = happyShift action_104 +action_386 (230) = happyShift action_46 +action_386 (234) = happyShift action_105 +action_386 (236) = happyShift action_106 +action_386 (242) = happyShift action_107 +action_386 (245) = happyShift action_108 +action_386 (246) = happyShift action_109 +action_386 (248) = happyShift action_110 +action_386 (249) = happyShift action_111 +action_386 (251) = happyShift action_52 +action_386 (255) = happyShift action_112 +action_386 (256) = happyShift action_113 +action_386 (257) = happyShift action_114 +action_386 (258) = happyShift action_54 +action_386 (259) = happyShift action_55 +action_386 (260) = happyShift action_115 +action_386 (261) = happyShift action_116 +action_386 (264) = happyShift action_117 +action_386 (265) = happyShift action_56 +action_386 (266) = happyShift action_57 +action_386 (267) = happyShift action_58 +action_386 (268) = happyShift action_59 +action_386 (269) = happyShift action_60 +action_386 (27) = happyGoto action_74 +action_386 (29) = happyGoto action_75 +action_386 (33) = happyGoto action_76 +action_386 (36) = happyGoto action_77 +action_386 (37) = happyGoto action_78 +action_386 (38) = happyGoto action_79 +action_386 (39) = happyGoto action_80 +action_386 (41) = happyGoto action_81 +action_386 (59) = happyGoto action_551 +action_386 (60) = happyGoto action_122 +action_386 (61) = happyGoto action_83 +action_386 (63) = happyGoto action_84 +action_386 (64) = happyGoto action_85 +action_386 (65) = happyGoto action_86 +action_386 (66) = happyGoto action_87 +action_386 (67) = happyGoto action_88 +action_386 (68) = happyGoto action_89 +action_386 (78) = happyGoto action_90 +action_386 (79) = happyGoto action_91 +action_386 (133) = happyGoto action_93 +action_386 (135) = happyGoto action_94 +action_386 _ = happyFail (happyExpListPerState 386) + +action_387 (204) = happyShift action_550 +action_387 _ = happyFail (happyExpListPerState 387) + +action_388 (198) = happyShift action_95 +action_388 (200) = happyShift action_96 +action_388 (202) = happyShift action_97 +action_388 (218) = happyShift action_98 +action_388 (219) = happyShift action_99 +action_388 (220) = happyShift action_100 +action_388 (222) = happyShift action_101 +action_388 (223) = happyShift action_102 +action_388 (224) = happyShift action_103 +action_388 (228) = happyShift action_104 +action_388 (230) = happyShift action_46 +action_388 (234) = happyShift action_105 +action_388 (236) = happyShift action_106 +action_388 (242) = happyShift action_107 +action_388 (245) = happyShift action_108 +action_388 (246) = happyShift action_109 +action_388 (248) = happyShift action_110 +action_388 (249) = happyShift action_111 +action_388 (251) = happyShift action_52 +action_388 (255) = happyShift action_112 +action_388 (256) = happyShift action_113 +action_388 (257) = happyShift action_114 +action_388 (258) = happyShift action_54 +action_388 (259) = happyShift action_55 +action_388 (260) = happyShift action_115 +action_388 (261) = happyShift action_116 +action_388 (264) = happyShift action_117 +action_388 (265) = happyShift action_56 +action_388 (266) = happyShift action_57 +action_388 (267) = happyShift action_58 +action_388 (268) = happyShift action_59 +action_388 (269) = happyShift action_60 +action_388 (27) = happyGoto action_74 +action_388 (29) = happyGoto action_75 +action_388 (33) = happyGoto action_76 +action_388 (36) = happyGoto action_77 +action_388 (37) = happyGoto action_78 +action_388 (38) = happyGoto action_79 +action_388 (39) = happyGoto action_80 +action_388 (41) = happyGoto action_81 +action_388 (59) = happyGoto action_549 +action_388 (60) = happyGoto action_122 +action_388 (61) = happyGoto action_83 +action_388 (63) = happyGoto action_84 +action_388 (64) = happyGoto action_85 +action_388 (65) = happyGoto action_86 +action_388 (66) = happyGoto action_87 +action_388 (67) = happyGoto action_88 +action_388 (68) = happyGoto action_89 +action_388 (78) = happyGoto action_90 +action_388 (79) = happyGoto action_91 +action_388 (133) = happyGoto action_93 +action_388 (135) = happyGoto action_94 +action_388 _ = happyFail (happyExpListPerState 388) + +action_389 (198) = happyShift action_40 +action_389 (200) = happyShift action_41 +action_389 (202) = happyShift action_42 +action_389 (209) = happyReduce_237 +action_389 (211) = happyReduce_237 +action_389 (212) = happyShift action_548 +action_389 (213) = happyShift action_432 +action_389 (214) = happyShift action_433 +action_389 (218) = happyShift action_43 +action_389 (220) = happyReduce_237 +action_389 (221) = happyShift action_347 +action_389 (223) = happyShift action_45 +action_389 (230) = happyShift action_46 +action_389 (234) = happyShift action_47 +action_389 (245) = happyShift action_48 +action_389 (246) = happyShift action_49 +action_389 (248) = happyShift action_50 +action_389 (249) = happyShift action_51 +action_389 (251) = happyShift action_52 +action_389 (256) = happyShift action_53 +action_389 (258) = happyShift action_54 +action_389 (259) = happyShift action_55 +action_389 (262) = happyReduce_237 +action_389 (263) = happyReduce_237 +action_389 (265) = happyShift action_56 +action_389 (266) = happyShift action_57 +action_389 (267) = happyShift action_58 +action_389 (268) = happyShift action_59 +action_389 (269) = happyShift action_60 +action_389 (27) = happyGoto action_25 +action_389 (30) = happyGoto action_26 +action_389 (37) = happyGoto action_27 +action_389 (38) = happyGoto action_28 +action_389 (39) = happyGoto action_29 +action_389 (41) = happyGoto action_30 +action_389 (74) = happyGoto action_546 +action_389 (75) = happyGoto action_428 +action_389 (83) = happyGoto action_429 +action_389 (91) = happyGoto action_35 +action_389 (132) = happyGoto action_36 +action_389 (134) = happyGoto action_37 +action_389 (136) = happyGoto action_547 +action_389 (138) = happyGoto action_430 +action_389 (166) = happyGoto action_39 +action_389 (168) = happyGoto action_431 +action_389 _ = happyReduce_237 + +action_390 _ = happyReduce_403 + +action_391 (209) = happyShift action_286 +action_391 (211) = happyShift action_288 +action_391 (213) = happyShift action_545 +action_391 (220) = happyShift action_289 +action_391 (262) = happyShift action_290 +action_391 (263) = happyShift action_291 +action_391 (31) = happyGoto action_344 +action_391 _ = happyFail (happyExpListPerState 391) + +action_392 (205) = happyShift action_544 +action_392 _ = happyFail (happyExpListPerState 392) + +action_393 (206) = happyShift action_543 +action_393 _ = happyReduce_368 + +action_394 _ = happyReduce_158 + +action_395 (1) = happyReduce_160 +action_395 (198) = happyReduce_160 +action_395 (199) = happyReduce_160 +action_395 (200) = happyReduce_160 +action_395 (201) = happyReduce_160 +action_395 (202) = happyReduce_160 +action_395 (203) = happyReduce_160 +action_395 (205) = happyReduce_160 +action_395 (206) = happyReduce_160 +action_395 (209) = happyReduce_160 +action_395 (211) = happyReduce_160 +action_395 (212) = happyReduce_160 +action_395 (214) = happyReduce_160 +action_395 (215) = happyShift action_319 +action_395 (217) = happyReduce_160 +action_395 (218) = happyReduce_160 +action_395 (219) = happyReduce_160 +action_395 (220) = happyReduce_160 +action_395 (221) = happyReduce_160 +action_395 (222) = happyReduce_160 +action_395 (223) = happyReduce_160 +action_395 (224) = happyReduce_160 +action_395 (228) = happyReduce_160 +action_395 (229) = happyReduce_160 +action_395 (230) = happyReduce_160 +action_395 (234) = happyReduce_160 +action_395 (236) = happyReduce_160 +action_395 (242) = happyReduce_160 +action_395 (245) = happyReduce_160 +action_395 (246) = happyReduce_160 +action_395 (247) = happyReduce_160 +action_395 (248) = happyReduce_160 +action_395 (249) = happyReduce_160 +action_395 (250) = happyReduce_160 +action_395 (251) = happyReduce_160 +action_395 (253) = happyReduce_160 +action_395 (255) = happyReduce_160 +action_395 (256) = happyReduce_160 +action_395 (257) = happyReduce_160 +action_395 (258) = happyReduce_160 +action_395 (259) = happyReduce_160 +action_395 (260) = happyReduce_160 +action_395 (261) = happyReduce_160 +action_395 (262) = happyReduce_160 +action_395 (263) = happyReduce_160 +action_395 (264) = happyReduce_160 +action_395 (265) = happyReduce_160 +action_395 (266) = happyReduce_160 +action_395 (267) = happyReduce_160 +action_395 (268) = happyReduce_160 +action_395 (269) = happyReduce_160 +action_395 (270) = happyReduce_160 +action_395 _ = happyReduce_160 + +action_396 (205) = happyShift action_542 +action_396 _ = happyFail (happyExpListPerState 396) + +action_397 (253) = happyShift action_541 +action_397 _ = happyFail (happyExpListPerState 397) + +action_398 (223) = happyShift action_45 +action_398 (225) = happyShift action_538 +action_398 (234) = happyShift action_47 +action_398 (243) = happyShift action_539 +action_398 (245) = happyShift action_48 +action_398 (246) = happyShift action_49 +action_398 (248) = happyShift action_50 +action_398 (249) = happyShift action_51 +action_398 (252) = happyShift action_540 +action_398 (255) = happyShift action_480 +action_398 (256) = happyShift action_53 +action_398 (258) = happyShift action_63 +action_398 (260) = happyShift action_481 +action_398 (28) = happyGoto action_532 +action_398 (30) = happyGoto action_533 +action_398 (34) = happyGoto action_534 +action_398 (101) = happyGoto action_535 +action_398 (155) = happyGoto action_536 +action_398 (184) = happyGoto action_537 +action_398 _ = happyFail (happyExpListPerState 398) + +action_399 _ = happyReduce_105 + +action_400 _ = happyReduce_106 + +action_401 _ = happyReduce_109 + +action_402 (1) = happyReduce_100 +action_402 (198) = happyShift action_404 +action_402 (199) = happyReduce_100 +action_402 (200) = happyReduce_100 +action_402 (201) = happyReduce_100 +action_402 (202) = happyReduce_100 +action_402 (203) = happyReduce_100 +action_402 (205) = happyReduce_100 +action_402 (206) = happyReduce_100 +action_402 (207) = happyReduce_100 +action_402 (208) = happyShift action_531 +action_402 (209) = happyReduce_100 +action_402 (211) = happyReduce_100 +action_402 (212) = happyReduce_100 +action_402 (214) = happyReduce_100 +action_402 (215) = happyReduce_100 +action_402 (217) = happyReduce_100 +action_402 (218) = happyShift action_405 +action_402 (219) = happyReduce_100 +action_402 (220) = happyReduce_100 +action_402 (221) = happyReduce_100 +action_402 (222) = happyReduce_100 +action_402 (223) = happyReduce_100 +action_402 (224) = happyReduce_100 +action_402 (228) = happyReduce_100 +action_402 (229) = happyReduce_100 +action_402 (230) = happyReduce_100 +action_402 (234) = happyReduce_100 +action_402 (236) = happyReduce_100 +action_402 (242) = happyReduce_100 +action_402 (245) = happyReduce_100 +action_402 (246) = happyReduce_100 +action_402 (247) = happyReduce_100 +action_402 (248) = happyReduce_100 +action_402 (249) = happyReduce_100 +action_402 (250) = happyReduce_100 +action_402 (251) = happyReduce_100 +action_402 (253) = happyReduce_100 +action_402 (255) = happyReduce_100 +action_402 (256) = happyReduce_100 +action_402 (257) = happyReduce_100 +action_402 (258) = happyShift action_54 +action_402 (259) = happyShift action_55 +action_402 (260) = happyReduce_100 +action_402 (261) = happyReduce_100 +action_402 (262) = happyReduce_100 +action_402 (263) = happyReduce_100 +action_402 (264) = happyShift action_117 +action_402 (265) = happyReduce_100 +action_402 (266) = happyReduce_100 +action_402 (267) = happyReduce_100 +action_402 (268) = happyReduce_100 +action_402 (269) = happyReduce_100 +action_402 (270) = happyReduce_100 +action_402 (27) = happyGoto action_399 +action_402 (36) = happyGoto action_400 +action_402 (44) = happyGoto action_530 +action_402 _ = happyReduce_100 + +action_403 _ = happyReduce_102 + +action_404 (198) = happyShift action_404 +action_404 (218) = happyShift action_405 +action_404 (258) = happyShift action_54 +action_404 (259) = happyShift action_55 +action_404 (264) = happyShift action_117 +action_404 (27) = happyGoto action_399 +action_404 (36) = happyGoto action_400 +action_404 (42) = happyGoto action_529 +action_404 (43) = happyGoto action_402 +action_404 (44) = happyGoto action_403 +action_404 _ = happyFail (happyExpListPerState 404) + +action_405 _ = happyReduce_104 + +action_406 _ = happyReduce_114 + +action_407 _ = happyReduce_113 + +action_408 (1) = happyReduce_116 +action_408 (198) = happyReduce_116 +action_408 (199) = happyReduce_116 +action_408 (200) = happyReduce_116 +action_408 (201) = happyReduce_116 +action_408 (202) = happyReduce_116 +action_408 (203) = happyReduce_116 +action_408 (205) = happyReduce_116 +action_408 (206) = happyReduce_116 +action_408 (207) = happyReduce_116 +action_408 (208) = happyReduce_116 +action_408 (209) = happyReduce_116 +action_408 (210) = happyReduce_116 +action_408 (211) = happyReduce_116 +action_408 (212) = happyReduce_116 +action_408 (214) = happyReduce_116 +action_408 (215) = happyReduce_116 +action_408 (217) = happyReduce_116 +action_408 (218) = happyReduce_116 +action_408 (219) = happyReduce_116 +action_408 (220) = happyReduce_116 +action_408 (221) = happyReduce_116 +action_408 (222) = happyReduce_116 +action_408 (223) = happyReduce_116 +action_408 (224) = happyReduce_116 +action_408 (228) = happyReduce_116 +action_408 (229) = happyReduce_116 +action_408 (230) = happyReduce_116 +action_408 (234) = happyReduce_116 +action_408 (236) = happyReduce_116 +action_408 (242) = happyReduce_116 +action_408 (245) = happyReduce_116 +action_408 (246) = happyReduce_116 +action_408 (247) = happyReduce_116 +action_408 (248) = happyReduce_116 +action_408 (249) = happyReduce_116 +action_408 (250) = happyReduce_116 +action_408 (251) = happyReduce_116 +action_408 (253) = happyReduce_116 +action_408 (255) = happyReduce_116 +action_408 (256) = happyReduce_116 +action_408 (257) = happyReduce_116 +action_408 (258) = happyReduce_116 +action_408 (259) = happyReduce_116 +action_408 (260) = happyReduce_116 +action_408 (261) = happyReduce_116 +action_408 (262) = happyReduce_116 +action_408 (263) = happyReduce_116 +action_408 (264) = happyReduce_116 +action_408 (265) = happyReduce_116 +action_408 (266) = happyReduce_116 +action_408 (267) = happyReduce_116 +action_408 (268) = happyReduce_116 +action_408 (269) = happyReduce_116 +action_408 (270) = happyReduce_116 +action_408 _ = happyReduce_116 + +action_409 _ = happyReduce_148 + +action_410 (212) = happyShift action_528 +action_410 _ = happyFail (happyExpListPerState 410) + +action_411 (223) = happyShift action_45 +action_411 (234) = happyShift action_47 +action_411 (245) = happyShift action_48 +action_411 (246) = happyShift action_49 +action_411 (248) = happyShift action_50 +action_411 (249) = happyShift action_51 +action_411 (256) = happyShift action_53 +action_411 (30) = happyGoto action_527 +action_411 _ = happyFail (happyExpListPerState 411) + +action_412 _ = happyReduce_396 + +action_413 (198) = happyShift action_148 +action_413 (200) = happyShift action_149 +action_413 (202) = happyShift action_150 +action_413 (218) = happyShift action_151 +action_413 (220) = happyShift action_152 +action_413 (223) = happyShift action_45 +action_413 (231) = happyShift action_153 +action_413 (232) = happyShift action_154 +action_413 (234) = happyShift action_47 +action_413 (245) = happyShift action_48 +action_413 (246) = happyShift action_49 +action_413 (248) = happyShift action_50 +action_413 (249) = happyShift action_51 +action_413 (254) = happyShift action_155 +action_413 (255) = happyShift action_112 +action_413 (256) = happyShift action_53 +action_413 (258) = happyShift action_54 +action_413 (259) = happyShift action_55 +action_413 (260) = happyShift action_115 +action_413 (261) = happyShift action_116 +action_413 (264) = happyShift action_117 +action_413 (266) = happyShift action_57 +action_413 (267) = happyShift action_58 +action_413 (268) = happyShift action_156 +action_413 (27) = happyGoto action_133 +action_413 (30) = happyGoto action_134 +action_413 (33) = happyGoto action_135 +action_413 (36) = happyGoto action_136 +action_413 (37) = happyGoto action_137 +action_413 (40) = happyGoto action_138 +action_413 (46) = happyGoto action_526 +action_413 (47) = happyGoto action_141 +action_413 (48) = happyGoto action_142 +action_413 (49) = happyGoto action_143 +action_413 (50) = happyGoto action_144 +action_413 (51) = happyGoto action_145 +action_413 (57) = happyGoto action_146 +action_413 _ = happyFail (happyExpListPerState 413) + +action_414 (203) = happyShift action_525 +action_414 _ = happyFail (happyExpListPerState 414) + +action_415 (201) = happyShift action_524 +action_415 _ = happyFail (happyExpListPerState 415) + +action_416 (199) = happyShift action_523 +action_416 _ = happyFail (happyExpListPerState 416) + +action_417 (212) = happyShift action_522 +action_417 _ = happyFail (happyExpListPerState 417) + +action_418 (198) = happyShift action_404 +action_418 (218) = happyShift action_405 +action_418 (258) = happyShift action_54 +action_418 (259) = happyShift action_55 +action_418 (264) = happyShift action_117 +action_418 (27) = happyGoto action_399 +action_418 (36) = happyGoto action_400 +action_418 (42) = happyGoto action_521 +action_418 (43) = happyGoto action_402 +action_418 (44) = happyGoto action_403 +action_418 _ = happyFail (happyExpListPerState 418) + +action_419 _ = happyReduce_131 + +action_420 _ = happyReduce_129 + +action_421 _ = happyReduce_143 + +action_422 (222) = happyShift action_232 +action_422 (223) = happyShift action_233 +action_422 (224) = happyShift action_234 +action_422 (225) = happyShift action_235 +action_422 (226) = happyShift action_236 +action_422 (227) = happyShift action_237 +action_422 (228) = happyShift action_238 +action_422 (229) = happyShift action_239 +action_422 (230) = happyShift action_240 +action_422 (231) = happyShift action_241 +action_422 (233) = happyShift action_242 +action_422 (234) = happyShift action_243 +action_422 (235) = happyShift action_244 +action_422 (236) = happyShift action_245 +action_422 (237) = happyShift action_246 +action_422 (238) = happyShift action_247 +action_422 (239) = happyShift action_248 +action_422 (240) = happyShift action_249 +action_422 (241) = happyShift action_250 +action_422 (242) = happyShift action_251 +action_422 (243) = happyShift action_252 +action_422 (244) = happyShift action_253 +action_422 (245) = happyShift action_254 +action_422 (246) = happyShift action_255 +action_422 (247) = happyShift action_256 +action_422 (248) = happyShift action_257 +action_422 (249) = happyShift action_258 +action_422 (250) = happyShift action_259 +action_422 (251) = happyShift action_260 +action_422 (252) = happyShift action_261 +action_422 (253) = happyShift action_262 +action_422 (256) = happyShift action_263 +action_422 (266) = happyShift action_264 +action_422 (267) = happyShift action_265 +action_422 (35) = happyGoto action_226 +action_422 (54) = happyGoto action_520 +action_422 _ = happyFail (happyExpListPerState 422) + +action_423 (198) = happyShift action_148 +action_423 (200) = happyShift action_149 +action_423 (202) = happyShift action_150 +action_423 (218) = happyShift action_151 +action_423 (220) = happyShift action_152 +action_423 (223) = happyShift action_45 +action_423 (231) = happyShift action_153 +action_423 (232) = happyShift action_154 +action_423 (234) = happyShift action_47 +action_423 (245) = happyShift action_48 +action_423 (246) = happyShift action_49 +action_423 (248) = happyShift action_50 +action_423 (249) = happyShift action_51 +action_423 (254) = happyShift action_155 +action_423 (255) = happyShift action_112 +action_423 (256) = happyShift action_53 +action_423 (258) = happyShift action_54 +action_423 (259) = happyShift action_55 +action_423 (260) = happyShift action_115 +action_423 (261) = happyShift action_116 +action_423 (264) = happyShift action_117 +action_423 (266) = happyShift action_57 +action_423 (267) = happyShift action_58 +action_423 (268) = happyShift action_156 +action_423 (27) = happyGoto action_133 +action_423 (30) = happyGoto action_134 +action_423 (33) = happyGoto action_135 +action_423 (36) = happyGoto action_136 +action_423 (37) = happyGoto action_137 +action_423 (40) = happyGoto action_138 +action_423 (45) = happyGoto action_519 +action_423 (46) = happyGoto action_140 +action_423 (47) = happyGoto action_141 +action_423 (48) = happyGoto action_142 +action_423 (49) = happyGoto action_143 +action_423 (50) = happyGoto action_144 +action_423 (51) = happyGoto action_145 +action_423 (57) = happyGoto action_146 +action_423 _ = happyFail (happyExpListPerState 423) + +action_424 _ = happyReduce_130 + +action_425 (198) = happyShift action_148 +action_425 (200) = happyShift action_149 +action_425 (202) = happyShift action_150 +action_425 (218) = happyShift action_151 +action_425 (220) = happyShift action_152 +action_425 (223) = happyShift action_45 +action_425 (231) = happyShift action_153 +action_425 (232) = happyShift action_154 +action_425 (234) = happyShift action_47 +action_425 (245) = happyShift action_48 +action_425 (246) = happyShift action_49 +action_425 (248) = happyShift action_50 +action_425 (249) = happyShift action_51 +action_425 (254) = happyShift action_155 +action_425 (255) = happyShift action_112 +action_425 (256) = happyShift action_53 +action_425 (258) = happyShift action_54 +action_425 (259) = happyShift action_55 +action_425 (260) = happyShift action_115 +action_425 (261) = happyShift action_116 +action_425 (264) = happyShift action_117 +action_425 (266) = happyShift action_57 +action_425 (267) = happyShift action_58 +action_425 (268) = happyShift action_156 +action_425 (27) = happyGoto action_133 +action_425 (30) = happyGoto action_134 +action_425 (33) = happyGoto action_135 +action_425 (36) = happyGoto action_136 +action_425 (37) = happyGoto action_137 +action_425 (40) = happyGoto action_138 +action_425 (45) = happyGoto action_518 +action_425 (46) = happyGoto action_140 +action_425 (47) = happyGoto action_141 +action_425 (48) = happyGoto action_142 +action_425 (49) = happyGoto action_143 +action_425 (50) = happyGoto action_144 +action_425 (51) = happyGoto action_145 +action_425 (57) = happyGoto action_146 +action_425 _ = happyFail (happyExpListPerState 425) + +action_426 _ = happyReduce_298 + +action_427 _ = happyReduce_299 + +action_428 _ = happyReduce_389 + +action_429 (213) = happyShift action_517 +action_429 _ = happyFail (happyExpListPerState 429) + +action_430 _ = happyReduce_211 + +action_431 (1) = happyReduce_353 +action_431 (205) = happyReduce_353 +action_431 (206) = happyReduce_353 +action_431 (214) = happyShift action_433 +action_431 (229) = happyReduce_353 +action_431 (270) = happyReduce_353 +action_431 (75) = happyGoto action_516 +action_431 (83) = happyGoto action_429 +action_431 _ = happyReduce_353 + +action_432 (198) = happyShift action_95 +action_432 (200) = happyShift action_96 +action_432 (202) = happyShift action_97 +action_432 (218) = happyShift action_98 +action_432 (219) = happyShift action_99 +action_432 (220) = happyShift action_100 +action_432 (222) = happyShift action_101 +action_432 (223) = happyShift action_102 +action_432 (224) = happyShift action_103 +action_432 (228) = happyShift action_104 +action_432 (230) = happyShift action_46 +action_432 (234) = happyShift action_105 +action_432 (236) = happyShift action_106 +action_432 (242) = happyShift action_107 +action_432 (245) = happyShift action_108 +action_432 (246) = happyShift action_109 +action_432 (248) = happyShift action_110 +action_432 (249) = happyShift action_111 +action_432 (251) = happyShift action_52 +action_432 (255) = happyShift action_112 +action_432 (256) = happyShift action_113 +action_432 (257) = happyShift action_114 +action_432 (258) = happyShift action_54 +action_432 (259) = happyShift action_55 +action_432 (260) = happyShift action_115 +action_432 (261) = happyShift action_116 +action_432 (264) = happyShift action_117 +action_432 (265) = happyShift action_56 +action_432 (266) = happyShift action_57 +action_432 (267) = happyShift action_58 +action_432 (268) = happyShift action_59 +action_432 (269) = happyShift action_60 +action_432 (27) = happyGoto action_74 +action_432 (29) = happyGoto action_75 +action_432 (33) = happyGoto action_76 +action_432 (36) = happyGoto action_77 +action_432 (37) = happyGoto action_78 +action_432 (38) = happyGoto action_79 +action_432 (39) = happyGoto action_80 +action_432 (41) = happyGoto action_81 +action_432 (58) = happyGoto action_514 +action_432 (59) = happyGoto action_515 +action_432 (60) = happyGoto action_122 +action_432 (61) = happyGoto action_83 +action_432 (63) = happyGoto action_84 +action_432 (64) = happyGoto action_85 +action_432 (65) = happyGoto action_86 +action_432 (66) = happyGoto action_87 +action_432 (67) = happyGoto action_88 +action_432 (68) = happyGoto action_89 +action_432 (78) = happyGoto action_90 +action_432 (79) = happyGoto action_91 +action_432 (133) = happyGoto action_93 +action_432 (135) = happyGoto action_94 +action_432 _ = happyFail (happyExpListPerState 432) + +action_433 _ = happyReduce_224 + +action_434 (198) = happyShift action_148 +action_434 (200) = happyShift action_149 +action_434 (202) = happyShift action_150 +action_434 (218) = happyShift action_151 +action_434 (223) = happyShift action_45 +action_434 (234) = happyShift action_47 +action_434 (245) = happyShift action_48 +action_434 (246) = happyShift action_49 +action_434 (248) = happyShift action_50 +action_434 (249) = happyShift action_51 +action_434 (254) = happyShift action_155 +action_434 (255) = happyShift action_112 +action_434 (256) = happyShift action_53 +action_434 (258) = happyShift action_54 +action_434 (259) = happyShift action_55 +action_434 (260) = happyShift action_115 +action_434 (261) = happyShift action_116 +action_434 (264) = happyShift action_117 +action_434 (266) = happyShift action_57 +action_434 (267) = happyShift action_58 +action_434 (268) = happyShift action_156 +action_434 (27) = happyGoto action_133 +action_434 (30) = happyGoto action_134 +action_434 (33) = happyGoto action_135 +action_434 (36) = happyGoto action_136 +action_434 (37) = happyGoto action_137 +action_434 (40) = happyGoto action_138 +action_434 (51) = happyGoto action_326 +action_434 (143) = happyGoto action_513 +action_434 (164) = happyGoto action_328 +action_434 (193) = happyGoto action_329 +action_434 _ = happyReduce_359 + +action_435 (1) = happyReduce_414 +action_435 (205) = happyReduce_414 +action_435 (206) = happyReduce_414 +action_435 (214) = happyReduce_414 +action_435 (229) = happyReduce_414 +action_435 (270) = happyReduce_414 +action_435 _ = happyReduce_414 + +action_436 _ = happyReduce_286 + +action_437 (214) = happyShift action_512 +action_437 _ = happyReduce_372 + +action_438 _ = happyReduce_287 + +action_439 (198) = happyShift action_148 +action_439 (200) = happyShift action_149 +action_439 (202) = happyShift action_150 +action_439 (218) = happyShift action_151 +action_439 (223) = happyShift action_45 +action_439 (234) = happyShift action_47 +action_439 (245) = happyShift action_48 +action_439 (246) = happyShift action_49 +action_439 (248) = happyShift action_50 +action_439 (249) = happyShift action_51 +action_439 (254) = happyShift action_155 +action_439 (255) = happyShift action_112 +action_439 (256) = happyShift action_53 +action_439 (258) = happyShift action_54 +action_439 (259) = happyShift action_55 +action_439 (260) = happyShift action_115 +action_439 (261) = happyShift action_116 +action_439 (264) = happyShift action_117 +action_439 (266) = happyShift action_57 +action_439 (267) = happyShift action_58 +action_439 (268) = happyShift action_156 +action_439 (27) = happyGoto action_133 +action_439 (30) = happyGoto action_134 +action_439 (33) = happyGoto action_135 +action_439 (36) = happyGoto action_136 +action_439 (37) = happyGoto action_137 +action_439 (40) = happyGoto action_138 +action_439 (51) = happyGoto action_511 +action_439 _ = happyFail (happyExpListPerState 439) + +action_440 (223) = happyShift action_45 +action_440 (234) = happyShift action_47 +action_440 (245) = happyShift action_48 +action_440 (246) = happyShift action_49 +action_440 (248) = happyShift action_50 +action_440 (249) = happyShift action_51 +action_440 (256) = happyShift action_53 +action_440 (30) = happyGoto action_507 +action_440 (117) = happyGoto action_508 +action_440 (147) = happyGoto action_509 +action_440 (173) = happyGoto action_510 +action_440 _ = happyFail (happyExpListPerState 440) + +action_441 (223) = happyShift action_45 +action_441 (234) = happyShift action_47 +action_441 (245) = happyShift action_48 +action_441 (246) = happyShift action_49 +action_441 (248) = happyShift action_50 +action_441 (249) = happyShift action_51 +action_441 (256) = happyShift action_53 +action_441 (30) = happyGoto action_503 +action_441 (122) = happyGoto action_504 +action_441 (148) = happyGoto action_505 +action_441 (174) = happyGoto action_506 +action_441 _ = happyFail (happyExpListPerState 441) + +action_442 (223) = happyShift action_502 +action_442 _ = happyFail (happyExpListPerState 442) + +action_443 (223) = happyShift action_501 +action_443 _ = happyFail (happyExpListPerState 443) + +action_444 (258) = happyShift action_54 +action_444 (259) = happyShift action_55 +action_444 (27) = happyGoto action_500 +action_444 _ = happyFail (happyExpListPerState 444) + +action_445 _ = happyReduce_151 + +action_446 _ = happyReduce_438 + +action_447 _ = happyReduce_304 + +action_448 _ = happyReduce_364 + +action_449 (1) = happyReduce_384 +action_449 (198) = happyShift action_450 +action_449 (205) = happyReduce_384 +action_449 (206) = happyReduce_384 +action_449 (213) = happyReduce_384 +action_449 (223) = happyShift action_45 +action_449 (229) = happyReduce_384 +action_449 (234) = happyShift action_47 +action_449 (245) = happyShift action_48 +action_449 (246) = happyShift action_49 +action_449 (248) = happyShift action_50 +action_449 (249) = happyShift action_51 +action_449 (256) = happyShift action_53 +action_449 (270) = happyReduce_384 +action_449 (30) = happyGoto action_445 +action_449 (56) = happyGoto action_499 +action_449 _ = happyReduce_384 + +action_450 (223) = happyShift action_45 +action_450 (234) = happyShift action_47 +action_450 (245) = happyShift action_48 +action_450 (246) = happyShift action_49 +action_450 (248) = happyShift action_50 +action_450 (249) = happyShift action_51 +action_450 (256) = happyShift action_53 +action_450 (30) = happyGoto action_498 +action_450 _ = happyFail (happyExpListPerState 450) + +action_451 (198) = happyShift action_148 +action_451 (200) = happyShift action_149 +action_451 (202) = happyShift action_150 +action_451 (218) = happyShift action_151 +action_451 (220) = happyShift action_152 +action_451 (223) = happyShift action_45 +action_451 (231) = happyShift action_153 +action_451 (232) = happyShift action_154 +action_451 (234) = happyShift action_47 +action_451 (245) = happyShift action_48 +action_451 (246) = happyShift action_49 +action_451 (248) = happyShift action_50 +action_451 (249) = happyShift action_51 +action_451 (254) = happyShift action_155 +action_451 (255) = happyShift action_112 +action_451 (256) = happyShift action_53 +action_451 (258) = happyShift action_54 +action_451 (259) = happyShift action_55 +action_451 (260) = happyShift action_115 +action_451 (261) = happyShift action_116 +action_451 (264) = happyShift action_117 +action_451 (266) = happyShift action_57 +action_451 (267) = happyShift action_58 +action_451 (268) = happyShift action_156 +action_451 (27) = happyGoto action_133 +action_451 (30) = happyGoto action_134 +action_451 (33) = happyGoto action_135 +action_451 (36) = happyGoto action_136 +action_451 (37) = happyGoto action_137 +action_451 (40) = happyGoto action_138 +action_451 (45) = happyGoto action_497 +action_451 (46) = happyGoto action_140 +action_451 (47) = happyGoto action_141 +action_451 (48) = happyGoto action_142 +action_451 (49) = happyGoto action_143 +action_451 (50) = happyGoto action_144 +action_451 (51) = happyGoto action_145 +action_451 (57) = happyGoto action_146 +action_451 _ = happyFail (happyExpListPerState 451) + +action_452 _ = happyReduce_297 + +action_453 (212) = happyShift action_496 +action_453 _ = happyFail (happyExpListPerState 453) + +action_454 (258) = happyShift action_63 +action_454 (28) = happyGoto action_495 +action_454 _ = happyFail (happyExpListPerState 454) + +action_455 (258) = happyShift action_54 +action_455 (259) = happyShift action_55 +action_455 (27) = happyGoto action_494 +action_455 _ = happyFail (happyExpListPerState 455) + +action_456 (198) = happyShift action_148 +action_456 (200) = happyShift action_149 +action_456 (202) = happyShift action_150 +action_456 (218) = happyShift action_151 +action_456 (223) = happyShift action_45 +action_456 (234) = happyShift action_47 +action_456 (245) = happyShift action_48 +action_456 (246) = happyShift action_49 +action_456 (248) = happyShift action_50 +action_456 (249) = happyShift action_51 +action_456 (254) = happyShift action_155 +action_456 (255) = happyShift action_112 +action_456 (256) = happyShift action_53 +action_456 (258) = happyShift action_54 +action_456 (259) = happyShift action_55 +action_456 (260) = happyShift action_115 +action_456 (261) = happyShift action_116 +action_456 (264) = happyShift action_117 +action_456 (266) = happyShift action_57 +action_456 (267) = happyShift action_58 +action_456 (268) = happyShift action_156 +action_456 (27) = happyGoto action_133 +action_456 (30) = happyGoto action_134 +action_456 (33) = happyGoto action_135 +action_456 (36) = happyGoto action_136 +action_456 (37) = happyGoto action_137 +action_456 (40) = happyGoto action_138 +action_456 (51) = happyGoto action_326 +action_456 (143) = happyGoto action_493 +action_456 (164) = happyGoto action_328 +action_456 (193) = happyGoto action_329 +action_456 _ = happyReduce_359 + +action_457 (210) = happyShift action_492 +action_457 _ = happyFail (happyExpListPerState 457) + +action_458 (216) = happyShift action_491 +action_458 _ = happyFail (happyExpListPerState 458) + +action_459 (210) = happyReduce_324 +action_459 _ = happyReduce_320 + +action_460 _ = happyReduce_306 + +action_461 (198) = happyShift action_148 +action_461 (200) = happyShift action_149 +action_461 (202) = happyShift action_150 +action_461 (218) = happyShift action_151 +action_461 (220) = happyShift action_152 +action_461 (223) = happyShift action_45 +action_461 (231) = happyShift action_153 +action_461 (232) = happyShift action_154 +action_461 (234) = happyShift action_47 +action_461 (245) = happyShift action_48 +action_461 (246) = happyShift action_49 +action_461 (248) = happyShift action_50 +action_461 (249) = happyShift action_51 +action_461 (254) = happyShift action_155 +action_461 (255) = happyShift action_112 +action_461 (256) = happyShift action_53 +action_461 (258) = happyShift action_54 +action_461 (259) = happyShift action_55 +action_461 (260) = happyShift action_115 +action_461 (261) = happyShift action_116 +action_461 (264) = happyShift action_117 +action_461 (266) = happyShift action_57 +action_461 (267) = happyShift action_58 +action_461 (268) = happyShift action_156 +action_461 (27) = happyGoto action_133 +action_461 (30) = happyGoto action_134 +action_461 (33) = happyGoto action_135 +action_461 (36) = happyGoto action_136 +action_461 (37) = happyGoto action_137 +action_461 (40) = happyGoto action_138 +action_461 (45) = happyGoto action_490 +action_461 (46) = happyGoto action_140 +action_461 (47) = happyGoto action_141 +action_461 (48) = happyGoto action_142 +action_461 (49) = happyGoto action_143 +action_461 (50) = happyGoto action_144 +action_461 (51) = happyGoto action_145 +action_461 (57) = happyGoto action_146 +action_461 _ = happyFail (happyExpListPerState 461) + +action_462 (245) = happyShift action_487 +action_462 (246) = happyShift action_488 +action_462 (248) = happyShift action_489 +action_462 (125) = happyGoto action_484 +action_462 (140) = happyGoto action_485 +action_462 (170) = happyGoto action_486 +action_462 _ = happyFail (happyExpListPerState 462) + +action_463 _ = happyReduce_305 + +action_464 (198) = happyShift action_148 +action_464 (200) = happyShift action_149 +action_464 (202) = happyShift action_150 +action_464 (218) = happyShift action_151 +action_464 (220) = happyShift action_152 +action_464 (223) = happyShift action_45 +action_464 (231) = happyShift action_153 +action_464 (232) = happyShift action_154 +action_464 (234) = happyShift action_47 +action_464 (245) = happyShift action_48 +action_464 (246) = happyShift action_49 +action_464 (248) = happyShift action_50 +action_464 (249) = happyShift action_51 +action_464 (254) = happyShift action_155 +action_464 (255) = happyShift action_112 +action_464 (256) = happyShift action_53 +action_464 (258) = happyShift action_54 +action_464 (259) = happyShift action_55 +action_464 (260) = happyShift action_115 +action_464 (261) = happyShift action_116 +action_464 (264) = happyShift action_117 +action_464 (266) = happyShift action_57 +action_464 (267) = happyShift action_58 +action_464 (268) = happyShift action_156 +action_464 (27) = happyGoto action_133 +action_464 (30) = happyGoto action_134 +action_464 (33) = happyGoto action_135 +action_464 (36) = happyGoto action_136 +action_464 (37) = happyGoto action_137 +action_464 (40) = happyGoto action_138 +action_464 (45) = happyGoto action_483 +action_464 (46) = happyGoto action_140 +action_464 (47) = happyGoto action_141 +action_464 (48) = happyGoto action_142 +action_464 (49) = happyGoto action_143 +action_464 (50) = happyGoto action_144 +action_464 (51) = happyGoto action_145 +action_464 (57) = happyGoto action_146 +action_464 _ = happyFail (happyExpListPerState 464) + +action_465 (223) = happyShift action_482 +action_465 _ = happyReduce_274 + +action_466 (223) = happyShift action_45 +action_466 (225) = happyShift action_478 +action_466 (234) = happyShift action_47 +action_466 (245) = happyShift action_48 +action_466 (246) = happyShift action_49 +action_466 (248) = happyShift action_50 +action_466 (249) = happyShift action_51 +action_466 (252) = happyShift action_479 +action_466 (255) = happyShift action_480 +action_466 (256) = happyShift action_53 +action_466 (258) = happyShift action_63 +action_466 (260) = happyShift action_481 +action_466 (28) = happyGoto action_472 +action_466 (30) = happyGoto action_473 +action_466 (34) = happyGoto action_474 +action_466 (105) = happyGoto action_475 +action_466 (158) = happyGoto action_476 +action_466 (187) = happyGoto action_477 +action_466 _ = happyFail (happyExpListPerState 466) + +action_467 (198) = happyShift action_471 +action_467 _ = happyFail (happyExpListPerState 467) + +action_468 _ = happyReduce_406 + +action_469 _ = happyReduce_261 + +action_470 _ = happyReduce_417 + +action_471 (223) = happyShift action_45 +action_471 (225) = happyShift action_478 +action_471 (234) = happyShift action_47 +action_471 (245) = happyShift action_48 +action_471 (246) = happyShift action_49 +action_471 (248) = happyShift action_50 +action_471 (249) = happyShift action_51 +action_471 (252) = happyShift action_479 +action_471 (255) = happyShift action_480 +action_471 (256) = happyShift action_53 +action_471 (258) = happyShift action_63 +action_471 (260) = happyShift action_481 +action_471 (28) = happyGoto action_472 +action_471 (30) = happyGoto action_473 +action_471 (34) = happyGoto action_474 +action_471 (105) = happyGoto action_475 +action_471 (158) = happyGoto action_642 +action_471 (187) = happyGoto action_477 +action_471 _ = happyFail (happyExpListPerState 471) + +action_472 (198) = happyShift action_609 +action_472 (255) = happyShift action_610 +action_472 (102) = happyGoto action_641 +action_472 _ = happyReduce_281 + +action_473 _ = happyReduce_279 + +action_474 _ = happyReduce_280 + +action_475 (199) = happyReduce_424 +action_475 (217) = happyReduce_424 +action_475 _ = happyReduce_424 + +action_476 (199) = happyShift action_640 +action_476 _ = happyFail (happyExpListPerState 476) + +action_477 (217) = happyShift action_639 +action_477 _ = happyReduce_377 + +action_478 (258) = happyShift action_63 +action_478 (28) = happyGoto action_638 +action_478 _ = happyFail (happyExpListPerState 478) + +action_479 (255) = happyShift action_480 +action_479 (260) = happyShift action_481 +action_479 (34) = happyGoto action_637 +action_479 _ = happyFail (happyExpListPerState 479) + +action_480 _ = happyReduce_56 + +action_481 _ = happyReduce_55 + +action_482 (258) = happyShift action_24 +action_482 (259) = happyShift action_132 +action_482 (26) = happyGoto action_636 +action_482 _ = happyFail (happyExpListPerState 482) + +action_483 _ = happyReduce_295 + +action_484 _ = happyReduce_393 + +action_485 _ = happyReduce_303 + +action_486 (1) = happyReduce_355 +action_486 (205) = happyReduce_355 +action_486 (206) = happyReduce_355 +action_486 (229) = happyReduce_355 +action_486 (245) = happyShift action_487 +action_486 (246) = happyShift action_488 +action_486 (248) = happyShift action_489 +action_486 (270) = happyReduce_355 +action_486 (125) = happyGoto action_635 +action_486 _ = happyReduce_355 + +action_487 _ = happyReduce_334 + +action_488 _ = happyReduce_336 + +action_489 _ = happyReduce_335 + +action_490 _ = happyReduce_294 + +action_491 _ = happyReduce_321 + +action_492 (258) = happyShift action_54 +action_492 (259) = happyShift action_55 +action_492 (27) = happyGoto action_634 +action_492 _ = happyFail (happyExpListPerState 492) + +action_493 (210) = happyReduce_324 +action_493 _ = happyReduce_318 + +action_494 (198) = happyShift action_148 +action_494 (200) = happyShift action_149 +action_494 (202) = happyShift action_150 +action_494 (218) = happyShift action_151 +action_494 (223) = happyShift action_45 +action_494 (234) = happyShift action_47 +action_494 (245) = happyShift action_48 +action_494 (246) = happyShift action_49 +action_494 (248) = happyShift action_50 +action_494 (249) = happyShift action_51 +action_494 (254) = happyShift action_155 +action_494 (255) = happyShift action_112 +action_494 (256) = happyShift action_53 +action_494 (258) = happyShift action_54 +action_494 (259) = happyShift action_55 +action_494 (260) = happyShift action_115 +action_494 (261) = happyShift action_116 +action_494 (264) = happyShift action_117 +action_494 (266) = happyShift action_57 +action_494 (267) = happyShift action_58 +action_494 (268) = happyShift action_156 +action_494 (27) = happyGoto action_133 +action_494 (30) = happyGoto action_134 +action_494 (33) = happyGoto action_135 +action_494 (36) = happyGoto action_136 +action_494 (37) = happyGoto action_137 +action_494 (40) = happyGoto action_138 +action_494 (51) = happyGoto action_326 +action_494 (143) = happyGoto action_633 +action_494 (164) = happyGoto action_328 +action_494 (193) = happyGoto action_329 +action_494 _ = happyReduce_359 + +action_495 (212) = happyShift action_632 +action_495 _ = happyFail (happyExpListPerState 495) + +action_496 (198) = happyShift action_148 +action_496 (200) = happyShift action_149 +action_496 (202) = happyShift action_150 +action_496 (218) = happyShift action_151 +action_496 (220) = happyShift action_152 +action_496 (223) = happyShift action_45 +action_496 (231) = happyShift action_153 +action_496 (232) = happyShift action_154 +action_496 (234) = happyShift action_47 +action_496 (245) = happyShift action_48 +action_496 (246) = happyShift action_49 +action_496 (248) = happyShift action_50 +action_496 (249) = happyShift action_51 +action_496 (254) = happyShift action_155 +action_496 (255) = happyShift action_112 +action_496 (256) = happyShift action_53 +action_496 (258) = happyShift action_54 +action_496 (259) = happyShift action_55 +action_496 (260) = happyShift action_115 +action_496 (261) = happyShift action_116 +action_496 (264) = happyShift action_117 +action_496 (266) = happyShift action_57 +action_496 (267) = happyShift action_58 +action_496 (268) = happyShift action_156 +action_496 (27) = happyGoto action_133 +action_496 (30) = happyGoto action_134 +action_496 (33) = happyGoto action_135 +action_496 (36) = happyGoto action_136 +action_496 (37) = happyGoto action_137 +action_496 (40) = happyGoto action_138 +action_496 (45) = happyGoto action_631 +action_496 (46) = happyGoto action_140 +action_496 (47) = happyGoto action_141 +action_496 (48) = happyGoto action_142 +action_496 (49) = happyGoto action_143 +action_496 (50) = happyGoto action_144 +action_496 (51) = happyGoto action_145 +action_496 (57) = happyGoto action_146 +action_496 _ = happyFail (happyExpListPerState 496) + +action_497 _ = happyReduce_293 + +action_498 (212) = happyShift action_630 +action_498 _ = happyFail (happyExpListPerState 498) + +action_499 _ = happyReduce_439 + +action_500 (223) = happyShift action_629 +action_500 _ = happyFail (happyExpListPerState 500) + +action_501 (209) = happyShift action_193 +action_501 (211) = happyShift action_194 +action_501 (220) = happyShift action_195 +action_501 (262) = happyShift action_196 +action_501 (32) = happyGoto action_628 +action_501 _ = happyFail (happyExpListPerState 501) + +action_502 (209) = happyShift action_193 +action_502 (211) = happyShift action_194 +action_502 (220) = happyShift action_195 +action_502 (262) = happyShift action_196 +action_502 (32) = happyGoto action_627 +action_502 _ = happyFail (happyExpListPerState 502) + +action_503 (198) = happyShift action_40 +action_503 (200) = happyShift action_41 +action_503 (202) = happyShift action_42 +action_503 (212) = happyShift action_626 +action_503 (218) = happyShift action_43 +action_503 (223) = happyShift action_45 +action_503 (230) = happyShift action_46 +action_503 (234) = happyShift action_47 +action_503 (245) = happyShift action_48 +action_503 (246) = happyShift action_49 +action_503 (248) = happyShift action_50 +action_503 (249) = happyShift action_51 +action_503 (251) = happyShift action_52 +action_503 (256) = happyShift action_53 +action_503 (258) = happyShift action_54 +action_503 (259) = happyShift action_55 +action_503 (265) = happyShift action_56 +action_503 (266) = happyShift action_57 +action_503 (267) = happyShift action_58 +action_503 (268) = happyShift action_59 +action_503 (269) = happyShift action_60 +action_503 (27) = happyGoto action_25 +action_503 (30) = happyGoto action_26 +action_503 (37) = happyGoto action_27 +action_503 (38) = happyGoto action_28 +action_503 (39) = happyGoto action_29 +action_503 (41) = happyGoto action_30 +action_503 (91) = happyGoto action_35 +action_503 (132) = happyGoto action_36 +action_503 (134) = happyGoto action_37 +action_503 (136) = happyGoto action_222 +action_503 (142) = happyGoto action_625 +action_503 (166) = happyGoto action_39 +action_503 _ = happyReduce_357 + +action_504 _ = happyReduce_401 + +action_505 (205) = happyShift action_624 +action_505 _ = happyFail (happyExpListPerState 505) + +action_506 (206) = happyShift action_623 +action_506 _ = happyReduce_367 + +action_507 (212) = happyShift action_622 +action_507 _ = happyFail (happyExpListPerState 507) + +action_508 _ = happyReduce_399 + +action_509 (205) = happyShift action_621 +action_509 _ = happyFail (happyExpListPerState 509) + +action_510 (206) = happyShift action_620 +action_510 _ = happyReduce_366 + +action_511 _ = happyReduce_288 + +action_512 (258) = happyShift action_63 +action_512 (28) = happyGoto action_434 +action_512 (110) = happyGoto action_619 +action_512 _ = happyFail (happyExpListPerState 512) + +action_513 _ = happyReduce_307 + +action_514 _ = happyReduce_210 + +action_515 (1) = happyReduce_155 +action_515 (198) = happyReduce_155 +action_515 (199) = happyReduce_155 +action_515 (200) = happyReduce_155 +action_515 (201) = happyReduce_155 +action_515 (202) = happyReduce_155 +action_515 (203) = happyReduce_155 +action_515 (205) = happyReduce_155 +action_515 (206) = happyReduce_155 +action_515 (209) = happyReduce_155 +action_515 (211) = happyReduce_155 +action_515 (212) = happyReduce_155 +action_515 (214) = happyReduce_155 +action_515 (215) = happyReduce_155 +action_515 (217) = happyReduce_155 +action_515 (218) = happyReduce_155 +action_515 (219) = happyReduce_155 +action_515 (220) = happyReduce_155 +action_515 (221) = happyReduce_155 +action_515 (222) = happyReduce_155 +action_515 (223) = happyReduce_155 +action_515 (224) = happyReduce_155 +action_515 (228) = happyReduce_155 +action_515 (229) = happyReduce_155 +action_515 (230) = happyReduce_155 +action_515 (234) = happyReduce_155 +action_515 (236) = happyReduce_155 +action_515 (242) = happyReduce_155 +action_515 (245) = happyReduce_155 +action_515 (246) = happyReduce_155 +action_515 (247) = happyReduce_155 +action_515 (248) = happyReduce_155 +action_515 (249) = happyReduce_155 +action_515 (250) = happyReduce_155 +action_515 (251) = happyReduce_155 +action_515 (253) = happyShift action_618 +action_515 (255) = happyReduce_155 +action_515 (256) = happyReduce_155 +action_515 (257) = happyReduce_155 +action_515 (258) = happyReduce_155 +action_515 (259) = happyReduce_155 +action_515 (260) = happyReduce_155 +action_515 (261) = happyReduce_155 +action_515 (262) = happyReduce_155 +action_515 (263) = happyReduce_155 +action_515 (264) = happyReduce_155 +action_515 (265) = happyReduce_155 +action_515 (266) = happyReduce_155 +action_515 (267) = happyReduce_155 +action_515 (268) = happyReduce_155 +action_515 (269) = happyReduce_155 +action_515 (270) = happyReduce_155 +action_515 _ = happyReduce_155 + +action_516 _ = happyReduce_390 + +action_517 (198) = happyShift action_95 +action_517 (200) = happyShift action_96 +action_517 (202) = happyShift action_97 +action_517 (218) = happyShift action_98 +action_517 (219) = happyShift action_99 +action_517 (220) = happyShift action_100 +action_517 (222) = happyShift action_101 +action_517 (223) = happyShift action_102 +action_517 (224) = happyShift action_103 +action_517 (228) = happyShift action_104 +action_517 (230) = happyShift action_46 +action_517 (234) = happyShift action_105 +action_517 (236) = happyShift action_106 +action_517 (242) = happyShift action_107 +action_517 (245) = happyShift action_108 +action_517 (246) = happyShift action_109 +action_517 (248) = happyShift action_110 +action_517 (249) = happyShift action_111 +action_517 (251) = happyShift action_52 +action_517 (255) = happyShift action_112 +action_517 (256) = happyShift action_113 +action_517 (257) = happyShift action_114 +action_517 (258) = happyShift action_54 +action_517 (259) = happyShift action_55 +action_517 (260) = happyShift action_115 +action_517 (261) = happyShift action_116 +action_517 (264) = happyShift action_117 +action_517 (265) = happyShift action_56 +action_517 (266) = happyShift action_57 +action_517 (267) = happyShift action_58 +action_517 (268) = happyShift action_59 +action_517 (269) = happyShift action_60 +action_517 (27) = happyGoto action_74 +action_517 (29) = happyGoto action_75 +action_517 (33) = happyGoto action_76 +action_517 (36) = happyGoto action_77 +action_517 (37) = happyGoto action_78 +action_517 (38) = happyGoto action_79 +action_517 (39) = happyGoto action_80 +action_517 (41) = happyGoto action_81 +action_517 (58) = happyGoto action_617 +action_517 (59) = happyGoto action_515 +action_517 (60) = happyGoto action_122 +action_517 (61) = happyGoto action_83 +action_517 (63) = happyGoto action_84 +action_517 (64) = happyGoto action_85 +action_517 (65) = happyGoto action_86 +action_517 (66) = happyGoto action_87 +action_517 (67) = happyGoto action_88 +action_517 (68) = happyGoto action_89 +action_517 (78) = happyGoto action_90 +action_517 (79) = happyGoto action_91 +action_517 (133) = happyGoto action_93 +action_517 (135) = happyGoto action_94 +action_517 _ = happyFail (happyExpListPerState 517) + +action_518 _ = happyReduce_146 + +action_519 _ = happyReduce_145 + +action_520 _ = happyReduce_435 + +action_521 (199) = happyShift action_616 +action_521 _ = happyFail (happyExpListPerState 521) + +action_522 (198) = happyShift action_404 +action_522 (218) = happyShift action_405 +action_522 (258) = happyShift action_54 +action_522 (259) = happyShift action_55 +action_522 (264) = happyShift action_117 +action_522 (27) = happyGoto action_399 +action_522 (36) = happyGoto action_400 +action_522 (42) = happyGoto action_615 +action_522 (43) = happyGoto action_402 +action_522 (44) = happyGoto action_403 +action_522 _ = happyFail (happyExpListPerState 522) + +action_523 (212) = happyReduce_140 +action_523 _ = happyReduce_131 + +action_524 (212) = happyReduce_138 +action_524 _ = happyReduce_129 + +action_525 (212) = happyReduce_139 +action_525 _ = happyReduce_130 + +action_526 _ = happyReduce_111 + +action_527 (212) = happyShift action_614 +action_527 _ = happyFail (happyExpListPerState 527) + +action_528 (198) = happyShift action_404 +action_528 (218) = happyShift action_405 +action_528 (258) = happyShift action_54 +action_528 (259) = happyShift action_55 +action_528 (264) = happyShift action_117 +action_528 (27) = happyGoto action_399 +action_528 (36) = happyGoto action_400 +action_528 (42) = happyGoto action_613 +action_528 (43) = happyGoto action_402 +action_528 (44) = happyGoto action_403 +action_528 _ = happyFail (happyExpListPerState 528) + +action_529 (199) = happyShift action_612 +action_529 _ = happyFail (happyExpListPerState 529) + +action_530 _ = happyReduce_103 + +action_531 (198) = happyShift action_404 +action_531 (218) = happyShift action_405 +action_531 (258) = happyShift action_54 +action_531 (259) = happyShift action_55 +action_531 (264) = happyShift action_117 +action_531 (27) = happyGoto action_399 +action_531 (36) = happyGoto action_400 +action_531 (42) = happyGoto action_611 +action_531 (43) = happyGoto action_402 +action_531 (44) = happyGoto action_403 +action_531 _ = happyFail (happyExpListPerState 531) + +action_532 (198) = happyShift action_609 +action_532 (255) = happyShift action_610 +action_532 (102) = happyGoto action_608 +action_532 _ = happyReduce_266 + +action_533 _ = happyReduce_264 + +action_534 _ = happyReduce_265 + +action_535 (199) = happyReduce_418 +action_535 (217) = happyReduce_418 +action_535 _ = happyReduce_418 + +action_536 (199) = happyShift action_607 +action_536 _ = happyFail (happyExpListPerState 536) + +action_537 (217) = happyShift action_606 +action_537 _ = happyReduce_374 + +action_538 (258) = happyShift action_63 +action_538 (28) = happyGoto action_605 +action_538 _ = happyFail (happyExpListPerState 538) + +action_539 (258) = happyShift action_24 +action_539 (259) = happyShift action_132 +action_539 (26) = happyGoto action_604 +action_539 _ = happyFail (happyExpListPerState 539) + +action_540 (255) = happyShift action_480 +action_540 (260) = happyShift action_481 +action_540 (34) = happyGoto action_603 +action_540 _ = happyFail (happyExpListPerState 540) + +action_541 (204) = happyShift action_602 +action_541 _ = happyFail (happyExpListPerState 541) + +action_542 _ = happyReduce_219 + +action_543 (198) = happyShift action_40 +action_543 (200) = happyShift action_41 +action_543 (202) = happyShift action_42 +action_543 (218) = happyShift action_43 +action_543 (220) = happyShift action_44 +action_543 (223) = happyShift action_45 +action_543 (230) = happyShift action_46 +action_543 (234) = happyShift action_47 +action_543 (245) = happyShift action_48 +action_543 (246) = happyShift action_49 +action_543 (248) = happyShift action_50 +action_543 (249) = happyShift action_51 +action_543 (251) = happyShift action_52 +action_543 (256) = happyShift action_53 +action_543 (258) = happyShift action_54 +action_543 (259) = happyShift action_55 +action_543 (265) = happyShift action_56 +action_543 (266) = happyShift action_57 +action_543 (267) = happyShift action_58 +action_543 (268) = happyShift action_59 +action_543 (269) = happyShift action_60 +action_543 (27) = happyGoto action_25 +action_543 (30) = happyGoto action_389 +action_543 (37) = happyGoto action_27 +action_543 (38) = happyGoto action_28 +action_543 (39) = happyGoto action_29 +action_543 (41) = happyGoto action_30 +action_543 (72) = happyGoto action_601 +action_543 (89) = happyGoto action_391 +action_543 (90) = happyGoto action_34 +action_543 (91) = happyGoto action_35 +action_543 (132) = happyGoto action_36 +action_543 (134) = happyGoto action_37 +action_543 (136) = happyGoto action_38 +action_543 (166) = happyGoto action_39 +action_543 _ = happyFail (happyExpListPerState 543) + +action_544 (237) = happyShift action_600 +action_544 _ = happyFail (happyExpListPerState 544) + +action_545 (198) = happyShift action_95 +action_545 (200) = happyShift action_96 +action_545 (202) = happyShift action_97 +action_545 (218) = happyShift action_98 +action_545 (219) = happyShift action_99 +action_545 (220) = happyShift action_100 +action_545 (222) = happyShift action_101 +action_545 (223) = happyShift action_102 +action_545 (224) = happyShift action_103 +action_545 (228) = happyShift action_104 +action_545 (230) = happyShift action_46 +action_545 (234) = happyShift action_105 +action_545 (236) = happyShift action_106 +action_545 (242) = happyShift action_107 +action_545 (245) = happyShift action_108 +action_545 (246) = happyShift action_109 +action_545 (248) = happyShift action_110 +action_545 (249) = happyShift action_111 +action_545 (251) = happyShift action_52 +action_545 (255) = happyShift action_112 +action_545 (256) = happyShift action_113 +action_545 (257) = happyShift action_114 +action_545 (258) = happyShift action_54 +action_545 (259) = happyShift action_55 +action_545 (260) = happyShift action_115 +action_545 (261) = happyShift action_116 +action_545 (264) = happyShift action_117 +action_545 (265) = happyShift action_56 +action_545 (266) = happyShift action_57 +action_545 (267) = happyShift action_58 +action_545 (268) = happyShift action_59 +action_545 (269) = happyShift action_60 +action_545 (27) = happyGoto action_74 +action_545 (29) = happyGoto action_75 +action_545 (33) = happyGoto action_76 +action_545 (36) = happyGoto action_77 +action_545 (37) = happyGoto action_78 +action_545 (38) = happyGoto action_79 +action_545 (39) = happyGoto action_80 +action_545 (41) = happyGoto action_81 +action_545 (58) = happyGoto action_599 +action_545 (59) = happyGoto action_515 +action_545 (60) = happyGoto action_122 +action_545 (61) = happyGoto action_83 +action_545 (63) = happyGoto action_84 +action_545 (64) = happyGoto action_85 +action_545 (65) = happyGoto action_86 +action_545 (66) = happyGoto action_87 +action_545 (67) = happyGoto action_88 +action_545 (68) = happyGoto action_89 +action_545 (78) = happyGoto action_90 +action_545 (79) = happyGoto action_91 +action_545 (133) = happyGoto action_93 +action_545 (135) = happyGoto action_94 +action_545 _ = happyFail (happyExpListPerState 545) + +action_546 _ = happyReduce_206 + +action_547 (213) = happyShift action_432 +action_547 (214) = happyShift action_433 +action_547 (74) = happyGoto action_598 +action_547 (75) = happyGoto action_428 +action_547 (83) = happyGoto action_429 +action_547 (138) = happyGoto action_430 +action_547 (168) = happyGoto action_431 +action_547 _ = happyFail (happyExpListPerState 547) + +action_548 (198) = happyShift action_148 +action_548 (200) = happyShift action_149 +action_548 (202) = happyShift action_150 +action_548 (218) = happyShift action_151 +action_548 (220) = happyShift action_152 +action_548 (223) = happyShift action_45 +action_548 (231) = happyShift action_153 +action_548 (232) = happyShift action_154 +action_548 (234) = happyShift action_47 +action_548 (245) = happyShift action_48 +action_548 (246) = happyShift action_49 +action_548 (248) = happyShift action_50 +action_548 (249) = happyShift action_51 +action_548 (254) = happyShift action_155 +action_548 (255) = happyShift action_112 +action_548 (256) = happyShift action_53 +action_548 (258) = happyShift action_54 +action_548 (259) = happyShift action_55 +action_548 (260) = happyShift action_115 +action_548 (261) = happyShift action_116 +action_548 (264) = happyShift action_117 +action_548 (266) = happyShift action_57 +action_548 (267) = happyShift action_58 +action_548 (268) = happyShift action_156 +action_548 (27) = happyGoto action_133 +action_548 (30) = happyGoto action_134 +action_548 (33) = happyGoto action_135 +action_548 (36) = happyGoto action_136 +action_548 (37) = happyGoto action_137 +action_548 (40) = happyGoto action_138 +action_548 (45) = happyGoto action_597 +action_548 (46) = happyGoto action_140 +action_548 (47) = happyGoto action_141 +action_548 (48) = happyGoto action_142 +action_548 (49) = happyGoto action_143 +action_548 (50) = happyGoto action_144 +action_548 (51) = happyGoto action_145 +action_548 (57) = happyGoto action_146 +action_548 _ = happyFail (happyExpListPerState 548) + +action_549 (229) = happyShift action_596 +action_549 _ = happyFail (happyExpListPerState 549) + +action_550 (198) = happyShift action_40 +action_550 (200) = happyShift action_41 +action_550 (202) = happyShift action_42 +action_550 (218) = happyShift action_43 +action_550 (220) = happyShift action_44 +action_550 (223) = happyShift action_45 +action_550 (230) = happyShift action_46 +action_550 (234) = happyShift action_47 +action_550 (245) = happyShift action_48 +action_550 (246) = happyShift action_49 +action_550 (248) = happyShift action_50 +action_550 (249) = happyShift action_51 +action_550 (251) = happyShift action_52 +action_550 (256) = happyShift action_53 +action_550 (258) = happyShift action_54 +action_550 (259) = happyShift action_55 +action_550 (265) = happyShift action_56 +action_550 (266) = happyShift action_57 +action_550 (267) = happyShift action_58 +action_550 (268) = happyShift action_59 +action_550 (269) = happyShift action_60 +action_550 (27) = happyGoto action_25 +action_550 (30) = happyGoto action_26 +action_550 (37) = happyGoto action_27 +action_550 (38) = happyGoto action_28 +action_550 (39) = happyGoto action_29 +action_550 (41) = happyGoto action_30 +action_550 (73) = happyGoto action_590 +action_550 (89) = happyGoto action_591 +action_550 (90) = happyGoto action_34 +action_550 (91) = happyGoto action_35 +action_550 (132) = happyGoto action_36 +action_550 (134) = happyGoto action_37 +action_550 (136) = happyGoto action_38 +action_550 (146) = happyGoto action_592 +action_550 (151) = happyGoto action_593 +action_550 (166) = happyGoto action_39 +action_550 (172) = happyGoto action_594 +action_550 (180) = happyGoto action_595 +action_550 _ = happyFail (happyExpListPerState 550) + +action_551 _ = happyReduce_421 + +action_552 _ = happyReduce_174 + +action_553 _ = happyReduce_197 + +action_554 _ = happyReduce_198 + +action_555 _ = happyReduce_445 + +action_556 (222) = happyShift action_232 +action_556 (223) = happyShift action_233 +action_556 (224) = happyShift action_234 +action_556 (225) = happyShift action_235 +action_556 (226) = happyShift action_236 +action_556 (227) = happyShift action_237 +action_556 (228) = happyShift action_238 +action_556 (229) = happyShift action_239 +action_556 (230) = happyShift action_240 +action_556 (231) = happyShift action_241 +action_556 (233) = happyShift action_242 +action_556 (234) = happyShift action_243 +action_556 (235) = happyShift action_244 +action_556 (236) = happyShift action_245 +action_556 (237) = happyShift action_246 +action_556 (238) = happyShift action_247 +action_556 (239) = happyShift action_248 +action_556 (240) = happyShift action_249 +action_556 (241) = happyShift action_250 +action_556 (242) = happyShift action_251 +action_556 (243) = happyShift action_252 +action_556 (244) = happyShift action_253 +action_556 (245) = happyShift action_254 +action_556 (246) = happyShift action_255 +action_556 (247) = happyShift action_256 +action_556 (248) = happyShift action_257 +action_556 (249) = happyShift action_258 +action_556 (250) = happyShift action_259 +action_556 (251) = happyShift action_260 +action_556 (252) = happyShift action_261 +action_556 (253) = happyShift action_262 +action_556 (256) = happyShift action_263 +action_556 (266) = happyShift action_264 +action_556 (267) = happyShift action_265 +action_556 (35) = happyGoto action_589 +action_556 _ = happyFail (happyExpListPerState 556) + +action_557 (222) = happyShift action_232 +action_557 (223) = happyShift action_233 +action_557 (224) = happyShift action_234 +action_557 (225) = happyShift action_235 +action_557 (226) = happyShift action_236 +action_557 (227) = happyShift action_237 +action_557 (228) = happyShift action_238 +action_557 (229) = happyShift action_239 +action_557 (230) = happyShift action_240 +action_557 (231) = happyShift action_241 +action_557 (233) = happyShift action_242 +action_557 (234) = happyShift action_243 +action_557 (235) = happyShift action_244 +action_557 (236) = happyShift action_245 +action_557 (237) = happyShift action_246 +action_557 (238) = happyShift action_247 +action_557 (239) = happyShift action_248 +action_557 (240) = happyShift action_249 +action_557 (241) = happyShift action_250 +action_557 (242) = happyShift action_251 +action_557 (243) = happyShift action_252 +action_557 (244) = happyShift action_253 +action_557 (245) = happyShift action_254 +action_557 (246) = happyShift action_255 +action_557 (247) = happyShift action_256 +action_557 (248) = happyShift action_257 +action_557 (249) = happyShift action_258 +action_557 (250) = happyShift action_259 +action_557 (251) = happyShift action_260 +action_557 (252) = happyShift action_261 +action_557 (253) = happyShift action_262 +action_557 (256) = happyShift action_263 +action_557 (266) = happyShift action_264 +action_557 (267) = happyShift action_265 +action_557 (35) = happyGoto action_369 +action_557 (70) = happyGoto action_588 +action_557 _ = happyFail (happyExpListPerState 557) + +action_558 _ = happyReduce_181 + +action_559 (222) = happyShift action_232 +action_559 (223) = happyShift action_233 +action_559 (224) = happyShift action_234 +action_559 (225) = happyShift action_235 +action_559 (226) = happyShift action_236 +action_559 (227) = happyShift action_237 +action_559 (228) = happyShift action_238 +action_559 (229) = happyShift action_239 +action_559 (230) = happyShift action_240 +action_559 (231) = happyShift action_241 +action_559 (233) = happyShift action_242 +action_559 (234) = happyShift action_243 +action_559 (235) = happyShift action_244 +action_559 (236) = happyShift action_245 +action_559 (237) = happyShift action_246 +action_559 (238) = happyShift action_247 +action_559 (239) = happyShift action_248 +action_559 (240) = happyShift action_249 +action_559 (241) = happyShift action_250 +action_559 (242) = happyShift action_251 +action_559 (243) = happyShift action_252 +action_559 (244) = happyShift action_253 +action_559 (245) = happyShift action_254 +action_559 (246) = happyShift action_255 +action_559 (247) = happyShift action_256 +action_559 (248) = happyShift action_257 +action_559 (249) = happyShift action_258 +action_559 (250) = happyShift action_259 +action_559 (251) = happyShift action_260 +action_559 (252) = happyShift action_261 +action_559 (253) = happyShift action_262 +action_559 (256) = happyShift action_263 +action_559 (266) = happyShift action_264 +action_559 (267) = happyShift action_265 +action_559 (35) = happyGoto action_584 +action_559 (71) = happyGoto action_585 +action_559 (161) = happyGoto action_586 +action_559 (190) = happyGoto action_587 +action_559 _ = happyFail (happyExpListPerState 559) + +action_560 (198) = happyShift action_95 +action_560 (200) = happyShift action_96 +action_560 (202) = happyShift action_97 +action_560 (218) = happyShift action_98 +action_560 (219) = happyShift action_99 +action_560 (220) = happyShift action_100 +action_560 (222) = happyShift action_101 +action_560 (223) = happyShift action_102 +action_560 (224) = happyShift action_103 +action_560 (228) = happyShift action_104 +action_560 (230) = happyShift action_46 +action_560 (234) = happyShift action_105 +action_560 (236) = happyShift action_106 +action_560 (242) = happyShift action_107 +action_560 (245) = happyShift action_108 +action_560 (246) = happyShift action_109 +action_560 (248) = happyShift action_110 +action_560 (249) = happyShift action_111 +action_560 (251) = happyShift action_52 +action_560 (255) = happyShift action_112 +action_560 (256) = happyShift action_113 +action_560 (257) = happyShift action_114 +action_560 (258) = happyShift action_54 +action_560 (259) = happyShift action_55 +action_560 (260) = happyShift action_115 +action_560 (261) = happyShift action_116 +action_560 (264) = happyShift action_117 +action_560 (265) = happyShift action_56 +action_560 (266) = happyShift action_57 +action_560 (267) = happyShift action_58 +action_560 (268) = happyShift action_59 +action_560 (269) = happyShift action_60 +action_560 (27) = happyGoto action_74 +action_560 (29) = happyGoto action_75 +action_560 (33) = happyGoto action_76 +action_560 (36) = happyGoto action_77 +action_560 (37) = happyGoto action_78 +action_560 (38) = happyGoto action_79 +action_560 (39) = happyGoto action_80 +action_560 (41) = happyGoto action_81 +action_560 (59) = happyGoto action_583 +action_560 (60) = happyGoto action_122 +action_560 (61) = happyGoto action_83 +action_560 (63) = happyGoto action_84 +action_560 (64) = happyGoto action_85 +action_560 (65) = happyGoto action_86 +action_560 (66) = happyGoto action_87 +action_560 (67) = happyGoto action_88 +action_560 (68) = happyGoto action_89 +action_560 (78) = happyGoto action_90 +action_560 (79) = happyGoto action_91 +action_560 (133) = happyGoto action_93 +action_560 (135) = happyGoto action_94 +action_560 _ = happyFail (happyExpListPerState 560) + +action_561 (198) = happyShift action_95 +action_561 (200) = happyShift action_96 +action_561 (202) = happyShift action_97 +action_561 (218) = happyShift action_98 +action_561 (219) = happyShift action_99 +action_561 (220) = happyShift action_100 +action_561 (222) = happyShift action_101 +action_561 (223) = happyShift action_102 +action_561 (224) = happyShift action_103 +action_561 (228) = happyShift action_104 +action_561 (230) = happyShift action_46 +action_561 (234) = happyShift action_105 +action_561 (236) = happyShift action_106 +action_561 (242) = happyShift action_107 +action_561 (245) = happyShift action_108 +action_561 (246) = happyShift action_109 +action_561 (248) = happyShift action_110 +action_561 (249) = happyShift action_111 +action_561 (251) = happyShift action_52 +action_561 (255) = happyShift action_112 +action_561 (256) = happyShift action_113 +action_561 (257) = happyShift action_114 +action_561 (258) = happyShift action_54 +action_561 (259) = happyShift action_55 +action_561 (260) = happyShift action_115 +action_561 (261) = happyShift action_116 +action_561 (264) = happyShift action_117 +action_561 (265) = happyShift action_56 +action_561 (266) = happyShift action_57 +action_561 (267) = happyShift action_58 +action_561 (268) = happyShift action_59 +action_561 (269) = happyShift action_60 +action_561 (27) = happyGoto action_74 +action_561 (29) = happyGoto action_75 +action_561 (33) = happyGoto action_76 +action_561 (36) = happyGoto action_77 +action_561 (37) = happyGoto action_78 +action_561 (38) = happyGoto action_79 +action_561 (39) = happyGoto action_80 +action_561 (41) = happyGoto action_81 +action_561 (59) = happyGoto action_582 +action_561 (60) = happyGoto action_122 +action_561 (61) = happyGoto action_83 +action_561 (63) = happyGoto action_84 +action_561 (64) = happyGoto action_85 +action_561 (65) = happyGoto action_86 +action_561 (66) = happyGoto action_87 +action_561 (67) = happyGoto action_88 +action_561 (68) = happyGoto action_89 +action_561 (78) = happyGoto action_90 +action_561 (79) = happyGoto action_91 +action_561 (133) = happyGoto action_93 +action_561 (135) = happyGoto action_94 +action_561 _ = happyFail (happyExpListPerState 561) + +action_562 (198) = happyShift action_95 +action_562 (200) = happyShift action_96 +action_562 (202) = happyShift action_97 +action_562 (218) = happyShift action_98 +action_562 (219) = happyShift action_99 +action_562 (220) = happyShift action_100 +action_562 (222) = happyShift action_101 +action_562 (223) = happyShift action_102 +action_562 (224) = happyShift action_103 +action_562 (228) = happyShift action_104 +action_562 (230) = happyShift action_46 +action_562 (234) = happyShift action_105 +action_562 (236) = happyShift action_106 +action_562 (242) = happyShift action_107 +action_562 (245) = happyShift action_108 +action_562 (246) = happyShift action_109 +action_562 (248) = happyShift action_110 +action_562 (249) = happyShift action_111 +action_562 (251) = happyShift action_52 +action_562 (255) = happyShift action_112 +action_562 (256) = happyShift action_113 +action_562 (257) = happyShift action_114 +action_562 (258) = happyShift action_54 +action_562 (259) = happyShift action_55 +action_562 (260) = happyShift action_115 +action_562 (261) = happyShift action_116 +action_562 (264) = happyShift action_117 +action_562 (265) = happyShift action_56 +action_562 (266) = happyShift action_57 +action_562 (267) = happyShift action_58 +action_562 (268) = happyShift action_59 +action_562 (269) = happyShift action_60 +action_562 (27) = happyGoto action_74 +action_562 (29) = happyGoto action_75 +action_562 (33) = happyGoto action_76 +action_562 (36) = happyGoto action_77 +action_562 (37) = happyGoto action_78 +action_562 (38) = happyGoto action_79 +action_562 (39) = happyGoto action_80 +action_562 (41) = happyGoto action_81 +action_562 (63) = happyGoto action_581 +action_562 (64) = happyGoto action_85 +action_562 (65) = happyGoto action_86 +action_562 (66) = happyGoto action_87 +action_562 (67) = happyGoto action_88 +action_562 (68) = happyGoto action_89 +action_562 (78) = happyGoto action_90 +action_562 (79) = happyGoto action_91 +action_562 (133) = happyGoto action_93 +action_562 (135) = happyGoto action_94 +action_562 _ = happyFail (happyExpListPerState 562) + +action_563 (198) = happyShift action_95 +action_563 (200) = happyShift action_96 +action_563 (202) = happyShift action_97 +action_563 (218) = happyShift action_98 +action_563 (219) = happyShift action_99 +action_563 (220) = happyShift action_100 +action_563 (222) = happyShift action_101 +action_563 (223) = happyShift action_102 +action_563 (224) = happyShift action_103 +action_563 (228) = happyShift action_104 +action_563 (230) = happyShift action_46 +action_563 (234) = happyShift action_105 +action_563 (236) = happyShift action_106 +action_563 (242) = happyShift action_107 +action_563 (245) = happyShift action_108 +action_563 (246) = happyShift action_109 +action_563 (248) = happyShift action_110 +action_563 (249) = happyShift action_111 +action_563 (251) = happyShift action_52 +action_563 (255) = happyShift action_112 +action_563 (256) = happyShift action_113 +action_563 (257) = happyShift action_114 +action_563 (258) = happyShift action_54 +action_563 (259) = happyShift action_55 +action_563 (260) = happyShift action_115 +action_563 (261) = happyShift action_116 +action_563 (264) = happyShift action_117 +action_563 (265) = happyShift action_56 +action_563 (266) = happyShift action_57 +action_563 (267) = happyShift action_58 +action_563 (268) = happyShift action_59 +action_563 (269) = happyShift action_60 +action_563 (27) = happyGoto action_74 +action_563 (29) = happyGoto action_75 +action_563 (33) = happyGoto action_76 +action_563 (36) = happyGoto action_77 +action_563 (37) = happyGoto action_78 +action_563 (38) = happyGoto action_79 +action_563 (39) = happyGoto action_80 +action_563 (41) = happyGoto action_81 +action_563 (63) = happyGoto action_580 +action_563 (64) = happyGoto action_85 +action_563 (65) = happyGoto action_86 +action_563 (66) = happyGoto action_87 +action_563 (67) = happyGoto action_88 +action_563 (68) = happyGoto action_89 +action_563 (78) = happyGoto action_90 +action_563 (79) = happyGoto action_91 +action_563 (133) = happyGoto action_93 +action_563 (135) = happyGoto action_94 +action_563 _ = happyFail (happyExpListPerState 563) + +action_564 _ = happyReduce_413 + +action_565 _ = happyReduce_391 + +action_566 (1) = happyReduce_422 +action_566 (217) = happyReduce_422 +action_566 _ = happyReduce_422 + +action_567 (208) = happyShift action_579 +action_567 _ = happyFail (happyExpListPerState 567) + +action_568 _ = happyReduce_313 + +action_569 (1) = happyReduce_354 +action_569 (208) = happyReduce_354 +action_569 (217) = happyReduce_354 +action_569 (223) = happyShift action_45 +action_569 (234) = happyShift action_47 +action_569 (245) = happyShift action_48 +action_569 (246) = happyShift action_49 +action_569 (248) = happyShift action_50 +action_569 (249) = happyShift action_51 +action_569 (256) = happyShift action_53 +action_569 (30) = happyGoto action_578 +action_569 _ = happyReduce_354 + +action_570 (217) = happyShift action_577 +action_570 _ = happyReduce_376 + +action_571 (223) = happyShift action_45 +action_571 (234) = happyShift action_47 +action_571 (245) = happyShift action_48 +action_571 (246) = happyShift action_49 +action_571 (248) = happyShift action_50 +action_571 (249) = happyShift action_51 +action_571 (256) = happyShift action_53 +action_571 (30) = happyGoto action_565 +action_571 (139) = happyGoto action_576 +action_571 (169) = happyGoto action_569 +action_571 _ = happyFail (happyExpListPerState 571) + +action_572 _ = happyReduce_441 + +action_573 _ = happyReduce_248 + +action_574 _ = happyReduce_249 + +action_575 _ = happyReduce_443 + +action_576 _ = happyReduce_314 + +action_577 (208) = happyShift action_571 +action_577 (223) = happyShift action_45 +action_577 (234) = happyShift action_47 +action_577 (245) = happyShift action_48 +action_577 (246) = happyShift action_49 +action_577 (248) = happyShift action_50 +action_577 (249) = happyShift action_51 +action_577 (256) = happyShift action_53 +action_577 (30) = happyGoto action_565 +action_577 (116) = happyGoto action_682 +action_577 (139) = happyGoto action_567 +action_577 (169) = happyGoto action_569 +action_577 _ = happyFail (happyExpListPerState 577) + +action_578 _ = happyReduce_392 + +action_579 (223) = happyShift action_45 +action_579 (234) = happyShift action_47 +action_579 (245) = happyShift action_48 +action_579 (246) = happyShift action_49 +action_579 (248) = happyShift action_50 +action_579 (249) = happyShift action_51 +action_579 (256) = happyShift action_53 +action_579 (30) = happyGoto action_565 +action_579 (139) = happyGoto action_681 +action_579 (169) = happyGoto action_569 +action_579 _ = happyFail (happyExpListPerState 579) + +action_580 _ = happyReduce_162 + +action_581 _ = happyReduce_164 + +action_582 _ = happyReduce_201 + +action_583 _ = happyReduce_199 + +action_584 (200) = happyShift action_679 +action_584 (213) = happyShift action_680 +action_584 _ = happyFail (happyExpListPerState 584) + +action_585 (201) = happyReduce_430 +action_585 (217) = happyReduce_430 +action_585 _ = happyReduce_430 + +action_586 (201) = happyShift action_678 +action_586 _ = happyFail (happyExpListPerState 586) + +action_587 (217) = happyShift action_677 +action_587 _ = happyReduce_380 + +action_588 _ = happyReduce_433 + +action_589 _ = happyReduce_427 + +action_590 _ = happyReduce_397 + +action_591 (205) = happyReduce_410 +action_591 (208) = happyReduce_410 +action_591 (209) = happyShift action_286 +action_591 (211) = happyShift action_288 +action_591 (214) = happyReduce_410 +action_591 (217) = happyReduce_410 +action_591 (220) = happyShift action_289 +action_591 (262) = happyShift action_290 +action_591 (263) = happyShift action_291 +action_591 (31) = happyGoto action_344 +action_591 _ = happyReduce_410 + +action_592 (205) = happyShift action_676 +action_592 _ = happyFail (happyExpListPerState 592) + +action_593 (205) = happyShift action_674 +action_593 (208) = happyShift action_675 +action_593 (214) = happyShift action_433 +action_593 (76) = happyGoto action_669 +action_593 (77) = happyGoto action_670 +action_593 (83) = happyGoto action_671 +action_593 (137) = happyGoto action_672 +action_593 (167) = happyGoto action_673 +action_593 _ = happyFail (happyExpListPerState 593) + +action_594 (206) = happyShift action_668 +action_594 _ = happyReduce_365 + +action_595 (217) = happyShift action_667 +action_595 _ = happyReduce_370 + +action_596 (198) = happyShift action_95 +action_596 (200) = happyShift action_96 +action_596 (202) = happyShift action_97 +action_596 (218) = happyShift action_98 +action_596 (219) = happyShift action_99 +action_596 (220) = happyShift action_100 +action_596 (222) = happyShift action_101 +action_596 (223) = happyShift action_102 +action_596 (224) = happyShift action_103 +action_596 (228) = happyShift action_104 +action_596 (230) = happyShift action_46 +action_596 (234) = happyShift action_105 +action_596 (236) = happyShift action_106 +action_596 (242) = happyShift action_107 +action_596 (245) = happyShift action_108 +action_596 (246) = happyShift action_109 +action_596 (248) = happyShift action_110 +action_596 (249) = happyShift action_111 +action_596 (251) = happyShift action_52 +action_596 (255) = happyShift action_112 +action_596 (256) = happyShift action_113 +action_596 (257) = happyShift action_114 +action_596 (258) = happyShift action_54 +action_596 (259) = happyShift action_55 +action_596 (260) = happyShift action_115 +action_596 (261) = happyShift action_116 +action_596 (264) = happyShift action_117 +action_596 (265) = happyShift action_56 +action_596 (266) = happyShift action_57 +action_596 (267) = happyShift action_58 +action_596 (268) = happyShift action_59 +action_596 (269) = happyShift action_60 +action_596 (27) = happyGoto action_74 +action_596 (29) = happyGoto action_75 +action_596 (33) = happyGoto action_76 +action_596 (36) = happyGoto action_77 +action_596 (37) = happyGoto action_78 +action_596 (38) = happyGoto action_79 +action_596 (39) = happyGoto action_80 +action_596 (41) = happyGoto action_81 +action_596 (59) = happyGoto action_666 +action_596 (60) = happyGoto action_122 +action_596 (61) = happyGoto action_83 +action_596 (63) = happyGoto action_84 +action_596 (64) = happyGoto action_85 +action_596 (65) = happyGoto action_86 +action_596 (66) = happyGoto action_87 +action_596 (67) = happyGoto action_88 +action_596 (68) = happyGoto action_89 +action_596 (78) = happyGoto action_90 +action_596 (79) = happyGoto action_91 +action_596 (133) = happyGoto action_93 +action_596 (135) = happyGoto action_94 +action_596 _ = happyFail (happyExpListPerState 596) + +action_597 _ = happyReduce_205 + +action_598 _ = happyReduce_207 + +action_599 _ = happyReduce_208 + +action_600 (198) = happyShift action_95 +action_600 (200) = happyShift action_96 +action_600 (202) = happyShift action_97 +action_600 (218) = happyShift action_98 +action_600 (219) = happyShift action_99 +action_600 (220) = happyShift action_100 +action_600 (222) = happyShift action_101 +action_600 (223) = happyShift action_102 +action_600 (224) = happyShift action_103 +action_600 (228) = happyShift action_104 +action_600 (230) = happyShift action_46 +action_600 (234) = happyShift action_105 +action_600 (236) = happyShift action_106 +action_600 (242) = happyShift action_107 +action_600 (245) = happyShift action_108 +action_600 (246) = happyShift action_109 +action_600 (248) = happyShift action_110 +action_600 (249) = happyShift action_111 +action_600 (251) = happyShift action_52 +action_600 (255) = happyShift action_112 +action_600 (256) = happyShift action_113 +action_600 (257) = happyShift action_114 +action_600 (258) = happyShift action_54 +action_600 (259) = happyShift action_55 +action_600 (260) = happyShift action_115 +action_600 (261) = happyShift action_116 +action_600 (264) = happyShift action_117 +action_600 (265) = happyShift action_56 +action_600 (266) = happyShift action_57 +action_600 (267) = happyShift action_58 +action_600 (268) = happyShift action_59 +action_600 (269) = happyShift action_60 +action_600 (27) = happyGoto action_74 +action_600 (29) = happyGoto action_75 +action_600 (33) = happyGoto action_76 +action_600 (36) = happyGoto action_77 +action_600 (37) = happyGoto action_78 +action_600 (38) = happyGoto action_79 +action_600 (39) = happyGoto action_80 +action_600 (41) = happyGoto action_81 +action_600 (59) = happyGoto action_665 +action_600 (60) = happyGoto action_122 +action_600 (61) = happyGoto action_83 +action_600 (63) = happyGoto action_84 +action_600 (64) = happyGoto action_85 +action_600 (65) = happyGoto action_86 +action_600 (66) = happyGoto action_87 +action_600 (67) = happyGoto action_88 +action_600 (68) = happyGoto action_89 +action_600 (78) = happyGoto action_90 +action_600 (79) = happyGoto action_91 +action_600 (133) = happyGoto action_93 +action_600 (135) = happyGoto action_94 +action_600 _ = happyFail (happyExpListPerState 600) + +action_601 _ = happyReduce_404 + +action_602 (95) = happyGoto action_663 +action_602 (96) = happyGoto action_664 +action_602 _ = happyReduce_255 + +action_603 _ = happyReduce_268 + +action_604 _ = happyReduce_270 + +action_605 _ = happyReduce_269 + +action_606 (223) = happyShift action_45 +action_606 (225) = happyShift action_538 +action_606 (234) = happyShift action_47 +action_606 (243) = happyShift action_539 +action_606 (245) = happyShift action_48 +action_606 (246) = happyShift action_49 +action_606 (248) = happyShift action_50 +action_606 (249) = happyShift action_51 +action_606 (252) = happyShift action_540 +action_606 (255) = happyShift action_480 +action_606 (256) = happyShift action_53 +action_606 (258) = happyShift action_63 +action_606 (260) = happyShift action_481 +action_606 (28) = happyGoto action_532 +action_606 (30) = happyGoto action_533 +action_606 (34) = happyGoto action_534 +action_606 (101) = happyGoto action_662 +action_606 _ = happyFail (happyExpListPerState 606) + +action_607 _ = happyReduce_263 + +action_608 _ = happyReduce_267 + +action_609 (199) = happyShift action_661 +action_609 (258) = happyShift action_63 +action_609 (28) = happyGoto action_658 +action_609 (160) = happyGoto action_659 +action_609 (189) = happyGoto action_660 +action_609 _ = happyFail (happyExpListPerState 609) + +action_610 _ = happyReduce_271 + +action_611 _ = happyReduce_101 + +action_612 _ = happyReduce_107 + +action_613 (199) = happyShift action_657 +action_613 _ = happyFail (happyExpListPerState 613) + +action_614 (198) = happyShift action_404 +action_614 (218) = happyShift action_405 +action_614 (258) = happyShift action_54 +action_614 (259) = happyShift action_55 +action_614 (264) = happyShift action_117 +action_614 (27) = happyGoto action_399 +action_614 (36) = happyGoto action_400 +action_614 (42) = happyGoto action_656 +action_614 (43) = happyGoto action_402 +action_614 (44) = happyGoto action_403 +action_614 _ = happyFail (happyExpListPerState 614) + +action_615 (199) = happyShift action_655 +action_615 _ = happyFail (happyExpListPerState 615) + +action_616 (1) = happyReduce_132 +action_616 (198) = happyReduce_132 +action_616 (199) = happyReduce_132 +action_616 (200) = happyReduce_132 +action_616 (201) = happyReduce_132 +action_616 (202) = happyReduce_132 +action_616 (203) = happyReduce_132 +action_616 (205) = happyReduce_132 +action_616 (206) = happyReduce_132 +action_616 (207) = happyReduce_132 +action_616 (208) = happyReduce_132 +action_616 (209) = happyReduce_132 +action_616 (210) = happyReduce_132 +action_616 (211) = happyReduce_132 +action_616 (212) = happyReduce_132 +action_616 (214) = happyReduce_132 +action_616 (215) = happyReduce_132 +action_616 (217) = happyReduce_132 +action_616 (218) = happyReduce_132 +action_616 (219) = happyReduce_132 +action_616 (220) = happyReduce_132 +action_616 (221) = happyReduce_132 +action_616 (222) = happyReduce_132 +action_616 (223) = happyReduce_132 +action_616 (224) = happyReduce_132 +action_616 (228) = happyReduce_132 +action_616 (229) = happyReduce_132 +action_616 (230) = happyReduce_132 +action_616 (234) = happyReduce_132 +action_616 (236) = happyReduce_132 +action_616 (242) = happyReduce_132 +action_616 (245) = happyReduce_132 +action_616 (246) = happyReduce_132 +action_616 (247) = happyReduce_132 +action_616 (248) = happyReduce_132 +action_616 (249) = happyReduce_132 +action_616 (250) = happyReduce_132 +action_616 (251) = happyReduce_132 +action_616 (253) = happyReduce_132 +action_616 (254) = happyReduce_132 +action_616 (255) = happyReduce_132 +action_616 (256) = happyReduce_132 +action_616 (257) = happyReduce_132 +action_616 (258) = happyReduce_132 +action_616 (259) = happyReduce_132 +action_616 (260) = happyReduce_132 +action_616 (261) = happyReduce_132 +action_616 (262) = happyReduce_132 +action_616 (263) = happyReduce_132 +action_616 (264) = happyReduce_132 +action_616 (265) = happyReduce_132 +action_616 (266) = happyReduce_132 +action_616 (267) = happyReduce_132 +action_616 (268) = happyReduce_132 +action_616 (269) = happyReduce_132 +action_616 (270) = happyReduce_132 +action_616 _ = happyReduce_132 + +action_617 _ = happyReduce_212 + +action_618 (204) = happyShift action_654 +action_618 _ = happyFail (happyExpListPerState 618) + +action_619 _ = happyReduce_415 + +action_620 (223) = happyShift action_45 +action_620 (234) = happyShift action_47 +action_620 (245) = happyShift action_48 +action_620 (246) = happyShift action_49 +action_620 (248) = happyShift action_50 +action_620 (249) = happyShift action_51 +action_620 (256) = happyShift action_53 +action_620 (30) = happyGoto action_507 +action_620 (117) = happyGoto action_653 +action_620 _ = happyFail (happyExpListPerState 620) + +action_621 _ = happyReduce_290 + +action_622 (198) = happyShift action_148 +action_622 (200) = happyShift action_149 +action_622 (202) = happyShift action_150 +action_622 (218) = happyShift action_151 +action_622 (220) = happyShift action_152 +action_622 (223) = happyShift action_45 +action_622 (231) = happyShift action_153 +action_622 (232) = happyShift action_154 +action_622 (234) = happyShift action_47 +action_622 (245) = happyShift action_48 +action_622 (246) = happyShift action_49 +action_622 (248) = happyShift action_50 +action_622 (249) = happyShift action_51 +action_622 (254) = happyShift action_155 +action_622 (255) = happyShift action_112 +action_622 (256) = happyShift action_53 +action_622 (258) = happyShift action_54 +action_622 (259) = happyShift action_55 +action_622 (260) = happyShift action_115 +action_622 (261) = happyShift action_116 +action_622 (264) = happyShift action_117 +action_622 (266) = happyShift action_57 +action_622 (267) = happyShift action_58 +action_622 (268) = happyShift action_156 +action_622 (27) = happyGoto action_133 +action_622 (30) = happyGoto action_134 +action_622 (33) = happyGoto action_135 +action_622 (36) = happyGoto action_136 +action_622 (37) = happyGoto action_137 +action_622 (40) = happyGoto action_138 +action_622 (45) = happyGoto action_652 +action_622 (46) = happyGoto action_140 +action_622 (47) = happyGoto action_141 +action_622 (48) = happyGoto action_142 +action_622 (49) = happyGoto action_143 +action_622 (50) = happyGoto action_144 +action_622 (51) = happyGoto action_145 +action_622 (57) = happyGoto action_146 +action_622 _ = happyFail (happyExpListPerState 622) + +action_623 (223) = happyShift action_45 +action_623 (234) = happyShift action_47 +action_623 (245) = happyShift action_48 +action_623 (246) = happyShift action_49 +action_623 (248) = happyShift action_50 +action_623 (249) = happyShift action_51 +action_623 (256) = happyShift action_53 +action_623 (30) = happyGoto action_503 +action_623 (122) = happyGoto action_651 +action_623 _ = happyFail (happyExpListPerState 623) + +action_624 _ = happyReduce_292 + +action_625 (213) = happyShift action_432 +action_625 (214) = happyShift action_433 +action_625 (74) = happyGoto action_650 +action_625 (75) = happyGoto action_428 +action_625 (83) = happyGoto action_429 +action_625 (138) = happyGoto action_430 +action_625 (168) = happyGoto action_431 +action_625 _ = happyFail (happyExpListPerState 625) + +action_626 (198) = happyShift action_148 +action_626 (200) = happyShift action_149 +action_626 (202) = happyShift action_150 +action_626 (218) = happyShift action_151 +action_626 (220) = happyShift action_152 +action_626 (223) = happyShift action_45 +action_626 (231) = happyShift action_153 +action_626 (232) = happyShift action_154 +action_626 (234) = happyShift action_47 +action_626 (245) = happyShift action_48 +action_626 (246) = happyShift action_49 +action_626 (248) = happyShift action_50 +action_626 (249) = happyShift action_51 +action_626 (254) = happyShift action_155 +action_626 (255) = happyShift action_112 +action_626 (256) = happyShift action_53 +action_626 (258) = happyShift action_54 +action_626 (259) = happyShift action_55 +action_626 (260) = happyShift action_115 +action_626 (261) = happyShift action_116 +action_626 (264) = happyShift action_117 +action_626 (266) = happyShift action_57 +action_626 (267) = happyShift action_58 +action_626 (268) = happyShift action_156 +action_626 (27) = happyGoto action_133 +action_626 (30) = happyGoto action_134 +action_626 (33) = happyGoto action_135 +action_626 (36) = happyGoto action_136 +action_626 (37) = happyGoto action_137 +action_626 (40) = happyGoto action_138 +action_626 (45) = happyGoto action_649 +action_626 (46) = happyGoto action_140 +action_626 (47) = happyGoto action_141 +action_626 (48) = happyGoto action_142 +action_626 (49) = happyGoto action_143 +action_626 (50) = happyGoto action_144 +action_626 (51) = happyGoto action_145 +action_626 (57) = happyGoto action_146 +action_626 _ = happyFail (happyExpListPerState 626) + +action_627 _ = happyReduce_329 + +action_628 _ = happyReduce_328 + +action_629 (209) = happyShift action_193 +action_629 (211) = happyShift action_194 +action_629 (220) = happyShift action_195 +action_629 (262) = happyShift action_196 +action_629 (32) = happyGoto action_648 +action_629 _ = happyFail (happyExpListPerState 629) + +action_630 (198) = happyShift action_404 +action_630 (218) = happyShift action_405 +action_630 (258) = happyShift action_54 +action_630 (259) = happyShift action_55 +action_630 (264) = happyShift action_117 +action_630 (27) = happyGoto action_399 +action_630 (36) = happyGoto action_400 +action_630 (42) = happyGoto action_647 +action_630 (43) = happyGoto action_402 +action_630 (44) = happyGoto action_403 +action_630 _ = happyFail (happyExpListPerState 630) + +action_631 _ = happyReduce_301 + +action_632 (198) = happyShift action_148 +action_632 (200) = happyShift action_149 +action_632 (202) = happyShift action_150 +action_632 (218) = happyShift action_151 +action_632 (220) = happyShift action_152 +action_632 (223) = happyShift action_45 +action_632 (231) = happyShift action_153 +action_632 (232) = happyShift action_154 +action_632 (234) = happyShift action_47 +action_632 (245) = happyShift action_48 +action_632 (246) = happyShift action_49 +action_632 (248) = happyShift action_50 +action_632 (249) = happyShift action_51 +action_632 (254) = happyShift action_155 +action_632 (255) = happyShift action_112 +action_632 (256) = happyShift action_53 +action_632 (258) = happyShift action_54 +action_632 (259) = happyShift action_55 +action_632 (260) = happyShift action_115 +action_632 (261) = happyShift action_116 +action_632 (264) = happyShift action_117 +action_632 (266) = happyShift action_57 +action_632 (267) = happyShift action_58 +action_632 (268) = happyShift action_156 +action_632 (27) = happyGoto action_133 +action_632 (30) = happyGoto action_134 +action_632 (33) = happyGoto action_135 +action_632 (36) = happyGoto action_136 +action_632 (37) = happyGoto action_137 +action_632 (40) = happyGoto action_138 +action_632 (45) = happyGoto action_646 +action_632 (46) = happyGoto action_140 +action_632 (47) = happyGoto action_141 +action_632 (48) = happyGoto action_142 +action_632 (49) = happyGoto action_143 +action_632 (50) = happyGoto action_144 +action_632 (51) = happyGoto action_145 +action_632 (57) = happyGoto action_146 +action_632 _ = happyFail (happyExpListPerState 632) + +action_633 _ = happyReduce_319 + +action_634 (198) = happyShift action_148 +action_634 (200) = happyShift action_149 +action_634 (202) = happyShift action_150 +action_634 (218) = happyShift action_151 +action_634 (223) = happyShift action_45 +action_634 (234) = happyShift action_47 +action_634 (245) = happyShift action_48 +action_634 (246) = happyShift action_49 +action_634 (248) = happyShift action_50 +action_634 (249) = happyShift action_51 +action_634 (254) = happyShift action_155 +action_634 (255) = happyShift action_112 +action_634 (256) = happyShift action_53 +action_634 (258) = happyShift action_54 +action_634 (259) = happyShift action_55 +action_634 (260) = happyShift action_115 +action_634 (261) = happyShift action_116 +action_634 (264) = happyShift action_117 +action_634 (266) = happyShift action_57 +action_634 (267) = happyShift action_58 +action_634 (268) = happyShift action_156 +action_634 (27) = happyGoto action_133 +action_634 (30) = happyGoto action_134 +action_634 (33) = happyGoto action_135 +action_634 (36) = happyGoto action_136 +action_634 (37) = happyGoto action_137 +action_634 (40) = happyGoto action_138 +action_634 (51) = happyGoto action_326 +action_634 (143) = happyGoto action_645 +action_634 (164) = happyGoto action_328 +action_634 (193) = happyGoto action_329 +action_634 _ = happyReduce_359 + +action_635 _ = happyReduce_394 + +action_636 _ = happyReduce_275 + +action_637 _ = happyReduce_283 + +action_638 _ = happyReduce_284 + +action_639 (223) = happyShift action_45 +action_639 (225) = happyShift action_478 +action_639 (234) = happyShift action_47 +action_639 (245) = happyShift action_48 +action_639 (246) = happyShift action_49 +action_639 (248) = happyShift action_50 +action_639 (249) = happyShift action_51 +action_639 (252) = happyShift action_479 +action_639 (255) = happyShift action_480 +action_639 (256) = happyShift action_53 +action_639 (258) = happyShift action_63 +action_639 (260) = happyShift action_481 +action_639 (28) = happyGoto action_472 +action_639 (30) = happyGoto action_473 +action_639 (34) = happyGoto action_474 +action_639 (105) = happyGoto action_644 +action_639 _ = happyFail (happyExpListPerState 639) + +action_640 _ = happyReduce_277 + +action_641 _ = happyReduce_282 + +action_642 (199) = happyShift action_643 +action_642 _ = happyFail (happyExpListPerState 642) + +action_643 _ = happyReduce_278 + +action_644 _ = happyReduce_425 + +action_645 _ = happyReduce_317 + +action_646 _ = happyReduce_302 + +action_647 (199) = happyShift action_700 +action_647 _ = happyFail (happyExpListPerState 647) + +action_648 _ = happyReduce_330 + +action_649 _ = happyReduce_326 + +action_650 _ = happyReduce_327 + +action_651 _ = happyReduce_402 + +action_652 _ = happyReduce_316 + +action_653 _ = happyReduce_400 + +action_654 (198) = happyShift action_40 +action_654 (200) = happyShift action_41 +action_654 (202) = happyShift action_42 +action_654 (218) = happyShift action_43 +action_654 (220) = happyShift action_44 +action_654 (223) = happyShift action_45 +action_654 (230) = happyShift action_46 +action_654 (234) = happyShift action_47 +action_654 (245) = happyShift action_48 +action_654 (246) = happyShift action_49 +action_654 (248) = happyShift action_50 +action_654 (249) = happyShift action_51 +action_654 (251) = happyShift action_52 +action_654 (256) = happyShift action_53 +action_654 (258) = happyShift action_54 +action_654 (259) = happyShift action_55 +action_654 (265) = happyShift action_56 +action_654 (266) = happyShift action_57 +action_654 (267) = happyShift action_58 +action_654 (268) = happyShift action_59 +action_654 (269) = happyShift action_60 +action_654 (27) = happyGoto action_25 +action_654 (30) = happyGoto action_389 +action_654 (37) = happyGoto action_27 +action_654 (38) = happyGoto action_28 +action_654 (39) = happyGoto action_29 +action_654 (41) = happyGoto action_30 +action_654 (72) = happyGoto action_390 +action_654 (89) = happyGoto action_391 +action_654 (90) = happyGoto action_34 +action_654 (91) = happyGoto action_35 +action_654 (132) = happyGoto action_36 +action_654 (134) = happyGoto action_37 +action_654 (136) = happyGoto action_38 +action_654 (149) = happyGoto action_699 +action_654 (166) = happyGoto action_39 +action_654 (175) = happyGoto action_393 +action_654 _ = happyFail (happyExpListPerState 654) + +action_655 (198) = happyReduce_132 +action_655 (199) = happyReduce_132 +action_655 (200) = happyReduce_132 +action_655 (202) = happyReduce_132 +action_655 (208) = happyReduce_132 +action_655 (209) = happyReduce_132 +action_655 (210) = happyReduce_132 +action_655 (211) = happyReduce_132 +action_655 (212) = happyReduce_141 +action_655 (218) = happyReduce_132 +action_655 (220) = happyReduce_132 +action_655 (223) = happyReduce_132 +action_655 (234) = happyReduce_132 +action_655 (245) = happyReduce_132 +action_655 (246) = happyReduce_132 +action_655 (248) = happyReduce_132 +action_655 (249) = happyReduce_132 +action_655 (254) = happyReduce_132 +action_655 (255) = happyReduce_132 +action_655 (256) = happyReduce_132 +action_655 (258) = happyReduce_132 +action_655 (259) = happyReduce_132 +action_655 (260) = happyReduce_132 +action_655 (261) = happyReduce_132 +action_655 (262) = happyReduce_132 +action_655 (263) = happyReduce_132 +action_655 (264) = happyReduce_132 +action_655 (266) = happyReduce_132 +action_655 (267) = happyReduce_132 +action_655 (268) = happyReduce_132 +action_655 _ = happyReduce_132 + +action_656 (199) = happyShift action_698 +action_656 _ = happyFail (happyExpListPerState 656) + +action_657 _ = happyReduce_149 + +action_658 (199) = happyReduce_428 +action_658 (217) = happyReduce_428 +action_658 _ = happyReduce_428 + +action_659 (199) = happyShift action_697 +action_659 _ = happyFail (happyExpListPerState 659) + +action_660 (217) = happyShift action_696 +action_660 _ = happyReduce_379 + +action_661 _ = happyReduce_272 + +action_662 _ = happyReduce_419 + +action_663 _ = happyReduce_250 + +action_664 (235) = happyShift action_181 +action_664 (103) = happyGoto action_695 +action_664 _ = happyReduce_253 + +action_665 _ = happyReduce_175 + +action_666 _ = happyReduce_171 + +action_667 (198) = happyShift action_40 +action_667 (200) = happyShift action_41 +action_667 (202) = happyShift action_42 +action_667 (218) = happyShift action_43 +action_667 (220) = happyShift action_44 +action_667 (223) = happyShift action_45 +action_667 (230) = happyShift action_46 +action_667 (234) = happyShift action_47 +action_667 (245) = happyShift action_48 +action_667 (246) = happyShift action_49 +action_667 (248) = happyShift action_50 +action_667 (249) = happyShift action_51 +action_667 (251) = happyShift action_52 +action_667 (256) = happyShift action_53 +action_667 (258) = happyShift action_54 +action_667 (259) = happyShift action_55 +action_667 (265) = happyShift action_56 +action_667 (266) = happyShift action_57 +action_667 (267) = happyShift action_58 +action_667 (268) = happyShift action_59 +action_667 (269) = happyShift action_60 +action_667 (27) = happyGoto action_25 +action_667 (30) = happyGoto action_26 +action_667 (37) = happyGoto action_27 +action_667 (38) = happyGoto action_28 +action_667 (39) = happyGoto action_29 +action_667 (41) = happyGoto action_30 +action_667 (89) = happyGoto action_694 +action_667 (90) = happyGoto action_34 +action_667 (91) = happyGoto action_35 +action_667 (132) = happyGoto action_36 +action_667 (134) = happyGoto action_37 +action_667 (136) = happyGoto action_38 +action_667 (166) = happyGoto action_39 +action_667 _ = happyFail (happyExpListPerState 667) + +action_668 (198) = happyShift action_40 +action_668 (200) = happyShift action_41 +action_668 (202) = happyShift action_42 +action_668 (218) = happyShift action_43 +action_668 (220) = happyShift action_44 +action_668 (223) = happyShift action_45 +action_668 (230) = happyShift action_46 +action_668 (234) = happyShift action_47 +action_668 (245) = happyShift action_48 +action_668 (246) = happyShift action_49 +action_668 (248) = happyShift action_50 +action_668 (249) = happyShift action_51 +action_668 (251) = happyShift action_52 +action_668 (256) = happyShift action_53 +action_668 (258) = happyShift action_54 +action_668 (259) = happyShift action_55 +action_668 (265) = happyShift action_56 +action_668 (266) = happyShift action_57 +action_668 (267) = happyShift action_58 +action_668 (268) = happyShift action_59 +action_668 (269) = happyShift action_60 +action_668 (27) = happyGoto action_25 +action_668 (30) = happyGoto action_26 +action_668 (37) = happyGoto action_27 +action_668 (38) = happyGoto action_28 +action_668 (39) = happyGoto action_29 +action_668 (41) = happyGoto action_30 +action_668 (73) = happyGoto action_692 +action_668 (89) = happyGoto action_591 +action_668 (90) = happyGoto action_34 +action_668 (91) = happyGoto action_35 +action_668 (132) = happyGoto action_36 +action_668 (134) = happyGoto action_37 +action_668 (136) = happyGoto action_38 +action_668 (151) = happyGoto action_693 +action_668 (166) = happyGoto action_39 +action_668 (180) = happyGoto action_595 +action_668 _ = happyFail (happyExpListPerState 668) + +action_669 _ = happyReduce_209 + +action_670 _ = happyReduce_387 + +action_671 (208) = happyShift action_691 +action_671 _ = happyFail (happyExpListPerState 671) + +action_672 _ = happyReduce_214 + +action_673 (1) = happyReduce_352 +action_673 (198) = happyReduce_352 +action_673 (199) = happyReduce_352 +action_673 (200) = happyReduce_352 +action_673 (201) = happyReduce_352 +action_673 (202) = happyReduce_352 +action_673 (203) = happyReduce_352 +action_673 (205) = happyReduce_352 +action_673 (206) = happyReduce_352 +action_673 (209) = happyReduce_352 +action_673 (211) = happyReduce_352 +action_673 (212) = happyReduce_352 +action_673 (214) = happyShift action_433 +action_673 (215) = happyReduce_352 +action_673 (217) = happyReduce_352 +action_673 (218) = happyReduce_352 +action_673 (219) = happyReduce_352 +action_673 (220) = happyReduce_352 +action_673 (221) = happyReduce_352 +action_673 (222) = happyReduce_352 +action_673 (223) = happyReduce_352 +action_673 (224) = happyReduce_352 +action_673 (228) = happyReduce_352 +action_673 (229) = happyReduce_352 +action_673 (230) = happyReduce_352 +action_673 (234) = happyReduce_352 +action_673 (236) = happyReduce_352 +action_673 (242) = happyReduce_352 +action_673 (245) = happyReduce_352 +action_673 (246) = happyReduce_352 +action_673 (247) = happyReduce_352 +action_673 (248) = happyReduce_352 +action_673 (249) = happyReduce_352 +action_673 (250) = happyReduce_352 +action_673 (251) = happyReduce_352 +action_673 (253) = happyReduce_352 +action_673 (255) = happyReduce_352 +action_673 (256) = happyReduce_352 +action_673 (257) = happyReduce_352 +action_673 (258) = happyReduce_352 +action_673 (259) = happyReduce_352 +action_673 (260) = happyReduce_352 +action_673 (261) = happyReduce_352 +action_673 (262) = happyReduce_352 +action_673 (263) = happyReduce_352 +action_673 (264) = happyReduce_352 +action_673 (265) = happyReduce_352 +action_673 (266) = happyReduce_352 +action_673 (267) = happyReduce_352 +action_673 (268) = happyReduce_352 +action_673 (269) = happyReduce_352 +action_673 (270) = happyReduce_352 +action_673 (77) = happyGoto action_690 +action_673 (83) = happyGoto action_671 +action_673 _ = happyReduce_352 + +action_674 (208) = happyShift action_689 +action_674 (214) = happyShift action_433 +action_674 (76) = happyGoto action_688 +action_674 (77) = happyGoto action_670 +action_674 (83) = happyGoto action_671 +action_674 (137) = happyGoto action_672 +action_674 (167) = happyGoto action_673 +action_674 _ = happyFail (happyExpListPerState 674) + +action_675 (198) = happyShift action_95 +action_675 (200) = happyShift action_96 +action_675 (202) = happyShift action_97 +action_675 (205) = happyShift action_687 +action_675 (218) = happyShift action_98 +action_675 (219) = happyShift action_99 +action_675 (220) = happyShift action_100 +action_675 (222) = happyShift action_101 +action_675 (223) = happyShift action_102 +action_675 (224) = happyShift action_103 +action_675 (228) = happyShift action_104 +action_675 (230) = happyShift action_46 +action_675 (234) = happyShift action_105 +action_675 (236) = happyShift action_106 +action_675 (242) = happyShift action_107 +action_675 (245) = happyShift action_108 +action_675 (246) = happyShift action_109 +action_675 (248) = happyShift action_110 +action_675 (249) = happyShift action_111 +action_675 (251) = happyShift action_52 +action_675 (255) = happyShift action_112 +action_675 (256) = happyShift action_113 +action_675 (257) = happyShift action_114 +action_675 (258) = happyShift action_54 +action_675 (259) = happyShift action_55 +action_675 (260) = happyShift action_115 +action_675 (261) = happyShift action_116 +action_675 (264) = happyShift action_117 +action_675 (265) = happyShift action_56 +action_675 (266) = happyShift action_57 +action_675 (267) = happyShift action_58 +action_675 (268) = happyShift action_59 +action_675 (269) = happyShift action_60 +action_675 (27) = happyGoto action_74 +action_675 (29) = happyGoto action_75 +action_675 (33) = happyGoto action_76 +action_675 (36) = happyGoto action_77 +action_675 (37) = happyGoto action_78 +action_675 (38) = happyGoto action_79 +action_675 (39) = happyGoto action_80 +action_675 (41) = happyGoto action_81 +action_675 (58) = happyGoto action_686 +action_675 (59) = happyGoto action_515 +action_675 (60) = happyGoto action_122 +action_675 (61) = happyGoto action_83 +action_675 (63) = happyGoto action_84 +action_675 (64) = happyGoto action_85 +action_675 (65) = happyGoto action_86 +action_675 (66) = happyGoto action_87 +action_675 (67) = happyGoto action_88 +action_675 (68) = happyGoto action_89 +action_675 (78) = happyGoto action_90 +action_675 (79) = happyGoto action_91 +action_675 (133) = happyGoto action_93 +action_675 (135) = happyGoto action_94 +action_675 _ = happyFail (happyExpListPerState 675) + +action_676 _ = happyReduce_176 + +action_677 (222) = happyShift action_232 +action_677 (223) = happyShift action_233 +action_677 (224) = happyShift action_234 +action_677 (225) = happyShift action_235 +action_677 (226) = happyShift action_236 +action_677 (227) = happyShift action_237 +action_677 (228) = happyShift action_238 +action_677 (229) = happyShift action_239 +action_677 (230) = happyShift action_240 +action_677 (231) = happyShift action_241 +action_677 (233) = happyShift action_242 +action_677 (234) = happyShift action_243 +action_677 (235) = happyShift action_244 +action_677 (236) = happyShift action_245 +action_677 (237) = happyShift action_246 +action_677 (238) = happyShift action_247 +action_677 (239) = happyShift action_248 +action_677 (240) = happyShift action_249 +action_677 (241) = happyShift action_250 +action_677 (242) = happyShift action_251 +action_677 (243) = happyShift action_252 +action_677 (244) = happyShift action_253 +action_677 (245) = happyShift action_254 +action_677 (246) = happyShift action_255 +action_677 (247) = happyShift action_256 +action_677 (248) = happyShift action_257 +action_677 (249) = happyShift action_258 +action_677 (250) = happyShift action_259 +action_677 (251) = happyShift action_260 +action_677 (252) = happyShift action_261 +action_677 (253) = happyShift action_262 +action_677 (256) = happyShift action_263 +action_677 (266) = happyShift action_264 +action_677 (267) = happyShift action_265 +action_677 (35) = happyGoto action_584 +action_677 (71) = happyGoto action_685 +action_677 _ = happyFail (happyExpListPerState 677) + +action_678 _ = happyReduce_202 + +action_679 (222) = happyShift action_232 +action_679 (223) = happyShift action_233 +action_679 (224) = happyShift action_234 +action_679 (225) = happyShift action_235 +action_679 (226) = happyShift action_236 +action_679 (227) = happyShift action_237 +action_679 (228) = happyShift action_238 +action_679 (229) = happyShift action_239 +action_679 (230) = happyShift action_240 +action_679 (231) = happyShift action_241 +action_679 (233) = happyShift action_242 +action_679 (234) = happyShift action_243 +action_679 (235) = happyShift action_244 +action_679 (236) = happyShift action_245 +action_679 (237) = happyShift action_246 +action_679 (238) = happyShift action_247 +action_679 (239) = happyShift action_248 +action_679 (240) = happyShift action_249 +action_679 (241) = happyShift action_250 +action_679 (242) = happyShift action_251 +action_679 (243) = happyShift action_252 +action_679 (244) = happyShift action_253 +action_679 (245) = happyShift action_254 +action_679 (246) = happyShift action_255 +action_679 (247) = happyShift action_256 +action_679 (248) = happyShift action_257 +action_679 (249) = happyShift action_258 +action_679 (250) = happyShift action_259 +action_679 (251) = happyShift action_260 +action_679 (252) = happyShift action_261 +action_679 (253) = happyShift action_262 +action_679 (256) = happyShift action_263 +action_679 (266) = happyShift action_264 +action_679 (267) = happyShift action_265 +action_679 (35) = happyGoto action_584 +action_679 (71) = happyGoto action_585 +action_679 (161) = happyGoto action_684 +action_679 (190) = happyGoto action_587 +action_679 _ = happyFail (happyExpListPerState 679) + +action_680 (198) = happyShift action_95 +action_680 (200) = happyShift action_96 +action_680 (202) = happyShift action_97 +action_680 (218) = happyShift action_98 +action_680 (219) = happyShift action_99 +action_680 (220) = happyShift action_100 +action_680 (222) = happyShift action_101 +action_680 (223) = happyShift action_102 +action_680 (224) = happyShift action_103 +action_680 (228) = happyShift action_104 +action_680 (230) = happyShift action_46 +action_680 (234) = happyShift action_105 +action_680 (236) = happyShift action_106 +action_680 (242) = happyShift action_107 +action_680 (245) = happyShift action_108 +action_680 (246) = happyShift action_109 +action_680 (248) = happyShift action_110 +action_680 (249) = happyShift action_111 +action_680 (251) = happyShift action_52 +action_680 (255) = happyShift action_112 +action_680 (256) = happyShift action_113 +action_680 (257) = happyShift action_114 +action_680 (258) = happyShift action_54 +action_680 (259) = happyShift action_55 +action_680 (260) = happyShift action_115 +action_680 (261) = happyShift action_116 +action_680 (264) = happyShift action_117 +action_680 (265) = happyShift action_56 +action_680 (266) = happyShift action_57 +action_680 (267) = happyShift action_58 +action_680 (268) = happyShift action_59 +action_680 (269) = happyShift action_60 +action_680 (27) = happyGoto action_74 +action_680 (29) = happyGoto action_75 +action_680 (33) = happyGoto action_76 +action_680 (36) = happyGoto action_77 +action_680 (37) = happyGoto action_78 +action_680 (38) = happyGoto action_79 +action_680 (39) = happyGoto action_80 +action_680 (41) = happyGoto action_81 +action_680 (59) = happyGoto action_683 +action_680 (60) = happyGoto action_122 +action_680 (61) = happyGoto action_83 +action_680 (63) = happyGoto action_84 +action_680 (64) = happyGoto action_85 +action_680 (65) = happyGoto action_86 +action_680 (66) = happyGoto action_87 +action_680 (67) = happyGoto action_88 +action_680 (68) = happyGoto action_89 +action_680 (78) = happyGoto action_90 +action_680 (79) = happyGoto action_91 +action_680 (133) = happyGoto action_93 +action_680 (135) = happyGoto action_94 +action_680 _ = happyFail (happyExpListPerState 680) + +action_681 _ = happyReduce_315 + +action_682 _ = happyReduce_423 + +action_683 _ = happyReduce_203 + +action_684 (201) = happyShift action_707 +action_684 _ = happyFail (happyExpListPerState 684) + +action_685 _ = happyReduce_431 + +action_686 _ = happyReduce_213 + +action_687 (198) = happyShift action_95 +action_687 (200) = happyShift action_96 +action_687 (202) = happyShift action_97 +action_687 (218) = happyShift action_98 +action_687 (219) = happyShift action_99 +action_687 (220) = happyShift action_100 +action_687 (222) = happyShift action_101 +action_687 (223) = happyShift action_102 +action_687 (224) = happyShift action_103 +action_687 (228) = happyShift action_104 +action_687 (230) = happyShift action_46 +action_687 (234) = happyShift action_105 +action_687 (236) = happyShift action_106 +action_687 (242) = happyShift action_107 +action_687 (245) = happyShift action_108 +action_687 (246) = happyShift action_109 +action_687 (248) = happyShift action_110 +action_687 (249) = happyShift action_111 +action_687 (251) = happyShift action_52 +action_687 (255) = happyShift action_112 +action_687 (256) = happyShift action_113 +action_687 (257) = happyShift action_114 +action_687 (258) = happyShift action_54 +action_687 (259) = happyShift action_55 +action_687 (260) = happyShift action_115 +action_687 (261) = happyShift action_116 +action_687 (264) = happyShift action_117 +action_687 (265) = happyShift action_56 +action_687 (266) = happyShift action_57 +action_687 (267) = happyShift action_58 +action_687 (268) = happyShift action_59 +action_687 (269) = happyShift action_60 +action_687 (27) = happyGoto action_74 +action_687 (29) = happyGoto action_75 +action_687 (33) = happyGoto action_76 +action_687 (36) = happyGoto action_77 +action_687 (37) = happyGoto action_78 +action_687 (38) = happyGoto action_79 +action_687 (39) = happyGoto action_80 +action_687 (41) = happyGoto action_81 +action_687 (58) = happyGoto action_706 +action_687 (59) = happyGoto action_515 +action_687 (60) = happyGoto action_122 +action_687 (61) = happyGoto action_83 +action_687 (63) = happyGoto action_84 +action_687 (64) = happyGoto action_85 +action_687 (65) = happyGoto action_86 +action_687 (66) = happyGoto action_87 +action_687 (67) = happyGoto action_88 +action_687 (68) = happyGoto action_89 +action_687 (78) = happyGoto action_90 +action_687 (79) = happyGoto action_91 +action_687 (133) = happyGoto action_93 +action_687 (135) = happyGoto action_94 +action_687 _ = happyFail (happyExpListPerState 687) + +action_688 _ = happyReduce_178 + +action_689 (198) = happyShift action_95 +action_689 (200) = happyShift action_96 +action_689 (202) = happyShift action_97 +action_689 (218) = happyShift action_98 +action_689 (219) = happyShift action_99 +action_689 (220) = happyShift action_100 +action_689 (222) = happyShift action_101 +action_689 (223) = happyShift action_102 +action_689 (224) = happyShift action_103 +action_689 (228) = happyShift action_104 +action_689 (230) = happyShift action_46 +action_689 (234) = happyShift action_105 +action_689 (236) = happyShift action_106 +action_689 (242) = happyShift action_107 +action_689 (245) = happyShift action_108 +action_689 (246) = happyShift action_109 +action_689 (248) = happyShift action_110 +action_689 (249) = happyShift action_111 +action_689 (251) = happyShift action_52 +action_689 (255) = happyShift action_112 +action_689 (256) = happyShift action_113 +action_689 (257) = happyShift action_114 +action_689 (258) = happyShift action_54 +action_689 (259) = happyShift action_55 +action_689 (260) = happyShift action_115 +action_689 (261) = happyShift action_116 +action_689 (264) = happyShift action_117 +action_689 (265) = happyShift action_56 +action_689 (266) = happyShift action_57 +action_689 (267) = happyShift action_58 +action_689 (268) = happyShift action_59 +action_689 (269) = happyShift action_60 +action_689 (27) = happyGoto action_74 +action_689 (29) = happyGoto action_75 +action_689 (33) = happyGoto action_76 +action_689 (36) = happyGoto action_77 +action_689 (37) = happyGoto action_78 +action_689 (38) = happyGoto action_79 +action_689 (39) = happyGoto action_80 +action_689 (41) = happyGoto action_81 +action_689 (58) = happyGoto action_686 +action_689 (59) = happyGoto action_515 +action_689 (60) = happyGoto action_122 +action_689 (61) = happyGoto action_83 +action_689 (63) = happyGoto action_84 +action_689 (64) = happyGoto action_85 +action_689 (65) = happyGoto action_86 +action_689 (66) = happyGoto action_87 +action_689 (67) = happyGoto action_88 +action_689 (68) = happyGoto action_89 +action_689 (78) = happyGoto action_90 +action_689 (79) = happyGoto action_91 +action_689 (133) = happyGoto action_93 +action_689 (135) = happyGoto action_94 +action_689 _ = happyFail (happyExpListPerState 689) + +action_690 _ = happyReduce_388 + +action_691 (198) = happyShift action_95 +action_691 (200) = happyShift action_96 +action_691 (202) = happyShift action_97 +action_691 (218) = happyShift action_98 +action_691 (219) = happyShift action_99 +action_691 (220) = happyShift action_100 +action_691 (222) = happyShift action_101 +action_691 (223) = happyShift action_102 +action_691 (224) = happyShift action_103 +action_691 (228) = happyShift action_104 +action_691 (230) = happyShift action_46 +action_691 (234) = happyShift action_105 +action_691 (236) = happyShift action_106 +action_691 (242) = happyShift action_107 +action_691 (245) = happyShift action_108 +action_691 (246) = happyShift action_109 +action_691 (248) = happyShift action_110 +action_691 (249) = happyShift action_111 +action_691 (251) = happyShift action_52 +action_691 (255) = happyShift action_112 +action_691 (256) = happyShift action_113 +action_691 (257) = happyShift action_114 +action_691 (258) = happyShift action_54 +action_691 (259) = happyShift action_55 +action_691 (260) = happyShift action_115 +action_691 (261) = happyShift action_116 +action_691 (264) = happyShift action_117 +action_691 (265) = happyShift action_56 +action_691 (266) = happyShift action_57 +action_691 (267) = happyShift action_58 +action_691 (268) = happyShift action_59 +action_691 (269) = happyShift action_60 +action_691 (27) = happyGoto action_74 +action_691 (29) = happyGoto action_75 +action_691 (33) = happyGoto action_76 +action_691 (36) = happyGoto action_77 +action_691 (37) = happyGoto action_78 +action_691 (38) = happyGoto action_79 +action_691 (39) = happyGoto action_80 +action_691 (41) = happyGoto action_81 +action_691 (58) = happyGoto action_705 +action_691 (59) = happyGoto action_515 +action_691 (60) = happyGoto action_122 +action_691 (61) = happyGoto action_83 +action_691 (63) = happyGoto action_84 +action_691 (64) = happyGoto action_85 +action_691 (65) = happyGoto action_86 +action_691 (66) = happyGoto action_87 +action_691 (67) = happyGoto action_88 +action_691 (68) = happyGoto action_89 +action_691 (78) = happyGoto action_90 +action_691 (79) = happyGoto action_91 +action_691 (133) = happyGoto action_93 +action_691 (135) = happyGoto action_94 +action_691 _ = happyFail (happyExpListPerState 691) + +action_692 _ = happyReduce_398 + +action_693 (208) = happyShift action_689 +action_693 (214) = happyShift action_433 +action_693 (76) = happyGoto action_669 +action_693 (77) = happyGoto action_670 +action_693 (83) = happyGoto action_671 +action_693 (137) = happyGoto action_672 +action_693 (167) = happyGoto action_673 +action_693 _ = happyFail (happyExpListPerState 693) + +action_694 (209) = happyShift action_286 +action_694 (211) = happyShift action_288 +action_694 (220) = happyShift action_289 +action_694 (262) = happyShift action_290 +action_694 (263) = happyShift action_291 +action_694 (31) = happyGoto action_344 +action_694 _ = happyReduce_411 + +action_695 (205) = happyShift action_703 +action_695 (206) = happyShift action_704 +action_695 _ = happyFail (happyExpListPerState 695) + +action_696 (258) = happyShift action_63 +action_696 (28) = happyGoto action_702 +action_696 _ = happyFail (happyExpListPerState 696) + +action_697 _ = happyReduce_273 + +action_698 _ = happyReduce_150 + +action_699 (205) = happyShift action_701 +action_699 _ = happyFail (happyExpListPerState 699) + +action_700 _ = happyReduce_152 + +action_701 _ = happyReduce_156 + +action_702 _ = happyReduce_429 + +action_703 _ = happyReduce_252 + +action_704 _ = happyReduce_254 + +action_705 _ = happyReduce_215 + +action_706 _ = happyReduce_177 + +action_707 _ = happyReduce_204 + +happyReduce_23 = happyMonadReduce 1 26 happyReduction_23 +happyReduction_23 + ( (HappyTerminal happy_var_1) + `HappyStk` happyRest + ) + tk = + happyThen + ( ((upperToModuleName happy_var_1)) + ) + (\r -> happyReturn (HappyAbsSyn26 r)) + +happyReduce_24 = happyMonadReduce 1 26 happyReduction_24 +happyReduction_24 + ( (HappyTerminal happy_var_1) + `HappyStk` happyRest + ) + tk = + happyThen + ( ((upperToModuleName happy_var_1)) + ) + (\r -> happyReturn (HappyAbsSyn26 r)) + +happyReduce_25 = happyMonadReduce 1 27 happyReduction_25 +happyReduction_25 + ( (HappyTerminal happy_var_1) + `HappyStk` happyRest + ) + tk = + happyThen + ( ((qualifiedProperName <$> toQualifiedName N.ProperName happy_var_1)) + ) + (\r -> happyReturn (HappyAbsSyn27 r)) + +happyReduce_26 = happyMonadReduce 1 27 happyReduction_26 +happyReduction_26 + ( (HappyTerminal happy_var_1) + `HappyStk` happyRest + ) + tk = + happyThen + ( ((qualifiedProperName <$> toQualifiedName N.ProperName happy_var_1)) + ) + (\r -> happyReturn (HappyAbsSyn27 r)) + +happyReduce_27 = happyMonadReduce 1 28 happyReduction_27 +happyReduction_27 + ( (HappyTerminal happy_var_1) + `HappyStk` happyRest + ) + tk = + happyThen + ( ((properName <$> toName N.ProperName happy_var_1)) + ) + (\r -> happyReturn (HappyAbsSyn28 r)) + +happyReduce_28 = happyMonadReduce 1 29 happyReduction_28 +happyReduction_28 + ( (HappyTerminal happy_var_1) + `HappyStk` happyRest + ) + tk = + happyThen + ( ((toQualifiedName Ident happy_var_1)) + ) + (\r -> happyReturn (HappyAbsSyn29 r)) + +happyReduce_29 = happyMonadReduce 1 29 happyReduction_29 +happyReduction_29 + ( (HappyTerminal happy_var_1) + `HappyStk` happyRest + ) + tk = + happyThen + ( ((toQualifiedName Ident happy_var_1)) + ) + (\r -> happyReturn (HappyAbsSyn29 r)) + +happyReduce_30 = happyMonadReduce 1 29 happyReduction_30 +happyReduction_30 + ( (HappyTerminal happy_var_1) + `HappyStk` happyRest + ) + tk = + happyThen + ( ((toQualifiedName Ident happy_var_1)) + ) + (\r -> happyReturn (HappyAbsSyn29 r)) + +happyReduce_31 = happyMonadReduce 1 29 happyReduction_31 +happyReduction_31 + ( (HappyTerminal happy_var_1) + `HappyStk` happyRest + ) + tk = + happyThen + ( ((toQualifiedName Ident happy_var_1)) + ) + (\r -> happyReturn (HappyAbsSyn29 r)) + +happyReduce_32 = happyMonadReduce 1 29 happyReduction_32 +happyReduction_32 + ( (HappyTerminal happy_var_1) + `HappyStk` happyRest + ) + tk = + happyThen + ( ((toQualifiedName Ident happy_var_1)) + ) + (\r -> happyReturn (HappyAbsSyn29 r)) + +happyReduce_33 = happyMonadReduce 1 29 happyReduction_33 +happyReduction_33 + ( (HappyTerminal happy_var_1) + `HappyStk` happyRest + ) + tk = + happyThen + ( ((toQualifiedName Ident happy_var_1)) + ) + (\r -> happyReturn (HappyAbsSyn29 r)) + +happyReduce_34 = happyMonadReduce 1 29 happyReduction_34 +happyReduction_34 + ( (HappyTerminal happy_var_1) + `HappyStk` happyRest + ) + tk = + happyThen + ( ((toQualifiedName Ident happy_var_1)) + ) + (\r -> happyReturn (HappyAbsSyn29 r)) + +happyReduce_35 = happyMonadReduce 1 29 happyReduction_35 +happyReduction_35 + ( (HappyTerminal happy_var_1) + `HappyStk` happyRest + ) + tk = + happyThen + ( ((toQualifiedName Ident happy_var_1)) + ) + (\r -> happyReturn (HappyAbsSyn29 r)) + +happyReduce_36 = happyMonadReduce 1 30 happyReduction_36 +happyReduction_36 + ( (HappyTerminal happy_var_1) + `HappyStk` happyRest + ) + tk = + happyThen + ( ((toName Ident happy_var_1)) + ) + (\r -> happyReturn (HappyAbsSyn30 r)) + +happyReduce_37 = happyMonadReduce 1 30 happyReduction_37 +happyReduction_37 + ( (HappyTerminal happy_var_1) + `HappyStk` happyRest + ) + tk = + happyThen + ( ((toName Ident happy_var_1)) + ) + (\r -> happyReturn (HappyAbsSyn30 r)) + +happyReduce_38 = happyMonadReduce 1 30 happyReduction_38 +happyReduction_38 + ( (HappyTerminal happy_var_1) + `HappyStk` happyRest + ) + tk = + happyThen + ( ((toName Ident happy_var_1)) + ) + (\r -> happyReturn (HappyAbsSyn30 r)) + +happyReduce_39 = happyMonadReduce 1 30 happyReduction_39 +happyReduction_39 + ( (HappyTerminal happy_var_1) + `HappyStk` happyRest + ) + tk = + happyThen + ( ((toName Ident happy_var_1)) + ) + (\r -> happyReturn (HappyAbsSyn30 r)) + +happyReduce_40 = happyMonadReduce 1 30 happyReduction_40 +happyReduction_40 + ( (HappyTerminal happy_var_1) + `HappyStk` happyRest + ) + tk = + happyThen + ( ((toName Ident happy_var_1)) + ) + (\r -> happyReturn (HappyAbsSyn30 r)) + +happyReduce_41 = happyMonadReduce 1 30 happyReduction_41 +happyReduction_41 + ( (HappyTerminal happy_var_1) + `HappyStk` happyRest + ) + tk = + happyThen + ( ((toName Ident happy_var_1)) + ) + (\r -> happyReturn (HappyAbsSyn30 r)) + +happyReduce_42 = happyMonadReduce 1 30 happyReduction_42 +happyReduction_42 + ( (HappyTerminal happy_var_1) + `HappyStk` happyRest + ) + tk = + happyThen + ( ((toName Ident happy_var_1)) + ) + (\r -> happyReturn (HappyAbsSyn30 r)) + +happyReduce_43 = happyMonadReduce 1 31 happyReduction_43 +happyReduction_43 + ( (HappyTerminal happy_var_1) + `HappyStk` happyRest + ) + tk = + happyThen + ( ((qualifiedOpName <$> toQualifiedName N.OpName happy_var_1)) + ) + (\r -> happyReturn (HappyAbsSyn31 r)) + +happyReduce_44 = happyMonadReduce 1 31 happyReduction_44 +happyReduction_44 + ( (HappyTerminal happy_var_1) + `HappyStk` happyRest + ) + tk = + happyThen + ( ((qualifiedOpName <$> toQualifiedName N.OpName happy_var_1)) + ) + (\r -> happyReturn (HappyAbsSyn31 r)) + +happyReduce_45 = happyMonadReduce 1 31 happyReduction_45 +happyReduction_45 + ( (HappyTerminal happy_var_1) + `HappyStk` happyRest + ) + tk = + happyThen + ( ((qualifiedOpName <$> toQualifiedName N.OpName happy_var_1)) + ) + (\r -> happyReturn (HappyAbsSyn31 r)) + +happyReduce_46 = happyMonadReduce 1 31 happyReduction_46 +happyReduction_46 + ( (HappyTerminal happy_var_1) + `HappyStk` happyRest + ) + tk = + happyThen + ( ((qualifiedOpName <$> toQualifiedName N.OpName happy_var_1)) + ) + (\r -> happyReturn (HappyAbsSyn31 r)) + +happyReduce_47 = happyMonadReduce 1 31 happyReduction_47 +happyReduction_47 + ( (HappyTerminal happy_var_1) + `HappyStk` happyRest + ) + tk = + happyThen + ( ((qualifiedOpName <$> toQualifiedName N.OpName happy_var_1)) + ) + (\r -> happyReturn (HappyAbsSyn31 r)) + +happyReduce_48 = happyMonadReduce 1 32 happyReduction_48 +happyReduction_48 + ( (HappyTerminal happy_var_1) + `HappyStk` happyRest + ) + tk = + happyThen + ( ((opName <$> toName N.OpName happy_var_1)) + ) + (\r -> happyReturn (HappyAbsSyn32 r)) + +happyReduce_49 = happyMonadReduce 1 32 happyReduction_49 +happyReduction_49 + ( (HappyTerminal happy_var_1) + `HappyStk` happyRest + ) + tk = + happyThen + ( ((opName <$> toName N.OpName happy_var_1)) + ) + (\r -> happyReturn (HappyAbsSyn32 r)) + +happyReduce_50 = happyMonadReduce 1 32 happyReduction_50 +happyReduction_50 + ( (HappyTerminal happy_var_1) + `HappyStk` happyRest + ) + tk = + happyThen + ( ((opName <$> toName N.OpName happy_var_1)) + ) + (\r -> happyReturn (HappyAbsSyn32 r)) + +happyReduce_51 = happyMonadReduce 1 32 happyReduction_51 +happyReduction_51 + ( (HappyTerminal happy_var_1) + `HappyStk` happyRest + ) + tk = + happyThen + ( ((opName <$> toName N.OpName happy_var_1)) + ) + (\r -> happyReturn (HappyAbsSyn32 r)) + +happyReduce_52 = happyMonadReduce 1 33 happyReduction_52 +happyReduction_52 + ( (HappyTerminal happy_var_1) + `HappyStk` happyRest + ) + tk = + happyThen + ( ((qualifiedOpName <$> toQualifiedName N.OpName happy_var_1)) + ) + (\r -> happyReturn (HappyAbsSyn31 r)) + +happyReduce_53 = happyMonadReduce 1 33 happyReduction_53 +happyReduction_53 + ( (HappyTerminal happy_var_1) + `HappyStk` happyRest + ) + tk = + happyThen + ( ((qualifiedOpName <$> toQualifiedName N.OpName happy_var_1)) + ) + (\r -> happyReturn (HappyAbsSyn31 r)) + +happyReduce_54 = happyMonadReduce 1 33 happyReduction_54 +happyReduction_54 + ( (HappyTerminal happy_var_1) + `HappyStk` happyRest + ) + tk = + happyThen + ( ((qualifiedOpName <$> toQualifiedName N.OpName happy_var_1)) + ) + (\r -> happyReturn (HappyAbsSyn31 r)) + +happyReduce_55 = happyMonadReduce 1 34 happyReduction_55 +happyReduction_55 + ( (HappyTerminal happy_var_1) + `HappyStk` happyRest + ) + tk = + happyThen + ( ((opName <$> toName N.OpName happy_var_1)) + ) + (\r -> happyReturn (HappyAbsSyn32 r)) + +happyReduce_56 = happyMonadReduce 1 34 happyReduction_56 +happyReduction_56 + ( (HappyTerminal happy_var_1) + `HappyStk` happyRest + ) + tk = + happyThen + ( ((opName <$> toName N.OpName happy_var_1)) + ) + (\r -> happyReturn (HappyAbsSyn32 r)) + +happyReduce_57 = happySpecReduce_1 35 happyReduction_57 +happyReduction_57 (HappyTerminal happy_var_1) = + HappyAbsSyn35 + ( toLabel happy_var_1 + ) +happyReduction_57 _ = notHappyAtAll + +happyReduce_58 = happySpecReduce_1 35 happyReduction_58 +happyReduction_58 (HappyTerminal happy_var_1) = + HappyAbsSyn35 + ( toLabel happy_var_1 + ) +happyReduction_58 _ = notHappyAtAll + +happyReduce_59 = happySpecReduce_1 35 happyReduction_59 +happyReduction_59 (HappyTerminal happy_var_1) = + HappyAbsSyn35 + ( toLabel happy_var_1 + ) +happyReduction_59 _ = notHappyAtAll + +happyReduce_60 = happySpecReduce_1 35 happyReduction_60 +happyReduction_60 (HappyTerminal happy_var_1) = + HappyAbsSyn35 + ( toLabel happy_var_1 + ) +happyReduction_60 _ = notHappyAtAll + +happyReduce_61 = happySpecReduce_1 35 happyReduction_61 +happyReduction_61 (HappyTerminal happy_var_1) = + HappyAbsSyn35 + ( toLabel happy_var_1 + ) +happyReduction_61 _ = notHappyAtAll + +happyReduce_62 = happySpecReduce_1 35 happyReduction_62 +happyReduction_62 (HappyTerminal happy_var_1) = + HappyAbsSyn35 + ( toLabel happy_var_1 + ) +happyReduction_62 _ = notHappyAtAll + +happyReduce_63 = happySpecReduce_1 35 happyReduction_63 +happyReduction_63 (HappyTerminal happy_var_1) = + HappyAbsSyn35 + ( toLabel happy_var_1 + ) +happyReduction_63 _ = notHappyAtAll + +happyReduce_64 = happySpecReduce_1 35 happyReduction_64 +happyReduction_64 (HappyTerminal happy_var_1) = + HappyAbsSyn35 + ( toLabel happy_var_1 + ) +happyReduction_64 _ = notHappyAtAll + +happyReduce_65 = happySpecReduce_1 35 happyReduction_65 +happyReduction_65 (HappyTerminal happy_var_1) = + HappyAbsSyn35 + ( toLabel happy_var_1 + ) +happyReduction_65 _ = notHappyAtAll + +happyReduce_66 = happySpecReduce_1 35 happyReduction_66 +happyReduction_66 (HappyTerminal happy_var_1) = + HappyAbsSyn35 + ( toLabel happy_var_1 + ) +happyReduction_66 _ = notHappyAtAll + +happyReduce_67 = happySpecReduce_1 35 happyReduction_67 +happyReduction_67 (HappyTerminal happy_var_1) = + HappyAbsSyn35 + ( toLabel happy_var_1 + ) +happyReduction_67 _ = notHappyAtAll + +happyReduce_68 = happySpecReduce_1 35 happyReduction_68 +happyReduction_68 (HappyTerminal happy_var_1) = + HappyAbsSyn35 + ( toLabel happy_var_1 + ) +happyReduction_68 _ = notHappyAtAll + +happyReduce_69 = happySpecReduce_1 35 happyReduction_69 +happyReduction_69 (HappyTerminal happy_var_1) = + HappyAbsSyn35 + ( toLabel happy_var_1 + ) +happyReduction_69 _ = notHappyAtAll + +happyReduce_70 = happySpecReduce_1 35 happyReduction_70 +happyReduction_70 (HappyTerminal happy_var_1) = + HappyAbsSyn35 + ( toLabel happy_var_1 + ) +happyReduction_70 _ = notHappyAtAll + +happyReduce_71 = happySpecReduce_1 35 happyReduction_71 +happyReduction_71 (HappyTerminal happy_var_1) = + HappyAbsSyn35 + ( toLabel happy_var_1 + ) +happyReduction_71 _ = notHappyAtAll + +happyReduce_72 = happySpecReduce_1 35 happyReduction_72 +happyReduction_72 (HappyTerminal happy_var_1) = + HappyAbsSyn35 + ( toLabel happy_var_1 + ) +happyReduction_72 _ = notHappyAtAll + +happyReduce_73 = happySpecReduce_1 35 happyReduction_73 +happyReduction_73 (HappyTerminal happy_var_1) = + HappyAbsSyn35 + ( toLabel happy_var_1 + ) +happyReduction_73 _ = notHappyAtAll + +happyReduce_74 = happySpecReduce_1 35 happyReduction_74 +happyReduction_74 (HappyTerminal happy_var_1) = + HappyAbsSyn35 + ( toLabel happy_var_1 + ) +happyReduction_74 _ = notHappyAtAll + +happyReduce_75 = happySpecReduce_1 35 happyReduction_75 +happyReduction_75 (HappyTerminal happy_var_1) = + HappyAbsSyn35 + ( toLabel happy_var_1 + ) +happyReduction_75 _ = notHappyAtAll + +happyReduce_76 = happySpecReduce_1 35 happyReduction_76 +happyReduction_76 (HappyTerminal happy_var_1) = + HappyAbsSyn35 + ( toLabel happy_var_1 + ) +happyReduction_76 _ = notHappyAtAll + +happyReduce_77 = happySpecReduce_1 35 happyReduction_77 +happyReduction_77 (HappyTerminal happy_var_1) = + HappyAbsSyn35 + ( toLabel happy_var_1 + ) +happyReduction_77 _ = notHappyAtAll + +happyReduce_78 = happySpecReduce_1 35 happyReduction_78 +happyReduction_78 (HappyTerminal happy_var_1) = + HappyAbsSyn35 + ( toLabel happy_var_1 + ) +happyReduction_78 _ = notHappyAtAll + +happyReduce_79 = happySpecReduce_1 35 happyReduction_79 +happyReduction_79 (HappyTerminal happy_var_1) = + HappyAbsSyn35 + ( toLabel happy_var_1 + ) +happyReduction_79 _ = notHappyAtAll + +happyReduce_80 = happySpecReduce_1 35 happyReduction_80 +happyReduction_80 (HappyTerminal happy_var_1) = + HappyAbsSyn35 + ( toLabel happy_var_1 + ) +happyReduction_80 _ = notHappyAtAll + +happyReduce_81 = happySpecReduce_1 35 happyReduction_81 +happyReduction_81 (HappyTerminal happy_var_1) = + HappyAbsSyn35 + ( toLabel happy_var_1 + ) +happyReduction_81 _ = notHappyAtAll + +happyReduce_82 = happySpecReduce_1 35 happyReduction_82 +happyReduction_82 (HappyTerminal happy_var_1) = + HappyAbsSyn35 + ( toLabel happy_var_1 + ) +happyReduction_82 _ = notHappyAtAll + +happyReduce_83 = happySpecReduce_1 35 happyReduction_83 +happyReduction_83 (HappyTerminal happy_var_1) = + HappyAbsSyn35 + ( toLabel happy_var_1 + ) +happyReduction_83 _ = notHappyAtAll + +happyReduce_84 = happySpecReduce_1 35 happyReduction_84 +happyReduction_84 (HappyTerminal happy_var_1) = + HappyAbsSyn35 + ( toLabel happy_var_1 + ) +happyReduction_84 _ = notHappyAtAll + +happyReduce_85 = happySpecReduce_1 35 happyReduction_85 +happyReduction_85 (HappyTerminal happy_var_1) = + HappyAbsSyn35 + ( toLabel happy_var_1 + ) +happyReduction_85 _ = notHappyAtAll + +happyReduce_86 = happySpecReduce_1 35 happyReduction_86 +happyReduction_86 (HappyTerminal happy_var_1) = + HappyAbsSyn35 + ( toLabel happy_var_1 + ) +happyReduction_86 _ = notHappyAtAll + +happyReduce_87 = happySpecReduce_1 35 happyReduction_87 +happyReduction_87 (HappyTerminal happy_var_1) = + HappyAbsSyn35 + ( toLabel happy_var_1 + ) +happyReduction_87 _ = notHappyAtAll + +happyReduce_88 = happySpecReduce_1 35 happyReduction_88 +happyReduction_88 (HappyTerminal happy_var_1) = + HappyAbsSyn35 + ( toLabel happy_var_1 + ) +happyReduction_88 _ = notHappyAtAll + +happyReduce_89 = happySpecReduce_1 35 happyReduction_89 +happyReduction_89 (HappyTerminal happy_var_1) = + HappyAbsSyn35 + ( toLabel happy_var_1 + ) +happyReduction_89 _ = notHappyAtAll + +happyReduce_90 = happySpecReduce_1 35 happyReduction_90 +happyReduction_90 (HappyTerminal happy_var_1) = + HappyAbsSyn35 + ( toLabel happy_var_1 + ) +happyReduction_90 _ = notHappyAtAll + +happyReduce_91 = happyMonadReduce 1 36 happyReduction_91 +happyReduction_91 + ( (HappyTerminal happy_var_1) + `HappyStk` happyRest + ) + tk = + happyThen + ( ((toName Ident happy_var_1)) + ) + (\r -> happyReturn (HappyAbsSyn30 r)) + +happyReduce_92 = happySpecReduce_1 37 happyReduction_92 +happyReduction_92 (HappyTerminal happy_var_1) = + HappyAbsSyn37 + ( toString happy_var_1 + ) +happyReduction_92 _ = notHappyAtAll + +happyReduce_93 = happySpecReduce_1 37 happyReduction_93 +happyReduction_93 (HappyTerminal happy_var_1) = + HappyAbsSyn37 + ( toString happy_var_1 + ) +happyReduction_93 _ = notHappyAtAll + +happyReduce_94 = happySpecReduce_1 38 happyReduction_94 +happyReduction_94 (HappyTerminal happy_var_1) = + HappyAbsSyn38 + ( toChar happy_var_1 + ) +happyReduction_94 _ = notHappyAtAll + +happyReduce_95 = happySpecReduce_1 39 happyReduction_95 +happyReduction_95 (HappyTerminal happy_var_1) = + HappyAbsSyn39 + ( toNumber happy_var_1 + ) +happyReduction_95 _ = notHappyAtAll + +happyReduce_96 = happySpecReduce_1 39 happyReduction_96 +happyReduction_96 (HappyTerminal happy_var_1) = + HappyAbsSyn39 + ( toNumber happy_var_1 + ) +happyReduction_96 _ = notHappyAtAll + +happyReduce_97 = happySpecReduce_1 40 happyReduction_97 +happyReduction_97 (HappyTerminal happy_var_1) = + HappyAbsSyn40 + ( toInt happy_var_1 + ) +happyReduction_97 _ = notHappyAtAll + +happyReduce_98 = happySpecReduce_1 41 happyReduction_98 +happyReduction_98 (HappyTerminal happy_var_1) = + HappyAbsSyn41 + ( toBoolean happy_var_1 + ) +happyReduction_98 _ = notHappyAtAll + +happyReduce_99 = happySpecReduce_1 41 happyReduction_99 +happyReduction_99 (HappyTerminal happy_var_1) = + HappyAbsSyn41 + ( toBoolean happy_var_1 + ) +happyReduction_99 _ = notHappyAtAll + +happyReduce_100 = happySpecReduce_1 42 happyReduction_100 +happyReduction_100 (HappyAbsSyn42 happy_var_1) = + HappyAbsSyn42 + ( happy_var_1 + ) +happyReduction_100 _ = notHappyAtAll + +happyReduce_101 = happySpecReduce_3 42 happyReduction_101 +happyReduction_101 + (HappyAbsSyn42 happy_var_3) + (HappyTerminal happy_var_2) + (HappyAbsSyn42 happy_var_1) = + HappyAbsSyn42 + ( TypeArr () happy_var_1 happy_var_2 happy_var_3 + ) +happyReduction_101 _ _ _ = notHappyAtAll + +happyReduce_102 = happySpecReduce_1 43 happyReduction_102 +happyReduction_102 (HappyAbsSyn42 happy_var_1) = + HappyAbsSyn42 + ( happy_var_1 + ) +happyReduction_102 _ = notHappyAtAll + +happyReduce_103 = happySpecReduce_2 43 happyReduction_103 +happyReduction_103 + (HappyAbsSyn42 happy_var_2) + (HappyAbsSyn42 happy_var_1) = + HappyAbsSyn42 + ( TypeApp () happy_var_1 happy_var_2 + ) +happyReduction_103 _ _ = notHappyAtAll + +happyReduce_104 = happySpecReduce_1 44 happyReduction_104 +happyReduction_104 (HappyTerminal happy_var_1) = + HappyAbsSyn42 + ( TypeWildcard () happy_var_1 + ) +happyReduction_104 _ = notHappyAtAll + +happyReduce_105 = happySpecReduce_1 44 happyReduction_105 +happyReduction_105 (HappyAbsSyn27 happy_var_1) = + HappyAbsSyn42 + ( TypeConstructor () (getQualifiedProperName happy_var_1) + ) +happyReduction_105 _ = notHappyAtAll + +happyReduce_106 = happySpecReduce_1 44 happyReduction_106 +happyReduction_106 (HappyAbsSyn30 happy_var_1) = + HappyAbsSyn42 + ( TypeHole () happy_var_1 + ) +happyReduction_106 _ = notHappyAtAll + +happyReduce_107 = happySpecReduce_3 44 happyReduction_107 +happyReduction_107 + (HappyTerminal happy_var_3) + (HappyAbsSyn42 happy_var_2) + (HappyTerminal happy_var_1) = + HappyAbsSyn42 + ( TypeParens () (Wrapped happy_var_1 happy_var_2 happy_var_3) + ) +happyReduction_107 _ _ _ = notHappyAtAll + +happyReduce_108 = happySpecReduce_1 45 happyReduction_108 +happyReduction_108 (HappyAbsSyn42 happy_var_1) = + HappyAbsSyn42 + ( happy_var_1 + ) +happyReduction_108 _ = notHappyAtAll + +happyReduce_109 = happySpecReduce_3 45 happyReduction_109 +happyReduction_109 + (HappyAbsSyn42 happy_var_3) + (HappyTerminal happy_var_2) + (HappyAbsSyn42 happy_var_1) = + HappyAbsSyn42 + ( TypeKinded () happy_var_1 happy_var_2 happy_var_3 + ) +happyReduction_109 _ _ _ = notHappyAtAll + +happyReduce_110 = happySpecReduce_1 46 happyReduction_110 +happyReduction_110 (HappyAbsSyn42 happy_var_1) = + HappyAbsSyn42 + ( happy_var_1 + ) +happyReduction_110 _ = notHappyAtAll + +happyReduce_111 = happyReduce 4 46 happyReduction_111 +happyReduction_111 + ( (HappyAbsSyn42 happy_var_4) + `HappyStk` (HappyTerminal happy_var_3) + `HappyStk` (HappyAbsSyn141 happy_var_2) + `HappyStk` (HappyAbsSyn57 happy_var_1) + `HappyStk` happyRest + ) = + HappyAbsSyn42 + ( TypeForall () happy_var_1 happy_var_2 happy_var_3 happy_var_4 + ) + `HappyStk` happyRest + +happyReduce_112 = happySpecReduce_1 47 happyReduction_112 +happyReduction_112 (HappyAbsSyn42 happy_var_1) = + HappyAbsSyn42 + ( happy_var_1 + ) +happyReduction_112 _ = notHappyAtAll + +happyReduce_113 = happySpecReduce_3 47 happyReduction_113 +happyReduction_113 + (HappyAbsSyn42 happy_var_3) + (HappyTerminal happy_var_2) + (HappyAbsSyn42 happy_var_1) = + HappyAbsSyn42 + ( TypeArr () happy_var_1 happy_var_2 happy_var_3 + ) +happyReduction_113 _ _ _ = notHappyAtAll + +happyReduce_114 = happyMonadReduce 3 47 happyReduction_114 +happyReduction_114 + ( (HappyAbsSyn42 happy_var_3) + `HappyStk` (HappyTerminal happy_var_2) + `HappyStk` (HappyAbsSyn42 happy_var_1) + `HappyStk` happyRest + ) + tk = + happyThen + ( ((do cs <- toConstraint happy_var_1; pure $ TypeConstrained () cs happy_var_2 happy_var_3)) + ) + (\r -> happyReturn (HappyAbsSyn42 r)) + +happyReduce_115 = happySpecReduce_1 48 happyReduction_115 +happyReduction_115 (HappyAbsSyn42 happy_var_1) = + HappyAbsSyn42 + ( happy_var_1 + ) +happyReduction_115 _ = notHappyAtAll + +happyReduce_116 = happySpecReduce_3 48 happyReduction_116 +happyReduction_116 + (HappyAbsSyn42 happy_var_3) + (HappyAbsSyn31 happy_var_2) + (HappyAbsSyn42 happy_var_1) = + HappyAbsSyn42 + ( TypeOp () happy_var_1 (getQualifiedOpName happy_var_2) happy_var_3 + ) +happyReduction_116 _ _ _ = notHappyAtAll + +happyReduce_117 = happySpecReduce_1 49 happyReduction_117 +happyReduction_117 (HappyAbsSyn42 happy_var_1) = + HappyAbsSyn42 + ( happy_var_1 + ) +happyReduction_117 _ = notHappyAtAll + +happyReduce_118 = happySpecReduce_2 49 happyReduction_118 +happyReduction_118 + (HappyAbsSyn40 happy_var_2) + (HappyTerminal happy_var_1) = + HappyAbsSyn42 + ( uncurry (TypeInt () (Just happy_var_1)) (second negate happy_var_2) + ) +happyReduction_118 _ _ = notHappyAtAll + +happyReduce_119 = happySpecReduce_1 50 happyReduction_119 +happyReduction_119 (HappyAbsSyn42 happy_var_1) = + HappyAbsSyn42 + ( happy_var_1 + ) +happyReduction_119 _ = notHappyAtAll + +happyReduce_120 = happySpecReduce_2 50 happyReduction_120 +happyReduction_120 + (HappyAbsSyn42 happy_var_2) + (HappyAbsSyn42 happy_var_1) = + HappyAbsSyn42 + ( TypeApp () happy_var_1 happy_var_2 + ) +happyReduction_120 _ _ = notHappyAtAll + +happyReduce_121 = happySpecReduce_1 51 happyReduction_121 +happyReduction_121 (HappyTerminal happy_var_1) = + HappyAbsSyn42 + ( TypeWildcard () happy_var_1 + ) +happyReduction_121 _ = notHappyAtAll + +happyReduce_122 = happySpecReduce_1 51 happyReduction_122 +happyReduction_122 (HappyAbsSyn30 happy_var_1) = + HappyAbsSyn42 + ( TypeVar () happy_var_1 + ) +happyReduction_122 _ = notHappyAtAll + +happyReduce_123 = happySpecReduce_1 51 happyReduction_123 +happyReduction_123 (HappyAbsSyn27 happy_var_1) = + HappyAbsSyn42 + ( TypeConstructor () (getQualifiedProperName happy_var_1) + ) +happyReduction_123 _ = notHappyAtAll + +happyReduce_124 = happySpecReduce_1 51 happyReduction_124 +happyReduction_124 (HappyAbsSyn31 happy_var_1) = + HappyAbsSyn42 + ( TypeOpName () (getQualifiedOpName happy_var_1) + ) +happyReduction_124 _ = notHappyAtAll + +happyReduce_125 = happySpecReduce_1 51 happyReduction_125 +happyReduction_125 (HappyAbsSyn37 happy_var_1) = + HappyAbsSyn42 + ( uncurry (TypeString ()) happy_var_1 + ) +happyReduction_125 _ = notHappyAtAll + +happyReduce_126 = happySpecReduce_1 51 happyReduction_126 +happyReduction_126 (HappyAbsSyn40 happy_var_1) = + HappyAbsSyn42 + ( uncurry (TypeInt () Nothing) happy_var_1 + ) +happyReduction_126 _ = notHappyAtAll + +happyReduce_127 = happySpecReduce_1 51 happyReduction_127 +happyReduction_127 (HappyAbsSyn30 happy_var_1) = + HappyAbsSyn42 + ( TypeHole () happy_var_1 + ) +happyReduction_127 _ = notHappyAtAll + +happyReduce_128 = happySpecReduce_1 51 happyReduction_128 +happyReduction_128 (HappyTerminal happy_var_1) = + HappyAbsSyn42 + ( TypeArrName () happy_var_1 + ) +happyReduction_128 _ = notHappyAtAll + +happyReduce_129 = happySpecReduce_3 51 happyReduction_129 +happyReduction_129 + (HappyTerminal happy_var_3) + (HappyAbsSyn53 happy_var_2) + (HappyTerminal happy_var_1) = + HappyAbsSyn42 + ( TypeRecord () (Wrapped happy_var_1 happy_var_2 happy_var_3) + ) +happyReduction_129 _ _ _ = notHappyAtAll + +happyReduce_130 = happySpecReduce_3 51 happyReduction_130 +happyReduction_130 + (HappyTerminal happy_var_3) + (HappyAbsSyn53 happy_var_2) + (HappyTerminal happy_var_1) = + HappyAbsSyn42 + ( TypeRow () (Wrapped happy_var_1 happy_var_2 happy_var_3) + ) +happyReduction_130 _ _ _ = notHappyAtAll + +happyReduce_131 = happySpecReduce_3 51 happyReduction_131 +happyReduction_131 + (HappyTerminal happy_var_3) + (HappyAbsSyn42 happy_var_2) + (HappyTerminal happy_var_1) = + HappyAbsSyn42 + ( TypeParens () (Wrapped happy_var_1 happy_var_2 happy_var_3) + ) +happyReduction_131 _ _ _ = notHappyAtAll + +happyReduce_132 = happyReduce 5 51 happyReduction_132 +happyReduction_132 + ( (HappyTerminal happy_var_5) + `HappyStk` (HappyAbsSyn42 happy_var_4) + `HappyStk` (HappyTerminal happy_var_3) + `HappyStk` (HappyAbsSyn42 happy_var_2) + `HappyStk` (HappyTerminal happy_var_1) + `HappyStk` happyRest + ) = + HappyAbsSyn42 + ( TypeParens () (Wrapped happy_var_1 (TypeKinded () happy_var_2 happy_var_3 happy_var_4) happy_var_5) + ) + `HappyStk` happyRest + +happyReduce_133 = happySpecReduce_1 52 happyReduction_133 +happyReduction_133 (HappyTerminal happy_var_1) = + HappyAbsSyn42 + ( TypeWildcard () happy_var_1 + ) +happyReduction_133 _ = notHappyAtAll + +happyReduce_134 = happySpecReduce_1 52 happyReduction_134 +happyReduction_134 (HappyAbsSyn27 happy_var_1) = + HappyAbsSyn42 + ( TypeConstructor () (getQualifiedProperName happy_var_1) + ) +happyReduction_134 _ = notHappyAtAll + +happyReduce_135 = happySpecReduce_1 52 happyReduction_135 +happyReduction_135 (HappyAbsSyn31 happy_var_1) = + HappyAbsSyn42 + ( TypeOpName () (getQualifiedOpName happy_var_1) + ) +happyReduction_135 _ = notHappyAtAll + +happyReduce_136 = happySpecReduce_1 52 happyReduction_136 +happyReduction_136 (HappyAbsSyn40 happy_var_1) = + HappyAbsSyn42 + ( uncurry (TypeInt () Nothing) happy_var_1 + ) +happyReduction_136 _ = notHappyAtAll + +happyReduce_137 = happySpecReduce_1 52 happyReduction_137 +happyReduction_137 (HappyAbsSyn30 happy_var_1) = + HappyAbsSyn42 + ( TypeHole () happy_var_1 + ) +happyReduction_137 _ = notHappyAtAll + +happyReduce_138 = happySpecReduce_3 52 happyReduction_138 +happyReduction_138 + (HappyTerminal happy_var_3) + (HappyAbsSyn53 happy_var_2) + (HappyTerminal happy_var_1) = + HappyAbsSyn42 + ( TypeRecord () (Wrapped happy_var_1 happy_var_2 happy_var_3) + ) +happyReduction_138 _ _ _ = notHappyAtAll + +happyReduce_139 = happySpecReduce_3 52 happyReduction_139 +happyReduction_139 + (HappyTerminal happy_var_3) + (HappyAbsSyn53 happy_var_2) + (HappyTerminal happy_var_1) = + HappyAbsSyn42 + ( TypeRow () (Wrapped happy_var_1 happy_var_2 happy_var_3) + ) +happyReduction_139 _ _ _ = notHappyAtAll + +happyReduce_140 = happySpecReduce_3 52 happyReduction_140 +happyReduction_140 + (HappyTerminal happy_var_3) + (HappyAbsSyn42 happy_var_2) + (HappyTerminal happy_var_1) = + HappyAbsSyn42 + ( TypeParens () (Wrapped happy_var_1 happy_var_2 happy_var_3) + ) +happyReduction_140 _ _ _ = notHappyAtAll + +happyReduce_141 = happyReduce 5 52 happyReduction_141 +happyReduction_141 + ( (HappyTerminal happy_var_5) + `HappyStk` (HappyAbsSyn42 happy_var_4) + `HappyStk` (HappyTerminal happy_var_3) + `HappyStk` (HappyAbsSyn42 happy_var_2) + `HappyStk` (HappyTerminal happy_var_1) + `HappyStk` happyRest + ) = + HappyAbsSyn42 + ( TypeParens () (Wrapped happy_var_1 (TypeKinded () happy_var_2 happy_var_3 happy_var_4) happy_var_5) + ) + `HappyStk` happyRest + +happyReduce_142 = happySpecReduce_0 53 happyReduction_142 +happyReduction_142 = + HappyAbsSyn53 + ( Row Nothing Nothing + ) + +happyReduce_143 = happySpecReduce_2 53 happyReduction_143 +happyReduction_143 + (HappyAbsSyn42 happy_var_2) + (HappyTerminal happy_var_1) = + HappyAbsSyn53 + ( Row Nothing (Just (happy_var_1, happy_var_2)) + ) +happyReduction_143 _ _ = notHappyAtAll + +happyReduce_144 = happySpecReduce_1 53 happyReduction_144 +happyReduction_144 (HappyAbsSyn163 happy_var_1) = + HappyAbsSyn53 + ( Row (Just happy_var_1) Nothing + ) +happyReduction_144 _ = notHappyAtAll + +happyReduce_145 = happySpecReduce_3 53 happyReduction_145 +happyReduction_145 + (HappyAbsSyn42 happy_var_3) + (HappyTerminal happy_var_2) + (HappyAbsSyn163 happy_var_1) = + HappyAbsSyn53 + ( Row (Just happy_var_1) (Just (happy_var_2, happy_var_3)) + ) +happyReduction_145 _ _ _ = notHappyAtAll + +happyReduce_146 = happySpecReduce_3 54 happyReduction_146 +happyReduction_146 + (HappyAbsSyn42 happy_var_3) + (HappyTerminal happy_var_2) + (HappyAbsSyn35 happy_var_1) = + HappyAbsSyn54 + ( Labeled happy_var_1 happy_var_2 happy_var_3 + ) +happyReduction_146 _ _ _ = notHappyAtAll + +happyReduce_147 = happySpecReduce_1 55 happyReduction_147 +happyReduction_147 (HappyAbsSyn30 happy_var_1) = + HappyAbsSyn55 + ( TypeVarName (Nothing, happy_var_1) + ) +happyReduction_147 _ = notHappyAtAll + +happyReduce_148 = happySpecReduce_2 55 happyReduction_148 +happyReduction_148 + (HappyAbsSyn30 happy_var_2) + (HappyTerminal happy_var_1) = + HappyAbsSyn55 + ( TypeVarName (Just happy_var_1, happy_var_2) + ) +happyReduction_148 _ _ = notHappyAtAll + +happyReduce_149 = happyMonadReduce 5 55 happyReduction_149 +happyReduction_149 + ( (HappyTerminal happy_var_5) + `HappyStk` (HappyAbsSyn42 happy_var_4) + `HappyStk` (HappyTerminal happy_var_3) + `HappyStk` (HappyAbsSyn30 happy_var_2) + `HappyStk` (HappyTerminal happy_var_1) + `HappyStk` happyRest + ) + tk = + happyThen + ( ((checkNoWildcards happy_var_4 *> pure (TypeVarKinded (Wrapped happy_var_1 (Labeled (Nothing, happy_var_2) happy_var_3 happy_var_4) happy_var_5)))) + ) + (\r -> happyReturn (HappyAbsSyn55 r)) + +happyReduce_150 = happyMonadReduce 6 55 happyReduction_150 +happyReduction_150 + ( (HappyTerminal happy_var_6) + `HappyStk` (HappyAbsSyn42 happy_var_5) + `HappyStk` (HappyTerminal happy_var_4) + `HappyStk` (HappyAbsSyn30 happy_var_3) + `HappyStk` (HappyTerminal happy_var_2) + `HappyStk` (HappyTerminal happy_var_1) + `HappyStk` happyRest + ) + tk = + happyThen + ( ((checkNoWildcards happy_var_5 *> pure (TypeVarKinded (Wrapped happy_var_1 (Labeled (Just happy_var_2, happy_var_3) happy_var_4 happy_var_5) happy_var_6)))) + ) + (\r -> happyReturn (HappyAbsSyn55 r)) + +happyReduce_151 = happySpecReduce_1 56 happyReduction_151 +happyReduction_151 (HappyAbsSyn30 happy_var_1) = + HappyAbsSyn55 + ( TypeVarName (Nothing, happy_var_1) + ) +happyReduction_151 _ = notHappyAtAll + +happyReduce_152 = happyMonadReduce 5 56 happyReduction_152 +happyReduction_152 + ( (HappyTerminal happy_var_5) + `HappyStk` (HappyAbsSyn42 happy_var_4) + `HappyStk` (HappyTerminal happy_var_3) + `HappyStk` (HappyAbsSyn30 happy_var_2) + `HappyStk` (HappyTerminal happy_var_1) + `HappyStk` happyRest + ) + tk = + happyThen + ( ((checkNoWildcards happy_var_4 *> pure (TypeVarKinded (Wrapped happy_var_1 (Labeled (Nothing, happy_var_2) happy_var_3 happy_var_4) happy_var_5)))) + ) + (\r -> happyReturn (HappyAbsSyn55 r)) + +happyReduce_153 = happySpecReduce_1 57 happyReduction_153 +happyReduction_153 (HappyTerminal happy_var_1) = + HappyAbsSyn57 + ( happy_var_1 + ) +happyReduction_153 _ = notHappyAtAll + +happyReduce_154 = happySpecReduce_1 57 happyReduction_154 +happyReduction_154 (HappyTerminal happy_var_1) = + HappyAbsSyn57 + ( happy_var_1 + ) +happyReduction_154 _ = notHappyAtAll + +happyReduce_155 = happySpecReduce_1 58 happyReduction_155 +happyReduction_155 (HappyAbsSyn59 happy_var_1) = + HappyAbsSyn58 + ( Where happy_var_1 Nothing + ) +happyReduction_155 _ = notHappyAtAll + +happyReduce_156 = happyReduce 5 58 happyReduction_156 +happyReduction_156 + ( _ + `HappyStk` (HappyAbsSyn149 happy_var_4) + `HappyStk` _ + `HappyStk` (HappyTerminal happy_var_2) + `HappyStk` (HappyAbsSyn59 happy_var_1) + `HappyStk` happyRest + ) = + HappyAbsSyn58 + ( Where happy_var_1 (Just (happy_var_2, happy_var_4)) + ) + `HappyStk` happyRest + +happyReduce_157 = happySpecReduce_1 59 happyReduction_157 +happyReduction_157 (HappyAbsSyn59 happy_var_1) = + HappyAbsSyn59 + ( happy_var_1 + ) +happyReduction_157 _ = notHappyAtAll + +happyReduce_158 = happySpecReduce_3 59 happyReduction_158 +happyReduction_158 + (HappyAbsSyn42 happy_var_3) + (HappyTerminal happy_var_2) + (HappyAbsSyn59 happy_var_1) = + HappyAbsSyn59 + ( ExprTyped () happy_var_1 happy_var_2 happy_var_3 + ) +happyReduction_158 _ _ _ = notHappyAtAll + +happyReduce_159 = happySpecReduce_1 60 happyReduction_159 +happyReduction_159 (HappyAbsSyn59 happy_var_1) = + HappyAbsSyn59 + ( happy_var_1 + ) +happyReduction_159 _ = notHappyAtAll + +happyReduce_160 = happySpecReduce_3 60 happyReduction_160 +happyReduction_160 + (HappyAbsSyn59 happy_var_3) + (HappyAbsSyn31 happy_var_2) + (HappyAbsSyn59 happy_var_1) = + HappyAbsSyn59 + ( ExprOp () happy_var_1 (getQualifiedOpName happy_var_2) happy_var_3 + ) +happyReduction_160 _ _ _ = notHappyAtAll + +happyReduce_161 = happySpecReduce_1 61 happyReduction_161 +happyReduction_161 (HappyAbsSyn59 happy_var_1) = + HappyAbsSyn59 + ( happy_var_1 + ) +happyReduction_161 _ = notHappyAtAll + +happyReduce_162 = happyReduce 5 61 happyReduction_162 +happyReduction_162 + ( (HappyAbsSyn59 happy_var_5) + `HappyStk` (HappyTerminal happy_var_4) + `HappyStk` (HappyAbsSyn59 happy_var_3) + `HappyStk` (HappyTerminal happy_var_2) + `HappyStk` (HappyAbsSyn59 happy_var_1) + `HappyStk` happyRest + ) = + HappyAbsSyn59 + ( ExprInfix () happy_var_1 (Wrapped happy_var_2 happy_var_3 happy_var_4) happy_var_5 + ) + `HappyStk` happyRest + +happyReduce_163 = happySpecReduce_1 62 happyReduction_163 +happyReduction_163 (HappyAbsSyn59 happy_var_1) = + HappyAbsSyn59 + ( happy_var_1 + ) +happyReduction_163 _ = notHappyAtAll + +happyReduce_164 = happySpecReduce_3 62 happyReduction_164 +happyReduction_164 + (HappyAbsSyn59 happy_var_3) + (HappyAbsSyn31 happy_var_2) + (HappyAbsSyn59 happy_var_1) = + HappyAbsSyn59 + ( ExprOp () happy_var_1 (getQualifiedOpName happy_var_2) happy_var_3 + ) +happyReduction_164 _ _ _ = notHappyAtAll + +happyReduce_165 = happySpecReduce_1 63 happyReduction_165 +happyReduction_165 (HappyAbsSyn59 happy_var_1) = + HappyAbsSyn59 + ( happy_var_1 + ) +happyReduction_165 _ = notHappyAtAll + +happyReduce_166 = happySpecReduce_2 63 happyReduction_166 +happyReduction_166 + (HappyAbsSyn59 happy_var_2) + (HappyTerminal happy_var_1) = + HappyAbsSyn59 + ( ExprNegate () happy_var_1 happy_var_2 + ) +happyReduction_166 _ _ = notHappyAtAll + +happyReduce_167 = happySpecReduce_1 64 happyReduction_167 +happyReduction_167 (HappyAbsSyn59 happy_var_1) = + HappyAbsSyn59 + ( happy_var_1 + ) +happyReduction_167 _ = notHappyAtAll + +happyReduce_168 = happySpecReduce_2 64 happyReduction_168 +happyReduction_168 + (HappyAbsSyn59 happy_var_2) + (HappyAbsSyn59 happy_var_1) = + HappyAbsSyn59 + ( -- Record application/updates can introduce a function application + -- associated to the right, so we need to correct it. + case happy_var_2 of + ExprApp _ lhs rhs -> + ExprApp () (ExprApp () happy_var_1 lhs) rhs + _ -> ExprApp () happy_var_1 happy_var_2 + ) +happyReduction_168 _ _ = notHappyAtAll + +happyReduce_169 = happySpecReduce_3 64 happyReduction_169 +happyReduction_169 + (HappyAbsSyn42 happy_var_3) + (HappyTerminal happy_var_2) + (HappyAbsSyn59 happy_var_1) = + HappyAbsSyn59 + ( ExprVisibleTypeApp () happy_var_1 happy_var_2 happy_var_3 + ) +happyReduction_169 _ _ _ = notHappyAtAll + +happyReduce_170 = happySpecReduce_1 65 happyReduction_170 +happyReduction_170 (HappyAbsSyn59 happy_var_1) = + HappyAbsSyn59 + ( happy_var_1 + ) +happyReduction_170 _ = notHappyAtAll + +happyReduce_171 = happyReduce 6 65 happyReduction_171 +happyReduction_171 + ( (HappyAbsSyn59 happy_var_6) + `HappyStk` (HappyTerminal happy_var_5) + `HappyStk` (HappyAbsSyn59 happy_var_4) + `HappyStk` (HappyTerminal happy_var_3) + `HappyStk` (HappyAbsSyn59 happy_var_2) + `HappyStk` (HappyTerminal happy_var_1) + `HappyStk` happyRest + ) = + HappyAbsSyn59 + ( ExprIf () (IfThenElse happy_var_1 happy_var_2 happy_var_3 happy_var_4 happy_var_5 happy_var_6) + ) + `HappyStk` happyRest + +happyReduce_172 = happySpecReduce_1 65 happyReduction_172 +happyReduction_172 (HappyAbsSyn78 happy_var_1) = + HappyAbsSyn59 + ( ExprDo () happy_var_1 + ) +happyReduction_172 _ = notHappyAtAll + +happyReduce_173 = happySpecReduce_3 65 happyReduction_173 +happyReduction_173 + (HappyAbsSyn59 happy_var_3) + (HappyTerminal happy_var_2) + (HappyAbsSyn79 happy_var_1) = + HappyAbsSyn59 + ( ExprAdo () $ uncurry AdoBlock happy_var_1 happy_var_2 happy_var_3 + ) +happyReduction_173 _ _ _ = notHappyAtAll + +happyReduce_174 = happyReduce 4 65 happyReduction_174 +happyReduction_174 + ( (HappyAbsSyn59 happy_var_4) + `HappyStk` (HappyTerminal happy_var_3) + `HappyStk` (HappyAbsSyn136 happy_var_2) + `HappyStk` (HappyTerminal happy_var_1) + `HappyStk` happyRest + ) = + HappyAbsSyn59 + ( ExprLambda () (Lambda happy_var_1 happy_var_2 happy_var_3 happy_var_4) + ) + `HappyStk` happyRest + +happyReduce_175 = happyReduce 6 65 happyReduction_175 +happyReduction_175 + ( (HappyAbsSyn59 happy_var_6) + `HappyStk` (HappyTerminal happy_var_5) + `HappyStk` _ + `HappyStk` (HappyAbsSyn149 happy_var_3) + `HappyStk` _ + `HappyStk` (HappyTerminal happy_var_1) + `HappyStk` happyRest + ) = + HappyAbsSyn59 + ( ExprLet () (LetIn happy_var_1 happy_var_3 happy_var_5 happy_var_6) + ) + `HappyStk` happyRest + +happyReduce_176 = happyReduce 6 65 happyReduction_176 +happyReduction_176 + ( _ + `HappyStk` (HappyAbsSyn146 happy_var_5) + `HappyStk` _ + `HappyStk` (HappyTerminal happy_var_3) + `HappyStk` (HappyAbsSyn156 happy_var_2) + `HappyStk` (HappyTerminal happy_var_1) + `HappyStk` happyRest + ) = + HappyAbsSyn59 + ( ExprCase () (CaseOf happy_var_1 happy_var_2 happy_var_3 happy_var_5) + ) + `HappyStk` happyRest + +happyReduce_177 = happyMonadReduce 8 65 happyReduction_177 +happyReduction_177 + ( (HappyAbsSyn58 happy_var_8) + `HappyStk` _ + `HappyStk` (HappyTerminal happy_var_6) + `HappyStk` (HappyAbsSyn151 happy_var_5) + `HappyStk` _ + `HappyStk` (HappyTerminal happy_var_3) + `HappyStk` (HappyAbsSyn156 happy_var_2) + `HappyStk` (HappyTerminal happy_var_1) + `HappyStk` happyRest + ) + tk = + happyThen + ( ((addWarning (let (a, b) = whereRange happy_var_8 in [a, b]) WarnDeprecatedCaseOfOffsideSyntax *> pure (ExprCase () (CaseOf happy_var_1 happy_var_2 happy_var_3 (pure (happy_var_5, Unconditional happy_var_6 happy_var_8)))))) + ) + (\r -> happyReturn (HappyAbsSyn59 r)) + +happyReduce_178 = happyMonadReduce 7 65 happyReduction_178 +happyReduction_178 + ( (HappyAbsSyn74 happy_var_7) + `HappyStk` _ + `HappyStk` (HappyAbsSyn151 happy_var_5) + `HappyStk` _ + `HappyStk` (HappyTerminal happy_var_3) + `HappyStk` (HappyAbsSyn156 happy_var_2) + `HappyStk` (HappyTerminal happy_var_1) + `HappyStk` happyRest + ) + tk = + happyThen + ( ((addWarning (let (a, b) = guardedRange happy_var_7 in [a, b]) WarnDeprecatedCaseOfOffsideSyntax *> pure (ExprCase () (CaseOf happy_var_1 happy_var_2 happy_var_3 (pure (happy_var_5, happy_var_7)))))) + ) + (\r -> happyReturn (HappyAbsSyn59 r)) + +happyReduce_179 = happySpecReduce_1 66 happyReduction_179 +happyReduction_179 (HappyAbsSyn59 happy_var_1) = + HappyAbsSyn59 + ( happy_var_1 + ) +happyReduction_179 _ = notHappyAtAll + +happyReduce_180 = happySpecReduce_3 66 happyReduction_180 +happyReduction_180 + (HappyTerminal happy_var_3) + (HappyTerminal happy_var_2) + (HappyAbsSyn59 happy_var_1) = + HappyAbsSyn59 + ( ExprApp () happy_var_1 (ExprRecord () (Wrapped happy_var_2 Nothing happy_var_3)) + ) +happyReduction_180 _ _ _ = notHappyAtAll + +happyReduce_181 = happyMonadReduce 4 66 happyReduction_181 +happyReduction_181 + ( (HappyTerminal happy_var_4) + `HappyStk` (HappyAbsSyn162 happy_var_3) + `HappyStk` (HappyTerminal happy_var_2) + `HappyStk` (HappyAbsSyn59 happy_var_1) + `HappyStk` happyRest + ) + tk = + happyThen + ( ( ( toRecordFields happy_var_3 >>= \case + Left xs -> pure $ ExprApp () happy_var_1 (ExprRecord () (Wrapped happy_var_2 (Just xs) happy_var_4)) + Right xs -> pure $ ExprRecordUpdate () happy_var_1 (Wrapped happy_var_2 xs happy_var_4) + ) + ) + ) + (\r -> happyReturn (HappyAbsSyn59 r)) + +happyReduce_182 = happySpecReduce_1 67 happyReduction_182 +happyReduction_182 (HappyAbsSyn59 happy_var_1) = + HappyAbsSyn59 + ( happy_var_1 + ) +happyReduction_182 _ = notHappyAtAll + +happyReduce_183 = happySpecReduce_3 67 happyReduction_183 +happyReduction_183 + (HappyAbsSyn159 happy_var_3) + (HappyTerminal happy_var_2) + (HappyAbsSyn59 happy_var_1) = + HappyAbsSyn59 + ( ExprRecordAccessor () (RecordAccessor happy_var_1 happy_var_2 happy_var_3) + ) +happyReduction_183 _ _ _ = notHappyAtAll + +happyReduce_184 = happySpecReduce_1 68 happyReduction_184 +happyReduction_184 (HappyTerminal happy_var_1) = + HappyAbsSyn59 + ( ExprSection () happy_var_1 + ) +happyReduction_184 _ = notHappyAtAll + +happyReduce_185 = happySpecReduce_1 68 happyReduction_185 +happyReduction_185 (HappyAbsSyn30 happy_var_1) = + HappyAbsSyn59 + ( ExprHole () happy_var_1 + ) +happyReduction_185 _ = notHappyAtAll + +happyReduce_186 = happySpecReduce_1 68 happyReduction_186 +happyReduction_186 (HappyAbsSyn29 happy_var_1) = + HappyAbsSyn59 + ( ExprIdent () happy_var_1 + ) +happyReduction_186 _ = notHappyAtAll + +happyReduce_187 = happySpecReduce_1 68 happyReduction_187 +happyReduction_187 (HappyAbsSyn27 happy_var_1) = + HappyAbsSyn59 + ( ExprConstructor () (getQualifiedProperName happy_var_1) + ) +happyReduction_187 _ = notHappyAtAll + +happyReduce_188 = happySpecReduce_1 68 happyReduction_188 +happyReduction_188 (HappyAbsSyn31 happy_var_1) = + HappyAbsSyn59 + ( ExprOpName () (getQualifiedOpName happy_var_1) + ) +happyReduction_188 _ = notHappyAtAll + +happyReduce_189 = happySpecReduce_1 68 happyReduction_189 +happyReduction_189 (HappyAbsSyn41 happy_var_1) = + HappyAbsSyn59 + ( uncurry (ExprBoolean ()) happy_var_1 + ) +happyReduction_189 _ = notHappyAtAll + +happyReduce_190 = happySpecReduce_1 68 happyReduction_190 +happyReduction_190 (HappyAbsSyn38 happy_var_1) = + HappyAbsSyn59 + ( uncurry (ExprChar ()) happy_var_1 + ) +happyReduction_190 _ = notHappyAtAll + +happyReduce_191 = happySpecReduce_1 68 happyReduction_191 +happyReduction_191 (HappyAbsSyn37 happy_var_1) = + HappyAbsSyn59 + ( uncurry (ExprString ()) happy_var_1 + ) +happyReduction_191 _ = notHappyAtAll + +happyReduce_192 = happySpecReduce_1 68 happyReduction_192 +happyReduction_192 (HappyAbsSyn39 happy_var_1) = + HappyAbsSyn59 + ( uncurry (ExprNumber ()) happy_var_1 + ) +happyReduction_192 _ = notHappyAtAll + +happyReduce_193 = happySpecReduce_1 68 happyReduction_193 +happyReduction_193 (HappyAbsSyn133 happy_var_1) = + HappyAbsSyn59 + ( ExprList () happy_var_1 + ) +happyReduction_193 _ = notHappyAtAll + +happyReduce_194 = happySpecReduce_1 68 happyReduction_194 +happyReduction_194 (HappyAbsSyn135 happy_var_1) = + HappyAbsSyn59 + ( ExprRecord () happy_var_1 + ) +happyReduction_194 _ = notHappyAtAll + +happyReduce_195 = happySpecReduce_3 68 happyReduction_195 +happyReduction_195 + (HappyTerminal happy_var_3) + (HappyAbsSyn59 happy_var_2) + (HappyTerminal happy_var_1) = + HappyAbsSyn59 + ( ExprParens () (Wrapped happy_var_1 happy_var_2 happy_var_3) + ) +happyReduction_195 _ _ _ = notHappyAtAll + +happyReduce_196 = happyMonadReduce 1 69 happyReduction_196 +happyReduction_196 + ( (HappyAbsSyn35 happy_var_1) + `HappyStk` happyRest + ) + tk = + happyThen + ( ((fmap RecordPun . toName Ident $ lblTok happy_var_1)) + ) + (\r -> happyReturn (HappyAbsSyn69 r)) + +happyReduce_197 = happyMonadReduce 3 69 happyReduction_197 +happyReduction_197 + ( _ + `HappyStk` (HappyTerminal happy_var_2) + `HappyStk` (HappyAbsSyn35 happy_var_1) + `HappyStk` happyRest + ) + tk = + happyThen + ( ((addFailure [happy_var_2] ErrRecordUpdateInCtr *> pure (RecordPun $ unexpectedName $ lblTok happy_var_1))) + ) + (\r -> happyReturn (HappyAbsSyn69 r)) + +happyReduce_198 = happySpecReduce_3 69 happyReduction_198 +happyReduction_198 + (HappyAbsSyn59 happy_var_3) + (HappyTerminal happy_var_2) + (HappyAbsSyn35 happy_var_1) = + HappyAbsSyn69 + ( RecordField happy_var_1 happy_var_2 happy_var_3 + ) +happyReduction_198 _ _ _ = notHappyAtAll + +happyReduce_199 = happySpecReduce_3 70 happyReduction_199 +happyReduction_199 + (HappyAbsSyn59 happy_var_3) + (HappyTerminal happy_var_2) + (HappyAbsSyn35 happy_var_1) = + HappyAbsSyn70 + ( Left (RecordField happy_var_1 happy_var_2 happy_var_3) + ) +happyReduction_199 _ _ _ = notHappyAtAll + +happyReduce_200 = happyMonadReduce 1 70 happyReduction_200 +happyReduction_200 + ( (HappyAbsSyn35 happy_var_1) + `HappyStk` happyRest + ) + tk = + happyThen + ( ((fmap (Left . RecordPun) . toName Ident $ lblTok happy_var_1)) + ) + (\r -> happyReturn (HappyAbsSyn70 r)) + +happyReduce_201 = happySpecReduce_3 70 happyReduction_201 +happyReduction_201 + (HappyAbsSyn59 happy_var_3) + (HappyTerminal happy_var_2) + (HappyAbsSyn35 happy_var_1) = + HappyAbsSyn70 + ( Right (RecordUpdateLeaf happy_var_1 happy_var_2 happy_var_3) + ) +happyReduction_201 _ _ _ = notHappyAtAll + +happyReduce_202 = happyReduce 4 70 happyReduction_202 +happyReduction_202 + ( (HappyTerminal happy_var_4) + `HappyStk` (HappyAbsSyn161 happy_var_3) + `HappyStk` (HappyTerminal happy_var_2) + `HappyStk` (HappyAbsSyn35 happy_var_1) + `HappyStk` happyRest + ) = + HappyAbsSyn70 + ( Right (RecordUpdateBranch happy_var_1 (Wrapped happy_var_2 happy_var_3 happy_var_4)) + ) + `HappyStk` happyRest + +happyReduce_203 = happySpecReduce_3 71 happyReduction_203 +happyReduction_203 + (HappyAbsSyn59 happy_var_3) + (HappyTerminal happy_var_2) + (HappyAbsSyn35 happy_var_1) = + HappyAbsSyn71 + ( RecordUpdateLeaf happy_var_1 happy_var_2 happy_var_3 + ) +happyReduction_203 _ _ _ = notHappyAtAll + +happyReduce_204 = happyReduce 4 71 happyReduction_204 +happyReduction_204 + ( (HappyTerminal happy_var_4) + `HappyStk` (HappyAbsSyn161 happy_var_3) + `HappyStk` (HappyTerminal happy_var_2) + `HappyStk` (HappyAbsSyn35 happy_var_1) + `HappyStk` happyRest + ) = + HappyAbsSyn71 + ( RecordUpdateBranch happy_var_1 (Wrapped happy_var_2 happy_var_3 happy_var_4) + ) + `HappyStk` happyRest + +happyReduce_205 = happySpecReduce_3 72 happyReduction_205 +happyReduction_205 + (HappyAbsSyn42 happy_var_3) + (HappyTerminal happy_var_2) + (HappyAbsSyn30 happy_var_1) = + HappyAbsSyn72 + ( LetBindingSignature () (Labeled happy_var_1 happy_var_2 happy_var_3) + ) +happyReduction_205 _ _ _ = notHappyAtAll + +happyReduce_206 = happySpecReduce_2 72 happyReduction_206 +happyReduction_206 + (HappyAbsSyn74 happy_var_2) + (HappyAbsSyn30 happy_var_1) = + HappyAbsSyn72 + ( LetBindingName () (ValueBindingFields happy_var_1 [] happy_var_2) + ) +happyReduction_206 _ _ = notHappyAtAll + +happyReduce_207 = happySpecReduce_3 72 happyReduction_207 +happyReduction_207 + (HappyAbsSyn74 happy_var_3) + (HappyAbsSyn136 happy_var_2) + (HappyAbsSyn30 happy_var_1) = + HappyAbsSyn72 + ( LetBindingName () (ValueBindingFields happy_var_1 (NE.toList happy_var_2) happy_var_3) + ) +happyReduction_207 _ _ _ = notHappyAtAll + +happyReduce_208 = happySpecReduce_3 72 happyReduction_208 +happyReduction_208 + (HappyAbsSyn58 happy_var_3) + (HappyTerminal happy_var_2) + (HappyAbsSyn88 happy_var_1) = + HappyAbsSyn72 + ( LetBindingPattern () happy_var_1 happy_var_2 happy_var_3 + ) +happyReduction_208 _ _ _ = notHappyAtAll + +happyReduce_209 = happySpecReduce_2 73 happyReduction_209 +happyReduction_209 + (HappyAbsSyn74 happy_var_2) + (HappyAbsSyn151 happy_var_1) = + HappyAbsSyn73 + ( (happy_var_1, happy_var_2) + ) +happyReduction_209 _ _ = notHappyAtAll + +happyReduce_210 = happySpecReduce_2 74 happyReduction_210 +happyReduction_210 + (HappyAbsSyn58 happy_var_2) + (HappyTerminal happy_var_1) = + HappyAbsSyn74 + ( Unconditional happy_var_1 happy_var_2 + ) +happyReduction_210 _ _ = notHappyAtAll + +happyReduce_211 = happySpecReduce_1 74 happyReduction_211 +happyReduction_211 (HappyAbsSyn137 happy_var_1) = + HappyAbsSyn74 + ( Guarded happy_var_1 + ) +happyReduction_211 _ = notHappyAtAll + +happyReduce_212 = happySpecReduce_3 75 happyReduction_212 +happyReduction_212 + (HappyAbsSyn58 happy_var_3) + (HappyTerminal happy_var_2) + (HappyAbsSyn83 happy_var_1) = + HappyAbsSyn75 + ( uncurry GuardedExpr happy_var_1 happy_var_2 happy_var_3 + ) +happyReduction_212 _ _ _ = notHappyAtAll + +happyReduce_213 = happySpecReduce_2 76 happyReduction_213 +happyReduction_213 + (HappyAbsSyn58 happy_var_2) + (HappyTerminal happy_var_1) = + HappyAbsSyn74 + ( Unconditional happy_var_1 happy_var_2 + ) +happyReduction_213 _ _ = notHappyAtAll + +happyReduce_214 = happySpecReduce_1 76 happyReduction_214 +happyReduction_214 (HappyAbsSyn137 happy_var_1) = + HappyAbsSyn74 + ( Guarded happy_var_1 + ) +happyReduction_214 _ = notHappyAtAll + +happyReduce_215 = happySpecReduce_3 77 happyReduction_215 +happyReduction_215 + (HappyAbsSyn58 happy_var_3) + (HappyTerminal happy_var_2) + (HappyAbsSyn83 happy_var_1) = + HappyAbsSyn75 + ( uncurry GuardedExpr happy_var_1 happy_var_2 happy_var_3 + ) +happyReduction_215 _ _ _ = notHappyAtAll + +happyReduce_216 = happyMonad2Reduce 2 78 happyReduction_216 +happyReduction_216 + ( (HappyTerminal happy_var_2) + `HappyStk` (HappyTerminal happy_var_1) + `HappyStk` happyRest + ) + tk = + happyThen + ( ( ( revert $ do + res <- parseDoStatement + when (null res) $ addFailure [happy_var_2] ErrEmptyDo + pure $ DoBlock happy_var_1 $ NE.fromList res + ) + ) + tk + ) + (\r -> happyReturn (HappyAbsSyn78 r)) + +happyReduce_217 = happySpecReduce_3 79 happyReduction_217 +happyReduction_217 + _ + _ + (HappyTerminal happy_var_1) = + HappyAbsSyn79 + ( (happy_var_1, []) + ) +happyReduction_217 _ _ _ = notHappyAtAll + +happyReduce_218 = happyMonad2Reduce 2 79 happyReduction_218 +happyReduction_218 + ( _ + `HappyStk` (HappyTerminal happy_var_1) + `HappyStk` happyRest + ) + tk = + happyThen + ( ((revert $ fmap (happy_var_1,) parseDoStatement)) tk + ) + (\r -> happyReturn (HappyAbsSyn79 r)) + +happyReduce_219 = happyMonadReduce 4 80 happyReduction_219 +happyReduction_219 + ( _ + `HappyStk` (HappyAbsSyn149 happy_var_3) + `HappyStk` _ + `HappyStk` (HappyTerminal happy_var_1) + `HappyStk` happyRest + ) + tk = + happyThen + ( ((revert $ fmap (DoLet happy_var_1 happy_var_3 :) parseDoNext)) tk + ) + (\r -> happyReturn (HappyAbsSyn80 r)) + +happyReduce_220 = happyMonadReduce 0 80 happyReduction_220 +happyReduction_220 (happyRest) tk = + happyThen + ( ( ( revert $ do + stmt <- tryPrefix parseBinderAndArrow parseDoExpr + let + ctr = case stmt of + (Just (binder, sep), expr) -> + (DoBind binder sep expr :) + (Nothing, expr) -> + (DoDiscard expr :) + fmap ctr parseDoNext + ) + ) + tk + ) + (\r -> happyReturn (HappyAbsSyn80 r)) + +happyReduce_221 = happyMonadReduce 1 81 happyReduction_221 +happyReduction_221 + ( (HappyAbsSyn59 happy_var_1) + `HappyStk` happyRest + ) + tk = + happyThen + ( ((revert $ pure happy_var_1)) tk + ) + (\r -> happyReturn (HappyAbsSyn59 r)) + +happyReduce_222 = happyMonadReduce 1 82 happyReduction_222 +happyReduction_222 + ( _ + `HappyStk` happyRest + ) + tk = + happyThen + ( ((revert parseDoStatement)) tk + ) + (\r -> happyReturn (HappyAbsSyn80 r)) + +happyReduce_223 = happyMonadReduce 1 82 happyReduction_223 +happyReduction_223 + ( _ + `HappyStk` happyRest + ) + tk = + happyThen + ( ((revert $ pure [])) tk + ) + (\r -> happyReturn (HappyAbsSyn80 r)) + +happyReduce_224 = happyMonad2Reduce 1 83 happyReduction_224 +happyReduction_224 + ( (HappyTerminal happy_var_1) + `HappyStk` happyRest + ) + tk = + happyThen + ( ((revert $ fmap ((happy_var_1,) . uncurry Separated) parseGuardStatement)) tk + ) + (\r -> happyReturn (HappyAbsSyn83 r)) + +happyReduce_225 = happyMonadReduce 0 84 happyReduction_225 +happyReduction_225 (happyRest) tk = + happyThen + ( ( ( revert $ do + grd <- fmap (uncurry PatternGuard) $ tryPrefix parseBinderAndArrow parseGuardExpr + fmap (grd,) parseGuardNext + ) + ) + tk + ) + (\r -> happyReturn (HappyAbsSyn84 r)) + +happyReduce_226 = happyMonadReduce 1 85 happyReduction_226 +happyReduction_226 + ( (HappyAbsSyn59 happy_var_1) + `HappyStk` happyRest + ) + tk = + happyThen + ( ((revert $ pure happy_var_1)) tk + ) + (\r -> happyReturn (HappyAbsSyn85 r)) + +happyReduce_227 = happyMonadReduce 1 86 happyReduction_227 +happyReduction_227 + ( (HappyTerminal happy_var_1) + `HappyStk` happyRest + ) + tk = + happyThen + ( ((revert $ fmap (\(g, gs) -> (happy_var_1, g) : gs) parseGuardStatement)) tk + ) + (\r -> happyReturn (HappyAbsSyn86 r)) + +happyReduce_228 = happyMonadReduce 0 86 happyReduction_228 +happyReduction_228 (happyRest) tk = + happyThen + ( ((revert $ pure [])) tk + ) + (\r -> happyReturn (HappyAbsSyn86 r)) + +happyReduce_229 = happyMonadReduce 2 87 happyReduction_229 +happyReduction_229 + ( (HappyTerminal happy_var_2) + `HappyStk` (HappyAbsSyn88 happy_var_1) + `HappyStk` happyRest + ) + tk = + happyThen + ( ((revert $ pure (happy_var_1, happy_var_2))) tk + ) + (\r -> happyReturn (HappyAbsSyn87 r)) + +happyReduce_230 = happySpecReduce_1 88 happyReduction_230 +happyReduction_230 (HappyAbsSyn88 happy_var_1) = + HappyAbsSyn88 + ( happy_var_1 + ) +happyReduction_230 _ = notHappyAtAll + +happyReduce_231 = happySpecReduce_3 88 happyReduction_231 +happyReduction_231 + (HappyAbsSyn42 happy_var_3) + (HappyTerminal happy_var_2) + (HappyAbsSyn88 happy_var_1) = + HappyAbsSyn88 + ( BinderTyped () happy_var_1 happy_var_2 happy_var_3 + ) +happyReduction_231 _ _ _ = notHappyAtAll + +happyReduce_232 = happySpecReduce_1 89 happyReduction_232 +happyReduction_232 (HappyAbsSyn88 happy_var_1) = + HappyAbsSyn88 + ( happy_var_1 + ) +happyReduction_232 _ = notHappyAtAll + +happyReduce_233 = happySpecReduce_3 89 happyReduction_233 +happyReduction_233 + (HappyAbsSyn88 happy_var_3) + (HappyAbsSyn31 happy_var_2) + (HappyAbsSyn88 happy_var_1) = + HappyAbsSyn88 + ( BinderOp () happy_var_1 (getQualifiedOpName happy_var_2) happy_var_3 + ) +happyReduction_233 _ _ _ = notHappyAtAll + +happyReduce_234 = happyMonadReduce 1 90 happyReduction_234 +happyReduction_234 + ( (HappyAbsSyn136 happy_var_1) + `HappyStk` happyRest + ) + tk = + happyThen + ( ((toBinderConstructor happy_var_1)) + ) + (\r -> happyReturn (HappyAbsSyn88 r)) + +happyReduce_235 = happySpecReduce_2 90 happyReduction_235 +happyReduction_235 + (HappyAbsSyn39 happy_var_2) + (HappyTerminal happy_var_1) = + HappyAbsSyn88 + ( uncurry (BinderNumber () (Just happy_var_1)) happy_var_2 + ) +happyReduction_235 _ _ = notHappyAtAll + +happyReduce_236 = happySpecReduce_1 91 happyReduction_236 +happyReduction_236 (HappyTerminal happy_var_1) = + HappyAbsSyn88 + ( BinderWildcard () happy_var_1 + ) +happyReduction_236 _ = notHappyAtAll + +happyReduce_237 = happySpecReduce_1 91 happyReduction_237 +happyReduction_237 (HappyAbsSyn30 happy_var_1) = + HappyAbsSyn88 + ( BinderVar () happy_var_1 + ) +happyReduction_237 _ = notHappyAtAll + +happyReduce_238 = happySpecReduce_3 91 happyReduction_238 +happyReduction_238 + (HappyAbsSyn88 happy_var_3) + (HappyTerminal happy_var_2) + (HappyAbsSyn30 happy_var_1) = + HappyAbsSyn88 + ( BinderNamed () happy_var_1 happy_var_2 happy_var_3 + ) +happyReduction_238 _ _ _ = notHappyAtAll + +happyReduce_239 = happySpecReduce_1 91 happyReduction_239 +happyReduction_239 (HappyAbsSyn27 happy_var_1) = + HappyAbsSyn88 + ( BinderConstructor () (getQualifiedProperName happy_var_1) [] + ) +happyReduction_239 _ = notHappyAtAll + +happyReduce_240 = happySpecReduce_1 91 happyReduction_240 +happyReduction_240 (HappyAbsSyn41 happy_var_1) = + HappyAbsSyn88 + ( uncurry (BinderBoolean ()) happy_var_1 + ) +happyReduction_240 _ = notHappyAtAll + +happyReduce_241 = happySpecReduce_1 91 happyReduction_241 +happyReduction_241 (HappyAbsSyn38 happy_var_1) = + HappyAbsSyn88 + ( uncurry (BinderChar ()) happy_var_1 + ) +happyReduction_241 _ = notHappyAtAll + +happyReduce_242 = happySpecReduce_1 91 happyReduction_242 +happyReduction_242 (HappyAbsSyn37 happy_var_1) = + HappyAbsSyn88 + ( uncurry (BinderString ()) happy_var_1 + ) +happyReduction_242 _ = notHappyAtAll + +happyReduce_243 = happySpecReduce_1 91 happyReduction_243 +happyReduction_243 (HappyAbsSyn39 happy_var_1) = + HappyAbsSyn88 + ( uncurry (BinderNumber () Nothing) happy_var_1 + ) +happyReduction_243 _ = notHappyAtAll + +happyReduce_244 = happySpecReduce_1 91 happyReduction_244 +happyReduction_244 (HappyAbsSyn132 happy_var_1) = + HappyAbsSyn88 + ( BinderList () happy_var_1 + ) +happyReduction_244 _ = notHappyAtAll + +happyReduce_245 = happySpecReduce_1 91 happyReduction_245 +happyReduction_245 (HappyAbsSyn134 happy_var_1) = + HappyAbsSyn88 + ( BinderRecord () happy_var_1 + ) +happyReduction_245 _ = notHappyAtAll + +happyReduce_246 = happySpecReduce_3 91 happyReduction_246 +happyReduction_246 + (HappyTerminal happy_var_3) + (HappyAbsSyn88 happy_var_2) + (HappyTerminal happy_var_1) = + HappyAbsSyn88 + ( BinderParens () (Wrapped happy_var_1 happy_var_2 happy_var_3) + ) +happyReduction_246 _ _ _ = notHappyAtAll + +happyReduce_247 = happyMonadReduce 1 92 happyReduction_247 +happyReduction_247 + ( (HappyAbsSyn35 happy_var_1) + `HappyStk` happyRest + ) + tk = + happyThen + ( ((fmap RecordPun . toName Ident $ lblTok happy_var_1)) + ) + (\r -> happyReturn (HappyAbsSyn92 r)) + +happyReduce_248 = happyMonadReduce 3 92 happyReduction_248 +happyReduction_248 + ( _ + `HappyStk` (HappyTerminal happy_var_2) + `HappyStk` (HappyAbsSyn35 happy_var_1) + `HappyStk` happyRest + ) + tk = + happyThen + ( ((addFailure [happy_var_2] ErrRecordUpdateInCtr *> pure (RecordPun $ unexpectedName $ lblTok happy_var_1))) + ) + (\r -> happyReturn (HappyAbsSyn92 r)) + +happyReduce_249 = happySpecReduce_3 92 happyReduction_249 +happyReduction_249 + (HappyAbsSyn88 happy_var_3) + (HappyTerminal happy_var_2) + (HappyAbsSyn35 happy_var_1) = + HappyAbsSyn92 + ( RecordField happy_var_1 happy_var_2 happy_var_3 + ) +happyReduction_249 _ _ _ = notHappyAtAll + +happyReduce_250 = happyReduce 6 93 happyReduction_250 +happyReduction_250 + ( (HappyAbsSyn95 happy_var_6) + `HappyStk` _ + `HappyStk` (HappyTerminal happy_var_4) + `HappyStk` (HappyAbsSyn100 happy_var_3) + `HappyStk` (HappyAbsSyn26 happy_var_2) + `HappyStk` (HappyTerminal happy_var_1) + `HappyStk` happyRest + ) = + HappyAbsSyn93 + ( (Module () happy_var_1 happy_var_2 happy_var_3 happy_var_4 happy_var_6 [] []) + ) + `HappyStk` happyRest + +happyReduce_251 = happyMonadReduce 2 94 happyReduction_251 +happyReduction_251 + ( _ + `HappyStk` (HappyAbsSyn97 happy_var_1) + `HappyStk` happyRest + ) + tk = + happyThen + ( ((\(SourceToken ann _) -> pure (snd happy_var_1, tokLeadingComments ann))) tk + ) + (\r -> happyReturn (HappyAbsSyn94 r)) + +happyReduce_252 = happyMonadReduce 3 95 happyReduction_252 +happyReduction_252 + ( (HappyTerminal happy_var_3) + `HappyStk` (HappyAbsSyn103 happy_var_2) + `HappyStk` (HappyAbsSyn95 happy_var_1) + `HappyStk` happyRest + ) + tk = + happyThen + ( ((revert $ pushBack happy_var_3 *> pure (reverse (happy_var_2 : happy_var_1)))) tk + ) + (\r -> happyReturn (HappyAbsSyn95 r)) + +happyReduce_253 = happyMonadReduce 1 95 happyReduction_253 +happyReduction_253 + ( (HappyAbsSyn95 happy_var_1) + `HappyStk` happyRest + ) + tk = + happyThen + ( ((revert $ pure (reverse happy_var_1))) tk + ) + (\r -> happyReturn (HappyAbsSyn95 r)) + +happyReduce_254 = happySpecReduce_3 96 happyReduction_254 +happyReduction_254 + _ + (HappyAbsSyn103 happy_var_2) + (HappyAbsSyn95 happy_var_1) = + HappyAbsSyn95 + ( happy_var_2 : happy_var_1 + ) +happyReduction_254 _ _ _ = notHappyAtAll + +happyReduce_255 = happySpecReduce_0 96 happyReduction_255 +happyReduction_255 = + HappyAbsSyn95 + ( [] + ) + +happyReduce_256 = happyMonadReduce 1 97 happyReduction_256 +happyReduction_256 + ( (HappyAbsSyn150 happy_var_1) + `HappyStk` happyRest + ) + tk = + happyThen + ( ((toModuleDecls $ NE.toList happy_var_1)) + ) + (\r -> happyReturn (HappyAbsSyn97 r)) + +happyReduce_257 = happySpecReduce_0 97 happyReduction_257 +happyReduction_257 = + HappyAbsSyn97 + ( ([], []) + ) + +happyReduce_258 = happySpecReduce_1 98 happyReduction_258 +happyReduction_258 (HappyAbsSyn103 happy_var_1) = + HappyAbsSyn98 + ( TmpImport happy_var_1 + ) +happyReduction_258 _ = notHappyAtAll + +happyReduce_259 = happySpecReduce_1 98 happyReduction_259 +happyReduction_259 (HappyAbsSyn154 happy_var_1) = + HappyAbsSyn98 + ( TmpChain happy_var_1 + ) +happyReduction_259 _ = notHappyAtAll + +happyReduce_260 = happySpecReduce_1 99 happyReduction_260 +happyReduction_260 (HappyTerminal happy_var_1) = + HappyAbsSyn57 + ( happy_var_1 + ) +happyReduction_260 _ = notHappyAtAll + +happyReduce_261 = happySpecReduce_2 99 happyReduction_261 +happyReduction_261 + _ + (HappyTerminal happy_var_1) = + HappyAbsSyn57 + ( happy_var_1 + ) +happyReduction_261 _ _ = notHappyAtAll + +happyReduce_262 = happySpecReduce_0 100 happyReduction_262 +happyReduction_262 = + HappyAbsSyn100 + ( Nothing + ) + +happyReduce_263 = happySpecReduce_3 100 happyReduction_263 +happyReduction_263 + (HappyTerminal happy_var_3) + (HappyAbsSyn155 happy_var_2) + (HappyTerminal happy_var_1) = + HappyAbsSyn100 + ( Just (Wrapped happy_var_1 happy_var_2 happy_var_3) + ) +happyReduction_263 _ _ _ = notHappyAtAll + +happyReduce_264 = happySpecReduce_1 101 happyReduction_264 +happyReduction_264 (HappyAbsSyn30 happy_var_1) = + HappyAbsSyn101 + ( ExportValue () happy_var_1 + ) +happyReduction_264 _ = notHappyAtAll + +happyReduce_265 = happySpecReduce_1 101 happyReduction_265 +happyReduction_265 (HappyAbsSyn32 happy_var_1) = + HappyAbsSyn101 + ( ExportOp () (getOpName happy_var_1) + ) +happyReduction_265 _ = notHappyAtAll + +happyReduce_266 = happySpecReduce_1 101 happyReduction_266 +happyReduction_266 (HappyAbsSyn28 happy_var_1) = + HappyAbsSyn101 + ( ExportType () (getProperName happy_var_1) Nothing + ) +happyReduction_266 _ = notHappyAtAll + +happyReduce_267 = happySpecReduce_2 101 happyReduction_267 +happyReduction_267 + (HappyAbsSyn102 happy_var_2) + (HappyAbsSyn28 happy_var_1) = + HappyAbsSyn101 + ( ExportType () (getProperName happy_var_1) (Just happy_var_2) + ) +happyReduction_267 _ _ = notHappyAtAll + +happyReduce_268 = happySpecReduce_2 101 happyReduction_268 +happyReduction_268 + (HappyAbsSyn32 happy_var_2) + (HappyTerminal happy_var_1) = + HappyAbsSyn101 + ( ExportTypeOp () happy_var_1 (getOpName happy_var_2) + ) +happyReduction_268 _ _ = notHappyAtAll + +happyReduce_269 = happySpecReduce_2 101 happyReduction_269 +happyReduction_269 + (HappyAbsSyn28 happy_var_2) + (HappyTerminal happy_var_1) = + HappyAbsSyn101 + ( ExportClass () happy_var_1 (getProperName happy_var_2) + ) +happyReduction_269 _ _ = notHappyAtAll + +happyReduce_270 = happySpecReduce_2 101 happyReduction_270 +happyReduction_270 + (HappyAbsSyn26 happy_var_2) + (HappyTerminal happy_var_1) = + HappyAbsSyn101 + ( ExportModule () happy_var_1 happy_var_2 + ) +happyReduction_270 _ _ = notHappyAtAll + +happyReduce_271 = happySpecReduce_1 102 happyReduction_271 +happyReduction_271 (HappyTerminal happy_var_1) = + HappyAbsSyn102 + ( DataAll () happy_var_1 + ) +happyReduction_271 _ = notHappyAtAll + +happyReduce_272 = happySpecReduce_2 102 happyReduction_272 +happyReduction_272 + (HappyTerminal happy_var_2) + (HappyTerminal happy_var_1) = + HappyAbsSyn102 + ( DataEnumerated () (Wrapped happy_var_1 Nothing happy_var_2) + ) +happyReduction_272 _ _ = notHappyAtAll + +happyReduce_273 = happySpecReduce_3 102 happyReduction_273 +happyReduction_273 + (HappyTerminal happy_var_3) + (HappyAbsSyn160 happy_var_2) + (HappyTerminal happy_var_1) = + HappyAbsSyn102 + ( DataEnumerated () (Wrapped happy_var_1 (Just $ getProperName <$> happy_var_2) happy_var_3) + ) +happyReduction_273 _ _ _ = notHappyAtAll + +happyReduce_274 = happySpecReduce_3 103 happyReduction_274 +happyReduction_274 + (HappyAbsSyn104 happy_var_3) + (HappyAbsSyn26 happy_var_2) + (HappyTerminal happy_var_1) = + HappyAbsSyn103 + ( ImportDecl () happy_var_1 happy_var_2 happy_var_3 Nothing + ) +happyReduction_274 _ _ _ = notHappyAtAll + +happyReduce_275 = happyReduce 5 103 happyReduction_275 +happyReduction_275 + ( (HappyAbsSyn26 happy_var_5) + `HappyStk` (HappyTerminal happy_var_4) + `HappyStk` (HappyAbsSyn104 happy_var_3) + `HappyStk` (HappyAbsSyn26 happy_var_2) + `HappyStk` (HappyTerminal happy_var_1) + `HappyStk` happyRest + ) = + HappyAbsSyn103 + ( ImportDecl () happy_var_1 happy_var_2 happy_var_3 (Just (happy_var_4, happy_var_5)) + ) + `HappyStk` happyRest + +happyReduce_276 = happySpecReduce_0 104 happyReduction_276 +happyReduction_276 = + HappyAbsSyn104 + ( Nothing + ) + +happyReduce_277 = happySpecReduce_3 104 happyReduction_277 +happyReduction_277 + (HappyTerminal happy_var_3) + (HappyAbsSyn158 happy_var_2) + (HappyTerminal happy_var_1) = + HappyAbsSyn104 + ( Just (Nothing, Wrapped happy_var_1 happy_var_2 happy_var_3) + ) +happyReduction_277 _ _ _ = notHappyAtAll + +happyReduce_278 = happyReduce 4 104 happyReduction_278 +happyReduction_278 + ( (HappyTerminal happy_var_4) + `HappyStk` (HappyAbsSyn158 happy_var_3) + `HappyStk` (HappyTerminal happy_var_2) + `HappyStk` (HappyTerminal happy_var_1) + `HappyStk` happyRest + ) = + HappyAbsSyn104 + ( Just (Just happy_var_1, Wrapped happy_var_2 happy_var_3 happy_var_4) + ) + `HappyStk` happyRest + +happyReduce_279 = happySpecReduce_1 105 happyReduction_279 +happyReduction_279 (HappyAbsSyn30 happy_var_1) = + HappyAbsSyn105 + ( ImportValue () happy_var_1 + ) +happyReduction_279 _ = notHappyAtAll + +happyReduce_280 = happySpecReduce_1 105 happyReduction_280 +happyReduction_280 (HappyAbsSyn32 happy_var_1) = + HappyAbsSyn105 + ( ImportOp () (getOpName happy_var_1) + ) +happyReduction_280 _ = notHappyAtAll + +happyReduce_281 = happySpecReduce_1 105 happyReduction_281 +happyReduction_281 (HappyAbsSyn28 happy_var_1) = + HappyAbsSyn105 + ( ImportType () (getProperName happy_var_1) Nothing + ) +happyReduction_281 _ = notHappyAtAll + +happyReduce_282 = happySpecReduce_2 105 happyReduction_282 +happyReduction_282 + (HappyAbsSyn102 happy_var_2) + (HappyAbsSyn28 happy_var_1) = + HappyAbsSyn105 + ( ImportType () (getProperName happy_var_1) (Just happy_var_2) + ) +happyReduction_282 _ _ = notHappyAtAll + +happyReduce_283 = happySpecReduce_2 105 happyReduction_283 +happyReduction_283 + (HappyAbsSyn32 happy_var_2) + (HappyTerminal happy_var_1) = + HappyAbsSyn105 + ( ImportTypeOp () happy_var_1 (getOpName happy_var_2) + ) +happyReduction_283 _ _ = notHappyAtAll + +happyReduce_284 = happySpecReduce_2 105 happyReduction_284 +happyReduction_284 + (HappyAbsSyn28 happy_var_2) + (HappyTerminal happy_var_1) = + HappyAbsSyn105 + ( ImportClass () happy_var_1 (getProperName happy_var_2) + ) +happyReduction_284 _ _ = notHappyAtAll + +happyReduce_285 = happySpecReduce_1 106 happyReduction_285 +happyReduction_285 (HappyAbsSyn107 happy_var_1) = + HappyAbsSyn106 + ( DeclData () happy_var_1 Nothing + ) +happyReduction_285 _ = notHappyAtAll + +happyReduce_286 = happySpecReduce_3 106 happyReduction_286 +happyReduction_286 + (HappyAbsSyn153 happy_var_3) + (HappyTerminal happy_var_2) + (HappyAbsSyn107 happy_var_1) = + HappyAbsSyn106 + ( DeclData () happy_var_1 (Just (happy_var_2, happy_var_3)) + ) +happyReduction_286 _ _ _ = notHappyAtAll + +happyReduce_287 = happyMonadReduce 3 106 happyReduction_287 +happyReduction_287 + ( (HappyAbsSyn42 happy_var_3) + `HappyStk` (HappyTerminal happy_var_2) + `HappyStk` (HappyAbsSyn107 happy_var_1) + `HappyStk` happyRest + ) + tk = + happyThen + ( ((checkNoWildcards happy_var_3 *> pure (DeclType () happy_var_1 happy_var_2 happy_var_3))) + ) + (\r -> happyReturn (HappyAbsSyn106 r)) + +happyReduce_288 = happyMonadReduce 4 106 happyReduction_288 +happyReduction_288 + ( (HappyAbsSyn42 happy_var_4) + `HappyStk` (HappyAbsSyn28 happy_var_3) + `HappyStk` (HappyTerminal happy_var_2) + `HappyStk` (HappyAbsSyn107 happy_var_1) + `HappyStk` happyRest + ) + tk = + happyThen + ( ((checkNoWildcards happy_var_4 *> pure (DeclNewtype () happy_var_1 happy_var_2 (getProperName happy_var_3) happy_var_4))) + ) + (\r -> happyReturn (HappyAbsSyn106 r)) + +happyReduce_289 = happySpecReduce_1 106 happyReduction_289 +happyReduction_289 (HappyAbsSyn111 happy_var_1) = + HappyAbsSyn106 + ( either id (\h -> DeclClass () h Nothing) happy_var_1 + ) +happyReduction_289 _ = notHappyAtAll + +happyReduce_290 = happyMonadReduce 5 106 happyReduction_290 +happyReduction_290 + ( _ + `HappyStk` (HappyAbsSyn147 happy_var_4) + `HappyStk` _ + `HappyStk` (HappyTerminal happy_var_2) + `HappyStk` (HappyAbsSyn111 happy_var_1) + `HappyStk` happyRest + ) + tk = + happyThen + ( ((either (const (parseError happy_var_2)) (\h -> pure $ DeclClass () h (Just (happy_var_2, happy_var_4))) happy_var_1)) + ) + (\r -> happyReturn (HappyAbsSyn106 r)) + +happyReduce_291 = happySpecReduce_1 106 happyReduction_291 +happyReduction_291 (HappyAbsSyn118 happy_var_1) = + HappyAbsSyn106 + ( DeclInstanceChain () (Separated (Instance happy_var_1 Nothing) []) + ) +happyReduction_291 _ = notHappyAtAll + +happyReduce_292 = happyReduce 5 106 happyReduction_292 +happyReduction_292 + ( _ + `HappyStk` (HappyAbsSyn148 happy_var_4) + `HappyStk` _ + `HappyStk` (HappyTerminal happy_var_2) + `HappyStk` (HappyAbsSyn118 happy_var_1) + `HappyStk` happyRest + ) = + HappyAbsSyn106 + ( DeclInstanceChain () (Separated (Instance happy_var_1 (Just (happy_var_2, happy_var_4))) []) + ) + `HappyStk` happyRest + +happyReduce_293 = happyMonadReduce 4 106 happyReduction_293 +happyReduction_293 + ( (HappyAbsSyn42 happy_var_4) + `HappyStk` (HappyTerminal happy_var_3) + `HappyStk` (HappyAbsSyn28 happy_var_2) + `HappyStk` (HappyTerminal happy_var_1) + `HappyStk` happyRest + ) + tk = + happyThen + ( ((checkNoWildcards happy_var_4 *> pure (DeclKindSignature () happy_var_1 (Labeled (getProperName happy_var_2) happy_var_3 happy_var_4)))) + ) + (\r -> happyReturn (HappyAbsSyn106 r)) + +happyReduce_294 = happyMonadReduce 4 106 happyReduction_294 +happyReduction_294 + ( (HappyAbsSyn42 happy_var_4) + `HappyStk` (HappyTerminal happy_var_3) + `HappyStk` (HappyAbsSyn28 happy_var_2) + `HappyStk` (HappyTerminal happy_var_1) + `HappyStk` happyRest + ) + tk = + happyThen + ( ((checkNoWildcards happy_var_4 *> pure (DeclKindSignature () happy_var_1 (Labeled (getProperName happy_var_2) happy_var_3 happy_var_4)))) + ) + (\r -> happyReturn (HappyAbsSyn106 r)) + +happyReduce_295 = happyMonadReduce 4 106 happyReduction_295 +happyReduction_295 + ( (HappyAbsSyn42 happy_var_4) + `HappyStk` (HappyTerminal happy_var_3) + `HappyStk` (HappyAbsSyn28 happy_var_2) + `HappyStk` (HappyTerminal happy_var_1) + `HappyStk` happyRest + ) + tk = + happyThen + ( ((checkNoWildcards happy_var_4 *> pure (DeclKindSignature () happy_var_1 (Labeled (getProperName happy_var_2) happy_var_3 happy_var_4)))) + ) + (\r -> happyReturn (HappyAbsSyn106 r)) + +happyReduce_296 = happySpecReduce_2 106 happyReduction_296 +happyReduction_296 + (HappyAbsSyn118 happy_var_2) + (HappyTerminal happy_var_1) = + HappyAbsSyn106 + ( DeclDerive () happy_var_1 Nothing happy_var_2 + ) +happyReduction_296 _ _ = notHappyAtAll + +happyReduce_297 = happySpecReduce_3 106 happyReduction_297 +happyReduction_297 + (HappyAbsSyn118 happy_var_3) + (HappyTerminal happy_var_2) + (HappyTerminal happy_var_1) = + HappyAbsSyn106 + ( DeclDerive () happy_var_1 (Just happy_var_2) happy_var_3 + ) +happyReduction_297 _ _ _ = notHappyAtAll + +happyReduce_298 = happySpecReduce_3 106 happyReduction_298 +happyReduction_298 + (HappyAbsSyn42 happy_var_3) + (HappyTerminal happy_var_2) + (HappyAbsSyn30 happy_var_1) = + HappyAbsSyn106 + ( DeclSignature () (Labeled happy_var_1 happy_var_2 happy_var_3) + ) +happyReduction_298 _ _ _ = notHappyAtAll + +happyReduce_299 = happySpecReduce_3 106 happyReduction_299 +happyReduction_299 + (HappyAbsSyn74 happy_var_3) + (HappyAbsSyn142 happy_var_2) + (HappyAbsSyn30 happy_var_1) = + HappyAbsSyn106 + ( DeclValue () (ValueBindingFields happy_var_1 happy_var_2 happy_var_3) + ) +happyReduction_299 _ _ _ = notHappyAtAll + +happyReduce_300 = happySpecReduce_1 106 happyReduction_300 +happyReduction_300 (HappyAbsSyn123 happy_var_1) = + HappyAbsSyn106 + ( DeclFixity () happy_var_1 + ) +happyReduction_300 _ = notHappyAtAll + +happyReduce_301 = happyMonadReduce 5 106 happyReduction_301 +happyReduction_301 + ( (HappyAbsSyn42 happy_var_5) + `HappyStk` (HappyTerminal happy_var_4) + `HappyStk` (HappyAbsSyn30 happy_var_3) + `HappyStk` (HappyTerminal happy_var_2) + `HappyStk` (HappyTerminal happy_var_1) + `HappyStk` happyRest + ) + tk = + happyThen + ( ((when (isConstrained happy_var_5) (addFailure ([happy_var_1, happy_var_2, nameTok happy_var_3, happy_var_4] <> toList (flattenType happy_var_5)) ErrConstraintInForeignImportSyntax) *> pure (DeclForeign () happy_var_1 happy_var_2 (ForeignValue (Labeled happy_var_3 happy_var_4 happy_var_5))))) + ) + (\r -> happyReturn (HappyAbsSyn106 r)) + +happyReduce_302 = happyReduce 6 106 happyReduction_302 +happyReduction_302 + ( (HappyAbsSyn42 happy_var_6) + `HappyStk` (HappyTerminal happy_var_5) + `HappyStk` (HappyAbsSyn28 happy_var_4) + `HappyStk` (HappyTerminal happy_var_3) + `HappyStk` (HappyTerminal happy_var_2) + `HappyStk` (HappyTerminal happy_var_1) + `HappyStk` happyRest + ) = + HappyAbsSyn106 + ( DeclForeign () happy_var_1 happy_var_2 (ForeignData happy_var_3 (Labeled (getProperName happy_var_4) happy_var_5 happy_var_6)) + ) + `HappyStk` happyRest + +happyReduce_303 = happyReduce 4 106 happyReduction_303 +happyReduction_303 + ( (HappyAbsSyn140 happy_var_4) + `HappyStk` (HappyAbsSyn28 happy_var_3) + `HappyStk` (HappyTerminal happy_var_2) + `HappyStk` (HappyTerminal happy_var_1) + `HappyStk` happyRest + ) = + HappyAbsSyn106 + ( DeclRole () happy_var_1 happy_var_2 (getProperName happy_var_3) happy_var_4 + ) + `HappyStk` happyRest + +happyReduce_304 = happySpecReduce_3 107 happyReduction_304 +happyReduction_304 + (HappyAbsSyn144 happy_var_3) + (HappyAbsSyn28 happy_var_2) + (HappyTerminal happy_var_1) = + HappyAbsSyn107 + ( DataHead happy_var_1 (getProperName happy_var_2) happy_var_3 + ) +happyReduction_304 _ _ _ = notHappyAtAll + +happyReduce_305 = happySpecReduce_3 108 happyReduction_305 +happyReduction_305 + (HappyAbsSyn144 happy_var_3) + (HappyAbsSyn28 happy_var_2) + (HappyTerminal happy_var_1) = + HappyAbsSyn107 + ( DataHead happy_var_1 (getProperName happy_var_2) happy_var_3 + ) +happyReduction_305 _ _ _ = notHappyAtAll + +happyReduce_306 = happySpecReduce_3 109 happyReduction_306 +happyReduction_306 + (HappyAbsSyn144 happy_var_3) + (HappyAbsSyn28 happy_var_2) + (HappyTerminal happy_var_1) = + HappyAbsSyn107 + ( DataHead happy_var_1 (getProperName happy_var_2) happy_var_3 + ) +happyReduction_306 _ _ _ = notHappyAtAll + +happyReduce_307 = happyMonadReduce 2 110 happyReduction_307 +happyReduction_307 + ( (HappyAbsSyn143 happy_var_2) + `HappyStk` (HappyAbsSyn28 happy_var_1) + `HappyStk` happyRest + ) + tk = + happyThen + ( ((for_ happy_var_2 checkNoWildcards *> pure (DataCtor () (getProperName happy_var_1) happy_var_2))) + ) + (\r -> happyReturn (HappyAbsSyn110 r)) + +happyReduce_308 = happyMonad2Reduce 1 111 happyReduction_308 +happyReduction_308 + ( (HappyTerminal happy_var_1) + `HappyStk` happyRest + ) + tk = + happyThen + ( ( ( revert $ + oneOf $ + NE.fromList + [ fmap (Left . DeclKindSignature () happy_var_1) parseClassSignature + , do + (super, (name, vars, fundeps)) <- tryPrefix parseClassSuper parseClassNameAndFundeps + let hd = ClassHead happy_var_1 super name vars fundeps + checkFundeps hd + pure $ Right hd + ] + ) + ) + tk + ) + (\r -> happyReturn (HappyAbsSyn111 r)) + +happyReduce_309 = happyMonadReduce 3 112 happyReduction_309 +happyReduction_309 + ( (HappyAbsSyn42 happy_var_3) + `HappyStk` (HappyTerminal happy_var_2) + `HappyStk` (HappyAbsSyn28 happy_var_1) + `HappyStk` happyRest + ) + tk = + happyThen + ( ((revert $ checkNoWildcards happy_var_3 *> pure (Labeled (getProperName happy_var_1) happy_var_2 happy_var_3))) tk + ) + (\r -> happyReturn (HappyAbsSyn112 r)) + +happyReduce_310 = happyMonadReduce 2 113 happyReduction_310 +happyReduction_310 + ( (HappyTerminal happy_var_2) + `HappyStk` (HappyAbsSyn120 happy_var_1) + `HappyStk` happyRest + ) + tk = + happyThen + ( ((revert $ pure (happy_var_1, happy_var_2))) tk + ) + (\r -> happyReturn (HappyAbsSyn113 r)) + +happyReduce_311 = happyMonadReduce 3 114 happyReduction_311 +happyReduction_311 + ( (HappyAbsSyn115 happy_var_3) + `HappyStk` (HappyAbsSyn144 happy_var_2) + `HappyStk` (HappyAbsSyn28 happy_var_1) + `HappyStk` happyRest + ) + tk = + happyThen + ( ((revert $ pure (getProperName happy_var_1, happy_var_2, happy_var_3))) tk + ) + (\r -> happyReturn (HappyAbsSyn114 r)) + +happyReduce_312 = happySpecReduce_0 115 happyReduction_312 +happyReduction_312 = + HappyAbsSyn115 + ( Nothing + ) + +happyReduce_313 = happySpecReduce_2 115 happyReduction_313 +happyReduction_313 + (HappyAbsSyn157 happy_var_2) + (HappyTerminal happy_var_1) = + HappyAbsSyn115 + ( Just (happy_var_1, happy_var_2) + ) +happyReduction_313 _ _ = notHappyAtAll + +happyReduce_314 = happySpecReduce_2 116 happyReduction_314 +happyReduction_314 + (HappyAbsSyn139 happy_var_2) + (HappyTerminal happy_var_1) = + HappyAbsSyn116 + ( FundepDetermined happy_var_1 happy_var_2 + ) +happyReduction_314 _ _ = notHappyAtAll + +happyReduce_315 = happySpecReduce_3 116 happyReduction_315 +happyReduction_315 + (HappyAbsSyn139 happy_var_3) + (HappyTerminal happy_var_2) + (HappyAbsSyn139 happy_var_1) = + HappyAbsSyn116 + ( FundepDetermines happy_var_1 happy_var_2 happy_var_3 + ) +happyReduction_315 _ _ _ = notHappyAtAll + +happyReduce_316 = happyMonadReduce 3 117 happyReduction_316 +happyReduction_316 + ( (HappyAbsSyn42 happy_var_3) + `HappyStk` (HappyTerminal happy_var_2) + `HappyStk` (HappyAbsSyn30 happy_var_1) + `HappyStk` happyRest + ) + tk = + happyThen + ( ((checkNoWildcards happy_var_3 *> pure (Labeled happy_var_1 happy_var_2 happy_var_3))) + ) + (\r -> happyReturn (HappyAbsSyn117 r)) + +happyReduce_317 = happyReduce 6 118 happyReduction_317 +happyReduction_317 + ( (HappyAbsSyn143 happy_var_6) + `HappyStk` (HappyAbsSyn27 happy_var_5) + `HappyStk` (HappyTerminal happy_var_4) + `HappyStk` (HappyAbsSyn120 happy_var_3) + `HappyStk` (HappyAbsSyn119 happy_var_2) + `HappyStk` (HappyTerminal happy_var_1) + `HappyStk` happyRest + ) = + HappyAbsSyn118 + ( InstanceHead happy_var_1 (Just happy_var_2) Nothing (Just (happy_var_3, happy_var_4)) (getQualifiedProperName happy_var_5) happy_var_6 + ) + `HappyStk` happyRest + +happyReduce_318 = happyReduce 4 118 happyReduction_318 +happyReduction_318 + ( (HappyAbsSyn143 happy_var_4) + `HappyStk` (HappyAbsSyn27 happy_var_3) + `HappyStk` (HappyAbsSyn119 happy_var_2) + `HappyStk` (HappyTerminal happy_var_1) + `HappyStk` happyRest + ) = + HappyAbsSyn118 + ( InstanceHead happy_var_1 (Just happy_var_2) Nothing Nothing (getQualifiedProperName happy_var_3) happy_var_4 + ) + `HappyStk` happyRest + +happyReduce_319 = happyReduce 5 118 happyReduction_319 +happyReduction_319 + ( (HappyAbsSyn143 happy_var_5) + `HappyStk` (HappyAbsSyn27 happy_var_4) + `HappyStk` (HappyTerminal happy_var_3) + `HappyStk` (HappyAbsSyn120 happy_var_2) + `HappyStk` (HappyTerminal happy_var_1) + `HappyStk` happyRest + ) = + HappyAbsSyn118 + ( InstanceHead happy_var_1 Nothing Nothing (Just (happy_var_2, happy_var_3)) (getQualifiedProperName happy_var_4) happy_var_5 + ) + `HappyStk` happyRest + +happyReduce_320 = happySpecReduce_3 118 happyReduction_320 +happyReduction_320 + (HappyAbsSyn143 happy_var_3) + (HappyAbsSyn27 happy_var_2) + (HappyTerminal happy_var_1) = + HappyAbsSyn118 + ( InstanceHead happy_var_1 Nothing Nothing Nothing (getQualifiedProperName happy_var_2) happy_var_3 + ) +happyReduction_320 _ _ _ = notHappyAtAll + +happyReduce_321 = happySpecReduce_3 119 happyReduction_321 +happyReduction_321 + _ + (HappyAbsSyn141 happy_var_2) + (HappyAbsSyn57 happy_var_1) = + HappyAbsSyn119 + ( (happy_var_1, happy_var_2) + ) +happyReduction_321 _ _ _ = notHappyAtAll + +happyReduce_322 = happySpecReduce_1 120 happyReduction_322 +happyReduction_322 (HappyAbsSyn121 happy_var_1) = + HappyAbsSyn120 + ( One happy_var_1 + ) +happyReduction_322 _ = notHappyAtAll + +happyReduce_323 = happySpecReduce_3 120 happyReduction_323 +happyReduction_323 + (HappyTerminal happy_var_3) + (HappyAbsSyn152 happy_var_2) + (HappyTerminal happy_var_1) = + HappyAbsSyn120 + ( Many (Wrapped happy_var_1 happy_var_2 happy_var_3) + ) +happyReduction_323 _ _ _ = notHappyAtAll + +happyReduce_324 = happyMonadReduce 2 121 happyReduction_324 +happyReduction_324 + ( (HappyAbsSyn143 happy_var_2) + `HappyStk` (HappyAbsSyn27 happy_var_1) + `HappyStk` happyRest + ) + tk = + happyThen + ( ((for_ happy_var_2 checkNoWildcards *> for_ happy_var_2 checkNoForalls *> pure (Constraint () (getQualifiedProperName happy_var_1) happy_var_2))) + ) + (\r -> happyReturn (HappyAbsSyn121 r)) + +happyReduce_325 = happySpecReduce_3 121 happyReduction_325 +happyReduction_325 + (HappyTerminal happy_var_3) + (HappyAbsSyn121 happy_var_2) + (HappyTerminal happy_var_1) = + HappyAbsSyn121 + ( ConstraintParens () (Wrapped happy_var_1 happy_var_2 happy_var_3) + ) +happyReduction_325 _ _ _ = notHappyAtAll + +happyReduce_326 = happySpecReduce_3 122 happyReduction_326 +happyReduction_326 + (HappyAbsSyn42 happy_var_3) + (HappyTerminal happy_var_2) + (HappyAbsSyn30 happy_var_1) = + HappyAbsSyn122 + ( InstanceBindingSignature () (Labeled happy_var_1 happy_var_2 happy_var_3) + ) +happyReduction_326 _ _ _ = notHappyAtAll + +happyReduce_327 = happySpecReduce_3 122 happyReduction_327 +happyReduction_327 + (HappyAbsSyn74 happy_var_3) + (HappyAbsSyn142 happy_var_2) + (HappyAbsSyn30 happy_var_1) = + HappyAbsSyn122 + ( InstanceBindingName () (ValueBindingFields happy_var_1 happy_var_2 happy_var_3) + ) +happyReduction_327 _ _ _ = notHappyAtAll + +happyReduce_328 = happyReduce 5 123 happyReduction_328 +happyReduction_328 + ( (HappyAbsSyn32 happy_var_5) + `HappyStk` (HappyTerminal happy_var_4) + `HappyStk` (HappyAbsSyn29 happy_var_3) + `HappyStk` (HappyAbsSyn40 happy_var_2) + `HappyStk` (HappyAbsSyn124 happy_var_1) + `HappyStk` happyRest + ) = + HappyAbsSyn123 + ( FixityFields happy_var_1 happy_var_2 (FixityValue (fmap Left happy_var_3) happy_var_4 (getOpName happy_var_5)) + ) + `HappyStk` happyRest + +happyReduce_329 = happyReduce 5 123 happyReduction_329 +happyReduction_329 + ( (HappyAbsSyn32 happy_var_5) + `HappyStk` (HappyTerminal happy_var_4) + `HappyStk` (HappyAbsSyn27 happy_var_3) + `HappyStk` (HappyAbsSyn40 happy_var_2) + `HappyStk` (HappyAbsSyn124 happy_var_1) + `HappyStk` happyRest + ) = + HappyAbsSyn123 + ( FixityFields happy_var_1 happy_var_2 (FixityValue (fmap Right (getQualifiedProperName happy_var_3)) happy_var_4 (getOpName happy_var_5)) + ) + `HappyStk` happyRest + +happyReduce_330 = happyReduce 6 123 happyReduction_330 +happyReduction_330 + ( (HappyAbsSyn32 happy_var_6) + `HappyStk` (HappyTerminal happy_var_5) + `HappyStk` (HappyAbsSyn27 happy_var_4) + `HappyStk` (HappyTerminal happy_var_3) + `HappyStk` (HappyAbsSyn40 happy_var_2) + `HappyStk` (HappyAbsSyn124 happy_var_1) + `HappyStk` happyRest + ) = + HappyAbsSyn123 + ( FixityFields happy_var_1 happy_var_2 (FixityType happy_var_3 (getQualifiedProperName happy_var_4) happy_var_5 (getOpName happy_var_6)) + ) + `HappyStk` happyRest + +happyReduce_331 = happySpecReduce_1 124 happyReduction_331 +happyReduction_331 (HappyTerminal happy_var_1) = + HappyAbsSyn124 + ( (happy_var_1, Infix) + ) +happyReduction_331 _ = notHappyAtAll + +happyReduce_332 = happySpecReduce_1 124 happyReduction_332 +happyReduction_332 (HappyTerminal happy_var_1) = + HappyAbsSyn124 + ( (happy_var_1, Infixl) + ) +happyReduction_332 _ = notHappyAtAll + +happyReduce_333 = happySpecReduce_1 124 happyReduction_333 +happyReduction_333 (HappyTerminal happy_var_1) = + HappyAbsSyn124 + ( (happy_var_1, Infixr) + ) +happyReduction_333 _ = notHappyAtAll + +happyReduce_334 = happySpecReduce_1 125 happyReduction_334 +happyReduction_334 (HappyTerminal happy_var_1) = + HappyAbsSyn125 + ( Role happy_var_1 R.Nominal + ) +happyReduction_334 _ = notHappyAtAll + +happyReduce_335 = happySpecReduce_1 125 happyReduction_335 +happyReduction_335 (HappyTerminal happy_var_1) = + HappyAbsSyn125 + ( Role happy_var_1 R.Representational + ) +happyReduction_335 _ = notHappyAtAll + +happyReduce_336 = happySpecReduce_1 125 happyReduction_336 +happyReduction_336 (HappyTerminal happy_var_1) = + HappyAbsSyn125 + ( Role happy_var_1 R.Phantom + ) +happyReduction_336 _ = notHappyAtAll + +happyReduce_337 = happyMonadReduce 1 126 happyReduction_337 +happyReduction_337 + ( (HappyAbsSyn103 happy_var_1) + `HappyStk` happyRest + ) + tk = + happyThen + ( ((revert $ pure happy_var_1)) tk + ) + (\r -> happyReturn (HappyAbsSyn103 r)) + +happyReduce_338 = happyMonadReduce 1 127 happyReduction_338 +happyReduction_338 + ( (HappyAbsSyn106 happy_var_1) + `HappyStk` happyRest + ) + tk = + happyThen + ( ((revert $ pure happy_var_1)) tk + ) + (\r -> happyReturn (HappyAbsSyn106 r)) + +happyReduce_339 = happyMonadReduce 1 128 happyReduction_339 +happyReduction_339 + ( (HappyAbsSyn59 happy_var_1) + `HappyStk` happyRest + ) + tk = + happyThen + ( ((revert $ pure happy_var_1)) tk + ) + (\r -> happyReturn (HappyAbsSyn59 r)) + +happyReduce_340 = happyMonadReduce 1 129 happyReduction_340 +happyReduction_340 + ( (HappyAbsSyn42 happy_var_1) + `HappyStk` happyRest + ) + tk = + happyThen + ( ((revert $ pure happy_var_1)) tk + ) + (\r -> happyReturn (HappyAbsSyn42 r)) + +happyReduce_341 = happyMonadReduce 1 130 happyReduction_341 +happyReduction_341 + ( (HappyAbsSyn26 happy_var_1) + `HappyStk` happyRest + ) + tk = + happyThen + ( ((revert $ pure happy_var_1)) tk + ) + (\r -> happyReturn (HappyAbsSyn26 r)) + +happyReduce_342 = happyMonadReduce 1 131 happyReduction_342 +happyReduction_342 + ( (HappyAbsSyn29 happy_var_1) + `HappyStk` happyRest + ) + tk = + happyThen + ( ((revert $ pure happy_var_1)) tk + ) + (\r -> happyReturn (HappyAbsSyn29 r)) + +happyReduce_343 = happySpecReduce_2 132 happyReduction_343 +happyReduction_343 + (HappyTerminal happy_var_2) + (HappyTerminal happy_var_1) = + HappyAbsSyn132 + ( Wrapped happy_var_1 Nothing happy_var_2 + ) +happyReduction_343 _ _ = notHappyAtAll + +happyReduce_344 = happySpecReduce_3 132 happyReduction_344 +happyReduction_344 + (HappyTerminal happy_var_3) + (HappyAbsSyn151 happy_var_2) + (HappyTerminal happy_var_1) = + HappyAbsSyn132 + ( Wrapped happy_var_1 (Just happy_var_2) happy_var_3 + ) +happyReduction_344 _ _ _ = notHappyAtAll + +happyReduce_345 = happySpecReduce_2 133 happyReduction_345 +happyReduction_345 + (HappyTerminal happy_var_2) + (HappyTerminal happy_var_1) = + HappyAbsSyn133 + ( Wrapped happy_var_1 Nothing happy_var_2 + ) +happyReduction_345 _ _ = notHappyAtAll + +happyReduce_346 = happySpecReduce_3 133 happyReduction_346 +happyReduction_346 + (HappyTerminal happy_var_3) + (HappyAbsSyn156 happy_var_2) + (HappyTerminal happy_var_1) = + HappyAbsSyn133 + ( Wrapped happy_var_1 (Just happy_var_2) happy_var_3 + ) +happyReduction_346 _ _ _ = notHappyAtAll + +happyReduce_347 = happySpecReduce_2 134 happyReduction_347 +happyReduction_347 + (HappyTerminal happy_var_2) + (HappyTerminal happy_var_1) = + HappyAbsSyn134 + ( Wrapped happy_var_1 Nothing happy_var_2 + ) +happyReduction_347 _ _ = notHappyAtAll + +happyReduce_348 = happySpecReduce_3 134 happyReduction_348 +happyReduction_348 + (HappyTerminal happy_var_3) + (HappyAbsSyn178 happy_var_2) + (HappyTerminal happy_var_1) = + HappyAbsSyn134 + ( Wrapped happy_var_1 (Just happy_var_2) happy_var_3 + ) +happyReduction_348 _ _ _ = notHappyAtAll + +happyReduce_349 = happySpecReduce_2 135 happyReduction_349 +happyReduction_349 + (HappyTerminal happy_var_2) + (HappyTerminal happy_var_1) = + HappyAbsSyn135 + ( Wrapped happy_var_1 Nothing happy_var_2 + ) +happyReduction_349 _ _ = notHappyAtAll + +happyReduce_350 = happySpecReduce_3 135 happyReduction_350 +happyReduction_350 + (HappyTerminal happy_var_3) + (HappyAbsSyn179 happy_var_2) + (HappyTerminal happy_var_1) = + HappyAbsSyn135 + ( Wrapped happy_var_1 (Just happy_var_2) happy_var_3 + ) +happyReduction_350 _ _ _ = notHappyAtAll + +happyReduce_351 = happySpecReduce_1 136 happyReduction_351 +happyReduction_351 (HappyAbsSyn136 happy_var_1) = + HappyAbsSyn136 + ( NE.reverse happy_var_1 + ) +happyReduction_351 _ = notHappyAtAll + +happyReduce_352 = happySpecReduce_1 137 happyReduction_352 +happyReduction_352 (HappyAbsSyn137 happy_var_1) = + HappyAbsSyn137 + ( NE.reverse happy_var_1 + ) +happyReduction_352 _ = notHappyAtAll + +happyReduce_353 = happySpecReduce_1 138 happyReduction_353 +happyReduction_353 (HappyAbsSyn137 happy_var_1) = + HappyAbsSyn137 + ( NE.reverse happy_var_1 + ) +happyReduction_353 _ = notHappyAtAll + +happyReduce_354 = happySpecReduce_1 139 happyReduction_354 +happyReduction_354 (HappyAbsSyn139 happy_var_1) = + HappyAbsSyn139 + ( NE.reverse happy_var_1 + ) +happyReduction_354 _ = notHappyAtAll + +happyReduce_355 = happySpecReduce_1 140 happyReduction_355 +happyReduction_355 (HappyAbsSyn140 happy_var_1) = + HappyAbsSyn140 + ( NE.reverse happy_var_1 + ) +happyReduction_355 _ = notHappyAtAll + +happyReduce_356 = happySpecReduce_1 141 happyReduction_356 +happyReduction_356 (HappyAbsSyn141 happy_var_1) = + HappyAbsSyn141 + ( NE.reverse happy_var_1 + ) +happyReduction_356 _ = notHappyAtAll + +happyReduce_357 = happySpecReduce_0 142 happyReduction_357 +happyReduction_357 = + HappyAbsSyn142 + ( [] + ) + +happyReduce_358 = happySpecReduce_1 142 happyReduction_358 +happyReduction_358 (HappyAbsSyn136 happy_var_1) = + HappyAbsSyn142 + ( NE.toList happy_var_1 + ) +happyReduction_358 _ = notHappyAtAll + +happyReduce_359 = happySpecReduce_0 143 happyReduction_359 +happyReduction_359 = + HappyAbsSyn143 + ( [] + ) + +happyReduce_360 = happySpecReduce_1 143 happyReduction_360 +happyReduction_360 (HappyAbsSyn164 happy_var_1) = + HappyAbsSyn143 + ( NE.toList happy_var_1 + ) +happyReduction_360 _ = notHappyAtAll + +happyReduce_361 = happySpecReduce_0 144 happyReduction_361 +happyReduction_361 = + HappyAbsSyn144 + ( [] + ) + +happyReduce_362 = happySpecReduce_1 144 happyReduction_362 +happyReduction_362 (HappyAbsSyn141 happy_var_1) = + HappyAbsSyn144 + ( NE.toList happy_var_1 + ) +happyReduction_362 _ = notHappyAtAll + +happyReduce_363 = happySpecReduce_0 145 happyReduction_363 +happyReduction_363 = + HappyAbsSyn144 + ( [] + ) + +happyReduce_364 = happySpecReduce_1 145 happyReduction_364 +happyReduction_364 (HappyAbsSyn141 happy_var_1) = + HappyAbsSyn144 + ( NE.toList happy_var_1 + ) +happyReduction_364 _ = notHappyAtAll + +happyReduce_365 = happySpecReduce_1 146 happyReduction_365 +happyReduction_365 (HappyAbsSyn146 happy_var_1) = + HappyAbsSyn146 + ( NE.reverse happy_var_1 + ) +happyReduction_365 _ = notHappyAtAll + +happyReduce_366 = happySpecReduce_1 147 happyReduction_366 +happyReduction_366 (HappyAbsSyn147 happy_var_1) = + HappyAbsSyn147 + ( NE.reverse happy_var_1 + ) +happyReduction_366 _ = notHappyAtAll + +happyReduce_367 = happySpecReduce_1 148 happyReduction_367 +happyReduction_367 (HappyAbsSyn148 happy_var_1) = + HappyAbsSyn148 + ( NE.reverse happy_var_1 + ) +happyReduction_367 _ = notHappyAtAll + +happyReduce_368 = happySpecReduce_1 149 happyReduction_368 +happyReduction_368 (HappyAbsSyn149 happy_var_1) = + HappyAbsSyn149 + ( NE.reverse happy_var_1 + ) +happyReduction_368 _ = notHappyAtAll + +happyReduce_369 = happySpecReduce_1 150 happyReduction_369 +happyReduction_369 (HappyAbsSyn150 happy_var_1) = + HappyAbsSyn150 + ( NE.reverse happy_var_1 + ) +happyReduction_369 _ = notHappyAtAll + +happyReduce_370 = happySpecReduce_1 151 happyReduction_370 +happyReduction_370 (HappyAbsSyn180 happy_var_1) = + HappyAbsSyn151 + ( separated happy_var_1 + ) +happyReduction_370 _ = notHappyAtAll + +happyReduce_371 = happySpecReduce_1 152 happyReduction_371 +happyReduction_371 (HappyAbsSyn181 happy_var_1) = + HappyAbsSyn152 + ( separated happy_var_1 + ) +happyReduction_371 _ = notHappyAtAll + +happyReduce_372 = happySpecReduce_1 153 happyReduction_372 +happyReduction_372 (HappyAbsSyn182 happy_var_1) = + HappyAbsSyn153 + ( separated happy_var_1 + ) +happyReduction_372 _ = notHappyAtAll + +happyReduce_373 = happySpecReduce_1 154 happyReduction_373 +happyReduction_373 (HappyAbsSyn183 happy_var_1) = + HappyAbsSyn154 + ( separated happy_var_1 + ) +happyReduction_373 _ = notHappyAtAll + +happyReduce_374 = happySpecReduce_1 155 happyReduction_374 +happyReduction_374 (HappyAbsSyn184 happy_var_1) = + HappyAbsSyn155 + ( separated happy_var_1 + ) +happyReduction_374 _ = notHappyAtAll + +happyReduce_375 = happySpecReduce_1 156 happyReduction_375 +happyReduction_375 (HappyAbsSyn185 happy_var_1) = + HappyAbsSyn156 + ( separated happy_var_1 + ) +happyReduction_375 _ = notHappyAtAll + +happyReduce_376 = happySpecReduce_1 157 happyReduction_376 +happyReduction_376 (HappyAbsSyn186 happy_var_1) = + HappyAbsSyn157 + ( separated happy_var_1 + ) +happyReduction_376 _ = notHappyAtAll + +happyReduce_377 = happySpecReduce_1 158 happyReduction_377 +happyReduction_377 (HappyAbsSyn187 happy_var_1) = + HappyAbsSyn158 + ( separated happy_var_1 + ) +happyReduction_377 _ = notHappyAtAll + +happyReduce_378 = happySpecReduce_1 159 happyReduction_378 +happyReduction_378 (HappyAbsSyn188 happy_var_1) = + HappyAbsSyn159 + ( separated happy_var_1 + ) +happyReduction_378 _ = notHappyAtAll + +happyReduce_379 = happySpecReduce_1 160 happyReduction_379 +happyReduction_379 (HappyAbsSyn189 happy_var_1) = + HappyAbsSyn160 + ( separated happy_var_1 + ) +happyReduction_379 _ = notHappyAtAll + +happyReduce_380 = happySpecReduce_1 161 happyReduction_380 +happyReduction_380 (HappyAbsSyn190 happy_var_1) = + HappyAbsSyn161 + ( separated happy_var_1 + ) +happyReduction_380 _ = notHappyAtAll + +happyReduce_381 = happySpecReduce_1 162 happyReduction_381 +happyReduction_381 (HappyAbsSyn191 happy_var_1) = + HappyAbsSyn162 + ( separated happy_var_1 + ) +happyReduction_381 _ = notHappyAtAll + +happyReduce_382 = happySpecReduce_1 163 happyReduction_382 +happyReduction_382 (HappyAbsSyn192 happy_var_1) = + HappyAbsSyn163 + ( separated happy_var_1 + ) +happyReduction_382 _ = notHappyAtAll + +happyReduce_383 = happySpecReduce_1 164 happyReduction_383 +happyReduction_383 (HappyAbsSyn164 happy_var_1) = + HappyAbsSyn164 + ( NE.reverse happy_var_1 + ) +happyReduction_383 _ = notHappyAtAll + +happyReduce_384 = happySpecReduce_1 165 happyReduction_384 +happyReduction_384 (HappyAbsSyn141 happy_var_1) = + HappyAbsSyn141 + ( NE.reverse happy_var_1 + ) +happyReduction_384 _ = notHappyAtAll + +happyReduce_385 = happySpecReduce_1 166 happyReduction_385 +happyReduction_385 (HappyAbsSyn88 happy_var_1) = + HappyAbsSyn136 + ( pure happy_var_1 + ) +happyReduction_385 _ = notHappyAtAll + +happyReduce_386 = happySpecReduce_2 166 happyReduction_386 +happyReduction_386 + (HappyAbsSyn88 happy_var_2) + (HappyAbsSyn136 happy_var_1) = + HappyAbsSyn136 + ( NE.cons happy_var_2 happy_var_1 + ) +happyReduction_386 _ _ = notHappyAtAll + +happyReduce_387 = happySpecReduce_1 167 happyReduction_387 +happyReduction_387 (HappyAbsSyn75 happy_var_1) = + HappyAbsSyn137 + ( pure happy_var_1 + ) +happyReduction_387 _ = notHappyAtAll + +happyReduce_388 = happySpecReduce_2 167 happyReduction_388 +happyReduction_388 + (HappyAbsSyn75 happy_var_2) + (HappyAbsSyn137 happy_var_1) = + HappyAbsSyn137 + ( NE.cons happy_var_2 happy_var_1 + ) +happyReduction_388 _ _ = notHappyAtAll + +happyReduce_389 = happySpecReduce_1 168 happyReduction_389 +happyReduction_389 (HappyAbsSyn75 happy_var_1) = + HappyAbsSyn137 + ( pure happy_var_1 + ) +happyReduction_389 _ = notHappyAtAll + +happyReduce_390 = happySpecReduce_2 168 happyReduction_390 +happyReduction_390 + (HappyAbsSyn75 happy_var_2) + (HappyAbsSyn137 happy_var_1) = + HappyAbsSyn137 + ( NE.cons happy_var_2 happy_var_1 + ) +happyReduction_390 _ _ = notHappyAtAll + +happyReduce_391 = happySpecReduce_1 169 happyReduction_391 +happyReduction_391 (HappyAbsSyn30 happy_var_1) = + HappyAbsSyn139 + ( pure happy_var_1 + ) +happyReduction_391 _ = notHappyAtAll + +happyReduce_392 = happySpecReduce_2 169 happyReduction_392 +happyReduction_392 + (HappyAbsSyn30 happy_var_2) + (HappyAbsSyn139 happy_var_1) = + HappyAbsSyn139 + ( NE.cons happy_var_2 happy_var_1 + ) +happyReduction_392 _ _ = notHappyAtAll + +happyReduce_393 = happySpecReduce_1 170 happyReduction_393 +happyReduction_393 (HappyAbsSyn125 happy_var_1) = + HappyAbsSyn140 + ( pure happy_var_1 + ) +happyReduction_393 _ = notHappyAtAll + +happyReduce_394 = happySpecReduce_2 170 happyReduction_394 +happyReduction_394 + (HappyAbsSyn125 happy_var_2) + (HappyAbsSyn140 happy_var_1) = + HappyAbsSyn140 + ( NE.cons happy_var_2 happy_var_1 + ) +happyReduction_394 _ _ = notHappyAtAll + +happyReduce_395 = happySpecReduce_1 171 happyReduction_395 +happyReduction_395 (HappyAbsSyn55 happy_var_1) = + HappyAbsSyn141 + ( pure happy_var_1 + ) +happyReduction_395 _ = notHappyAtAll + +happyReduce_396 = happySpecReduce_2 171 happyReduction_396 +happyReduction_396 + (HappyAbsSyn55 happy_var_2) + (HappyAbsSyn141 happy_var_1) = + HappyAbsSyn141 + ( NE.cons happy_var_2 happy_var_1 + ) +happyReduction_396 _ _ = notHappyAtAll + +happyReduce_397 = happySpecReduce_1 172 happyReduction_397 +happyReduction_397 (HappyAbsSyn73 happy_var_1) = + HappyAbsSyn146 + ( pure happy_var_1 + ) +happyReduction_397 _ = notHappyAtAll + +happyReduce_398 = happySpecReduce_3 172 happyReduction_398 +happyReduction_398 + (HappyAbsSyn73 happy_var_3) + _ + (HappyAbsSyn146 happy_var_1) = + HappyAbsSyn146 + ( NE.cons happy_var_3 happy_var_1 + ) +happyReduction_398 _ _ _ = notHappyAtAll + +happyReduce_399 = happySpecReduce_1 173 happyReduction_399 +happyReduction_399 (HappyAbsSyn117 happy_var_1) = + HappyAbsSyn147 + ( pure happy_var_1 + ) +happyReduction_399 _ = notHappyAtAll + +happyReduce_400 = happySpecReduce_3 173 happyReduction_400 +happyReduction_400 + (HappyAbsSyn117 happy_var_3) + _ + (HappyAbsSyn147 happy_var_1) = + HappyAbsSyn147 + ( NE.cons happy_var_3 happy_var_1 + ) +happyReduction_400 _ _ _ = notHappyAtAll + +happyReduce_401 = happySpecReduce_1 174 happyReduction_401 +happyReduction_401 (HappyAbsSyn122 happy_var_1) = + HappyAbsSyn148 + ( pure happy_var_1 + ) +happyReduction_401 _ = notHappyAtAll + +happyReduce_402 = happySpecReduce_3 174 happyReduction_402 +happyReduction_402 + (HappyAbsSyn122 happy_var_3) + _ + (HappyAbsSyn148 happy_var_1) = + HappyAbsSyn148 + ( NE.cons happy_var_3 happy_var_1 + ) +happyReduction_402 _ _ _ = notHappyAtAll + +happyReduce_403 = happySpecReduce_1 175 happyReduction_403 +happyReduction_403 (HappyAbsSyn72 happy_var_1) = + HappyAbsSyn149 + ( pure happy_var_1 + ) +happyReduction_403 _ = notHappyAtAll + +happyReduce_404 = happySpecReduce_3 175 happyReduction_404 +happyReduction_404 + (HappyAbsSyn72 happy_var_3) + _ + (HappyAbsSyn149 happy_var_1) = + HappyAbsSyn149 + ( NE.cons happy_var_3 happy_var_1 + ) +happyReduction_404 _ _ _ = notHappyAtAll + +happyReduce_405 = happySpecReduce_1 176 happyReduction_405 +happyReduction_405 (HappyAbsSyn98 happy_var_1) = + HappyAbsSyn150 + ( pure happy_var_1 + ) +happyReduction_405 _ = notHappyAtAll + +happyReduce_406 = happySpecReduce_3 176 happyReduction_406 +happyReduction_406 + (HappyAbsSyn98 happy_var_3) + _ + (HappyAbsSyn150 happy_var_1) = + HappyAbsSyn150 + ( NE.cons happy_var_3 happy_var_1 + ) +happyReduction_406 _ _ _ = notHappyAtAll + +happyReduce_407 = happySpecReduce_1 177 happyReduction_407 +happyReduction_407 (HappyAbsSyn180 happy_var_1) = + HappyAbsSyn151 + ( separated happy_var_1 + ) +happyReduction_407 _ = notHappyAtAll + +happyReduce_408 = happySpecReduce_1 178 happyReduction_408 +happyReduction_408 (HappyAbsSyn196 happy_var_1) = + HappyAbsSyn178 + ( separated happy_var_1 + ) +happyReduction_408 _ = notHappyAtAll + +happyReduce_409 = happySpecReduce_1 179 happyReduction_409 +happyReduction_409 (HappyAbsSyn197 happy_var_1) = + HappyAbsSyn179 + ( separated happy_var_1 + ) +happyReduction_409 _ = notHappyAtAll + +happyReduce_410 = happySpecReduce_1 180 happyReduction_410 +happyReduction_410 (HappyAbsSyn88 happy_var_1) = + HappyAbsSyn180 + ( [(placeholder, happy_var_1)] + ) +happyReduction_410 _ = notHappyAtAll + +happyReduce_411 = happySpecReduce_3 180 happyReduction_411 +happyReduction_411 + (HappyAbsSyn88 happy_var_3) + (HappyTerminal happy_var_2) + (HappyAbsSyn180 happy_var_1) = + HappyAbsSyn180 + ( (happy_var_2, happy_var_3) : happy_var_1 + ) +happyReduction_411 _ _ _ = notHappyAtAll + +happyReduce_412 = happySpecReduce_1 181 happyReduction_412 +happyReduction_412 (HappyAbsSyn121 happy_var_1) = + HappyAbsSyn181 + ( [(placeholder, happy_var_1)] + ) +happyReduction_412 _ = notHappyAtAll + +happyReduce_413 = happySpecReduce_3 181 happyReduction_413 +happyReduction_413 + (HappyAbsSyn121 happy_var_3) + (HappyTerminal happy_var_2) + (HappyAbsSyn181 happy_var_1) = + HappyAbsSyn181 + ( (happy_var_2, happy_var_3) : happy_var_1 + ) +happyReduction_413 _ _ _ = notHappyAtAll + +happyReduce_414 = happySpecReduce_1 182 happyReduction_414 +happyReduction_414 (HappyAbsSyn110 happy_var_1) = + HappyAbsSyn182 + ( [(placeholder, happy_var_1)] + ) +happyReduction_414 _ = notHappyAtAll + +happyReduce_415 = happySpecReduce_3 182 happyReduction_415 +happyReduction_415 + (HappyAbsSyn110 happy_var_3) + (HappyTerminal happy_var_2) + (HappyAbsSyn182 happy_var_1) = + HappyAbsSyn182 + ( (happy_var_2, happy_var_3) : happy_var_1 + ) +happyReduction_415 _ _ _ = notHappyAtAll + +happyReduce_416 = happySpecReduce_1 183 happyReduction_416 +happyReduction_416 (HappyAbsSyn106 happy_var_1) = + HappyAbsSyn183 + ( [(placeholder, happy_var_1)] + ) +happyReduction_416 _ = notHappyAtAll + +happyReduce_417 = happySpecReduce_3 183 happyReduction_417 +happyReduction_417 + (HappyAbsSyn106 happy_var_3) + (HappyAbsSyn57 happy_var_2) + (HappyAbsSyn183 happy_var_1) = + HappyAbsSyn183 + ( (happy_var_2, happy_var_3) : happy_var_1 + ) +happyReduction_417 _ _ _ = notHappyAtAll + +happyReduce_418 = happySpecReduce_1 184 happyReduction_418 +happyReduction_418 (HappyAbsSyn101 happy_var_1) = + HappyAbsSyn184 + ( [(placeholder, happy_var_1)] + ) +happyReduction_418 _ = notHappyAtAll + +happyReduce_419 = happySpecReduce_3 184 happyReduction_419 +happyReduction_419 + (HappyAbsSyn101 happy_var_3) + (HappyTerminal happy_var_2) + (HappyAbsSyn184 happy_var_1) = + HappyAbsSyn184 + ( (happy_var_2, happy_var_3) : happy_var_1 + ) +happyReduction_419 _ _ _ = notHappyAtAll + +happyReduce_420 = happySpecReduce_1 185 happyReduction_420 +happyReduction_420 (HappyAbsSyn59 happy_var_1) = + HappyAbsSyn185 + ( [(placeholder, happy_var_1)] + ) +happyReduction_420 _ = notHappyAtAll + +happyReduce_421 = happySpecReduce_3 185 happyReduction_421 +happyReduction_421 + (HappyAbsSyn59 happy_var_3) + (HappyTerminal happy_var_2) + (HappyAbsSyn185 happy_var_1) = + HappyAbsSyn185 + ( (happy_var_2, happy_var_3) : happy_var_1 + ) +happyReduction_421 _ _ _ = notHappyAtAll + +happyReduce_422 = happySpecReduce_1 186 happyReduction_422 +happyReduction_422 (HappyAbsSyn116 happy_var_1) = + HappyAbsSyn186 + ( [(placeholder, happy_var_1)] + ) +happyReduction_422 _ = notHappyAtAll + +happyReduce_423 = happySpecReduce_3 186 happyReduction_423 +happyReduction_423 + (HappyAbsSyn116 happy_var_3) + (HappyTerminal happy_var_2) + (HappyAbsSyn186 happy_var_1) = + HappyAbsSyn186 + ( (happy_var_2, happy_var_3) : happy_var_1 + ) +happyReduction_423 _ _ _ = notHappyAtAll + +happyReduce_424 = happySpecReduce_1 187 happyReduction_424 +happyReduction_424 (HappyAbsSyn105 happy_var_1) = + HappyAbsSyn187 + ( [(placeholder, happy_var_1)] + ) +happyReduction_424 _ = notHappyAtAll + +happyReduce_425 = happySpecReduce_3 187 happyReduction_425 +happyReduction_425 + (HappyAbsSyn105 happy_var_3) + (HappyTerminal happy_var_2) + (HappyAbsSyn187 happy_var_1) = + HappyAbsSyn187 + ( (happy_var_2, happy_var_3) : happy_var_1 + ) +happyReduction_425 _ _ _ = notHappyAtAll + +happyReduce_426 = happySpecReduce_1 188 happyReduction_426 +happyReduction_426 (HappyAbsSyn35 happy_var_1) = + HappyAbsSyn188 + ( [(placeholder, happy_var_1)] + ) +happyReduction_426 _ = notHappyAtAll + +happyReduce_427 = happySpecReduce_3 188 happyReduction_427 +happyReduction_427 + (HappyAbsSyn35 happy_var_3) + (HappyTerminal happy_var_2) + (HappyAbsSyn188 happy_var_1) = + HappyAbsSyn188 + ( (happy_var_2, happy_var_3) : happy_var_1 + ) +happyReduction_427 _ _ _ = notHappyAtAll + +happyReduce_428 = happySpecReduce_1 189 happyReduction_428 +happyReduction_428 (HappyAbsSyn28 happy_var_1) = + HappyAbsSyn189 + ( [(placeholder, happy_var_1)] + ) +happyReduction_428 _ = notHappyAtAll + +happyReduce_429 = happySpecReduce_3 189 happyReduction_429 +happyReduction_429 + (HappyAbsSyn28 happy_var_3) + (HappyTerminal happy_var_2) + (HappyAbsSyn189 happy_var_1) = + HappyAbsSyn189 + ( (happy_var_2, happy_var_3) : happy_var_1 + ) +happyReduction_429 _ _ _ = notHappyAtAll + +happyReduce_430 = happySpecReduce_1 190 happyReduction_430 +happyReduction_430 (HappyAbsSyn71 happy_var_1) = + HappyAbsSyn190 + ( [(placeholder, happy_var_1)] + ) +happyReduction_430 _ = notHappyAtAll + +happyReduce_431 = happySpecReduce_3 190 happyReduction_431 +happyReduction_431 + (HappyAbsSyn71 happy_var_3) + (HappyTerminal happy_var_2) + (HappyAbsSyn190 happy_var_1) = + HappyAbsSyn190 + ( (happy_var_2, happy_var_3) : happy_var_1 + ) +happyReduction_431 _ _ _ = notHappyAtAll + +happyReduce_432 = happySpecReduce_1 191 happyReduction_432 +happyReduction_432 (HappyAbsSyn70 happy_var_1) = + HappyAbsSyn191 + ( [(placeholder, happy_var_1)] + ) +happyReduction_432 _ = notHappyAtAll + +happyReduce_433 = happySpecReduce_3 191 happyReduction_433 +happyReduction_433 + (HappyAbsSyn70 happy_var_3) + (HappyTerminal happy_var_2) + (HappyAbsSyn191 happy_var_1) = + HappyAbsSyn191 + ( (happy_var_2, happy_var_3) : happy_var_1 + ) +happyReduction_433 _ _ _ = notHappyAtAll + +happyReduce_434 = happySpecReduce_1 192 happyReduction_434 +happyReduction_434 (HappyAbsSyn54 happy_var_1) = + HappyAbsSyn192 + ( [(placeholder, happy_var_1)] + ) +happyReduction_434 _ = notHappyAtAll + +happyReduce_435 = happySpecReduce_3 192 happyReduction_435 +happyReduction_435 + (HappyAbsSyn54 happy_var_3) + (HappyTerminal happy_var_2) + (HappyAbsSyn192 happy_var_1) = + HappyAbsSyn192 + ( (happy_var_2, happy_var_3) : happy_var_1 + ) +happyReduction_435 _ _ _ = notHappyAtAll + +happyReduce_436 = happySpecReduce_1 193 happyReduction_436 +happyReduction_436 (HappyAbsSyn42 happy_var_1) = + HappyAbsSyn164 + ( pure happy_var_1 + ) +happyReduction_436 _ = notHappyAtAll + +happyReduce_437 = happySpecReduce_2 193 happyReduction_437 +happyReduction_437 + (HappyAbsSyn42 happy_var_2) + (HappyAbsSyn164 happy_var_1) = + HappyAbsSyn164 + ( NE.cons happy_var_2 happy_var_1 + ) +happyReduction_437 _ _ = notHappyAtAll + +happyReduce_438 = happySpecReduce_1 194 happyReduction_438 +happyReduction_438 (HappyAbsSyn55 happy_var_1) = + HappyAbsSyn141 + ( pure happy_var_1 + ) +happyReduction_438 _ = notHappyAtAll + +happyReduce_439 = happySpecReduce_2 194 happyReduction_439 +happyReduction_439 + (HappyAbsSyn55 happy_var_2) + (HappyAbsSyn141 happy_var_1) = + HappyAbsSyn141 + ( NE.cons happy_var_2 happy_var_1 + ) +happyReduction_439 _ _ = notHappyAtAll + +happyReduce_440 = happySpecReduce_1 195 happyReduction_440 +happyReduction_440 (HappyAbsSyn88 happy_var_1) = + HappyAbsSyn180 + ( [(placeholder, happy_var_1)] + ) +happyReduction_440 _ = notHappyAtAll + +happyReduce_441 = happySpecReduce_3 195 happyReduction_441 +happyReduction_441 + (HappyAbsSyn88 happy_var_3) + (HappyTerminal happy_var_2) + (HappyAbsSyn180 happy_var_1) = + HappyAbsSyn180 + ( (happy_var_2, happy_var_3) : happy_var_1 + ) +happyReduction_441 _ _ _ = notHappyAtAll + +happyReduce_442 = happySpecReduce_1 196 happyReduction_442 +happyReduction_442 (HappyAbsSyn92 happy_var_1) = + HappyAbsSyn196 + ( [(placeholder, happy_var_1)] + ) +happyReduction_442 _ = notHappyAtAll + +happyReduce_443 = happySpecReduce_3 196 happyReduction_443 +happyReduction_443 + (HappyAbsSyn92 happy_var_3) + (HappyTerminal happy_var_2) + (HappyAbsSyn196 happy_var_1) = + HappyAbsSyn196 + ( (happy_var_2, happy_var_3) : happy_var_1 + ) +happyReduction_443 _ _ _ = notHappyAtAll + +happyReduce_444 = happySpecReduce_1 197 happyReduction_444 +happyReduction_444 (HappyAbsSyn69 happy_var_1) = + HappyAbsSyn197 + ( [(placeholder, happy_var_1)] + ) +happyReduction_444 _ = notHappyAtAll + +happyReduce_445 = happySpecReduce_3 197 happyReduction_445 +happyReduction_445 + (HappyAbsSyn69 happy_var_3) + (HappyTerminal happy_var_2) + (HappyAbsSyn197 happy_var_1) = + HappyAbsSyn197 + ( (happy_var_2, happy_var_3) : happy_var_1 + ) +happyReduction_445 _ _ _ = notHappyAtAll + +happyNewToken action sts stk = + lexer + ( \tk -> + let cont i = action i i tk (HappyState action) sts stk + in case tk of + SourceToken _ TokEof -> action 270 270 tk (HappyState action) sts stk + SourceToken _ TokLeftParen -> cont 198 + SourceToken _ TokRightParen -> cont 199 + SourceToken _ TokLeftBrace -> cont 200 + SourceToken _ TokRightBrace -> cont 201 + SourceToken _ TokLeftSquare -> cont 202 + SourceToken _ TokRightSquare -> cont 203 + SourceToken _ TokLayoutStart -> cont 204 + SourceToken _ TokLayoutEnd -> cont 205 + SourceToken _ TokLayoutSep -> cont 206 + SourceToken _ (TokLeftArrow _) -> cont 207 + SourceToken _ (TokRightArrow _) -> cont 208 + SourceToken _ (TokOperator [] sym) | isLeftFatArrow sym -> cont 209 + SourceToken _ (TokRightFatArrow _) -> cont 210 + SourceToken _ (TokOperator [] ":") -> cont 211 + SourceToken _ (TokDoubleColon _) -> cont 212 + SourceToken _ TokEquals -> cont 213 + SourceToken _ TokPipe -> cont 214 + SourceToken _ TokTick -> cont 215 + SourceToken _ TokDot -> cont 216 + SourceToken _ TokComma -> cont 217 + SourceToken _ TokUnderscore -> cont 218 + SourceToken _ TokBackslash -> cont 219 + SourceToken _ (TokOperator [] "-") -> cont 220 + SourceToken _ (TokOperator [] "@") -> cont 221 + SourceToken _ (TokLowerName _ "ado") -> cont 222 + SourceToken _ (TokLowerName [] "as") -> cont 223 + SourceToken _ (TokLowerName [] "case") -> cont 224 + SourceToken _ (TokLowerName [] "class") -> cont 225 + SourceToken _ (TokLowerName [] "data") -> cont 226 + SourceToken _ (TokLowerName [] "derive") -> cont 227 + SourceToken _ (TokLowerName _ "do") -> cont 228 + SourceToken _ (TokLowerName [] "else") -> cont 229 + SourceToken _ (TokLowerName [] "false") -> cont 230 + SourceToken _ (TokForall ASCII) -> cont 231 + SourceToken _ (TokForall Unicode) -> cont 232 + SourceToken _ (TokLowerName [] "foreign") -> cont 233 + SourceToken _ (TokLowerName [] "hiding") -> cont 234 + SourceToken _ (TokLowerName [] "import") -> cont 235 + SourceToken _ (TokLowerName [] "if") -> cont 236 + SourceToken _ (TokLowerName [] "in") -> cont 237 + SourceToken _ (TokLowerName [] "infix") -> cont 238 + SourceToken _ (TokLowerName [] "infixl") -> cont 239 + SourceToken _ (TokLowerName [] "infixr") -> cont 240 + SourceToken _ (TokLowerName [] "instance") -> cont 241 + SourceToken _ (TokLowerName [] "let") -> cont 242 + SourceToken _ (TokLowerName [] "module") -> cont 243 + SourceToken _ (TokLowerName [] "newtype") -> cont 244 + SourceToken _ (TokLowerName [] "nominal") -> cont 245 + SourceToken _ (TokLowerName [] "phantom") -> cont 246 + SourceToken _ (TokLowerName [] "of") -> cont 247 + SourceToken _ (TokLowerName [] "representational") -> cont 248 + SourceToken _ (TokLowerName [] "role") -> cont 249 + SourceToken _ (TokLowerName [] "then") -> cont 250 + SourceToken _ (TokLowerName [] "true") -> cont 251 + SourceToken _ (TokLowerName [] "type") -> cont 252 + SourceToken _ (TokLowerName [] "where") -> cont 253 + SourceToken _ (TokSymbolArr _) -> cont 254 + SourceToken _ (TokSymbolName [] "..") -> cont 255 + SourceToken _ (TokLowerName [] _) -> cont 256 + SourceToken _ (TokLowerName _ _) -> cont 257 + SourceToken _ (TokUpperName [] _) -> cont 258 + SourceToken _ (TokUpperName _ _) -> cont 259 + SourceToken _ (TokSymbolName [] _) -> cont 260 + SourceToken _ (TokSymbolName _ _) -> cont 261 + SourceToken _ (TokOperator [] _) -> cont 262 + SourceToken _ (TokOperator _ _) -> cont 263 + SourceToken _ (TokHole _) -> cont 264 + SourceToken _ (TokChar _ _) -> cont 265 + SourceToken _ (TokString _ _) -> cont 266 + SourceToken _ (TokRawString _) -> cont 267 + SourceToken _ (TokInt _ _) -> cont 268 + SourceToken _ (TokNumber _ _) -> cont 269 + _ -> happyError' (tk, []) + ) + +happyError_ explist 270 tk = happyError' (tk, explist) +happyError_ explist _ tk = happyError' (tk, explist) + +happyThen :: () => Parser a -> (a -> Parser b) -> Parser b +happyThen = (Prelude.>>=) +happyReturn :: () => a -> Parser a +happyReturn = (Prelude.return) +happyThen1 :: () => Parser a -> (a -> Parser b) -> Parser b +happyThen1 = happyThen +happyReturn1 :: () => a -> Parser a +happyReturn1 = happyReturn +happyError' :: () => ((SourceToken), [Prelude.String]) -> Parser a +happyError' tk = (\(tokens, _) -> parseError tokens) tk +parseType = happySomeParser + where + happySomeParser = happyThen (happyParse action_0) (\x -> case x of HappyAbsSyn42 z -> happyReturn z; _other -> notHappyAtAll) + +parseExpr = happySomeParser + where + happySomeParser = happyThen (happyParse action_1) (\x -> case x of HappyAbsSyn59 z -> happyReturn z; _other -> notHappyAtAll) + +parseIdent = happySomeParser + where + happySomeParser = happyThen (happyParse action_2) (\x -> case x of HappyAbsSyn30 z -> happyReturn z; _other -> notHappyAtAll) + +parseOperator = happySomeParser + where + happySomeParser = happyThen (happyParse action_3) (\x -> case x of HappyAbsSyn32 z -> happyReturn z; _other -> notHappyAtAll) + +parseModuleBody = happySomeParser + where + happySomeParser = happyThen (happyParse action_4) (\x -> case x of HappyAbsSyn94 z -> happyReturn z; _other -> notHappyAtAll) + +parseDecl = happySomeParser + where + happySomeParser = happyThen (happyParse action_5) (\x -> case x of HappyAbsSyn106 z -> happyReturn z; _other -> notHappyAtAll) + +parseImportDeclP = happySomeParser + where + happySomeParser = happyThen (happyParse action_6) (\x -> case x of HappyAbsSyn103 z -> happyReturn z; _other -> notHappyAtAll) + +parseDeclP = happySomeParser + where + happySomeParser = happyThen (happyParse action_7) (\x -> case x of HappyAbsSyn106 z -> happyReturn z; _other -> notHappyAtAll) + +parseExprP = happySomeParser + where + happySomeParser = happyThen (happyParse action_8) (\x -> case x of HappyAbsSyn59 z -> happyReturn z; _other -> notHappyAtAll) + +parseTypeP = happySomeParser + where + happySomeParser = happyThen (happyParse action_9) (\x -> case x of HappyAbsSyn42 z -> happyReturn z; _other -> notHappyAtAll) + +parseModuleNameP = happySomeParser + where + happySomeParser = happyThen (happyParse action_10) (\x -> case x of HappyAbsSyn26 z -> happyReturn z; _other -> notHappyAtAll) + +parseQualIdentP = happySomeParser + where + happySomeParser = happyThen (happyParse action_11) (\x -> case x of HappyAbsSyn29 z -> happyReturn z; _other -> notHappyAtAll) + +parseModuleHeader = happySomeParser + where + happySomeParser = happyThen (happyParse action_12) (\x -> case x of HappyAbsSyn93 z -> happyReturn z; _other -> notHappyAtAll) + +parseDoStatement = happySomeParser + where + happySomeParser = happyThen (happyParse action_13) (\x -> case x of HappyAbsSyn80 z -> happyReturn z; _other -> notHappyAtAll) + +parseDoExpr = happySomeParser + where + happySomeParser = happyThen (happyParse action_14) (\x -> case x of HappyAbsSyn59 z -> happyReturn z; _other -> notHappyAtAll) + +parseDoNext = happySomeParser + where + happySomeParser = happyThen (happyParse action_15) (\x -> case x of HappyAbsSyn80 z -> happyReturn z; _other -> notHappyAtAll) + +parseGuardExpr = happySomeParser + where + happySomeParser = happyThen (happyParse action_16) (\x -> case x of HappyAbsSyn85 z -> happyReturn z; _other -> notHappyAtAll) + +parseGuardNext = happySomeParser + where + happySomeParser = happyThen (happyParse action_17) (\x -> case x of HappyAbsSyn86 z -> happyReturn z; _other -> notHappyAtAll) + +parseGuardStatement = happySomeParser + where + happySomeParser = happyThen (happyParse action_18) (\x -> case x of HappyAbsSyn84 z -> happyReturn z; _other -> notHappyAtAll) + +parseClassSignature = happySomeParser + where + happySomeParser = happyThen (happyParse action_19) (\x -> case x of HappyAbsSyn112 z -> happyReturn z; _other -> notHappyAtAll) + +parseClassSuper = happySomeParser + where + happySomeParser = happyThen (happyParse action_20) (\x -> case x of HappyAbsSyn113 z -> happyReturn z; _other -> notHappyAtAll) + +parseClassNameAndFundeps = happySomeParser + where + happySomeParser = happyThen (happyParse action_21) (\x -> case x of HappyAbsSyn114 z -> happyReturn z; _other -> notHappyAtAll) + +parseBinderAndArrow = happySomeParser + where + happySomeParser = happyThen (happyParse action_22) (\x -> case x of HappyAbsSyn87 z -> happyReturn z; _other -> notHappyAtAll) + +happySeq = happyDontSeq + +lexer :: (SourceToken -> Parser a) -> Parser a +lexer k = munch >>= k + +parse :: Text -> ([ParserWarning], Either (NE.NonEmpty ParserError) (Module ())) +parse = either (([],) . Left) resFull . parseModule . lexModule + +data PartialResult a = PartialResult + { resPartial :: a + , resFull :: ([ParserWarning], Either (NE.NonEmpty ParserError) a) + } + deriving (Functor) + +parseModule :: [LexResult] -> Either (NE.NonEmpty ParserError) (PartialResult (Module ())) +parseModule toks = fmap (\header -> PartialResult header (parseFull header)) headerRes + where + (st, headerRes) = + runParser (ParserState toks [] []) parseModuleHeader + + parseFull header = do + let (ParserState _ _ warnings, res) = runParser st parseModuleBody + (warnings, (\(decls, trailing) -> header {modDecls = decls, modTrailingComments = trailing}) <$> res) +{-# LINE 1 "templates/GenericTemplate.hs" #-} +-- $Id: GenericTemplate.hs,v 1.26 2005/01/14 14:47:22 simonmar Exp $ + +data Happy_IntList = HappyCons Prelude.Int Happy_IntList + +infixr 9 `HappyStk` +data HappyStk a = HappyStk a (HappyStk a) + +----------------------------------------------------------------------------- +-- starting the parse + +happyParse start_state = happyNewToken start_state notHappyAtAll notHappyAtAll + +----------------------------------------------------------------------------- +-- Accepting the parse + +-- If the current token is ERROR_TOK, it means we've just accepted a partial +-- parse (a %partial parser). We must ignore the saved token on the top of +-- the stack in this case. +happyAccept (1) tk st sts (_ `HappyStk` ans `HappyStk` _) = + happyReturn1 ans +happyAccept j tk st sts (HappyStk ans _) = + (happyReturn1 ans) + +----------------------------------------------------------------------------- +-- Arrays only: do the next action + +indexShortOffAddr arr off = arr Happy_Data_Array.! off + +{-# INLINE happyLt #-} +happyLt x y = (x Prelude.< y) + +readArrayBit arr bit = + Bits.testBit (indexShortOffAddr arr (bit `Prelude.div` 16)) (bit `Prelude.mod` 16) + +----------------------------------------------------------------------------- +-- HappyState data type (not arrays) + +newtype HappyState b c + = HappyState + ( Prelude.Int -> -- token number + Prelude.Int -> -- token number (yes, again) + b -> -- token semantic value + HappyState b c -> -- current state + [HappyState b c] -> -- state stack + c + ) + +----------------------------------------------------------------------------- +-- Shifting a token + +happyShift new_state (1) tk st sts stk@(x `HappyStk` _) = + let i = (case x of HappyErrorToken (i) -> i) + in -- trace "shifting the error token" $ + new_state i i tk (HappyState (new_state)) ((st) : (sts)) (stk) +happyShift new_state i tk st sts stk = + happyNewToken new_state ((st) : (sts)) ((HappyTerminal (tk)) `HappyStk` stk) + +-- happyReduce is specialised for the common cases. + +happySpecReduce_0 i fn (1) tk st sts stk = + happyFail [] (1) tk st sts stk +happySpecReduce_0 nt fn j tk st@((HappyState (action))) sts stk = + action nt j tk st ((st) : (sts)) (fn `HappyStk` stk) + +happySpecReduce_1 i fn (1) tk st sts stk = + happyFail [] (1) tk st sts stk +happySpecReduce_1 nt fn j tk _ sts@(((st@(HappyState (action))) : (_))) (v1 `HappyStk` stk') = + let r = fn v1 + in happySeq r (action nt j tk st sts (r `HappyStk` stk')) + +happySpecReduce_2 i fn (1) tk st sts stk = + happyFail [] (1) tk st sts stk +happySpecReduce_2 nt fn j tk _ ((_) : (sts@(((st@(HappyState (action))) : (_))))) (v1 `HappyStk` v2 `HappyStk` stk') = + let r = fn v1 v2 + in happySeq r (action nt j tk st sts (r `HappyStk` stk')) + +happySpecReduce_3 i fn (1) tk st sts stk = + happyFail [] (1) tk st sts stk +happySpecReduce_3 nt fn j tk _ ((_) : (((_) : (sts@(((st@(HappyState (action))) : (_))))))) (v1 `HappyStk` v2 `HappyStk` v3 `HappyStk` stk') = + let r = fn v1 v2 v3 + in happySeq r (action nt j tk st sts (r `HappyStk` stk')) + +happyReduce k i fn (1) tk st sts stk = + happyFail [] (1) tk st sts stk +happyReduce k nt fn j tk st sts stk = + case happyDrop (k Prelude.- ((1) :: Prelude.Int)) sts of + sts1@(((st1@(HappyState (action))) : (_))) -> + let r = fn stk -- it doesn't hurt to always seq here... + in happyDoSeq r (action nt j tk st1 sts1 r) + +happyMonadReduce k nt fn (1) tk st sts stk = + happyFail [] (1) tk st sts stk +happyMonadReduce k nt fn j tk st sts stk = + case happyDrop k ((st) : (sts)) of + sts1@(((st1@(HappyState (action))) : (_))) -> + let drop_stk = happyDropStk k stk + in happyThen1 (fn stk tk) (\r -> action nt j tk st1 sts1 (r `HappyStk` drop_stk)) + +happyMonad2Reduce k nt fn (1) tk st sts stk = + happyFail [] (1) tk st sts stk +happyMonad2Reduce k nt fn j tk st sts stk = + case happyDrop k ((st) : (sts)) of + sts1@(((st1@(HappyState (action))) : (_))) -> + let drop_stk = happyDropStk k stk + + _ = nt :: Prelude.Int + new_state = action + in happyThen1 (fn stk tk) (\r -> happyNewToken new_state sts1 (r `HappyStk` drop_stk)) + +happyDrop (0) l = l +happyDrop n ((_) : (t)) = happyDrop (n Prelude.- ((1) :: Prelude.Int)) t + +happyDropStk (0) l = l +happyDropStk n (x `HappyStk` xs) = happyDropStk (n Prelude.- ((1) :: Prelude.Int)) xs + +----------------------------------------------------------------------------- +-- Moving to a new state after a reduction + +happyGoto action j tk st = action j j tk (HappyState action) + +----------------------------------------------------------------------------- +-- Error recovery (ERROR_TOK is the error token) + +-- parse error if we are in recovery and we fail again +happyFail explist (1) tk old_st _ stk@(x `HappyStk` _) = + let i = (case x of HappyErrorToken (i) -> i) + in -- trace "failing" $ + happyError_ explist i tk +{- We don't need state discarding for our restricted implementation of + "error". In fact, it can cause some bogus parses, so I've disabled it + for now --SDM + +-- discard a state +happyFail ERROR_TOK tk old_st CONS(HAPPYSTATE(action),sts) + (saved_tok `HappyStk` _ `HappyStk` stk) = +-- trace ("discarding state, depth " ++ show (length stk)) $ + DO_ACTION(action,ERROR_TOK,tk,sts,(saved_tok`HappyStk`stk)) +-} + +-- Enter error recovery: generate an error token, +-- save the old token and carry on. +happyFail explist i tk (HappyState (action)) sts stk = + -- trace "entering error recovery" $ + action (1) (1) tk (HappyState (action)) sts ((HappyErrorToken (i)) `HappyStk` stk) + +-- Internal happy errors: + +notHappyAtAll :: a +notHappyAtAll = Prelude.error "Internal Happy error\n" + +----------------------------------------------------------------------------- +-- Hack to get the typechecker to accept our action functions + +----------------------------------------------------------------------------- +-- Seq-ing. If the --strict flag is given, then Happy emits +-- happySeq = happyDoSeq +-- otherwise it emits +-- happySeq = happyDontSeq + +happyDoSeq, happyDontSeq :: a -> b -> b +happyDoSeq a b = a `Prelude.seq` b +happyDontSeq a b = b + +----------------------------------------------------------------------------- +-- Don't inline any functions from the template. GHC has a nasty habit +-- of deciding to inline happyGoto everywhere, which increases the size of +-- the generated parser quite a bit. + +{-# NOINLINE happyShift #-} +{-# NOINLINE happySpecReduce_0 #-} +{-# NOINLINE happySpecReduce_1 #-} +{-# NOINLINE happySpecReduce_2 #-} +{-# NOINLINE happySpecReduce_3 #-} +{-# NOINLINE happyReduce #-} +{-# NOINLINE happyMonadReduce #-} +{-# NOINLINE happyGoto #-} +{-# NOINLINE happyFail #-} + +-- end of Happy Template. diff --git a/src/Language/PureScript/CST/Parser.info b/src/Language/PureScript/CST/Parser.info new file mode 100644 index 000000000..c61fbf1b7 --- /dev/null +++ b/src/Language/PureScript/CST/Parser.info @@ -0,0 +1,20284 @@ +----------------------------------------------------------------------------- +Info file generated by Happy Version 1.20.1.1 from src/Language/PureScript/CST/Parser.y +----------------------------------------------------------------------------- + + +----------------------------------------------------------------------------- +Grammar +----------------------------------------------------------------------------- + %start_parseType -> type (0) + %start_parseExpr -> expr (1) + %start_parseIdent -> ident (2) + %start_parseOperator -> op (3) + %start_parseModuleBody -> moduleBody (4) + %start_parseDecl -> decl (5) + %start_parseImportDeclP -> importDeclP (6) + %start_parseDeclP -> declP (7) + %start_parseExprP -> exprP (8) + %start_parseTypeP -> typeP (9) + %start_parseModuleNameP -> moduleNameP (10) + %start_parseQualIdentP -> qualIdentP (11) + %start_parseModuleHeader -> moduleHeader (12) + %start_parseDoStatement -> doStatement (13) + %start_parseDoExpr -> doExpr (14) + %start_parseDoNext -> doNext (15) + %start_parseGuardExpr -> guardExpr (16) + %start_parseGuardNext -> guardNext (17) + %start_parseGuardStatement -> guardStatement (18) + %start_parseClassSignature -> classSignature (19) + %start_parseClassSuper -> classSuper (20) + %start_parseClassNameAndFundeps -> classNameAndFundeps (21) + %start_parseBinderAndArrow -> binderAndArrow (22) + moduleName -> UPPER (23) + moduleName -> QUAL_UPPER (24) + qualProperName -> UPPER (25) + qualProperName -> QUAL_UPPER (26) + properName -> UPPER (27) + qualIdent -> LOWER (28) + qualIdent -> QUAL_LOWER (29) + qualIdent -> 'as' (30) + qualIdent -> 'hiding' (31) + qualIdent -> 'role' (32) + qualIdent -> 'nominal' (33) + qualIdent -> 'representational' (34) + qualIdent -> 'phantom' (35) + ident -> LOWER (36) + ident -> 'as' (37) + ident -> 'hiding' (38) + ident -> 'role' (39) + ident -> 'nominal' (40) + ident -> 'representational' (41) + ident -> 'phantom' (42) + qualOp -> OPERATOR (43) + qualOp -> QUAL_OPERATOR (44) + qualOp -> '<=' (45) + qualOp -> '-' (46) + qualOp -> ':' (47) + op -> OPERATOR (48) + op -> '<=' (49) + op -> '-' (50) + op -> ':' (51) + qualSymbol -> SYMBOL (52) + qualSymbol -> QUAL_SYMBOL (53) + qualSymbol -> '(..)' (54) + symbol -> SYMBOL (55) + symbol -> '(..)' (56) + label -> LOWER (57) + label -> LIT_STRING (58) + label -> LIT_RAW_STRING (59) + label -> 'ado' (60) + label -> 'as' (61) + label -> 'case' (62) + label -> 'class' (63) + label -> 'data' (64) + label -> 'derive' (65) + label -> 'do' (66) + label -> 'else' (67) + label -> 'false' (68) + label -> 'forall' (69) + label -> 'foreign' (70) + label -> 'hiding' (71) + label -> 'import' (72) + label -> 'if' (73) + label -> 'in' (74) + label -> 'infix' (75) + label -> 'infixl' (76) + label -> 'infixr' (77) + label -> 'instance' (78) + label -> 'let' (79) + label -> 'module' (80) + label -> 'newtype' (81) + label -> 'nominal' (82) + label -> 'of' (83) + label -> 'phantom' (84) + label -> 'representational' (85) + label -> 'role' (86) + label -> 'then' (87) + label -> 'true' (88) + label -> 'type' (89) + label -> 'where' (90) + hole -> LIT_HOLE (91) + string -> LIT_STRING (92) + string -> LIT_RAW_STRING (93) + char -> LIT_CHAR (94) + number -> LIT_INT (95) + number -> LIT_NUMBER (96) + int -> LIT_INT (97) + boolean -> 'true' (98) + boolean -> 'false' (99) + type -> type1 (100) + type -> type1 '::' type (101) + type1 -> type2 (102) + type1 -> forall many__typeVarBinding__ '.' type1 (103) + type2 -> type3 (104) + type2 -> type3 '->' type1 (105) + type2 -> type3 '=>' type1 (106) + type3 -> type4 (107) + type3 -> type3 qualOp type4 (108) + type4 -> type5 (109) + type4 -> '-' int (110) + type5 -> typeAtom (111) + type5 -> type5 typeAtom (112) + typeAtom -> '_' (113) + typeAtom -> ident (114) + typeAtom -> qualProperName (115) + typeAtom -> qualSymbol (116) + typeAtom -> string (117) + typeAtom -> int (118) + typeAtom -> hole (119) + typeAtom -> '(->)' (120) + typeAtom -> '{' row '}' (121) + typeAtom -> '(' row ')' (122) + typeAtom -> '(' type1 ')' (123) + typeAtom -> '(' typeKindedAtom '::' type ')' (124) + typeKindedAtom -> '_' (125) + typeKindedAtom -> qualProperName (126) + typeKindedAtom -> qualSymbol (127) + typeKindedAtom -> int (128) + typeKindedAtom -> hole (129) + typeKindedAtom -> '{' row '}' (130) + typeKindedAtom -> '(' row ')' (131) + typeKindedAtom -> '(' type1 ')' (132) + typeKindedAtom -> '(' typeKindedAtom '::' type ')' (133) + row -> (134) + row -> '|' type (135) + row -> sep__rowLabel__','__ (136) + row -> sep__rowLabel__','__ '|' type (137) + rowLabel -> label '::' type (138) + typeVarBinding -> ident (139) + typeVarBinding -> '@' ident (140) + typeVarBinding -> '(' ident '::' type ')' (141) + typeVarBinding -> '(' '@' ident '::' type ')' (142) + typeVarBindingPlain -> ident (143) + typeVarBindingPlain -> '(' ident '::' type ')' (144) + forall -> 'forall' (145) + forall -> 'forallu' (146) + exprWhere -> expr (147) + exprWhere -> expr 'where' '\{' manySep__letBinding__'\;'__ '\}' (148) + expr -> expr1 (149) + expr -> expr1 '::' type (150) + expr1 -> expr2 (151) + expr1 -> expr1 qualOp expr2 (152) + expr2 -> expr3 (153) + expr2 -> expr2 '`' exprBacktick '`' expr3 (154) + exprBacktick -> expr3 (155) + exprBacktick -> exprBacktick qualOp expr3 (156) + expr3 -> expr4 (157) + expr3 -> '-' expr3 (158) + expr4 -> expr5 (159) + expr4 -> expr4 expr5 (160) + expr4 -> expr4 '@' typeAtom (161) + expr5 -> expr6 (162) + expr5 -> 'if' expr 'then' expr 'else' expr (163) + expr5 -> doBlock (164) + expr5 -> adoBlock 'in' expr (165) + expr5 -> '\\' many__binderAtom__ '->' expr (166) + expr5 -> 'let' '\{' manySep__letBinding__'\;'__ '\}' 'in' expr (167) + expr5 -> 'case' sep__expr__','__ 'of' '\{' manySep__caseBranch__'\;'__ '\}' (168) + expr5 -> 'case' sep__expr__','__ 'of' '\{' sep__binder1__','__ '->' '\}' exprWhere (169) + expr5 -> 'case' sep__expr__','__ 'of' '\{' sep__binder1__','__ '\}' guardedCase (170) + expr6 -> expr7 (171) + expr6 -> expr7 '{' '}' (172) + expr6 -> expr7 '{' sep__recordUpdateOrLabel__','__ '}' (173) + expr7 -> exprAtom (174) + expr7 -> exprAtom '.' sep__label__'.'__ (175) + exprAtom -> '_' (176) + exprAtom -> hole (177) + exprAtom -> qualIdent (178) + exprAtom -> qualProperName (179) + exprAtom -> qualSymbol (180) + exprAtom -> boolean (181) + exprAtom -> char (182) + exprAtom -> string (183) + exprAtom -> number (184) + exprAtom -> delim__'['__expr__','__']'__ (185) + exprAtom -> delim__'{'__recordLabel__','__'}'__ (186) + exprAtom -> '(' expr ')' (187) + recordLabel -> label (188) + recordLabel -> label '=' expr (189) + recordLabel -> label ':' expr (190) + recordUpdateOrLabel -> label ':' expr (191) + recordUpdateOrLabel -> label (192) + recordUpdateOrLabel -> label '=' expr (193) + recordUpdateOrLabel -> label '{' sep__recordUpdate__','__ '}' (194) + recordUpdate -> label '=' expr (195) + recordUpdate -> label '{' sep__recordUpdate__','__ '}' (196) + letBinding -> ident '::' type (197) + letBinding -> ident guardedDecl (198) + letBinding -> ident many__binderAtom__ guardedDecl (199) + letBinding -> binder1 '=' exprWhere (200) + caseBranch -> sep__binder1__','__ guardedCase (201) + guardedDecl -> '=' exprWhere (202) + guardedDecl -> many__guardedDeclExpr__ (203) + guardedDeclExpr -> guard '=' exprWhere (204) + guardedCase -> '->' exprWhere (205) + guardedCase -> many__guardedCaseExpr__ (206) + guardedCaseExpr -> guard '->' exprWhere (207) + doBlock -> 'do' '\{' (208) + adoBlock -> 'ado' '\{' '\}' (209) + adoBlock -> 'ado' '\{' (210) + doStatement -> 'let' '\{' manySep__letBinding__'\;'__ '\}' (211) + doStatement -> (212) + doExpr -> expr (213) + doNext -> '\;' (214) + doNext -> '\}' (215) + guard -> '|' (216) + guardStatement -> (217) + guardExpr -> expr1 (218) + guardNext -> ',' (219) + guardNext -> (220) + binderAndArrow -> binder '<-' (221) + binder -> binder1 (222) + binder -> binder1 '::' type (223) + binder1 -> binder2 (224) + binder1 -> binder1 qualOp binder2 (225) + binder2 -> many__binderAtom__ (226) + binder2 -> '-' number (227) + binderAtom -> '_' (228) + binderAtom -> ident (229) + binderAtom -> ident '@' binderAtom (230) + binderAtom -> qualProperName (231) + binderAtom -> boolean (232) + binderAtom -> char (233) + binderAtom -> string (234) + binderAtom -> number (235) + binderAtom -> delim__'['__binder__','__']'__ (236) + binderAtom -> delim__'{'__recordBinder__','__'}'__ (237) + binderAtom -> '(' binder ')' (238) + recordBinder -> label (239) + recordBinder -> label '=' binder (240) + recordBinder -> label ':' binder (241) + moduleHeader -> 'module' moduleName exports 'where' '\{' moduleImports (242) + moduleBody -> moduleDecls '\}' (243) + moduleImports -> importDecls importDecl '\}' (244) + moduleImports -> importDecls (245) + importDecls -> importDecls importDecl '\;' (246) + importDecls -> (247) + moduleDecls -> manySep__moduleDecl__'\;'__ (248) + moduleDecls -> (249) + moduleDecl -> importDecl (250) + moduleDecl -> sep__decl__declElse__ (251) + declElse -> 'else' (252) + declElse -> 'else' '\;' (253) + exports -> (254) + exports -> '(' sep__export__','__ ')' (255) + export -> ident (256) + export -> symbol (257) + export -> properName (258) + export -> properName dataMembers (259) + export -> 'type' symbol (260) + export -> 'class' properName (261) + export -> 'module' moduleName (262) + dataMembers -> '(..)' (263) + dataMembers -> '(' ')' (264) + dataMembers -> '(' sep__properName__','__ ')' (265) + importDecl -> 'import' moduleName imports (266) + importDecl -> 'import' moduleName imports 'as' moduleName (267) + imports -> (268) + imports -> '(' sep__import__','__ ')' (269) + imports -> 'hiding' '(' sep__import__','__ ')' (270) + import -> ident (271) + import -> symbol (272) + import -> properName (273) + import -> properName dataMembers (274) + import -> 'type' symbol (275) + import -> 'class' properName (276) + decl -> dataHead (277) + decl -> dataHead '=' sep__dataCtor__'|'__ (278) + decl -> typeHead '=' type (279) + decl -> newtypeHead '=' properName typeAtom (280) + decl -> classHead (281) + decl -> classHead 'where' '\{' manySep__classMember__'\;'__ '\}' (282) + decl -> instHead (283) + decl -> instHead 'where' '\{' manySep__instBinding__'\;'__ '\}' (284) + decl -> 'data' properName '::' type (285) + decl -> 'newtype' properName '::' type (286) + decl -> 'type' properName '::' type (287) + decl -> 'derive' instHead (288) + decl -> 'derive' 'newtype' instHead (289) + decl -> ident '::' type (290) + decl -> ident manyOrEmpty__binderAtom__ guardedDecl (291) + decl -> fixity (292) + decl -> 'foreign' 'import' ident '::' type (293) + decl -> 'foreign' 'import' 'data' properName '::' type (294) + decl -> 'type' 'role' properName many__role__ (295) + dataHead -> 'data' properName manyOrEmpty__typeVarBindingPlain__ (296) + typeHead -> 'type' properName manyOrEmpty__typeVarBindingPlain__ (297) + newtypeHead -> 'newtype' properName manyOrEmpty__typeVarBindingPlain__ (298) + dataCtor -> properName manyOrEmpty__typeAtom__ (299) + classHead -> 'class' (300) + classSignature -> properName '::' type (301) + classSuper -> constraints '<=' (302) + classNameAndFundeps -> properName manyOrEmpty__typeVarBinding__ fundeps (303) + fundeps -> (304) + fundeps -> '|' sep__fundep__','__ (305) + fundep -> '->' many__ident__ (306) + fundep -> many__ident__ '->' many__ident__ (307) + classMember -> ident '::' type (308) + instHead -> 'instance' constraints '=>' qualProperName manyOrEmpty__typeAtom__ (309) + instHead -> 'instance' qualProperName manyOrEmpty__typeAtom__ (310) + instHead -> 'instance' ident '::' constraints '=>' qualProperName manyOrEmpty__typeAtom__ (311) + instHead -> 'instance' ident '::' qualProperName manyOrEmpty__typeAtom__ (312) + constraints -> constraint (313) + constraints -> '(' sep__constraint__','__ ')' (314) + constraint -> qualProperName manyOrEmpty__typeAtom__ (315) + constraint -> '(' constraint ')' (316) + instBinding -> ident '::' type (317) + instBinding -> ident manyOrEmpty__binderAtom__ guardedDecl (318) + fixity -> infix int qualIdent 'as' op (319) + fixity -> infix int qualProperName 'as' op (320) + fixity -> infix int 'type' qualProperName 'as' op (321) + infix -> 'infix' (322) + infix -> 'infixl' (323) + infix -> 'infixr' (324) + role -> 'nominal' (325) + role -> 'representational' (326) + role -> 'phantom' (327) + importDeclP -> importDecl (328) + declP -> decl (329) + exprP -> expr (330) + typeP -> type (331) + moduleNameP -> moduleName (332) + qualIdentP -> qualIdent (333) + delim__'['__binder__','__']'__ -> '[' ']' (334) + delim__'['__binder__','__']'__ -> '[' sep__binder__','__ ']' (335) + delim__'['__expr__','__']'__ -> '[' ']' (336) + delim__'['__expr__','__']'__ -> '[' sep__expr__','__ ']' (337) + delim__'{'__recordBinder__','__'}'__ -> '{' '}' (338) + delim__'{'__recordBinder__','__'}'__ -> '{' sep__recordBinder__','__ '}' (339) + delim__'{'__recordLabel__','__'}'__ -> '{' '}' (340) + delim__'{'__recordLabel__','__'}'__ -> '{' sep__recordLabel__','__ '}' (341) + many__binderAtom__ -> many1__binderAtom__ (342) + many__guardedCaseExpr__ -> many1__guardedCaseExpr__ (343) + many__guardedDeclExpr__ -> many1__guardedDeclExpr__ (344) + many__ident__ -> many1__ident__ (345) + many__role__ -> many1__role__ (346) + many__typeVarBinding__ -> many1__typeVarBinding__ (347) + manyOrEmpty__binderAtom__ -> (348) + manyOrEmpty__binderAtom__ -> many__binderAtom__ (349) + manyOrEmpty__typeAtom__ -> (350) + manyOrEmpty__typeAtom__ -> many__typeAtom__ (351) + manyOrEmpty__typeVarBinding__ -> (352) + manyOrEmpty__typeVarBinding__ -> many__typeVarBinding__ (353) + manyOrEmpty__typeVarBindingPlain__ -> (354) + manyOrEmpty__typeVarBindingPlain__ -> many__typeVarBindingPlain__ (355) + manySep__caseBranch__'\;'__ -> manySep1__caseBranch__'\;'__ (356) + manySep__classMember__'\;'__ -> manySep1__classMember__'\;'__ (357) + manySep__instBinding__'\;'__ -> manySep1__instBinding__'\;'__ (358) + manySep__letBinding__'\;'__ -> manySep1__letBinding__'\;'__ (359) + manySep__moduleDecl__'\;'__ -> manySep1__moduleDecl__'\;'__ (360) + sep__binder1__','__ -> sep1__binder1__','__ (361) + sep__constraint__','__ -> sep1__constraint__','__ (362) + sep__dataCtor__'|'__ -> sep1__dataCtor__'|'__ (363) + sep__decl__declElse__ -> sep1__decl__declElse__ (364) + sep__export__','__ -> sep1__export__','__ (365) + sep__expr__','__ -> sep1__expr__','__ (366) + sep__fundep__','__ -> sep1__fundep__','__ (367) + sep__import__','__ -> sep1__import__','__ (368) + sep__label__'.'__ -> sep1__label__'.'__ (369) + sep__properName__','__ -> sep1__properName__','__ (370) + sep__recordUpdate__','__ -> sep1__recordUpdate__','__ (371) + sep__recordUpdateOrLabel__','__ -> sep1__recordUpdateOrLabel__','__ (372) + sep__rowLabel__','__ -> sep1__rowLabel__','__ (373) + many__typeAtom__ -> many1__typeAtom__ (374) + many__typeVarBindingPlain__ -> many1__typeVarBindingPlain__ (375) + many1__binderAtom__ -> binderAtom (376) + many1__binderAtom__ -> many1__binderAtom__ binderAtom (377) + many1__guardedCaseExpr__ -> guardedCaseExpr (378) + many1__guardedCaseExpr__ -> many1__guardedCaseExpr__ guardedCaseExpr (379) + many1__guardedDeclExpr__ -> guardedDeclExpr (380) + many1__guardedDeclExpr__ -> many1__guardedDeclExpr__ guardedDeclExpr (381) + many1__ident__ -> ident (382) + many1__ident__ -> many1__ident__ ident (383) + many1__role__ -> role (384) + many1__role__ -> many1__role__ role (385) + many1__typeVarBinding__ -> typeVarBinding (386) + many1__typeVarBinding__ -> many1__typeVarBinding__ typeVarBinding (387) + manySep1__caseBranch__'\;'__ -> caseBranch (388) + manySep1__caseBranch__'\;'__ -> manySep1__caseBranch__'\;'__ '\;' caseBranch (389) + manySep1__classMember__'\;'__ -> classMember (390) + manySep1__classMember__'\;'__ -> manySep1__classMember__'\;'__ '\;' classMember (391) + manySep1__instBinding__'\;'__ -> instBinding (392) + manySep1__instBinding__'\;'__ -> manySep1__instBinding__'\;'__ '\;' instBinding (393) + manySep1__letBinding__'\;'__ -> letBinding (394) + manySep1__letBinding__'\;'__ -> manySep1__letBinding__'\;'__ '\;' letBinding (395) + manySep1__moduleDecl__'\;'__ -> moduleDecl (396) + manySep1__moduleDecl__'\;'__ -> manySep1__moduleDecl__'\;'__ '\;' moduleDecl (397) + sep__binder__','__ -> sep1__binder__','__ (398) + sep__recordBinder__','__ -> sep1__recordBinder__','__ (399) + sep__recordLabel__','__ -> sep1__recordLabel__','__ (400) + sep1__binder1__','__ -> binder1 (401) + sep1__binder1__','__ -> sep1__binder1__','__ ',' binder1 (402) + sep1__constraint__','__ -> constraint (403) + sep1__constraint__','__ -> sep1__constraint__','__ ',' constraint (404) + sep1__dataCtor__'|'__ -> dataCtor (405) + sep1__dataCtor__'|'__ -> sep1__dataCtor__'|'__ '|' dataCtor (406) + sep1__decl__declElse__ -> decl (407) + sep1__decl__declElse__ -> sep1__decl__declElse__ declElse decl (408) + sep1__export__','__ -> export (409) + sep1__export__','__ -> sep1__export__','__ ',' export (410) + sep1__expr__','__ -> expr (411) + sep1__expr__','__ -> sep1__expr__','__ ',' expr (412) + sep1__fundep__','__ -> fundep (413) + sep1__fundep__','__ -> sep1__fundep__','__ ',' fundep (414) + sep1__import__','__ -> import (415) + sep1__import__','__ -> sep1__import__','__ ',' import (416) + sep1__label__'.'__ -> label (417) + sep1__label__'.'__ -> sep1__label__'.'__ '.' label (418) + sep1__properName__','__ -> properName (419) + sep1__properName__','__ -> sep1__properName__','__ ',' properName (420) + sep1__recordUpdate__','__ -> recordUpdate (421) + sep1__recordUpdate__','__ -> sep1__recordUpdate__','__ ',' recordUpdate (422) + sep1__recordUpdateOrLabel__','__ -> recordUpdateOrLabel (423) + sep1__recordUpdateOrLabel__','__ -> sep1__recordUpdateOrLabel__','__ ',' recordUpdateOrLabel (424) + sep1__rowLabel__','__ -> rowLabel (425) + sep1__rowLabel__','__ -> sep1__rowLabel__','__ ',' rowLabel (426) + many1__typeAtom__ -> typeAtom (427) + many1__typeAtom__ -> many1__typeAtom__ typeAtom (428) + many1__typeVarBindingPlain__ -> typeVarBindingPlain (429) + many1__typeVarBindingPlain__ -> many1__typeVarBindingPlain__ typeVarBindingPlain (430) + sep1__binder__','__ -> binder (431) + sep1__binder__','__ -> sep1__binder__','__ ',' binder (432) + sep1__recordBinder__','__ -> recordBinder (433) + sep1__recordBinder__','__ -> sep1__recordBinder__','__ ',' recordBinder (434) + sep1__recordLabel__','__ -> recordLabel (435) + sep1__recordLabel__','__ -> sep1__recordLabel__','__ ',' recordLabel (436) + +----------------------------------------------------------------------------- +Terminals +----------------------------------------------------------------------------- + '(' { SourceToken _ TokLeftParen } + ')' { SourceToken _ TokRightParen } + '{' { SourceToken _ TokLeftBrace } + '}' { SourceToken _ TokRightBrace } + '[' { SourceToken _ TokLeftSquare } + ']' { SourceToken _ TokRightSquare } + '\{' { SourceToken _ TokLayoutStart } + '\}' { SourceToken _ TokLayoutEnd } + '\;' { SourceToken _ TokLayoutSep } + '<-' { SourceToken _ (TokLeftArrow _) } + '->' { SourceToken _ (TokRightArrow _) } + '<=' { SourceToken _ (TokOperator [] sym) | isLeftFatArrow sym } + '=>' { SourceToken _ (TokRightFatArrow _) } + ':' { SourceToken _ (TokOperator [] ":") } + '::' { SourceToken _ (TokDoubleColon _) } + '=' { SourceToken _ TokEquals } + '|' { SourceToken _ TokPipe } + '`' { SourceToken _ TokTick } + '.' { SourceToken _ TokDot } + ',' { SourceToken _ TokComma } + '_' { SourceToken _ TokUnderscore } + '\\' { SourceToken _ TokBackslash } + '-' { SourceToken _ (TokOperator [] "-") } + '@' { SourceToken _ (TokOperator [] "@") } + 'ado' { SourceToken _ (TokLowerName _ "ado") } + 'as' { SourceToken _ (TokLowerName [] "as") } + 'case' { SourceToken _ (TokLowerName [] "case") } + 'class' { SourceToken _ (TokLowerName [] "class") } + 'data' { SourceToken _ (TokLowerName [] "data") } + 'derive' { SourceToken _ (TokLowerName [] "derive") } + 'do' { SourceToken _ (TokLowerName _ "do") } + 'else' { SourceToken _ (TokLowerName [] "else") } + 'false' { SourceToken _ (TokLowerName [] "false") } + 'forall' { SourceToken _ (TokForall ASCII) } + 'forallu' { SourceToken _ (TokForall Unicode) } + 'foreign' { SourceToken _ (TokLowerName [] "foreign") } + 'hiding' { SourceToken _ (TokLowerName [] "hiding") } + 'import' { SourceToken _ (TokLowerName [] "import") } + 'if' { SourceToken _ (TokLowerName [] "if") } + 'in' { SourceToken _ (TokLowerName [] "in") } + 'infix' { SourceToken _ (TokLowerName [] "infix") } + 'infixl' { SourceToken _ (TokLowerName [] "infixl") } + 'infixr' { SourceToken _ (TokLowerName [] "infixr") } + 'instance' { SourceToken _ (TokLowerName [] "instance") } + 'let' { SourceToken _ (TokLowerName [] "let") } + 'module' { SourceToken _ (TokLowerName [] "module") } + 'newtype' { SourceToken _ (TokLowerName [] "newtype") } + 'nominal' { SourceToken _ (TokLowerName [] "nominal") } + 'phantom' { SourceToken _ (TokLowerName [] "phantom") } + 'of' { SourceToken _ (TokLowerName [] "of") } + 'representational'{ SourceToken _ (TokLowerName [] "representational") } + 'role' { SourceToken _ (TokLowerName [] "role") } + 'then' { SourceToken _ (TokLowerName [] "then") } + 'true' { SourceToken _ (TokLowerName [] "true") } + 'type' { SourceToken _ (TokLowerName [] "type") } + 'where' { SourceToken _ (TokLowerName [] "where") } + '(->)' { SourceToken _ (TokSymbolArr _) } + '(..)' { SourceToken _ (TokSymbolName [] "..") } + LOWER { SourceToken _ (TokLowerName [] _) } + QUAL_LOWER { SourceToken _ (TokLowerName _ _) } + UPPER { SourceToken _ (TokUpperName [] _) } + QUAL_UPPER { SourceToken _ (TokUpperName _ _) } + SYMBOL { SourceToken _ (TokSymbolName [] _) } + QUAL_SYMBOL { SourceToken _ (TokSymbolName _ _) } + OPERATOR { SourceToken _ (TokOperator [] _) } + QUAL_OPERATOR { SourceToken _ (TokOperator _ _) } + LIT_HOLE { SourceToken _ (TokHole _) } + LIT_CHAR { SourceToken _ (TokChar _ _) } + LIT_STRING { SourceToken _ (TokString _ _) } + LIT_RAW_STRING { SourceToken _ (TokRawString _) } + LIT_INT { SourceToken _ (TokInt _ _) } + LIT_NUMBER { SourceToken _ (TokNumber _ _) } + +----------------------------------------------------------------------------- +Non-terminals +----------------------------------------------------------------------------- + %start_parseType rule 0 + %start_parseExpr rule 1 + %start_parseIdent rule 2 + %start_parseOperator rule 3 + %start_parseModuleBody rule 4 + %start_parseDecl rule 5 + %start_parseImportDeclP rule 6 + %start_parseDeclP rule 7 + %start_parseExprP rule 8 + %start_parseTypeP rule 9 + %start_parseModuleNameP rule 10 + %start_parseQualIdentP rule 11 + %start_parseModuleHeader rule 12 + %start_parseDoStatement rule 13 + %start_parseDoExpr rule 14 + %start_parseDoNext rule 15 + %start_parseGuardExpr rule 16 + %start_parseGuardNext rule 17 + %start_parseGuardStatement rule 18 + %start_parseClassSignature rule 19 + %start_parseClassSuper rule 20 + %start_parseClassNameAndFundeps rule 21 + %start_parseBinderAndArrow rule 22 + moduleName rules 23, 24 + qualProperName rules 25, 26 + properName rule 27 + qualIdent rules 28, 29, 30, 31, 32, 33, 34, 35 + ident rules 36, 37, 38, 39, 40, 41, 42 + qualOp rules 43, 44, 45, 46, 47 + op rules 48, 49, 50, 51 + qualSymbol rules 52, 53, 54 + symbol rules 55, 56 + label rules 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90 + hole rule 91 + string rules 92, 93 + char rule 94 + number rules 95, 96 + int rule 97 + boolean rules 98, 99 + type rules 100, 101 + type1 rules 102, 103 + type2 rules 104, 105, 106 + type3 rules 107, 108 + type4 rules 109, 110 + type5 rules 111, 112 + typeAtom rules 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124 + typeKindedAtom rules 125, 126, 127, 128, 129, 130, 131, 132, 133 + row rules 134, 135, 136, 137 + rowLabel rule 138 + typeVarBinding rules 139, 140, 141, 142 + typeVarBindingPlain rules 143, 144 + forall rules 145, 146 + exprWhere rules 147, 148 + expr rules 149, 150 + expr1 rules 151, 152 + expr2 rules 153, 154 + exprBacktick rules 155, 156 + expr3 rules 157, 158 + expr4 rules 159, 160, 161 + expr5 rules 162, 163, 164, 165, 166, 167, 168, 169, 170 + expr6 rules 171, 172, 173 + expr7 rules 174, 175 + exprAtom rules 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187 + recordLabel rules 188, 189, 190 + recordUpdateOrLabel rules 191, 192, 193, 194 + recordUpdate rules 195, 196 + letBinding rules 197, 198, 199, 200 + caseBranch rule 201 + guardedDecl rules 202, 203 + guardedDeclExpr rule 204 + guardedCase rules 205, 206 + guardedCaseExpr rule 207 + doBlock rule 208 + adoBlock rules 209, 210 + doStatement rules 211, 212 + doExpr rule 213 + doNext rules 214, 215 + guard rule 216 + guardStatement rule 217 + guardExpr rule 218 + guardNext rules 219, 220 + binderAndArrow rule 221 + binder rules 222, 223 + binder1 rules 224, 225 + binder2 rules 226, 227 + binderAtom rules 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238 + recordBinder rules 239, 240, 241 + moduleHeader rule 242 + moduleBody rule 243 + moduleImports rules 244, 245 + importDecls rules 246, 247 + moduleDecls rules 248, 249 + moduleDecl rules 250, 251 + declElse rules 252, 253 + exports rules 254, 255 + export rules 256, 257, 258, 259, 260, 261, 262 + dataMembers rules 263, 264, 265 + importDecl rules 266, 267 + imports rules 268, 269, 270 + import rules 271, 272, 273, 274, 275, 276 + decl rules 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295 + dataHead rule 296 + typeHead rule 297 + newtypeHead rule 298 + dataCtor rule 299 + classHead rule 300 + classSignature rule 301 + classSuper rule 302 + classNameAndFundeps rule 303 + fundeps rules 304, 305 + fundep rules 306, 307 + classMember rule 308 + instHead rules 309, 310, 311, 312 + constraints rules 313, 314 + constraint rules 315, 316 + instBinding rules 317, 318 + fixity rules 319, 320, 321 + infix rules 322, 323, 324 + role rules 325, 326, 327 + importDeclP rule 328 + declP rule 329 + exprP rule 330 + typeP rule 331 + moduleNameP rule 332 + qualIdentP rule 333 + delim__'['__binder__','__']'__ rules 334, 335 + delim__'['__expr__','__']'__ rules 336, 337 + delim__'{'__recordBinder__','__'}'__ rules 338, 339 + delim__'{'__recordLabel__','__'}'__ rules 340, 341 + many__binderAtom__ rule 342 + many__guardedCaseExpr__ rule 343 + many__guardedDeclExpr__ rule 344 + many__ident__ rule 345 + many__role__ rule 346 + many__typeVarBinding__ rule 347 + manyOrEmpty__binderAtom__ rules 348, 349 + manyOrEmpty__typeAtom__ rules 350, 351 + manyOrEmpty__typeVarBinding__ rules 352, 353 + manyOrEmpty__typeVarBindingPlain__ rules 354, 355 + manySep__caseBranch__'\;'__ rule 356 + manySep__classMember__'\;'__ rule 357 + manySep__instBinding__'\;'__ rule 358 + manySep__letBinding__'\;'__ rule 359 + manySep__moduleDecl__'\;'__ rule 360 + sep__binder1__','__ rule 361 + sep__constraint__','__ rule 362 + sep__dataCtor__'|'__ rule 363 + sep__decl__declElse__ rule 364 + sep__export__','__ rule 365 + sep__expr__','__ rule 366 + sep__fundep__','__ rule 367 + sep__import__','__ rule 368 + sep__label__'.'__ rule 369 + sep__properName__','__ rule 370 + sep__recordUpdate__','__ rule 371 + sep__recordUpdateOrLabel__','__ rule 372 + sep__rowLabel__','__ rule 373 + many__typeAtom__ rule 374 + many__typeVarBindingPlain__ rule 375 + many1__binderAtom__ rules 376, 377 + many1__guardedCaseExpr__ rules 378, 379 + many1__guardedDeclExpr__ rules 380, 381 + many1__ident__ rules 382, 383 + many1__role__ rules 384, 385 + many1__typeVarBinding__ rules 386, 387 + manySep1__caseBranch__'\;'__ rules 388, 389 + manySep1__classMember__'\;'__ rules 390, 391 + manySep1__instBinding__'\;'__ rules 392, 393 + manySep1__letBinding__'\;'__ rules 394, 395 + manySep1__moduleDecl__'\;'__ rules 396, 397 + sep__binder__','__ rule 398 + sep__recordBinder__','__ rule 399 + sep__recordLabel__','__ rule 400 + sep1__binder1__','__ rules 401, 402 + sep1__constraint__','__ rules 403, 404 + sep1__dataCtor__'|'__ rules 405, 406 + sep1__decl__declElse__ rules 407, 408 + sep1__export__','__ rules 409, 410 + sep1__expr__','__ rules 411, 412 + sep1__fundep__','__ rules 413, 414 + sep1__import__','__ rules 415, 416 + sep1__label__'.'__ rules 417, 418 + sep1__properName__','__ rules 419, 420 + sep1__recordUpdate__','__ rules 421, 422 + sep1__recordUpdateOrLabel__','__ rules 423, 424 + sep1__rowLabel__','__ rules 425, 426 + many1__typeAtom__ rules 427, 428 + many1__typeVarBindingPlain__ rules 429, 430 + sep1__binder__','__ rules 431, 432 + sep1__recordBinder__','__ rules 433, 434 + sep1__recordLabel__','__ rules 435, 436 + +----------------------------------------------------------------------------- +States +----------------------------------------------------------------------------- +State 0 + + %start_parseType -> . type (rule 0) + + '(' shift, and enter state 148 + '{' shift, and enter state 149 + '_' shift, and enter state 150 + '-' shift, and enter state 151 + 'as' shift, and enter state 45 + 'forall' shift, and enter state 152 + 'forallu' shift, and enter state 153 + 'hiding' shift, and enter state 47 + 'nominal' shift, and enter state 48 + 'phantom' shift, and enter state 49 + 'representational'shift, and enter state 50 + 'role' shift, and enter state 51 + '(->)' shift, and enter state 154 + '(..)' shift, and enter state 112 + LOWER shift, and enter state 53 + UPPER shift, and enter state 54 + QUAL_UPPER shift, and enter state 55 + SYMBOL shift, and enter state 115 + QUAL_SYMBOL shift, and enter state 116 + LIT_HOLE shift, and enter state 117 + LIT_STRING shift, and enter state 57 + LIT_RAW_STRING shift, and enter state 58 + LIT_INT shift, and enter state 155 + + qualProperName goto state 133 + ident goto state 134 + qualSymbol goto state 135 + hole goto state 136 + string goto state 137 + int goto state 138 + type goto state 198 + type1 goto state 140 + type2 goto state 141 + type3 goto state 142 + type4 goto state 143 + type5 goto state 144 + typeAtom goto state 145 + forall goto state 146 + +State 1 + + %start_parseExpr -> . expr (rule 1) + + '(' shift, and enter state 95 + '{' shift, and enter state 96 + '[' shift, and enter state 97 + '_' shift, and enter state 98 + '\\' shift, and enter state 99 + '-' shift, and enter state 100 + 'ado' shift, and enter state 101 + 'as' shift, and enter state 102 + 'case' shift, and enter state 103 + 'do' shift, and enter state 104 + 'false' shift, and enter state 46 + 'hiding' shift, and enter state 105 + 'if' shift, and enter state 106 + 'let' shift, and enter state 107 + 'nominal' shift, and enter state 108 + 'phantom' shift, and enter state 109 + 'representational'shift, and enter state 110 + 'role' shift, and enter state 111 + 'true' shift, and enter state 52 + '(..)' shift, and enter state 112 + LOWER shift, and enter state 113 + QUAL_LOWER shift, and enter state 114 + UPPER shift, and enter state 54 + QUAL_UPPER shift, and enter state 55 + SYMBOL shift, and enter state 115 + QUAL_SYMBOL shift, and enter state 116 + LIT_HOLE shift, and enter state 117 + LIT_CHAR shift, and enter state 56 + LIT_STRING shift, and enter state 57 + LIT_RAW_STRING shift, and enter state 58 + LIT_INT shift, and enter state 59 + LIT_NUMBER shift, and enter state 60 + + qualProperName goto state 74 + qualIdent goto state 75 + qualSymbol goto state 76 + hole goto state 77 + string goto state 78 + char goto state 79 + number goto state 80 + boolean goto state 81 + expr goto state 197 + expr1 goto state 122 + expr2 goto state 83 + expr3 goto state 84 + expr4 goto state 85 + expr5 goto state 86 + expr6 goto state 87 + expr7 goto state 88 + exprAtom goto state 89 + doBlock goto state 90 + adoBlock goto state 91 + delim__'['__expr__','__']'__goto state 93 + delim__'{'__recordLabel__','__'}'__goto state 94 + +State 2 + + %start_parseIdent -> . ident (rule 2) + + 'as' shift, and enter state 45 + 'hiding' shift, and enter state 47 + 'nominal' shift, and enter state 48 + 'phantom' shift, and enter state 49 + 'representational'shift, and enter state 50 + 'role' shift, and enter state 51 + LOWER shift, and enter state 53 + + ident goto state 196 + +State 3 + + %start_parseOperator -> . op (rule 3) + + '<=' shift, and enter state 192 + ':' shift, and enter state 193 + '-' shift, and enter state 194 + OPERATOR shift, and enter state 195 + + op goto state 191 + +State 4 + + %start_parseModuleBody -> . moduleBody (rule 4) + + '\}' reduce using rule 249 + 'as' shift, and enter state 45 + 'class' shift, and enter state 168 + 'data' shift, and enter state 169 + 'derive' shift, and enter state 170 + 'foreign' shift, and enter state 171 + 'hiding' shift, and enter state 47 + 'import' shift, and enter state 180 + 'infix' shift, and enter state 172 + 'infixl' shift, and enter state 173 + 'infixr' shift, and enter state 174 + 'instance' shift, and enter state 175 + 'newtype' shift, and enter state 176 + 'nominal' shift, and enter state 48 + 'phantom' shift, and enter state 49 + 'representational'shift, and enter state 50 + 'role' shift, and enter state 51 + 'type' shift, and enter state 177 + LOWER shift, and enter state 53 + + ident goto state 158 + moduleBody goto state 182 + moduleDecls goto state 183 + moduleDecl goto state 184 + importDecl goto state 185 + decl goto state 186 + dataHead goto state 160 + typeHead goto state 161 + newtypeHead goto state 162 + classHead goto state 163 + instHead goto state 164 + fixity goto state 165 + infix goto state 166 + manySep__moduleDecl__'\;'__goto state 187 + sep__decl__declElse__goto state 188 + manySep1__moduleDecl__'\;'__goto state 189 + sep1__decl__declElse__goto state 190 + +State 5 + + %start_parseDecl -> . decl (rule 5) + + 'as' shift, and enter state 45 + 'class' shift, and enter state 168 + 'data' shift, and enter state 169 + 'derive' shift, and enter state 170 + 'foreign' shift, and enter state 171 + 'hiding' shift, and enter state 47 + 'infix' shift, and enter state 172 + 'infixl' shift, and enter state 173 + 'infixr' shift, and enter state 174 + 'instance' shift, and enter state 175 + 'newtype' shift, and enter state 176 + 'nominal' shift, and enter state 48 + 'phantom' shift, and enter state 49 + 'representational'shift, and enter state 50 + 'role' shift, and enter state 51 + 'type' shift, and enter state 177 + LOWER shift, and enter state 53 + + ident goto state 158 + decl goto state 181 + dataHead goto state 160 + typeHead goto state 161 + newtypeHead goto state 162 + classHead goto state 163 + instHead goto state 164 + fixity goto state 165 + infix goto state 166 + +State 6 + + %start_parseImportDeclP -> . importDeclP (rule 6) + + 'import' shift, and enter state 180 + + importDecl goto state 178 + importDeclP goto state 179 + +State 7 + + %start_parseDeclP -> . declP (rule 7) + + 'as' shift, and enter state 45 + 'class' shift, and enter state 168 + 'data' shift, and enter state 169 + 'derive' shift, and enter state 170 + 'foreign' shift, and enter state 171 + 'hiding' shift, and enter state 47 + 'infix' shift, and enter state 172 + 'infixl' shift, and enter state 173 + 'infixr' shift, and enter state 174 + 'instance' shift, and enter state 175 + 'newtype' shift, and enter state 176 + 'nominal' shift, and enter state 48 + 'phantom' shift, and enter state 49 + 'representational'shift, and enter state 50 + 'role' shift, and enter state 51 + 'type' shift, and enter state 177 + LOWER shift, and enter state 53 + + ident goto state 158 + decl goto state 159 + dataHead goto state 160 + typeHead goto state 161 + newtypeHead goto state 162 + classHead goto state 163 + instHead goto state 164 + fixity goto state 165 + infix goto state 166 + declP goto state 167 + +State 8 + + %start_parseExprP -> . exprP (rule 8) + + '(' shift, and enter state 95 + '{' shift, and enter state 96 + '[' shift, and enter state 97 + '_' shift, and enter state 98 + '\\' shift, and enter state 99 + '-' shift, and enter state 100 + 'ado' shift, and enter state 101 + 'as' shift, and enter state 102 + 'case' shift, and enter state 103 + 'do' shift, and enter state 104 + 'false' shift, and enter state 46 + 'hiding' shift, and enter state 105 + 'if' shift, and enter state 106 + 'let' shift, and enter state 107 + 'nominal' shift, and enter state 108 + 'phantom' shift, and enter state 109 + 'representational'shift, and enter state 110 + 'role' shift, and enter state 111 + 'true' shift, and enter state 52 + '(..)' shift, and enter state 112 + LOWER shift, and enter state 113 + QUAL_LOWER shift, and enter state 114 + UPPER shift, and enter state 54 + QUAL_UPPER shift, and enter state 55 + SYMBOL shift, and enter state 115 + QUAL_SYMBOL shift, and enter state 116 + LIT_HOLE shift, and enter state 117 + LIT_CHAR shift, and enter state 56 + LIT_STRING shift, and enter state 57 + LIT_RAW_STRING shift, and enter state 58 + LIT_INT shift, and enter state 59 + LIT_NUMBER shift, and enter state 60 + + qualProperName goto state 74 + qualIdent goto state 75 + qualSymbol goto state 76 + hole goto state 77 + string goto state 78 + char goto state 79 + number goto state 80 + boolean goto state 81 + expr goto state 156 + expr1 goto state 122 + expr2 goto state 83 + expr3 goto state 84 + expr4 goto state 85 + expr5 goto state 86 + expr6 goto state 87 + expr7 goto state 88 + exprAtom goto state 89 + doBlock goto state 90 + adoBlock goto state 91 + exprP goto state 157 + delim__'['__expr__','__']'__goto state 93 + delim__'{'__recordLabel__','__'}'__goto state 94 + +State 9 + + %start_parseTypeP -> . typeP (rule 9) + + '(' shift, and enter state 148 + '{' shift, and enter state 149 + '_' shift, and enter state 150 + '-' shift, and enter state 151 + 'as' shift, and enter state 45 + 'forall' shift, and enter state 152 + 'forallu' shift, and enter state 153 + 'hiding' shift, and enter state 47 + 'nominal' shift, and enter state 48 + 'phantom' shift, and enter state 49 + 'representational'shift, and enter state 50 + 'role' shift, and enter state 51 + '(->)' shift, and enter state 154 + '(..)' shift, and enter state 112 + LOWER shift, and enter state 53 + UPPER shift, and enter state 54 + QUAL_UPPER shift, and enter state 55 + SYMBOL shift, and enter state 115 + QUAL_SYMBOL shift, and enter state 116 + LIT_HOLE shift, and enter state 117 + LIT_STRING shift, and enter state 57 + LIT_RAW_STRING shift, and enter state 58 + LIT_INT shift, and enter state 155 + + qualProperName goto state 133 + ident goto state 134 + qualSymbol goto state 135 + hole goto state 136 + string goto state 137 + int goto state 138 + type goto state 139 + type1 goto state 140 + type2 goto state 141 + type3 goto state 142 + type4 goto state 143 + type5 goto state 144 + typeAtom goto state 145 + forall goto state 146 + typeP goto state 147 + +State 10 + + %start_parseModuleNameP -> . moduleNameP (rule 10) + + UPPER shift, and enter state 24 + QUAL_UPPER shift, and enter state 132 + + moduleName goto state 130 + moduleNameP goto state 131 + +State 11 + + %start_parseQualIdentP -> . qualIdentP (rule 11) + + 'as' shift, and enter state 102 + 'hiding' shift, and enter state 105 + 'nominal' shift, and enter state 108 + 'phantom' shift, and enter state 109 + 'representational'shift, and enter state 110 + 'role' shift, and enter state 111 + LOWER shift, and enter state 113 + QUAL_LOWER shift, and enter state 114 + + qualIdent goto state 128 + qualIdentP goto state 129 + +State 12 + + %start_parseModuleHeader -> . moduleHeader (rule 12) + + 'module' shift, and enter state 127 + + moduleHeader goto state 126 + +State 13 + + %start_parseDoStatement -> . doStatement (rule 13) + + error reduce using rule 212 + 'let' shift, and enter state 125 + + doStatement goto state 124 + +State 14 + + %start_parseDoExpr -> . doExpr (rule 14) + + '(' shift, and enter state 95 + '{' shift, and enter state 96 + '[' shift, and enter state 97 + '_' shift, and enter state 98 + '\\' shift, and enter state 99 + '-' shift, and enter state 100 + 'ado' shift, and enter state 101 + 'as' shift, and enter state 102 + 'case' shift, and enter state 103 + 'do' shift, and enter state 104 + 'false' shift, and enter state 46 + 'hiding' shift, and enter state 105 + 'if' shift, and enter state 106 + 'let' shift, and enter state 107 + 'nominal' shift, and enter state 108 + 'phantom' shift, and enter state 109 + 'representational'shift, and enter state 110 + 'role' shift, and enter state 111 + 'true' shift, and enter state 52 + '(..)' shift, and enter state 112 + LOWER shift, and enter state 113 + QUAL_LOWER shift, and enter state 114 + UPPER shift, and enter state 54 + QUAL_UPPER shift, and enter state 55 + SYMBOL shift, and enter state 115 + QUAL_SYMBOL shift, and enter state 116 + LIT_HOLE shift, and enter state 117 + LIT_CHAR shift, and enter state 56 + LIT_STRING shift, and enter state 57 + LIT_RAW_STRING shift, and enter state 58 + LIT_INT shift, and enter state 59 + LIT_NUMBER shift, and enter state 60 + + qualProperName goto state 74 + qualIdent goto state 75 + qualSymbol goto state 76 + hole goto state 77 + string goto state 78 + char goto state 79 + number goto state 80 + boolean goto state 81 + expr goto state 121 + expr1 goto state 122 + expr2 goto state 83 + expr3 goto state 84 + expr4 goto state 85 + expr5 goto state 86 + expr6 goto state 87 + expr7 goto state 88 + exprAtom goto state 89 + doBlock goto state 90 + adoBlock goto state 91 + doExpr goto state 123 + delim__'['__expr__','__']'__goto state 93 + delim__'{'__recordLabel__','__'}'__goto state 94 + +State 15 + + %start_parseDoNext -> . doNext (rule 15) + + '\}' shift, and enter state 119 + '\;' shift, and enter state 120 + + doNext goto state 118 + +State 16 + + %start_parseGuardExpr -> . guardExpr (rule 16) + + '(' shift, and enter state 95 + '{' shift, and enter state 96 + '[' shift, and enter state 97 + '_' shift, and enter state 98 + '\\' shift, and enter state 99 + '-' shift, and enter state 100 + 'ado' shift, and enter state 101 + 'as' shift, and enter state 102 + 'case' shift, and enter state 103 + 'do' shift, and enter state 104 + 'false' shift, and enter state 46 + 'hiding' shift, and enter state 105 + 'if' shift, and enter state 106 + 'let' shift, and enter state 107 + 'nominal' shift, and enter state 108 + 'phantom' shift, and enter state 109 + 'representational'shift, and enter state 110 + 'role' shift, and enter state 111 + 'true' shift, and enter state 52 + '(..)' shift, and enter state 112 + LOWER shift, and enter state 113 + QUAL_LOWER shift, and enter state 114 + UPPER shift, and enter state 54 + QUAL_UPPER shift, and enter state 55 + SYMBOL shift, and enter state 115 + QUAL_SYMBOL shift, and enter state 116 + LIT_HOLE shift, and enter state 117 + LIT_CHAR shift, and enter state 56 + LIT_STRING shift, and enter state 57 + LIT_RAW_STRING shift, and enter state 58 + LIT_INT shift, and enter state 59 + LIT_NUMBER shift, and enter state 60 + + qualProperName goto state 74 + qualIdent goto state 75 + qualSymbol goto state 76 + hole goto state 77 + string goto state 78 + char goto state 79 + number goto state 80 + boolean goto state 81 + expr1 goto state 82 + expr2 goto state 83 + expr3 goto state 84 + expr4 goto state 85 + expr5 goto state 86 + expr6 goto state 87 + expr7 goto state 88 + exprAtom goto state 89 + doBlock goto state 90 + adoBlock goto state 91 + guardExpr goto state 92 + delim__'['__expr__','__']'__goto state 93 + delim__'{'__recordLabel__','__'}'__goto state 94 + +State 17 + + %start_parseGuardNext -> . guardNext (rule 17) + + error reduce using rule 220 + ',' shift, and enter state 73 + + guardNext goto state 72 + +State 18 + + %start_parseGuardStatement -> . guardStatement (rule 18) + + error reduce using rule 217 + + guardStatement goto state 71 + +State 19 + + %start_parseClassSignature -> . classSignature (rule 19) + + UPPER shift, and enter state 63 + + properName goto state 69 + classSignature goto state 70 + +State 20 + + %start_parseClassSuper -> . classSuper (rule 20) + + '(' shift, and enter state 68 + UPPER shift, and enter state 54 + QUAL_UPPER shift, and enter state 55 + + qualProperName goto state 64 + classSuper goto state 65 + constraints goto state 66 + constraint goto state 67 + +State 21 + + %start_parseClassNameAndFundeps -> . classNameAndFundeps (rule 21) + + UPPER shift, and enter state 63 + + properName goto state 61 + classNameAndFundepsgoto state 62 + +State 22 + + %start_parseBinderAndArrow -> . binderAndArrow (rule 22) + + '(' shift, and enter state 40 + '{' shift, and enter state 41 + '[' shift, and enter state 42 + '_' shift, and enter state 43 + '-' shift, and enter state 44 + 'as' shift, and enter state 45 + 'false' shift, and enter state 46 + 'hiding' shift, and enter state 47 + 'nominal' shift, and enter state 48 + 'phantom' shift, and enter state 49 + 'representational'shift, and enter state 50 + 'role' shift, and enter state 51 + 'true' shift, and enter state 52 + LOWER shift, and enter state 53 + UPPER shift, and enter state 54 + QUAL_UPPER shift, and enter state 55 + LIT_CHAR shift, and enter state 56 + LIT_STRING shift, and enter state 57 + LIT_RAW_STRING shift, and enter state 58 + LIT_INT shift, and enter state 59 + LIT_NUMBER shift, and enter state 60 + + qualProperName goto state 25 + ident goto state 26 + string goto state 27 + char goto state 28 + number goto state 29 + boolean goto state 30 + binderAndArrow goto state 31 + binder goto state 32 + binder1 goto state 33 + binder2 goto state 34 + binderAtom goto state 35 + delim__'['__binder__','__']'__goto state 36 + delim__'{'__recordBinder__','__'}'__goto state 37 + many__binderAtom__goto state 38 + many1__binderAtom__goto state 39 + +State 23 + + moduleName -> . UPPER (rule 23) + + UPPER shift, and enter state 24 + + +State 24 + + moduleName -> UPPER . (rule 23) + + error reduce using rule 23 + '(' reduce using rule 23 + ')' reduce using rule 23 + '\}' reduce using rule 23 + '\;' reduce using rule 23 + ',' reduce using rule 23 + 'as' reduce using rule 23 + 'hiding' reduce using rule 23 + 'where' reduce using rule 23 + + +State 25 + + binderAtom -> qualProperName . (rule 231) + + '(' reduce using rule 231 + ')' reduce using rule 231 + '{' reduce using rule 231 + '}' reduce using rule 231 + '[' reduce using rule 231 + ']' reduce using rule 231 + '\}' reduce using rule 231 + '<-' reduce using rule 231 + '->' reduce using rule 231 + '<=' reduce using rule 231 + ':' reduce using rule 231 + '::' reduce using rule 231 + '=' reduce using rule 231 + '|' reduce using rule 231 + ',' reduce using rule 231 + '_' reduce using rule 231 + '-' reduce using rule 231 + 'as' reduce using rule 231 + 'false' reduce using rule 231 + 'hiding' reduce using rule 231 + 'nominal' reduce using rule 231 + 'phantom' reduce using rule 231 + 'representational'reduce using rule 231 + 'role' reduce using rule 231 + 'true' reduce using rule 231 + LOWER reduce using rule 231 + UPPER reduce using rule 231 + QUAL_UPPER reduce using rule 231 + OPERATOR reduce using rule 231 + QUAL_OPERATOR reduce using rule 231 + LIT_CHAR reduce using rule 231 + LIT_STRING reduce using rule 231 + LIT_RAW_STRING reduce using rule 231 + LIT_INT reduce using rule 231 + LIT_NUMBER reduce using rule 231 + + +State 26 + + binderAtom -> ident . (rule 229) + binderAtom -> ident . '@' binderAtom (rule 230) + + '(' reduce using rule 229 + ')' reduce using rule 229 + '{' reduce using rule 229 + '}' reduce using rule 229 + '[' reduce using rule 229 + ']' reduce using rule 229 + '\}' reduce using rule 229 + '<-' reduce using rule 229 + '->' reduce using rule 229 + '<=' reduce using rule 229 + ':' reduce using rule 229 + '::' reduce using rule 229 + '=' reduce using rule 229 + '|' reduce using rule 229 + ',' reduce using rule 229 + '_' reduce using rule 229 + '-' reduce using rule 229 + '@' shift, and enter state 354 + 'as' reduce using rule 229 + 'false' reduce using rule 229 + 'hiding' reduce using rule 229 + 'nominal' reduce using rule 229 + 'phantom' reduce using rule 229 + 'representational'reduce using rule 229 + 'role' reduce using rule 229 + 'true' reduce using rule 229 + LOWER reduce using rule 229 + UPPER reduce using rule 229 + QUAL_UPPER reduce using rule 229 + OPERATOR reduce using rule 229 + QUAL_OPERATOR reduce using rule 229 + LIT_CHAR reduce using rule 229 + LIT_STRING reduce using rule 229 + LIT_RAW_STRING reduce using rule 229 + LIT_INT reduce using rule 229 + LIT_NUMBER reduce using rule 229 + + +State 27 + + binderAtom -> string . (rule 234) + + '(' reduce using rule 234 + ')' reduce using rule 234 + '{' reduce using rule 234 + '}' reduce using rule 234 + '[' reduce using rule 234 + ']' reduce using rule 234 + '\}' reduce using rule 234 + '<-' reduce using rule 234 + '->' reduce using rule 234 + '<=' reduce using rule 234 + ':' reduce using rule 234 + '::' reduce using rule 234 + '=' reduce using rule 234 + '|' reduce using rule 234 + ',' reduce using rule 234 + '_' reduce using rule 234 + '-' reduce using rule 234 + 'as' reduce using rule 234 + 'false' reduce using rule 234 + 'hiding' reduce using rule 234 + 'nominal' reduce using rule 234 + 'phantom' reduce using rule 234 + 'representational'reduce using rule 234 + 'role' reduce using rule 234 + 'true' reduce using rule 234 + LOWER reduce using rule 234 + UPPER reduce using rule 234 + QUAL_UPPER reduce using rule 234 + OPERATOR reduce using rule 234 + QUAL_OPERATOR reduce using rule 234 + LIT_CHAR reduce using rule 234 + LIT_STRING reduce using rule 234 + LIT_RAW_STRING reduce using rule 234 + LIT_INT reduce using rule 234 + LIT_NUMBER reduce using rule 234 + + +State 28 + + binderAtom -> char . (rule 233) + + '(' reduce using rule 233 + ')' reduce using rule 233 + '{' reduce using rule 233 + '}' reduce using rule 233 + '[' reduce using rule 233 + ']' reduce using rule 233 + '\}' reduce using rule 233 + '<-' reduce using rule 233 + '->' reduce using rule 233 + '<=' reduce using rule 233 + ':' reduce using rule 233 + '::' reduce using rule 233 + '=' reduce using rule 233 + '|' reduce using rule 233 + ',' reduce using rule 233 + '_' reduce using rule 233 + '-' reduce using rule 233 + 'as' reduce using rule 233 + 'false' reduce using rule 233 + 'hiding' reduce using rule 233 + 'nominal' reduce using rule 233 + 'phantom' reduce using rule 233 + 'representational'reduce using rule 233 + 'role' reduce using rule 233 + 'true' reduce using rule 233 + LOWER reduce using rule 233 + UPPER reduce using rule 233 + QUAL_UPPER reduce using rule 233 + OPERATOR reduce using rule 233 + QUAL_OPERATOR reduce using rule 233 + LIT_CHAR reduce using rule 233 + LIT_STRING reduce using rule 233 + LIT_RAW_STRING reduce using rule 233 + LIT_INT reduce using rule 233 + LIT_NUMBER reduce using rule 233 + + +State 29 + + binderAtom -> number . (rule 235) + + '(' reduce using rule 235 + ')' reduce using rule 235 + '{' reduce using rule 235 + '}' reduce using rule 235 + '[' reduce using rule 235 + ']' reduce using rule 235 + '\}' reduce using rule 235 + '<-' reduce using rule 235 + '->' reduce using rule 235 + '<=' reduce using rule 235 + ':' reduce using rule 235 + '::' reduce using rule 235 + '=' reduce using rule 235 + '|' reduce using rule 235 + ',' reduce using rule 235 + '_' reduce using rule 235 + '-' reduce using rule 235 + 'as' reduce using rule 235 + 'false' reduce using rule 235 + 'hiding' reduce using rule 235 + 'nominal' reduce using rule 235 + 'phantom' reduce using rule 235 + 'representational'reduce using rule 235 + 'role' reduce using rule 235 + 'true' reduce using rule 235 + LOWER reduce using rule 235 + UPPER reduce using rule 235 + QUAL_UPPER reduce using rule 235 + OPERATOR reduce using rule 235 + QUAL_OPERATOR reduce using rule 235 + LIT_CHAR reduce using rule 235 + LIT_STRING reduce using rule 235 + LIT_RAW_STRING reduce using rule 235 + LIT_INT reduce using rule 235 + LIT_NUMBER reduce using rule 235 + + +State 30 + + binderAtom -> boolean . (rule 232) + + '(' reduce using rule 232 + ')' reduce using rule 232 + '{' reduce using rule 232 + '}' reduce using rule 232 + '[' reduce using rule 232 + ']' reduce using rule 232 + '\}' reduce using rule 232 + '<-' reduce using rule 232 + '->' reduce using rule 232 + '<=' reduce using rule 232 + ':' reduce using rule 232 + '::' reduce using rule 232 + '=' reduce using rule 232 + '|' reduce using rule 232 + ',' reduce using rule 232 + '_' reduce using rule 232 + '-' reduce using rule 232 + 'as' reduce using rule 232 + 'false' reduce using rule 232 + 'hiding' reduce using rule 232 + 'nominal' reduce using rule 232 + 'phantom' reduce using rule 232 + 'representational'reduce using rule 232 + 'role' reduce using rule 232 + 'true' reduce using rule 232 + LOWER reduce using rule 232 + UPPER reduce using rule 232 + QUAL_UPPER reduce using rule 232 + OPERATOR reduce using rule 232 + QUAL_OPERATOR reduce using rule 232 + LIT_CHAR reduce using rule 232 + LIT_STRING reduce using rule 232 + LIT_RAW_STRING reduce using rule 232 + LIT_INT reduce using rule 232 + LIT_NUMBER reduce using rule 232 + + +State 31 + + %start_parseBinderAndArrow -> binderAndArrow . (rule 22) + + error accept + + +State 32 + + binderAndArrow -> binder . '<-' (rule 221) + + '<-' shift, and enter state 353 + + +State 33 + + binder -> binder1 . (rule 222) + binder -> binder1 . '::' type (rule 223) + binder1 -> binder1 . qualOp binder2 (rule 225) + + ')' reduce using rule 222 + '}' reduce using rule 222 + ']' reduce using rule 222 + '<-' reduce using rule 222 + '<=' shift, and enter state 293 + ':' shift, and enter state 295 + '::' shift, and enter state 352 + ',' reduce using rule 222 + '-' shift, and enter state 296 + OPERATOR shift, and enter state 297 + QUAL_OPERATOR shift, and enter state 298 + + qualOp goto state 351 + +State 34 + + binder1 -> binder2 . (rule 224) + + ')' reduce using rule 224 + '}' reduce using rule 224 + ']' reduce using rule 224 + '\}' reduce using rule 224 + '<-' reduce using rule 224 + '->' reduce using rule 224 + '<=' reduce using rule 224 + ':' reduce using rule 224 + '::' reduce using rule 224 + '=' reduce using rule 224 + '|' reduce using rule 224 + ',' reduce using rule 224 + '-' reduce using rule 224 + OPERATOR reduce using rule 224 + QUAL_OPERATOR reduce using rule 224 + + +State 35 + + many1__binderAtom__ -> binderAtom . (rule 376) + + '(' reduce using rule 376 + ')' reduce using rule 376 + '{' reduce using rule 376 + '}' reduce using rule 376 + '[' reduce using rule 376 + ']' reduce using rule 376 + '\}' reduce using rule 376 + '<-' reduce using rule 376 + '->' reduce using rule 376 + '<=' reduce using rule 376 + ':' reduce using rule 376 + '::' reduce using rule 376 + '=' reduce using rule 376 + '|' reduce using rule 376 + ',' reduce using rule 376 + '_' reduce using rule 376 + '-' reduce using rule 376 + 'as' reduce using rule 376 + 'false' reduce using rule 376 + 'hiding' reduce using rule 376 + 'nominal' reduce using rule 376 + 'phantom' reduce using rule 376 + 'representational'reduce using rule 376 + 'role' reduce using rule 376 + 'true' reduce using rule 376 + LOWER reduce using rule 376 + UPPER reduce using rule 376 + QUAL_UPPER reduce using rule 376 + OPERATOR reduce using rule 376 + QUAL_OPERATOR reduce using rule 376 + LIT_CHAR reduce using rule 376 + LIT_STRING reduce using rule 376 + LIT_RAW_STRING reduce using rule 376 + LIT_INT reduce using rule 376 + LIT_NUMBER reduce using rule 376 + + +State 36 + + binderAtom -> delim__'['__binder__','__']'__ . (rule 236) + + '(' reduce using rule 236 + ')' reduce using rule 236 + '{' reduce using rule 236 + '}' reduce using rule 236 + '[' reduce using rule 236 + ']' reduce using rule 236 + '\}' reduce using rule 236 + '<-' reduce using rule 236 + '->' reduce using rule 236 + '<=' reduce using rule 236 + ':' reduce using rule 236 + '::' reduce using rule 236 + '=' reduce using rule 236 + '|' reduce using rule 236 + ',' reduce using rule 236 + '_' reduce using rule 236 + '-' reduce using rule 236 + 'as' reduce using rule 236 + 'false' reduce using rule 236 + 'hiding' reduce using rule 236 + 'nominal' reduce using rule 236 + 'phantom' reduce using rule 236 + 'representational'reduce using rule 236 + 'role' reduce using rule 236 + 'true' reduce using rule 236 + LOWER reduce using rule 236 + UPPER reduce using rule 236 + QUAL_UPPER reduce using rule 236 + OPERATOR reduce using rule 236 + QUAL_OPERATOR reduce using rule 236 + LIT_CHAR reduce using rule 236 + LIT_STRING reduce using rule 236 + LIT_RAW_STRING reduce using rule 236 + LIT_INT reduce using rule 236 + LIT_NUMBER reduce using rule 236 + + +State 37 + + binderAtom -> delim__'{'__recordBinder__','__'}'__ . (rule 237) + + '(' reduce using rule 237 + ')' reduce using rule 237 + '{' reduce using rule 237 + '}' reduce using rule 237 + '[' reduce using rule 237 + ']' reduce using rule 237 + '\}' reduce using rule 237 + '<-' reduce using rule 237 + '->' reduce using rule 237 + '<=' reduce using rule 237 + ':' reduce using rule 237 + '::' reduce using rule 237 + '=' reduce using rule 237 + '|' reduce using rule 237 + ',' reduce using rule 237 + '_' reduce using rule 237 + '-' reduce using rule 237 + 'as' reduce using rule 237 + 'false' reduce using rule 237 + 'hiding' reduce using rule 237 + 'nominal' reduce using rule 237 + 'phantom' reduce using rule 237 + 'representational'reduce using rule 237 + 'role' reduce using rule 237 + 'true' reduce using rule 237 + LOWER reduce using rule 237 + UPPER reduce using rule 237 + QUAL_UPPER reduce using rule 237 + OPERATOR reduce using rule 237 + QUAL_OPERATOR reduce using rule 237 + LIT_CHAR reduce using rule 237 + LIT_STRING reduce using rule 237 + LIT_RAW_STRING reduce using rule 237 + LIT_INT reduce using rule 237 + LIT_NUMBER reduce using rule 237 + + +State 38 + + binder2 -> many__binderAtom__ . (rule 226) + + ')' reduce using rule 226 + '}' reduce using rule 226 + ']' reduce using rule 226 + '\}' reduce using rule 226 + '<-' reduce using rule 226 + '->' reduce using rule 226 + '<=' reduce using rule 226 + ':' reduce using rule 226 + '::' reduce using rule 226 + '=' reduce using rule 226 + '|' reduce using rule 226 + ',' reduce using rule 226 + '-' reduce using rule 226 + OPERATOR reduce using rule 226 + QUAL_OPERATOR reduce using rule 226 + + +State 39 + + many__binderAtom__ -> many1__binderAtom__ . (rule 342) + many1__binderAtom__ -> many1__binderAtom__ . binderAtom (rule 377) + + '(' shift, and enter state 40 + ')' reduce using rule 342 + '{' shift, and enter state 41 + '}' reduce using rule 342 + '[' shift, and enter state 42 + ']' reduce using rule 342 + '\}' reduce using rule 342 + '<-' reduce using rule 342 + '->' reduce using rule 342 + '<=' reduce using rule 342 + ':' reduce using rule 342 + '::' reduce using rule 342 + '=' reduce using rule 342 + '|' reduce using rule 342 + ',' reduce using rule 342 + '_' shift, and enter state 43 + '-' reduce using rule 342 + 'as' shift, and enter state 45 + 'false' shift, and enter state 46 + 'hiding' shift, and enter state 47 + 'nominal' shift, and enter state 48 + 'phantom' shift, and enter state 49 + 'representational'shift, and enter state 50 + 'role' shift, and enter state 51 + 'true' shift, and enter state 52 + LOWER shift, and enter state 53 + UPPER shift, and enter state 54 + QUAL_UPPER shift, and enter state 55 + OPERATOR reduce using rule 342 + QUAL_OPERATOR reduce using rule 342 + LIT_CHAR shift, and enter state 56 + LIT_STRING shift, and enter state 57 + LIT_RAW_STRING shift, and enter state 58 + LIT_INT shift, and enter state 59 + LIT_NUMBER shift, and enter state 60 + + qualProperName goto state 25 + ident goto state 26 + string goto state 27 + char goto state 28 + number goto state 29 + boolean goto state 30 + binderAtom goto state 350 + delim__'['__binder__','__']'__goto state 36 + delim__'{'__recordBinder__','__'}'__goto state 37 + +State 40 + + binderAtom -> '(' . binder ')' (rule 238) + + '(' shift, and enter state 40 + '{' shift, and enter state 41 + '[' shift, and enter state 42 + '_' shift, and enter state 43 + '-' shift, and enter state 44 + 'as' shift, and enter state 45 + 'false' shift, and enter state 46 + 'hiding' shift, and enter state 47 + 'nominal' shift, and enter state 48 + 'phantom' shift, and enter state 49 + 'representational'shift, and enter state 50 + 'role' shift, and enter state 51 + 'true' shift, and enter state 52 + LOWER shift, and enter state 53 + UPPER shift, and enter state 54 + QUAL_UPPER shift, and enter state 55 + LIT_CHAR shift, and enter state 56 + LIT_STRING shift, and enter state 57 + LIT_RAW_STRING shift, and enter state 58 + LIT_INT shift, and enter state 59 + LIT_NUMBER shift, and enter state 60 + + qualProperName goto state 25 + ident goto state 26 + string goto state 27 + char goto state 28 + number goto state 29 + boolean goto state 30 + binder goto state 349 + binder1 goto state 33 + binder2 goto state 34 + binderAtom goto state 35 + delim__'['__binder__','__']'__goto state 36 + delim__'{'__recordBinder__','__'}'__goto state 37 + many__binderAtom__goto state 38 + many1__binderAtom__goto state 39 + +State 41 + + delim__'{'__recordBinder__','__'}'__ -> '{' . '}' (rule 338) + delim__'{'__recordBinder__','__'}'__ -> '{' . sep__recordBinder__','__ '}' (rule 339) + + '}' shift, and enter state 348 + 'ado' shift, and enter state 230 + 'as' shift, and enter state 231 + 'case' shift, and enter state 232 + 'class' shift, and enter state 233 + 'data' shift, and enter state 234 + 'derive' shift, and enter state 235 + 'do' shift, and enter state 236 + 'else' shift, and enter state 237 + 'false' shift, and enter state 238 + 'forall' shift, and enter state 239 + 'foreign' shift, and enter state 240 + 'hiding' shift, and enter state 241 + 'import' shift, and enter state 242 + 'if' shift, and enter state 243 + 'in' shift, and enter state 244 + 'infix' shift, and enter state 245 + 'infixl' shift, and enter state 246 + 'infixr' shift, and enter state 247 + 'instance' shift, and enter state 248 + 'let' shift, and enter state 249 + 'module' shift, and enter state 250 + 'newtype' shift, and enter state 251 + 'nominal' shift, and enter state 252 + 'phantom' shift, and enter state 253 + 'of' shift, and enter state 254 + 'representational'shift, and enter state 255 + 'role' shift, and enter state 256 + 'then' shift, and enter state 257 + 'true' shift, and enter state 258 + 'type' shift, and enter state 259 + 'where' shift, and enter state 260 + LOWER shift, and enter state 261 + LIT_STRING shift, and enter state 262 + LIT_RAW_STRING shift, and enter state 263 + + label goto state 344 + recordBinder goto state 345 + sep__recordBinder__','__goto state 346 + sep1__recordBinder__','__goto state 347 + +State 42 + + delim__'['__binder__','__']'__ -> '[' . ']' (rule 334) + delim__'['__binder__','__']'__ -> '[' . sep__binder__','__ ']' (rule 335) + + '(' shift, and enter state 40 + '{' shift, and enter state 41 + '[' shift, and enter state 42 + ']' shift, and enter state 343 + '_' shift, and enter state 43 + '-' shift, and enter state 44 + 'as' shift, and enter state 45 + 'false' shift, and enter state 46 + 'hiding' shift, and enter state 47 + 'nominal' shift, and enter state 48 + 'phantom' shift, and enter state 49 + 'representational'shift, and enter state 50 + 'role' shift, and enter state 51 + 'true' shift, and enter state 52 + LOWER shift, and enter state 53 + UPPER shift, and enter state 54 + QUAL_UPPER shift, and enter state 55 + LIT_CHAR shift, and enter state 56 + LIT_STRING shift, and enter state 57 + LIT_RAW_STRING shift, and enter state 58 + LIT_INT shift, and enter state 59 + LIT_NUMBER shift, and enter state 60 + + qualProperName goto state 25 + ident goto state 26 + string goto state 27 + char goto state 28 + number goto state 29 + boolean goto state 30 + binder goto state 340 + binder1 goto state 33 + binder2 goto state 34 + binderAtom goto state 35 + delim__'['__binder__','__']'__goto state 36 + delim__'{'__recordBinder__','__'}'__goto state 37 + many__binderAtom__goto state 38 + many1__binderAtom__goto state 39 + sep__binder__','__goto state 341 + sep1__binder__','__goto state 342 + +State 43 + + binderAtom -> '_' . (rule 228) + + '(' reduce using rule 228 + ')' reduce using rule 228 + '{' reduce using rule 228 + '}' reduce using rule 228 + '[' reduce using rule 228 + ']' reduce using rule 228 + '\}' reduce using rule 228 + '<-' reduce using rule 228 + '->' reduce using rule 228 + '<=' reduce using rule 228 + ':' reduce using rule 228 + '::' reduce using rule 228 + '=' reduce using rule 228 + '|' reduce using rule 228 + ',' reduce using rule 228 + '_' reduce using rule 228 + '-' reduce using rule 228 + 'as' reduce using rule 228 + 'false' reduce using rule 228 + 'hiding' reduce using rule 228 + 'nominal' reduce using rule 228 + 'phantom' reduce using rule 228 + 'representational'reduce using rule 228 + 'role' reduce using rule 228 + 'true' reduce using rule 228 + LOWER reduce using rule 228 + UPPER reduce using rule 228 + QUAL_UPPER reduce using rule 228 + OPERATOR reduce using rule 228 + QUAL_OPERATOR reduce using rule 228 + LIT_CHAR reduce using rule 228 + LIT_STRING reduce using rule 228 + LIT_RAW_STRING reduce using rule 228 + LIT_INT reduce using rule 228 + LIT_NUMBER reduce using rule 228 + + +State 44 + + binder2 -> '-' . number (rule 227) + + LIT_INT shift, and enter state 59 + LIT_NUMBER shift, and enter state 60 + + number goto state 339 + +State 45 + + ident -> 'as' . (rule 37) + + error reduce using rule 37 + '(' reduce using rule 37 + ')' reduce using rule 37 + '{' reduce using rule 37 + '}' reduce using rule 37 + '[' reduce using rule 37 + ']' reduce using rule 37 + '\}' reduce using rule 37 + '\;' reduce using rule 37 + '<-' reduce using rule 37 + '->' reduce using rule 37 + '<=' reduce using rule 37 + '=>' reduce using rule 37 + ':' reduce using rule 37 + '::' reduce using rule 37 + '=' reduce using rule 37 + '|' reduce using rule 37 + '`' reduce using rule 37 + '.' reduce using rule 37 + ',' reduce using rule 37 + '_' reduce using rule 37 + '\\' reduce using rule 37 + '-' reduce using rule 37 + '@' reduce using rule 37 + 'ado' reduce using rule 37 + 'as' reduce using rule 37 + 'case' reduce using rule 37 + 'do' reduce using rule 37 + 'else' reduce using rule 37 + 'false' reduce using rule 37 + 'hiding' reduce using rule 37 + 'if' reduce using rule 37 + 'let' reduce using rule 37 + 'nominal' reduce using rule 37 + 'phantom' reduce using rule 37 + 'of' reduce using rule 37 + 'representational'reduce using rule 37 + 'role' reduce using rule 37 + 'then' reduce using rule 37 + 'true' reduce using rule 37 + 'where' reduce using rule 37 + '(->)' reduce using rule 37 + '(..)' reduce using rule 37 + LOWER reduce using rule 37 + QUAL_LOWER reduce using rule 37 + UPPER reduce using rule 37 + QUAL_UPPER reduce using rule 37 + SYMBOL reduce using rule 37 + QUAL_SYMBOL reduce using rule 37 + OPERATOR reduce using rule 37 + QUAL_OPERATOR reduce using rule 37 + LIT_HOLE reduce using rule 37 + LIT_CHAR reduce using rule 37 + LIT_STRING reduce using rule 37 + LIT_RAW_STRING reduce using rule 37 + LIT_INT reduce using rule 37 + LIT_NUMBER reduce using rule 37 + %eof reduce using rule 37 + + +State 46 + + boolean -> 'false' . (rule 99) + + error reduce using rule 99 + '(' reduce using rule 99 + ')' reduce using rule 99 + '{' reduce using rule 99 + '}' reduce using rule 99 + '[' reduce using rule 99 + ']' reduce using rule 99 + '\}' reduce using rule 99 + '\;' reduce using rule 99 + '<-' reduce using rule 99 + '->' reduce using rule 99 + '<=' reduce using rule 99 + ':' reduce using rule 99 + '::' reduce using rule 99 + '=' reduce using rule 99 + '|' reduce using rule 99 + '`' reduce using rule 99 + '.' reduce using rule 99 + ',' reduce using rule 99 + '_' reduce using rule 99 + '\\' reduce using rule 99 + '-' reduce using rule 99 + '@' reduce using rule 99 + 'ado' reduce using rule 99 + 'as' reduce using rule 99 + 'case' reduce using rule 99 + 'do' reduce using rule 99 + 'else' reduce using rule 99 + 'false' reduce using rule 99 + 'hiding' reduce using rule 99 + 'if' reduce using rule 99 + 'let' reduce using rule 99 + 'nominal' reduce using rule 99 + 'phantom' reduce using rule 99 + 'of' reduce using rule 99 + 'representational'reduce using rule 99 + 'role' reduce using rule 99 + 'then' reduce using rule 99 + 'true' reduce using rule 99 + 'where' reduce using rule 99 + '(..)' reduce using rule 99 + LOWER reduce using rule 99 + QUAL_LOWER reduce using rule 99 + UPPER reduce using rule 99 + QUAL_UPPER reduce using rule 99 + SYMBOL reduce using rule 99 + QUAL_SYMBOL reduce using rule 99 + OPERATOR reduce using rule 99 + QUAL_OPERATOR reduce using rule 99 + LIT_HOLE reduce using rule 99 + LIT_CHAR reduce using rule 99 + LIT_STRING reduce using rule 99 + LIT_RAW_STRING reduce using rule 99 + LIT_INT reduce using rule 99 + LIT_NUMBER reduce using rule 99 + %eof reduce using rule 99 + + +State 47 + + ident -> 'hiding' . (rule 38) + + error reduce using rule 38 + '(' reduce using rule 38 + ')' reduce using rule 38 + '{' reduce using rule 38 + '}' reduce using rule 38 + '[' reduce using rule 38 + ']' reduce using rule 38 + '\}' reduce using rule 38 + '\;' reduce using rule 38 + '<-' reduce using rule 38 + '->' reduce using rule 38 + '<=' reduce using rule 38 + '=>' reduce using rule 38 + ':' reduce using rule 38 + '::' reduce using rule 38 + '=' reduce using rule 38 + '|' reduce using rule 38 + '`' reduce using rule 38 + '.' reduce using rule 38 + ',' reduce using rule 38 + '_' reduce using rule 38 + '\\' reduce using rule 38 + '-' reduce using rule 38 + '@' reduce using rule 38 + 'ado' reduce using rule 38 + 'as' reduce using rule 38 + 'case' reduce using rule 38 + 'do' reduce using rule 38 + 'else' reduce using rule 38 + 'false' reduce using rule 38 + 'hiding' reduce using rule 38 + 'if' reduce using rule 38 + 'let' reduce using rule 38 + 'nominal' reduce using rule 38 + 'phantom' reduce using rule 38 + 'of' reduce using rule 38 + 'representational'reduce using rule 38 + 'role' reduce using rule 38 + 'then' reduce using rule 38 + 'true' reduce using rule 38 + 'where' reduce using rule 38 + '(->)' reduce using rule 38 + '(..)' reduce using rule 38 + LOWER reduce using rule 38 + QUAL_LOWER reduce using rule 38 + UPPER reduce using rule 38 + QUAL_UPPER reduce using rule 38 + SYMBOL reduce using rule 38 + QUAL_SYMBOL reduce using rule 38 + OPERATOR reduce using rule 38 + QUAL_OPERATOR reduce using rule 38 + LIT_HOLE reduce using rule 38 + LIT_CHAR reduce using rule 38 + LIT_STRING reduce using rule 38 + LIT_RAW_STRING reduce using rule 38 + LIT_INT reduce using rule 38 + LIT_NUMBER reduce using rule 38 + %eof reduce using rule 38 + + +State 48 + + ident -> 'nominal' . (rule 40) + + error reduce using rule 40 + '(' reduce using rule 40 + ')' reduce using rule 40 + '{' reduce using rule 40 + '}' reduce using rule 40 + '[' reduce using rule 40 + ']' reduce using rule 40 + '\}' reduce using rule 40 + '\;' reduce using rule 40 + '<-' reduce using rule 40 + '->' reduce using rule 40 + '<=' reduce using rule 40 + '=>' reduce using rule 40 + ':' reduce using rule 40 + '::' reduce using rule 40 + '=' reduce using rule 40 + '|' reduce using rule 40 + '`' reduce using rule 40 + '.' reduce using rule 40 + ',' reduce using rule 40 + '_' reduce using rule 40 + '\\' reduce using rule 40 + '-' reduce using rule 40 + '@' reduce using rule 40 + 'ado' reduce using rule 40 + 'as' reduce using rule 40 + 'case' reduce using rule 40 + 'do' reduce using rule 40 + 'else' reduce using rule 40 + 'false' reduce using rule 40 + 'hiding' reduce using rule 40 + 'if' reduce using rule 40 + 'let' reduce using rule 40 + 'nominal' reduce using rule 40 + 'phantom' reduce using rule 40 + 'of' reduce using rule 40 + 'representational'reduce using rule 40 + 'role' reduce using rule 40 + 'then' reduce using rule 40 + 'true' reduce using rule 40 + 'where' reduce using rule 40 + '(->)' reduce using rule 40 + '(..)' reduce using rule 40 + LOWER reduce using rule 40 + QUAL_LOWER reduce using rule 40 + UPPER reduce using rule 40 + QUAL_UPPER reduce using rule 40 + SYMBOL reduce using rule 40 + QUAL_SYMBOL reduce using rule 40 + OPERATOR reduce using rule 40 + QUAL_OPERATOR reduce using rule 40 + LIT_HOLE reduce using rule 40 + LIT_CHAR reduce using rule 40 + LIT_STRING reduce using rule 40 + LIT_RAW_STRING reduce using rule 40 + LIT_INT reduce using rule 40 + LIT_NUMBER reduce using rule 40 + %eof reduce using rule 40 + + +State 49 + + ident -> 'phantom' . (rule 42) + + error reduce using rule 42 + '(' reduce using rule 42 + ')' reduce using rule 42 + '{' reduce using rule 42 + '}' reduce using rule 42 + '[' reduce using rule 42 + ']' reduce using rule 42 + '\}' reduce using rule 42 + '\;' reduce using rule 42 + '<-' reduce using rule 42 + '->' reduce using rule 42 + '<=' reduce using rule 42 + '=>' reduce using rule 42 + ':' reduce using rule 42 + '::' reduce using rule 42 + '=' reduce using rule 42 + '|' reduce using rule 42 + '`' reduce using rule 42 + '.' reduce using rule 42 + ',' reduce using rule 42 + '_' reduce using rule 42 + '\\' reduce using rule 42 + '-' reduce using rule 42 + '@' reduce using rule 42 + 'ado' reduce using rule 42 + 'as' reduce using rule 42 + 'case' reduce using rule 42 + 'do' reduce using rule 42 + 'else' reduce using rule 42 + 'false' reduce using rule 42 + 'hiding' reduce using rule 42 + 'if' reduce using rule 42 + 'let' reduce using rule 42 + 'nominal' reduce using rule 42 + 'phantom' reduce using rule 42 + 'of' reduce using rule 42 + 'representational'reduce using rule 42 + 'role' reduce using rule 42 + 'then' reduce using rule 42 + 'true' reduce using rule 42 + 'where' reduce using rule 42 + '(->)' reduce using rule 42 + '(..)' reduce using rule 42 + LOWER reduce using rule 42 + QUAL_LOWER reduce using rule 42 + UPPER reduce using rule 42 + QUAL_UPPER reduce using rule 42 + SYMBOL reduce using rule 42 + QUAL_SYMBOL reduce using rule 42 + OPERATOR reduce using rule 42 + QUAL_OPERATOR reduce using rule 42 + LIT_HOLE reduce using rule 42 + LIT_CHAR reduce using rule 42 + LIT_STRING reduce using rule 42 + LIT_RAW_STRING reduce using rule 42 + LIT_INT reduce using rule 42 + LIT_NUMBER reduce using rule 42 + %eof reduce using rule 42 + + +State 50 + + ident -> 'representational' . (rule 41) + + error reduce using rule 41 + '(' reduce using rule 41 + ')' reduce using rule 41 + '{' reduce using rule 41 + '}' reduce using rule 41 + '[' reduce using rule 41 + ']' reduce using rule 41 + '\}' reduce using rule 41 + '\;' reduce using rule 41 + '<-' reduce using rule 41 + '->' reduce using rule 41 + '<=' reduce using rule 41 + '=>' reduce using rule 41 + ':' reduce using rule 41 + '::' reduce using rule 41 + '=' reduce using rule 41 + '|' reduce using rule 41 + '`' reduce using rule 41 + '.' reduce using rule 41 + ',' reduce using rule 41 + '_' reduce using rule 41 + '\\' reduce using rule 41 + '-' reduce using rule 41 + '@' reduce using rule 41 + 'ado' reduce using rule 41 + 'as' reduce using rule 41 + 'case' reduce using rule 41 + 'do' reduce using rule 41 + 'else' reduce using rule 41 + 'false' reduce using rule 41 + 'hiding' reduce using rule 41 + 'if' reduce using rule 41 + 'let' reduce using rule 41 + 'nominal' reduce using rule 41 + 'phantom' reduce using rule 41 + 'of' reduce using rule 41 + 'representational'reduce using rule 41 + 'role' reduce using rule 41 + 'then' reduce using rule 41 + 'true' reduce using rule 41 + 'where' reduce using rule 41 + '(->)' reduce using rule 41 + '(..)' reduce using rule 41 + LOWER reduce using rule 41 + QUAL_LOWER reduce using rule 41 + UPPER reduce using rule 41 + QUAL_UPPER reduce using rule 41 + SYMBOL reduce using rule 41 + QUAL_SYMBOL reduce using rule 41 + OPERATOR reduce using rule 41 + QUAL_OPERATOR reduce using rule 41 + LIT_HOLE reduce using rule 41 + LIT_CHAR reduce using rule 41 + LIT_STRING reduce using rule 41 + LIT_RAW_STRING reduce using rule 41 + LIT_INT reduce using rule 41 + LIT_NUMBER reduce using rule 41 + %eof reduce using rule 41 + + +State 51 + + ident -> 'role' . (rule 39) + + error reduce using rule 39 + '(' reduce using rule 39 + ')' reduce using rule 39 + '{' reduce using rule 39 + '}' reduce using rule 39 + '[' reduce using rule 39 + ']' reduce using rule 39 + '\}' reduce using rule 39 + '\;' reduce using rule 39 + '<-' reduce using rule 39 + '->' reduce using rule 39 + '<=' reduce using rule 39 + '=>' reduce using rule 39 + ':' reduce using rule 39 + '::' reduce using rule 39 + '=' reduce using rule 39 + '|' reduce using rule 39 + '`' reduce using rule 39 + '.' reduce using rule 39 + ',' reduce using rule 39 + '_' reduce using rule 39 + '\\' reduce using rule 39 + '-' reduce using rule 39 + '@' reduce using rule 39 + 'ado' reduce using rule 39 + 'as' reduce using rule 39 + 'case' reduce using rule 39 + 'do' reduce using rule 39 + 'else' reduce using rule 39 + 'false' reduce using rule 39 + 'hiding' reduce using rule 39 + 'if' reduce using rule 39 + 'let' reduce using rule 39 + 'nominal' reduce using rule 39 + 'phantom' reduce using rule 39 + 'of' reduce using rule 39 + 'representational'reduce using rule 39 + 'role' reduce using rule 39 + 'then' reduce using rule 39 + 'true' reduce using rule 39 + 'where' reduce using rule 39 + '(->)' reduce using rule 39 + '(..)' reduce using rule 39 + LOWER reduce using rule 39 + QUAL_LOWER reduce using rule 39 + UPPER reduce using rule 39 + QUAL_UPPER reduce using rule 39 + SYMBOL reduce using rule 39 + QUAL_SYMBOL reduce using rule 39 + OPERATOR reduce using rule 39 + QUAL_OPERATOR reduce using rule 39 + LIT_HOLE reduce using rule 39 + LIT_CHAR reduce using rule 39 + LIT_STRING reduce using rule 39 + LIT_RAW_STRING reduce using rule 39 + LIT_INT reduce using rule 39 + LIT_NUMBER reduce using rule 39 + %eof reduce using rule 39 + + +State 52 + + boolean -> 'true' . (rule 98) + + error reduce using rule 98 + '(' reduce using rule 98 + ')' reduce using rule 98 + '{' reduce using rule 98 + '}' reduce using rule 98 + '[' reduce using rule 98 + ']' reduce using rule 98 + '\}' reduce using rule 98 + '\;' reduce using rule 98 + '<-' reduce using rule 98 + '->' reduce using rule 98 + '<=' reduce using rule 98 + ':' reduce using rule 98 + '::' reduce using rule 98 + '=' reduce using rule 98 + '|' reduce using rule 98 + '`' reduce using rule 98 + '.' reduce using rule 98 + ',' reduce using rule 98 + '_' reduce using rule 98 + '\\' reduce using rule 98 + '-' reduce using rule 98 + '@' reduce using rule 98 + 'ado' reduce using rule 98 + 'as' reduce using rule 98 + 'case' reduce using rule 98 + 'do' reduce using rule 98 + 'else' reduce using rule 98 + 'false' reduce using rule 98 + 'hiding' reduce using rule 98 + 'if' reduce using rule 98 + 'let' reduce using rule 98 + 'nominal' reduce using rule 98 + 'phantom' reduce using rule 98 + 'of' reduce using rule 98 + 'representational'reduce using rule 98 + 'role' reduce using rule 98 + 'then' reduce using rule 98 + 'true' reduce using rule 98 + 'where' reduce using rule 98 + '(..)' reduce using rule 98 + LOWER reduce using rule 98 + QUAL_LOWER reduce using rule 98 + UPPER reduce using rule 98 + QUAL_UPPER reduce using rule 98 + SYMBOL reduce using rule 98 + QUAL_SYMBOL reduce using rule 98 + OPERATOR reduce using rule 98 + QUAL_OPERATOR reduce using rule 98 + LIT_HOLE reduce using rule 98 + LIT_CHAR reduce using rule 98 + LIT_STRING reduce using rule 98 + LIT_RAW_STRING reduce using rule 98 + LIT_INT reduce using rule 98 + LIT_NUMBER reduce using rule 98 + %eof reduce using rule 98 + + +State 53 + + ident -> LOWER . (rule 36) + + error reduce using rule 36 + '(' reduce using rule 36 + ')' reduce using rule 36 + '{' reduce using rule 36 + '}' reduce using rule 36 + '[' reduce using rule 36 + ']' reduce using rule 36 + '\}' reduce using rule 36 + '\;' reduce using rule 36 + '<-' reduce using rule 36 + '->' reduce using rule 36 + '<=' reduce using rule 36 + '=>' reduce using rule 36 + ':' reduce using rule 36 + '::' reduce using rule 36 + '=' reduce using rule 36 + '|' reduce using rule 36 + '`' reduce using rule 36 + '.' reduce using rule 36 + ',' reduce using rule 36 + '_' reduce using rule 36 + '\\' reduce using rule 36 + '-' reduce using rule 36 + '@' reduce using rule 36 + 'ado' reduce using rule 36 + 'as' reduce using rule 36 + 'case' reduce using rule 36 + 'do' reduce using rule 36 + 'else' reduce using rule 36 + 'false' reduce using rule 36 + 'hiding' reduce using rule 36 + 'if' reduce using rule 36 + 'let' reduce using rule 36 + 'nominal' reduce using rule 36 + 'phantom' reduce using rule 36 + 'of' reduce using rule 36 + 'representational'reduce using rule 36 + 'role' reduce using rule 36 + 'then' reduce using rule 36 + 'true' reduce using rule 36 + 'where' reduce using rule 36 + '(->)' reduce using rule 36 + '(..)' reduce using rule 36 + LOWER reduce using rule 36 + QUAL_LOWER reduce using rule 36 + UPPER reduce using rule 36 + QUAL_UPPER reduce using rule 36 + SYMBOL reduce using rule 36 + QUAL_SYMBOL reduce using rule 36 + OPERATOR reduce using rule 36 + QUAL_OPERATOR reduce using rule 36 + LIT_HOLE reduce using rule 36 + LIT_CHAR reduce using rule 36 + LIT_STRING reduce using rule 36 + LIT_RAW_STRING reduce using rule 36 + LIT_INT reduce using rule 36 + LIT_NUMBER reduce using rule 36 + %eof reduce using rule 36 + + +State 54 + + qualProperName -> UPPER . (rule 25) + + error reduce using rule 25 + '(' reduce using rule 25 + ')' reduce using rule 25 + '{' reduce using rule 25 + '}' reduce using rule 25 + '[' reduce using rule 25 + ']' reduce using rule 25 + '\}' reduce using rule 25 + '\;' reduce using rule 25 + '<-' reduce using rule 25 + '->' reduce using rule 25 + '<=' reduce using rule 25 + '=>' reduce using rule 25 + ':' reduce using rule 25 + '::' reduce using rule 25 + '=' reduce using rule 25 + '|' reduce using rule 25 + '`' reduce using rule 25 + '.' reduce using rule 25 + ',' reduce using rule 25 + '_' reduce using rule 25 + '\\' reduce using rule 25 + '-' reduce using rule 25 + '@' reduce using rule 25 + 'ado' reduce using rule 25 + 'as' reduce using rule 25 + 'case' reduce using rule 25 + 'do' reduce using rule 25 + 'else' reduce using rule 25 + 'false' reduce using rule 25 + 'hiding' reduce using rule 25 + 'if' reduce using rule 25 + 'let' reduce using rule 25 + 'nominal' reduce using rule 25 + 'phantom' reduce using rule 25 + 'of' reduce using rule 25 + 'representational'reduce using rule 25 + 'role' reduce using rule 25 + 'then' reduce using rule 25 + 'true' reduce using rule 25 + 'where' reduce using rule 25 + '(->)' reduce using rule 25 + '(..)' reduce using rule 25 + LOWER reduce using rule 25 + QUAL_LOWER reduce using rule 25 + UPPER reduce using rule 25 + QUAL_UPPER reduce using rule 25 + SYMBOL reduce using rule 25 + QUAL_SYMBOL reduce using rule 25 + OPERATOR reduce using rule 25 + QUAL_OPERATOR reduce using rule 25 + LIT_HOLE reduce using rule 25 + LIT_CHAR reduce using rule 25 + LIT_STRING reduce using rule 25 + LIT_RAW_STRING reduce using rule 25 + LIT_INT reduce using rule 25 + LIT_NUMBER reduce using rule 25 + %eof reduce using rule 25 + + +State 55 + + qualProperName -> QUAL_UPPER . (rule 26) + + error reduce using rule 26 + '(' reduce using rule 26 + ')' reduce using rule 26 + '{' reduce using rule 26 + '}' reduce using rule 26 + '[' reduce using rule 26 + ']' reduce using rule 26 + '\}' reduce using rule 26 + '\;' reduce using rule 26 + '<-' reduce using rule 26 + '->' reduce using rule 26 + '<=' reduce using rule 26 + '=>' reduce using rule 26 + ':' reduce using rule 26 + '::' reduce using rule 26 + '=' reduce using rule 26 + '|' reduce using rule 26 + '`' reduce using rule 26 + '.' reduce using rule 26 + ',' reduce using rule 26 + '_' reduce using rule 26 + '\\' reduce using rule 26 + '-' reduce using rule 26 + '@' reduce using rule 26 + 'ado' reduce using rule 26 + 'as' reduce using rule 26 + 'case' reduce using rule 26 + 'do' reduce using rule 26 + 'else' reduce using rule 26 + 'false' reduce using rule 26 + 'hiding' reduce using rule 26 + 'if' reduce using rule 26 + 'let' reduce using rule 26 + 'nominal' reduce using rule 26 + 'phantom' reduce using rule 26 + 'of' reduce using rule 26 + 'representational'reduce using rule 26 + 'role' reduce using rule 26 + 'then' reduce using rule 26 + 'true' reduce using rule 26 + 'where' reduce using rule 26 + '(->)' reduce using rule 26 + '(..)' reduce using rule 26 + LOWER reduce using rule 26 + QUAL_LOWER reduce using rule 26 + UPPER reduce using rule 26 + QUAL_UPPER reduce using rule 26 + SYMBOL reduce using rule 26 + QUAL_SYMBOL reduce using rule 26 + OPERATOR reduce using rule 26 + QUAL_OPERATOR reduce using rule 26 + LIT_HOLE reduce using rule 26 + LIT_CHAR reduce using rule 26 + LIT_STRING reduce using rule 26 + LIT_RAW_STRING reduce using rule 26 + LIT_INT reduce using rule 26 + LIT_NUMBER reduce using rule 26 + %eof reduce using rule 26 + + +State 56 + + char -> LIT_CHAR . (rule 94) + + error reduce using rule 94 + '(' reduce using rule 94 + ')' reduce using rule 94 + '{' reduce using rule 94 + '}' reduce using rule 94 + '[' reduce using rule 94 + ']' reduce using rule 94 + '\}' reduce using rule 94 + '\;' reduce using rule 94 + '<-' reduce using rule 94 + '->' reduce using rule 94 + '<=' reduce using rule 94 + ':' reduce using rule 94 + '::' reduce using rule 94 + '=' reduce using rule 94 + '|' reduce using rule 94 + '`' reduce using rule 94 + '.' reduce using rule 94 + ',' reduce using rule 94 + '_' reduce using rule 94 + '\\' reduce using rule 94 + '-' reduce using rule 94 + '@' reduce using rule 94 + 'ado' reduce using rule 94 + 'as' reduce using rule 94 + 'case' reduce using rule 94 + 'do' reduce using rule 94 + 'else' reduce using rule 94 + 'false' reduce using rule 94 + 'hiding' reduce using rule 94 + 'if' reduce using rule 94 + 'let' reduce using rule 94 + 'nominal' reduce using rule 94 + 'phantom' reduce using rule 94 + 'of' reduce using rule 94 + 'representational'reduce using rule 94 + 'role' reduce using rule 94 + 'then' reduce using rule 94 + 'true' reduce using rule 94 + 'where' reduce using rule 94 + '(..)' reduce using rule 94 + LOWER reduce using rule 94 + QUAL_LOWER reduce using rule 94 + UPPER reduce using rule 94 + QUAL_UPPER reduce using rule 94 + SYMBOL reduce using rule 94 + QUAL_SYMBOL reduce using rule 94 + OPERATOR reduce using rule 94 + QUAL_OPERATOR reduce using rule 94 + LIT_HOLE reduce using rule 94 + LIT_CHAR reduce using rule 94 + LIT_STRING reduce using rule 94 + LIT_RAW_STRING reduce using rule 94 + LIT_INT reduce using rule 94 + LIT_NUMBER reduce using rule 94 + %eof reduce using rule 94 + + +State 57 + + string -> LIT_STRING . (rule 92) + + error reduce using rule 92 + '(' reduce using rule 92 + ')' reduce using rule 92 + '{' reduce using rule 92 + '}' reduce using rule 92 + '[' reduce using rule 92 + ']' reduce using rule 92 + '\}' reduce using rule 92 + '\;' reduce using rule 92 + '<-' reduce using rule 92 + '->' reduce using rule 92 + '<=' reduce using rule 92 + '=>' reduce using rule 92 + ':' reduce using rule 92 + '::' reduce using rule 92 + '=' reduce using rule 92 + '|' reduce using rule 92 + '`' reduce using rule 92 + '.' reduce using rule 92 + ',' reduce using rule 92 + '_' reduce using rule 92 + '\\' reduce using rule 92 + '-' reduce using rule 92 + '@' reduce using rule 92 + 'ado' reduce using rule 92 + 'as' reduce using rule 92 + 'case' reduce using rule 92 + 'do' reduce using rule 92 + 'else' reduce using rule 92 + 'false' reduce using rule 92 + 'hiding' reduce using rule 92 + 'if' reduce using rule 92 + 'let' reduce using rule 92 + 'nominal' reduce using rule 92 + 'phantom' reduce using rule 92 + 'of' reduce using rule 92 + 'representational'reduce using rule 92 + 'role' reduce using rule 92 + 'then' reduce using rule 92 + 'true' reduce using rule 92 + 'where' reduce using rule 92 + '(->)' reduce using rule 92 + '(..)' reduce using rule 92 + LOWER reduce using rule 92 + QUAL_LOWER reduce using rule 92 + UPPER reduce using rule 92 + QUAL_UPPER reduce using rule 92 + SYMBOL reduce using rule 92 + QUAL_SYMBOL reduce using rule 92 + OPERATOR reduce using rule 92 + QUAL_OPERATOR reduce using rule 92 + LIT_HOLE reduce using rule 92 + LIT_CHAR reduce using rule 92 + LIT_STRING reduce using rule 92 + LIT_RAW_STRING reduce using rule 92 + LIT_INT reduce using rule 92 + LIT_NUMBER reduce using rule 92 + %eof reduce using rule 92 + + +State 58 + + string -> LIT_RAW_STRING . (rule 93) + + error reduce using rule 93 + '(' reduce using rule 93 + ')' reduce using rule 93 + '{' reduce using rule 93 + '}' reduce using rule 93 + '[' reduce using rule 93 + ']' reduce using rule 93 + '\}' reduce using rule 93 + '\;' reduce using rule 93 + '<-' reduce using rule 93 + '->' reduce using rule 93 + '<=' reduce using rule 93 + '=>' reduce using rule 93 + ':' reduce using rule 93 + '::' reduce using rule 93 + '=' reduce using rule 93 + '|' reduce using rule 93 + '`' reduce using rule 93 + '.' reduce using rule 93 + ',' reduce using rule 93 + '_' reduce using rule 93 + '\\' reduce using rule 93 + '-' reduce using rule 93 + '@' reduce using rule 93 + 'ado' reduce using rule 93 + 'as' reduce using rule 93 + 'case' reduce using rule 93 + 'do' reduce using rule 93 + 'else' reduce using rule 93 + 'false' reduce using rule 93 + 'hiding' reduce using rule 93 + 'if' reduce using rule 93 + 'let' reduce using rule 93 + 'nominal' reduce using rule 93 + 'phantom' reduce using rule 93 + 'of' reduce using rule 93 + 'representational'reduce using rule 93 + 'role' reduce using rule 93 + 'then' reduce using rule 93 + 'true' reduce using rule 93 + 'where' reduce using rule 93 + '(->)' reduce using rule 93 + '(..)' reduce using rule 93 + LOWER reduce using rule 93 + QUAL_LOWER reduce using rule 93 + UPPER reduce using rule 93 + QUAL_UPPER reduce using rule 93 + SYMBOL reduce using rule 93 + QUAL_SYMBOL reduce using rule 93 + OPERATOR reduce using rule 93 + QUAL_OPERATOR reduce using rule 93 + LIT_HOLE reduce using rule 93 + LIT_CHAR reduce using rule 93 + LIT_STRING reduce using rule 93 + LIT_RAW_STRING reduce using rule 93 + LIT_INT reduce using rule 93 + LIT_NUMBER reduce using rule 93 + %eof reduce using rule 93 + + +State 59 + + number -> LIT_INT . (rule 95) + + error reduce using rule 95 + '(' reduce using rule 95 + ')' reduce using rule 95 + '{' reduce using rule 95 + '}' reduce using rule 95 + '[' reduce using rule 95 + ']' reduce using rule 95 + '\}' reduce using rule 95 + '\;' reduce using rule 95 + '<-' reduce using rule 95 + '->' reduce using rule 95 + '<=' reduce using rule 95 + ':' reduce using rule 95 + '::' reduce using rule 95 + '=' reduce using rule 95 + '|' reduce using rule 95 + '`' reduce using rule 95 + '.' reduce using rule 95 + ',' reduce using rule 95 + '_' reduce using rule 95 + '\\' reduce using rule 95 + '-' reduce using rule 95 + '@' reduce using rule 95 + 'ado' reduce using rule 95 + 'as' reduce using rule 95 + 'case' reduce using rule 95 + 'do' reduce using rule 95 + 'else' reduce using rule 95 + 'false' reduce using rule 95 + 'hiding' reduce using rule 95 + 'if' reduce using rule 95 + 'let' reduce using rule 95 + 'nominal' reduce using rule 95 + 'phantom' reduce using rule 95 + 'of' reduce using rule 95 + 'representational'reduce using rule 95 + 'role' reduce using rule 95 + 'then' reduce using rule 95 + 'true' reduce using rule 95 + 'where' reduce using rule 95 + '(..)' reduce using rule 95 + LOWER reduce using rule 95 + QUAL_LOWER reduce using rule 95 + UPPER reduce using rule 95 + QUAL_UPPER reduce using rule 95 + SYMBOL reduce using rule 95 + QUAL_SYMBOL reduce using rule 95 + OPERATOR reduce using rule 95 + QUAL_OPERATOR reduce using rule 95 + LIT_HOLE reduce using rule 95 + LIT_CHAR reduce using rule 95 + LIT_STRING reduce using rule 95 + LIT_RAW_STRING reduce using rule 95 + LIT_INT reduce using rule 95 + LIT_NUMBER reduce using rule 95 + %eof reduce using rule 95 + + +State 60 + + number -> LIT_NUMBER . (rule 96) + + error reduce using rule 96 + '(' reduce using rule 96 + ')' reduce using rule 96 + '{' reduce using rule 96 + '}' reduce using rule 96 + '[' reduce using rule 96 + ']' reduce using rule 96 + '\}' reduce using rule 96 + '\;' reduce using rule 96 + '<-' reduce using rule 96 + '->' reduce using rule 96 + '<=' reduce using rule 96 + ':' reduce using rule 96 + '::' reduce using rule 96 + '=' reduce using rule 96 + '|' reduce using rule 96 + '`' reduce using rule 96 + '.' reduce using rule 96 + ',' reduce using rule 96 + '_' reduce using rule 96 + '\\' reduce using rule 96 + '-' reduce using rule 96 + '@' reduce using rule 96 + 'ado' reduce using rule 96 + 'as' reduce using rule 96 + 'case' reduce using rule 96 + 'do' reduce using rule 96 + 'else' reduce using rule 96 + 'false' reduce using rule 96 + 'hiding' reduce using rule 96 + 'if' reduce using rule 96 + 'let' reduce using rule 96 + 'nominal' reduce using rule 96 + 'phantom' reduce using rule 96 + 'of' reduce using rule 96 + 'representational'reduce using rule 96 + 'role' reduce using rule 96 + 'then' reduce using rule 96 + 'true' reduce using rule 96 + 'where' reduce using rule 96 + '(..)' reduce using rule 96 + LOWER reduce using rule 96 + QUAL_LOWER reduce using rule 96 + UPPER reduce using rule 96 + QUAL_UPPER reduce using rule 96 + SYMBOL reduce using rule 96 + QUAL_SYMBOL reduce using rule 96 + OPERATOR reduce using rule 96 + QUAL_OPERATOR reduce using rule 96 + LIT_HOLE reduce using rule 96 + LIT_CHAR reduce using rule 96 + LIT_STRING reduce using rule 96 + LIT_RAW_STRING reduce using rule 96 + LIT_INT reduce using rule 96 + LIT_NUMBER reduce using rule 96 + %eof reduce using rule 96 + + +State 61 + + classNameAndFundeps -> properName . manyOrEmpty__typeVarBinding__ fundeps (rule 303) + + error reduce using rule 352 + '(' shift, and enter state 288 + '|' reduce using rule 352 + '@' shift, and enter state 289 + 'as' shift, and enter state 45 + 'hiding' shift, and enter state 47 + 'nominal' shift, and enter state 48 + 'phantom' shift, and enter state 49 + 'representational'shift, and enter state 50 + 'role' shift, and enter state 51 + LOWER shift, and enter state 53 + + ident goto state 284 + typeVarBinding goto state 285 + many__typeVarBinding__goto state 337 + manyOrEmpty__typeVarBinding__goto state 338 + many1__typeVarBinding__goto state 287 + +State 62 + + %start_parseClassNameAndFundeps -> classNameAndFundeps . (rule 21) + + error accept + + +State 63 + + properName -> UPPER . (rule 27) + + error reduce using rule 27 + '(' reduce using rule 27 + ')' reduce using rule 27 + '{' reduce using rule 27 + '\}' reduce using rule 27 + '\;' reduce using rule 27 + '::' reduce using rule 27 + '=' reduce using rule 27 + '|' reduce using rule 27 + ',' reduce using rule 27 + '_' reduce using rule 27 + '@' reduce using rule 27 + 'as' reduce using rule 27 + 'else' reduce using rule 27 + 'hiding' reduce using rule 27 + 'nominal' reduce using rule 27 + 'phantom' reduce using rule 27 + 'representational'reduce using rule 27 + 'role' reduce using rule 27 + '(->)' reduce using rule 27 + '(..)' reduce using rule 27 + LOWER reduce using rule 27 + UPPER reduce using rule 27 + QUAL_UPPER reduce using rule 27 + SYMBOL reduce using rule 27 + QUAL_SYMBOL reduce using rule 27 + LIT_HOLE reduce using rule 27 + LIT_STRING reduce using rule 27 + LIT_RAW_STRING reduce using rule 27 + LIT_INT reduce using rule 27 + %eof reduce using rule 27 + + +State 64 + + constraint -> qualProperName . manyOrEmpty__typeAtom__ (rule 315) + + '(' shift, and enter state 148 + ')' reduce using rule 350 + '{' shift, and enter state 149 + '<=' reduce using rule 350 + ',' reduce using rule 350 + '_' shift, and enter state 150 + 'as' shift, and enter state 45 + 'hiding' shift, and enter state 47 + 'nominal' shift, and enter state 48 + 'phantom' shift, and enter state 49 + 'representational'shift, and enter state 50 + 'role' shift, and enter state 51 + '(->)' shift, and enter state 154 + '(..)' shift, and enter state 112 + LOWER shift, and enter state 53 + UPPER shift, and enter state 54 + QUAL_UPPER shift, and enter state 55 + SYMBOL shift, and enter state 115 + QUAL_SYMBOL shift, and enter state 116 + LIT_HOLE shift, and enter state 117 + LIT_STRING shift, and enter state 57 + LIT_RAW_STRING shift, and enter state 58 + LIT_INT shift, and enter state 155 + + qualProperName goto state 133 + ident goto state 134 + qualSymbol goto state 135 + hole goto state 136 + string goto state 137 + int goto state 138 + typeAtom goto state 333 + manyOrEmpty__typeAtom__goto state 334 + many__typeAtom__goto state 335 + many1__typeAtom__goto state 336 + +State 65 + + %start_parseClassSuper -> classSuper . (rule 20) + + error accept + + +State 66 + + classSuper -> constraints . '<=' (rule 302) + + '<=' shift, and enter state 332 + + +State 67 + + constraints -> constraint . (rule 313) + + '<=' reduce using rule 313 + '=>' reduce using rule 313 + + +State 68 + + constraints -> '(' . sep__constraint__','__ ')' (rule 314) + constraint -> '(' . constraint ')' (rule 316) + + '(' shift, and enter state 331 + UPPER shift, and enter state 54 + QUAL_UPPER shift, and enter state 55 + + qualProperName goto state 64 + constraint goto state 328 + sep__constraint__','__goto state 329 + sep1__constraint__','__goto state 330 + +State 69 + + classSignature -> properName . '::' type (rule 301) + + '::' shift, and enter state 327 + + +State 70 + + %start_parseClassSignature -> classSignature . (rule 19) + + error accept + + +State 71 + + %start_parseGuardStatement -> guardStatement . (rule 18) + + error accept + + +State 72 + + %start_parseGuardNext -> guardNext . (rule 17) + + error accept + + +State 73 + + guardNext -> ',' . (rule 219) + + error reduce using rule 219 + + +State 74 + + exprAtom -> qualProperName . (rule 179) + + error reduce using rule 179 + '(' reduce using rule 179 + ')' reduce using rule 179 + '{' reduce using rule 179 + '}' reduce using rule 179 + '[' reduce using rule 179 + ']' reduce using rule 179 + '\}' reduce using rule 179 + '\;' reduce using rule 179 + '<=' reduce using rule 179 + ':' reduce using rule 179 + '::' reduce using rule 179 + '|' reduce using rule 179 + '`' reduce using rule 179 + '.' reduce using rule 179 + ',' reduce using rule 179 + '_' reduce using rule 179 + '\\' reduce using rule 179 + '-' reduce using rule 179 + '@' reduce using rule 179 + 'ado' reduce using rule 179 + 'as' reduce using rule 179 + 'case' reduce using rule 179 + 'do' reduce using rule 179 + 'else' reduce using rule 179 + 'false' reduce using rule 179 + 'hiding' reduce using rule 179 + 'if' reduce using rule 179 + 'let' reduce using rule 179 + 'nominal' reduce using rule 179 + 'phantom' reduce using rule 179 + 'of' reduce using rule 179 + 'representational'reduce using rule 179 + 'role' reduce using rule 179 + 'then' reduce using rule 179 + 'true' reduce using rule 179 + 'where' reduce using rule 179 + '(..)' reduce using rule 179 + LOWER reduce using rule 179 + QUAL_LOWER reduce using rule 179 + UPPER reduce using rule 179 + QUAL_UPPER reduce using rule 179 + SYMBOL reduce using rule 179 + QUAL_SYMBOL reduce using rule 179 + OPERATOR reduce using rule 179 + QUAL_OPERATOR reduce using rule 179 + LIT_HOLE reduce using rule 179 + LIT_CHAR reduce using rule 179 + LIT_STRING reduce using rule 179 + LIT_RAW_STRING reduce using rule 179 + LIT_INT reduce using rule 179 + LIT_NUMBER reduce using rule 179 + %eof reduce using rule 179 + + +State 75 + + exprAtom -> qualIdent . (rule 178) + + error reduce using rule 178 + '(' reduce using rule 178 + ')' reduce using rule 178 + '{' reduce using rule 178 + '}' reduce using rule 178 + '[' reduce using rule 178 + ']' reduce using rule 178 + '\}' reduce using rule 178 + '\;' reduce using rule 178 + '<=' reduce using rule 178 + ':' reduce using rule 178 + '::' reduce using rule 178 + '|' reduce using rule 178 + '`' reduce using rule 178 + '.' reduce using rule 178 + ',' reduce using rule 178 + '_' reduce using rule 178 + '\\' reduce using rule 178 + '-' reduce using rule 178 + '@' reduce using rule 178 + 'ado' reduce using rule 178 + 'as' reduce using rule 178 + 'case' reduce using rule 178 + 'do' reduce using rule 178 + 'else' reduce using rule 178 + 'false' reduce using rule 178 + 'hiding' reduce using rule 178 + 'if' reduce using rule 178 + 'let' reduce using rule 178 + 'nominal' reduce using rule 178 + 'phantom' reduce using rule 178 + 'of' reduce using rule 178 + 'representational'reduce using rule 178 + 'role' reduce using rule 178 + 'then' reduce using rule 178 + 'true' reduce using rule 178 + 'where' reduce using rule 178 + '(..)' reduce using rule 178 + LOWER reduce using rule 178 + QUAL_LOWER reduce using rule 178 + UPPER reduce using rule 178 + QUAL_UPPER reduce using rule 178 + SYMBOL reduce using rule 178 + QUAL_SYMBOL reduce using rule 178 + OPERATOR reduce using rule 178 + QUAL_OPERATOR reduce using rule 178 + LIT_HOLE reduce using rule 178 + LIT_CHAR reduce using rule 178 + LIT_STRING reduce using rule 178 + LIT_RAW_STRING reduce using rule 178 + LIT_INT reduce using rule 178 + LIT_NUMBER reduce using rule 178 + %eof reduce using rule 178 + + +State 76 + + exprAtom -> qualSymbol . (rule 180) + + error reduce using rule 180 + '(' reduce using rule 180 + ')' reduce using rule 180 + '{' reduce using rule 180 + '}' reduce using rule 180 + '[' reduce using rule 180 + ']' reduce using rule 180 + '\}' reduce using rule 180 + '\;' reduce using rule 180 + '<=' reduce using rule 180 + ':' reduce using rule 180 + '::' reduce using rule 180 + '|' reduce using rule 180 + '`' reduce using rule 180 + '.' reduce using rule 180 + ',' reduce using rule 180 + '_' reduce using rule 180 + '\\' reduce using rule 180 + '-' reduce using rule 180 + '@' reduce using rule 180 + 'ado' reduce using rule 180 + 'as' reduce using rule 180 + 'case' reduce using rule 180 + 'do' reduce using rule 180 + 'else' reduce using rule 180 + 'false' reduce using rule 180 + 'hiding' reduce using rule 180 + 'if' reduce using rule 180 + 'let' reduce using rule 180 + 'nominal' reduce using rule 180 + 'phantom' reduce using rule 180 + 'of' reduce using rule 180 + 'representational'reduce using rule 180 + 'role' reduce using rule 180 + 'then' reduce using rule 180 + 'true' reduce using rule 180 + 'where' reduce using rule 180 + '(..)' reduce using rule 180 + LOWER reduce using rule 180 + QUAL_LOWER reduce using rule 180 + UPPER reduce using rule 180 + QUAL_UPPER reduce using rule 180 + SYMBOL reduce using rule 180 + QUAL_SYMBOL reduce using rule 180 + OPERATOR reduce using rule 180 + QUAL_OPERATOR reduce using rule 180 + LIT_HOLE reduce using rule 180 + LIT_CHAR reduce using rule 180 + LIT_STRING reduce using rule 180 + LIT_RAW_STRING reduce using rule 180 + LIT_INT reduce using rule 180 + LIT_NUMBER reduce using rule 180 + %eof reduce using rule 180 + + +State 77 + + exprAtom -> hole . (rule 177) + + error reduce using rule 177 + '(' reduce using rule 177 + ')' reduce using rule 177 + '{' reduce using rule 177 + '}' reduce using rule 177 + '[' reduce using rule 177 + ']' reduce using rule 177 + '\}' reduce using rule 177 + '\;' reduce using rule 177 + '<=' reduce using rule 177 + ':' reduce using rule 177 + '::' reduce using rule 177 + '|' reduce using rule 177 + '`' reduce using rule 177 + '.' reduce using rule 177 + ',' reduce using rule 177 + '_' reduce using rule 177 + '\\' reduce using rule 177 + '-' reduce using rule 177 + '@' reduce using rule 177 + 'ado' reduce using rule 177 + 'as' reduce using rule 177 + 'case' reduce using rule 177 + 'do' reduce using rule 177 + 'else' reduce using rule 177 + 'false' reduce using rule 177 + 'hiding' reduce using rule 177 + 'if' reduce using rule 177 + 'let' reduce using rule 177 + 'nominal' reduce using rule 177 + 'phantom' reduce using rule 177 + 'of' reduce using rule 177 + 'representational'reduce using rule 177 + 'role' reduce using rule 177 + 'then' reduce using rule 177 + 'true' reduce using rule 177 + 'where' reduce using rule 177 + '(..)' reduce using rule 177 + LOWER reduce using rule 177 + QUAL_LOWER reduce using rule 177 + UPPER reduce using rule 177 + QUAL_UPPER reduce using rule 177 + SYMBOL reduce using rule 177 + QUAL_SYMBOL reduce using rule 177 + OPERATOR reduce using rule 177 + QUAL_OPERATOR reduce using rule 177 + LIT_HOLE reduce using rule 177 + LIT_CHAR reduce using rule 177 + LIT_STRING reduce using rule 177 + LIT_RAW_STRING reduce using rule 177 + LIT_INT reduce using rule 177 + LIT_NUMBER reduce using rule 177 + %eof reduce using rule 177 + + +State 78 + + exprAtom -> string . (rule 183) + + error reduce using rule 183 + '(' reduce using rule 183 + ')' reduce using rule 183 + '{' reduce using rule 183 + '}' reduce using rule 183 + '[' reduce using rule 183 + ']' reduce using rule 183 + '\}' reduce using rule 183 + '\;' reduce using rule 183 + '<=' reduce using rule 183 + ':' reduce using rule 183 + '::' reduce using rule 183 + '|' reduce using rule 183 + '`' reduce using rule 183 + '.' reduce using rule 183 + ',' reduce using rule 183 + '_' reduce using rule 183 + '\\' reduce using rule 183 + '-' reduce using rule 183 + '@' reduce using rule 183 + 'ado' reduce using rule 183 + 'as' reduce using rule 183 + 'case' reduce using rule 183 + 'do' reduce using rule 183 + 'else' reduce using rule 183 + 'false' reduce using rule 183 + 'hiding' reduce using rule 183 + 'if' reduce using rule 183 + 'let' reduce using rule 183 + 'nominal' reduce using rule 183 + 'phantom' reduce using rule 183 + 'of' reduce using rule 183 + 'representational'reduce using rule 183 + 'role' reduce using rule 183 + 'then' reduce using rule 183 + 'true' reduce using rule 183 + 'where' reduce using rule 183 + '(..)' reduce using rule 183 + LOWER reduce using rule 183 + QUAL_LOWER reduce using rule 183 + UPPER reduce using rule 183 + QUAL_UPPER reduce using rule 183 + SYMBOL reduce using rule 183 + QUAL_SYMBOL reduce using rule 183 + OPERATOR reduce using rule 183 + QUAL_OPERATOR reduce using rule 183 + LIT_HOLE reduce using rule 183 + LIT_CHAR reduce using rule 183 + LIT_STRING reduce using rule 183 + LIT_RAW_STRING reduce using rule 183 + LIT_INT reduce using rule 183 + LIT_NUMBER reduce using rule 183 + %eof reduce using rule 183 + + +State 79 + + exprAtom -> char . (rule 182) + + error reduce using rule 182 + '(' reduce using rule 182 + ')' reduce using rule 182 + '{' reduce using rule 182 + '}' reduce using rule 182 + '[' reduce using rule 182 + ']' reduce using rule 182 + '\}' reduce using rule 182 + '\;' reduce using rule 182 + '<=' reduce using rule 182 + ':' reduce using rule 182 + '::' reduce using rule 182 + '|' reduce using rule 182 + '`' reduce using rule 182 + '.' reduce using rule 182 + ',' reduce using rule 182 + '_' reduce using rule 182 + '\\' reduce using rule 182 + '-' reduce using rule 182 + '@' reduce using rule 182 + 'ado' reduce using rule 182 + 'as' reduce using rule 182 + 'case' reduce using rule 182 + 'do' reduce using rule 182 + 'else' reduce using rule 182 + 'false' reduce using rule 182 + 'hiding' reduce using rule 182 + 'if' reduce using rule 182 + 'let' reduce using rule 182 + 'nominal' reduce using rule 182 + 'phantom' reduce using rule 182 + 'of' reduce using rule 182 + 'representational'reduce using rule 182 + 'role' reduce using rule 182 + 'then' reduce using rule 182 + 'true' reduce using rule 182 + 'where' reduce using rule 182 + '(..)' reduce using rule 182 + LOWER reduce using rule 182 + QUAL_LOWER reduce using rule 182 + UPPER reduce using rule 182 + QUAL_UPPER reduce using rule 182 + SYMBOL reduce using rule 182 + QUAL_SYMBOL reduce using rule 182 + OPERATOR reduce using rule 182 + QUAL_OPERATOR reduce using rule 182 + LIT_HOLE reduce using rule 182 + LIT_CHAR reduce using rule 182 + LIT_STRING reduce using rule 182 + LIT_RAW_STRING reduce using rule 182 + LIT_INT reduce using rule 182 + LIT_NUMBER reduce using rule 182 + %eof reduce using rule 182 + + +State 80 + + exprAtom -> number . (rule 184) + + error reduce using rule 184 + '(' reduce using rule 184 + ')' reduce using rule 184 + '{' reduce using rule 184 + '}' reduce using rule 184 + '[' reduce using rule 184 + ']' reduce using rule 184 + '\}' reduce using rule 184 + '\;' reduce using rule 184 + '<=' reduce using rule 184 + ':' reduce using rule 184 + '::' reduce using rule 184 + '|' reduce using rule 184 + '`' reduce using rule 184 + '.' reduce using rule 184 + ',' reduce using rule 184 + '_' reduce using rule 184 + '\\' reduce using rule 184 + '-' reduce using rule 184 + '@' reduce using rule 184 + 'ado' reduce using rule 184 + 'as' reduce using rule 184 + 'case' reduce using rule 184 + 'do' reduce using rule 184 + 'else' reduce using rule 184 + 'false' reduce using rule 184 + 'hiding' reduce using rule 184 + 'if' reduce using rule 184 + 'let' reduce using rule 184 + 'nominal' reduce using rule 184 + 'phantom' reduce using rule 184 + 'of' reduce using rule 184 + 'representational'reduce using rule 184 + 'role' reduce using rule 184 + 'then' reduce using rule 184 + 'true' reduce using rule 184 + 'where' reduce using rule 184 + '(..)' reduce using rule 184 + LOWER reduce using rule 184 + QUAL_LOWER reduce using rule 184 + UPPER reduce using rule 184 + QUAL_UPPER reduce using rule 184 + SYMBOL reduce using rule 184 + QUAL_SYMBOL reduce using rule 184 + OPERATOR reduce using rule 184 + QUAL_OPERATOR reduce using rule 184 + LIT_HOLE reduce using rule 184 + LIT_CHAR reduce using rule 184 + LIT_STRING reduce using rule 184 + LIT_RAW_STRING reduce using rule 184 + LIT_INT reduce using rule 184 + LIT_NUMBER reduce using rule 184 + %eof reduce using rule 184 + + +State 81 + + exprAtom -> boolean . (rule 181) + + error reduce using rule 181 + '(' reduce using rule 181 + ')' reduce using rule 181 + '{' reduce using rule 181 + '}' reduce using rule 181 + '[' reduce using rule 181 + ']' reduce using rule 181 + '\}' reduce using rule 181 + '\;' reduce using rule 181 + '<=' reduce using rule 181 + ':' reduce using rule 181 + '::' reduce using rule 181 + '|' reduce using rule 181 + '`' reduce using rule 181 + '.' reduce using rule 181 + ',' reduce using rule 181 + '_' reduce using rule 181 + '\\' reduce using rule 181 + '-' reduce using rule 181 + '@' reduce using rule 181 + 'ado' reduce using rule 181 + 'as' reduce using rule 181 + 'case' reduce using rule 181 + 'do' reduce using rule 181 + 'else' reduce using rule 181 + 'false' reduce using rule 181 + 'hiding' reduce using rule 181 + 'if' reduce using rule 181 + 'let' reduce using rule 181 + 'nominal' reduce using rule 181 + 'phantom' reduce using rule 181 + 'of' reduce using rule 181 + 'representational'reduce using rule 181 + 'role' reduce using rule 181 + 'then' reduce using rule 181 + 'true' reduce using rule 181 + 'where' reduce using rule 181 + '(..)' reduce using rule 181 + LOWER reduce using rule 181 + QUAL_LOWER reduce using rule 181 + UPPER reduce using rule 181 + QUAL_UPPER reduce using rule 181 + SYMBOL reduce using rule 181 + QUAL_SYMBOL reduce using rule 181 + OPERATOR reduce using rule 181 + QUAL_OPERATOR reduce using rule 181 + LIT_HOLE reduce using rule 181 + LIT_CHAR reduce using rule 181 + LIT_STRING reduce using rule 181 + LIT_RAW_STRING reduce using rule 181 + LIT_INT reduce using rule 181 + LIT_NUMBER reduce using rule 181 + %eof reduce using rule 181 + + +State 82 + + expr1 -> expr1 . qualOp expr2 (rule 152) + guardExpr -> expr1 . (rule 218) + + error reduce using rule 218 + '<=' shift, and enter state 293 + ':' shift, and enter state 295 + '-' shift, and enter state 296 + OPERATOR shift, and enter state 297 + QUAL_OPERATOR shift, and enter state 298 + + qualOp goto state 302 + +State 83 + + expr1 -> expr2 . (rule 151) + expr2 -> expr2 . '`' exprBacktick '`' expr3 (rule 154) + + error reduce using rule 151 + '(' reduce using rule 151 + ')' reduce using rule 151 + '{' reduce using rule 151 + '}' reduce using rule 151 + '[' reduce using rule 151 + ']' reduce using rule 151 + '\}' reduce using rule 151 + '\;' reduce using rule 151 + '<=' reduce using rule 151 + ':' reduce using rule 151 + '::' reduce using rule 151 + '|' reduce using rule 151 + '`' shift, and enter state 326 + ',' reduce using rule 151 + '_' reduce using rule 151 + '\\' reduce using rule 151 + '-' reduce using rule 151 + '@' reduce using rule 151 + 'ado' reduce using rule 151 + 'as' reduce using rule 151 + 'case' reduce using rule 151 + 'do' reduce using rule 151 + 'else' reduce using rule 151 + 'false' reduce using rule 151 + 'hiding' reduce using rule 151 + 'if' reduce using rule 151 + 'let' reduce using rule 151 + 'nominal' reduce using rule 151 + 'phantom' reduce using rule 151 + 'of' reduce using rule 151 + 'representational'reduce using rule 151 + 'role' reduce using rule 151 + 'then' reduce using rule 151 + 'true' reduce using rule 151 + 'where' reduce using rule 151 + '(..)' reduce using rule 151 + LOWER reduce using rule 151 + QUAL_LOWER reduce using rule 151 + UPPER reduce using rule 151 + QUAL_UPPER reduce using rule 151 + SYMBOL reduce using rule 151 + QUAL_SYMBOL reduce using rule 151 + OPERATOR reduce using rule 151 + QUAL_OPERATOR reduce using rule 151 + LIT_HOLE reduce using rule 151 + LIT_CHAR reduce using rule 151 + LIT_STRING reduce using rule 151 + LIT_RAW_STRING reduce using rule 151 + LIT_INT reduce using rule 151 + LIT_NUMBER reduce using rule 151 + %eof reduce using rule 151 + + +State 84 + + expr2 -> expr3 . (rule 153) + + error reduce using rule 153 + '(' reduce using rule 153 + ')' reduce using rule 153 + '{' reduce using rule 153 + '}' reduce using rule 153 + '[' reduce using rule 153 + ']' reduce using rule 153 + '\}' reduce using rule 153 + '\;' reduce using rule 153 + '<=' reduce using rule 153 + ':' reduce using rule 153 + '::' reduce using rule 153 + '|' reduce using rule 153 + '`' reduce using rule 153 + ',' reduce using rule 153 + '_' reduce using rule 153 + '\\' reduce using rule 153 + '-' reduce using rule 153 + '@' reduce using rule 153 + 'ado' reduce using rule 153 + 'as' reduce using rule 153 + 'case' reduce using rule 153 + 'do' reduce using rule 153 + 'else' reduce using rule 153 + 'false' reduce using rule 153 + 'hiding' reduce using rule 153 + 'if' reduce using rule 153 + 'let' reduce using rule 153 + 'nominal' reduce using rule 153 + 'phantom' reduce using rule 153 + 'of' reduce using rule 153 + 'representational'reduce using rule 153 + 'role' reduce using rule 153 + 'then' reduce using rule 153 + 'true' reduce using rule 153 + 'where' reduce using rule 153 + '(..)' reduce using rule 153 + LOWER reduce using rule 153 + QUAL_LOWER reduce using rule 153 + UPPER reduce using rule 153 + QUAL_UPPER reduce using rule 153 + SYMBOL reduce using rule 153 + QUAL_SYMBOL reduce using rule 153 + OPERATOR reduce using rule 153 + QUAL_OPERATOR reduce using rule 153 + LIT_HOLE reduce using rule 153 + LIT_CHAR reduce using rule 153 + LIT_STRING reduce using rule 153 + LIT_RAW_STRING reduce using rule 153 + LIT_INT reduce using rule 153 + LIT_NUMBER reduce using rule 153 + %eof reduce using rule 153 + + +State 85 + + expr3 -> expr4 . (rule 157) + expr4 -> expr4 . expr5 (rule 160) + expr4 -> expr4 . '@' typeAtom (rule 161) + + error reduce using rule 157 + '(' shift, and enter state 95 + ')' reduce using rule 157 + '{' shift, and enter state 96 + '}' reduce using rule 157 + '[' shift, and enter state 97 + ']' reduce using rule 157 + '\}' reduce using rule 157 + '\;' reduce using rule 157 + '<=' reduce using rule 157 + ':' reduce using rule 157 + '::' reduce using rule 157 + '|' reduce using rule 157 + '`' reduce using rule 157 + ',' reduce using rule 157 + '_' shift, and enter state 98 + '\\' shift, and enter state 99 + '-' reduce using rule 157 + '@' shift, and enter state 325 + 'ado' shift, and enter state 101 + 'as' shift, and enter state 102 + 'case' shift, and enter state 103 + 'do' shift, and enter state 104 + 'else' reduce using rule 157 + 'false' shift, and enter state 46 + 'hiding' shift, and enter state 105 + 'if' shift, and enter state 106 + 'let' shift, and enter state 107 + 'nominal' shift, and enter state 108 + 'phantom' shift, and enter state 109 + 'of' reduce using rule 157 + 'representational'shift, and enter state 110 + 'role' shift, and enter state 111 + 'then' reduce using rule 157 + 'true' shift, and enter state 52 + 'where' reduce using rule 157 + '(..)' shift, and enter state 112 + LOWER shift, and enter state 113 + QUAL_LOWER shift, and enter state 114 + UPPER shift, and enter state 54 + QUAL_UPPER shift, and enter state 55 + SYMBOL shift, and enter state 115 + QUAL_SYMBOL shift, and enter state 116 + OPERATOR reduce using rule 157 + QUAL_OPERATOR reduce using rule 157 + LIT_HOLE shift, and enter state 117 + LIT_CHAR shift, and enter state 56 + LIT_STRING shift, and enter state 57 + LIT_RAW_STRING shift, and enter state 58 + LIT_INT shift, and enter state 59 + LIT_NUMBER shift, and enter state 60 + %eof reduce using rule 157 + + qualProperName goto state 74 + qualIdent goto state 75 + qualSymbol goto state 76 + hole goto state 77 + string goto state 78 + char goto state 79 + number goto state 80 + boolean goto state 81 + expr5 goto state 324 + expr6 goto state 87 + expr7 goto state 88 + exprAtom goto state 89 + doBlock goto state 90 + adoBlock goto state 91 + delim__'['__expr__','__']'__goto state 93 + delim__'{'__recordLabel__','__'}'__goto state 94 + +State 86 + + expr4 -> expr5 . (rule 159) + + error reduce using rule 159 + '(' reduce using rule 159 + ')' reduce using rule 159 + '{' reduce using rule 159 + '}' reduce using rule 159 + '[' reduce using rule 159 + ']' reduce using rule 159 + '\}' reduce using rule 159 + '\;' reduce using rule 159 + '<=' reduce using rule 159 + ':' reduce using rule 159 + '::' reduce using rule 159 + '|' reduce using rule 159 + '`' reduce using rule 159 + ',' reduce using rule 159 + '_' reduce using rule 159 + '\\' reduce using rule 159 + '-' reduce using rule 159 + '@' reduce using rule 159 + 'ado' reduce using rule 159 + 'as' reduce using rule 159 + 'case' reduce using rule 159 + 'do' reduce using rule 159 + 'else' reduce using rule 159 + 'false' reduce using rule 159 + 'hiding' reduce using rule 159 + 'if' reduce using rule 159 + 'let' reduce using rule 159 + 'nominal' reduce using rule 159 + 'phantom' reduce using rule 159 + 'of' reduce using rule 159 + 'representational'reduce using rule 159 + 'role' reduce using rule 159 + 'then' reduce using rule 159 + 'true' reduce using rule 159 + 'where' reduce using rule 159 + '(..)' reduce using rule 159 + LOWER reduce using rule 159 + QUAL_LOWER reduce using rule 159 + UPPER reduce using rule 159 + QUAL_UPPER reduce using rule 159 + SYMBOL reduce using rule 159 + QUAL_SYMBOL reduce using rule 159 + OPERATOR reduce using rule 159 + QUAL_OPERATOR reduce using rule 159 + LIT_HOLE reduce using rule 159 + LIT_CHAR reduce using rule 159 + LIT_STRING reduce using rule 159 + LIT_RAW_STRING reduce using rule 159 + LIT_INT reduce using rule 159 + LIT_NUMBER reduce using rule 159 + %eof reduce using rule 159 + + +State 87 + + expr5 -> expr6 . (rule 162) + + error reduce using rule 162 + '(' reduce using rule 162 + ')' reduce using rule 162 + '{' reduce using rule 162 + '}' reduce using rule 162 + '[' reduce using rule 162 + ']' reduce using rule 162 + '\}' reduce using rule 162 + '\;' reduce using rule 162 + '<=' reduce using rule 162 + ':' reduce using rule 162 + '::' reduce using rule 162 + '|' reduce using rule 162 + '`' reduce using rule 162 + ',' reduce using rule 162 + '_' reduce using rule 162 + '\\' reduce using rule 162 + '-' reduce using rule 162 + '@' reduce using rule 162 + 'ado' reduce using rule 162 + 'as' reduce using rule 162 + 'case' reduce using rule 162 + 'do' reduce using rule 162 + 'else' reduce using rule 162 + 'false' reduce using rule 162 + 'hiding' reduce using rule 162 + 'if' reduce using rule 162 + 'let' reduce using rule 162 + 'nominal' reduce using rule 162 + 'phantom' reduce using rule 162 + 'of' reduce using rule 162 + 'representational'reduce using rule 162 + 'role' reduce using rule 162 + 'then' reduce using rule 162 + 'true' reduce using rule 162 + 'where' reduce using rule 162 + '(..)' reduce using rule 162 + LOWER reduce using rule 162 + QUAL_LOWER reduce using rule 162 + UPPER reduce using rule 162 + QUAL_UPPER reduce using rule 162 + SYMBOL reduce using rule 162 + QUAL_SYMBOL reduce using rule 162 + OPERATOR reduce using rule 162 + QUAL_OPERATOR reduce using rule 162 + LIT_HOLE reduce using rule 162 + LIT_CHAR reduce using rule 162 + LIT_STRING reduce using rule 162 + LIT_RAW_STRING reduce using rule 162 + LIT_INT reduce using rule 162 + LIT_NUMBER reduce using rule 162 + %eof reduce using rule 162 + + +State 88 + + expr6 -> expr7 . (rule 171) + expr6 -> expr7 . '{' '}' (rule 172) + expr6 -> expr7 . '{' sep__recordUpdateOrLabel__','__ '}' (rule 173) + + error reduce using rule 171 + '(' reduce using rule 171 + ')' reduce using rule 171 + '{' shift, and enter state 323 + '}' reduce using rule 171 + '[' reduce using rule 171 + ']' reduce using rule 171 + '\}' reduce using rule 171 + '\;' reduce using rule 171 + '<=' reduce using rule 171 + ':' reduce using rule 171 + '::' reduce using rule 171 + '|' reduce using rule 171 + '`' reduce using rule 171 + ',' reduce using rule 171 + '_' reduce using rule 171 + '\\' reduce using rule 171 + '-' reduce using rule 171 + '@' reduce using rule 171 + 'ado' reduce using rule 171 + 'as' reduce using rule 171 + 'case' reduce using rule 171 + 'do' reduce using rule 171 + 'else' reduce using rule 171 + 'false' reduce using rule 171 + 'hiding' reduce using rule 171 + 'if' reduce using rule 171 + 'let' reduce using rule 171 + 'nominal' reduce using rule 171 + 'phantom' reduce using rule 171 + 'of' reduce using rule 171 + 'representational'reduce using rule 171 + 'role' reduce using rule 171 + 'then' reduce using rule 171 + 'true' reduce using rule 171 + 'where' reduce using rule 171 + '(..)' reduce using rule 171 + LOWER reduce using rule 171 + QUAL_LOWER reduce using rule 171 + UPPER reduce using rule 171 + QUAL_UPPER reduce using rule 171 + SYMBOL reduce using rule 171 + QUAL_SYMBOL reduce using rule 171 + OPERATOR reduce using rule 171 + QUAL_OPERATOR reduce using rule 171 + LIT_HOLE reduce using rule 171 + LIT_CHAR reduce using rule 171 + LIT_STRING reduce using rule 171 + LIT_RAW_STRING reduce using rule 171 + LIT_INT reduce using rule 171 + LIT_NUMBER reduce using rule 171 + %eof reduce using rule 171 + + +State 89 + + expr7 -> exprAtom . (rule 174) + expr7 -> exprAtom . '.' sep__label__'.'__ (rule 175) + + error reduce using rule 174 + '(' reduce using rule 174 + ')' reduce using rule 174 + '{' reduce using rule 174 + '}' reduce using rule 174 + '[' reduce using rule 174 + ']' reduce using rule 174 + '\}' reduce using rule 174 + '\;' reduce using rule 174 + '<=' reduce using rule 174 + ':' reduce using rule 174 + '::' reduce using rule 174 + '|' reduce using rule 174 + '`' reduce using rule 174 + '.' shift, and enter state 322 + ',' reduce using rule 174 + '_' reduce using rule 174 + '\\' reduce using rule 174 + '-' reduce using rule 174 + '@' reduce using rule 174 + 'ado' reduce using rule 174 + 'as' reduce using rule 174 + 'case' reduce using rule 174 + 'do' reduce using rule 174 + 'else' reduce using rule 174 + 'false' reduce using rule 174 + 'hiding' reduce using rule 174 + 'if' reduce using rule 174 + 'let' reduce using rule 174 + 'nominal' reduce using rule 174 + 'phantom' reduce using rule 174 + 'of' reduce using rule 174 + 'representational'reduce using rule 174 + 'role' reduce using rule 174 + 'then' reduce using rule 174 + 'true' reduce using rule 174 + 'where' reduce using rule 174 + '(..)' reduce using rule 174 + LOWER reduce using rule 174 + QUAL_LOWER reduce using rule 174 + UPPER reduce using rule 174 + QUAL_UPPER reduce using rule 174 + SYMBOL reduce using rule 174 + QUAL_SYMBOL reduce using rule 174 + OPERATOR reduce using rule 174 + QUAL_OPERATOR reduce using rule 174 + LIT_HOLE reduce using rule 174 + LIT_CHAR reduce using rule 174 + LIT_STRING reduce using rule 174 + LIT_RAW_STRING reduce using rule 174 + LIT_INT reduce using rule 174 + LIT_NUMBER reduce using rule 174 + %eof reduce using rule 174 + + +State 90 + + expr5 -> doBlock . (rule 164) + + error reduce using rule 164 + '(' reduce using rule 164 + ')' reduce using rule 164 + '{' reduce using rule 164 + '}' reduce using rule 164 + '[' reduce using rule 164 + ']' reduce using rule 164 + '\}' reduce using rule 164 + '\;' reduce using rule 164 + '<=' reduce using rule 164 + ':' reduce using rule 164 + '::' reduce using rule 164 + '|' reduce using rule 164 + '`' reduce using rule 164 + ',' reduce using rule 164 + '_' reduce using rule 164 + '\\' reduce using rule 164 + '-' reduce using rule 164 + '@' reduce using rule 164 + 'ado' reduce using rule 164 + 'as' reduce using rule 164 + 'case' reduce using rule 164 + 'do' reduce using rule 164 + 'else' reduce using rule 164 + 'false' reduce using rule 164 + 'hiding' reduce using rule 164 + 'if' reduce using rule 164 + 'let' reduce using rule 164 + 'nominal' reduce using rule 164 + 'phantom' reduce using rule 164 + 'of' reduce using rule 164 + 'representational'reduce using rule 164 + 'role' reduce using rule 164 + 'then' reduce using rule 164 + 'true' reduce using rule 164 + 'where' reduce using rule 164 + '(..)' reduce using rule 164 + LOWER reduce using rule 164 + QUAL_LOWER reduce using rule 164 + UPPER reduce using rule 164 + QUAL_UPPER reduce using rule 164 + SYMBOL reduce using rule 164 + QUAL_SYMBOL reduce using rule 164 + OPERATOR reduce using rule 164 + QUAL_OPERATOR reduce using rule 164 + LIT_HOLE reduce using rule 164 + LIT_CHAR reduce using rule 164 + LIT_STRING reduce using rule 164 + LIT_RAW_STRING reduce using rule 164 + LIT_INT reduce using rule 164 + LIT_NUMBER reduce using rule 164 + %eof reduce using rule 164 + + +State 91 + + expr5 -> adoBlock . 'in' expr (rule 165) + + 'in' shift, and enter state 321 + + +State 92 + + %start_parseGuardExpr -> guardExpr . (rule 16) + + error accept + + +State 93 + + exprAtom -> delim__'['__expr__','__']'__ . (rule 185) + + error reduce using rule 185 + '(' reduce using rule 185 + ')' reduce using rule 185 + '{' reduce using rule 185 + '}' reduce using rule 185 + '[' reduce using rule 185 + ']' reduce using rule 185 + '\}' reduce using rule 185 + '\;' reduce using rule 185 + '<=' reduce using rule 185 + ':' reduce using rule 185 + '::' reduce using rule 185 + '|' reduce using rule 185 + '`' reduce using rule 185 + '.' reduce using rule 185 + ',' reduce using rule 185 + '_' reduce using rule 185 + '\\' reduce using rule 185 + '-' reduce using rule 185 + '@' reduce using rule 185 + 'ado' reduce using rule 185 + 'as' reduce using rule 185 + 'case' reduce using rule 185 + 'do' reduce using rule 185 + 'else' reduce using rule 185 + 'false' reduce using rule 185 + 'hiding' reduce using rule 185 + 'if' reduce using rule 185 + 'let' reduce using rule 185 + 'nominal' reduce using rule 185 + 'phantom' reduce using rule 185 + 'of' reduce using rule 185 + 'representational'reduce using rule 185 + 'role' reduce using rule 185 + 'then' reduce using rule 185 + 'true' reduce using rule 185 + 'where' reduce using rule 185 + '(..)' reduce using rule 185 + LOWER reduce using rule 185 + QUAL_LOWER reduce using rule 185 + UPPER reduce using rule 185 + QUAL_UPPER reduce using rule 185 + SYMBOL reduce using rule 185 + QUAL_SYMBOL reduce using rule 185 + OPERATOR reduce using rule 185 + QUAL_OPERATOR reduce using rule 185 + LIT_HOLE reduce using rule 185 + LIT_CHAR reduce using rule 185 + LIT_STRING reduce using rule 185 + LIT_RAW_STRING reduce using rule 185 + LIT_INT reduce using rule 185 + LIT_NUMBER reduce using rule 185 + %eof reduce using rule 185 + + +State 94 + + exprAtom -> delim__'{'__recordLabel__','__'}'__ . (rule 186) + + error reduce using rule 186 + '(' reduce using rule 186 + ')' reduce using rule 186 + '{' reduce using rule 186 + '}' reduce using rule 186 + '[' reduce using rule 186 + ']' reduce using rule 186 + '\}' reduce using rule 186 + '\;' reduce using rule 186 + '<=' reduce using rule 186 + ':' reduce using rule 186 + '::' reduce using rule 186 + '|' reduce using rule 186 + '`' reduce using rule 186 + '.' reduce using rule 186 + ',' reduce using rule 186 + '_' reduce using rule 186 + '\\' reduce using rule 186 + '-' reduce using rule 186 + '@' reduce using rule 186 + 'ado' reduce using rule 186 + 'as' reduce using rule 186 + 'case' reduce using rule 186 + 'do' reduce using rule 186 + 'else' reduce using rule 186 + 'false' reduce using rule 186 + 'hiding' reduce using rule 186 + 'if' reduce using rule 186 + 'let' reduce using rule 186 + 'nominal' reduce using rule 186 + 'phantom' reduce using rule 186 + 'of' reduce using rule 186 + 'representational'reduce using rule 186 + 'role' reduce using rule 186 + 'then' reduce using rule 186 + 'true' reduce using rule 186 + 'where' reduce using rule 186 + '(..)' reduce using rule 186 + LOWER reduce using rule 186 + QUAL_LOWER reduce using rule 186 + UPPER reduce using rule 186 + QUAL_UPPER reduce using rule 186 + SYMBOL reduce using rule 186 + QUAL_SYMBOL reduce using rule 186 + OPERATOR reduce using rule 186 + QUAL_OPERATOR reduce using rule 186 + LIT_HOLE reduce using rule 186 + LIT_CHAR reduce using rule 186 + LIT_STRING reduce using rule 186 + LIT_RAW_STRING reduce using rule 186 + LIT_INT reduce using rule 186 + LIT_NUMBER reduce using rule 186 + %eof reduce using rule 186 + + +State 95 + + exprAtom -> '(' . expr ')' (rule 187) + + '(' shift, and enter state 95 + '{' shift, and enter state 96 + '[' shift, and enter state 97 + '_' shift, and enter state 98 + '\\' shift, and enter state 99 + '-' shift, and enter state 100 + 'ado' shift, and enter state 101 + 'as' shift, and enter state 102 + 'case' shift, and enter state 103 + 'do' shift, and enter state 104 + 'false' shift, and enter state 46 + 'hiding' shift, and enter state 105 + 'if' shift, and enter state 106 + 'let' shift, and enter state 107 + 'nominal' shift, and enter state 108 + 'phantom' shift, and enter state 109 + 'representational'shift, and enter state 110 + 'role' shift, and enter state 111 + 'true' shift, and enter state 52 + '(..)' shift, and enter state 112 + LOWER shift, and enter state 113 + QUAL_LOWER shift, and enter state 114 + UPPER shift, and enter state 54 + QUAL_UPPER shift, and enter state 55 + SYMBOL shift, and enter state 115 + QUAL_SYMBOL shift, and enter state 116 + LIT_HOLE shift, and enter state 117 + LIT_CHAR shift, and enter state 56 + LIT_STRING shift, and enter state 57 + LIT_RAW_STRING shift, and enter state 58 + LIT_INT shift, and enter state 59 + LIT_NUMBER shift, and enter state 60 + + qualProperName goto state 74 + qualIdent goto state 75 + qualSymbol goto state 76 + hole goto state 77 + string goto state 78 + char goto state 79 + number goto state 80 + boolean goto state 81 + expr goto state 320 + expr1 goto state 122 + expr2 goto state 83 + expr3 goto state 84 + expr4 goto state 85 + expr5 goto state 86 + expr6 goto state 87 + expr7 goto state 88 + exprAtom goto state 89 + doBlock goto state 90 + adoBlock goto state 91 + delim__'['__expr__','__']'__goto state 93 + delim__'{'__recordLabel__','__'}'__goto state 94 + +State 96 + + delim__'{'__recordLabel__','__'}'__ -> '{' . '}' (rule 340) + delim__'{'__recordLabel__','__'}'__ -> '{' . sep__recordLabel__','__ '}' (rule 341) + + '}' shift, and enter state 319 + 'ado' shift, and enter state 230 + 'as' shift, and enter state 231 + 'case' shift, and enter state 232 + 'class' shift, and enter state 233 + 'data' shift, and enter state 234 + 'derive' shift, and enter state 235 + 'do' shift, and enter state 236 + 'else' shift, and enter state 237 + 'false' shift, and enter state 238 + 'forall' shift, and enter state 239 + 'foreign' shift, and enter state 240 + 'hiding' shift, and enter state 241 + 'import' shift, and enter state 242 + 'if' shift, and enter state 243 + 'in' shift, and enter state 244 + 'infix' shift, and enter state 245 + 'infixl' shift, and enter state 246 + 'infixr' shift, and enter state 247 + 'instance' shift, and enter state 248 + 'let' shift, and enter state 249 + 'module' shift, and enter state 250 + 'newtype' shift, and enter state 251 + 'nominal' shift, and enter state 252 + 'phantom' shift, and enter state 253 + 'of' shift, and enter state 254 + 'representational'shift, and enter state 255 + 'role' shift, and enter state 256 + 'then' shift, and enter state 257 + 'true' shift, and enter state 258 + 'type' shift, and enter state 259 + 'where' shift, and enter state 260 + LOWER shift, and enter state 261 + LIT_STRING shift, and enter state 262 + LIT_RAW_STRING shift, and enter state 263 + + label goto state 315 + recordLabel goto state 316 + sep__recordLabel__','__goto state 317 + sep1__recordLabel__','__goto state 318 + +State 97 + + delim__'['__expr__','__']'__ -> '[' . ']' (rule 336) + delim__'['__expr__','__']'__ -> '[' . sep__expr__','__ ']' (rule 337) + + '(' shift, and enter state 95 + '{' shift, and enter state 96 + '[' shift, and enter state 97 + ']' shift, and enter state 314 + '_' shift, and enter state 98 + '\\' shift, and enter state 99 + '-' shift, and enter state 100 + 'ado' shift, and enter state 101 + 'as' shift, and enter state 102 + 'case' shift, and enter state 103 + 'do' shift, and enter state 104 + 'false' shift, and enter state 46 + 'hiding' shift, and enter state 105 + 'if' shift, and enter state 106 + 'let' shift, and enter state 107 + 'nominal' shift, and enter state 108 + 'phantom' shift, and enter state 109 + 'representational'shift, and enter state 110 + 'role' shift, and enter state 111 + 'true' shift, and enter state 52 + '(..)' shift, and enter state 112 + LOWER shift, and enter state 113 + QUAL_LOWER shift, and enter state 114 + UPPER shift, and enter state 54 + QUAL_UPPER shift, and enter state 55 + SYMBOL shift, and enter state 115 + QUAL_SYMBOL shift, and enter state 116 + LIT_HOLE shift, and enter state 117 + LIT_CHAR shift, and enter state 56 + LIT_STRING shift, and enter state 57 + LIT_RAW_STRING shift, and enter state 58 + LIT_INT shift, and enter state 59 + LIT_NUMBER shift, and enter state 60 + + qualProperName goto state 74 + qualIdent goto state 75 + qualSymbol goto state 76 + hole goto state 77 + string goto state 78 + char goto state 79 + number goto state 80 + boolean goto state 81 + expr goto state 307 + expr1 goto state 122 + expr2 goto state 83 + expr3 goto state 84 + expr4 goto state 85 + expr5 goto state 86 + expr6 goto state 87 + expr7 goto state 88 + exprAtom goto state 89 + doBlock goto state 90 + adoBlock goto state 91 + delim__'['__expr__','__']'__goto state 93 + delim__'{'__recordLabel__','__'}'__goto state 94 + sep__expr__','__goto state 313 + sep1__expr__','__goto state 309 + +State 98 + + exprAtom -> '_' . (rule 176) + + error reduce using rule 176 + '(' reduce using rule 176 + ')' reduce using rule 176 + '{' reduce using rule 176 + '}' reduce using rule 176 + '[' reduce using rule 176 + ']' reduce using rule 176 + '\}' reduce using rule 176 + '\;' reduce using rule 176 + '<=' reduce using rule 176 + ':' reduce using rule 176 + '::' reduce using rule 176 + '|' reduce using rule 176 + '`' reduce using rule 176 + '.' reduce using rule 176 + ',' reduce using rule 176 + '_' reduce using rule 176 + '\\' reduce using rule 176 + '-' reduce using rule 176 + '@' reduce using rule 176 + 'ado' reduce using rule 176 + 'as' reduce using rule 176 + 'case' reduce using rule 176 + 'do' reduce using rule 176 + 'else' reduce using rule 176 + 'false' reduce using rule 176 + 'hiding' reduce using rule 176 + 'if' reduce using rule 176 + 'let' reduce using rule 176 + 'nominal' reduce using rule 176 + 'phantom' reduce using rule 176 + 'of' reduce using rule 176 + 'representational'reduce using rule 176 + 'role' reduce using rule 176 + 'then' reduce using rule 176 + 'true' reduce using rule 176 + 'where' reduce using rule 176 + '(..)' reduce using rule 176 + LOWER reduce using rule 176 + QUAL_LOWER reduce using rule 176 + UPPER reduce using rule 176 + QUAL_UPPER reduce using rule 176 + SYMBOL reduce using rule 176 + QUAL_SYMBOL reduce using rule 176 + OPERATOR reduce using rule 176 + QUAL_OPERATOR reduce using rule 176 + LIT_HOLE reduce using rule 176 + LIT_CHAR reduce using rule 176 + LIT_STRING reduce using rule 176 + LIT_RAW_STRING reduce using rule 176 + LIT_INT reduce using rule 176 + LIT_NUMBER reduce using rule 176 + %eof reduce using rule 176 + + +State 99 + + expr5 -> '\\' . many__binderAtom__ '->' expr (rule 166) + + '(' shift, and enter state 40 + '{' shift, and enter state 41 + '[' shift, and enter state 42 + '_' shift, and enter state 43 + 'as' shift, and enter state 45 + 'false' shift, and enter state 46 + 'hiding' shift, and enter state 47 + 'nominal' shift, and enter state 48 + 'phantom' shift, and enter state 49 + 'representational'shift, and enter state 50 + 'role' shift, and enter state 51 + 'true' shift, and enter state 52 + LOWER shift, and enter state 53 + UPPER shift, and enter state 54 + QUAL_UPPER shift, and enter state 55 + LIT_CHAR shift, and enter state 56 + LIT_STRING shift, and enter state 57 + LIT_RAW_STRING shift, and enter state 58 + LIT_INT shift, and enter state 59 + LIT_NUMBER shift, and enter state 60 + + qualProperName goto state 25 + ident goto state 26 + string goto state 27 + char goto state 28 + number goto state 29 + boolean goto state 30 + binderAtom goto state 35 + delim__'['__binder__','__']'__goto state 36 + delim__'{'__recordBinder__','__'}'__goto state 37 + many__binderAtom__goto state 312 + many1__binderAtom__goto state 39 + +State 100 + + expr3 -> '-' . expr3 (rule 158) + + '(' shift, and enter state 95 + '{' shift, and enter state 96 + '[' shift, and enter state 97 + '_' shift, and enter state 98 + '\\' shift, and enter state 99 + '-' shift, and enter state 100 + 'ado' shift, and enter state 101 + 'as' shift, and enter state 102 + 'case' shift, and enter state 103 + 'do' shift, and enter state 104 + 'false' shift, and enter state 46 + 'hiding' shift, and enter state 105 + 'if' shift, and enter state 106 + 'let' shift, and enter state 107 + 'nominal' shift, and enter state 108 + 'phantom' shift, and enter state 109 + 'representational'shift, and enter state 110 + 'role' shift, and enter state 111 + 'true' shift, and enter state 52 + '(..)' shift, and enter state 112 + LOWER shift, and enter state 113 + QUAL_LOWER shift, and enter state 114 + UPPER shift, and enter state 54 + QUAL_UPPER shift, and enter state 55 + SYMBOL shift, and enter state 115 + QUAL_SYMBOL shift, and enter state 116 + LIT_HOLE shift, and enter state 117 + LIT_CHAR shift, and enter state 56 + LIT_STRING shift, and enter state 57 + LIT_RAW_STRING shift, and enter state 58 + LIT_INT shift, and enter state 59 + LIT_NUMBER shift, and enter state 60 + + qualProperName goto state 74 + qualIdent goto state 75 + qualSymbol goto state 76 + hole goto state 77 + string goto state 78 + char goto state 79 + number goto state 80 + boolean goto state 81 + expr3 goto state 311 + expr4 goto state 85 + expr5 goto state 86 + expr6 goto state 87 + expr7 goto state 88 + exprAtom goto state 89 + doBlock goto state 90 + adoBlock goto state 91 + delim__'['__expr__','__']'__goto state 93 + delim__'{'__recordLabel__','__'}'__goto state 94 + +State 101 + + adoBlock -> 'ado' . '\{' '\}' (rule 209) + adoBlock -> 'ado' . '\{' (rule 210) + + '\{' shift, and enter state 310 + + +State 102 + + qualIdent -> 'as' . (rule 30) + + error reduce using rule 30 + '(' reduce using rule 30 + ')' reduce using rule 30 + '{' reduce using rule 30 + '}' reduce using rule 30 + '[' reduce using rule 30 + ']' reduce using rule 30 + '\}' reduce using rule 30 + '\;' reduce using rule 30 + '<=' reduce using rule 30 + ':' reduce using rule 30 + '::' reduce using rule 30 + '|' reduce using rule 30 + '`' reduce using rule 30 + '.' reduce using rule 30 + ',' reduce using rule 30 + '_' reduce using rule 30 + '\\' reduce using rule 30 + '-' reduce using rule 30 + '@' reduce using rule 30 + 'ado' reduce using rule 30 + 'as' reduce using rule 30 + 'case' reduce using rule 30 + 'do' reduce using rule 30 + 'else' reduce using rule 30 + 'false' reduce using rule 30 + 'hiding' reduce using rule 30 + 'if' reduce using rule 30 + 'let' reduce using rule 30 + 'nominal' reduce using rule 30 + 'phantom' reduce using rule 30 + 'of' reduce using rule 30 + 'representational'reduce using rule 30 + 'role' reduce using rule 30 + 'then' reduce using rule 30 + 'true' reduce using rule 30 + 'where' reduce using rule 30 + '(..)' reduce using rule 30 + LOWER reduce using rule 30 + QUAL_LOWER reduce using rule 30 + UPPER reduce using rule 30 + QUAL_UPPER reduce using rule 30 + SYMBOL reduce using rule 30 + QUAL_SYMBOL reduce using rule 30 + OPERATOR reduce using rule 30 + QUAL_OPERATOR reduce using rule 30 + LIT_HOLE reduce using rule 30 + LIT_CHAR reduce using rule 30 + LIT_STRING reduce using rule 30 + LIT_RAW_STRING reduce using rule 30 + LIT_INT reduce using rule 30 + LIT_NUMBER reduce using rule 30 + %eof reduce using rule 30 + + +State 103 + + expr5 -> 'case' . sep__expr__','__ 'of' '\{' manySep__caseBranch__'\;'__ '\}' (rule 168) + expr5 -> 'case' . sep__expr__','__ 'of' '\{' sep__binder1__','__ '->' '\}' exprWhere (rule 169) + expr5 -> 'case' . sep__expr__','__ 'of' '\{' sep__binder1__','__ '\}' guardedCase (rule 170) + + '(' shift, and enter state 95 + '{' shift, and enter state 96 + '[' shift, and enter state 97 + '_' shift, and enter state 98 + '\\' shift, and enter state 99 + '-' shift, and enter state 100 + 'ado' shift, and enter state 101 + 'as' shift, and enter state 102 + 'case' shift, and enter state 103 + 'do' shift, and enter state 104 + 'false' shift, and enter state 46 + 'hiding' shift, and enter state 105 + 'if' shift, and enter state 106 + 'let' shift, and enter state 107 + 'nominal' shift, and enter state 108 + 'phantom' shift, and enter state 109 + 'representational'shift, and enter state 110 + 'role' shift, and enter state 111 + 'true' shift, and enter state 52 + '(..)' shift, and enter state 112 + LOWER shift, and enter state 113 + QUAL_LOWER shift, and enter state 114 + UPPER shift, and enter state 54 + QUAL_UPPER shift, and enter state 55 + SYMBOL shift, and enter state 115 + QUAL_SYMBOL shift, and enter state 116 + LIT_HOLE shift, and enter state 117 + LIT_CHAR shift, and enter state 56 + LIT_STRING shift, and enter state 57 + LIT_RAW_STRING shift, and enter state 58 + LIT_INT shift, and enter state 59 + LIT_NUMBER shift, and enter state 60 + + qualProperName goto state 74 + qualIdent goto state 75 + qualSymbol goto state 76 + hole goto state 77 + string goto state 78 + char goto state 79 + number goto state 80 + boolean goto state 81 + expr goto state 307 + expr1 goto state 122 + expr2 goto state 83 + expr3 goto state 84 + expr4 goto state 85 + expr5 goto state 86 + expr6 goto state 87 + expr7 goto state 88 + exprAtom goto state 89 + doBlock goto state 90 + adoBlock goto state 91 + delim__'['__expr__','__']'__goto state 93 + delim__'{'__recordLabel__','__'}'__goto state 94 + sep__expr__','__goto state 308 + sep1__expr__','__goto state 309 + +State 104 + + doBlock -> 'do' . '\{' (rule 208) + + '\{' shift, and enter state 306 + + +State 105 + + qualIdent -> 'hiding' . (rule 31) + + error reduce using rule 31 + '(' reduce using rule 31 + ')' reduce using rule 31 + '{' reduce using rule 31 + '}' reduce using rule 31 + '[' reduce using rule 31 + ']' reduce using rule 31 + '\}' reduce using rule 31 + '\;' reduce using rule 31 + '<=' reduce using rule 31 + ':' reduce using rule 31 + '::' reduce using rule 31 + '|' reduce using rule 31 + '`' reduce using rule 31 + '.' reduce using rule 31 + ',' reduce using rule 31 + '_' reduce using rule 31 + '\\' reduce using rule 31 + '-' reduce using rule 31 + '@' reduce using rule 31 + 'ado' reduce using rule 31 + 'as' reduce using rule 31 + 'case' reduce using rule 31 + 'do' reduce using rule 31 + 'else' reduce using rule 31 + 'false' reduce using rule 31 + 'hiding' reduce using rule 31 + 'if' reduce using rule 31 + 'let' reduce using rule 31 + 'nominal' reduce using rule 31 + 'phantom' reduce using rule 31 + 'of' reduce using rule 31 + 'representational'reduce using rule 31 + 'role' reduce using rule 31 + 'then' reduce using rule 31 + 'true' reduce using rule 31 + 'where' reduce using rule 31 + '(..)' reduce using rule 31 + LOWER reduce using rule 31 + QUAL_LOWER reduce using rule 31 + UPPER reduce using rule 31 + QUAL_UPPER reduce using rule 31 + SYMBOL reduce using rule 31 + QUAL_SYMBOL reduce using rule 31 + OPERATOR reduce using rule 31 + QUAL_OPERATOR reduce using rule 31 + LIT_HOLE reduce using rule 31 + LIT_CHAR reduce using rule 31 + LIT_STRING reduce using rule 31 + LIT_RAW_STRING reduce using rule 31 + LIT_INT reduce using rule 31 + LIT_NUMBER reduce using rule 31 + %eof reduce using rule 31 + + +State 106 + + expr5 -> 'if' . expr 'then' expr 'else' expr (rule 163) + + '(' shift, and enter state 95 + '{' shift, and enter state 96 + '[' shift, and enter state 97 + '_' shift, and enter state 98 + '\\' shift, and enter state 99 + '-' shift, and enter state 100 + 'ado' shift, and enter state 101 + 'as' shift, and enter state 102 + 'case' shift, and enter state 103 + 'do' shift, and enter state 104 + 'false' shift, and enter state 46 + 'hiding' shift, and enter state 105 + 'if' shift, and enter state 106 + 'let' shift, and enter state 107 + 'nominal' shift, and enter state 108 + 'phantom' shift, and enter state 109 + 'representational'shift, and enter state 110 + 'role' shift, and enter state 111 + 'true' shift, and enter state 52 + '(..)' shift, and enter state 112 + LOWER shift, and enter state 113 + QUAL_LOWER shift, and enter state 114 + UPPER shift, and enter state 54 + QUAL_UPPER shift, and enter state 55 + SYMBOL shift, and enter state 115 + QUAL_SYMBOL shift, and enter state 116 + LIT_HOLE shift, and enter state 117 + LIT_CHAR shift, and enter state 56 + LIT_STRING shift, and enter state 57 + LIT_RAW_STRING shift, and enter state 58 + LIT_INT shift, and enter state 59 + LIT_NUMBER shift, and enter state 60 + + qualProperName goto state 74 + qualIdent goto state 75 + qualSymbol goto state 76 + hole goto state 77 + string goto state 78 + char goto state 79 + number goto state 80 + boolean goto state 81 + expr goto state 305 + expr1 goto state 122 + expr2 goto state 83 + expr3 goto state 84 + expr4 goto state 85 + expr5 goto state 86 + expr6 goto state 87 + expr7 goto state 88 + exprAtom goto state 89 + doBlock goto state 90 + adoBlock goto state 91 + delim__'['__expr__','__']'__goto state 93 + delim__'{'__recordLabel__','__'}'__goto state 94 + +State 107 + + expr5 -> 'let' . '\{' manySep__letBinding__'\;'__ '\}' 'in' expr (rule 167) + + '\{' shift, and enter state 304 + + +State 108 + + qualIdent -> 'nominal' . (rule 33) + + error reduce using rule 33 + '(' reduce using rule 33 + ')' reduce using rule 33 + '{' reduce using rule 33 + '}' reduce using rule 33 + '[' reduce using rule 33 + ']' reduce using rule 33 + '\}' reduce using rule 33 + '\;' reduce using rule 33 + '<=' reduce using rule 33 + ':' reduce using rule 33 + '::' reduce using rule 33 + '|' reduce using rule 33 + '`' reduce using rule 33 + '.' reduce using rule 33 + ',' reduce using rule 33 + '_' reduce using rule 33 + '\\' reduce using rule 33 + '-' reduce using rule 33 + '@' reduce using rule 33 + 'ado' reduce using rule 33 + 'as' reduce using rule 33 + 'case' reduce using rule 33 + 'do' reduce using rule 33 + 'else' reduce using rule 33 + 'false' reduce using rule 33 + 'hiding' reduce using rule 33 + 'if' reduce using rule 33 + 'let' reduce using rule 33 + 'nominal' reduce using rule 33 + 'phantom' reduce using rule 33 + 'of' reduce using rule 33 + 'representational'reduce using rule 33 + 'role' reduce using rule 33 + 'then' reduce using rule 33 + 'true' reduce using rule 33 + 'where' reduce using rule 33 + '(..)' reduce using rule 33 + LOWER reduce using rule 33 + QUAL_LOWER reduce using rule 33 + UPPER reduce using rule 33 + QUAL_UPPER reduce using rule 33 + SYMBOL reduce using rule 33 + QUAL_SYMBOL reduce using rule 33 + OPERATOR reduce using rule 33 + QUAL_OPERATOR reduce using rule 33 + LIT_HOLE reduce using rule 33 + LIT_CHAR reduce using rule 33 + LIT_STRING reduce using rule 33 + LIT_RAW_STRING reduce using rule 33 + LIT_INT reduce using rule 33 + LIT_NUMBER reduce using rule 33 + %eof reduce using rule 33 + + +State 109 + + qualIdent -> 'phantom' . (rule 35) + + error reduce using rule 35 + '(' reduce using rule 35 + ')' reduce using rule 35 + '{' reduce using rule 35 + '}' reduce using rule 35 + '[' reduce using rule 35 + ']' reduce using rule 35 + '\}' reduce using rule 35 + '\;' reduce using rule 35 + '<=' reduce using rule 35 + ':' reduce using rule 35 + '::' reduce using rule 35 + '|' reduce using rule 35 + '`' reduce using rule 35 + '.' reduce using rule 35 + ',' reduce using rule 35 + '_' reduce using rule 35 + '\\' reduce using rule 35 + '-' reduce using rule 35 + '@' reduce using rule 35 + 'ado' reduce using rule 35 + 'as' reduce using rule 35 + 'case' reduce using rule 35 + 'do' reduce using rule 35 + 'else' reduce using rule 35 + 'false' reduce using rule 35 + 'hiding' reduce using rule 35 + 'if' reduce using rule 35 + 'let' reduce using rule 35 + 'nominal' reduce using rule 35 + 'phantom' reduce using rule 35 + 'of' reduce using rule 35 + 'representational'reduce using rule 35 + 'role' reduce using rule 35 + 'then' reduce using rule 35 + 'true' reduce using rule 35 + 'where' reduce using rule 35 + '(..)' reduce using rule 35 + LOWER reduce using rule 35 + QUAL_LOWER reduce using rule 35 + UPPER reduce using rule 35 + QUAL_UPPER reduce using rule 35 + SYMBOL reduce using rule 35 + QUAL_SYMBOL reduce using rule 35 + OPERATOR reduce using rule 35 + QUAL_OPERATOR reduce using rule 35 + LIT_HOLE reduce using rule 35 + LIT_CHAR reduce using rule 35 + LIT_STRING reduce using rule 35 + LIT_RAW_STRING reduce using rule 35 + LIT_INT reduce using rule 35 + LIT_NUMBER reduce using rule 35 + %eof reduce using rule 35 + + +State 110 + + qualIdent -> 'representational' . (rule 34) + + error reduce using rule 34 + '(' reduce using rule 34 + ')' reduce using rule 34 + '{' reduce using rule 34 + '}' reduce using rule 34 + '[' reduce using rule 34 + ']' reduce using rule 34 + '\}' reduce using rule 34 + '\;' reduce using rule 34 + '<=' reduce using rule 34 + ':' reduce using rule 34 + '::' reduce using rule 34 + '|' reduce using rule 34 + '`' reduce using rule 34 + '.' reduce using rule 34 + ',' reduce using rule 34 + '_' reduce using rule 34 + '\\' reduce using rule 34 + '-' reduce using rule 34 + '@' reduce using rule 34 + 'ado' reduce using rule 34 + 'as' reduce using rule 34 + 'case' reduce using rule 34 + 'do' reduce using rule 34 + 'else' reduce using rule 34 + 'false' reduce using rule 34 + 'hiding' reduce using rule 34 + 'if' reduce using rule 34 + 'let' reduce using rule 34 + 'nominal' reduce using rule 34 + 'phantom' reduce using rule 34 + 'of' reduce using rule 34 + 'representational'reduce using rule 34 + 'role' reduce using rule 34 + 'then' reduce using rule 34 + 'true' reduce using rule 34 + 'where' reduce using rule 34 + '(..)' reduce using rule 34 + LOWER reduce using rule 34 + QUAL_LOWER reduce using rule 34 + UPPER reduce using rule 34 + QUAL_UPPER reduce using rule 34 + SYMBOL reduce using rule 34 + QUAL_SYMBOL reduce using rule 34 + OPERATOR reduce using rule 34 + QUAL_OPERATOR reduce using rule 34 + LIT_HOLE reduce using rule 34 + LIT_CHAR reduce using rule 34 + LIT_STRING reduce using rule 34 + LIT_RAW_STRING reduce using rule 34 + LIT_INT reduce using rule 34 + LIT_NUMBER reduce using rule 34 + %eof reduce using rule 34 + + +State 111 + + qualIdent -> 'role' . (rule 32) + + error reduce using rule 32 + '(' reduce using rule 32 + ')' reduce using rule 32 + '{' reduce using rule 32 + '}' reduce using rule 32 + '[' reduce using rule 32 + ']' reduce using rule 32 + '\}' reduce using rule 32 + '\;' reduce using rule 32 + '<=' reduce using rule 32 + ':' reduce using rule 32 + '::' reduce using rule 32 + '|' reduce using rule 32 + '`' reduce using rule 32 + '.' reduce using rule 32 + ',' reduce using rule 32 + '_' reduce using rule 32 + '\\' reduce using rule 32 + '-' reduce using rule 32 + '@' reduce using rule 32 + 'ado' reduce using rule 32 + 'as' reduce using rule 32 + 'case' reduce using rule 32 + 'do' reduce using rule 32 + 'else' reduce using rule 32 + 'false' reduce using rule 32 + 'hiding' reduce using rule 32 + 'if' reduce using rule 32 + 'let' reduce using rule 32 + 'nominal' reduce using rule 32 + 'phantom' reduce using rule 32 + 'of' reduce using rule 32 + 'representational'reduce using rule 32 + 'role' reduce using rule 32 + 'then' reduce using rule 32 + 'true' reduce using rule 32 + 'where' reduce using rule 32 + '(..)' reduce using rule 32 + LOWER reduce using rule 32 + QUAL_LOWER reduce using rule 32 + UPPER reduce using rule 32 + QUAL_UPPER reduce using rule 32 + SYMBOL reduce using rule 32 + QUAL_SYMBOL reduce using rule 32 + OPERATOR reduce using rule 32 + QUAL_OPERATOR reduce using rule 32 + LIT_HOLE reduce using rule 32 + LIT_CHAR reduce using rule 32 + LIT_STRING reduce using rule 32 + LIT_RAW_STRING reduce using rule 32 + LIT_INT reduce using rule 32 + LIT_NUMBER reduce using rule 32 + %eof reduce using rule 32 + + +State 112 + + qualSymbol -> '(..)' . (rule 54) + + error reduce using rule 54 + '(' reduce using rule 54 + ')' reduce using rule 54 + '{' reduce using rule 54 + '}' reduce using rule 54 + '[' reduce using rule 54 + ']' reduce using rule 54 + '\}' reduce using rule 54 + '\;' reduce using rule 54 + '<-' reduce using rule 54 + '->' reduce using rule 54 + '<=' reduce using rule 54 + '=>' reduce using rule 54 + ':' reduce using rule 54 + '::' reduce using rule 54 + '|' reduce using rule 54 + '`' reduce using rule 54 + '.' reduce using rule 54 + ',' reduce using rule 54 + '_' reduce using rule 54 + '\\' reduce using rule 54 + '-' reduce using rule 54 + '@' reduce using rule 54 + 'ado' reduce using rule 54 + 'as' reduce using rule 54 + 'case' reduce using rule 54 + 'do' reduce using rule 54 + 'else' reduce using rule 54 + 'false' reduce using rule 54 + 'hiding' reduce using rule 54 + 'if' reduce using rule 54 + 'let' reduce using rule 54 + 'nominal' reduce using rule 54 + 'phantom' reduce using rule 54 + 'of' reduce using rule 54 + 'representational'reduce using rule 54 + 'role' reduce using rule 54 + 'then' reduce using rule 54 + 'true' reduce using rule 54 + 'where' reduce using rule 54 + '(->)' reduce using rule 54 + '(..)' reduce using rule 54 + LOWER reduce using rule 54 + QUAL_LOWER reduce using rule 54 + UPPER reduce using rule 54 + QUAL_UPPER reduce using rule 54 + SYMBOL reduce using rule 54 + QUAL_SYMBOL reduce using rule 54 + OPERATOR reduce using rule 54 + QUAL_OPERATOR reduce using rule 54 + LIT_HOLE reduce using rule 54 + LIT_CHAR reduce using rule 54 + LIT_STRING reduce using rule 54 + LIT_RAW_STRING reduce using rule 54 + LIT_INT reduce using rule 54 + LIT_NUMBER reduce using rule 54 + %eof reduce using rule 54 + + +State 113 + + qualIdent -> LOWER . (rule 28) + + error reduce using rule 28 + '(' reduce using rule 28 + ')' reduce using rule 28 + '{' reduce using rule 28 + '}' reduce using rule 28 + '[' reduce using rule 28 + ']' reduce using rule 28 + '\}' reduce using rule 28 + '\;' reduce using rule 28 + '<=' reduce using rule 28 + ':' reduce using rule 28 + '::' reduce using rule 28 + '|' reduce using rule 28 + '`' reduce using rule 28 + '.' reduce using rule 28 + ',' reduce using rule 28 + '_' reduce using rule 28 + '\\' reduce using rule 28 + '-' reduce using rule 28 + '@' reduce using rule 28 + 'ado' reduce using rule 28 + 'as' reduce using rule 28 + 'case' reduce using rule 28 + 'do' reduce using rule 28 + 'else' reduce using rule 28 + 'false' reduce using rule 28 + 'hiding' reduce using rule 28 + 'if' reduce using rule 28 + 'let' reduce using rule 28 + 'nominal' reduce using rule 28 + 'phantom' reduce using rule 28 + 'of' reduce using rule 28 + 'representational'reduce using rule 28 + 'role' reduce using rule 28 + 'then' reduce using rule 28 + 'true' reduce using rule 28 + 'where' reduce using rule 28 + '(..)' reduce using rule 28 + LOWER reduce using rule 28 + QUAL_LOWER reduce using rule 28 + UPPER reduce using rule 28 + QUAL_UPPER reduce using rule 28 + SYMBOL reduce using rule 28 + QUAL_SYMBOL reduce using rule 28 + OPERATOR reduce using rule 28 + QUAL_OPERATOR reduce using rule 28 + LIT_HOLE reduce using rule 28 + LIT_CHAR reduce using rule 28 + LIT_STRING reduce using rule 28 + LIT_RAW_STRING reduce using rule 28 + LIT_INT reduce using rule 28 + LIT_NUMBER reduce using rule 28 + %eof reduce using rule 28 + + +State 114 + + qualIdent -> QUAL_LOWER . (rule 29) + + error reduce using rule 29 + '(' reduce using rule 29 + ')' reduce using rule 29 + '{' reduce using rule 29 + '}' reduce using rule 29 + '[' reduce using rule 29 + ']' reduce using rule 29 + '\}' reduce using rule 29 + '\;' reduce using rule 29 + '<=' reduce using rule 29 + ':' reduce using rule 29 + '::' reduce using rule 29 + '|' reduce using rule 29 + '`' reduce using rule 29 + '.' reduce using rule 29 + ',' reduce using rule 29 + '_' reduce using rule 29 + '\\' reduce using rule 29 + '-' reduce using rule 29 + '@' reduce using rule 29 + 'ado' reduce using rule 29 + 'as' reduce using rule 29 + 'case' reduce using rule 29 + 'do' reduce using rule 29 + 'else' reduce using rule 29 + 'false' reduce using rule 29 + 'hiding' reduce using rule 29 + 'if' reduce using rule 29 + 'let' reduce using rule 29 + 'nominal' reduce using rule 29 + 'phantom' reduce using rule 29 + 'of' reduce using rule 29 + 'representational'reduce using rule 29 + 'role' reduce using rule 29 + 'then' reduce using rule 29 + 'true' reduce using rule 29 + 'where' reduce using rule 29 + '(..)' reduce using rule 29 + LOWER reduce using rule 29 + QUAL_LOWER reduce using rule 29 + UPPER reduce using rule 29 + QUAL_UPPER reduce using rule 29 + SYMBOL reduce using rule 29 + QUAL_SYMBOL reduce using rule 29 + OPERATOR reduce using rule 29 + QUAL_OPERATOR reduce using rule 29 + LIT_HOLE reduce using rule 29 + LIT_CHAR reduce using rule 29 + LIT_STRING reduce using rule 29 + LIT_RAW_STRING reduce using rule 29 + LIT_INT reduce using rule 29 + LIT_NUMBER reduce using rule 29 + %eof reduce using rule 29 + + +State 115 + + qualSymbol -> SYMBOL . (rule 52) + + error reduce using rule 52 + '(' reduce using rule 52 + ')' reduce using rule 52 + '{' reduce using rule 52 + '}' reduce using rule 52 + '[' reduce using rule 52 + ']' reduce using rule 52 + '\}' reduce using rule 52 + '\;' reduce using rule 52 + '<-' reduce using rule 52 + '->' reduce using rule 52 + '<=' reduce using rule 52 + '=>' reduce using rule 52 + ':' reduce using rule 52 + '::' reduce using rule 52 + '|' reduce using rule 52 + '`' reduce using rule 52 + '.' reduce using rule 52 + ',' reduce using rule 52 + '_' reduce using rule 52 + '\\' reduce using rule 52 + '-' reduce using rule 52 + '@' reduce using rule 52 + 'ado' reduce using rule 52 + 'as' reduce using rule 52 + 'case' reduce using rule 52 + 'do' reduce using rule 52 + 'else' reduce using rule 52 + 'false' reduce using rule 52 + 'hiding' reduce using rule 52 + 'if' reduce using rule 52 + 'let' reduce using rule 52 + 'nominal' reduce using rule 52 + 'phantom' reduce using rule 52 + 'of' reduce using rule 52 + 'representational'reduce using rule 52 + 'role' reduce using rule 52 + 'then' reduce using rule 52 + 'true' reduce using rule 52 + 'where' reduce using rule 52 + '(->)' reduce using rule 52 + '(..)' reduce using rule 52 + LOWER reduce using rule 52 + QUAL_LOWER reduce using rule 52 + UPPER reduce using rule 52 + QUAL_UPPER reduce using rule 52 + SYMBOL reduce using rule 52 + QUAL_SYMBOL reduce using rule 52 + OPERATOR reduce using rule 52 + QUAL_OPERATOR reduce using rule 52 + LIT_HOLE reduce using rule 52 + LIT_CHAR reduce using rule 52 + LIT_STRING reduce using rule 52 + LIT_RAW_STRING reduce using rule 52 + LIT_INT reduce using rule 52 + LIT_NUMBER reduce using rule 52 + %eof reduce using rule 52 + + +State 116 + + qualSymbol -> QUAL_SYMBOL . (rule 53) + + error reduce using rule 53 + '(' reduce using rule 53 + ')' reduce using rule 53 + '{' reduce using rule 53 + '}' reduce using rule 53 + '[' reduce using rule 53 + ']' reduce using rule 53 + '\}' reduce using rule 53 + '\;' reduce using rule 53 + '<-' reduce using rule 53 + '->' reduce using rule 53 + '<=' reduce using rule 53 + '=>' reduce using rule 53 + ':' reduce using rule 53 + '::' reduce using rule 53 + '|' reduce using rule 53 + '`' reduce using rule 53 + '.' reduce using rule 53 + ',' reduce using rule 53 + '_' reduce using rule 53 + '\\' reduce using rule 53 + '-' reduce using rule 53 + '@' reduce using rule 53 + 'ado' reduce using rule 53 + 'as' reduce using rule 53 + 'case' reduce using rule 53 + 'do' reduce using rule 53 + 'else' reduce using rule 53 + 'false' reduce using rule 53 + 'hiding' reduce using rule 53 + 'if' reduce using rule 53 + 'let' reduce using rule 53 + 'nominal' reduce using rule 53 + 'phantom' reduce using rule 53 + 'of' reduce using rule 53 + 'representational'reduce using rule 53 + 'role' reduce using rule 53 + 'then' reduce using rule 53 + 'true' reduce using rule 53 + 'where' reduce using rule 53 + '(->)' reduce using rule 53 + '(..)' reduce using rule 53 + LOWER reduce using rule 53 + QUAL_LOWER reduce using rule 53 + UPPER reduce using rule 53 + QUAL_UPPER reduce using rule 53 + SYMBOL reduce using rule 53 + QUAL_SYMBOL reduce using rule 53 + OPERATOR reduce using rule 53 + QUAL_OPERATOR reduce using rule 53 + LIT_HOLE reduce using rule 53 + LIT_CHAR reduce using rule 53 + LIT_STRING reduce using rule 53 + LIT_RAW_STRING reduce using rule 53 + LIT_INT reduce using rule 53 + LIT_NUMBER reduce using rule 53 + %eof reduce using rule 53 + + +State 117 + + hole -> LIT_HOLE . (rule 91) + + error reduce using rule 91 + '(' reduce using rule 91 + ')' reduce using rule 91 + '{' reduce using rule 91 + '}' reduce using rule 91 + '[' reduce using rule 91 + ']' reduce using rule 91 + '\}' reduce using rule 91 + '\;' reduce using rule 91 + '<-' reduce using rule 91 + '->' reduce using rule 91 + '<=' reduce using rule 91 + '=>' reduce using rule 91 + ':' reduce using rule 91 + '::' reduce using rule 91 + '|' reduce using rule 91 + '`' reduce using rule 91 + '.' reduce using rule 91 + ',' reduce using rule 91 + '_' reduce using rule 91 + '\\' reduce using rule 91 + '-' reduce using rule 91 + '@' reduce using rule 91 + 'ado' reduce using rule 91 + 'as' reduce using rule 91 + 'case' reduce using rule 91 + 'do' reduce using rule 91 + 'else' reduce using rule 91 + 'false' reduce using rule 91 + 'hiding' reduce using rule 91 + 'if' reduce using rule 91 + 'let' reduce using rule 91 + 'nominal' reduce using rule 91 + 'phantom' reduce using rule 91 + 'of' reduce using rule 91 + 'representational'reduce using rule 91 + 'role' reduce using rule 91 + 'then' reduce using rule 91 + 'true' reduce using rule 91 + 'where' reduce using rule 91 + '(->)' reduce using rule 91 + '(..)' reduce using rule 91 + LOWER reduce using rule 91 + QUAL_LOWER reduce using rule 91 + UPPER reduce using rule 91 + QUAL_UPPER reduce using rule 91 + SYMBOL reduce using rule 91 + QUAL_SYMBOL reduce using rule 91 + OPERATOR reduce using rule 91 + QUAL_OPERATOR reduce using rule 91 + LIT_HOLE reduce using rule 91 + LIT_CHAR reduce using rule 91 + LIT_STRING reduce using rule 91 + LIT_RAW_STRING reduce using rule 91 + LIT_INT reduce using rule 91 + LIT_NUMBER reduce using rule 91 + %eof reduce using rule 91 + + +State 118 + + %start_parseDoNext -> doNext . (rule 15) + + error accept + + +State 119 + + doNext -> '\}' . (rule 215) + + error reduce using rule 215 + + +State 120 + + doNext -> '\;' . (rule 214) + + error reduce using rule 214 + + +State 121 + + doExpr -> expr . (rule 213) + + error reduce using rule 213 + + +State 122 + + expr -> expr1 . (rule 149) + expr -> expr1 . '::' type (rule 150) + expr1 -> expr1 . qualOp expr2 (rule 152) + + error reduce using rule 149 + '(' reduce using rule 149 + ')' reduce using rule 149 + '{' reduce using rule 149 + '}' reduce using rule 149 + '[' reduce using rule 149 + ']' reduce using rule 149 + '\}' reduce using rule 149 + '\;' reduce using rule 149 + '<=' shift, and enter state 293 + ':' shift, and enter state 295 + '::' shift, and enter state 303 + '|' reduce using rule 149 + '`' reduce using rule 149 + ',' reduce using rule 149 + '_' reduce using rule 149 + '\\' reduce using rule 149 + '-' shift, and enter state 296 + '@' reduce using rule 149 + 'ado' reduce using rule 149 + 'as' reduce using rule 149 + 'case' reduce using rule 149 + 'do' reduce using rule 149 + 'else' reduce using rule 149 + 'false' reduce using rule 149 + 'hiding' reduce using rule 149 + 'if' reduce using rule 149 + 'let' reduce using rule 149 + 'nominal' reduce using rule 149 + 'phantom' reduce using rule 149 + 'of' reduce using rule 149 + 'representational'reduce using rule 149 + 'role' reduce using rule 149 + 'then' reduce using rule 149 + 'true' reduce using rule 149 + 'where' reduce using rule 149 + '(..)' reduce using rule 149 + LOWER reduce using rule 149 + QUAL_LOWER reduce using rule 149 + UPPER reduce using rule 149 + QUAL_UPPER reduce using rule 149 + SYMBOL reduce using rule 149 + QUAL_SYMBOL reduce using rule 149 + OPERATOR shift, and enter state 297 + QUAL_OPERATOR shift, and enter state 298 + LIT_HOLE reduce using rule 149 + LIT_CHAR reduce using rule 149 + LIT_STRING reduce using rule 149 + LIT_RAW_STRING reduce using rule 149 + LIT_INT reduce using rule 149 + LIT_NUMBER reduce using rule 149 + %eof reduce using rule 149 + + qualOp goto state 302 + +State 123 + + %start_parseDoExpr -> doExpr . (rule 14) + + error accept + + +State 124 + + %start_parseDoStatement -> doStatement . (rule 13) + + error accept + + +State 125 + + doStatement -> 'let' . '\{' manySep__letBinding__'\;'__ '\}' (rule 211) + + '\{' shift, and enter state 301 + + +State 126 + + %start_parseModuleHeader -> moduleHeader . (rule 12) + + error accept + + +State 127 + + moduleHeader -> 'module' . moduleName exports 'where' '\{' moduleImports (rule 242) + + UPPER shift, and enter state 24 + QUAL_UPPER shift, and enter state 132 + + moduleName goto state 300 + +State 128 + + qualIdentP -> qualIdent . (rule 333) + + error reduce using rule 333 + + +State 129 + + %start_parseQualIdentP -> qualIdentP . (rule 11) + + error accept + + +State 130 + + moduleNameP -> moduleName . (rule 332) + + error reduce using rule 332 + + +State 131 + + %start_parseModuleNameP -> moduleNameP . (rule 10) + + error accept + + +State 132 + + moduleName -> QUAL_UPPER . (rule 24) + + error reduce using rule 24 + '(' reduce using rule 24 + ')' reduce using rule 24 + '\}' reduce using rule 24 + '\;' reduce using rule 24 + ',' reduce using rule 24 + 'as' reduce using rule 24 + 'hiding' reduce using rule 24 + 'where' reduce using rule 24 + + +State 133 + + typeAtom -> qualProperName . (rule 115) + + error reduce using rule 115 + '(' reduce using rule 115 + ')' reduce using rule 115 + '{' reduce using rule 115 + '}' reduce using rule 115 + '[' reduce using rule 115 + ']' reduce using rule 115 + '\}' reduce using rule 115 + '\;' reduce using rule 115 + '<-' reduce using rule 115 + '->' reduce using rule 115 + '<=' reduce using rule 115 + '=>' reduce using rule 115 + ':' reduce using rule 115 + '::' reduce using rule 115 + '|' reduce using rule 115 + '`' reduce using rule 115 + ',' reduce using rule 115 + '_' reduce using rule 115 + '\\' reduce using rule 115 + '-' reduce using rule 115 + '@' reduce using rule 115 + 'ado' reduce using rule 115 + 'as' reduce using rule 115 + 'case' reduce using rule 115 + 'do' reduce using rule 115 + 'else' reduce using rule 115 + 'false' reduce using rule 115 + 'hiding' reduce using rule 115 + 'if' reduce using rule 115 + 'let' reduce using rule 115 + 'nominal' reduce using rule 115 + 'phantom' reduce using rule 115 + 'of' reduce using rule 115 + 'representational'reduce using rule 115 + 'role' reduce using rule 115 + 'then' reduce using rule 115 + 'true' reduce using rule 115 + 'where' reduce using rule 115 + '(->)' reduce using rule 115 + '(..)' reduce using rule 115 + LOWER reduce using rule 115 + QUAL_LOWER reduce using rule 115 + UPPER reduce using rule 115 + QUAL_UPPER reduce using rule 115 + SYMBOL reduce using rule 115 + QUAL_SYMBOL reduce using rule 115 + OPERATOR reduce using rule 115 + QUAL_OPERATOR reduce using rule 115 + LIT_HOLE reduce using rule 115 + LIT_CHAR reduce using rule 115 + LIT_STRING reduce using rule 115 + LIT_RAW_STRING reduce using rule 115 + LIT_INT reduce using rule 115 + LIT_NUMBER reduce using rule 115 + %eof reduce using rule 115 + + +State 134 + + typeAtom -> ident . (rule 114) + + error reduce using rule 114 + '(' reduce using rule 114 + ')' reduce using rule 114 + '{' reduce using rule 114 + '}' reduce using rule 114 + '[' reduce using rule 114 + ']' reduce using rule 114 + '\}' reduce using rule 114 + '\;' reduce using rule 114 + '<-' reduce using rule 114 + '->' reduce using rule 114 + '<=' reduce using rule 114 + '=>' reduce using rule 114 + ':' reduce using rule 114 + '::' reduce using rule 114 + '|' reduce using rule 114 + '`' reduce using rule 114 + ',' reduce using rule 114 + '_' reduce using rule 114 + '\\' reduce using rule 114 + '-' reduce using rule 114 + '@' reduce using rule 114 + 'ado' reduce using rule 114 + 'as' reduce using rule 114 + 'case' reduce using rule 114 + 'do' reduce using rule 114 + 'else' reduce using rule 114 + 'false' reduce using rule 114 + 'hiding' reduce using rule 114 + 'if' reduce using rule 114 + 'let' reduce using rule 114 + 'nominal' reduce using rule 114 + 'phantom' reduce using rule 114 + 'of' reduce using rule 114 + 'representational'reduce using rule 114 + 'role' reduce using rule 114 + 'then' reduce using rule 114 + 'true' reduce using rule 114 + 'where' reduce using rule 114 + '(->)' reduce using rule 114 + '(..)' reduce using rule 114 + LOWER reduce using rule 114 + QUAL_LOWER reduce using rule 114 + UPPER reduce using rule 114 + QUAL_UPPER reduce using rule 114 + SYMBOL reduce using rule 114 + QUAL_SYMBOL reduce using rule 114 + OPERATOR reduce using rule 114 + QUAL_OPERATOR reduce using rule 114 + LIT_HOLE reduce using rule 114 + LIT_CHAR reduce using rule 114 + LIT_STRING reduce using rule 114 + LIT_RAW_STRING reduce using rule 114 + LIT_INT reduce using rule 114 + LIT_NUMBER reduce using rule 114 + %eof reduce using rule 114 + + +State 135 + + typeAtom -> qualSymbol . (rule 116) + + error reduce using rule 116 + '(' reduce using rule 116 + ')' reduce using rule 116 + '{' reduce using rule 116 + '}' reduce using rule 116 + '[' reduce using rule 116 + ']' reduce using rule 116 + '\}' reduce using rule 116 + '\;' reduce using rule 116 + '<-' reduce using rule 116 + '->' reduce using rule 116 + '<=' reduce using rule 116 + '=>' reduce using rule 116 + ':' reduce using rule 116 + '::' reduce using rule 116 + '|' reduce using rule 116 + '`' reduce using rule 116 + ',' reduce using rule 116 + '_' reduce using rule 116 + '\\' reduce using rule 116 + '-' reduce using rule 116 + '@' reduce using rule 116 + 'ado' reduce using rule 116 + 'as' reduce using rule 116 + 'case' reduce using rule 116 + 'do' reduce using rule 116 + 'else' reduce using rule 116 + 'false' reduce using rule 116 + 'hiding' reduce using rule 116 + 'if' reduce using rule 116 + 'let' reduce using rule 116 + 'nominal' reduce using rule 116 + 'phantom' reduce using rule 116 + 'of' reduce using rule 116 + 'representational'reduce using rule 116 + 'role' reduce using rule 116 + 'then' reduce using rule 116 + 'true' reduce using rule 116 + 'where' reduce using rule 116 + '(->)' reduce using rule 116 + '(..)' reduce using rule 116 + LOWER reduce using rule 116 + QUAL_LOWER reduce using rule 116 + UPPER reduce using rule 116 + QUAL_UPPER reduce using rule 116 + SYMBOL reduce using rule 116 + QUAL_SYMBOL reduce using rule 116 + OPERATOR reduce using rule 116 + QUAL_OPERATOR reduce using rule 116 + LIT_HOLE reduce using rule 116 + LIT_CHAR reduce using rule 116 + LIT_STRING reduce using rule 116 + LIT_RAW_STRING reduce using rule 116 + LIT_INT reduce using rule 116 + LIT_NUMBER reduce using rule 116 + %eof reduce using rule 116 + + +State 136 + + typeAtom -> hole . (rule 119) + + error reduce using rule 119 + '(' reduce using rule 119 + ')' reduce using rule 119 + '{' reduce using rule 119 + '}' reduce using rule 119 + '[' reduce using rule 119 + ']' reduce using rule 119 + '\}' reduce using rule 119 + '\;' reduce using rule 119 + '<-' reduce using rule 119 + '->' reduce using rule 119 + '<=' reduce using rule 119 + '=>' reduce using rule 119 + ':' reduce using rule 119 + '::' reduce using rule 119 + '|' reduce using rule 119 + '`' reduce using rule 119 + ',' reduce using rule 119 + '_' reduce using rule 119 + '\\' reduce using rule 119 + '-' reduce using rule 119 + '@' reduce using rule 119 + 'ado' reduce using rule 119 + 'as' reduce using rule 119 + 'case' reduce using rule 119 + 'do' reduce using rule 119 + 'else' reduce using rule 119 + 'false' reduce using rule 119 + 'hiding' reduce using rule 119 + 'if' reduce using rule 119 + 'let' reduce using rule 119 + 'nominal' reduce using rule 119 + 'phantom' reduce using rule 119 + 'of' reduce using rule 119 + 'representational'reduce using rule 119 + 'role' reduce using rule 119 + 'then' reduce using rule 119 + 'true' reduce using rule 119 + 'where' reduce using rule 119 + '(->)' reduce using rule 119 + '(..)' reduce using rule 119 + LOWER reduce using rule 119 + QUAL_LOWER reduce using rule 119 + UPPER reduce using rule 119 + QUAL_UPPER reduce using rule 119 + SYMBOL reduce using rule 119 + QUAL_SYMBOL reduce using rule 119 + OPERATOR reduce using rule 119 + QUAL_OPERATOR reduce using rule 119 + LIT_HOLE reduce using rule 119 + LIT_CHAR reduce using rule 119 + LIT_STRING reduce using rule 119 + LIT_RAW_STRING reduce using rule 119 + LIT_INT reduce using rule 119 + LIT_NUMBER reduce using rule 119 + %eof reduce using rule 119 + + +State 137 + + typeAtom -> string . (rule 117) + + error reduce using rule 117 + '(' reduce using rule 117 + ')' reduce using rule 117 + '{' reduce using rule 117 + '}' reduce using rule 117 + '[' reduce using rule 117 + ']' reduce using rule 117 + '\}' reduce using rule 117 + '\;' reduce using rule 117 + '<-' reduce using rule 117 + '->' reduce using rule 117 + '<=' reduce using rule 117 + '=>' reduce using rule 117 + ':' reduce using rule 117 + '::' reduce using rule 117 + '|' reduce using rule 117 + '`' reduce using rule 117 + ',' reduce using rule 117 + '_' reduce using rule 117 + '\\' reduce using rule 117 + '-' reduce using rule 117 + '@' reduce using rule 117 + 'ado' reduce using rule 117 + 'as' reduce using rule 117 + 'case' reduce using rule 117 + 'do' reduce using rule 117 + 'else' reduce using rule 117 + 'false' reduce using rule 117 + 'hiding' reduce using rule 117 + 'if' reduce using rule 117 + 'let' reduce using rule 117 + 'nominal' reduce using rule 117 + 'phantom' reduce using rule 117 + 'of' reduce using rule 117 + 'representational'reduce using rule 117 + 'role' reduce using rule 117 + 'then' reduce using rule 117 + 'true' reduce using rule 117 + 'where' reduce using rule 117 + '(->)' reduce using rule 117 + '(..)' reduce using rule 117 + LOWER reduce using rule 117 + QUAL_LOWER reduce using rule 117 + UPPER reduce using rule 117 + QUAL_UPPER reduce using rule 117 + SYMBOL reduce using rule 117 + QUAL_SYMBOL reduce using rule 117 + OPERATOR reduce using rule 117 + QUAL_OPERATOR reduce using rule 117 + LIT_HOLE reduce using rule 117 + LIT_CHAR reduce using rule 117 + LIT_STRING reduce using rule 117 + LIT_RAW_STRING reduce using rule 117 + LIT_INT reduce using rule 117 + LIT_NUMBER reduce using rule 117 + %eof reduce using rule 117 + + +State 138 + + typeAtom -> int . (rule 118) + + error reduce using rule 118 + '(' reduce using rule 118 + ')' reduce using rule 118 + '{' reduce using rule 118 + '}' reduce using rule 118 + '[' reduce using rule 118 + ']' reduce using rule 118 + '\}' reduce using rule 118 + '\;' reduce using rule 118 + '<-' reduce using rule 118 + '->' reduce using rule 118 + '<=' reduce using rule 118 + '=>' reduce using rule 118 + ':' reduce using rule 118 + '::' reduce using rule 118 + '|' reduce using rule 118 + '`' reduce using rule 118 + ',' reduce using rule 118 + '_' reduce using rule 118 + '\\' reduce using rule 118 + '-' reduce using rule 118 + '@' reduce using rule 118 + 'ado' reduce using rule 118 + 'as' reduce using rule 118 + 'case' reduce using rule 118 + 'do' reduce using rule 118 + 'else' reduce using rule 118 + 'false' reduce using rule 118 + 'hiding' reduce using rule 118 + 'if' reduce using rule 118 + 'let' reduce using rule 118 + 'nominal' reduce using rule 118 + 'phantom' reduce using rule 118 + 'of' reduce using rule 118 + 'representational'reduce using rule 118 + 'role' reduce using rule 118 + 'then' reduce using rule 118 + 'true' reduce using rule 118 + 'where' reduce using rule 118 + '(->)' reduce using rule 118 + '(..)' reduce using rule 118 + LOWER reduce using rule 118 + QUAL_LOWER reduce using rule 118 + UPPER reduce using rule 118 + QUAL_UPPER reduce using rule 118 + SYMBOL reduce using rule 118 + QUAL_SYMBOL reduce using rule 118 + OPERATOR reduce using rule 118 + QUAL_OPERATOR reduce using rule 118 + LIT_HOLE reduce using rule 118 + LIT_CHAR reduce using rule 118 + LIT_STRING reduce using rule 118 + LIT_RAW_STRING reduce using rule 118 + LIT_INT reduce using rule 118 + LIT_NUMBER reduce using rule 118 + %eof reduce using rule 118 + + +State 139 + + typeP -> type . (rule 331) + + error reduce using rule 331 + + +State 140 + + type -> type1 . (rule 100) + type -> type1 . '::' type (rule 101) + + error reduce using rule 100 + '(' reduce using rule 100 + ')' reduce using rule 100 + '{' reduce using rule 100 + '}' reduce using rule 100 + '[' reduce using rule 100 + ']' reduce using rule 100 + '\}' reduce using rule 100 + '\;' reduce using rule 100 + '<-' reduce using rule 100 + '<=' reduce using rule 100 + ':' reduce using rule 100 + '::' shift, and enter state 299 + '|' reduce using rule 100 + '`' reduce using rule 100 + ',' reduce using rule 100 + '_' reduce using rule 100 + '\\' reduce using rule 100 + '-' reduce using rule 100 + '@' reduce using rule 100 + 'ado' reduce using rule 100 + 'as' reduce using rule 100 + 'case' reduce using rule 100 + 'do' reduce using rule 100 + 'else' reduce using rule 100 + 'false' reduce using rule 100 + 'hiding' reduce using rule 100 + 'if' reduce using rule 100 + 'let' reduce using rule 100 + 'nominal' reduce using rule 100 + 'phantom' reduce using rule 100 + 'of' reduce using rule 100 + 'representational'reduce using rule 100 + 'role' reduce using rule 100 + 'then' reduce using rule 100 + 'true' reduce using rule 100 + 'where' reduce using rule 100 + '(..)' reduce using rule 100 + LOWER reduce using rule 100 + QUAL_LOWER reduce using rule 100 + UPPER reduce using rule 100 + QUAL_UPPER reduce using rule 100 + SYMBOL reduce using rule 100 + QUAL_SYMBOL reduce using rule 100 + OPERATOR reduce using rule 100 + QUAL_OPERATOR reduce using rule 100 + LIT_HOLE reduce using rule 100 + LIT_CHAR reduce using rule 100 + LIT_STRING reduce using rule 100 + LIT_RAW_STRING reduce using rule 100 + LIT_INT reduce using rule 100 + LIT_NUMBER reduce using rule 100 + %eof reduce using rule 100 + + +State 141 + + type1 -> type2 . (rule 102) + + error reduce using rule 102 + '(' reduce using rule 102 + ')' reduce using rule 102 + '{' reduce using rule 102 + '}' reduce using rule 102 + '[' reduce using rule 102 + ']' reduce using rule 102 + '\}' reduce using rule 102 + '\;' reduce using rule 102 + '<-' reduce using rule 102 + '<=' reduce using rule 102 + ':' reduce using rule 102 + '::' reduce using rule 102 + '|' reduce using rule 102 + '`' reduce using rule 102 + ',' reduce using rule 102 + '_' reduce using rule 102 + '\\' reduce using rule 102 + '-' reduce using rule 102 + '@' reduce using rule 102 + 'ado' reduce using rule 102 + 'as' reduce using rule 102 + 'case' reduce using rule 102 + 'do' reduce using rule 102 + 'else' reduce using rule 102 + 'false' reduce using rule 102 + 'hiding' reduce using rule 102 + 'if' reduce using rule 102 + 'let' reduce using rule 102 + 'nominal' reduce using rule 102 + 'phantom' reduce using rule 102 + 'of' reduce using rule 102 + 'representational'reduce using rule 102 + 'role' reduce using rule 102 + 'then' reduce using rule 102 + 'true' reduce using rule 102 + 'where' reduce using rule 102 + '(..)' reduce using rule 102 + LOWER reduce using rule 102 + QUAL_LOWER reduce using rule 102 + UPPER reduce using rule 102 + QUAL_UPPER reduce using rule 102 + SYMBOL reduce using rule 102 + QUAL_SYMBOL reduce using rule 102 + OPERATOR reduce using rule 102 + QUAL_OPERATOR reduce using rule 102 + LIT_HOLE reduce using rule 102 + LIT_CHAR reduce using rule 102 + LIT_STRING reduce using rule 102 + LIT_RAW_STRING reduce using rule 102 + LIT_INT reduce using rule 102 + LIT_NUMBER reduce using rule 102 + %eof reduce using rule 102 + + +State 142 + + type2 -> type3 . (rule 104) + type2 -> type3 . '->' type1 (rule 105) + type2 -> type3 . '=>' type1 (rule 106) + type3 -> type3 . qualOp type4 (rule 108) + + error reduce using rule 104 + '(' reduce using rule 104 + ')' reduce using rule 104 + '{' reduce using rule 104 + '}' reduce using rule 104 + '[' reduce using rule 104 + ']' reduce using rule 104 + '\}' reduce using rule 104 + '\;' reduce using rule 104 + '<-' reduce using rule 104 + '->' shift, and enter state 292 + '<=' shift, and enter state 293 + '=>' shift, and enter state 294 + ':' shift, and enter state 295 + '::' reduce using rule 104 + '|' reduce using rule 104 + '`' reduce using rule 104 + ',' reduce using rule 104 + '_' reduce using rule 104 + '\\' reduce using rule 104 + '-' shift, and enter state 296 + '@' reduce using rule 104 + 'ado' reduce using rule 104 + 'as' reduce using rule 104 + 'case' reduce using rule 104 + 'do' reduce using rule 104 + 'else' reduce using rule 104 + 'false' reduce using rule 104 + 'hiding' reduce using rule 104 + 'if' reduce using rule 104 + 'let' reduce using rule 104 + 'nominal' reduce using rule 104 + 'phantom' reduce using rule 104 + 'of' reduce using rule 104 + 'representational'reduce using rule 104 + 'role' reduce using rule 104 + 'then' reduce using rule 104 + 'true' reduce using rule 104 + 'where' reduce using rule 104 + '(..)' reduce using rule 104 + LOWER reduce using rule 104 + QUAL_LOWER reduce using rule 104 + UPPER reduce using rule 104 + QUAL_UPPER reduce using rule 104 + SYMBOL reduce using rule 104 + QUAL_SYMBOL reduce using rule 104 + OPERATOR shift, and enter state 297 + QUAL_OPERATOR shift, and enter state 298 + LIT_HOLE reduce using rule 104 + LIT_CHAR reduce using rule 104 + LIT_STRING reduce using rule 104 + LIT_RAW_STRING reduce using rule 104 + LIT_INT reduce using rule 104 + LIT_NUMBER reduce using rule 104 + %eof reduce using rule 104 + + qualOp goto state 291 + +State 143 + + type3 -> type4 . (rule 107) + + error reduce using rule 107 + '(' reduce using rule 107 + ')' reduce using rule 107 + '{' reduce using rule 107 + '}' reduce using rule 107 + '[' reduce using rule 107 + ']' reduce using rule 107 + '\}' reduce using rule 107 + '\;' reduce using rule 107 + '<-' reduce using rule 107 + '->' reduce using rule 107 + '<=' reduce using rule 107 + '=>' reduce using rule 107 + ':' reduce using rule 107 + '::' reduce using rule 107 + '|' reduce using rule 107 + '`' reduce using rule 107 + ',' reduce using rule 107 + '_' reduce using rule 107 + '\\' reduce using rule 107 + '-' reduce using rule 107 + '@' reduce using rule 107 + 'ado' reduce using rule 107 + 'as' reduce using rule 107 + 'case' reduce using rule 107 + 'do' reduce using rule 107 + 'else' reduce using rule 107 + 'false' reduce using rule 107 + 'hiding' reduce using rule 107 + 'if' reduce using rule 107 + 'let' reduce using rule 107 + 'nominal' reduce using rule 107 + 'phantom' reduce using rule 107 + 'of' reduce using rule 107 + 'representational'reduce using rule 107 + 'role' reduce using rule 107 + 'then' reduce using rule 107 + 'true' reduce using rule 107 + 'where' reduce using rule 107 + '(..)' reduce using rule 107 + LOWER reduce using rule 107 + QUAL_LOWER reduce using rule 107 + UPPER reduce using rule 107 + QUAL_UPPER reduce using rule 107 + SYMBOL reduce using rule 107 + QUAL_SYMBOL reduce using rule 107 + OPERATOR reduce using rule 107 + QUAL_OPERATOR reduce using rule 107 + LIT_HOLE reduce using rule 107 + LIT_CHAR reduce using rule 107 + LIT_STRING reduce using rule 107 + LIT_RAW_STRING reduce using rule 107 + LIT_INT reduce using rule 107 + LIT_NUMBER reduce using rule 107 + %eof reduce using rule 107 + + +State 144 + + type4 -> type5 . (rule 109) + type5 -> type5 . typeAtom (rule 112) + + error reduce using rule 109 + '(' shift, and enter state 148 + ')' reduce using rule 109 + '{' shift, and enter state 149 + '}' reduce using rule 109 + '[' reduce using rule 109 + ']' reduce using rule 109 + '\}' reduce using rule 109 + '\;' reduce using rule 109 + '<-' reduce using rule 109 + '->' reduce using rule 109 + '<=' reduce using rule 109 + '=>' reduce using rule 109 + ':' reduce using rule 109 + '::' reduce using rule 109 + '|' reduce using rule 109 + '`' reduce using rule 109 + ',' reduce using rule 109 + '_' shift, and enter state 150 + '\\' reduce using rule 109 + '-' reduce using rule 109 + '@' reduce using rule 109 + 'ado' reduce using rule 109 + 'as' shift, and enter state 45 + 'case' reduce using rule 109 + 'do' reduce using rule 109 + 'else' reduce using rule 109 + 'false' reduce using rule 109 + 'hiding' shift, and enter state 47 + 'if' reduce using rule 109 + 'let' reduce using rule 109 + 'nominal' shift, and enter state 48 + 'phantom' shift, and enter state 49 + 'of' reduce using rule 109 + 'representational'shift, and enter state 50 + 'role' shift, and enter state 51 + 'then' reduce using rule 109 + 'true' reduce using rule 109 + 'where' reduce using rule 109 + '(->)' shift, and enter state 154 + '(..)' shift, and enter state 112 + LOWER shift, and enter state 53 + QUAL_LOWER reduce using rule 109 + UPPER shift, and enter state 54 + QUAL_UPPER shift, and enter state 55 + SYMBOL shift, and enter state 115 + QUAL_SYMBOL shift, and enter state 116 + OPERATOR reduce using rule 109 + QUAL_OPERATOR reduce using rule 109 + LIT_HOLE shift, and enter state 117 + LIT_CHAR reduce using rule 109 + LIT_STRING shift, and enter state 57 + LIT_RAW_STRING shift, and enter state 58 + LIT_INT shift, and enter state 155 + LIT_NUMBER reduce using rule 109 + %eof reduce using rule 109 + + qualProperName goto state 133 + ident goto state 134 + qualSymbol goto state 135 + hole goto state 136 + string goto state 137 + int goto state 138 + typeAtom goto state 290 + +State 145 + + type5 -> typeAtom . (rule 111) + + error reduce using rule 111 + '(' reduce using rule 111 + ')' reduce using rule 111 + '{' reduce using rule 111 + '}' reduce using rule 111 + '[' reduce using rule 111 + ']' reduce using rule 111 + '\}' reduce using rule 111 + '\;' reduce using rule 111 + '<-' reduce using rule 111 + '->' reduce using rule 111 + '<=' reduce using rule 111 + '=>' reduce using rule 111 + ':' reduce using rule 111 + '::' reduce using rule 111 + '|' reduce using rule 111 + '`' reduce using rule 111 + ',' reduce using rule 111 + '_' reduce using rule 111 + '\\' reduce using rule 111 + '-' reduce using rule 111 + '@' reduce using rule 111 + 'ado' reduce using rule 111 + 'as' reduce using rule 111 + 'case' reduce using rule 111 + 'do' reduce using rule 111 + 'else' reduce using rule 111 + 'false' reduce using rule 111 + 'hiding' reduce using rule 111 + 'if' reduce using rule 111 + 'let' reduce using rule 111 + 'nominal' reduce using rule 111 + 'phantom' reduce using rule 111 + 'of' reduce using rule 111 + 'representational'reduce using rule 111 + 'role' reduce using rule 111 + 'then' reduce using rule 111 + 'true' reduce using rule 111 + 'where' reduce using rule 111 + '(->)' reduce using rule 111 + '(..)' reduce using rule 111 + LOWER reduce using rule 111 + QUAL_LOWER reduce using rule 111 + UPPER reduce using rule 111 + QUAL_UPPER reduce using rule 111 + SYMBOL reduce using rule 111 + QUAL_SYMBOL reduce using rule 111 + OPERATOR reduce using rule 111 + QUAL_OPERATOR reduce using rule 111 + LIT_HOLE reduce using rule 111 + LIT_CHAR reduce using rule 111 + LIT_STRING reduce using rule 111 + LIT_RAW_STRING reduce using rule 111 + LIT_INT reduce using rule 111 + LIT_NUMBER reduce using rule 111 + %eof reduce using rule 111 + + +State 146 + + type1 -> forall . many__typeVarBinding__ '.' type1 (rule 103) + + '(' shift, and enter state 288 + '@' shift, and enter state 289 + 'as' shift, and enter state 45 + 'hiding' shift, and enter state 47 + 'nominal' shift, and enter state 48 + 'phantom' shift, and enter state 49 + 'representational'shift, and enter state 50 + 'role' shift, and enter state 51 + LOWER shift, and enter state 53 + + ident goto state 284 + typeVarBinding goto state 285 + many__typeVarBinding__goto state 286 + many1__typeVarBinding__goto state 287 + +State 147 + + %start_parseTypeP -> typeP . (rule 9) + + error accept + + +State 148 + + typeAtom -> '(' . row ')' (rule 122) + typeAtom -> '(' . type1 ')' (rule 123) + typeAtom -> '(' . typeKindedAtom '::' type ')' (rule 124) + + '(' shift, and enter state 271 + ')' reduce using rule 134 + '{' shift, and enter state 272 + '|' shift, and enter state 229 + '_' shift, and enter state 273 + '-' shift, and enter state 151 + 'ado' shift, and enter state 230 + 'as' shift, and enter state 274 + 'case' shift, and enter state 232 + 'class' shift, and enter state 233 + 'data' shift, and enter state 234 + 'derive' shift, and enter state 235 + 'do' shift, and enter state 236 + 'else' shift, and enter state 237 + 'false' shift, and enter state 238 + 'forall' shift, and enter state 275 + 'forallu' shift, and enter state 153 + 'foreign' shift, and enter state 240 + 'hiding' shift, and enter state 276 + 'import' shift, and enter state 242 + 'if' shift, and enter state 243 + 'in' shift, and enter state 244 + 'infix' shift, and enter state 245 + 'infixl' shift, and enter state 246 + 'infixr' shift, and enter state 247 + 'instance' shift, and enter state 248 + 'let' shift, and enter state 249 + 'module' shift, and enter state 250 + 'newtype' shift, and enter state 251 + 'nominal' shift, and enter state 277 + 'phantom' shift, and enter state 278 + 'of' shift, and enter state 254 + 'representational'shift, and enter state 279 + 'role' shift, and enter state 280 + 'then' shift, and enter state 257 + 'true' shift, and enter state 258 + 'type' shift, and enter state 259 + 'where' shift, and enter state 260 + '(->)' shift, and enter state 154 + '(..)' shift, and enter state 112 + LOWER shift, and enter state 281 + UPPER shift, and enter state 54 + QUAL_UPPER shift, and enter state 55 + SYMBOL shift, and enter state 115 + QUAL_SYMBOL shift, and enter state 116 + LIT_HOLE shift, and enter state 117 + LIT_STRING shift, and enter state 282 + LIT_RAW_STRING shift, and enter state 283 + LIT_INT shift, and enter state 155 + + qualProperName goto state 264 + ident goto state 134 + qualSymbol goto state 265 + label goto state 224 + hole goto state 266 + string goto state 137 + int goto state 267 + type1 goto state 268 + type2 goto state 141 + type3 goto state 142 + type4 goto state 143 + type5 goto state 144 + typeAtom goto state 145 + typeKindedAtom goto state 269 + row goto state 270 + rowLabel goto state 226 + forall goto state 146 + sep__rowLabel__','__goto state 227 + sep1__rowLabel__','__goto state 228 + +State 149 + + typeAtom -> '{' . row '}' (rule 121) + + '}' reduce using rule 134 + '|' shift, and enter state 229 + 'ado' shift, and enter state 230 + 'as' shift, and enter state 231 + 'case' shift, and enter state 232 + 'class' shift, and enter state 233 + 'data' shift, and enter state 234 + 'derive' shift, and enter state 235 + 'do' shift, and enter state 236 + 'else' shift, and enter state 237 + 'false' shift, and enter state 238 + 'forall' shift, and enter state 239 + 'foreign' shift, and enter state 240 + 'hiding' shift, and enter state 241 + 'import' shift, and enter state 242 + 'if' shift, and enter state 243 + 'in' shift, and enter state 244 + 'infix' shift, and enter state 245 + 'infixl' shift, and enter state 246 + 'infixr' shift, and enter state 247 + 'instance' shift, and enter state 248 + 'let' shift, and enter state 249 + 'module' shift, and enter state 250 + 'newtype' shift, and enter state 251 + 'nominal' shift, and enter state 252 + 'phantom' shift, and enter state 253 + 'of' shift, and enter state 254 + 'representational'shift, and enter state 255 + 'role' shift, and enter state 256 + 'then' shift, and enter state 257 + 'true' shift, and enter state 258 + 'type' shift, and enter state 259 + 'where' shift, and enter state 260 + LOWER shift, and enter state 261 + LIT_STRING shift, and enter state 262 + LIT_RAW_STRING shift, and enter state 263 + + label goto state 224 + row goto state 225 + rowLabel goto state 226 + sep__rowLabel__','__goto state 227 + sep1__rowLabel__','__goto state 228 + +State 150 + + typeAtom -> '_' . (rule 113) + + error reduce using rule 113 + '(' reduce using rule 113 + ')' reduce using rule 113 + '{' reduce using rule 113 + '}' reduce using rule 113 + '[' reduce using rule 113 + ']' reduce using rule 113 + '\}' reduce using rule 113 + '\;' reduce using rule 113 + '<-' reduce using rule 113 + '->' reduce using rule 113 + '<=' reduce using rule 113 + '=>' reduce using rule 113 + ':' reduce using rule 113 + '::' reduce using rule 113 + '|' reduce using rule 113 + '`' reduce using rule 113 + ',' reduce using rule 113 + '_' reduce using rule 113 + '\\' reduce using rule 113 + '-' reduce using rule 113 + '@' reduce using rule 113 + 'ado' reduce using rule 113 + 'as' reduce using rule 113 + 'case' reduce using rule 113 + 'do' reduce using rule 113 + 'else' reduce using rule 113 + 'false' reduce using rule 113 + 'hiding' reduce using rule 113 + 'if' reduce using rule 113 + 'let' reduce using rule 113 + 'nominal' reduce using rule 113 + 'phantom' reduce using rule 113 + 'of' reduce using rule 113 + 'representational'reduce using rule 113 + 'role' reduce using rule 113 + 'then' reduce using rule 113 + 'true' reduce using rule 113 + 'where' reduce using rule 113 + '(->)' reduce using rule 113 + '(..)' reduce using rule 113 + LOWER reduce using rule 113 + QUAL_LOWER reduce using rule 113 + UPPER reduce using rule 113 + QUAL_UPPER reduce using rule 113 + SYMBOL reduce using rule 113 + QUAL_SYMBOL reduce using rule 113 + OPERATOR reduce using rule 113 + QUAL_OPERATOR reduce using rule 113 + LIT_HOLE reduce using rule 113 + LIT_CHAR reduce using rule 113 + LIT_STRING reduce using rule 113 + LIT_RAW_STRING reduce using rule 113 + LIT_INT reduce using rule 113 + LIT_NUMBER reduce using rule 113 + %eof reduce using rule 113 + + +State 151 + + type4 -> '-' . int (rule 110) + + LIT_INT shift, and enter state 155 + + int goto state 223 + +State 152 + + forall -> 'forall' . (rule 145) + + '(' reduce using rule 145 + '@' reduce using rule 145 + 'as' reduce using rule 145 + 'hiding' reduce using rule 145 + 'nominal' reduce using rule 145 + 'phantom' reduce using rule 145 + 'representational'reduce using rule 145 + 'role' reduce using rule 145 + LOWER reduce using rule 145 + + +State 153 + + forall -> 'forallu' . (rule 146) + + '(' reduce using rule 146 + '@' reduce using rule 146 + 'as' reduce using rule 146 + 'hiding' reduce using rule 146 + 'nominal' reduce using rule 146 + 'phantom' reduce using rule 146 + 'representational'reduce using rule 146 + 'role' reduce using rule 146 + LOWER reduce using rule 146 + + +State 154 + + typeAtom -> '(->)' . (rule 120) + + error reduce using rule 120 + '(' reduce using rule 120 + ')' reduce using rule 120 + '{' reduce using rule 120 + '}' reduce using rule 120 + '[' reduce using rule 120 + ']' reduce using rule 120 + '\}' reduce using rule 120 + '\;' reduce using rule 120 + '<-' reduce using rule 120 + '->' reduce using rule 120 + '<=' reduce using rule 120 + '=>' reduce using rule 120 + ':' reduce using rule 120 + '::' reduce using rule 120 + '|' reduce using rule 120 + '`' reduce using rule 120 + ',' reduce using rule 120 + '_' reduce using rule 120 + '\\' reduce using rule 120 + '-' reduce using rule 120 + '@' reduce using rule 120 + 'ado' reduce using rule 120 + 'as' reduce using rule 120 + 'case' reduce using rule 120 + 'do' reduce using rule 120 + 'else' reduce using rule 120 + 'false' reduce using rule 120 + 'hiding' reduce using rule 120 + 'if' reduce using rule 120 + 'let' reduce using rule 120 + 'nominal' reduce using rule 120 + 'phantom' reduce using rule 120 + 'of' reduce using rule 120 + 'representational'reduce using rule 120 + 'role' reduce using rule 120 + 'then' reduce using rule 120 + 'true' reduce using rule 120 + 'where' reduce using rule 120 + '(->)' reduce using rule 120 + '(..)' reduce using rule 120 + LOWER reduce using rule 120 + QUAL_LOWER reduce using rule 120 + UPPER reduce using rule 120 + QUAL_UPPER reduce using rule 120 + SYMBOL reduce using rule 120 + QUAL_SYMBOL reduce using rule 120 + OPERATOR reduce using rule 120 + QUAL_OPERATOR reduce using rule 120 + LIT_HOLE reduce using rule 120 + LIT_CHAR reduce using rule 120 + LIT_STRING reduce using rule 120 + LIT_RAW_STRING reduce using rule 120 + LIT_INT reduce using rule 120 + LIT_NUMBER reduce using rule 120 + %eof reduce using rule 120 + + +State 155 + + int -> LIT_INT . (rule 97) + + error reduce using rule 97 + '(' reduce using rule 97 + ')' reduce using rule 97 + '{' reduce using rule 97 + '}' reduce using rule 97 + '[' reduce using rule 97 + ']' reduce using rule 97 + '\}' reduce using rule 97 + '\;' reduce using rule 97 + '<-' reduce using rule 97 + '->' reduce using rule 97 + '<=' reduce using rule 97 + '=>' reduce using rule 97 + ':' reduce using rule 97 + '::' reduce using rule 97 + '|' reduce using rule 97 + '`' reduce using rule 97 + ',' reduce using rule 97 + '_' reduce using rule 97 + '\\' reduce using rule 97 + '-' reduce using rule 97 + '@' reduce using rule 97 + 'ado' reduce using rule 97 + 'as' reduce using rule 97 + 'case' reduce using rule 97 + 'do' reduce using rule 97 + 'else' reduce using rule 97 + 'false' reduce using rule 97 + 'hiding' reduce using rule 97 + 'if' reduce using rule 97 + 'let' reduce using rule 97 + 'nominal' reduce using rule 97 + 'phantom' reduce using rule 97 + 'of' reduce using rule 97 + 'representational'reduce using rule 97 + 'role' reduce using rule 97 + 'then' reduce using rule 97 + 'true' reduce using rule 97 + 'type' reduce using rule 97 + 'where' reduce using rule 97 + '(->)' reduce using rule 97 + '(..)' reduce using rule 97 + LOWER reduce using rule 97 + QUAL_LOWER reduce using rule 97 + UPPER reduce using rule 97 + QUAL_UPPER reduce using rule 97 + SYMBOL reduce using rule 97 + QUAL_SYMBOL reduce using rule 97 + OPERATOR reduce using rule 97 + QUAL_OPERATOR reduce using rule 97 + LIT_HOLE reduce using rule 97 + LIT_CHAR reduce using rule 97 + LIT_STRING reduce using rule 97 + LIT_RAW_STRING reduce using rule 97 + LIT_INT reduce using rule 97 + LIT_NUMBER reduce using rule 97 + %eof reduce using rule 97 + + +State 156 + + exprP -> expr . (rule 330) + + error reduce using rule 330 + + +State 157 + + %start_parseExprP -> exprP . (rule 8) + + error accept + + +State 158 + + decl -> ident . '::' type (rule 290) + decl -> ident . manyOrEmpty__binderAtom__ guardedDecl (rule 291) + + '(' shift, and enter state 40 + '{' shift, and enter state 41 + '[' shift, and enter state 42 + '::' shift, and enter state 222 + '=' reduce using rule 348 + '|' reduce using rule 348 + '_' shift, and enter state 43 + 'as' shift, and enter state 45 + 'false' shift, and enter state 46 + 'hiding' shift, and enter state 47 + 'nominal' shift, and enter state 48 + 'phantom' shift, and enter state 49 + 'representational'shift, and enter state 50 + 'role' shift, and enter state 51 + 'true' shift, and enter state 52 + LOWER shift, and enter state 53 + UPPER shift, and enter state 54 + QUAL_UPPER shift, and enter state 55 + LIT_CHAR shift, and enter state 56 + LIT_STRING shift, and enter state 57 + LIT_RAW_STRING shift, and enter state 58 + LIT_INT shift, and enter state 59 + LIT_NUMBER shift, and enter state 60 + + qualProperName goto state 25 + ident goto state 26 + string goto state 27 + char goto state 28 + number goto state 29 + boolean goto state 30 + binderAtom goto state 35 + delim__'['__binder__','__']'__goto state 36 + delim__'{'__recordBinder__','__'}'__goto state 37 + many__binderAtom__goto state 220 + manyOrEmpty__binderAtom__goto state 221 + many1__binderAtom__goto state 39 + +State 159 + + declP -> decl . (rule 329) + + error reduce using rule 329 + + +State 160 + + decl -> dataHead . (rule 277) + decl -> dataHead . '=' sep__dataCtor__'|'__ (rule 278) + + error reduce using rule 277 + '\}' reduce using rule 277 + '\;' reduce using rule 277 + '=' shift, and enter state 219 + 'else' reduce using rule 277 + %eof reduce using rule 277 + + +State 161 + + decl -> typeHead . '=' type (rule 279) + + '=' shift, and enter state 218 + + +State 162 + + decl -> newtypeHead . '=' properName typeAtom (rule 280) + + '=' shift, and enter state 217 + + +State 163 + + decl -> classHead . (rule 281) + decl -> classHead . 'where' '\{' manySep__classMember__'\;'__ '\}' (rule 282) + + error reduce using rule 281 + '\}' reduce using rule 281 + '\;' reduce using rule 281 + 'else' reduce using rule 281 + 'where' shift, and enter state 216 + %eof reduce using rule 281 + + +State 164 + + decl -> instHead . (rule 283) + decl -> instHead . 'where' '\{' manySep__instBinding__'\;'__ '\}' (rule 284) + + error reduce using rule 283 + '\}' reduce using rule 283 + '\;' reduce using rule 283 + 'else' reduce using rule 283 + 'where' shift, and enter state 215 + %eof reduce using rule 283 + + +State 165 + + decl -> fixity . (rule 292) + + error reduce using rule 292 + '\}' reduce using rule 292 + '\;' reduce using rule 292 + 'else' reduce using rule 292 + %eof reduce using rule 292 + + +State 166 + + fixity -> infix . int qualIdent 'as' op (rule 319) + fixity -> infix . int qualProperName 'as' op (rule 320) + fixity -> infix . int 'type' qualProperName 'as' op (rule 321) + + LIT_INT shift, and enter state 155 + + int goto state 214 + +State 167 + + %start_parseDeclP -> declP . (rule 7) + + error accept + + +State 168 + + classHead -> 'class' . (rule 300) + + error reduce using rule 300 + '\}' reduce using rule 300 + '\;' reduce using rule 300 + 'else' reduce using rule 300 + 'where' reduce using rule 300 + %eof reduce using rule 300 + + +State 169 + + decl -> 'data' . properName '::' type (rule 285) + dataHead -> 'data' . properName manyOrEmpty__typeVarBindingPlain__ (rule 296) + + UPPER shift, and enter state 63 + + properName goto state 213 + +State 170 + + decl -> 'derive' . instHead (rule 288) + decl -> 'derive' . 'newtype' instHead (rule 289) + + 'instance' shift, and enter state 175 + 'newtype' shift, and enter state 212 + + instHead goto state 211 + +State 171 + + decl -> 'foreign' . 'import' ident '::' type (rule 293) + decl -> 'foreign' . 'import' 'data' properName '::' type (rule 294) + + 'import' shift, and enter state 210 + + +State 172 + + infix -> 'infix' . (rule 322) + + LIT_INT reduce using rule 322 + + +State 173 + + infix -> 'infixl' . (rule 323) + + LIT_INT reduce using rule 323 + + +State 174 + + infix -> 'infixr' . (rule 324) + + LIT_INT reduce using rule 324 + + +State 175 + + instHead -> 'instance' . constraints '=>' qualProperName manyOrEmpty__typeAtom__ (rule 309) + instHead -> 'instance' . qualProperName manyOrEmpty__typeAtom__ (rule 310) + instHead -> 'instance' . ident '::' constraints '=>' qualProperName manyOrEmpty__typeAtom__ (rule 311) + instHead -> 'instance' . ident '::' qualProperName manyOrEmpty__typeAtom__ (rule 312) + + '(' shift, and enter state 68 + 'as' shift, and enter state 45 + 'hiding' shift, and enter state 47 + 'nominal' shift, and enter state 48 + 'phantom' shift, and enter state 49 + 'representational'shift, and enter state 50 + 'role' shift, and enter state 51 + LOWER shift, and enter state 53 + UPPER shift, and enter state 54 + QUAL_UPPER shift, and enter state 55 + + qualProperName goto state 207 + ident goto state 208 + constraints goto state 209 + constraint goto state 67 + +State 176 + + decl -> 'newtype' . properName '::' type (rule 286) + newtypeHead -> 'newtype' . properName manyOrEmpty__typeVarBindingPlain__ (rule 298) + + UPPER shift, and enter state 63 + + properName goto state 206 + +State 177 + + decl -> 'type' . properName '::' type (rule 287) + decl -> 'type' . 'role' properName many__role__ (rule 295) + typeHead -> 'type' . properName manyOrEmpty__typeVarBindingPlain__ (rule 297) + + 'role' shift, and enter state 205 + UPPER shift, and enter state 63 + + properName goto state 204 + +State 178 + + importDeclP -> importDecl . (rule 328) + + error reduce using rule 328 + + +State 179 + + %start_parseImportDeclP -> importDeclP . (rule 6) + + error accept + + +State 180 + + importDecl -> 'import' . moduleName imports (rule 266) + importDecl -> 'import' . moduleName imports 'as' moduleName (rule 267) + + UPPER shift, and enter state 24 + QUAL_UPPER shift, and enter state 132 + + moduleName goto state 203 + +State 181 + + %start_parseDecl -> decl . (rule 5) + + %eof accept + + +State 182 + + %start_parseModuleBody -> moduleBody . (rule 4) + + %eof accept + + +State 183 + + moduleBody -> moduleDecls . '\}' (rule 243) + + '\}' shift, and enter state 202 + + +State 184 + + manySep1__moduleDecl__'\;'__ -> moduleDecl . (rule 396) + + '\}' reduce using rule 396 + '\;' reduce using rule 396 + + +State 185 + + moduleDecl -> importDecl . (rule 250) + + '\}' reduce using rule 250 + '\;' reduce using rule 250 + + +State 186 + + sep1__decl__declElse__ -> decl . (rule 407) + + '\}' reduce using rule 407 + '\;' reduce using rule 407 + 'else' reduce using rule 407 + + +State 187 + + moduleDecls -> manySep__moduleDecl__'\;'__ . (rule 248) + + '\}' reduce using rule 248 + + +State 188 + + moduleDecl -> sep__decl__declElse__ . (rule 251) + + '\}' reduce using rule 251 + '\;' reduce using rule 251 + + +State 189 + + manySep__moduleDecl__'\;'__ -> manySep1__moduleDecl__'\;'__ . (rule 360) + manySep1__moduleDecl__'\;'__ -> manySep1__moduleDecl__'\;'__ . '\;' moduleDecl (rule 397) + + '\}' reduce using rule 360 + '\;' shift, and enter state 201 + + +State 190 + + sep__decl__declElse__ -> sep1__decl__declElse__ . (rule 364) + sep1__decl__declElse__ -> sep1__decl__declElse__ . declElse decl (rule 408) + + '\}' reduce using rule 364 + '\;' reduce using rule 364 + 'else' shift, and enter state 200 + + declElse goto state 199 + +State 191 + + %start_parseOperator -> op . (rule 3) + + %eof accept + + +State 192 + + op -> '<=' . (rule 49) + + error reduce using rule 49 + '\}' reduce using rule 49 + '\;' reduce using rule 49 + 'else' reduce using rule 49 + %eof reduce using rule 49 + + +State 193 + + op -> ':' . (rule 51) + + error reduce using rule 51 + '\}' reduce using rule 51 + '\;' reduce using rule 51 + 'else' reduce using rule 51 + %eof reduce using rule 51 + + +State 194 + + op -> '-' . (rule 50) + + error reduce using rule 50 + '\}' reduce using rule 50 + '\;' reduce using rule 50 + 'else' reduce using rule 50 + %eof reduce using rule 50 + + +State 195 + + op -> OPERATOR . (rule 48) + + error reduce using rule 48 + '\}' reduce using rule 48 + '\;' reduce using rule 48 + 'else' reduce using rule 48 + %eof reduce using rule 48 + + +State 196 + + %start_parseIdent -> ident . (rule 2) + + %eof accept + + +State 197 + + %start_parseExpr -> expr . (rule 1) + + %eof accept + + +State 198 + + %start_parseType -> type . (rule 0) + + %eof accept + + +State 199 + + sep1__decl__declElse__ -> sep1__decl__declElse__ declElse . decl (rule 408) + + 'as' shift, and enter state 45 + 'class' shift, and enter state 168 + 'data' shift, and enter state 169 + 'derive' shift, and enter state 170 + 'foreign' shift, and enter state 171 + 'hiding' shift, and enter state 47 + 'infix' shift, and enter state 172 + 'infixl' shift, and enter state 173 + 'infixr' shift, and enter state 174 + 'instance' shift, and enter state 175 + 'newtype' shift, and enter state 176 + 'nominal' shift, and enter state 48 + 'phantom' shift, and enter state 49 + 'representational'shift, and enter state 50 + 'role' shift, and enter state 51 + 'type' shift, and enter state 177 + LOWER shift, and enter state 53 + + ident goto state 158 + decl goto state 469 + dataHead goto state 160 + typeHead goto state 161 + newtypeHead goto state 162 + classHead goto state 163 + instHead goto state 164 + fixity goto state 165 + infix goto state 166 + +State 200 + + declElse -> 'else' . (rule 252) + declElse -> 'else' . '\;' (rule 253) + + '\;' shift, and enter state 468 + 'as' reduce using rule 252 + 'class' reduce using rule 252 + 'data' reduce using rule 252 + 'derive' reduce using rule 252 + 'foreign' reduce using rule 252 + 'hiding' reduce using rule 252 + 'infix' reduce using rule 252 + 'infixl' reduce using rule 252 + 'infixr' reduce using rule 252 + 'instance' reduce using rule 252 + 'newtype' reduce using rule 252 + 'nominal' reduce using rule 252 + 'phantom' reduce using rule 252 + 'representational'reduce using rule 252 + 'role' reduce using rule 252 + 'type' reduce using rule 252 + LOWER reduce using rule 252 + + +State 201 + + manySep1__moduleDecl__'\;'__ -> manySep1__moduleDecl__'\;'__ '\;' . moduleDecl (rule 397) + + 'as' shift, and enter state 45 + 'class' shift, and enter state 168 + 'data' shift, and enter state 169 + 'derive' shift, and enter state 170 + 'foreign' shift, and enter state 171 + 'hiding' shift, and enter state 47 + 'import' shift, and enter state 180 + 'infix' shift, and enter state 172 + 'infixl' shift, and enter state 173 + 'infixr' shift, and enter state 174 + 'instance' shift, and enter state 175 + 'newtype' shift, and enter state 176 + 'nominal' shift, and enter state 48 + 'phantom' shift, and enter state 49 + 'representational'shift, and enter state 50 + 'role' shift, and enter state 51 + 'type' shift, and enter state 177 + LOWER shift, and enter state 53 + + ident goto state 158 + moduleDecl goto state 467 + importDecl goto state 185 + decl goto state 186 + dataHead goto state 160 + typeHead goto state 161 + newtypeHead goto state 162 + classHead goto state 163 + instHead goto state 164 + fixity goto state 165 + infix goto state 166 + sep__decl__declElse__goto state 188 + sep1__decl__declElse__goto state 190 + +State 202 + + moduleBody -> moduleDecls '\}' . (rule 243) + + %eof reduce using rule 243 + + +State 203 + + importDecl -> 'import' moduleName . imports (rule 266) + importDecl -> 'import' moduleName . imports 'as' moduleName (rule 267) + + error reduce using rule 268 + '(' shift, and enter state 465 + '\}' reduce using rule 268 + '\;' reduce using rule 268 + 'as' reduce using rule 268 + 'hiding' shift, and enter state 466 + + imports goto state 464 + +State 204 + + decl -> 'type' properName . '::' type (rule 287) + typeHead -> 'type' properName . manyOrEmpty__typeVarBindingPlain__ (rule 297) + + '(' shift, and enter state 451 + '::' shift, and enter state 463 + '=' reduce using rule 354 + 'as' shift, and enter state 45 + 'hiding' shift, and enter state 47 + 'nominal' shift, and enter state 48 + 'phantom' shift, and enter state 49 + 'representational'shift, and enter state 50 + 'role' shift, and enter state 51 + LOWER shift, and enter state 53 + + ident goto state 446 + typeVarBindingPlaingoto state 447 + manyOrEmpty__typeVarBindingPlain__goto state 462 + many__typeVarBindingPlain__goto state 449 + many1__typeVarBindingPlain__goto state 450 + +State 205 + + decl -> 'type' 'role' . properName many__role__ (rule 295) + + UPPER shift, and enter state 63 + + properName goto state 461 + +State 206 + + decl -> 'newtype' properName . '::' type (rule 286) + newtypeHead -> 'newtype' properName . manyOrEmpty__typeVarBindingPlain__ (rule 298) + + '(' shift, and enter state 451 + '::' shift, and enter state 460 + '=' reduce using rule 354 + 'as' shift, and enter state 45 + 'hiding' shift, and enter state 47 + 'nominal' shift, and enter state 48 + 'phantom' shift, and enter state 49 + 'representational'shift, and enter state 50 + 'role' shift, and enter state 51 + LOWER shift, and enter state 53 + + ident goto state 446 + typeVarBindingPlaingoto state 447 + manyOrEmpty__typeVarBindingPlain__goto state 459 + many__typeVarBindingPlain__goto state 449 + many1__typeVarBindingPlain__goto state 450 + +State 207 + + instHead -> 'instance' qualProperName . manyOrEmpty__typeAtom__ (rule 310) + constraint -> qualProperName . manyOrEmpty__typeAtom__ (rule 315) + + error reduce using rule 350 + '(' shift, and enter state 148 + '{' shift, and enter state 149 + '\}' reduce using rule 350 + '\;' reduce using rule 350 + '=>' reduce using rule 350 + '_' shift, and enter state 150 + 'as' shift, and enter state 45 + 'else' reduce using rule 350 + 'hiding' shift, and enter state 47 + 'nominal' shift, and enter state 48 + 'phantom' shift, and enter state 49 + 'representational'shift, and enter state 50 + 'role' shift, and enter state 51 + 'where' reduce using rule 350 + '(->)' shift, and enter state 154 + '(..)' shift, and enter state 112 + LOWER shift, and enter state 53 + UPPER shift, and enter state 54 + QUAL_UPPER shift, and enter state 55 + SYMBOL shift, and enter state 115 + QUAL_SYMBOL shift, and enter state 116 + LIT_HOLE shift, and enter state 117 + LIT_STRING shift, and enter state 57 + LIT_RAW_STRING shift, and enter state 58 + LIT_INT shift, and enter state 155 + %eof reduce using rule 350 + + qualProperName goto state 133 + ident goto state 134 + qualSymbol goto state 135 + hole goto state 136 + string goto state 137 + int goto state 138 + typeAtom goto state 333 + manyOrEmpty__typeAtom__goto state 458 + many__typeAtom__goto state 335 + many1__typeAtom__goto state 336 + +State 208 + + instHead -> 'instance' ident . '::' constraints '=>' qualProperName manyOrEmpty__typeAtom__ (rule 311) + instHead -> 'instance' ident . '::' qualProperName manyOrEmpty__typeAtom__ (rule 312) + + '::' shift, and enter state 457 + + +State 209 + + instHead -> 'instance' constraints . '=>' qualProperName manyOrEmpty__typeAtom__ (rule 309) + + '=>' shift, and enter state 456 + + +State 210 + + decl -> 'foreign' 'import' . ident '::' type (rule 293) + decl -> 'foreign' 'import' . 'data' properName '::' type (rule 294) + + 'as' shift, and enter state 45 + 'data' shift, and enter state 455 + 'hiding' shift, and enter state 47 + 'nominal' shift, and enter state 48 + 'phantom' shift, and enter state 49 + 'representational'shift, and enter state 50 + 'role' shift, and enter state 51 + LOWER shift, and enter state 53 + + ident goto state 454 + +State 211 + + decl -> 'derive' instHead . (rule 288) + + error reduce using rule 288 + '\}' reduce using rule 288 + '\;' reduce using rule 288 + 'else' reduce using rule 288 + %eof reduce using rule 288 + + +State 212 + + decl -> 'derive' 'newtype' . instHead (rule 289) + + 'instance' shift, and enter state 175 + + instHead goto state 453 + +State 213 + + decl -> 'data' properName . '::' type (rule 285) + dataHead -> 'data' properName . manyOrEmpty__typeVarBindingPlain__ (rule 296) + + error reduce using rule 354 + '(' shift, and enter state 451 + '\}' reduce using rule 354 + '\;' reduce using rule 354 + '::' shift, and enter state 452 + '=' reduce using rule 354 + 'as' shift, and enter state 45 + 'else' reduce using rule 354 + 'hiding' shift, and enter state 47 + 'nominal' shift, and enter state 48 + 'phantom' shift, and enter state 49 + 'representational'shift, and enter state 50 + 'role' shift, and enter state 51 + LOWER shift, and enter state 53 + %eof reduce using rule 354 + + ident goto state 446 + typeVarBindingPlaingoto state 447 + manyOrEmpty__typeVarBindingPlain__goto state 448 + many__typeVarBindingPlain__goto state 449 + many1__typeVarBindingPlain__goto state 450 + +State 214 + + fixity -> infix int . qualIdent 'as' op (rule 319) + fixity -> infix int . qualProperName 'as' op (rule 320) + fixity -> infix int . 'type' qualProperName 'as' op (rule 321) + + 'as' shift, and enter state 102 + 'hiding' shift, and enter state 105 + 'nominal' shift, and enter state 108 + 'phantom' shift, and enter state 109 + 'representational'shift, and enter state 110 + 'role' shift, and enter state 111 + 'type' shift, and enter state 445 + LOWER shift, and enter state 113 + QUAL_LOWER shift, and enter state 114 + UPPER shift, and enter state 54 + QUAL_UPPER shift, and enter state 55 + + qualProperName goto state 443 + qualIdent goto state 444 + +State 215 + + decl -> instHead 'where' . '\{' manySep__instBinding__'\;'__ '\}' (rule 284) + + '\{' shift, and enter state 442 + + +State 216 + + decl -> classHead 'where' . '\{' manySep__classMember__'\;'__ '\}' (rule 282) + + '\{' shift, and enter state 441 + + +State 217 + + decl -> newtypeHead '=' . properName typeAtom (rule 280) + + UPPER shift, and enter state 63 + + properName goto state 440 + +State 218 + + decl -> typeHead '=' . type (rule 279) + + '(' shift, and enter state 148 + '{' shift, and enter state 149 + '_' shift, and enter state 150 + '-' shift, and enter state 151 + 'as' shift, and enter state 45 + 'forall' shift, and enter state 152 + 'forallu' shift, and enter state 153 + 'hiding' shift, and enter state 47 + 'nominal' shift, and enter state 48 + 'phantom' shift, and enter state 49 + 'representational'shift, and enter state 50 + 'role' shift, and enter state 51 + '(->)' shift, and enter state 154 + '(..)' shift, and enter state 112 + LOWER shift, and enter state 53 + UPPER shift, and enter state 54 + QUAL_UPPER shift, and enter state 55 + SYMBOL shift, and enter state 115 + QUAL_SYMBOL shift, and enter state 116 + LIT_HOLE shift, and enter state 117 + LIT_STRING shift, and enter state 57 + LIT_RAW_STRING shift, and enter state 58 + LIT_INT shift, and enter state 155 + + qualProperName goto state 133 + ident goto state 134 + qualSymbol goto state 135 + hole goto state 136 + string goto state 137 + int goto state 138 + type goto state 439 + type1 goto state 140 + type2 goto state 141 + type3 goto state 142 + type4 goto state 143 + type5 goto state 144 + typeAtom goto state 145 + forall goto state 146 + +State 219 + + decl -> dataHead '=' . sep__dataCtor__'|'__ (rule 278) + + UPPER shift, and enter state 63 + + properName goto state 435 + dataCtor goto state 436 + sep__dataCtor__'|'__goto state 437 + sep1__dataCtor__'|'__goto state 438 + +State 220 + + manyOrEmpty__binderAtom__ -> many__binderAtom__ . (rule 349) + + '=' reduce using rule 349 + '|' reduce using rule 349 + + +State 221 + + decl -> ident manyOrEmpty__binderAtom__ . guardedDecl (rule 291) + + '=' shift, and enter state 433 + '|' shift, and enter state 434 + + guardedDecl goto state 428 + guardedDeclExprgoto state 429 + guard goto state 430 + many__guardedDeclExpr__goto state 431 + many1__guardedDeclExpr__goto state 432 + +State 222 + + decl -> ident '::' . type (rule 290) + + '(' shift, and enter state 148 + '{' shift, and enter state 149 + '_' shift, and enter state 150 + '-' shift, and enter state 151 + 'as' shift, and enter state 45 + 'forall' shift, and enter state 152 + 'forallu' shift, and enter state 153 + 'hiding' shift, and enter state 47 + 'nominal' shift, and enter state 48 + 'phantom' shift, and enter state 49 + 'representational'shift, and enter state 50 + 'role' shift, and enter state 51 + '(->)' shift, and enter state 154 + '(..)' shift, and enter state 112 + LOWER shift, and enter state 53 + UPPER shift, and enter state 54 + QUAL_UPPER shift, and enter state 55 + SYMBOL shift, and enter state 115 + QUAL_SYMBOL shift, and enter state 116 + LIT_HOLE shift, and enter state 117 + LIT_STRING shift, and enter state 57 + LIT_RAW_STRING shift, and enter state 58 + LIT_INT shift, and enter state 155 + + qualProperName goto state 133 + ident goto state 134 + qualSymbol goto state 135 + hole goto state 136 + string goto state 137 + int goto state 138 + type goto state 427 + type1 goto state 140 + type2 goto state 141 + type3 goto state 142 + type4 goto state 143 + type5 goto state 144 + typeAtom goto state 145 + forall goto state 146 + +State 223 + + type4 -> '-' int . (rule 110) + + error reduce using rule 110 + '(' reduce using rule 110 + ')' reduce using rule 110 + '{' reduce using rule 110 + '}' reduce using rule 110 + '[' reduce using rule 110 + ']' reduce using rule 110 + '\}' reduce using rule 110 + '\;' reduce using rule 110 + '<-' reduce using rule 110 + '->' reduce using rule 110 + '<=' reduce using rule 110 + '=>' reduce using rule 110 + ':' reduce using rule 110 + '::' reduce using rule 110 + '|' reduce using rule 110 + '`' reduce using rule 110 + ',' reduce using rule 110 + '_' reduce using rule 110 + '\\' reduce using rule 110 + '-' reduce using rule 110 + '@' reduce using rule 110 + 'ado' reduce using rule 110 + 'as' reduce using rule 110 + 'case' reduce using rule 110 + 'do' reduce using rule 110 + 'else' reduce using rule 110 + 'false' reduce using rule 110 + 'hiding' reduce using rule 110 + 'if' reduce using rule 110 + 'let' reduce using rule 110 + 'nominal' reduce using rule 110 + 'phantom' reduce using rule 110 + 'of' reduce using rule 110 + 'representational'reduce using rule 110 + 'role' reduce using rule 110 + 'then' reduce using rule 110 + 'true' reduce using rule 110 + 'where' reduce using rule 110 + '(..)' reduce using rule 110 + LOWER reduce using rule 110 + QUAL_LOWER reduce using rule 110 + UPPER reduce using rule 110 + QUAL_UPPER reduce using rule 110 + SYMBOL reduce using rule 110 + QUAL_SYMBOL reduce using rule 110 + OPERATOR reduce using rule 110 + QUAL_OPERATOR reduce using rule 110 + LIT_HOLE reduce using rule 110 + LIT_CHAR reduce using rule 110 + LIT_STRING reduce using rule 110 + LIT_RAW_STRING reduce using rule 110 + LIT_INT reduce using rule 110 + LIT_NUMBER reduce using rule 110 + %eof reduce using rule 110 + + +State 224 + + rowLabel -> label . '::' type (rule 138) + + '::' shift, and enter state 426 + + +State 225 + + typeAtom -> '{' row . '}' (rule 121) + + '}' shift, and enter state 425 + + +State 226 + + sep1__rowLabel__','__ -> rowLabel . (rule 425) + + ')' reduce using rule 425 + '}' reduce using rule 425 + '|' reduce using rule 425 + ',' reduce using rule 425 + + +State 227 + + row -> sep__rowLabel__','__ . (rule 136) + row -> sep__rowLabel__','__ . '|' type (rule 137) + + ')' reduce using rule 136 + '}' reduce using rule 136 + '|' shift, and enter state 424 + + +State 228 + + sep__rowLabel__','__ -> sep1__rowLabel__','__ . (rule 373) + sep1__rowLabel__','__ -> sep1__rowLabel__','__ . ',' rowLabel (rule 426) + + ')' reduce using rule 373 + '}' reduce using rule 373 + '|' reduce using rule 373 + ',' shift, and enter state 423 + + +State 229 + + row -> '|' . type (rule 135) + + '(' shift, and enter state 148 + '{' shift, and enter state 149 + '_' shift, and enter state 150 + '-' shift, and enter state 151 + 'as' shift, and enter state 45 + 'forall' shift, and enter state 152 + 'forallu' shift, and enter state 153 + 'hiding' shift, and enter state 47 + 'nominal' shift, and enter state 48 + 'phantom' shift, and enter state 49 + 'representational'shift, and enter state 50 + 'role' shift, and enter state 51 + '(->)' shift, and enter state 154 + '(..)' shift, and enter state 112 + LOWER shift, and enter state 53 + UPPER shift, and enter state 54 + QUAL_UPPER shift, and enter state 55 + SYMBOL shift, and enter state 115 + QUAL_SYMBOL shift, and enter state 116 + LIT_HOLE shift, and enter state 117 + LIT_STRING shift, and enter state 57 + LIT_RAW_STRING shift, and enter state 58 + LIT_INT shift, and enter state 155 + + qualProperName goto state 133 + ident goto state 134 + qualSymbol goto state 135 + hole goto state 136 + string goto state 137 + int goto state 138 + type goto state 422 + type1 goto state 140 + type2 goto state 141 + type3 goto state 142 + type4 goto state 143 + type5 goto state 144 + typeAtom goto state 145 + forall goto state 146 + +State 230 + + label -> 'ado' . (rule 60) + + error reduce using rule 60 + '(' reduce using rule 60 + ')' reduce using rule 60 + '{' reduce using rule 60 + '}' reduce using rule 60 + '[' reduce using rule 60 + ']' reduce using rule 60 + '\}' reduce using rule 60 + '\;' reduce using rule 60 + '<=' reduce using rule 60 + ':' reduce using rule 60 + '::' reduce using rule 60 + '=' reduce using rule 60 + '|' reduce using rule 60 + '`' reduce using rule 60 + '.' reduce using rule 60 + ',' reduce using rule 60 + '_' reduce using rule 60 + '\\' reduce using rule 60 + '-' reduce using rule 60 + '@' reduce using rule 60 + 'ado' reduce using rule 60 + 'as' reduce using rule 60 + 'case' reduce using rule 60 + 'do' reduce using rule 60 + 'else' reduce using rule 60 + 'false' reduce using rule 60 + 'hiding' reduce using rule 60 + 'if' reduce using rule 60 + 'let' reduce using rule 60 + 'nominal' reduce using rule 60 + 'phantom' reduce using rule 60 + 'of' reduce using rule 60 + 'representational'reduce using rule 60 + 'role' reduce using rule 60 + 'then' reduce using rule 60 + 'true' reduce using rule 60 + 'where' reduce using rule 60 + '(..)' reduce using rule 60 + LOWER reduce using rule 60 + QUAL_LOWER reduce using rule 60 + UPPER reduce using rule 60 + QUAL_UPPER reduce using rule 60 + SYMBOL reduce using rule 60 + QUAL_SYMBOL reduce using rule 60 + OPERATOR reduce using rule 60 + QUAL_OPERATOR reduce using rule 60 + LIT_HOLE reduce using rule 60 + LIT_CHAR reduce using rule 60 + LIT_STRING reduce using rule 60 + LIT_RAW_STRING reduce using rule 60 + LIT_INT reduce using rule 60 + LIT_NUMBER reduce using rule 60 + %eof reduce using rule 60 + + +State 231 + + label -> 'as' . (rule 61) + + error reduce using rule 61 + '(' reduce using rule 61 + ')' reduce using rule 61 + '{' reduce using rule 61 + '}' reduce using rule 61 + '[' reduce using rule 61 + ']' reduce using rule 61 + '\}' reduce using rule 61 + '\;' reduce using rule 61 + '<=' reduce using rule 61 + ':' reduce using rule 61 + '::' reduce using rule 61 + '=' reduce using rule 61 + '|' reduce using rule 61 + '`' reduce using rule 61 + '.' reduce using rule 61 + ',' reduce using rule 61 + '_' reduce using rule 61 + '\\' reduce using rule 61 + '-' reduce using rule 61 + '@' reduce using rule 61 + 'ado' reduce using rule 61 + 'as' reduce using rule 61 + 'case' reduce using rule 61 + 'do' reduce using rule 61 + 'else' reduce using rule 61 + 'false' reduce using rule 61 + 'hiding' reduce using rule 61 + 'if' reduce using rule 61 + 'let' reduce using rule 61 + 'nominal' reduce using rule 61 + 'phantom' reduce using rule 61 + 'of' reduce using rule 61 + 'representational'reduce using rule 61 + 'role' reduce using rule 61 + 'then' reduce using rule 61 + 'true' reduce using rule 61 + 'where' reduce using rule 61 + '(..)' reduce using rule 61 + LOWER reduce using rule 61 + QUAL_LOWER reduce using rule 61 + UPPER reduce using rule 61 + QUAL_UPPER reduce using rule 61 + SYMBOL reduce using rule 61 + QUAL_SYMBOL reduce using rule 61 + OPERATOR reduce using rule 61 + QUAL_OPERATOR reduce using rule 61 + LIT_HOLE reduce using rule 61 + LIT_CHAR reduce using rule 61 + LIT_STRING reduce using rule 61 + LIT_RAW_STRING reduce using rule 61 + LIT_INT reduce using rule 61 + LIT_NUMBER reduce using rule 61 + %eof reduce using rule 61 + + +State 232 + + label -> 'case' . (rule 62) + + error reduce using rule 62 + '(' reduce using rule 62 + ')' reduce using rule 62 + '{' reduce using rule 62 + '}' reduce using rule 62 + '[' reduce using rule 62 + ']' reduce using rule 62 + '\}' reduce using rule 62 + '\;' reduce using rule 62 + '<=' reduce using rule 62 + ':' reduce using rule 62 + '::' reduce using rule 62 + '=' reduce using rule 62 + '|' reduce using rule 62 + '`' reduce using rule 62 + '.' reduce using rule 62 + ',' reduce using rule 62 + '_' reduce using rule 62 + '\\' reduce using rule 62 + '-' reduce using rule 62 + '@' reduce using rule 62 + 'ado' reduce using rule 62 + 'as' reduce using rule 62 + 'case' reduce using rule 62 + 'do' reduce using rule 62 + 'else' reduce using rule 62 + 'false' reduce using rule 62 + 'hiding' reduce using rule 62 + 'if' reduce using rule 62 + 'let' reduce using rule 62 + 'nominal' reduce using rule 62 + 'phantom' reduce using rule 62 + 'of' reduce using rule 62 + 'representational'reduce using rule 62 + 'role' reduce using rule 62 + 'then' reduce using rule 62 + 'true' reduce using rule 62 + 'where' reduce using rule 62 + '(..)' reduce using rule 62 + LOWER reduce using rule 62 + QUAL_LOWER reduce using rule 62 + UPPER reduce using rule 62 + QUAL_UPPER reduce using rule 62 + SYMBOL reduce using rule 62 + QUAL_SYMBOL reduce using rule 62 + OPERATOR reduce using rule 62 + QUAL_OPERATOR reduce using rule 62 + LIT_HOLE reduce using rule 62 + LIT_CHAR reduce using rule 62 + LIT_STRING reduce using rule 62 + LIT_RAW_STRING reduce using rule 62 + LIT_INT reduce using rule 62 + LIT_NUMBER reduce using rule 62 + %eof reduce using rule 62 + + +State 233 + + label -> 'class' . (rule 63) + + error reduce using rule 63 + '(' reduce using rule 63 + ')' reduce using rule 63 + '{' reduce using rule 63 + '}' reduce using rule 63 + '[' reduce using rule 63 + ']' reduce using rule 63 + '\}' reduce using rule 63 + '\;' reduce using rule 63 + '<=' reduce using rule 63 + ':' reduce using rule 63 + '::' reduce using rule 63 + '=' reduce using rule 63 + '|' reduce using rule 63 + '`' reduce using rule 63 + '.' reduce using rule 63 + ',' reduce using rule 63 + '_' reduce using rule 63 + '\\' reduce using rule 63 + '-' reduce using rule 63 + '@' reduce using rule 63 + 'ado' reduce using rule 63 + 'as' reduce using rule 63 + 'case' reduce using rule 63 + 'do' reduce using rule 63 + 'else' reduce using rule 63 + 'false' reduce using rule 63 + 'hiding' reduce using rule 63 + 'if' reduce using rule 63 + 'let' reduce using rule 63 + 'nominal' reduce using rule 63 + 'phantom' reduce using rule 63 + 'of' reduce using rule 63 + 'representational'reduce using rule 63 + 'role' reduce using rule 63 + 'then' reduce using rule 63 + 'true' reduce using rule 63 + 'where' reduce using rule 63 + '(..)' reduce using rule 63 + LOWER reduce using rule 63 + QUAL_LOWER reduce using rule 63 + UPPER reduce using rule 63 + QUAL_UPPER reduce using rule 63 + SYMBOL reduce using rule 63 + QUAL_SYMBOL reduce using rule 63 + OPERATOR reduce using rule 63 + QUAL_OPERATOR reduce using rule 63 + LIT_HOLE reduce using rule 63 + LIT_CHAR reduce using rule 63 + LIT_STRING reduce using rule 63 + LIT_RAW_STRING reduce using rule 63 + LIT_INT reduce using rule 63 + LIT_NUMBER reduce using rule 63 + %eof reduce using rule 63 + + +State 234 + + label -> 'data' . (rule 64) + + error reduce using rule 64 + '(' reduce using rule 64 + ')' reduce using rule 64 + '{' reduce using rule 64 + '}' reduce using rule 64 + '[' reduce using rule 64 + ']' reduce using rule 64 + '\}' reduce using rule 64 + '\;' reduce using rule 64 + '<=' reduce using rule 64 + ':' reduce using rule 64 + '::' reduce using rule 64 + '=' reduce using rule 64 + '|' reduce using rule 64 + '`' reduce using rule 64 + '.' reduce using rule 64 + ',' reduce using rule 64 + '_' reduce using rule 64 + '\\' reduce using rule 64 + '-' reduce using rule 64 + '@' reduce using rule 64 + 'ado' reduce using rule 64 + 'as' reduce using rule 64 + 'case' reduce using rule 64 + 'do' reduce using rule 64 + 'else' reduce using rule 64 + 'false' reduce using rule 64 + 'hiding' reduce using rule 64 + 'if' reduce using rule 64 + 'let' reduce using rule 64 + 'nominal' reduce using rule 64 + 'phantom' reduce using rule 64 + 'of' reduce using rule 64 + 'representational'reduce using rule 64 + 'role' reduce using rule 64 + 'then' reduce using rule 64 + 'true' reduce using rule 64 + 'where' reduce using rule 64 + '(..)' reduce using rule 64 + LOWER reduce using rule 64 + QUAL_LOWER reduce using rule 64 + UPPER reduce using rule 64 + QUAL_UPPER reduce using rule 64 + SYMBOL reduce using rule 64 + QUAL_SYMBOL reduce using rule 64 + OPERATOR reduce using rule 64 + QUAL_OPERATOR reduce using rule 64 + LIT_HOLE reduce using rule 64 + LIT_CHAR reduce using rule 64 + LIT_STRING reduce using rule 64 + LIT_RAW_STRING reduce using rule 64 + LIT_INT reduce using rule 64 + LIT_NUMBER reduce using rule 64 + %eof reduce using rule 64 + + +State 235 + + label -> 'derive' . (rule 65) + + error reduce using rule 65 + '(' reduce using rule 65 + ')' reduce using rule 65 + '{' reduce using rule 65 + '}' reduce using rule 65 + '[' reduce using rule 65 + ']' reduce using rule 65 + '\}' reduce using rule 65 + '\;' reduce using rule 65 + '<=' reduce using rule 65 + ':' reduce using rule 65 + '::' reduce using rule 65 + '=' reduce using rule 65 + '|' reduce using rule 65 + '`' reduce using rule 65 + '.' reduce using rule 65 + ',' reduce using rule 65 + '_' reduce using rule 65 + '\\' reduce using rule 65 + '-' reduce using rule 65 + '@' reduce using rule 65 + 'ado' reduce using rule 65 + 'as' reduce using rule 65 + 'case' reduce using rule 65 + 'do' reduce using rule 65 + 'else' reduce using rule 65 + 'false' reduce using rule 65 + 'hiding' reduce using rule 65 + 'if' reduce using rule 65 + 'let' reduce using rule 65 + 'nominal' reduce using rule 65 + 'phantom' reduce using rule 65 + 'of' reduce using rule 65 + 'representational'reduce using rule 65 + 'role' reduce using rule 65 + 'then' reduce using rule 65 + 'true' reduce using rule 65 + 'where' reduce using rule 65 + '(..)' reduce using rule 65 + LOWER reduce using rule 65 + QUAL_LOWER reduce using rule 65 + UPPER reduce using rule 65 + QUAL_UPPER reduce using rule 65 + SYMBOL reduce using rule 65 + QUAL_SYMBOL reduce using rule 65 + OPERATOR reduce using rule 65 + QUAL_OPERATOR reduce using rule 65 + LIT_HOLE reduce using rule 65 + LIT_CHAR reduce using rule 65 + LIT_STRING reduce using rule 65 + LIT_RAW_STRING reduce using rule 65 + LIT_INT reduce using rule 65 + LIT_NUMBER reduce using rule 65 + %eof reduce using rule 65 + + +State 236 + + label -> 'do' . (rule 66) + + error reduce using rule 66 + '(' reduce using rule 66 + ')' reduce using rule 66 + '{' reduce using rule 66 + '}' reduce using rule 66 + '[' reduce using rule 66 + ']' reduce using rule 66 + '\}' reduce using rule 66 + '\;' reduce using rule 66 + '<=' reduce using rule 66 + ':' reduce using rule 66 + '::' reduce using rule 66 + '=' reduce using rule 66 + '|' reduce using rule 66 + '`' reduce using rule 66 + '.' reduce using rule 66 + ',' reduce using rule 66 + '_' reduce using rule 66 + '\\' reduce using rule 66 + '-' reduce using rule 66 + '@' reduce using rule 66 + 'ado' reduce using rule 66 + 'as' reduce using rule 66 + 'case' reduce using rule 66 + 'do' reduce using rule 66 + 'else' reduce using rule 66 + 'false' reduce using rule 66 + 'hiding' reduce using rule 66 + 'if' reduce using rule 66 + 'let' reduce using rule 66 + 'nominal' reduce using rule 66 + 'phantom' reduce using rule 66 + 'of' reduce using rule 66 + 'representational'reduce using rule 66 + 'role' reduce using rule 66 + 'then' reduce using rule 66 + 'true' reduce using rule 66 + 'where' reduce using rule 66 + '(..)' reduce using rule 66 + LOWER reduce using rule 66 + QUAL_LOWER reduce using rule 66 + UPPER reduce using rule 66 + QUAL_UPPER reduce using rule 66 + SYMBOL reduce using rule 66 + QUAL_SYMBOL reduce using rule 66 + OPERATOR reduce using rule 66 + QUAL_OPERATOR reduce using rule 66 + LIT_HOLE reduce using rule 66 + LIT_CHAR reduce using rule 66 + LIT_STRING reduce using rule 66 + LIT_RAW_STRING reduce using rule 66 + LIT_INT reduce using rule 66 + LIT_NUMBER reduce using rule 66 + %eof reduce using rule 66 + + +State 237 + + label -> 'else' . (rule 67) + + error reduce using rule 67 + '(' reduce using rule 67 + ')' reduce using rule 67 + '{' reduce using rule 67 + '}' reduce using rule 67 + '[' reduce using rule 67 + ']' reduce using rule 67 + '\}' reduce using rule 67 + '\;' reduce using rule 67 + '<=' reduce using rule 67 + ':' reduce using rule 67 + '::' reduce using rule 67 + '=' reduce using rule 67 + '|' reduce using rule 67 + '`' reduce using rule 67 + '.' reduce using rule 67 + ',' reduce using rule 67 + '_' reduce using rule 67 + '\\' reduce using rule 67 + '-' reduce using rule 67 + '@' reduce using rule 67 + 'ado' reduce using rule 67 + 'as' reduce using rule 67 + 'case' reduce using rule 67 + 'do' reduce using rule 67 + 'else' reduce using rule 67 + 'false' reduce using rule 67 + 'hiding' reduce using rule 67 + 'if' reduce using rule 67 + 'let' reduce using rule 67 + 'nominal' reduce using rule 67 + 'phantom' reduce using rule 67 + 'of' reduce using rule 67 + 'representational'reduce using rule 67 + 'role' reduce using rule 67 + 'then' reduce using rule 67 + 'true' reduce using rule 67 + 'where' reduce using rule 67 + '(..)' reduce using rule 67 + LOWER reduce using rule 67 + QUAL_LOWER reduce using rule 67 + UPPER reduce using rule 67 + QUAL_UPPER reduce using rule 67 + SYMBOL reduce using rule 67 + QUAL_SYMBOL reduce using rule 67 + OPERATOR reduce using rule 67 + QUAL_OPERATOR reduce using rule 67 + LIT_HOLE reduce using rule 67 + LIT_CHAR reduce using rule 67 + LIT_STRING reduce using rule 67 + LIT_RAW_STRING reduce using rule 67 + LIT_INT reduce using rule 67 + LIT_NUMBER reduce using rule 67 + %eof reduce using rule 67 + + +State 238 + + label -> 'false' . (rule 68) + + error reduce using rule 68 + '(' reduce using rule 68 + ')' reduce using rule 68 + '{' reduce using rule 68 + '}' reduce using rule 68 + '[' reduce using rule 68 + ']' reduce using rule 68 + '\}' reduce using rule 68 + '\;' reduce using rule 68 + '<=' reduce using rule 68 + ':' reduce using rule 68 + '::' reduce using rule 68 + '=' reduce using rule 68 + '|' reduce using rule 68 + '`' reduce using rule 68 + '.' reduce using rule 68 + ',' reduce using rule 68 + '_' reduce using rule 68 + '\\' reduce using rule 68 + '-' reduce using rule 68 + '@' reduce using rule 68 + 'ado' reduce using rule 68 + 'as' reduce using rule 68 + 'case' reduce using rule 68 + 'do' reduce using rule 68 + 'else' reduce using rule 68 + 'false' reduce using rule 68 + 'hiding' reduce using rule 68 + 'if' reduce using rule 68 + 'let' reduce using rule 68 + 'nominal' reduce using rule 68 + 'phantom' reduce using rule 68 + 'of' reduce using rule 68 + 'representational'reduce using rule 68 + 'role' reduce using rule 68 + 'then' reduce using rule 68 + 'true' reduce using rule 68 + 'where' reduce using rule 68 + '(..)' reduce using rule 68 + LOWER reduce using rule 68 + QUAL_LOWER reduce using rule 68 + UPPER reduce using rule 68 + QUAL_UPPER reduce using rule 68 + SYMBOL reduce using rule 68 + QUAL_SYMBOL reduce using rule 68 + OPERATOR reduce using rule 68 + QUAL_OPERATOR reduce using rule 68 + LIT_HOLE reduce using rule 68 + LIT_CHAR reduce using rule 68 + LIT_STRING reduce using rule 68 + LIT_RAW_STRING reduce using rule 68 + LIT_INT reduce using rule 68 + LIT_NUMBER reduce using rule 68 + %eof reduce using rule 68 + + +State 239 + + label -> 'forall' . (rule 69) + + error reduce using rule 69 + '(' reduce using rule 69 + ')' reduce using rule 69 + '{' reduce using rule 69 + '}' reduce using rule 69 + '[' reduce using rule 69 + ']' reduce using rule 69 + '\}' reduce using rule 69 + '\;' reduce using rule 69 + '<=' reduce using rule 69 + ':' reduce using rule 69 + '::' reduce using rule 69 + '=' reduce using rule 69 + '|' reduce using rule 69 + '`' reduce using rule 69 + '.' reduce using rule 69 + ',' reduce using rule 69 + '_' reduce using rule 69 + '\\' reduce using rule 69 + '-' reduce using rule 69 + '@' reduce using rule 69 + 'ado' reduce using rule 69 + 'as' reduce using rule 69 + 'case' reduce using rule 69 + 'do' reduce using rule 69 + 'else' reduce using rule 69 + 'false' reduce using rule 69 + 'hiding' reduce using rule 69 + 'if' reduce using rule 69 + 'let' reduce using rule 69 + 'nominal' reduce using rule 69 + 'phantom' reduce using rule 69 + 'of' reduce using rule 69 + 'representational'reduce using rule 69 + 'role' reduce using rule 69 + 'then' reduce using rule 69 + 'true' reduce using rule 69 + 'where' reduce using rule 69 + '(..)' reduce using rule 69 + LOWER reduce using rule 69 + QUAL_LOWER reduce using rule 69 + UPPER reduce using rule 69 + QUAL_UPPER reduce using rule 69 + SYMBOL reduce using rule 69 + QUAL_SYMBOL reduce using rule 69 + OPERATOR reduce using rule 69 + QUAL_OPERATOR reduce using rule 69 + LIT_HOLE reduce using rule 69 + LIT_CHAR reduce using rule 69 + LIT_STRING reduce using rule 69 + LIT_RAW_STRING reduce using rule 69 + LIT_INT reduce using rule 69 + LIT_NUMBER reduce using rule 69 + %eof reduce using rule 69 + + +State 240 + + label -> 'foreign' . (rule 70) + + error reduce using rule 70 + '(' reduce using rule 70 + ')' reduce using rule 70 + '{' reduce using rule 70 + '}' reduce using rule 70 + '[' reduce using rule 70 + ']' reduce using rule 70 + '\}' reduce using rule 70 + '\;' reduce using rule 70 + '<=' reduce using rule 70 + ':' reduce using rule 70 + '::' reduce using rule 70 + '=' reduce using rule 70 + '|' reduce using rule 70 + '`' reduce using rule 70 + '.' reduce using rule 70 + ',' reduce using rule 70 + '_' reduce using rule 70 + '\\' reduce using rule 70 + '-' reduce using rule 70 + '@' reduce using rule 70 + 'ado' reduce using rule 70 + 'as' reduce using rule 70 + 'case' reduce using rule 70 + 'do' reduce using rule 70 + 'else' reduce using rule 70 + 'false' reduce using rule 70 + 'hiding' reduce using rule 70 + 'if' reduce using rule 70 + 'let' reduce using rule 70 + 'nominal' reduce using rule 70 + 'phantom' reduce using rule 70 + 'of' reduce using rule 70 + 'representational'reduce using rule 70 + 'role' reduce using rule 70 + 'then' reduce using rule 70 + 'true' reduce using rule 70 + 'where' reduce using rule 70 + '(..)' reduce using rule 70 + LOWER reduce using rule 70 + QUAL_LOWER reduce using rule 70 + UPPER reduce using rule 70 + QUAL_UPPER reduce using rule 70 + SYMBOL reduce using rule 70 + QUAL_SYMBOL reduce using rule 70 + OPERATOR reduce using rule 70 + QUAL_OPERATOR reduce using rule 70 + LIT_HOLE reduce using rule 70 + LIT_CHAR reduce using rule 70 + LIT_STRING reduce using rule 70 + LIT_RAW_STRING reduce using rule 70 + LIT_INT reduce using rule 70 + LIT_NUMBER reduce using rule 70 + %eof reduce using rule 70 + + +State 241 + + label -> 'hiding' . (rule 71) + + error reduce using rule 71 + '(' reduce using rule 71 + ')' reduce using rule 71 + '{' reduce using rule 71 + '}' reduce using rule 71 + '[' reduce using rule 71 + ']' reduce using rule 71 + '\}' reduce using rule 71 + '\;' reduce using rule 71 + '<=' reduce using rule 71 + ':' reduce using rule 71 + '::' reduce using rule 71 + '=' reduce using rule 71 + '|' reduce using rule 71 + '`' reduce using rule 71 + '.' reduce using rule 71 + ',' reduce using rule 71 + '_' reduce using rule 71 + '\\' reduce using rule 71 + '-' reduce using rule 71 + '@' reduce using rule 71 + 'ado' reduce using rule 71 + 'as' reduce using rule 71 + 'case' reduce using rule 71 + 'do' reduce using rule 71 + 'else' reduce using rule 71 + 'false' reduce using rule 71 + 'hiding' reduce using rule 71 + 'if' reduce using rule 71 + 'let' reduce using rule 71 + 'nominal' reduce using rule 71 + 'phantom' reduce using rule 71 + 'of' reduce using rule 71 + 'representational'reduce using rule 71 + 'role' reduce using rule 71 + 'then' reduce using rule 71 + 'true' reduce using rule 71 + 'where' reduce using rule 71 + '(..)' reduce using rule 71 + LOWER reduce using rule 71 + QUAL_LOWER reduce using rule 71 + UPPER reduce using rule 71 + QUAL_UPPER reduce using rule 71 + SYMBOL reduce using rule 71 + QUAL_SYMBOL reduce using rule 71 + OPERATOR reduce using rule 71 + QUAL_OPERATOR reduce using rule 71 + LIT_HOLE reduce using rule 71 + LIT_CHAR reduce using rule 71 + LIT_STRING reduce using rule 71 + LIT_RAW_STRING reduce using rule 71 + LIT_INT reduce using rule 71 + LIT_NUMBER reduce using rule 71 + %eof reduce using rule 71 + + +State 242 + + label -> 'import' . (rule 72) + + error reduce using rule 72 + '(' reduce using rule 72 + ')' reduce using rule 72 + '{' reduce using rule 72 + '}' reduce using rule 72 + '[' reduce using rule 72 + ']' reduce using rule 72 + '\}' reduce using rule 72 + '\;' reduce using rule 72 + '<=' reduce using rule 72 + ':' reduce using rule 72 + '::' reduce using rule 72 + '=' reduce using rule 72 + '|' reduce using rule 72 + '`' reduce using rule 72 + '.' reduce using rule 72 + ',' reduce using rule 72 + '_' reduce using rule 72 + '\\' reduce using rule 72 + '-' reduce using rule 72 + '@' reduce using rule 72 + 'ado' reduce using rule 72 + 'as' reduce using rule 72 + 'case' reduce using rule 72 + 'do' reduce using rule 72 + 'else' reduce using rule 72 + 'false' reduce using rule 72 + 'hiding' reduce using rule 72 + 'if' reduce using rule 72 + 'let' reduce using rule 72 + 'nominal' reduce using rule 72 + 'phantom' reduce using rule 72 + 'of' reduce using rule 72 + 'representational'reduce using rule 72 + 'role' reduce using rule 72 + 'then' reduce using rule 72 + 'true' reduce using rule 72 + 'where' reduce using rule 72 + '(..)' reduce using rule 72 + LOWER reduce using rule 72 + QUAL_LOWER reduce using rule 72 + UPPER reduce using rule 72 + QUAL_UPPER reduce using rule 72 + SYMBOL reduce using rule 72 + QUAL_SYMBOL reduce using rule 72 + OPERATOR reduce using rule 72 + QUAL_OPERATOR reduce using rule 72 + LIT_HOLE reduce using rule 72 + LIT_CHAR reduce using rule 72 + LIT_STRING reduce using rule 72 + LIT_RAW_STRING reduce using rule 72 + LIT_INT reduce using rule 72 + LIT_NUMBER reduce using rule 72 + %eof reduce using rule 72 + + +State 243 + + label -> 'if' . (rule 73) + + error reduce using rule 73 + '(' reduce using rule 73 + ')' reduce using rule 73 + '{' reduce using rule 73 + '}' reduce using rule 73 + '[' reduce using rule 73 + ']' reduce using rule 73 + '\}' reduce using rule 73 + '\;' reduce using rule 73 + '<=' reduce using rule 73 + ':' reduce using rule 73 + '::' reduce using rule 73 + '=' reduce using rule 73 + '|' reduce using rule 73 + '`' reduce using rule 73 + '.' reduce using rule 73 + ',' reduce using rule 73 + '_' reduce using rule 73 + '\\' reduce using rule 73 + '-' reduce using rule 73 + '@' reduce using rule 73 + 'ado' reduce using rule 73 + 'as' reduce using rule 73 + 'case' reduce using rule 73 + 'do' reduce using rule 73 + 'else' reduce using rule 73 + 'false' reduce using rule 73 + 'hiding' reduce using rule 73 + 'if' reduce using rule 73 + 'let' reduce using rule 73 + 'nominal' reduce using rule 73 + 'phantom' reduce using rule 73 + 'of' reduce using rule 73 + 'representational'reduce using rule 73 + 'role' reduce using rule 73 + 'then' reduce using rule 73 + 'true' reduce using rule 73 + 'where' reduce using rule 73 + '(..)' reduce using rule 73 + LOWER reduce using rule 73 + QUAL_LOWER reduce using rule 73 + UPPER reduce using rule 73 + QUAL_UPPER reduce using rule 73 + SYMBOL reduce using rule 73 + QUAL_SYMBOL reduce using rule 73 + OPERATOR reduce using rule 73 + QUAL_OPERATOR reduce using rule 73 + LIT_HOLE reduce using rule 73 + LIT_CHAR reduce using rule 73 + LIT_STRING reduce using rule 73 + LIT_RAW_STRING reduce using rule 73 + LIT_INT reduce using rule 73 + LIT_NUMBER reduce using rule 73 + %eof reduce using rule 73 + + +State 244 + + label -> 'in' . (rule 74) + + error reduce using rule 74 + '(' reduce using rule 74 + ')' reduce using rule 74 + '{' reduce using rule 74 + '}' reduce using rule 74 + '[' reduce using rule 74 + ']' reduce using rule 74 + '\}' reduce using rule 74 + '\;' reduce using rule 74 + '<=' reduce using rule 74 + ':' reduce using rule 74 + '::' reduce using rule 74 + '=' reduce using rule 74 + '|' reduce using rule 74 + '`' reduce using rule 74 + '.' reduce using rule 74 + ',' reduce using rule 74 + '_' reduce using rule 74 + '\\' reduce using rule 74 + '-' reduce using rule 74 + '@' reduce using rule 74 + 'ado' reduce using rule 74 + 'as' reduce using rule 74 + 'case' reduce using rule 74 + 'do' reduce using rule 74 + 'else' reduce using rule 74 + 'false' reduce using rule 74 + 'hiding' reduce using rule 74 + 'if' reduce using rule 74 + 'let' reduce using rule 74 + 'nominal' reduce using rule 74 + 'phantom' reduce using rule 74 + 'of' reduce using rule 74 + 'representational'reduce using rule 74 + 'role' reduce using rule 74 + 'then' reduce using rule 74 + 'true' reduce using rule 74 + 'where' reduce using rule 74 + '(..)' reduce using rule 74 + LOWER reduce using rule 74 + QUAL_LOWER reduce using rule 74 + UPPER reduce using rule 74 + QUAL_UPPER reduce using rule 74 + SYMBOL reduce using rule 74 + QUAL_SYMBOL reduce using rule 74 + OPERATOR reduce using rule 74 + QUAL_OPERATOR reduce using rule 74 + LIT_HOLE reduce using rule 74 + LIT_CHAR reduce using rule 74 + LIT_STRING reduce using rule 74 + LIT_RAW_STRING reduce using rule 74 + LIT_INT reduce using rule 74 + LIT_NUMBER reduce using rule 74 + %eof reduce using rule 74 + + +State 245 + + label -> 'infix' . (rule 75) + + error reduce using rule 75 + '(' reduce using rule 75 + ')' reduce using rule 75 + '{' reduce using rule 75 + '}' reduce using rule 75 + '[' reduce using rule 75 + ']' reduce using rule 75 + '\}' reduce using rule 75 + '\;' reduce using rule 75 + '<=' reduce using rule 75 + ':' reduce using rule 75 + '::' reduce using rule 75 + '=' reduce using rule 75 + '|' reduce using rule 75 + '`' reduce using rule 75 + '.' reduce using rule 75 + ',' reduce using rule 75 + '_' reduce using rule 75 + '\\' reduce using rule 75 + '-' reduce using rule 75 + '@' reduce using rule 75 + 'ado' reduce using rule 75 + 'as' reduce using rule 75 + 'case' reduce using rule 75 + 'do' reduce using rule 75 + 'else' reduce using rule 75 + 'false' reduce using rule 75 + 'hiding' reduce using rule 75 + 'if' reduce using rule 75 + 'let' reduce using rule 75 + 'nominal' reduce using rule 75 + 'phantom' reduce using rule 75 + 'of' reduce using rule 75 + 'representational'reduce using rule 75 + 'role' reduce using rule 75 + 'then' reduce using rule 75 + 'true' reduce using rule 75 + 'where' reduce using rule 75 + '(..)' reduce using rule 75 + LOWER reduce using rule 75 + QUAL_LOWER reduce using rule 75 + UPPER reduce using rule 75 + QUAL_UPPER reduce using rule 75 + SYMBOL reduce using rule 75 + QUAL_SYMBOL reduce using rule 75 + OPERATOR reduce using rule 75 + QUAL_OPERATOR reduce using rule 75 + LIT_HOLE reduce using rule 75 + LIT_CHAR reduce using rule 75 + LIT_STRING reduce using rule 75 + LIT_RAW_STRING reduce using rule 75 + LIT_INT reduce using rule 75 + LIT_NUMBER reduce using rule 75 + %eof reduce using rule 75 + + +State 246 + + label -> 'infixl' . (rule 76) + + error reduce using rule 76 + '(' reduce using rule 76 + ')' reduce using rule 76 + '{' reduce using rule 76 + '}' reduce using rule 76 + '[' reduce using rule 76 + ']' reduce using rule 76 + '\}' reduce using rule 76 + '\;' reduce using rule 76 + '<=' reduce using rule 76 + ':' reduce using rule 76 + '::' reduce using rule 76 + '=' reduce using rule 76 + '|' reduce using rule 76 + '`' reduce using rule 76 + '.' reduce using rule 76 + ',' reduce using rule 76 + '_' reduce using rule 76 + '\\' reduce using rule 76 + '-' reduce using rule 76 + '@' reduce using rule 76 + 'ado' reduce using rule 76 + 'as' reduce using rule 76 + 'case' reduce using rule 76 + 'do' reduce using rule 76 + 'else' reduce using rule 76 + 'false' reduce using rule 76 + 'hiding' reduce using rule 76 + 'if' reduce using rule 76 + 'let' reduce using rule 76 + 'nominal' reduce using rule 76 + 'phantom' reduce using rule 76 + 'of' reduce using rule 76 + 'representational'reduce using rule 76 + 'role' reduce using rule 76 + 'then' reduce using rule 76 + 'true' reduce using rule 76 + 'where' reduce using rule 76 + '(..)' reduce using rule 76 + LOWER reduce using rule 76 + QUAL_LOWER reduce using rule 76 + UPPER reduce using rule 76 + QUAL_UPPER reduce using rule 76 + SYMBOL reduce using rule 76 + QUAL_SYMBOL reduce using rule 76 + OPERATOR reduce using rule 76 + QUAL_OPERATOR reduce using rule 76 + LIT_HOLE reduce using rule 76 + LIT_CHAR reduce using rule 76 + LIT_STRING reduce using rule 76 + LIT_RAW_STRING reduce using rule 76 + LIT_INT reduce using rule 76 + LIT_NUMBER reduce using rule 76 + %eof reduce using rule 76 + + +State 247 + + label -> 'infixr' . (rule 77) + + error reduce using rule 77 + '(' reduce using rule 77 + ')' reduce using rule 77 + '{' reduce using rule 77 + '}' reduce using rule 77 + '[' reduce using rule 77 + ']' reduce using rule 77 + '\}' reduce using rule 77 + '\;' reduce using rule 77 + '<=' reduce using rule 77 + ':' reduce using rule 77 + '::' reduce using rule 77 + '=' reduce using rule 77 + '|' reduce using rule 77 + '`' reduce using rule 77 + '.' reduce using rule 77 + ',' reduce using rule 77 + '_' reduce using rule 77 + '\\' reduce using rule 77 + '-' reduce using rule 77 + '@' reduce using rule 77 + 'ado' reduce using rule 77 + 'as' reduce using rule 77 + 'case' reduce using rule 77 + 'do' reduce using rule 77 + 'else' reduce using rule 77 + 'false' reduce using rule 77 + 'hiding' reduce using rule 77 + 'if' reduce using rule 77 + 'let' reduce using rule 77 + 'nominal' reduce using rule 77 + 'phantom' reduce using rule 77 + 'of' reduce using rule 77 + 'representational'reduce using rule 77 + 'role' reduce using rule 77 + 'then' reduce using rule 77 + 'true' reduce using rule 77 + 'where' reduce using rule 77 + '(..)' reduce using rule 77 + LOWER reduce using rule 77 + QUAL_LOWER reduce using rule 77 + UPPER reduce using rule 77 + QUAL_UPPER reduce using rule 77 + SYMBOL reduce using rule 77 + QUAL_SYMBOL reduce using rule 77 + OPERATOR reduce using rule 77 + QUAL_OPERATOR reduce using rule 77 + LIT_HOLE reduce using rule 77 + LIT_CHAR reduce using rule 77 + LIT_STRING reduce using rule 77 + LIT_RAW_STRING reduce using rule 77 + LIT_INT reduce using rule 77 + LIT_NUMBER reduce using rule 77 + %eof reduce using rule 77 + + +State 248 + + label -> 'instance' . (rule 78) + + error reduce using rule 78 + '(' reduce using rule 78 + ')' reduce using rule 78 + '{' reduce using rule 78 + '}' reduce using rule 78 + '[' reduce using rule 78 + ']' reduce using rule 78 + '\}' reduce using rule 78 + '\;' reduce using rule 78 + '<=' reduce using rule 78 + ':' reduce using rule 78 + '::' reduce using rule 78 + '=' reduce using rule 78 + '|' reduce using rule 78 + '`' reduce using rule 78 + '.' reduce using rule 78 + ',' reduce using rule 78 + '_' reduce using rule 78 + '\\' reduce using rule 78 + '-' reduce using rule 78 + '@' reduce using rule 78 + 'ado' reduce using rule 78 + 'as' reduce using rule 78 + 'case' reduce using rule 78 + 'do' reduce using rule 78 + 'else' reduce using rule 78 + 'false' reduce using rule 78 + 'hiding' reduce using rule 78 + 'if' reduce using rule 78 + 'let' reduce using rule 78 + 'nominal' reduce using rule 78 + 'phantom' reduce using rule 78 + 'of' reduce using rule 78 + 'representational'reduce using rule 78 + 'role' reduce using rule 78 + 'then' reduce using rule 78 + 'true' reduce using rule 78 + 'where' reduce using rule 78 + '(..)' reduce using rule 78 + LOWER reduce using rule 78 + QUAL_LOWER reduce using rule 78 + UPPER reduce using rule 78 + QUAL_UPPER reduce using rule 78 + SYMBOL reduce using rule 78 + QUAL_SYMBOL reduce using rule 78 + OPERATOR reduce using rule 78 + QUAL_OPERATOR reduce using rule 78 + LIT_HOLE reduce using rule 78 + LIT_CHAR reduce using rule 78 + LIT_STRING reduce using rule 78 + LIT_RAW_STRING reduce using rule 78 + LIT_INT reduce using rule 78 + LIT_NUMBER reduce using rule 78 + %eof reduce using rule 78 + + +State 249 + + label -> 'let' . (rule 79) + + error reduce using rule 79 + '(' reduce using rule 79 + ')' reduce using rule 79 + '{' reduce using rule 79 + '}' reduce using rule 79 + '[' reduce using rule 79 + ']' reduce using rule 79 + '\}' reduce using rule 79 + '\;' reduce using rule 79 + '<=' reduce using rule 79 + ':' reduce using rule 79 + '::' reduce using rule 79 + '=' reduce using rule 79 + '|' reduce using rule 79 + '`' reduce using rule 79 + '.' reduce using rule 79 + ',' reduce using rule 79 + '_' reduce using rule 79 + '\\' reduce using rule 79 + '-' reduce using rule 79 + '@' reduce using rule 79 + 'ado' reduce using rule 79 + 'as' reduce using rule 79 + 'case' reduce using rule 79 + 'do' reduce using rule 79 + 'else' reduce using rule 79 + 'false' reduce using rule 79 + 'hiding' reduce using rule 79 + 'if' reduce using rule 79 + 'let' reduce using rule 79 + 'nominal' reduce using rule 79 + 'phantom' reduce using rule 79 + 'of' reduce using rule 79 + 'representational'reduce using rule 79 + 'role' reduce using rule 79 + 'then' reduce using rule 79 + 'true' reduce using rule 79 + 'where' reduce using rule 79 + '(..)' reduce using rule 79 + LOWER reduce using rule 79 + QUAL_LOWER reduce using rule 79 + UPPER reduce using rule 79 + QUAL_UPPER reduce using rule 79 + SYMBOL reduce using rule 79 + QUAL_SYMBOL reduce using rule 79 + OPERATOR reduce using rule 79 + QUAL_OPERATOR reduce using rule 79 + LIT_HOLE reduce using rule 79 + LIT_CHAR reduce using rule 79 + LIT_STRING reduce using rule 79 + LIT_RAW_STRING reduce using rule 79 + LIT_INT reduce using rule 79 + LIT_NUMBER reduce using rule 79 + %eof reduce using rule 79 + + +State 250 + + label -> 'module' . (rule 80) + + error reduce using rule 80 + '(' reduce using rule 80 + ')' reduce using rule 80 + '{' reduce using rule 80 + '}' reduce using rule 80 + '[' reduce using rule 80 + ']' reduce using rule 80 + '\}' reduce using rule 80 + '\;' reduce using rule 80 + '<=' reduce using rule 80 + ':' reduce using rule 80 + '::' reduce using rule 80 + '=' reduce using rule 80 + '|' reduce using rule 80 + '`' reduce using rule 80 + '.' reduce using rule 80 + ',' reduce using rule 80 + '_' reduce using rule 80 + '\\' reduce using rule 80 + '-' reduce using rule 80 + '@' reduce using rule 80 + 'ado' reduce using rule 80 + 'as' reduce using rule 80 + 'case' reduce using rule 80 + 'do' reduce using rule 80 + 'else' reduce using rule 80 + 'false' reduce using rule 80 + 'hiding' reduce using rule 80 + 'if' reduce using rule 80 + 'let' reduce using rule 80 + 'nominal' reduce using rule 80 + 'phantom' reduce using rule 80 + 'of' reduce using rule 80 + 'representational'reduce using rule 80 + 'role' reduce using rule 80 + 'then' reduce using rule 80 + 'true' reduce using rule 80 + 'where' reduce using rule 80 + '(..)' reduce using rule 80 + LOWER reduce using rule 80 + QUAL_LOWER reduce using rule 80 + UPPER reduce using rule 80 + QUAL_UPPER reduce using rule 80 + SYMBOL reduce using rule 80 + QUAL_SYMBOL reduce using rule 80 + OPERATOR reduce using rule 80 + QUAL_OPERATOR reduce using rule 80 + LIT_HOLE reduce using rule 80 + LIT_CHAR reduce using rule 80 + LIT_STRING reduce using rule 80 + LIT_RAW_STRING reduce using rule 80 + LIT_INT reduce using rule 80 + LIT_NUMBER reduce using rule 80 + %eof reduce using rule 80 + + +State 251 + + label -> 'newtype' . (rule 81) + + error reduce using rule 81 + '(' reduce using rule 81 + ')' reduce using rule 81 + '{' reduce using rule 81 + '}' reduce using rule 81 + '[' reduce using rule 81 + ']' reduce using rule 81 + '\}' reduce using rule 81 + '\;' reduce using rule 81 + '<=' reduce using rule 81 + ':' reduce using rule 81 + '::' reduce using rule 81 + '=' reduce using rule 81 + '|' reduce using rule 81 + '`' reduce using rule 81 + '.' reduce using rule 81 + ',' reduce using rule 81 + '_' reduce using rule 81 + '\\' reduce using rule 81 + '-' reduce using rule 81 + '@' reduce using rule 81 + 'ado' reduce using rule 81 + 'as' reduce using rule 81 + 'case' reduce using rule 81 + 'do' reduce using rule 81 + 'else' reduce using rule 81 + 'false' reduce using rule 81 + 'hiding' reduce using rule 81 + 'if' reduce using rule 81 + 'let' reduce using rule 81 + 'nominal' reduce using rule 81 + 'phantom' reduce using rule 81 + 'of' reduce using rule 81 + 'representational'reduce using rule 81 + 'role' reduce using rule 81 + 'then' reduce using rule 81 + 'true' reduce using rule 81 + 'where' reduce using rule 81 + '(..)' reduce using rule 81 + LOWER reduce using rule 81 + QUAL_LOWER reduce using rule 81 + UPPER reduce using rule 81 + QUAL_UPPER reduce using rule 81 + SYMBOL reduce using rule 81 + QUAL_SYMBOL reduce using rule 81 + OPERATOR reduce using rule 81 + QUAL_OPERATOR reduce using rule 81 + LIT_HOLE reduce using rule 81 + LIT_CHAR reduce using rule 81 + LIT_STRING reduce using rule 81 + LIT_RAW_STRING reduce using rule 81 + LIT_INT reduce using rule 81 + LIT_NUMBER reduce using rule 81 + %eof reduce using rule 81 + + +State 252 + + label -> 'nominal' . (rule 82) + + error reduce using rule 82 + '(' reduce using rule 82 + ')' reduce using rule 82 + '{' reduce using rule 82 + '}' reduce using rule 82 + '[' reduce using rule 82 + ']' reduce using rule 82 + '\}' reduce using rule 82 + '\;' reduce using rule 82 + '<=' reduce using rule 82 + ':' reduce using rule 82 + '::' reduce using rule 82 + '=' reduce using rule 82 + '|' reduce using rule 82 + '`' reduce using rule 82 + '.' reduce using rule 82 + ',' reduce using rule 82 + '_' reduce using rule 82 + '\\' reduce using rule 82 + '-' reduce using rule 82 + '@' reduce using rule 82 + 'ado' reduce using rule 82 + 'as' reduce using rule 82 + 'case' reduce using rule 82 + 'do' reduce using rule 82 + 'else' reduce using rule 82 + 'false' reduce using rule 82 + 'hiding' reduce using rule 82 + 'if' reduce using rule 82 + 'let' reduce using rule 82 + 'nominal' reduce using rule 82 + 'phantom' reduce using rule 82 + 'of' reduce using rule 82 + 'representational'reduce using rule 82 + 'role' reduce using rule 82 + 'then' reduce using rule 82 + 'true' reduce using rule 82 + 'where' reduce using rule 82 + '(..)' reduce using rule 82 + LOWER reduce using rule 82 + QUAL_LOWER reduce using rule 82 + UPPER reduce using rule 82 + QUAL_UPPER reduce using rule 82 + SYMBOL reduce using rule 82 + QUAL_SYMBOL reduce using rule 82 + OPERATOR reduce using rule 82 + QUAL_OPERATOR reduce using rule 82 + LIT_HOLE reduce using rule 82 + LIT_CHAR reduce using rule 82 + LIT_STRING reduce using rule 82 + LIT_RAW_STRING reduce using rule 82 + LIT_INT reduce using rule 82 + LIT_NUMBER reduce using rule 82 + %eof reduce using rule 82 + + +State 253 + + label -> 'phantom' . (rule 84) + + error reduce using rule 84 + '(' reduce using rule 84 + ')' reduce using rule 84 + '{' reduce using rule 84 + '}' reduce using rule 84 + '[' reduce using rule 84 + ']' reduce using rule 84 + '\}' reduce using rule 84 + '\;' reduce using rule 84 + '<=' reduce using rule 84 + ':' reduce using rule 84 + '::' reduce using rule 84 + '=' reduce using rule 84 + '|' reduce using rule 84 + '`' reduce using rule 84 + '.' reduce using rule 84 + ',' reduce using rule 84 + '_' reduce using rule 84 + '\\' reduce using rule 84 + '-' reduce using rule 84 + '@' reduce using rule 84 + 'ado' reduce using rule 84 + 'as' reduce using rule 84 + 'case' reduce using rule 84 + 'do' reduce using rule 84 + 'else' reduce using rule 84 + 'false' reduce using rule 84 + 'hiding' reduce using rule 84 + 'if' reduce using rule 84 + 'let' reduce using rule 84 + 'nominal' reduce using rule 84 + 'phantom' reduce using rule 84 + 'of' reduce using rule 84 + 'representational'reduce using rule 84 + 'role' reduce using rule 84 + 'then' reduce using rule 84 + 'true' reduce using rule 84 + 'where' reduce using rule 84 + '(..)' reduce using rule 84 + LOWER reduce using rule 84 + QUAL_LOWER reduce using rule 84 + UPPER reduce using rule 84 + QUAL_UPPER reduce using rule 84 + SYMBOL reduce using rule 84 + QUAL_SYMBOL reduce using rule 84 + OPERATOR reduce using rule 84 + QUAL_OPERATOR reduce using rule 84 + LIT_HOLE reduce using rule 84 + LIT_CHAR reduce using rule 84 + LIT_STRING reduce using rule 84 + LIT_RAW_STRING reduce using rule 84 + LIT_INT reduce using rule 84 + LIT_NUMBER reduce using rule 84 + %eof reduce using rule 84 + + +State 254 + + label -> 'of' . (rule 83) + + error reduce using rule 83 + '(' reduce using rule 83 + ')' reduce using rule 83 + '{' reduce using rule 83 + '}' reduce using rule 83 + '[' reduce using rule 83 + ']' reduce using rule 83 + '\}' reduce using rule 83 + '\;' reduce using rule 83 + '<=' reduce using rule 83 + ':' reduce using rule 83 + '::' reduce using rule 83 + '=' reduce using rule 83 + '|' reduce using rule 83 + '`' reduce using rule 83 + '.' reduce using rule 83 + ',' reduce using rule 83 + '_' reduce using rule 83 + '\\' reduce using rule 83 + '-' reduce using rule 83 + '@' reduce using rule 83 + 'ado' reduce using rule 83 + 'as' reduce using rule 83 + 'case' reduce using rule 83 + 'do' reduce using rule 83 + 'else' reduce using rule 83 + 'false' reduce using rule 83 + 'hiding' reduce using rule 83 + 'if' reduce using rule 83 + 'let' reduce using rule 83 + 'nominal' reduce using rule 83 + 'phantom' reduce using rule 83 + 'of' reduce using rule 83 + 'representational'reduce using rule 83 + 'role' reduce using rule 83 + 'then' reduce using rule 83 + 'true' reduce using rule 83 + 'where' reduce using rule 83 + '(..)' reduce using rule 83 + LOWER reduce using rule 83 + QUAL_LOWER reduce using rule 83 + UPPER reduce using rule 83 + QUAL_UPPER reduce using rule 83 + SYMBOL reduce using rule 83 + QUAL_SYMBOL reduce using rule 83 + OPERATOR reduce using rule 83 + QUAL_OPERATOR reduce using rule 83 + LIT_HOLE reduce using rule 83 + LIT_CHAR reduce using rule 83 + LIT_STRING reduce using rule 83 + LIT_RAW_STRING reduce using rule 83 + LIT_INT reduce using rule 83 + LIT_NUMBER reduce using rule 83 + %eof reduce using rule 83 + + +State 255 + + label -> 'representational' . (rule 85) + + error reduce using rule 85 + '(' reduce using rule 85 + ')' reduce using rule 85 + '{' reduce using rule 85 + '}' reduce using rule 85 + '[' reduce using rule 85 + ']' reduce using rule 85 + '\}' reduce using rule 85 + '\;' reduce using rule 85 + '<=' reduce using rule 85 + ':' reduce using rule 85 + '::' reduce using rule 85 + '=' reduce using rule 85 + '|' reduce using rule 85 + '`' reduce using rule 85 + '.' reduce using rule 85 + ',' reduce using rule 85 + '_' reduce using rule 85 + '\\' reduce using rule 85 + '-' reduce using rule 85 + '@' reduce using rule 85 + 'ado' reduce using rule 85 + 'as' reduce using rule 85 + 'case' reduce using rule 85 + 'do' reduce using rule 85 + 'else' reduce using rule 85 + 'false' reduce using rule 85 + 'hiding' reduce using rule 85 + 'if' reduce using rule 85 + 'let' reduce using rule 85 + 'nominal' reduce using rule 85 + 'phantom' reduce using rule 85 + 'of' reduce using rule 85 + 'representational'reduce using rule 85 + 'role' reduce using rule 85 + 'then' reduce using rule 85 + 'true' reduce using rule 85 + 'where' reduce using rule 85 + '(..)' reduce using rule 85 + LOWER reduce using rule 85 + QUAL_LOWER reduce using rule 85 + UPPER reduce using rule 85 + QUAL_UPPER reduce using rule 85 + SYMBOL reduce using rule 85 + QUAL_SYMBOL reduce using rule 85 + OPERATOR reduce using rule 85 + QUAL_OPERATOR reduce using rule 85 + LIT_HOLE reduce using rule 85 + LIT_CHAR reduce using rule 85 + LIT_STRING reduce using rule 85 + LIT_RAW_STRING reduce using rule 85 + LIT_INT reduce using rule 85 + LIT_NUMBER reduce using rule 85 + %eof reduce using rule 85 + + +State 256 + + label -> 'role' . (rule 86) + + error reduce using rule 86 + '(' reduce using rule 86 + ')' reduce using rule 86 + '{' reduce using rule 86 + '}' reduce using rule 86 + '[' reduce using rule 86 + ']' reduce using rule 86 + '\}' reduce using rule 86 + '\;' reduce using rule 86 + '<=' reduce using rule 86 + ':' reduce using rule 86 + '::' reduce using rule 86 + '=' reduce using rule 86 + '|' reduce using rule 86 + '`' reduce using rule 86 + '.' reduce using rule 86 + ',' reduce using rule 86 + '_' reduce using rule 86 + '\\' reduce using rule 86 + '-' reduce using rule 86 + '@' reduce using rule 86 + 'ado' reduce using rule 86 + 'as' reduce using rule 86 + 'case' reduce using rule 86 + 'do' reduce using rule 86 + 'else' reduce using rule 86 + 'false' reduce using rule 86 + 'hiding' reduce using rule 86 + 'if' reduce using rule 86 + 'let' reduce using rule 86 + 'nominal' reduce using rule 86 + 'phantom' reduce using rule 86 + 'of' reduce using rule 86 + 'representational'reduce using rule 86 + 'role' reduce using rule 86 + 'then' reduce using rule 86 + 'true' reduce using rule 86 + 'where' reduce using rule 86 + '(..)' reduce using rule 86 + LOWER reduce using rule 86 + QUAL_LOWER reduce using rule 86 + UPPER reduce using rule 86 + QUAL_UPPER reduce using rule 86 + SYMBOL reduce using rule 86 + QUAL_SYMBOL reduce using rule 86 + OPERATOR reduce using rule 86 + QUAL_OPERATOR reduce using rule 86 + LIT_HOLE reduce using rule 86 + LIT_CHAR reduce using rule 86 + LIT_STRING reduce using rule 86 + LIT_RAW_STRING reduce using rule 86 + LIT_INT reduce using rule 86 + LIT_NUMBER reduce using rule 86 + %eof reduce using rule 86 + + +State 257 + + label -> 'then' . (rule 87) + + error reduce using rule 87 + '(' reduce using rule 87 + ')' reduce using rule 87 + '{' reduce using rule 87 + '}' reduce using rule 87 + '[' reduce using rule 87 + ']' reduce using rule 87 + '\}' reduce using rule 87 + '\;' reduce using rule 87 + '<=' reduce using rule 87 + ':' reduce using rule 87 + '::' reduce using rule 87 + '=' reduce using rule 87 + '|' reduce using rule 87 + '`' reduce using rule 87 + '.' reduce using rule 87 + ',' reduce using rule 87 + '_' reduce using rule 87 + '\\' reduce using rule 87 + '-' reduce using rule 87 + '@' reduce using rule 87 + 'ado' reduce using rule 87 + 'as' reduce using rule 87 + 'case' reduce using rule 87 + 'do' reduce using rule 87 + 'else' reduce using rule 87 + 'false' reduce using rule 87 + 'hiding' reduce using rule 87 + 'if' reduce using rule 87 + 'let' reduce using rule 87 + 'nominal' reduce using rule 87 + 'phantom' reduce using rule 87 + 'of' reduce using rule 87 + 'representational'reduce using rule 87 + 'role' reduce using rule 87 + 'then' reduce using rule 87 + 'true' reduce using rule 87 + 'where' reduce using rule 87 + '(..)' reduce using rule 87 + LOWER reduce using rule 87 + QUAL_LOWER reduce using rule 87 + UPPER reduce using rule 87 + QUAL_UPPER reduce using rule 87 + SYMBOL reduce using rule 87 + QUAL_SYMBOL reduce using rule 87 + OPERATOR reduce using rule 87 + QUAL_OPERATOR reduce using rule 87 + LIT_HOLE reduce using rule 87 + LIT_CHAR reduce using rule 87 + LIT_STRING reduce using rule 87 + LIT_RAW_STRING reduce using rule 87 + LIT_INT reduce using rule 87 + LIT_NUMBER reduce using rule 87 + %eof reduce using rule 87 + + +State 258 + + label -> 'true' . (rule 88) + + error reduce using rule 88 + '(' reduce using rule 88 + ')' reduce using rule 88 + '{' reduce using rule 88 + '}' reduce using rule 88 + '[' reduce using rule 88 + ']' reduce using rule 88 + '\}' reduce using rule 88 + '\;' reduce using rule 88 + '<=' reduce using rule 88 + ':' reduce using rule 88 + '::' reduce using rule 88 + '=' reduce using rule 88 + '|' reduce using rule 88 + '`' reduce using rule 88 + '.' reduce using rule 88 + ',' reduce using rule 88 + '_' reduce using rule 88 + '\\' reduce using rule 88 + '-' reduce using rule 88 + '@' reduce using rule 88 + 'ado' reduce using rule 88 + 'as' reduce using rule 88 + 'case' reduce using rule 88 + 'do' reduce using rule 88 + 'else' reduce using rule 88 + 'false' reduce using rule 88 + 'hiding' reduce using rule 88 + 'if' reduce using rule 88 + 'let' reduce using rule 88 + 'nominal' reduce using rule 88 + 'phantom' reduce using rule 88 + 'of' reduce using rule 88 + 'representational'reduce using rule 88 + 'role' reduce using rule 88 + 'then' reduce using rule 88 + 'true' reduce using rule 88 + 'where' reduce using rule 88 + '(..)' reduce using rule 88 + LOWER reduce using rule 88 + QUAL_LOWER reduce using rule 88 + UPPER reduce using rule 88 + QUAL_UPPER reduce using rule 88 + SYMBOL reduce using rule 88 + QUAL_SYMBOL reduce using rule 88 + OPERATOR reduce using rule 88 + QUAL_OPERATOR reduce using rule 88 + LIT_HOLE reduce using rule 88 + LIT_CHAR reduce using rule 88 + LIT_STRING reduce using rule 88 + LIT_RAW_STRING reduce using rule 88 + LIT_INT reduce using rule 88 + LIT_NUMBER reduce using rule 88 + %eof reduce using rule 88 + + +State 259 + + label -> 'type' . (rule 89) + + error reduce using rule 89 + '(' reduce using rule 89 + ')' reduce using rule 89 + '{' reduce using rule 89 + '}' reduce using rule 89 + '[' reduce using rule 89 + ']' reduce using rule 89 + '\}' reduce using rule 89 + '\;' reduce using rule 89 + '<=' reduce using rule 89 + ':' reduce using rule 89 + '::' reduce using rule 89 + '=' reduce using rule 89 + '|' reduce using rule 89 + '`' reduce using rule 89 + '.' reduce using rule 89 + ',' reduce using rule 89 + '_' reduce using rule 89 + '\\' reduce using rule 89 + '-' reduce using rule 89 + '@' reduce using rule 89 + 'ado' reduce using rule 89 + 'as' reduce using rule 89 + 'case' reduce using rule 89 + 'do' reduce using rule 89 + 'else' reduce using rule 89 + 'false' reduce using rule 89 + 'hiding' reduce using rule 89 + 'if' reduce using rule 89 + 'let' reduce using rule 89 + 'nominal' reduce using rule 89 + 'phantom' reduce using rule 89 + 'of' reduce using rule 89 + 'representational'reduce using rule 89 + 'role' reduce using rule 89 + 'then' reduce using rule 89 + 'true' reduce using rule 89 + 'where' reduce using rule 89 + '(..)' reduce using rule 89 + LOWER reduce using rule 89 + QUAL_LOWER reduce using rule 89 + UPPER reduce using rule 89 + QUAL_UPPER reduce using rule 89 + SYMBOL reduce using rule 89 + QUAL_SYMBOL reduce using rule 89 + OPERATOR reduce using rule 89 + QUAL_OPERATOR reduce using rule 89 + LIT_HOLE reduce using rule 89 + LIT_CHAR reduce using rule 89 + LIT_STRING reduce using rule 89 + LIT_RAW_STRING reduce using rule 89 + LIT_INT reduce using rule 89 + LIT_NUMBER reduce using rule 89 + %eof reduce using rule 89 + + +State 260 + + label -> 'where' . (rule 90) + + error reduce using rule 90 + '(' reduce using rule 90 + ')' reduce using rule 90 + '{' reduce using rule 90 + '}' reduce using rule 90 + '[' reduce using rule 90 + ']' reduce using rule 90 + '\}' reduce using rule 90 + '\;' reduce using rule 90 + '<=' reduce using rule 90 + ':' reduce using rule 90 + '::' reduce using rule 90 + '=' reduce using rule 90 + '|' reduce using rule 90 + '`' reduce using rule 90 + '.' reduce using rule 90 + ',' reduce using rule 90 + '_' reduce using rule 90 + '\\' reduce using rule 90 + '-' reduce using rule 90 + '@' reduce using rule 90 + 'ado' reduce using rule 90 + 'as' reduce using rule 90 + 'case' reduce using rule 90 + 'do' reduce using rule 90 + 'else' reduce using rule 90 + 'false' reduce using rule 90 + 'hiding' reduce using rule 90 + 'if' reduce using rule 90 + 'let' reduce using rule 90 + 'nominal' reduce using rule 90 + 'phantom' reduce using rule 90 + 'of' reduce using rule 90 + 'representational'reduce using rule 90 + 'role' reduce using rule 90 + 'then' reduce using rule 90 + 'true' reduce using rule 90 + 'where' reduce using rule 90 + '(..)' reduce using rule 90 + LOWER reduce using rule 90 + QUAL_LOWER reduce using rule 90 + UPPER reduce using rule 90 + QUAL_UPPER reduce using rule 90 + SYMBOL reduce using rule 90 + QUAL_SYMBOL reduce using rule 90 + OPERATOR reduce using rule 90 + QUAL_OPERATOR reduce using rule 90 + LIT_HOLE reduce using rule 90 + LIT_CHAR reduce using rule 90 + LIT_STRING reduce using rule 90 + LIT_RAW_STRING reduce using rule 90 + LIT_INT reduce using rule 90 + LIT_NUMBER reduce using rule 90 + %eof reduce using rule 90 + + +State 261 + + label -> LOWER . (rule 57) + + error reduce using rule 57 + '(' reduce using rule 57 + ')' reduce using rule 57 + '{' reduce using rule 57 + '}' reduce using rule 57 + '[' reduce using rule 57 + ']' reduce using rule 57 + '\}' reduce using rule 57 + '\;' reduce using rule 57 + '<=' reduce using rule 57 + ':' reduce using rule 57 + '::' reduce using rule 57 + '=' reduce using rule 57 + '|' reduce using rule 57 + '`' reduce using rule 57 + '.' reduce using rule 57 + ',' reduce using rule 57 + '_' reduce using rule 57 + '\\' reduce using rule 57 + '-' reduce using rule 57 + '@' reduce using rule 57 + 'ado' reduce using rule 57 + 'as' reduce using rule 57 + 'case' reduce using rule 57 + 'do' reduce using rule 57 + 'else' reduce using rule 57 + 'false' reduce using rule 57 + 'hiding' reduce using rule 57 + 'if' reduce using rule 57 + 'let' reduce using rule 57 + 'nominal' reduce using rule 57 + 'phantom' reduce using rule 57 + 'of' reduce using rule 57 + 'representational'reduce using rule 57 + 'role' reduce using rule 57 + 'then' reduce using rule 57 + 'true' reduce using rule 57 + 'where' reduce using rule 57 + '(..)' reduce using rule 57 + LOWER reduce using rule 57 + QUAL_LOWER reduce using rule 57 + UPPER reduce using rule 57 + QUAL_UPPER reduce using rule 57 + SYMBOL reduce using rule 57 + QUAL_SYMBOL reduce using rule 57 + OPERATOR reduce using rule 57 + QUAL_OPERATOR reduce using rule 57 + LIT_HOLE reduce using rule 57 + LIT_CHAR reduce using rule 57 + LIT_STRING reduce using rule 57 + LIT_RAW_STRING reduce using rule 57 + LIT_INT reduce using rule 57 + LIT_NUMBER reduce using rule 57 + %eof reduce using rule 57 + + +State 262 + + label -> LIT_STRING . (rule 58) + + error reduce using rule 58 + '(' reduce using rule 58 + ')' reduce using rule 58 + '{' reduce using rule 58 + '}' reduce using rule 58 + '[' reduce using rule 58 + ']' reduce using rule 58 + '\}' reduce using rule 58 + '\;' reduce using rule 58 + '<=' reduce using rule 58 + ':' reduce using rule 58 + '::' reduce using rule 58 + '=' reduce using rule 58 + '|' reduce using rule 58 + '`' reduce using rule 58 + '.' reduce using rule 58 + ',' reduce using rule 58 + '_' reduce using rule 58 + '\\' reduce using rule 58 + '-' reduce using rule 58 + '@' reduce using rule 58 + 'ado' reduce using rule 58 + 'as' reduce using rule 58 + 'case' reduce using rule 58 + 'do' reduce using rule 58 + 'else' reduce using rule 58 + 'false' reduce using rule 58 + 'hiding' reduce using rule 58 + 'if' reduce using rule 58 + 'let' reduce using rule 58 + 'nominal' reduce using rule 58 + 'phantom' reduce using rule 58 + 'of' reduce using rule 58 + 'representational'reduce using rule 58 + 'role' reduce using rule 58 + 'then' reduce using rule 58 + 'true' reduce using rule 58 + 'where' reduce using rule 58 + '(..)' reduce using rule 58 + LOWER reduce using rule 58 + QUAL_LOWER reduce using rule 58 + UPPER reduce using rule 58 + QUAL_UPPER reduce using rule 58 + SYMBOL reduce using rule 58 + QUAL_SYMBOL reduce using rule 58 + OPERATOR reduce using rule 58 + QUAL_OPERATOR reduce using rule 58 + LIT_HOLE reduce using rule 58 + LIT_CHAR reduce using rule 58 + LIT_STRING reduce using rule 58 + LIT_RAW_STRING reduce using rule 58 + LIT_INT reduce using rule 58 + LIT_NUMBER reduce using rule 58 + %eof reduce using rule 58 + + +State 263 + + label -> LIT_RAW_STRING . (rule 59) + + error reduce using rule 59 + '(' reduce using rule 59 + ')' reduce using rule 59 + '{' reduce using rule 59 + '}' reduce using rule 59 + '[' reduce using rule 59 + ']' reduce using rule 59 + '\}' reduce using rule 59 + '\;' reduce using rule 59 + '<=' reduce using rule 59 + ':' reduce using rule 59 + '::' reduce using rule 59 + '=' reduce using rule 59 + '|' reduce using rule 59 + '`' reduce using rule 59 + '.' reduce using rule 59 + ',' reduce using rule 59 + '_' reduce using rule 59 + '\\' reduce using rule 59 + '-' reduce using rule 59 + '@' reduce using rule 59 + 'ado' reduce using rule 59 + 'as' reduce using rule 59 + 'case' reduce using rule 59 + 'do' reduce using rule 59 + 'else' reduce using rule 59 + 'false' reduce using rule 59 + 'hiding' reduce using rule 59 + 'if' reduce using rule 59 + 'let' reduce using rule 59 + 'nominal' reduce using rule 59 + 'phantom' reduce using rule 59 + 'of' reduce using rule 59 + 'representational'reduce using rule 59 + 'role' reduce using rule 59 + 'then' reduce using rule 59 + 'true' reduce using rule 59 + 'where' reduce using rule 59 + '(..)' reduce using rule 59 + LOWER reduce using rule 59 + QUAL_LOWER reduce using rule 59 + UPPER reduce using rule 59 + QUAL_UPPER reduce using rule 59 + SYMBOL reduce using rule 59 + QUAL_SYMBOL reduce using rule 59 + OPERATOR reduce using rule 59 + QUAL_OPERATOR reduce using rule 59 + LIT_HOLE reduce using rule 59 + LIT_CHAR reduce using rule 59 + LIT_STRING reduce using rule 59 + LIT_RAW_STRING reduce using rule 59 + LIT_INT reduce using rule 59 + LIT_NUMBER reduce using rule 59 + %eof reduce using rule 59 + + +State 264 + + typeAtom -> qualProperName . (rule 115) + typeKindedAtom -> qualProperName . (rule 126) + + '(' reduce using rule 115 + ')' reduce using rule 115 + '{' reduce using rule 115 + '->' reduce using rule 115 + '<=' reduce using rule 115 + '=>' reduce using rule 115 + ':' reduce using rule 115 + '::' reduce using rule 126 + '_' reduce using rule 115 + '-' reduce using rule 115 + 'as' reduce using rule 115 + 'hiding' reduce using rule 115 + 'nominal' reduce using rule 115 + 'phantom' reduce using rule 115 + 'representational'reduce using rule 115 + 'role' reduce using rule 115 + '(->)' reduce using rule 115 + '(..)' reduce using rule 115 + LOWER reduce using rule 115 + UPPER reduce using rule 115 + QUAL_UPPER reduce using rule 115 + SYMBOL reduce using rule 115 + QUAL_SYMBOL reduce using rule 115 + OPERATOR reduce using rule 115 + QUAL_OPERATOR reduce using rule 115 + LIT_HOLE reduce using rule 115 + LIT_STRING reduce using rule 115 + LIT_RAW_STRING reduce using rule 115 + LIT_INT reduce using rule 115 + + +State 265 + + typeAtom -> qualSymbol . (rule 116) + typeKindedAtom -> qualSymbol . (rule 127) + + '(' reduce using rule 116 + ')' reduce using rule 116 + '{' reduce using rule 116 + '->' reduce using rule 116 + '<=' reduce using rule 116 + '=>' reduce using rule 116 + ':' reduce using rule 116 + '::' reduce using rule 127 + '_' reduce using rule 116 + '-' reduce using rule 116 + 'as' reduce using rule 116 + 'hiding' reduce using rule 116 + 'nominal' reduce using rule 116 + 'phantom' reduce using rule 116 + 'representational'reduce using rule 116 + 'role' reduce using rule 116 + '(->)' reduce using rule 116 + '(..)' reduce using rule 116 + LOWER reduce using rule 116 + UPPER reduce using rule 116 + QUAL_UPPER reduce using rule 116 + SYMBOL reduce using rule 116 + QUAL_SYMBOL reduce using rule 116 + OPERATOR reduce using rule 116 + QUAL_OPERATOR reduce using rule 116 + LIT_HOLE reduce using rule 116 + LIT_STRING reduce using rule 116 + LIT_RAW_STRING reduce using rule 116 + LIT_INT reduce using rule 116 + + +State 266 + + typeAtom -> hole . (rule 119) + typeKindedAtom -> hole . (rule 129) + + '(' reduce using rule 119 + ')' reduce using rule 119 + '{' reduce using rule 119 + '->' reduce using rule 119 + '<=' reduce using rule 119 + '=>' reduce using rule 119 + ':' reduce using rule 119 + '::' reduce using rule 129 + '_' reduce using rule 119 + '-' reduce using rule 119 + 'as' reduce using rule 119 + 'hiding' reduce using rule 119 + 'nominal' reduce using rule 119 + 'phantom' reduce using rule 119 + 'representational'reduce using rule 119 + 'role' reduce using rule 119 + '(->)' reduce using rule 119 + '(..)' reduce using rule 119 + LOWER reduce using rule 119 + UPPER reduce using rule 119 + QUAL_UPPER reduce using rule 119 + SYMBOL reduce using rule 119 + QUAL_SYMBOL reduce using rule 119 + OPERATOR reduce using rule 119 + QUAL_OPERATOR reduce using rule 119 + LIT_HOLE reduce using rule 119 + LIT_STRING reduce using rule 119 + LIT_RAW_STRING reduce using rule 119 + LIT_INT reduce using rule 119 + + +State 267 + + typeAtom -> int . (rule 118) + typeKindedAtom -> int . (rule 128) + + '(' reduce using rule 118 + ')' reduce using rule 118 + '{' reduce using rule 118 + '->' reduce using rule 118 + '<=' reduce using rule 118 + '=>' reduce using rule 118 + ':' reduce using rule 118 + '::' reduce using rule 128 + '_' reduce using rule 118 + '-' reduce using rule 118 + 'as' reduce using rule 118 + 'hiding' reduce using rule 118 + 'nominal' reduce using rule 118 + 'phantom' reduce using rule 118 + 'representational'reduce using rule 118 + 'role' reduce using rule 118 + '(->)' reduce using rule 118 + '(..)' reduce using rule 118 + LOWER reduce using rule 118 + UPPER reduce using rule 118 + QUAL_UPPER reduce using rule 118 + SYMBOL reduce using rule 118 + QUAL_SYMBOL reduce using rule 118 + OPERATOR reduce using rule 118 + QUAL_OPERATOR reduce using rule 118 + LIT_HOLE reduce using rule 118 + LIT_STRING reduce using rule 118 + LIT_RAW_STRING reduce using rule 118 + LIT_INT reduce using rule 118 + + +State 268 + + typeAtom -> '(' type1 . ')' (rule 123) + + ')' shift, and enter state 421 + + +State 269 + + typeAtom -> '(' typeKindedAtom . '::' type ')' (rule 124) + + '::' shift, and enter state 420 + + +State 270 + + typeAtom -> '(' row . ')' (rule 122) + + ')' shift, and enter state 419 + + +State 271 + + typeAtom -> '(' . row ')' (rule 122) + typeAtom -> '(' . type1 ')' (rule 123) + typeAtom -> '(' . typeKindedAtom '::' type ')' (rule 124) + typeKindedAtom -> '(' . row ')' (rule 131) + typeKindedAtom -> '(' . type1 ')' (rule 132) + typeKindedAtom -> '(' . typeKindedAtom '::' type ')' (rule 133) + + '(' shift, and enter state 271 + ')' reduce using rule 134 + '{' shift, and enter state 272 + '|' shift, and enter state 229 + '_' shift, and enter state 273 + '-' shift, and enter state 151 + 'ado' shift, and enter state 230 + 'as' shift, and enter state 274 + 'case' shift, and enter state 232 + 'class' shift, and enter state 233 + 'data' shift, and enter state 234 + 'derive' shift, and enter state 235 + 'do' shift, and enter state 236 + 'else' shift, and enter state 237 + 'false' shift, and enter state 238 + 'forall' shift, and enter state 275 + 'forallu' shift, and enter state 153 + 'foreign' shift, and enter state 240 + 'hiding' shift, and enter state 276 + 'import' shift, and enter state 242 + 'if' shift, and enter state 243 + 'in' shift, and enter state 244 + 'infix' shift, and enter state 245 + 'infixl' shift, and enter state 246 + 'infixr' shift, and enter state 247 + 'instance' shift, and enter state 248 + 'let' shift, and enter state 249 + 'module' shift, and enter state 250 + 'newtype' shift, and enter state 251 + 'nominal' shift, and enter state 277 + 'phantom' shift, and enter state 278 + 'of' shift, and enter state 254 + 'representational'shift, and enter state 279 + 'role' shift, and enter state 280 + 'then' shift, and enter state 257 + 'true' shift, and enter state 258 + 'type' shift, and enter state 259 + 'where' shift, and enter state 260 + '(->)' shift, and enter state 154 + '(..)' shift, and enter state 112 + LOWER shift, and enter state 281 + UPPER shift, and enter state 54 + QUAL_UPPER shift, and enter state 55 + SYMBOL shift, and enter state 115 + QUAL_SYMBOL shift, and enter state 116 + LIT_HOLE shift, and enter state 117 + LIT_STRING shift, and enter state 282 + LIT_RAW_STRING shift, and enter state 283 + LIT_INT shift, and enter state 155 + + qualProperName goto state 264 + ident goto state 134 + qualSymbol goto state 265 + label goto state 224 + hole goto state 266 + string goto state 137 + int goto state 267 + type1 goto state 416 + type2 goto state 141 + type3 goto state 142 + type4 goto state 143 + type5 goto state 144 + typeAtom goto state 145 + typeKindedAtom goto state 417 + row goto state 418 + rowLabel goto state 226 + forall goto state 146 + sep__rowLabel__','__goto state 227 + sep1__rowLabel__','__goto state 228 + +State 272 + + typeAtom -> '{' . row '}' (rule 121) + typeKindedAtom -> '{' . row '}' (rule 130) + + '}' reduce using rule 134 + '|' shift, and enter state 229 + 'ado' shift, and enter state 230 + 'as' shift, and enter state 231 + 'case' shift, and enter state 232 + 'class' shift, and enter state 233 + 'data' shift, and enter state 234 + 'derive' shift, and enter state 235 + 'do' shift, and enter state 236 + 'else' shift, and enter state 237 + 'false' shift, and enter state 238 + 'forall' shift, and enter state 239 + 'foreign' shift, and enter state 240 + 'hiding' shift, and enter state 241 + 'import' shift, and enter state 242 + 'if' shift, and enter state 243 + 'in' shift, and enter state 244 + 'infix' shift, and enter state 245 + 'infixl' shift, and enter state 246 + 'infixr' shift, and enter state 247 + 'instance' shift, and enter state 248 + 'let' shift, and enter state 249 + 'module' shift, and enter state 250 + 'newtype' shift, and enter state 251 + 'nominal' shift, and enter state 252 + 'phantom' shift, and enter state 253 + 'of' shift, and enter state 254 + 'representational'shift, and enter state 255 + 'role' shift, and enter state 256 + 'then' shift, and enter state 257 + 'true' shift, and enter state 258 + 'type' shift, and enter state 259 + 'where' shift, and enter state 260 + LOWER shift, and enter state 261 + LIT_STRING shift, and enter state 262 + LIT_RAW_STRING shift, and enter state 263 + + label goto state 224 + row goto state 415 + rowLabel goto state 226 + sep__rowLabel__','__goto state 227 + sep1__rowLabel__','__goto state 228 + +State 273 + + typeAtom -> '_' . (rule 113) + typeKindedAtom -> '_' . (rule 125) + + '(' reduce using rule 113 + ')' reduce using rule 113 + '{' reduce using rule 113 + '->' reduce using rule 113 + '<=' reduce using rule 113 + '=>' reduce using rule 113 + ':' reduce using rule 113 + '::' reduce using rule 125 + '_' reduce using rule 113 + '-' reduce using rule 113 + 'as' reduce using rule 113 + 'hiding' reduce using rule 113 + 'nominal' reduce using rule 113 + 'phantom' reduce using rule 113 + 'representational'reduce using rule 113 + 'role' reduce using rule 113 + '(->)' reduce using rule 113 + '(..)' reduce using rule 113 + LOWER reduce using rule 113 + UPPER reduce using rule 113 + QUAL_UPPER reduce using rule 113 + SYMBOL reduce using rule 113 + QUAL_SYMBOL reduce using rule 113 + OPERATOR reduce using rule 113 + QUAL_OPERATOR reduce using rule 113 + LIT_HOLE reduce using rule 113 + LIT_STRING reduce using rule 113 + LIT_RAW_STRING reduce using rule 113 + LIT_INT reduce using rule 113 + + +State 274 + + ident -> 'as' . (rule 37) + label -> 'as' . (rule 61) + + '(' reduce using rule 37 + ')' reduce using rule 37 + '{' reduce using rule 37 + '->' reduce using rule 37 + '<=' reduce using rule 37 + '=>' reduce using rule 37 + ':' reduce using rule 37 + '::' reduce using rule 61 + '_' reduce using rule 37 + '-' reduce using rule 37 + 'as' reduce using rule 37 + 'hiding' reduce using rule 37 + 'nominal' reduce using rule 37 + 'phantom' reduce using rule 37 + 'representational'reduce using rule 37 + 'role' reduce using rule 37 + '(->)' reduce using rule 37 + '(..)' reduce using rule 37 + LOWER reduce using rule 37 + UPPER reduce using rule 37 + QUAL_UPPER reduce using rule 37 + SYMBOL reduce using rule 37 + QUAL_SYMBOL reduce using rule 37 + OPERATOR reduce using rule 37 + QUAL_OPERATOR reduce using rule 37 + LIT_HOLE reduce using rule 37 + LIT_STRING reduce using rule 37 + LIT_RAW_STRING reduce using rule 37 + LIT_INT reduce using rule 37 + + +State 275 + + label -> 'forall' . (rule 69) + forall -> 'forall' . (rule 145) + + '(' reduce using rule 145 + '::' reduce using rule 69 + '@' reduce using rule 145 + 'as' reduce using rule 145 + 'hiding' reduce using rule 145 + 'nominal' reduce using rule 145 + 'phantom' reduce using rule 145 + 'representational'reduce using rule 145 + 'role' reduce using rule 145 + LOWER reduce using rule 145 + + +State 276 + + ident -> 'hiding' . (rule 38) + label -> 'hiding' . (rule 71) + + '(' reduce using rule 38 + ')' reduce using rule 38 + '{' reduce using rule 38 + '->' reduce using rule 38 + '<=' reduce using rule 38 + '=>' reduce using rule 38 + ':' reduce using rule 38 + '::' reduce using rule 71 + '_' reduce using rule 38 + '-' reduce using rule 38 + 'as' reduce using rule 38 + 'hiding' reduce using rule 38 + 'nominal' reduce using rule 38 + 'phantom' reduce using rule 38 + 'representational'reduce using rule 38 + 'role' reduce using rule 38 + '(->)' reduce using rule 38 + '(..)' reduce using rule 38 + LOWER reduce using rule 38 + UPPER reduce using rule 38 + QUAL_UPPER reduce using rule 38 + SYMBOL reduce using rule 38 + QUAL_SYMBOL reduce using rule 38 + OPERATOR reduce using rule 38 + QUAL_OPERATOR reduce using rule 38 + LIT_HOLE reduce using rule 38 + LIT_STRING reduce using rule 38 + LIT_RAW_STRING reduce using rule 38 + LIT_INT reduce using rule 38 + + +State 277 + + ident -> 'nominal' . (rule 40) + label -> 'nominal' . (rule 82) + + '(' reduce using rule 40 + ')' reduce using rule 40 + '{' reduce using rule 40 + '->' reduce using rule 40 + '<=' reduce using rule 40 + '=>' reduce using rule 40 + ':' reduce using rule 40 + '::' reduce using rule 82 + '_' reduce using rule 40 + '-' reduce using rule 40 + 'as' reduce using rule 40 + 'hiding' reduce using rule 40 + 'nominal' reduce using rule 40 + 'phantom' reduce using rule 40 + 'representational'reduce using rule 40 + 'role' reduce using rule 40 + '(->)' reduce using rule 40 + '(..)' reduce using rule 40 + LOWER reduce using rule 40 + UPPER reduce using rule 40 + QUAL_UPPER reduce using rule 40 + SYMBOL reduce using rule 40 + QUAL_SYMBOL reduce using rule 40 + OPERATOR reduce using rule 40 + QUAL_OPERATOR reduce using rule 40 + LIT_HOLE reduce using rule 40 + LIT_STRING reduce using rule 40 + LIT_RAW_STRING reduce using rule 40 + LIT_INT reduce using rule 40 + + +State 278 + + ident -> 'phantom' . (rule 42) + label -> 'phantom' . (rule 84) + + '(' reduce using rule 42 + ')' reduce using rule 42 + '{' reduce using rule 42 + '->' reduce using rule 42 + '<=' reduce using rule 42 + '=>' reduce using rule 42 + ':' reduce using rule 42 + '::' reduce using rule 84 + '_' reduce using rule 42 + '-' reduce using rule 42 + 'as' reduce using rule 42 + 'hiding' reduce using rule 42 + 'nominal' reduce using rule 42 + 'phantom' reduce using rule 42 + 'representational'reduce using rule 42 + 'role' reduce using rule 42 + '(->)' reduce using rule 42 + '(..)' reduce using rule 42 + LOWER reduce using rule 42 + UPPER reduce using rule 42 + QUAL_UPPER reduce using rule 42 + SYMBOL reduce using rule 42 + QUAL_SYMBOL reduce using rule 42 + OPERATOR reduce using rule 42 + QUAL_OPERATOR reduce using rule 42 + LIT_HOLE reduce using rule 42 + LIT_STRING reduce using rule 42 + LIT_RAW_STRING reduce using rule 42 + LIT_INT reduce using rule 42 + + +State 279 + + ident -> 'representational' . (rule 41) + label -> 'representational' . (rule 85) + + '(' reduce using rule 41 + ')' reduce using rule 41 + '{' reduce using rule 41 + '->' reduce using rule 41 + '<=' reduce using rule 41 + '=>' reduce using rule 41 + ':' reduce using rule 41 + '::' reduce using rule 85 + '_' reduce using rule 41 + '-' reduce using rule 41 + 'as' reduce using rule 41 + 'hiding' reduce using rule 41 + 'nominal' reduce using rule 41 + 'phantom' reduce using rule 41 + 'representational'reduce using rule 41 + 'role' reduce using rule 41 + '(->)' reduce using rule 41 + '(..)' reduce using rule 41 + LOWER reduce using rule 41 + UPPER reduce using rule 41 + QUAL_UPPER reduce using rule 41 + SYMBOL reduce using rule 41 + QUAL_SYMBOL reduce using rule 41 + OPERATOR reduce using rule 41 + QUAL_OPERATOR reduce using rule 41 + LIT_HOLE reduce using rule 41 + LIT_STRING reduce using rule 41 + LIT_RAW_STRING reduce using rule 41 + LIT_INT reduce using rule 41 + + +State 280 + + ident -> 'role' . (rule 39) + label -> 'role' . (rule 86) + + '(' reduce using rule 39 + ')' reduce using rule 39 + '{' reduce using rule 39 + '->' reduce using rule 39 + '<=' reduce using rule 39 + '=>' reduce using rule 39 + ':' reduce using rule 39 + '::' reduce using rule 86 + '_' reduce using rule 39 + '-' reduce using rule 39 + 'as' reduce using rule 39 + 'hiding' reduce using rule 39 + 'nominal' reduce using rule 39 + 'phantom' reduce using rule 39 + 'representational'reduce using rule 39 + 'role' reduce using rule 39 + '(->)' reduce using rule 39 + '(..)' reduce using rule 39 + LOWER reduce using rule 39 + UPPER reduce using rule 39 + QUAL_UPPER reduce using rule 39 + SYMBOL reduce using rule 39 + QUAL_SYMBOL reduce using rule 39 + OPERATOR reduce using rule 39 + QUAL_OPERATOR reduce using rule 39 + LIT_HOLE reduce using rule 39 + LIT_STRING reduce using rule 39 + LIT_RAW_STRING reduce using rule 39 + LIT_INT reduce using rule 39 + + +State 281 + + ident -> LOWER . (rule 36) + label -> LOWER . (rule 57) + + '(' reduce using rule 36 + ')' reduce using rule 36 + '{' reduce using rule 36 + '->' reduce using rule 36 + '<=' reduce using rule 36 + '=>' reduce using rule 36 + ':' reduce using rule 36 + '::' reduce using rule 57 + '_' reduce using rule 36 + '-' reduce using rule 36 + 'as' reduce using rule 36 + 'hiding' reduce using rule 36 + 'nominal' reduce using rule 36 + 'phantom' reduce using rule 36 + 'representational'reduce using rule 36 + 'role' reduce using rule 36 + '(->)' reduce using rule 36 + '(..)' reduce using rule 36 + LOWER reduce using rule 36 + UPPER reduce using rule 36 + QUAL_UPPER reduce using rule 36 + SYMBOL reduce using rule 36 + QUAL_SYMBOL reduce using rule 36 + OPERATOR reduce using rule 36 + QUAL_OPERATOR reduce using rule 36 + LIT_HOLE reduce using rule 36 + LIT_STRING reduce using rule 36 + LIT_RAW_STRING reduce using rule 36 + LIT_INT reduce using rule 36 + + +State 282 + + label -> LIT_STRING . (rule 58) + string -> LIT_STRING . (rule 92) + + '(' reduce using rule 92 + ')' reduce using rule 92 + '{' reduce using rule 92 + '->' reduce using rule 92 + '<=' reduce using rule 92 + '=>' reduce using rule 92 + ':' reduce using rule 92 + '::' reduce using rule 58 + '_' reduce using rule 92 + '-' reduce using rule 92 + 'as' reduce using rule 92 + 'hiding' reduce using rule 92 + 'nominal' reduce using rule 92 + 'phantom' reduce using rule 92 + 'representational'reduce using rule 92 + 'role' reduce using rule 92 + '(->)' reduce using rule 92 + '(..)' reduce using rule 92 + LOWER reduce using rule 92 + UPPER reduce using rule 92 + QUAL_UPPER reduce using rule 92 + SYMBOL reduce using rule 92 + QUAL_SYMBOL reduce using rule 92 + OPERATOR reduce using rule 92 + QUAL_OPERATOR reduce using rule 92 + LIT_HOLE reduce using rule 92 + LIT_STRING reduce using rule 92 + LIT_RAW_STRING reduce using rule 92 + LIT_INT reduce using rule 92 + + +State 283 + + label -> LIT_RAW_STRING . (rule 59) + string -> LIT_RAW_STRING . (rule 93) + + '(' reduce using rule 93 + ')' reduce using rule 93 + '{' reduce using rule 93 + '->' reduce using rule 93 + '<=' reduce using rule 93 + '=>' reduce using rule 93 + ':' reduce using rule 93 + '::' reduce using rule 59 + '_' reduce using rule 93 + '-' reduce using rule 93 + 'as' reduce using rule 93 + 'hiding' reduce using rule 93 + 'nominal' reduce using rule 93 + 'phantom' reduce using rule 93 + 'representational'reduce using rule 93 + 'role' reduce using rule 93 + '(->)' reduce using rule 93 + '(..)' reduce using rule 93 + LOWER reduce using rule 93 + UPPER reduce using rule 93 + QUAL_UPPER reduce using rule 93 + SYMBOL reduce using rule 93 + QUAL_SYMBOL reduce using rule 93 + OPERATOR reduce using rule 93 + QUAL_OPERATOR reduce using rule 93 + LIT_HOLE reduce using rule 93 + LIT_STRING reduce using rule 93 + LIT_RAW_STRING reduce using rule 93 + LIT_INT reduce using rule 93 + + +State 284 + + typeVarBinding -> ident . (rule 139) + + error reduce using rule 139 + '(' reduce using rule 139 + '|' reduce using rule 139 + '.' reduce using rule 139 + '@' reduce using rule 139 + 'as' reduce using rule 139 + 'hiding' reduce using rule 139 + 'nominal' reduce using rule 139 + 'phantom' reduce using rule 139 + 'representational'reduce using rule 139 + 'role' reduce using rule 139 + LOWER reduce using rule 139 + + +State 285 + + many1__typeVarBinding__ -> typeVarBinding . (rule 386) + + error reduce using rule 386 + '(' reduce using rule 386 + '|' reduce using rule 386 + '.' reduce using rule 386 + '@' reduce using rule 386 + 'as' reduce using rule 386 + 'hiding' reduce using rule 386 + 'nominal' reduce using rule 386 + 'phantom' reduce using rule 386 + 'representational'reduce using rule 386 + 'role' reduce using rule 386 + LOWER reduce using rule 386 + + +State 286 + + type1 -> forall many__typeVarBinding__ . '.' type1 (rule 103) + + '.' shift, and enter state 414 + + +State 287 + + many__typeVarBinding__ -> many1__typeVarBinding__ . (rule 347) + many1__typeVarBinding__ -> many1__typeVarBinding__ . typeVarBinding (rule 387) + + error reduce using rule 347 + '(' shift, and enter state 288 + '|' reduce using rule 347 + '.' reduce using rule 347 + '@' shift, and enter state 289 + 'as' shift, and enter state 45 + 'hiding' shift, and enter state 47 + 'nominal' shift, and enter state 48 + 'phantom' shift, and enter state 49 + 'representational'shift, and enter state 50 + 'role' shift, and enter state 51 + LOWER shift, and enter state 53 + + ident goto state 284 + typeVarBinding goto state 413 + +State 288 + + typeVarBinding -> '(' . ident '::' type ')' (rule 141) + typeVarBinding -> '(' . '@' ident '::' type ')' (rule 142) + + '@' shift, and enter state 412 + 'as' shift, and enter state 45 + 'hiding' shift, and enter state 47 + 'nominal' shift, and enter state 48 + 'phantom' shift, and enter state 49 + 'representational'shift, and enter state 50 + 'role' shift, and enter state 51 + LOWER shift, and enter state 53 + + ident goto state 411 + +State 289 + + typeVarBinding -> '@' . ident (rule 140) + + 'as' shift, and enter state 45 + 'hiding' shift, and enter state 47 + 'nominal' shift, and enter state 48 + 'phantom' shift, and enter state 49 + 'representational'shift, and enter state 50 + 'role' shift, and enter state 51 + LOWER shift, and enter state 53 + + ident goto state 410 + +State 290 + + type5 -> type5 typeAtom . (rule 112) + + error reduce using rule 112 + '(' reduce using rule 112 + ')' reduce using rule 112 + '{' reduce using rule 112 + '}' reduce using rule 112 + '[' reduce using rule 112 + ']' reduce using rule 112 + '\}' reduce using rule 112 + '\;' reduce using rule 112 + '<-' reduce using rule 112 + '->' reduce using rule 112 + '<=' reduce using rule 112 + '=>' reduce using rule 112 + ':' reduce using rule 112 + '::' reduce using rule 112 + '|' reduce using rule 112 + '`' reduce using rule 112 + ',' reduce using rule 112 + '_' reduce using rule 112 + '\\' reduce using rule 112 + '-' reduce using rule 112 + '@' reduce using rule 112 + 'ado' reduce using rule 112 + 'as' reduce using rule 112 + 'case' reduce using rule 112 + 'do' reduce using rule 112 + 'else' reduce using rule 112 + 'false' reduce using rule 112 + 'hiding' reduce using rule 112 + 'if' reduce using rule 112 + 'let' reduce using rule 112 + 'nominal' reduce using rule 112 + 'phantom' reduce using rule 112 + 'of' reduce using rule 112 + 'representational'reduce using rule 112 + 'role' reduce using rule 112 + 'then' reduce using rule 112 + 'true' reduce using rule 112 + 'where' reduce using rule 112 + '(->)' reduce using rule 112 + '(..)' reduce using rule 112 + LOWER reduce using rule 112 + QUAL_LOWER reduce using rule 112 + UPPER reduce using rule 112 + QUAL_UPPER reduce using rule 112 + SYMBOL reduce using rule 112 + QUAL_SYMBOL reduce using rule 112 + OPERATOR reduce using rule 112 + QUAL_OPERATOR reduce using rule 112 + LIT_HOLE reduce using rule 112 + LIT_CHAR reduce using rule 112 + LIT_STRING reduce using rule 112 + LIT_RAW_STRING reduce using rule 112 + LIT_INT reduce using rule 112 + LIT_NUMBER reduce using rule 112 + %eof reduce using rule 112 + + +State 291 + + type3 -> type3 qualOp . type4 (rule 108) + + '(' shift, and enter state 148 + '{' shift, and enter state 149 + '_' shift, and enter state 150 + '-' shift, and enter state 151 + 'as' shift, and enter state 45 + 'hiding' shift, and enter state 47 + 'nominal' shift, and enter state 48 + 'phantom' shift, and enter state 49 + 'representational'shift, and enter state 50 + 'role' shift, and enter state 51 + '(->)' shift, and enter state 154 + '(..)' shift, and enter state 112 + LOWER shift, and enter state 53 + UPPER shift, and enter state 54 + QUAL_UPPER shift, and enter state 55 + SYMBOL shift, and enter state 115 + QUAL_SYMBOL shift, and enter state 116 + LIT_HOLE shift, and enter state 117 + LIT_STRING shift, and enter state 57 + LIT_RAW_STRING shift, and enter state 58 + LIT_INT shift, and enter state 155 + + qualProperName goto state 133 + ident goto state 134 + qualSymbol goto state 135 + hole goto state 136 + string goto state 137 + int goto state 138 + type4 goto state 409 + type5 goto state 144 + typeAtom goto state 145 + +State 292 + + type2 -> type3 '->' . type1 (rule 105) + + '(' shift, and enter state 148 + '{' shift, and enter state 149 + '_' shift, and enter state 150 + '-' shift, and enter state 151 + 'as' shift, and enter state 45 + 'forall' shift, and enter state 152 + 'forallu' shift, and enter state 153 + 'hiding' shift, and enter state 47 + 'nominal' shift, and enter state 48 + 'phantom' shift, and enter state 49 + 'representational'shift, and enter state 50 + 'role' shift, and enter state 51 + '(->)' shift, and enter state 154 + '(..)' shift, and enter state 112 + LOWER shift, and enter state 53 + UPPER shift, and enter state 54 + QUAL_UPPER shift, and enter state 55 + SYMBOL shift, and enter state 115 + QUAL_SYMBOL shift, and enter state 116 + LIT_HOLE shift, and enter state 117 + LIT_STRING shift, and enter state 57 + LIT_RAW_STRING shift, and enter state 58 + LIT_INT shift, and enter state 155 + + qualProperName goto state 133 + ident goto state 134 + qualSymbol goto state 135 + hole goto state 136 + string goto state 137 + int goto state 138 + type1 goto state 408 + type2 goto state 141 + type3 goto state 142 + type4 goto state 143 + type5 goto state 144 + typeAtom goto state 145 + forall goto state 146 + +State 293 + + qualOp -> '<=' . (rule 45) + + '(' reduce using rule 45 + '{' reduce using rule 45 + '[' reduce using rule 45 + '_' reduce using rule 45 + '\\' reduce using rule 45 + '-' reduce using rule 45 + 'ado' reduce using rule 45 + 'as' reduce using rule 45 + 'case' reduce using rule 45 + 'do' reduce using rule 45 + 'false' reduce using rule 45 + 'hiding' reduce using rule 45 + 'if' reduce using rule 45 + 'let' reduce using rule 45 + 'nominal' reduce using rule 45 + 'phantom' reduce using rule 45 + 'representational'reduce using rule 45 + 'role' reduce using rule 45 + 'true' reduce using rule 45 + '(->)' reduce using rule 45 + '(..)' reduce using rule 45 + LOWER reduce using rule 45 + QUAL_LOWER reduce using rule 45 + UPPER reduce using rule 45 + QUAL_UPPER reduce using rule 45 + SYMBOL reduce using rule 45 + QUAL_SYMBOL reduce using rule 45 + LIT_HOLE reduce using rule 45 + LIT_CHAR reduce using rule 45 + LIT_STRING reduce using rule 45 + LIT_RAW_STRING reduce using rule 45 + LIT_INT reduce using rule 45 + LIT_NUMBER reduce using rule 45 + + +State 294 + + type2 -> type3 '=>' . type1 (rule 106) + + '(' shift, and enter state 148 + '{' shift, and enter state 149 + '_' shift, and enter state 150 + '-' shift, and enter state 151 + 'as' shift, and enter state 45 + 'forall' shift, and enter state 152 + 'forallu' shift, and enter state 153 + 'hiding' shift, and enter state 47 + 'nominal' shift, and enter state 48 + 'phantom' shift, and enter state 49 + 'representational'shift, and enter state 50 + 'role' shift, and enter state 51 + '(->)' shift, and enter state 154 + '(..)' shift, and enter state 112 + LOWER shift, and enter state 53 + UPPER shift, and enter state 54 + QUAL_UPPER shift, and enter state 55 + SYMBOL shift, and enter state 115 + QUAL_SYMBOL shift, and enter state 116 + LIT_HOLE shift, and enter state 117 + LIT_STRING shift, and enter state 57 + LIT_RAW_STRING shift, and enter state 58 + LIT_INT shift, and enter state 155 + + qualProperName goto state 133 + ident goto state 134 + qualSymbol goto state 135 + hole goto state 136 + string goto state 137 + int goto state 138 + type1 goto state 407 + type2 goto state 141 + type3 goto state 142 + type4 goto state 143 + type5 goto state 144 + typeAtom goto state 145 + forall goto state 146 + +State 295 + + qualOp -> ':' . (rule 47) + + '(' reduce using rule 47 + '{' reduce using rule 47 + '[' reduce using rule 47 + '_' reduce using rule 47 + '\\' reduce using rule 47 + '-' reduce using rule 47 + 'ado' reduce using rule 47 + 'as' reduce using rule 47 + 'case' reduce using rule 47 + 'do' reduce using rule 47 + 'false' reduce using rule 47 + 'hiding' reduce using rule 47 + 'if' reduce using rule 47 + 'let' reduce using rule 47 + 'nominal' reduce using rule 47 + 'phantom' reduce using rule 47 + 'representational'reduce using rule 47 + 'role' reduce using rule 47 + 'true' reduce using rule 47 + '(->)' reduce using rule 47 + '(..)' reduce using rule 47 + LOWER reduce using rule 47 + QUAL_LOWER reduce using rule 47 + UPPER reduce using rule 47 + QUAL_UPPER reduce using rule 47 + SYMBOL reduce using rule 47 + QUAL_SYMBOL reduce using rule 47 + LIT_HOLE reduce using rule 47 + LIT_CHAR reduce using rule 47 + LIT_STRING reduce using rule 47 + LIT_RAW_STRING reduce using rule 47 + LIT_INT reduce using rule 47 + LIT_NUMBER reduce using rule 47 + + +State 296 + + qualOp -> '-' . (rule 46) + + '(' reduce using rule 46 + '{' reduce using rule 46 + '[' reduce using rule 46 + '_' reduce using rule 46 + '\\' reduce using rule 46 + '-' reduce using rule 46 + 'ado' reduce using rule 46 + 'as' reduce using rule 46 + 'case' reduce using rule 46 + 'do' reduce using rule 46 + 'false' reduce using rule 46 + 'hiding' reduce using rule 46 + 'if' reduce using rule 46 + 'let' reduce using rule 46 + 'nominal' reduce using rule 46 + 'phantom' reduce using rule 46 + 'representational'reduce using rule 46 + 'role' reduce using rule 46 + 'true' reduce using rule 46 + '(->)' reduce using rule 46 + '(..)' reduce using rule 46 + LOWER reduce using rule 46 + QUAL_LOWER reduce using rule 46 + UPPER reduce using rule 46 + QUAL_UPPER reduce using rule 46 + SYMBOL reduce using rule 46 + QUAL_SYMBOL reduce using rule 46 + LIT_HOLE reduce using rule 46 + LIT_CHAR reduce using rule 46 + LIT_STRING reduce using rule 46 + LIT_RAW_STRING reduce using rule 46 + LIT_INT reduce using rule 46 + LIT_NUMBER reduce using rule 46 + + +State 297 + + qualOp -> OPERATOR . (rule 43) + + '(' reduce using rule 43 + '{' reduce using rule 43 + '[' reduce using rule 43 + '_' reduce using rule 43 + '\\' reduce using rule 43 + '-' reduce using rule 43 + 'ado' reduce using rule 43 + 'as' reduce using rule 43 + 'case' reduce using rule 43 + 'do' reduce using rule 43 + 'false' reduce using rule 43 + 'hiding' reduce using rule 43 + 'if' reduce using rule 43 + 'let' reduce using rule 43 + 'nominal' reduce using rule 43 + 'phantom' reduce using rule 43 + 'representational'reduce using rule 43 + 'role' reduce using rule 43 + 'true' reduce using rule 43 + '(->)' reduce using rule 43 + '(..)' reduce using rule 43 + LOWER reduce using rule 43 + QUAL_LOWER reduce using rule 43 + UPPER reduce using rule 43 + QUAL_UPPER reduce using rule 43 + SYMBOL reduce using rule 43 + QUAL_SYMBOL reduce using rule 43 + LIT_HOLE reduce using rule 43 + LIT_CHAR reduce using rule 43 + LIT_STRING reduce using rule 43 + LIT_RAW_STRING reduce using rule 43 + LIT_INT reduce using rule 43 + LIT_NUMBER reduce using rule 43 + + +State 298 + + qualOp -> QUAL_OPERATOR . (rule 44) + + '(' reduce using rule 44 + '{' reduce using rule 44 + '[' reduce using rule 44 + '_' reduce using rule 44 + '\\' reduce using rule 44 + '-' reduce using rule 44 + 'ado' reduce using rule 44 + 'as' reduce using rule 44 + 'case' reduce using rule 44 + 'do' reduce using rule 44 + 'false' reduce using rule 44 + 'hiding' reduce using rule 44 + 'if' reduce using rule 44 + 'let' reduce using rule 44 + 'nominal' reduce using rule 44 + 'phantom' reduce using rule 44 + 'representational'reduce using rule 44 + 'role' reduce using rule 44 + 'true' reduce using rule 44 + '(->)' reduce using rule 44 + '(..)' reduce using rule 44 + LOWER reduce using rule 44 + QUAL_LOWER reduce using rule 44 + UPPER reduce using rule 44 + QUAL_UPPER reduce using rule 44 + SYMBOL reduce using rule 44 + QUAL_SYMBOL reduce using rule 44 + LIT_HOLE reduce using rule 44 + LIT_CHAR reduce using rule 44 + LIT_STRING reduce using rule 44 + LIT_RAW_STRING reduce using rule 44 + LIT_INT reduce using rule 44 + LIT_NUMBER reduce using rule 44 + + +State 299 + + type -> type1 '::' . type (rule 101) + + '(' shift, and enter state 148 + '{' shift, and enter state 149 + '_' shift, and enter state 150 + '-' shift, and enter state 151 + 'as' shift, and enter state 45 + 'forall' shift, and enter state 152 + 'forallu' shift, and enter state 153 + 'hiding' shift, and enter state 47 + 'nominal' shift, and enter state 48 + 'phantom' shift, and enter state 49 + 'representational'shift, and enter state 50 + 'role' shift, and enter state 51 + '(->)' shift, and enter state 154 + '(..)' shift, and enter state 112 + LOWER shift, and enter state 53 + UPPER shift, and enter state 54 + QUAL_UPPER shift, and enter state 55 + SYMBOL shift, and enter state 115 + QUAL_SYMBOL shift, and enter state 116 + LIT_HOLE shift, and enter state 117 + LIT_STRING shift, and enter state 57 + LIT_RAW_STRING shift, and enter state 58 + LIT_INT shift, and enter state 155 + + qualProperName goto state 133 + ident goto state 134 + qualSymbol goto state 135 + hole goto state 136 + string goto state 137 + int goto state 138 + type goto state 406 + type1 goto state 140 + type2 goto state 141 + type3 goto state 142 + type4 goto state 143 + type5 goto state 144 + typeAtom goto state 145 + forall goto state 146 + +State 300 + + moduleHeader -> 'module' moduleName . exports 'where' '\{' moduleImports (rule 242) + + '(' shift, and enter state 405 + 'where' reduce using rule 254 + + exports goto state 404 + +State 301 + + doStatement -> 'let' '\{' . manySep__letBinding__'\;'__ '\}' (rule 211) + + '(' shift, and enter state 40 + '{' shift, and enter state 41 + '[' shift, and enter state 42 + '_' shift, and enter state 43 + '-' shift, and enter state 44 + 'as' shift, and enter state 45 + 'false' shift, and enter state 46 + 'hiding' shift, and enter state 47 + 'nominal' shift, and enter state 48 + 'phantom' shift, and enter state 49 + 'representational'shift, and enter state 50 + 'role' shift, and enter state 51 + 'true' shift, and enter state 52 + LOWER shift, and enter state 53 + UPPER shift, and enter state 54 + QUAL_UPPER shift, and enter state 55 + LIT_CHAR shift, and enter state 56 + LIT_STRING shift, and enter state 57 + LIT_RAW_STRING shift, and enter state 58 + LIT_INT shift, and enter state 59 + LIT_NUMBER shift, and enter state 60 + + qualProperName goto state 25 + ident goto state 396 + string goto state 27 + char goto state 28 + number goto state 29 + boolean goto state 30 + letBinding goto state 397 + binder1 goto state 398 + binder2 goto state 34 + binderAtom goto state 35 + delim__'['__binder__','__']'__goto state 36 + delim__'{'__recordBinder__','__'}'__goto state 37 + many__binderAtom__goto state 38 + manySep__letBinding__'\;'__goto state 403 + many1__binderAtom__goto state 39 + manySep1__letBinding__'\;'__goto state 400 + +State 302 + + expr1 -> expr1 qualOp . expr2 (rule 152) + + '(' shift, and enter state 95 + '{' shift, and enter state 96 + '[' shift, and enter state 97 + '_' shift, and enter state 98 + '\\' shift, and enter state 99 + '-' shift, and enter state 100 + 'ado' shift, and enter state 101 + 'as' shift, and enter state 102 + 'case' shift, and enter state 103 + 'do' shift, and enter state 104 + 'false' shift, and enter state 46 + 'hiding' shift, and enter state 105 + 'if' shift, and enter state 106 + 'let' shift, and enter state 107 + 'nominal' shift, and enter state 108 + 'phantom' shift, and enter state 109 + 'representational'shift, and enter state 110 + 'role' shift, and enter state 111 + 'true' shift, and enter state 52 + '(..)' shift, and enter state 112 + LOWER shift, and enter state 113 + QUAL_LOWER shift, and enter state 114 + UPPER shift, and enter state 54 + QUAL_UPPER shift, and enter state 55 + SYMBOL shift, and enter state 115 + QUAL_SYMBOL shift, and enter state 116 + LIT_HOLE shift, and enter state 117 + LIT_CHAR shift, and enter state 56 + LIT_STRING shift, and enter state 57 + LIT_RAW_STRING shift, and enter state 58 + LIT_INT shift, and enter state 59 + LIT_NUMBER shift, and enter state 60 + + qualProperName goto state 74 + qualIdent goto state 75 + qualSymbol goto state 76 + hole goto state 77 + string goto state 78 + char goto state 79 + number goto state 80 + boolean goto state 81 + expr2 goto state 402 + expr3 goto state 84 + expr4 goto state 85 + expr5 goto state 86 + expr6 goto state 87 + expr7 goto state 88 + exprAtom goto state 89 + doBlock goto state 90 + adoBlock goto state 91 + delim__'['__expr__','__']'__goto state 93 + delim__'{'__recordLabel__','__'}'__goto state 94 + +State 303 + + expr -> expr1 '::' . type (rule 150) + + '(' shift, and enter state 148 + '{' shift, and enter state 149 + '_' shift, and enter state 150 + '-' shift, and enter state 151 + 'as' shift, and enter state 45 + 'forall' shift, and enter state 152 + 'forallu' shift, and enter state 153 + 'hiding' shift, and enter state 47 + 'nominal' shift, and enter state 48 + 'phantom' shift, and enter state 49 + 'representational'shift, and enter state 50 + 'role' shift, and enter state 51 + '(->)' shift, and enter state 154 + '(..)' shift, and enter state 112 + LOWER shift, and enter state 53 + UPPER shift, and enter state 54 + QUAL_UPPER shift, and enter state 55 + SYMBOL shift, and enter state 115 + QUAL_SYMBOL shift, and enter state 116 + LIT_HOLE shift, and enter state 117 + LIT_STRING shift, and enter state 57 + LIT_RAW_STRING shift, and enter state 58 + LIT_INT shift, and enter state 155 + + qualProperName goto state 133 + ident goto state 134 + qualSymbol goto state 135 + hole goto state 136 + string goto state 137 + int goto state 138 + type goto state 401 + type1 goto state 140 + type2 goto state 141 + type3 goto state 142 + type4 goto state 143 + type5 goto state 144 + typeAtom goto state 145 + forall goto state 146 + +State 304 + + expr5 -> 'let' '\{' . manySep__letBinding__'\;'__ '\}' 'in' expr (rule 167) + + '(' shift, and enter state 40 + '{' shift, and enter state 41 + '[' shift, and enter state 42 + '_' shift, and enter state 43 + '-' shift, and enter state 44 + 'as' shift, and enter state 45 + 'false' shift, and enter state 46 + 'hiding' shift, and enter state 47 + 'nominal' shift, and enter state 48 + 'phantom' shift, and enter state 49 + 'representational'shift, and enter state 50 + 'role' shift, and enter state 51 + 'true' shift, and enter state 52 + LOWER shift, and enter state 53 + UPPER shift, and enter state 54 + QUAL_UPPER shift, and enter state 55 + LIT_CHAR shift, and enter state 56 + LIT_STRING shift, and enter state 57 + LIT_RAW_STRING shift, and enter state 58 + LIT_INT shift, and enter state 59 + LIT_NUMBER shift, and enter state 60 + + qualProperName goto state 25 + ident goto state 396 + string goto state 27 + char goto state 28 + number goto state 29 + boolean goto state 30 + letBinding goto state 397 + binder1 goto state 398 + binder2 goto state 34 + binderAtom goto state 35 + delim__'['__binder__','__']'__goto state 36 + delim__'{'__recordBinder__','__'}'__goto state 37 + many__binderAtom__goto state 38 + manySep__letBinding__'\;'__goto state 399 + many1__binderAtom__goto state 39 + manySep1__letBinding__'\;'__goto state 400 + +State 305 + + expr5 -> 'if' expr . 'then' expr 'else' expr (rule 163) + + 'then' shift, and enter state 395 + + +State 306 + + doBlock -> 'do' '\{' . (rule 208) + + error reduce using rule 208 + '(' reduce using rule 208 + ')' reduce using rule 208 + '{' reduce using rule 208 + '}' reduce using rule 208 + '[' reduce using rule 208 + ']' reduce using rule 208 + '\}' reduce using rule 208 + '\;' reduce using rule 208 + '<=' reduce using rule 208 + ':' reduce using rule 208 + '::' reduce using rule 208 + '|' reduce using rule 208 + '`' reduce using rule 208 + ',' reduce using rule 208 + '_' reduce using rule 208 + '\\' reduce using rule 208 + '-' reduce using rule 208 + '@' reduce using rule 208 + 'ado' reduce using rule 208 + 'as' reduce using rule 208 + 'case' reduce using rule 208 + 'do' reduce using rule 208 + 'else' reduce using rule 208 + 'false' reduce using rule 208 + 'hiding' reduce using rule 208 + 'if' reduce using rule 208 + 'let' reduce using rule 208 + 'nominal' reduce using rule 208 + 'phantom' reduce using rule 208 + 'of' reduce using rule 208 + 'representational'reduce using rule 208 + 'role' reduce using rule 208 + 'then' reduce using rule 208 + 'true' reduce using rule 208 + 'where' reduce using rule 208 + '(..)' reduce using rule 208 + LOWER reduce using rule 208 + QUAL_LOWER reduce using rule 208 + UPPER reduce using rule 208 + QUAL_UPPER reduce using rule 208 + SYMBOL reduce using rule 208 + QUAL_SYMBOL reduce using rule 208 + OPERATOR reduce using rule 208 + QUAL_OPERATOR reduce using rule 208 + LIT_HOLE reduce using rule 208 + LIT_CHAR reduce using rule 208 + LIT_STRING reduce using rule 208 + LIT_RAW_STRING reduce using rule 208 + LIT_INT reduce using rule 208 + LIT_NUMBER reduce using rule 208 + %eof reduce using rule 208 + + +State 307 + + sep1__expr__','__ -> expr . (rule 411) + + ']' reduce using rule 411 + ',' reduce using rule 411 + 'of' reduce using rule 411 + + +State 308 + + expr5 -> 'case' sep__expr__','__ . 'of' '\{' manySep__caseBranch__'\;'__ '\}' (rule 168) + expr5 -> 'case' sep__expr__','__ . 'of' '\{' sep__binder1__','__ '->' '\}' exprWhere (rule 169) + expr5 -> 'case' sep__expr__','__ . 'of' '\{' sep__binder1__','__ '\}' guardedCase (rule 170) + + 'of' shift, and enter state 394 + + +State 309 + + sep__expr__','__ -> sep1__expr__','__ . (rule 366) + sep1__expr__','__ -> sep1__expr__','__ . ',' expr (rule 412) + + ']' reduce using rule 366 + ',' shift, and enter state 393 + 'of' reduce using rule 366 + + +State 310 + + adoBlock -> 'ado' '\{' . '\}' (rule 209) + adoBlock -> 'ado' '\{' . (rule 210) + + '\}' shift, and enter state 392 + 'in' reduce using rule 210 + + +State 311 + + expr3 -> '-' expr3 . (rule 158) + + error reduce using rule 158 + '(' reduce using rule 158 + ')' reduce using rule 158 + '{' reduce using rule 158 + '}' reduce using rule 158 + '[' reduce using rule 158 + ']' reduce using rule 158 + '\}' reduce using rule 158 + '\;' reduce using rule 158 + '<=' reduce using rule 158 + ':' reduce using rule 158 + '::' reduce using rule 158 + '|' reduce using rule 158 + '`' reduce using rule 158 + ',' reduce using rule 158 + '_' reduce using rule 158 + '\\' reduce using rule 158 + '-' reduce using rule 158 + '@' reduce using rule 158 + 'ado' reduce using rule 158 + 'as' reduce using rule 158 + 'case' reduce using rule 158 + 'do' reduce using rule 158 + 'else' reduce using rule 158 + 'false' reduce using rule 158 + 'hiding' reduce using rule 158 + 'if' reduce using rule 158 + 'let' reduce using rule 158 + 'nominal' reduce using rule 158 + 'phantom' reduce using rule 158 + 'of' reduce using rule 158 + 'representational'reduce using rule 158 + 'role' reduce using rule 158 + 'then' reduce using rule 158 + 'true' reduce using rule 158 + 'where' reduce using rule 158 + '(..)' reduce using rule 158 + LOWER reduce using rule 158 + QUAL_LOWER reduce using rule 158 + UPPER reduce using rule 158 + QUAL_UPPER reduce using rule 158 + SYMBOL reduce using rule 158 + QUAL_SYMBOL reduce using rule 158 + OPERATOR reduce using rule 158 + QUAL_OPERATOR reduce using rule 158 + LIT_HOLE reduce using rule 158 + LIT_CHAR reduce using rule 158 + LIT_STRING reduce using rule 158 + LIT_RAW_STRING reduce using rule 158 + LIT_INT reduce using rule 158 + LIT_NUMBER reduce using rule 158 + %eof reduce using rule 158 + + +State 312 + + expr5 -> '\\' many__binderAtom__ . '->' expr (rule 166) + + '->' shift, and enter state 391 + + +State 313 + + delim__'['__expr__','__']'__ -> '[' sep__expr__','__ . ']' (rule 337) + + ']' shift, and enter state 390 + + +State 314 + + delim__'['__expr__','__']'__ -> '[' ']' . (rule 336) + + error reduce using rule 336 + '(' reduce using rule 336 + ')' reduce using rule 336 + '{' reduce using rule 336 + '}' reduce using rule 336 + '[' reduce using rule 336 + ']' reduce using rule 336 + '\}' reduce using rule 336 + '\;' reduce using rule 336 + '<=' reduce using rule 336 + ':' reduce using rule 336 + '::' reduce using rule 336 + '|' reduce using rule 336 + '`' reduce using rule 336 + '.' reduce using rule 336 + ',' reduce using rule 336 + '_' reduce using rule 336 + '\\' reduce using rule 336 + '-' reduce using rule 336 + '@' reduce using rule 336 + 'ado' reduce using rule 336 + 'as' reduce using rule 336 + 'case' reduce using rule 336 + 'do' reduce using rule 336 + 'else' reduce using rule 336 + 'false' reduce using rule 336 + 'hiding' reduce using rule 336 + 'if' reduce using rule 336 + 'let' reduce using rule 336 + 'nominal' reduce using rule 336 + 'phantom' reduce using rule 336 + 'of' reduce using rule 336 + 'representational'reduce using rule 336 + 'role' reduce using rule 336 + 'then' reduce using rule 336 + 'true' reduce using rule 336 + 'where' reduce using rule 336 + '(..)' reduce using rule 336 + LOWER reduce using rule 336 + QUAL_LOWER reduce using rule 336 + UPPER reduce using rule 336 + QUAL_UPPER reduce using rule 336 + SYMBOL reduce using rule 336 + QUAL_SYMBOL reduce using rule 336 + OPERATOR reduce using rule 336 + QUAL_OPERATOR reduce using rule 336 + LIT_HOLE reduce using rule 336 + LIT_CHAR reduce using rule 336 + LIT_STRING reduce using rule 336 + LIT_RAW_STRING reduce using rule 336 + LIT_INT reduce using rule 336 + LIT_NUMBER reduce using rule 336 + %eof reduce using rule 336 + + +State 315 + + recordLabel -> label . (rule 188) + recordLabel -> label . '=' expr (rule 189) + recordLabel -> label . ':' expr (rule 190) + + '}' reduce using rule 188 + ':' shift, and enter state 388 + '=' shift, and enter state 389 + ',' reduce using rule 188 + + +State 316 + + sep1__recordLabel__','__ -> recordLabel . (rule 435) + + '}' reduce using rule 435 + ',' reduce using rule 435 + + +State 317 + + delim__'{'__recordLabel__','__'}'__ -> '{' sep__recordLabel__','__ . '}' (rule 341) + + '}' shift, and enter state 387 + + +State 318 + + sep__recordLabel__','__ -> sep1__recordLabel__','__ . (rule 400) + sep1__recordLabel__','__ -> sep1__recordLabel__','__ . ',' recordLabel (rule 436) + + '}' reduce using rule 400 + ',' shift, and enter state 386 + + +State 319 + + delim__'{'__recordLabel__','__'}'__ -> '{' '}' . (rule 340) + + error reduce using rule 340 + '(' reduce using rule 340 + ')' reduce using rule 340 + '{' reduce using rule 340 + '}' reduce using rule 340 + '[' reduce using rule 340 + ']' reduce using rule 340 + '\}' reduce using rule 340 + '\;' reduce using rule 340 + '<=' reduce using rule 340 + ':' reduce using rule 340 + '::' reduce using rule 340 + '|' reduce using rule 340 + '`' reduce using rule 340 + '.' reduce using rule 340 + ',' reduce using rule 340 + '_' reduce using rule 340 + '\\' reduce using rule 340 + '-' reduce using rule 340 + '@' reduce using rule 340 + 'ado' reduce using rule 340 + 'as' reduce using rule 340 + 'case' reduce using rule 340 + 'do' reduce using rule 340 + 'else' reduce using rule 340 + 'false' reduce using rule 340 + 'hiding' reduce using rule 340 + 'if' reduce using rule 340 + 'let' reduce using rule 340 + 'nominal' reduce using rule 340 + 'phantom' reduce using rule 340 + 'of' reduce using rule 340 + 'representational'reduce using rule 340 + 'role' reduce using rule 340 + 'then' reduce using rule 340 + 'true' reduce using rule 340 + 'where' reduce using rule 340 + '(..)' reduce using rule 340 + LOWER reduce using rule 340 + QUAL_LOWER reduce using rule 340 + UPPER reduce using rule 340 + QUAL_UPPER reduce using rule 340 + SYMBOL reduce using rule 340 + QUAL_SYMBOL reduce using rule 340 + OPERATOR reduce using rule 340 + QUAL_OPERATOR reduce using rule 340 + LIT_HOLE reduce using rule 340 + LIT_CHAR reduce using rule 340 + LIT_STRING reduce using rule 340 + LIT_RAW_STRING reduce using rule 340 + LIT_INT reduce using rule 340 + LIT_NUMBER reduce using rule 340 + %eof reduce using rule 340 + + +State 320 + + exprAtom -> '(' expr . ')' (rule 187) + + ')' shift, and enter state 385 + + +State 321 + + expr5 -> adoBlock 'in' . expr (rule 165) + + '(' shift, and enter state 95 + '{' shift, and enter state 96 + '[' shift, and enter state 97 + '_' shift, and enter state 98 + '\\' shift, and enter state 99 + '-' shift, and enter state 100 + 'ado' shift, and enter state 101 + 'as' shift, and enter state 102 + 'case' shift, and enter state 103 + 'do' shift, and enter state 104 + 'false' shift, and enter state 46 + 'hiding' shift, and enter state 105 + 'if' shift, and enter state 106 + 'let' shift, and enter state 107 + 'nominal' shift, and enter state 108 + 'phantom' shift, and enter state 109 + 'representational'shift, and enter state 110 + 'role' shift, and enter state 111 + 'true' shift, and enter state 52 + '(..)' shift, and enter state 112 + LOWER shift, and enter state 113 + QUAL_LOWER shift, and enter state 114 + UPPER shift, and enter state 54 + QUAL_UPPER shift, and enter state 55 + SYMBOL shift, and enter state 115 + QUAL_SYMBOL shift, and enter state 116 + LIT_HOLE shift, and enter state 117 + LIT_CHAR shift, and enter state 56 + LIT_STRING shift, and enter state 57 + LIT_RAW_STRING shift, and enter state 58 + LIT_INT shift, and enter state 59 + LIT_NUMBER shift, and enter state 60 + + qualProperName goto state 74 + qualIdent goto state 75 + qualSymbol goto state 76 + hole goto state 77 + string goto state 78 + char goto state 79 + number goto state 80 + boolean goto state 81 + expr goto state 384 + expr1 goto state 122 + expr2 goto state 83 + expr3 goto state 84 + expr4 goto state 85 + expr5 goto state 86 + expr6 goto state 87 + expr7 goto state 88 + exprAtom goto state 89 + doBlock goto state 90 + adoBlock goto state 91 + delim__'['__expr__','__']'__goto state 93 + delim__'{'__recordLabel__','__'}'__goto state 94 + +State 322 + + expr7 -> exprAtom '.' . sep__label__'.'__ (rule 175) + + 'ado' shift, and enter state 230 + 'as' shift, and enter state 231 + 'case' shift, and enter state 232 + 'class' shift, and enter state 233 + 'data' shift, and enter state 234 + 'derive' shift, and enter state 235 + 'do' shift, and enter state 236 + 'else' shift, and enter state 237 + 'false' shift, and enter state 238 + 'forall' shift, and enter state 239 + 'foreign' shift, and enter state 240 + 'hiding' shift, and enter state 241 + 'import' shift, and enter state 242 + 'if' shift, and enter state 243 + 'in' shift, and enter state 244 + 'infix' shift, and enter state 245 + 'infixl' shift, and enter state 246 + 'infixr' shift, and enter state 247 + 'instance' shift, and enter state 248 + 'let' shift, and enter state 249 + 'module' shift, and enter state 250 + 'newtype' shift, and enter state 251 + 'nominal' shift, and enter state 252 + 'phantom' shift, and enter state 253 + 'of' shift, and enter state 254 + 'representational'shift, and enter state 255 + 'role' shift, and enter state 256 + 'then' shift, and enter state 257 + 'true' shift, and enter state 258 + 'type' shift, and enter state 259 + 'where' shift, and enter state 260 + LOWER shift, and enter state 261 + LIT_STRING shift, and enter state 262 + LIT_RAW_STRING shift, and enter state 263 + + label goto state 381 + sep__label__'.'__goto state 382 + sep1__label__'.'__goto state 383 + +State 323 + + expr6 -> expr7 '{' . '}' (rule 172) + expr6 -> expr7 '{' . sep__recordUpdateOrLabel__','__ '}' (rule 173) + + '}' shift, and enter state 380 + 'ado' shift, and enter state 230 + 'as' shift, and enter state 231 + 'case' shift, and enter state 232 + 'class' shift, and enter state 233 + 'data' shift, and enter state 234 + 'derive' shift, and enter state 235 + 'do' shift, and enter state 236 + 'else' shift, and enter state 237 + 'false' shift, and enter state 238 + 'forall' shift, and enter state 239 + 'foreign' shift, and enter state 240 + 'hiding' shift, and enter state 241 + 'import' shift, and enter state 242 + 'if' shift, and enter state 243 + 'in' shift, and enter state 244 + 'infix' shift, and enter state 245 + 'infixl' shift, and enter state 246 + 'infixr' shift, and enter state 247 + 'instance' shift, and enter state 248 + 'let' shift, and enter state 249 + 'module' shift, and enter state 250 + 'newtype' shift, and enter state 251 + 'nominal' shift, and enter state 252 + 'phantom' shift, and enter state 253 + 'of' shift, and enter state 254 + 'representational'shift, and enter state 255 + 'role' shift, and enter state 256 + 'then' shift, and enter state 257 + 'true' shift, and enter state 258 + 'type' shift, and enter state 259 + 'where' shift, and enter state 260 + LOWER shift, and enter state 261 + LIT_STRING shift, and enter state 262 + LIT_RAW_STRING shift, and enter state 263 + + label goto state 376 + recordUpdateOrLabelgoto state 377 + sep__recordUpdateOrLabel__','__goto state 378 + sep1__recordUpdateOrLabel__','__goto state 379 + +State 324 + + expr4 -> expr4 expr5 . (rule 160) + + error reduce using rule 160 + '(' reduce using rule 160 + ')' reduce using rule 160 + '{' reduce using rule 160 + '}' reduce using rule 160 + '[' reduce using rule 160 + ']' reduce using rule 160 + '\}' reduce using rule 160 + '\;' reduce using rule 160 + '<=' reduce using rule 160 + ':' reduce using rule 160 + '::' reduce using rule 160 + '|' reduce using rule 160 + '`' reduce using rule 160 + ',' reduce using rule 160 + '_' reduce using rule 160 + '\\' reduce using rule 160 + '-' reduce using rule 160 + '@' reduce using rule 160 + 'ado' reduce using rule 160 + 'as' reduce using rule 160 + 'case' reduce using rule 160 + 'do' reduce using rule 160 + 'else' reduce using rule 160 + 'false' reduce using rule 160 + 'hiding' reduce using rule 160 + 'if' reduce using rule 160 + 'let' reduce using rule 160 + 'nominal' reduce using rule 160 + 'phantom' reduce using rule 160 + 'of' reduce using rule 160 + 'representational'reduce using rule 160 + 'role' reduce using rule 160 + 'then' reduce using rule 160 + 'true' reduce using rule 160 + 'where' reduce using rule 160 + '(..)' reduce using rule 160 + LOWER reduce using rule 160 + QUAL_LOWER reduce using rule 160 + UPPER reduce using rule 160 + QUAL_UPPER reduce using rule 160 + SYMBOL reduce using rule 160 + QUAL_SYMBOL reduce using rule 160 + OPERATOR reduce using rule 160 + QUAL_OPERATOR reduce using rule 160 + LIT_HOLE reduce using rule 160 + LIT_CHAR reduce using rule 160 + LIT_STRING reduce using rule 160 + LIT_RAW_STRING reduce using rule 160 + LIT_INT reduce using rule 160 + LIT_NUMBER reduce using rule 160 + %eof reduce using rule 160 + + +State 325 + + expr4 -> expr4 '@' . typeAtom (rule 161) + + '(' shift, and enter state 148 + '{' shift, and enter state 149 + '_' shift, and enter state 150 + 'as' shift, and enter state 45 + 'hiding' shift, and enter state 47 + 'nominal' shift, and enter state 48 + 'phantom' shift, and enter state 49 + 'representational'shift, and enter state 50 + 'role' shift, and enter state 51 + '(->)' shift, and enter state 154 + '(..)' shift, and enter state 112 + LOWER shift, and enter state 53 + UPPER shift, and enter state 54 + QUAL_UPPER shift, and enter state 55 + SYMBOL shift, and enter state 115 + QUAL_SYMBOL shift, and enter state 116 + LIT_HOLE shift, and enter state 117 + LIT_STRING shift, and enter state 57 + LIT_RAW_STRING shift, and enter state 58 + LIT_INT shift, and enter state 155 + + qualProperName goto state 133 + ident goto state 134 + qualSymbol goto state 135 + hole goto state 136 + string goto state 137 + int goto state 138 + typeAtom goto state 375 + +State 326 + + expr2 -> expr2 '`' . exprBacktick '`' expr3 (rule 154) + + '(' shift, and enter state 95 + '{' shift, and enter state 96 + '[' shift, and enter state 97 + '_' shift, and enter state 98 + '\\' shift, and enter state 99 + '-' shift, and enter state 100 + 'ado' shift, and enter state 101 + 'as' shift, and enter state 102 + 'case' shift, and enter state 103 + 'do' shift, and enter state 104 + 'false' shift, and enter state 46 + 'hiding' shift, and enter state 105 + 'if' shift, and enter state 106 + 'let' shift, and enter state 107 + 'nominal' shift, and enter state 108 + 'phantom' shift, and enter state 109 + 'representational'shift, and enter state 110 + 'role' shift, and enter state 111 + 'true' shift, and enter state 52 + '(..)' shift, and enter state 112 + LOWER shift, and enter state 113 + QUAL_LOWER shift, and enter state 114 + UPPER shift, and enter state 54 + QUAL_UPPER shift, and enter state 55 + SYMBOL shift, and enter state 115 + QUAL_SYMBOL shift, and enter state 116 + LIT_HOLE shift, and enter state 117 + LIT_CHAR shift, and enter state 56 + LIT_STRING shift, and enter state 57 + LIT_RAW_STRING shift, and enter state 58 + LIT_INT shift, and enter state 59 + LIT_NUMBER shift, and enter state 60 + + qualProperName goto state 74 + qualIdent goto state 75 + qualSymbol goto state 76 + hole goto state 77 + string goto state 78 + char goto state 79 + number goto state 80 + boolean goto state 81 + exprBacktick goto state 373 + expr3 goto state 374 + expr4 goto state 85 + expr5 goto state 86 + expr6 goto state 87 + expr7 goto state 88 + exprAtom goto state 89 + doBlock goto state 90 + adoBlock goto state 91 + delim__'['__expr__','__']'__goto state 93 + delim__'{'__recordLabel__','__'}'__goto state 94 + +State 327 + + classSignature -> properName '::' . type (rule 301) + + '(' shift, and enter state 148 + '{' shift, and enter state 149 + '_' shift, and enter state 150 + '-' shift, and enter state 151 + 'as' shift, and enter state 45 + 'forall' shift, and enter state 152 + 'forallu' shift, and enter state 153 + 'hiding' shift, and enter state 47 + 'nominal' shift, and enter state 48 + 'phantom' shift, and enter state 49 + 'representational'shift, and enter state 50 + 'role' shift, and enter state 51 + '(->)' shift, and enter state 154 + '(..)' shift, and enter state 112 + LOWER shift, and enter state 53 + UPPER shift, and enter state 54 + QUAL_UPPER shift, and enter state 55 + SYMBOL shift, and enter state 115 + QUAL_SYMBOL shift, and enter state 116 + LIT_HOLE shift, and enter state 117 + LIT_STRING shift, and enter state 57 + LIT_RAW_STRING shift, and enter state 58 + LIT_INT shift, and enter state 155 + + qualProperName goto state 133 + ident goto state 134 + qualSymbol goto state 135 + hole goto state 136 + string goto state 137 + int goto state 138 + type goto state 372 + type1 goto state 140 + type2 goto state 141 + type3 goto state 142 + type4 goto state 143 + type5 goto state 144 + typeAtom goto state 145 + forall goto state 146 + +State 328 + + constraint -> '(' constraint . ')' (rule 316) + sep1__constraint__','__ -> constraint . (rule 403) + + ')' shift, and enter state 371 + ',' reduce using rule 403 + + +State 329 + + constraints -> '(' sep__constraint__','__ . ')' (rule 314) + + ')' shift, and enter state 370 + + +State 330 + + sep__constraint__','__ -> sep1__constraint__','__ . (rule 362) + sep1__constraint__','__ -> sep1__constraint__','__ . ',' constraint (rule 404) + + ')' reduce using rule 362 + ',' shift, and enter state 369 + + +State 331 + + constraint -> '(' . constraint ')' (rule 316) + + '(' shift, and enter state 331 + UPPER shift, and enter state 54 + QUAL_UPPER shift, and enter state 55 + + qualProperName goto state 64 + constraint goto state 368 + +State 332 + + classSuper -> constraints '<=' . (rule 302) + + error reduce using rule 302 + + +State 333 + + many1__typeAtom__ -> typeAtom . (rule 427) + + error reduce using rule 427 + '(' reduce using rule 427 + ')' reduce using rule 427 + '{' reduce using rule 427 + '\}' reduce using rule 427 + '\;' reduce using rule 427 + '<=' reduce using rule 427 + '=>' reduce using rule 427 + '|' reduce using rule 427 + ',' reduce using rule 427 + '_' reduce using rule 427 + 'as' reduce using rule 427 + 'else' reduce using rule 427 + 'hiding' reduce using rule 427 + 'nominal' reduce using rule 427 + 'phantom' reduce using rule 427 + 'representational'reduce using rule 427 + 'role' reduce using rule 427 + 'where' reduce using rule 427 + '(->)' reduce using rule 427 + '(..)' reduce using rule 427 + LOWER reduce using rule 427 + UPPER reduce using rule 427 + QUAL_UPPER reduce using rule 427 + SYMBOL reduce using rule 427 + QUAL_SYMBOL reduce using rule 427 + LIT_HOLE reduce using rule 427 + LIT_STRING reduce using rule 427 + LIT_RAW_STRING reduce using rule 427 + LIT_INT reduce using rule 427 + %eof reduce using rule 427 + + +State 334 + + constraint -> qualProperName manyOrEmpty__typeAtom__ . (rule 315) + + ')' reduce using rule 315 + '<=' reduce using rule 315 + ',' reduce using rule 315 + + +State 335 + + manyOrEmpty__typeAtom__ -> many__typeAtom__ . (rule 351) + + error reduce using rule 351 + ')' reduce using rule 351 + '\}' reduce using rule 351 + '\;' reduce using rule 351 + '<=' reduce using rule 351 + '=>' reduce using rule 351 + '|' reduce using rule 351 + ',' reduce using rule 351 + 'else' reduce using rule 351 + 'where' reduce using rule 351 + %eof reduce using rule 351 + + +State 336 + + many__typeAtom__ -> many1__typeAtom__ . (rule 374) + many1__typeAtom__ -> many1__typeAtom__ . typeAtom (rule 428) + + error reduce using rule 374 + '(' shift, and enter state 148 + ')' reduce using rule 374 + '{' shift, and enter state 149 + '\}' reduce using rule 374 + '\;' reduce using rule 374 + '<=' reduce using rule 374 + '=>' reduce using rule 374 + '|' reduce using rule 374 + ',' reduce using rule 374 + '_' shift, and enter state 150 + 'as' shift, and enter state 45 + 'else' reduce using rule 374 + 'hiding' shift, and enter state 47 + 'nominal' shift, and enter state 48 + 'phantom' shift, and enter state 49 + 'representational'shift, and enter state 50 + 'role' shift, and enter state 51 + 'where' reduce using rule 374 + '(->)' shift, and enter state 154 + '(..)' shift, and enter state 112 + LOWER shift, and enter state 53 + UPPER shift, and enter state 54 + QUAL_UPPER shift, and enter state 55 + SYMBOL shift, and enter state 115 + QUAL_SYMBOL shift, and enter state 116 + LIT_HOLE shift, and enter state 117 + LIT_STRING shift, and enter state 57 + LIT_RAW_STRING shift, and enter state 58 + LIT_INT shift, and enter state 155 + %eof reduce using rule 374 + + qualProperName goto state 133 + ident goto state 134 + qualSymbol goto state 135 + hole goto state 136 + string goto state 137 + int goto state 138 + typeAtom goto state 367 + +State 337 + + manyOrEmpty__typeVarBinding__ -> many__typeVarBinding__ . (rule 353) + + error reduce using rule 353 + '|' reduce using rule 353 + + +State 338 + + classNameAndFundeps -> properName manyOrEmpty__typeVarBinding__ . fundeps (rule 303) + + error reduce using rule 304 + '|' shift, and enter state 366 + + fundeps goto state 365 + +State 339 + + binder2 -> '-' number . (rule 227) + + ')' reduce using rule 227 + '}' reduce using rule 227 + ']' reduce using rule 227 + '\}' reduce using rule 227 + '<-' reduce using rule 227 + '->' reduce using rule 227 + '<=' reduce using rule 227 + ':' reduce using rule 227 + '::' reduce using rule 227 + '=' reduce using rule 227 + '|' reduce using rule 227 + ',' reduce using rule 227 + '-' reduce using rule 227 + OPERATOR reduce using rule 227 + QUAL_OPERATOR reduce using rule 227 + + +State 340 + + sep1__binder__','__ -> binder . (rule 431) + + ']' reduce using rule 431 + ',' reduce using rule 431 + + +State 341 + + delim__'['__binder__','__']'__ -> '[' sep__binder__','__ . ']' (rule 335) + + ']' shift, and enter state 364 + + +State 342 + + sep__binder__','__ -> sep1__binder__','__ . (rule 398) + sep1__binder__','__ -> sep1__binder__','__ . ',' binder (rule 432) + + ']' reduce using rule 398 + ',' shift, and enter state 363 + + +State 343 + + delim__'['__binder__','__']'__ -> '[' ']' . (rule 334) + + '(' reduce using rule 334 + ')' reduce using rule 334 + '{' reduce using rule 334 + '}' reduce using rule 334 + '[' reduce using rule 334 + ']' reduce using rule 334 + '\}' reduce using rule 334 + '<-' reduce using rule 334 + '->' reduce using rule 334 + '<=' reduce using rule 334 + ':' reduce using rule 334 + '::' reduce using rule 334 + '=' reduce using rule 334 + '|' reduce using rule 334 + ',' reduce using rule 334 + '_' reduce using rule 334 + '-' reduce using rule 334 + 'as' reduce using rule 334 + 'false' reduce using rule 334 + 'hiding' reduce using rule 334 + 'nominal' reduce using rule 334 + 'phantom' reduce using rule 334 + 'representational'reduce using rule 334 + 'role' reduce using rule 334 + 'true' reduce using rule 334 + LOWER reduce using rule 334 + UPPER reduce using rule 334 + QUAL_UPPER reduce using rule 334 + OPERATOR reduce using rule 334 + QUAL_OPERATOR reduce using rule 334 + LIT_CHAR reduce using rule 334 + LIT_STRING reduce using rule 334 + LIT_RAW_STRING reduce using rule 334 + LIT_INT reduce using rule 334 + LIT_NUMBER reduce using rule 334 + + +State 344 + + recordBinder -> label . (rule 239) + recordBinder -> label . '=' binder (rule 240) + recordBinder -> label . ':' binder (rule 241) + + '}' reduce using rule 239 + ':' shift, and enter state 361 + '=' shift, and enter state 362 + ',' reduce using rule 239 + + +State 345 + + sep1__recordBinder__','__ -> recordBinder . (rule 433) + + '}' reduce using rule 433 + ',' reduce using rule 433 + + +State 346 + + delim__'{'__recordBinder__','__'}'__ -> '{' sep__recordBinder__','__ . '}' (rule 339) + + '}' shift, and enter state 360 + + +State 347 + + sep__recordBinder__','__ -> sep1__recordBinder__','__ . (rule 399) + sep1__recordBinder__','__ -> sep1__recordBinder__','__ . ',' recordBinder (rule 434) + + '}' reduce using rule 399 + ',' shift, and enter state 359 + + +State 348 + + delim__'{'__recordBinder__','__'}'__ -> '{' '}' . (rule 338) + + '(' reduce using rule 338 + ')' reduce using rule 338 + '{' reduce using rule 338 + '}' reduce using rule 338 + '[' reduce using rule 338 + ']' reduce using rule 338 + '\}' reduce using rule 338 + '<-' reduce using rule 338 + '->' reduce using rule 338 + '<=' reduce using rule 338 + ':' reduce using rule 338 + '::' reduce using rule 338 + '=' reduce using rule 338 + '|' reduce using rule 338 + ',' reduce using rule 338 + '_' reduce using rule 338 + '-' reduce using rule 338 + 'as' reduce using rule 338 + 'false' reduce using rule 338 + 'hiding' reduce using rule 338 + 'nominal' reduce using rule 338 + 'phantom' reduce using rule 338 + 'representational'reduce using rule 338 + 'role' reduce using rule 338 + 'true' reduce using rule 338 + LOWER reduce using rule 338 + UPPER reduce using rule 338 + QUAL_UPPER reduce using rule 338 + OPERATOR reduce using rule 338 + QUAL_OPERATOR reduce using rule 338 + LIT_CHAR reduce using rule 338 + LIT_STRING reduce using rule 338 + LIT_RAW_STRING reduce using rule 338 + LIT_INT reduce using rule 338 + LIT_NUMBER reduce using rule 338 + + +State 349 + + binderAtom -> '(' binder . ')' (rule 238) + + ')' shift, and enter state 358 + + +State 350 + + many1__binderAtom__ -> many1__binderAtom__ binderAtom . (rule 377) + + '(' reduce using rule 377 + ')' reduce using rule 377 + '{' reduce using rule 377 + '}' reduce using rule 377 + '[' reduce using rule 377 + ']' reduce using rule 377 + '\}' reduce using rule 377 + '<-' reduce using rule 377 + '->' reduce using rule 377 + '<=' reduce using rule 377 + ':' reduce using rule 377 + '::' reduce using rule 377 + '=' reduce using rule 377 + '|' reduce using rule 377 + ',' reduce using rule 377 + '_' reduce using rule 377 + '-' reduce using rule 377 + 'as' reduce using rule 377 + 'false' reduce using rule 377 + 'hiding' reduce using rule 377 + 'nominal' reduce using rule 377 + 'phantom' reduce using rule 377 + 'representational'reduce using rule 377 + 'role' reduce using rule 377 + 'true' reduce using rule 377 + LOWER reduce using rule 377 + UPPER reduce using rule 377 + QUAL_UPPER reduce using rule 377 + OPERATOR reduce using rule 377 + QUAL_OPERATOR reduce using rule 377 + LIT_CHAR reduce using rule 377 + LIT_STRING reduce using rule 377 + LIT_RAW_STRING reduce using rule 377 + LIT_INT reduce using rule 377 + LIT_NUMBER reduce using rule 377 + + +State 351 + + binder1 -> binder1 qualOp . binder2 (rule 225) + + '(' shift, and enter state 40 + '{' shift, and enter state 41 + '[' shift, and enter state 42 + '_' shift, and enter state 43 + '-' shift, and enter state 44 + 'as' shift, and enter state 45 + 'false' shift, and enter state 46 + 'hiding' shift, and enter state 47 + 'nominal' shift, and enter state 48 + 'phantom' shift, and enter state 49 + 'representational'shift, and enter state 50 + 'role' shift, and enter state 51 + 'true' shift, and enter state 52 + LOWER shift, and enter state 53 + UPPER shift, and enter state 54 + QUAL_UPPER shift, and enter state 55 + LIT_CHAR shift, and enter state 56 + LIT_STRING shift, and enter state 57 + LIT_RAW_STRING shift, and enter state 58 + LIT_INT shift, and enter state 59 + LIT_NUMBER shift, and enter state 60 + + qualProperName goto state 25 + ident goto state 26 + string goto state 27 + char goto state 28 + number goto state 29 + boolean goto state 30 + binder2 goto state 357 + binderAtom goto state 35 + delim__'['__binder__','__']'__goto state 36 + delim__'{'__recordBinder__','__'}'__goto state 37 + many__binderAtom__goto state 38 + many1__binderAtom__goto state 39 + +State 352 + + binder -> binder1 '::' . type (rule 223) + + '(' shift, and enter state 148 + '{' shift, and enter state 149 + '_' shift, and enter state 150 + '-' shift, and enter state 151 + 'as' shift, and enter state 45 + 'forall' shift, and enter state 152 + 'forallu' shift, and enter state 153 + 'hiding' shift, and enter state 47 + 'nominal' shift, and enter state 48 + 'phantom' shift, and enter state 49 + 'representational'shift, and enter state 50 + 'role' shift, and enter state 51 + '(->)' shift, and enter state 154 + '(..)' shift, and enter state 112 + LOWER shift, and enter state 53 + UPPER shift, and enter state 54 + QUAL_UPPER shift, and enter state 55 + SYMBOL shift, and enter state 115 + QUAL_SYMBOL shift, and enter state 116 + LIT_HOLE shift, and enter state 117 + LIT_STRING shift, and enter state 57 + LIT_RAW_STRING shift, and enter state 58 + LIT_INT shift, and enter state 155 + + qualProperName goto state 133 + ident goto state 134 + qualSymbol goto state 135 + hole goto state 136 + string goto state 137 + int goto state 138 + type goto state 356 + type1 goto state 140 + type2 goto state 141 + type3 goto state 142 + type4 goto state 143 + type5 goto state 144 + typeAtom goto state 145 + forall goto state 146 + +State 353 + + binderAndArrow -> binder '<-' . (rule 221) + + error reduce using rule 221 + + +State 354 + + binderAtom -> ident '@' . binderAtom (rule 230) + + '(' shift, and enter state 40 + '{' shift, and enter state 41 + '[' shift, and enter state 42 + '_' shift, and enter state 43 + 'as' shift, and enter state 45 + 'false' shift, and enter state 46 + 'hiding' shift, and enter state 47 + 'nominal' shift, and enter state 48 + 'phantom' shift, and enter state 49 + 'representational'shift, and enter state 50 + 'role' shift, and enter state 51 + 'true' shift, and enter state 52 + LOWER shift, and enter state 53 + UPPER shift, and enter state 54 + QUAL_UPPER shift, and enter state 55 + LIT_CHAR shift, and enter state 56 + LIT_STRING shift, and enter state 57 + LIT_RAW_STRING shift, and enter state 58 + LIT_INT shift, and enter state 59 + LIT_NUMBER shift, and enter state 60 + + qualProperName goto state 25 + ident goto state 26 + string goto state 27 + char goto state 28 + number goto state 29 + boolean goto state 30 + binderAtom goto state 355 + delim__'['__binder__','__']'__goto state 36 + delim__'{'__recordBinder__','__'}'__goto state 37 + +State 355 + + binderAtom -> ident '@' binderAtom . (rule 230) + + '(' reduce using rule 230 + ')' reduce using rule 230 + '{' reduce using rule 230 + '}' reduce using rule 230 + '[' reduce using rule 230 + ']' reduce using rule 230 + '\}' reduce using rule 230 + '<-' reduce using rule 230 + '->' reduce using rule 230 + '<=' reduce using rule 230 + ':' reduce using rule 230 + '::' reduce using rule 230 + '=' reduce using rule 230 + '|' reduce using rule 230 + ',' reduce using rule 230 + '_' reduce using rule 230 + '-' reduce using rule 230 + 'as' reduce using rule 230 + 'false' reduce using rule 230 + 'hiding' reduce using rule 230 + 'nominal' reduce using rule 230 + 'phantom' reduce using rule 230 + 'representational'reduce using rule 230 + 'role' reduce using rule 230 + 'true' reduce using rule 230 + LOWER reduce using rule 230 + UPPER reduce using rule 230 + QUAL_UPPER reduce using rule 230 + OPERATOR reduce using rule 230 + QUAL_OPERATOR reduce using rule 230 + LIT_CHAR reduce using rule 230 + LIT_STRING reduce using rule 230 + LIT_RAW_STRING reduce using rule 230 + LIT_INT reduce using rule 230 + LIT_NUMBER reduce using rule 230 + + +State 356 + + binder -> binder1 '::' type . (rule 223) + + ')' reduce using rule 223 + '}' reduce using rule 223 + ']' reduce using rule 223 + '<-' reduce using rule 223 + ',' reduce using rule 223 + + +State 357 + + binder1 -> binder1 qualOp binder2 . (rule 225) + + ')' reduce using rule 225 + '}' reduce using rule 225 + ']' reduce using rule 225 + '\}' reduce using rule 225 + '<-' reduce using rule 225 + '->' reduce using rule 225 + '<=' reduce using rule 225 + ':' reduce using rule 225 + '::' reduce using rule 225 + '=' reduce using rule 225 + '|' reduce using rule 225 + ',' reduce using rule 225 + '-' reduce using rule 225 + OPERATOR reduce using rule 225 + QUAL_OPERATOR reduce using rule 225 + + +State 358 + + binderAtom -> '(' binder ')' . (rule 238) + + '(' reduce using rule 238 + ')' reduce using rule 238 + '{' reduce using rule 238 + '}' reduce using rule 238 + '[' reduce using rule 238 + ']' reduce using rule 238 + '\}' reduce using rule 238 + '<-' reduce using rule 238 + '->' reduce using rule 238 + '<=' reduce using rule 238 + ':' reduce using rule 238 + '::' reduce using rule 238 + '=' reduce using rule 238 + '|' reduce using rule 238 + ',' reduce using rule 238 + '_' reduce using rule 238 + '-' reduce using rule 238 + 'as' reduce using rule 238 + 'false' reduce using rule 238 + 'hiding' reduce using rule 238 + 'nominal' reduce using rule 238 + 'phantom' reduce using rule 238 + 'representational'reduce using rule 238 + 'role' reduce using rule 238 + 'true' reduce using rule 238 + LOWER reduce using rule 238 + UPPER reduce using rule 238 + QUAL_UPPER reduce using rule 238 + OPERATOR reduce using rule 238 + QUAL_OPERATOR reduce using rule 238 + LIT_CHAR reduce using rule 238 + LIT_STRING reduce using rule 238 + LIT_RAW_STRING reduce using rule 238 + LIT_INT reduce using rule 238 + LIT_NUMBER reduce using rule 238 + + +State 359 + + sep1__recordBinder__','__ -> sep1__recordBinder__','__ ',' . recordBinder (rule 434) + + 'ado' shift, and enter state 230 + 'as' shift, and enter state 231 + 'case' shift, and enter state 232 + 'class' shift, and enter state 233 + 'data' shift, and enter state 234 + 'derive' shift, and enter state 235 + 'do' shift, and enter state 236 + 'else' shift, and enter state 237 + 'false' shift, and enter state 238 + 'forall' shift, and enter state 239 + 'foreign' shift, and enter state 240 + 'hiding' shift, and enter state 241 + 'import' shift, and enter state 242 + 'if' shift, and enter state 243 + 'in' shift, and enter state 244 + 'infix' shift, and enter state 245 + 'infixl' shift, and enter state 246 + 'infixr' shift, and enter state 247 + 'instance' shift, and enter state 248 + 'let' shift, and enter state 249 + 'module' shift, and enter state 250 + 'newtype' shift, and enter state 251 + 'nominal' shift, and enter state 252 + 'phantom' shift, and enter state 253 + 'of' shift, and enter state 254 + 'representational'shift, and enter state 255 + 'role' shift, and enter state 256 + 'then' shift, and enter state 257 + 'true' shift, and enter state 258 + 'type' shift, and enter state 259 + 'where' shift, and enter state 260 + LOWER shift, and enter state 261 + LIT_STRING shift, and enter state 262 + LIT_RAW_STRING shift, and enter state 263 + + label goto state 344 + recordBinder goto state 570 + +State 360 + + delim__'{'__recordBinder__','__'}'__ -> '{' sep__recordBinder__','__ '}' . (rule 339) + + '(' reduce using rule 339 + ')' reduce using rule 339 + '{' reduce using rule 339 + '}' reduce using rule 339 + '[' reduce using rule 339 + ']' reduce using rule 339 + '\}' reduce using rule 339 + '<-' reduce using rule 339 + '->' reduce using rule 339 + '<=' reduce using rule 339 + ':' reduce using rule 339 + '::' reduce using rule 339 + '=' reduce using rule 339 + '|' reduce using rule 339 + ',' reduce using rule 339 + '_' reduce using rule 339 + '-' reduce using rule 339 + 'as' reduce using rule 339 + 'false' reduce using rule 339 + 'hiding' reduce using rule 339 + 'nominal' reduce using rule 339 + 'phantom' reduce using rule 339 + 'representational'reduce using rule 339 + 'role' reduce using rule 339 + 'true' reduce using rule 339 + LOWER reduce using rule 339 + UPPER reduce using rule 339 + QUAL_UPPER reduce using rule 339 + OPERATOR reduce using rule 339 + QUAL_OPERATOR reduce using rule 339 + LIT_CHAR reduce using rule 339 + LIT_STRING reduce using rule 339 + LIT_RAW_STRING reduce using rule 339 + LIT_INT reduce using rule 339 + LIT_NUMBER reduce using rule 339 + + +State 361 + + recordBinder -> label ':' . binder (rule 241) + + '(' shift, and enter state 40 + '{' shift, and enter state 41 + '[' shift, and enter state 42 + '_' shift, and enter state 43 + '-' shift, and enter state 44 + 'as' shift, and enter state 45 + 'false' shift, and enter state 46 + 'hiding' shift, and enter state 47 + 'nominal' shift, and enter state 48 + 'phantom' shift, and enter state 49 + 'representational'shift, and enter state 50 + 'role' shift, and enter state 51 + 'true' shift, and enter state 52 + LOWER shift, and enter state 53 + UPPER shift, and enter state 54 + QUAL_UPPER shift, and enter state 55 + LIT_CHAR shift, and enter state 56 + LIT_STRING shift, and enter state 57 + LIT_RAW_STRING shift, and enter state 58 + LIT_INT shift, and enter state 59 + LIT_NUMBER shift, and enter state 60 + + qualProperName goto state 25 + ident goto state 26 + string goto state 27 + char goto state 28 + number goto state 29 + boolean goto state 30 + binder goto state 569 + binder1 goto state 33 + binder2 goto state 34 + binderAtom goto state 35 + delim__'['__binder__','__']'__goto state 36 + delim__'{'__recordBinder__','__'}'__goto state 37 + many__binderAtom__goto state 38 + many1__binderAtom__goto state 39 + +State 362 + + recordBinder -> label '=' . binder (rule 240) + + '(' shift, and enter state 40 + '{' shift, and enter state 41 + '[' shift, and enter state 42 + '_' shift, and enter state 43 + '-' shift, and enter state 44 + 'as' shift, and enter state 45 + 'false' shift, and enter state 46 + 'hiding' shift, and enter state 47 + 'nominal' shift, and enter state 48 + 'phantom' shift, and enter state 49 + 'representational'shift, and enter state 50 + 'role' shift, and enter state 51 + 'true' shift, and enter state 52 + LOWER shift, and enter state 53 + UPPER shift, and enter state 54 + QUAL_UPPER shift, and enter state 55 + LIT_CHAR shift, and enter state 56 + LIT_STRING shift, and enter state 57 + LIT_RAW_STRING shift, and enter state 58 + LIT_INT shift, and enter state 59 + LIT_NUMBER shift, and enter state 60 + + qualProperName goto state 25 + ident goto state 26 + string goto state 27 + char goto state 28 + number goto state 29 + boolean goto state 30 + binder goto state 568 + binder1 goto state 33 + binder2 goto state 34 + binderAtom goto state 35 + delim__'['__binder__','__']'__goto state 36 + delim__'{'__recordBinder__','__'}'__goto state 37 + many__binderAtom__goto state 38 + many1__binderAtom__goto state 39 + +State 363 + + sep1__binder__','__ -> sep1__binder__','__ ',' . binder (rule 432) + + '(' shift, and enter state 40 + '{' shift, and enter state 41 + '[' shift, and enter state 42 + '_' shift, and enter state 43 + '-' shift, and enter state 44 + 'as' shift, and enter state 45 + 'false' shift, and enter state 46 + 'hiding' shift, and enter state 47 + 'nominal' shift, and enter state 48 + 'phantom' shift, and enter state 49 + 'representational'shift, and enter state 50 + 'role' shift, and enter state 51 + 'true' shift, and enter state 52 + LOWER shift, and enter state 53 + UPPER shift, and enter state 54 + QUAL_UPPER shift, and enter state 55 + LIT_CHAR shift, and enter state 56 + LIT_STRING shift, and enter state 57 + LIT_RAW_STRING shift, and enter state 58 + LIT_INT shift, and enter state 59 + LIT_NUMBER shift, and enter state 60 + + qualProperName goto state 25 + ident goto state 26 + string goto state 27 + char goto state 28 + number goto state 29 + boolean goto state 30 + binder goto state 567 + binder1 goto state 33 + binder2 goto state 34 + binderAtom goto state 35 + delim__'['__binder__','__']'__goto state 36 + delim__'{'__recordBinder__','__'}'__goto state 37 + many__binderAtom__goto state 38 + many1__binderAtom__goto state 39 + +State 364 + + delim__'['__binder__','__']'__ -> '[' sep__binder__','__ ']' . (rule 335) + + '(' reduce using rule 335 + ')' reduce using rule 335 + '{' reduce using rule 335 + '}' reduce using rule 335 + '[' reduce using rule 335 + ']' reduce using rule 335 + '\}' reduce using rule 335 + '<-' reduce using rule 335 + '->' reduce using rule 335 + '<=' reduce using rule 335 + ':' reduce using rule 335 + '::' reduce using rule 335 + '=' reduce using rule 335 + '|' reduce using rule 335 + ',' reduce using rule 335 + '_' reduce using rule 335 + '-' reduce using rule 335 + 'as' reduce using rule 335 + 'false' reduce using rule 335 + 'hiding' reduce using rule 335 + 'nominal' reduce using rule 335 + 'phantom' reduce using rule 335 + 'representational'reduce using rule 335 + 'role' reduce using rule 335 + 'true' reduce using rule 335 + LOWER reduce using rule 335 + UPPER reduce using rule 335 + QUAL_UPPER reduce using rule 335 + OPERATOR reduce using rule 335 + QUAL_OPERATOR reduce using rule 335 + LIT_CHAR reduce using rule 335 + LIT_STRING reduce using rule 335 + LIT_RAW_STRING reduce using rule 335 + LIT_INT reduce using rule 335 + LIT_NUMBER reduce using rule 335 + + +State 365 + + classNameAndFundeps -> properName manyOrEmpty__typeVarBinding__ fundeps . (rule 303) + + error reduce using rule 303 + + +State 366 + + fundeps -> '|' . sep__fundep__','__ (rule 305) + + '->' shift, and enter state 566 + 'as' shift, and enter state 45 + 'hiding' shift, and enter state 47 + 'nominal' shift, and enter state 48 + 'phantom' shift, and enter state 49 + 'representational'shift, and enter state 50 + 'role' shift, and enter state 51 + LOWER shift, and enter state 53 + + ident goto state 560 + fundep goto state 561 + many__ident__ goto state 562 + sep__fundep__','__goto state 563 + many1__ident__ goto state 564 + sep1__fundep__','__goto state 565 + +State 367 + + many1__typeAtom__ -> many1__typeAtom__ typeAtom . (rule 428) + + error reduce using rule 428 + '(' reduce using rule 428 + ')' reduce using rule 428 + '{' reduce using rule 428 + '\}' reduce using rule 428 + '\;' reduce using rule 428 + '<=' reduce using rule 428 + '=>' reduce using rule 428 + '|' reduce using rule 428 + ',' reduce using rule 428 + '_' reduce using rule 428 + 'as' reduce using rule 428 + 'else' reduce using rule 428 + 'hiding' reduce using rule 428 + 'nominal' reduce using rule 428 + 'phantom' reduce using rule 428 + 'representational'reduce using rule 428 + 'role' reduce using rule 428 + 'where' reduce using rule 428 + '(->)' reduce using rule 428 + '(..)' reduce using rule 428 + LOWER reduce using rule 428 + UPPER reduce using rule 428 + QUAL_UPPER reduce using rule 428 + SYMBOL reduce using rule 428 + QUAL_SYMBOL reduce using rule 428 + LIT_HOLE reduce using rule 428 + LIT_STRING reduce using rule 428 + LIT_RAW_STRING reduce using rule 428 + LIT_INT reduce using rule 428 + %eof reduce using rule 428 + + +State 368 + + constraint -> '(' constraint . ')' (rule 316) + + ')' shift, and enter state 371 + + +State 369 + + sep1__constraint__','__ -> sep1__constraint__','__ ',' . constraint (rule 404) + + '(' shift, and enter state 331 + UPPER shift, and enter state 54 + QUAL_UPPER shift, and enter state 55 + + qualProperName goto state 64 + constraint goto state 559 + +State 370 + + constraints -> '(' sep__constraint__','__ ')' . (rule 314) + + '<=' reduce using rule 314 + '=>' reduce using rule 314 + + +State 371 + + constraint -> '(' constraint ')' . (rule 316) + + ')' reduce using rule 316 + '<=' reduce using rule 316 + '=>' reduce using rule 316 + ',' reduce using rule 316 + + +State 372 + + classSignature -> properName '::' type . (rule 301) + + error reduce using rule 301 + + +State 373 + + expr2 -> expr2 '`' exprBacktick . '`' expr3 (rule 154) + exprBacktick -> exprBacktick . qualOp expr3 (rule 156) + + '<=' shift, and enter state 293 + ':' shift, and enter state 295 + '`' shift, and enter state 558 + '-' shift, and enter state 296 + OPERATOR shift, and enter state 297 + QUAL_OPERATOR shift, and enter state 298 + + qualOp goto state 557 + +State 374 + + exprBacktick -> expr3 . (rule 155) + + '<=' reduce using rule 155 + ':' reduce using rule 155 + '`' reduce using rule 155 + '-' reduce using rule 155 + OPERATOR reduce using rule 155 + QUAL_OPERATOR reduce using rule 155 + + +State 375 + + expr4 -> expr4 '@' typeAtom . (rule 161) + + error reduce using rule 161 + '(' reduce using rule 161 + ')' reduce using rule 161 + '{' reduce using rule 161 + '}' reduce using rule 161 + '[' reduce using rule 161 + ']' reduce using rule 161 + '\}' reduce using rule 161 + '\;' reduce using rule 161 + '<=' reduce using rule 161 + ':' reduce using rule 161 + '::' reduce using rule 161 + '|' reduce using rule 161 + '`' reduce using rule 161 + ',' reduce using rule 161 + '_' reduce using rule 161 + '\\' reduce using rule 161 + '-' reduce using rule 161 + '@' reduce using rule 161 + 'ado' reduce using rule 161 + 'as' reduce using rule 161 + 'case' reduce using rule 161 + 'do' reduce using rule 161 + 'else' reduce using rule 161 + 'false' reduce using rule 161 + 'hiding' reduce using rule 161 + 'if' reduce using rule 161 + 'let' reduce using rule 161 + 'nominal' reduce using rule 161 + 'phantom' reduce using rule 161 + 'of' reduce using rule 161 + 'representational'reduce using rule 161 + 'role' reduce using rule 161 + 'then' reduce using rule 161 + 'true' reduce using rule 161 + 'where' reduce using rule 161 + '(..)' reduce using rule 161 + LOWER reduce using rule 161 + QUAL_LOWER reduce using rule 161 + UPPER reduce using rule 161 + QUAL_UPPER reduce using rule 161 + SYMBOL reduce using rule 161 + QUAL_SYMBOL reduce using rule 161 + OPERATOR reduce using rule 161 + QUAL_OPERATOR reduce using rule 161 + LIT_HOLE reduce using rule 161 + LIT_CHAR reduce using rule 161 + LIT_STRING reduce using rule 161 + LIT_RAW_STRING reduce using rule 161 + LIT_INT reduce using rule 161 + LIT_NUMBER reduce using rule 161 + %eof reduce using rule 161 + + +State 376 + + recordUpdateOrLabel -> label . ':' expr (rule 191) + recordUpdateOrLabel -> label . (rule 192) + recordUpdateOrLabel -> label . '=' expr (rule 193) + recordUpdateOrLabel -> label . '{' sep__recordUpdate__','__ '}' (rule 194) + + '{' shift, and enter state 554 + '}' reduce using rule 192 + ':' shift, and enter state 555 + '=' shift, and enter state 556 + ',' reduce using rule 192 + + +State 377 + + sep1__recordUpdateOrLabel__','__ -> recordUpdateOrLabel . (rule 423) + + '}' reduce using rule 423 + ',' reduce using rule 423 + + +State 378 + + expr6 -> expr7 '{' sep__recordUpdateOrLabel__','__ . '}' (rule 173) + + '}' shift, and enter state 553 + + +State 379 + + sep__recordUpdateOrLabel__','__ -> sep1__recordUpdateOrLabel__','__ . (rule 372) + sep1__recordUpdateOrLabel__','__ -> sep1__recordUpdateOrLabel__','__ . ',' recordUpdateOrLabel (rule 424) + + '}' reduce using rule 372 + ',' shift, and enter state 552 + + +State 380 + + expr6 -> expr7 '{' '}' . (rule 172) + + error reduce using rule 172 + '(' reduce using rule 172 + ')' reduce using rule 172 + '{' reduce using rule 172 + '}' reduce using rule 172 + '[' reduce using rule 172 + ']' reduce using rule 172 + '\}' reduce using rule 172 + '\;' reduce using rule 172 + '<=' reduce using rule 172 + ':' reduce using rule 172 + '::' reduce using rule 172 + '|' reduce using rule 172 + '`' reduce using rule 172 + ',' reduce using rule 172 + '_' reduce using rule 172 + '\\' reduce using rule 172 + '-' reduce using rule 172 + '@' reduce using rule 172 + 'ado' reduce using rule 172 + 'as' reduce using rule 172 + 'case' reduce using rule 172 + 'do' reduce using rule 172 + 'else' reduce using rule 172 + 'false' reduce using rule 172 + 'hiding' reduce using rule 172 + 'if' reduce using rule 172 + 'let' reduce using rule 172 + 'nominal' reduce using rule 172 + 'phantom' reduce using rule 172 + 'of' reduce using rule 172 + 'representational'reduce using rule 172 + 'role' reduce using rule 172 + 'then' reduce using rule 172 + 'true' reduce using rule 172 + 'where' reduce using rule 172 + '(..)' reduce using rule 172 + LOWER reduce using rule 172 + QUAL_LOWER reduce using rule 172 + UPPER reduce using rule 172 + QUAL_UPPER reduce using rule 172 + SYMBOL reduce using rule 172 + QUAL_SYMBOL reduce using rule 172 + OPERATOR reduce using rule 172 + QUAL_OPERATOR reduce using rule 172 + LIT_HOLE reduce using rule 172 + LIT_CHAR reduce using rule 172 + LIT_STRING reduce using rule 172 + LIT_RAW_STRING reduce using rule 172 + LIT_INT reduce using rule 172 + LIT_NUMBER reduce using rule 172 + %eof reduce using rule 172 + + +State 381 + + sep1__label__'.'__ -> label . (rule 417) + + error reduce using rule 417 + '(' reduce using rule 417 + ')' reduce using rule 417 + '{' reduce using rule 417 + '}' reduce using rule 417 + '[' reduce using rule 417 + ']' reduce using rule 417 + '\}' reduce using rule 417 + '\;' reduce using rule 417 + '<=' reduce using rule 417 + ':' reduce using rule 417 + '::' reduce using rule 417 + '|' reduce using rule 417 + '`' reduce using rule 417 + '.' reduce using rule 417 + ',' reduce using rule 417 + '_' reduce using rule 417 + '\\' reduce using rule 417 + '-' reduce using rule 417 + '@' reduce using rule 417 + 'ado' reduce using rule 417 + 'as' reduce using rule 417 + 'case' reduce using rule 417 + 'do' reduce using rule 417 + 'else' reduce using rule 417 + 'false' reduce using rule 417 + 'hiding' reduce using rule 417 + 'if' reduce using rule 417 + 'let' reduce using rule 417 + 'nominal' reduce using rule 417 + 'phantom' reduce using rule 417 + 'of' reduce using rule 417 + 'representational'reduce using rule 417 + 'role' reduce using rule 417 + 'then' reduce using rule 417 + 'true' reduce using rule 417 + 'where' reduce using rule 417 + '(..)' reduce using rule 417 + LOWER reduce using rule 417 + QUAL_LOWER reduce using rule 417 + UPPER reduce using rule 417 + QUAL_UPPER reduce using rule 417 + SYMBOL reduce using rule 417 + QUAL_SYMBOL reduce using rule 417 + OPERATOR reduce using rule 417 + QUAL_OPERATOR reduce using rule 417 + LIT_HOLE reduce using rule 417 + LIT_CHAR reduce using rule 417 + LIT_STRING reduce using rule 417 + LIT_RAW_STRING reduce using rule 417 + LIT_INT reduce using rule 417 + LIT_NUMBER reduce using rule 417 + %eof reduce using rule 417 + + +State 382 + + expr7 -> exprAtom '.' sep__label__'.'__ . (rule 175) + + error reduce using rule 175 + '(' reduce using rule 175 + ')' reduce using rule 175 + '{' reduce using rule 175 + '}' reduce using rule 175 + '[' reduce using rule 175 + ']' reduce using rule 175 + '\}' reduce using rule 175 + '\;' reduce using rule 175 + '<=' reduce using rule 175 + ':' reduce using rule 175 + '::' reduce using rule 175 + '|' reduce using rule 175 + '`' reduce using rule 175 + ',' reduce using rule 175 + '_' reduce using rule 175 + '\\' reduce using rule 175 + '-' reduce using rule 175 + '@' reduce using rule 175 + 'ado' reduce using rule 175 + 'as' reduce using rule 175 + 'case' reduce using rule 175 + 'do' reduce using rule 175 + 'else' reduce using rule 175 + 'false' reduce using rule 175 + 'hiding' reduce using rule 175 + 'if' reduce using rule 175 + 'let' reduce using rule 175 + 'nominal' reduce using rule 175 + 'phantom' reduce using rule 175 + 'of' reduce using rule 175 + 'representational'reduce using rule 175 + 'role' reduce using rule 175 + 'then' reduce using rule 175 + 'true' reduce using rule 175 + 'where' reduce using rule 175 + '(..)' reduce using rule 175 + LOWER reduce using rule 175 + QUAL_LOWER reduce using rule 175 + UPPER reduce using rule 175 + QUAL_UPPER reduce using rule 175 + SYMBOL reduce using rule 175 + QUAL_SYMBOL reduce using rule 175 + OPERATOR reduce using rule 175 + QUAL_OPERATOR reduce using rule 175 + LIT_HOLE reduce using rule 175 + LIT_CHAR reduce using rule 175 + LIT_STRING reduce using rule 175 + LIT_RAW_STRING reduce using rule 175 + LIT_INT reduce using rule 175 + LIT_NUMBER reduce using rule 175 + %eof reduce using rule 175 + + +State 383 + + sep__label__'.'__ -> sep1__label__'.'__ . (rule 369) + sep1__label__'.'__ -> sep1__label__'.'__ . '.' label (rule 418) + + error reduce using rule 369 + '(' reduce using rule 369 + ')' reduce using rule 369 + '{' reduce using rule 369 + '}' reduce using rule 369 + '[' reduce using rule 369 + ']' reduce using rule 369 + '\}' reduce using rule 369 + '\;' reduce using rule 369 + '<=' reduce using rule 369 + ':' reduce using rule 369 + '::' reduce using rule 369 + '|' reduce using rule 369 + '`' reduce using rule 369 + '.' shift, and enter state 551 + ',' reduce using rule 369 + '_' reduce using rule 369 + '\\' reduce using rule 369 + '-' reduce using rule 369 + '@' reduce using rule 369 + 'ado' reduce using rule 369 + 'as' reduce using rule 369 + 'case' reduce using rule 369 + 'do' reduce using rule 369 + 'else' reduce using rule 369 + 'false' reduce using rule 369 + 'hiding' reduce using rule 369 + 'if' reduce using rule 369 + 'let' reduce using rule 369 + 'nominal' reduce using rule 369 + 'phantom' reduce using rule 369 + 'of' reduce using rule 369 + 'representational'reduce using rule 369 + 'role' reduce using rule 369 + 'then' reduce using rule 369 + 'true' reduce using rule 369 + 'where' reduce using rule 369 + '(..)' reduce using rule 369 + LOWER reduce using rule 369 + QUAL_LOWER reduce using rule 369 + UPPER reduce using rule 369 + QUAL_UPPER reduce using rule 369 + SYMBOL reduce using rule 369 + QUAL_SYMBOL reduce using rule 369 + OPERATOR reduce using rule 369 + QUAL_OPERATOR reduce using rule 369 + LIT_HOLE reduce using rule 369 + LIT_CHAR reduce using rule 369 + LIT_STRING reduce using rule 369 + LIT_RAW_STRING reduce using rule 369 + LIT_INT reduce using rule 369 + LIT_NUMBER reduce using rule 369 + %eof reduce using rule 369 + + +State 384 + + expr5 -> adoBlock 'in' expr . (rule 165) + + error reduce using rule 165 + '(' reduce using rule 165 + ')' reduce using rule 165 + '{' reduce using rule 165 + '}' reduce using rule 165 + '[' reduce using rule 165 + ']' reduce using rule 165 + '\}' reduce using rule 165 + '\;' reduce using rule 165 + '<=' reduce using rule 165 + ':' reduce using rule 165 + '::' reduce using rule 165 + '|' reduce using rule 165 + '`' reduce using rule 165 + ',' reduce using rule 165 + '_' reduce using rule 165 + '\\' reduce using rule 165 + '-' reduce using rule 165 + '@' reduce using rule 165 + 'ado' reduce using rule 165 + 'as' reduce using rule 165 + 'case' reduce using rule 165 + 'do' reduce using rule 165 + 'else' reduce using rule 165 + 'false' reduce using rule 165 + 'hiding' reduce using rule 165 + 'if' reduce using rule 165 + 'let' reduce using rule 165 + 'nominal' reduce using rule 165 + 'phantom' reduce using rule 165 + 'of' reduce using rule 165 + 'representational'reduce using rule 165 + 'role' reduce using rule 165 + 'then' reduce using rule 165 + 'true' reduce using rule 165 + 'where' reduce using rule 165 + '(..)' reduce using rule 165 + LOWER reduce using rule 165 + QUAL_LOWER reduce using rule 165 + UPPER reduce using rule 165 + QUAL_UPPER reduce using rule 165 + SYMBOL reduce using rule 165 + QUAL_SYMBOL reduce using rule 165 + OPERATOR reduce using rule 165 + QUAL_OPERATOR reduce using rule 165 + LIT_HOLE reduce using rule 165 + LIT_CHAR reduce using rule 165 + LIT_STRING reduce using rule 165 + LIT_RAW_STRING reduce using rule 165 + LIT_INT reduce using rule 165 + LIT_NUMBER reduce using rule 165 + %eof reduce using rule 165 + + +State 385 + + exprAtom -> '(' expr ')' . (rule 187) + + error reduce using rule 187 + '(' reduce using rule 187 + ')' reduce using rule 187 + '{' reduce using rule 187 + '}' reduce using rule 187 + '[' reduce using rule 187 + ']' reduce using rule 187 + '\}' reduce using rule 187 + '\;' reduce using rule 187 + '<=' reduce using rule 187 + ':' reduce using rule 187 + '::' reduce using rule 187 + '|' reduce using rule 187 + '`' reduce using rule 187 + '.' reduce using rule 187 + ',' reduce using rule 187 + '_' reduce using rule 187 + '\\' reduce using rule 187 + '-' reduce using rule 187 + '@' reduce using rule 187 + 'ado' reduce using rule 187 + 'as' reduce using rule 187 + 'case' reduce using rule 187 + 'do' reduce using rule 187 + 'else' reduce using rule 187 + 'false' reduce using rule 187 + 'hiding' reduce using rule 187 + 'if' reduce using rule 187 + 'let' reduce using rule 187 + 'nominal' reduce using rule 187 + 'phantom' reduce using rule 187 + 'of' reduce using rule 187 + 'representational'reduce using rule 187 + 'role' reduce using rule 187 + 'then' reduce using rule 187 + 'true' reduce using rule 187 + 'where' reduce using rule 187 + '(..)' reduce using rule 187 + LOWER reduce using rule 187 + QUAL_LOWER reduce using rule 187 + UPPER reduce using rule 187 + QUAL_UPPER reduce using rule 187 + SYMBOL reduce using rule 187 + QUAL_SYMBOL reduce using rule 187 + OPERATOR reduce using rule 187 + QUAL_OPERATOR reduce using rule 187 + LIT_HOLE reduce using rule 187 + LIT_CHAR reduce using rule 187 + LIT_STRING reduce using rule 187 + LIT_RAW_STRING reduce using rule 187 + LIT_INT reduce using rule 187 + LIT_NUMBER reduce using rule 187 + %eof reduce using rule 187 + + +State 386 + + sep1__recordLabel__','__ -> sep1__recordLabel__','__ ',' . recordLabel (rule 436) + + 'ado' shift, and enter state 230 + 'as' shift, and enter state 231 + 'case' shift, and enter state 232 + 'class' shift, and enter state 233 + 'data' shift, and enter state 234 + 'derive' shift, and enter state 235 + 'do' shift, and enter state 236 + 'else' shift, and enter state 237 + 'false' shift, and enter state 238 + 'forall' shift, and enter state 239 + 'foreign' shift, and enter state 240 + 'hiding' shift, and enter state 241 + 'import' shift, and enter state 242 + 'if' shift, and enter state 243 + 'in' shift, and enter state 244 + 'infix' shift, and enter state 245 + 'infixl' shift, and enter state 246 + 'infixr' shift, and enter state 247 + 'instance' shift, and enter state 248 + 'let' shift, and enter state 249 + 'module' shift, and enter state 250 + 'newtype' shift, and enter state 251 + 'nominal' shift, and enter state 252 + 'phantom' shift, and enter state 253 + 'of' shift, and enter state 254 + 'representational'shift, and enter state 255 + 'role' shift, and enter state 256 + 'then' shift, and enter state 257 + 'true' shift, and enter state 258 + 'type' shift, and enter state 259 + 'where' shift, and enter state 260 + LOWER shift, and enter state 261 + LIT_STRING shift, and enter state 262 + LIT_RAW_STRING shift, and enter state 263 + + label goto state 315 + recordLabel goto state 550 + +State 387 + + delim__'{'__recordLabel__','__'}'__ -> '{' sep__recordLabel__','__ '}' . (rule 341) + + error reduce using rule 341 + '(' reduce using rule 341 + ')' reduce using rule 341 + '{' reduce using rule 341 + '}' reduce using rule 341 + '[' reduce using rule 341 + ']' reduce using rule 341 + '\}' reduce using rule 341 + '\;' reduce using rule 341 + '<=' reduce using rule 341 + ':' reduce using rule 341 + '::' reduce using rule 341 + '|' reduce using rule 341 + '`' reduce using rule 341 + '.' reduce using rule 341 + ',' reduce using rule 341 + '_' reduce using rule 341 + '\\' reduce using rule 341 + '-' reduce using rule 341 + '@' reduce using rule 341 + 'ado' reduce using rule 341 + 'as' reduce using rule 341 + 'case' reduce using rule 341 + 'do' reduce using rule 341 + 'else' reduce using rule 341 + 'false' reduce using rule 341 + 'hiding' reduce using rule 341 + 'if' reduce using rule 341 + 'let' reduce using rule 341 + 'nominal' reduce using rule 341 + 'phantom' reduce using rule 341 + 'of' reduce using rule 341 + 'representational'reduce using rule 341 + 'role' reduce using rule 341 + 'then' reduce using rule 341 + 'true' reduce using rule 341 + 'where' reduce using rule 341 + '(..)' reduce using rule 341 + LOWER reduce using rule 341 + QUAL_LOWER reduce using rule 341 + UPPER reduce using rule 341 + QUAL_UPPER reduce using rule 341 + SYMBOL reduce using rule 341 + QUAL_SYMBOL reduce using rule 341 + OPERATOR reduce using rule 341 + QUAL_OPERATOR reduce using rule 341 + LIT_HOLE reduce using rule 341 + LIT_CHAR reduce using rule 341 + LIT_STRING reduce using rule 341 + LIT_RAW_STRING reduce using rule 341 + LIT_INT reduce using rule 341 + LIT_NUMBER reduce using rule 341 + %eof reduce using rule 341 + + +State 388 + + recordLabel -> label ':' . expr (rule 190) + + '(' shift, and enter state 95 + '{' shift, and enter state 96 + '[' shift, and enter state 97 + '_' shift, and enter state 98 + '\\' shift, and enter state 99 + '-' shift, and enter state 100 + 'ado' shift, and enter state 101 + 'as' shift, and enter state 102 + 'case' shift, and enter state 103 + 'do' shift, and enter state 104 + 'false' shift, and enter state 46 + 'hiding' shift, and enter state 105 + 'if' shift, and enter state 106 + 'let' shift, and enter state 107 + 'nominal' shift, and enter state 108 + 'phantom' shift, and enter state 109 + 'representational'shift, and enter state 110 + 'role' shift, and enter state 111 + 'true' shift, and enter state 52 + '(..)' shift, and enter state 112 + LOWER shift, and enter state 113 + QUAL_LOWER shift, and enter state 114 + UPPER shift, and enter state 54 + QUAL_UPPER shift, and enter state 55 + SYMBOL shift, and enter state 115 + QUAL_SYMBOL shift, and enter state 116 + LIT_HOLE shift, and enter state 117 + LIT_CHAR shift, and enter state 56 + LIT_STRING shift, and enter state 57 + LIT_RAW_STRING shift, and enter state 58 + LIT_INT shift, and enter state 59 + LIT_NUMBER shift, and enter state 60 + + qualProperName goto state 74 + qualIdent goto state 75 + qualSymbol goto state 76 + hole goto state 77 + string goto state 78 + char goto state 79 + number goto state 80 + boolean goto state 81 + expr goto state 549 + expr1 goto state 122 + expr2 goto state 83 + expr3 goto state 84 + expr4 goto state 85 + expr5 goto state 86 + expr6 goto state 87 + expr7 goto state 88 + exprAtom goto state 89 + doBlock goto state 90 + adoBlock goto state 91 + delim__'['__expr__','__']'__goto state 93 + delim__'{'__recordLabel__','__'}'__goto state 94 + +State 389 + + recordLabel -> label '=' . expr (rule 189) + + '(' shift, and enter state 95 + '{' shift, and enter state 96 + '[' shift, and enter state 97 + '_' shift, and enter state 98 + '\\' shift, and enter state 99 + '-' shift, and enter state 100 + 'ado' shift, and enter state 101 + 'as' shift, and enter state 102 + 'case' shift, and enter state 103 + 'do' shift, and enter state 104 + 'false' shift, and enter state 46 + 'hiding' shift, and enter state 105 + 'if' shift, and enter state 106 + 'let' shift, and enter state 107 + 'nominal' shift, and enter state 108 + 'phantom' shift, and enter state 109 + 'representational'shift, and enter state 110 + 'role' shift, and enter state 111 + 'true' shift, and enter state 52 + '(..)' shift, and enter state 112 + LOWER shift, and enter state 113 + QUAL_LOWER shift, and enter state 114 + UPPER shift, and enter state 54 + QUAL_UPPER shift, and enter state 55 + SYMBOL shift, and enter state 115 + QUAL_SYMBOL shift, and enter state 116 + LIT_HOLE shift, and enter state 117 + LIT_CHAR shift, and enter state 56 + LIT_STRING shift, and enter state 57 + LIT_RAW_STRING shift, and enter state 58 + LIT_INT shift, and enter state 59 + LIT_NUMBER shift, and enter state 60 + + qualProperName goto state 74 + qualIdent goto state 75 + qualSymbol goto state 76 + hole goto state 77 + string goto state 78 + char goto state 79 + number goto state 80 + boolean goto state 81 + expr goto state 548 + expr1 goto state 122 + expr2 goto state 83 + expr3 goto state 84 + expr4 goto state 85 + expr5 goto state 86 + expr6 goto state 87 + expr7 goto state 88 + exprAtom goto state 89 + doBlock goto state 90 + adoBlock goto state 91 + delim__'['__expr__','__']'__goto state 93 + delim__'{'__recordLabel__','__'}'__goto state 94 + +State 390 + + delim__'['__expr__','__']'__ -> '[' sep__expr__','__ ']' . (rule 337) + + error reduce using rule 337 + '(' reduce using rule 337 + ')' reduce using rule 337 + '{' reduce using rule 337 + '}' reduce using rule 337 + '[' reduce using rule 337 + ']' reduce using rule 337 + '\}' reduce using rule 337 + '\;' reduce using rule 337 + '<=' reduce using rule 337 + ':' reduce using rule 337 + '::' reduce using rule 337 + '|' reduce using rule 337 + '`' reduce using rule 337 + '.' reduce using rule 337 + ',' reduce using rule 337 + '_' reduce using rule 337 + '\\' reduce using rule 337 + '-' reduce using rule 337 + '@' reduce using rule 337 + 'ado' reduce using rule 337 + 'as' reduce using rule 337 + 'case' reduce using rule 337 + 'do' reduce using rule 337 + 'else' reduce using rule 337 + 'false' reduce using rule 337 + 'hiding' reduce using rule 337 + 'if' reduce using rule 337 + 'let' reduce using rule 337 + 'nominal' reduce using rule 337 + 'phantom' reduce using rule 337 + 'of' reduce using rule 337 + 'representational'reduce using rule 337 + 'role' reduce using rule 337 + 'then' reduce using rule 337 + 'true' reduce using rule 337 + 'where' reduce using rule 337 + '(..)' reduce using rule 337 + LOWER reduce using rule 337 + QUAL_LOWER reduce using rule 337 + UPPER reduce using rule 337 + QUAL_UPPER reduce using rule 337 + SYMBOL reduce using rule 337 + QUAL_SYMBOL reduce using rule 337 + OPERATOR reduce using rule 337 + QUAL_OPERATOR reduce using rule 337 + LIT_HOLE reduce using rule 337 + LIT_CHAR reduce using rule 337 + LIT_STRING reduce using rule 337 + LIT_RAW_STRING reduce using rule 337 + LIT_INT reduce using rule 337 + LIT_NUMBER reduce using rule 337 + %eof reduce using rule 337 + + +State 391 + + expr5 -> '\\' many__binderAtom__ '->' . expr (rule 166) + + '(' shift, and enter state 95 + '{' shift, and enter state 96 + '[' shift, and enter state 97 + '_' shift, and enter state 98 + '\\' shift, and enter state 99 + '-' shift, and enter state 100 + 'ado' shift, and enter state 101 + 'as' shift, and enter state 102 + 'case' shift, and enter state 103 + 'do' shift, and enter state 104 + 'false' shift, and enter state 46 + 'hiding' shift, and enter state 105 + 'if' shift, and enter state 106 + 'let' shift, and enter state 107 + 'nominal' shift, and enter state 108 + 'phantom' shift, and enter state 109 + 'representational'shift, and enter state 110 + 'role' shift, and enter state 111 + 'true' shift, and enter state 52 + '(..)' shift, and enter state 112 + LOWER shift, and enter state 113 + QUAL_LOWER shift, and enter state 114 + UPPER shift, and enter state 54 + QUAL_UPPER shift, and enter state 55 + SYMBOL shift, and enter state 115 + QUAL_SYMBOL shift, and enter state 116 + LIT_HOLE shift, and enter state 117 + LIT_CHAR shift, and enter state 56 + LIT_STRING shift, and enter state 57 + LIT_RAW_STRING shift, and enter state 58 + LIT_INT shift, and enter state 59 + LIT_NUMBER shift, and enter state 60 + + qualProperName goto state 74 + qualIdent goto state 75 + qualSymbol goto state 76 + hole goto state 77 + string goto state 78 + char goto state 79 + number goto state 80 + boolean goto state 81 + expr goto state 547 + expr1 goto state 122 + expr2 goto state 83 + expr3 goto state 84 + expr4 goto state 85 + expr5 goto state 86 + expr6 goto state 87 + expr7 goto state 88 + exprAtom goto state 89 + doBlock goto state 90 + adoBlock goto state 91 + delim__'['__expr__','__']'__goto state 93 + delim__'{'__recordLabel__','__'}'__goto state 94 + +State 392 + + adoBlock -> 'ado' '\{' '\}' . (rule 209) + + 'in' reduce using rule 209 + + +State 393 + + sep1__expr__','__ -> sep1__expr__','__ ',' . expr (rule 412) + + '(' shift, and enter state 95 + '{' shift, and enter state 96 + '[' shift, and enter state 97 + '_' shift, and enter state 98 + '\\' shift, and enter state 99 + '-' shift, and enter state 100 + 'ado' shift, and enter state 101 + 'as' shift, and enter state 102 + 'case' shift, and enter state 103 + 'do' shift, and enter state 104 + 'false' shift, and enter state 46 + 'hiding' shift, and enter state 105 + 'if' shift, and enter state 106 + 'let' shift, and enter state 107 + 'nominal' shift, and enter state 108 + 'phantom' shift, and enter state 109 + 'representational'shift, and enter state 110 + 'role' shift, and enter state 111 + 'true' shift, and enter state 52 + '(..)' shift, and enter state 112 + LOWER shift, and enter state 113 + QUAL_LOWER shift, and enter state 114 + UPPER shift, and enter state 54 + QUAL_UPPER shift, and enter state 55 + SYMBOL shift, and enter state 115 + QUAL_SYMBOL shift, and enter state 116 + LIT_HOLE shift, and enter state 117 + LIT_CHAR shift, and enter state 56 + LIT_STRING shift, and enter state 57 + LIT_RAW_STRING shift, and enter state 58 + LIT_INT shift, and enter state 59 + LIT_NUMBER shift, and enter state 60 + + qualProperName goto state 74 + qualIdent goto state 75 + qualSymbol goto state 76 + hole goto state 77 + string goto state 78 + char goto state 79 + number goto state 80 + boolean goto state 81 + expr goto state 546 + expr1 goto state 122 + expr2 goto state 83 + expr3 goto state 84 + expr4 goto state 85 + expr5 goto state 86 + expr6 goto state 87 + expr7 goto state 88 + exprAtom goto state 89 + doBlock goto state 90 + adoBlock goto state 91 + delim__'['__expr__','__']'__goto state 93 + delim__'{'__recordLabel__','__'}'__goto state 94 + +State 394 + + expr5 -> 'case' sep__expr__','__ 'of' . '\{' manySep__caseBranch__'\;'__ '\}' (rule 168) + expr5 -> 'case' sep__expr__','__ 'of' . '\{' sep__binder1__','__ '->' '\}' exprWhere (rule 169) + expr5 -> 'case' sep__expr__','__ 'of' . '\{' sep__binder1__','__ '\}' guardedCase (rule 170) + + '\{' shift, and enter state 545 + + +State 395 + + expr5 -> 'if' expr 'then' . expr 'else' expr (rule 163) + + '(' shift, and enter state 95 + '{' shift, and enter state 96 + '[' shift, and enter state 97 + '_' shift, and enter state 98 + '\\' shift, and enter state 99 + '-' shift, and enter state 100 + 'ado' shift, and enter state 101 + 'as' shift, and enter state 102 + 'case' shift, and enter state 103 + 'do' shift, and enter state 104 + 'false' shift, and enter state 46 + 'hiding' shift, and enter state 105 + 'if' shift, and enter state 106 + 'let' shift, and enter state 107 + 'nominal' shift, and enter state 108 + 'phantom' shift, and enter state 109 + 'representational'shift, and enter state 110 + 'role' shift, and enter state 111 + 'true' shift, and enter state 52 + '(..)' shift, and enter state 112 + LOWER shift, and enter state 113 + QUAL_LOWER shift, and enter state 114 + UPPER shift, and enter state 54 + QUAL_UPPER shift, and enter state 55 + SYMBOL shift, and enter state 115 + QUAL_SYMBOL shift, and enter state 116 + LIT_HOLE shift, and enter state 117 + LIT_CHAR shift, and enter state 56 + LIT_STRING shift, and enter state 57 + LIT_RAW_STRING shift, and enter state 58 + LIT_INT shift, and enter state 59 + LIT_NUMBER shift, and enter state 60 + + qualProperName goto state 74 + qualIdent goto state 75 + qualSymbol goto state 76 + hole goto state 77 + string goto state 78 + char goto state 79 + number goto state 80 + boolean goto state 81 + expr goto state 544 + expr1 goto state 122 + expr2 goto state 83 + expr3 goto state 84 + expr4 goto state 85 + expr5 goto state 86 + expr6 goto state 87 + expr7 goto state 88 + exprAtom goto state 89 + doBlock goto state 90 + adoBlock goto state 91 + delim__'['__expr__','__']'__goto state 93 + delim__'{'__recordLabel__','__'}'__goto state 94 + +State 396 + + letBinding -> ident . '::' type (rule 197) + letBinding -> ident . guardedDecl (rule 198) + letBinding -> ident . many__binderAtom__ guardedDecl (rule 199) + binderAtom -> ident . (rule 229) + binderAtom -> ident . '@' binderAtom (rule 230) + + '(' shift, and enter state 40 + '{' shift, and enter state 41 + '[' shift, and enter state 42 + '<=' reduce using rule 229 + ':' reduce using rule 229 + '::' shift, and enter state 543 + '=' shift, and enter state 433 + '|' shift, and enter state 434 + '_' shift, and enter state 43 + '-' reduce using rule 229 + '@' shift, and enter state 354 + 'as' shift, and enter state 45 + 'false' shift, and enter state 46 + 'hiding' shift, and enter state 47 + 'nominal' shift, and enter state 48 + 'phantom' shift, and enter state 49 + 'representational'shift, and enter state 50 + 'role' shift, and enter state 51 + 'true' shift, and enter state 52 + LOWER shift, and enter state 53 + UPPER shift, and enter state 54 + QUAL_UPPER shift, and enter state 55 + OPERATOR reduce using rule 229 + QUAL_OPERATOR reduce using rule 229 + LIT_CHAR shift, and enter state 56 + LIT_STRING shift, and enter state 57 + LIT_RAW_STRING shift, and enter state 58 + LIT_INT shift, and enter state 59 + LIT_NUMBER shift, and enter state 60 + + qualProperName goto state 25 + ident goto state 26 + string goto state 27 + char goto state 28 + number goto state 29 + boolean goto state 30 + guardedDecl goto state 541 + guardedDeclExprgoto state 429 + guard goto state 430 + binderAtom goto state 35 + delim__'['__binder__','__']'__goto state 36 + delim__'{'__recordBinder__','__'}'__goto state 37 + many__binderAtom__goto state 542 + many__guardedDeclExpr__goto state 431 + many1__binderAtom__goto state 39 + many1__guardedDeclExpr__goto state 432 + +State 397 + + manySep1__letBinding__'\;'__ -> letBinding . (rule 394) + + '\}' reduce using rule 394 + '\;' reduce using rule 394 + + +State 398 + + letBinding -> binder1 . '=' exprWhere (rule 200) + binder1 -> binder1 . qualOp binder2 (rule 225) + + '<=' shift, and enter state 293 + ':' shift, and enter state 295 + '=' shift, and enter state 540 + '-' shift, and enter state 296 + OPERATOR shift, and enter state 297 + QUAL_OPERATOR shift, and enter state 298 + + qualOp goto state 351 + +State 399 + + expr5 -> 'let' '\{' manySep__letBinding__'\;'__ . '\}' 'in' expr (rule 167) + + '\}' shift, and enter state 539 + + +State 400 + + manySep__letBinding__'\;'__ -> manySep1__letBinding__'\;'__ . (rule 359) + manySep1__letBinding__'\;'__ -> manySep1__letBinding__'\;'__ . '\;' letBinding (rule 395) + + '\}' reduce using rule 359 + '\;' shift, and enter state 538 + + +State 401 + + expr -> expr1 '::' type . (rule 150) + + error reduce using rule 150 + '(' reduce using rule 150 + ')' reduce using rule 150 + '{' reduce using rule 150 + '}' reduce using rule 150 + '[' reduce using rule 150 + ']' reduce using rule 150 + '\}' reduce using rule 150 + '\;' reduce using rule 150 + '<=' reduce using rule 150 + ':' reduce using rule 150 + '::' reduce using rule 150 + '|' reduce using rule 150 + '`' reduce using rule 150 + ',' reduce using rule 150 + '_' reduce using rule 150 + '\\' reduce using rule 150 + '-' reduce using rule 150 + '@' reduce using rule 150 + 'ado' reduce using rule 150 + 'as' reduce using rule 150 + 'case' reduce using rule 150 + 'do' reduce using rule 150 + 'else' reduce using rule 150 + 'false' reduce using rule 150 + 'hiding' reduce using rule 150 + 'if' reduce using rule 150 + 'let' reduce using rule 150 + 'nominal' reduce using rule 150 + 'phantom' reduce using rule 150 + 'of' reduce using rule 150 + 'representational'reduce using rule 150 + 'role' reduce using rule 150 + 'then' reduce using rule 150 + 'true' reduce using rule 150 + 'where' reduce using rule 150 + '(..)' reduce using rule 150 + LOWER reduce using rule 150 + QUAL_LOWER reduce using rule 150 + UPPER reduce using rule 150 + QUAL_UPPER reduce using rule 150 + SYMBOL reduce using rule 150 + QUAL_SYMBOL reduce using rule 150 + OPERATOR reduce using rule 150 + QUAL_OPERATOR reduce using rule 150 + LIT_HOLE reduce using rule 150 + LIT_CHAR reduce using rule 150 + LIT_STRING reduce using rule 150 + LIT_RAW_STRING reduce using rule 150 + LIT_INT reduce using rule 150 + LIT_NUMBER reduce using rule 150 + %eof reduce using rule 150 + + +State 402 + + expr1 -> expr1 qualOp expr2 . (rule 152) + expr2 -> expr2 . '`' exprBacktick '`' expr3 (rule 154) + + error reduce using rule 152 + '(' reduce using rule 152 + ')' reduce using rule 152 + '{' reduce using rule 152 + '}' reduce using rule 152 + '[' reduce using rule 152 + ']' reduce using rule 152 + '\}' reduce using rule 152 + '\;' reduce using rule 152 + '<=' reduce using rule 152 + ':' reduce using rule 152 + '::' reduce using rule 152 + '|' reduce using rule 152 + '`' shift, and enter state 326 + ',' reduce using rule 152 + '_' reduce using rule 152 + '\\' reduce using rule 152 + '-' reduce using rule 152 + '@' reduce using rule 152 + 'ado' reduce using rule 152 + 'as' reduce using rule 152 + 'case' reduce using rule 152 + 'do' reduce using rule 152 + 'else' reduce using rule 152 + 'false' reduce using rule 152 + 'hiding' reduce using rule 152 + 'if' reduce using rule 152 + 'let' reduce using rule 152 + 'nominal' reduce using rule 152 + 'phantom' reduce using rule 152 + 'of' reduce using rule 152 + 'representational'reduce using rule 152 + 'role' reduce using rule 152 + 'then' reduce using rule 152 + 'true' reduce using rule 152 + 'where' reduce using rule 152 + '(..)' reduce using rule 152 + LOWER reduce using rule 152 + QUAL_LOWER reduce using rule 152 + UPPER reduce using rule 152 + QUAL_UPPER reduce using rule 152 + SYMBOL reduce using rule 152 + QUAL_SYMBOL reduce using rule 152 + OPERATOR reduce using rule 152 + QUAL_OPERATOR reduce using rule 152 + LIT_HOLE reduce using rule 152 + LIT_CHAR reduce using rule 152 + LIT_STRING reduce using rule 152 + LIT_RAW_STRING reduce using rule 152 + LIT_INT reduce using rule 152 + LIT_NUMBER reduce using rule 152 + %eof reduce using rule 152 + + +State 403 + + doStatement -> 'let' '\{' manySep__letBinding__'\;'__ . '\}' (rule 211) + + '\}' shift, and enter state 537 + + +State 404 + + moduleHeader -> 'module' moduleName exports . 'where' '\{' moduleImports (rule 242) + + 'where' shift, and enter state 536 + + +State 405 + + exports -> '(' . sep__export__','__ ')' (rule 255) + + 'as' shift, and enter state 45 + 'class' shift, and enter state 533 + 'hiding' shift, and enter state 47 + 'module' shift, and enter state 534 + 'nominal' shift, and enter state 48 + 'phantom' shift, and enter state 49 + 'representational'shift, and enter state 50 + 'role' shift, and enter state 51 + 'type' shift, and enter state 535 + '(..)' shift, and enter state 479 + LOWER shift, and enter state 53 + UPPER shift, and enter state 63 + SYMBOL shift, and enter state 480 + + properName goto state 527 + ident goto state 528 + symbol goto state 529 + export goto state 530 + sep__export__','__goto state 531 + sep1__export__','__goto state 532 + +State 406 + + type -> type1 '::' type . (rule 101) + + error reduce using rule 101 + '(' reduce using rule 101 + ')' reduce using rule 101 + '{' reduce using rule 101 + '}' reduce using rule 101 + '[' reduce using rule 101 + ']' reduce using rule 101 + '\}' reduce using rule 101 + '\;' reduce using rule 101 + '<-' reduce using rule 101 + '<=' reduce using rule 101 + ':' reduce using rule 101 + '::' reduce using rule 101 + '|' reduce using rule 101 + '`' reduce using rule 101 + ',' reduce using rule 101 + '_' reduce using rule 101 + '\\' reduce using rule 101 + '-' reduce using rule 101 + '@' reduce using rule 101 + 'ado' reduce using rule 101 + 'as' reduce using rule 101 + 'case' reduce using rule 101 + 'do' reduce using rule 101 + 'else' reduce using rule 101 + 'false' reduce using rule 101 + 'hiding' reduce using rule 101 + 'if' reduce using rule 101 + 'let' reduce using rule 101 + 'nominal' reduce using rule 101 + 'phantom' reduce using rule 101 + 'of' reduce using rule 101 + 'representational'reduce using rule 101 + 'role' reduce using rule 101 + 'then' reduce using rule 101 + 'true' reduce using rule 101 + 'where' reduce using rule 101 + '(..)' reduce using rule 101 + LOWER reduce using rule 101 + QUAL_LOWER reduce using rule 101 + UPPER reduce using rule 101 + QUAL_UPPER reduce using rule 101 + SYMBOL reduce using rule 101 + QUAL_SYMBOL reduce using rule 101 + OPERATOR reduce using rule 101 + QUAL_OPERATOR reduce using rule 101 + LIT_HOLE reduce using rule 101 + LIT_CHAR reduce using rule 101 + LIT_STRING reduce using rule 101 + LIT_RAW_STRING reduce using rule 101 + LIT_INT reduce using rule 101 + LIT_NUMBER reduce using rule 101 + %eof reduce using rule 101 + + +State 407 + + type2 -> type3 '=>' type1 . (rule 106) + + error reduce using rule 106 + '(' reduce using rule 106 + ')' reduce using rule 106 + '{' reduce using rule 106 + '}' reduce using rule 106 + '[' reduce using rule 106 + ']' reduce using rule 106 + '\}' reduce using rule 106 + '\;' reduce using rule 106 + '<-' reduce using rule 106 + '<=' reduce using rule 106 + ':' reduce using rule 106 + '::' reduce using rule 106 + '|' reduce using rule 106 + '`' reduce using rule 106 + ',' reduce using rule 106 + '_' reduce using rule 106 + '\\' reduce using rule 106 + '-' reduce using rule 106 + '@' reduce using rule 106 + 'ado' reduce using rule 106 + 'as' reduce using rule 106 + 'case' reduce using rule 106 + 'do' reduce using rule 106 + 'else' reduce using rule 106 + 'false' reduce using rule 106 + 'hiding' reduce using rule 106 + 'if' reduce using rule 106 + 'let' reduce using rule 106 + 'nominal' reduce using rule 106 + 'phantom' reduce using rule 106 + 'of' reduce using rule 106 + 'representational'reduce using rule 106 + 'role' reduce using rule 106 + 'then' reduce using rule 106 + 'true' reduce using rule 106 + 'where' reduce using rule 106 + '(..)' reduce using rule 106 + LOWER reduce using rule 106 + QUAL_LOWER reduce using rule 106 + UPPER reduce using rule 106 + QUAL_UPPER reduce using rule 106 + SYMBOL reduce using rule 106 + QUAL_SYMBOL reduce using rule 106 + OPERATOR reduce using rule 106 + QUAL_OPERATOR reduce using rule 106 + LIT_HOLE reduce using rule 106 + LIT_CHAR reduce using rule 106 + LIT_STRING reduce using rule 106 + LIT_RAW_STRING reduce using rule 106 + LIT_INT reduce using rule 106 + LIT_NUMBER reduce using rule 106 + %eof reduce using rule 106 + + +State 408 + + type2 -> type3 '->' type1 . (rule 105) + + error reduce using rule 105 + '(' reduce using rule 105 + ')' reduce using rule 105 + '{' reduce using rule 105 + '}' reduce using rule 105 + '[' reduce using rule 105 + ']' reduce using rule 105 + '\}' reduce using rule 105 + '\;' reduce using rule 105 + '<-' reduce using rule 105 + '<=' reduce using rule 105 + ':' reduce using rule 105 + '::' reduce using rule 105 + '|' reduce using rule 105 + '`' reduce using rule 105 + ',' reduce using rule 105 + '_' reduce using rule 105 + '\\' reduce using rule 105 + '-' reduce using rule 105 + '@' reduce using rule 105 + 'ado' reduce using rule 105 + 'as' reduce using rule 105 + 'case' reduce using rule 105 + 'do' reduce using rule 105 + 'else' reduce using rule 105 + 'false' reduce using rule 105 + 'hiding' reduce using rule 105 + 'if' reduce using rule 105 + 'let' reduce using rule 105 + 'nominal' reduce using rule 105 + 'phantom' reduce using rule 105 + 'of' reduce using rule 105 + 'representational'reduce using rule 105 + 'role' reduce using rule 105 + 'then' reduce using rule 105 + 'true' reduce using rule 105 + 'where' reduce using rule 105 + '(..)' reduce using rule 105 + LOWER reduce using rule 105 + QUAL_LOWER reduce using rule 105 + UPPER reduce using rule 105 + QUAL_UPPER reduce using rule 105 + SYMBOL reduce using rule 105 + QUAL_SYMBOL reduce using rule 105 + OPERATOR reduce using rule 105 + QUAL_OPERATOR reduce using rule 105 + LIT_HOLE reduce using rule 105 + LIT_CHAR reduce using rule 105 + LIT_STRING reduce using rule 105 + LIT_RAW_STRING reduce using rule 105 + LIT_INT reduce using rule 105 + LIT_NUMBER reduce using rule 105 + %eof reduce using rule 105 + + +State 409 + + type3 -> type3 qualOp type4 . (rule 108) + + error reduce using rule 108 + '(' reduce using rule 108 + ')' reduce using rule 108 + '{' reduce using rule 108 + '}' reduce using rule 108 + '[' reduce using rule 108 + ']' reduce using rule 108 + '\}' reduce using rule 108 + '\;' reduce using rule 108 + '<-' reduce using rule 108 + '->' reduce using rule 108 + '<=' reduce using rule 108 + '=>' reduce using rule 108 + ':' reduce using rule 108 + '::' reduce using rule 108 + '|' reduce using rule 108 + '`' reduce using rule 108 + ',' reduce using rule 108 + '_' reduce using rule 108 + '\\' reduce using rule 108 + '-' reduce using rule 108 + '@' reduce using rule 108 + 'ado' reduce using rule 108 + 'as' reduce using rule 108 + 'case' reduce using rule 108 + 'do' reduce using rule 108 + 'else' reduce using rule 108 + 'false' reduce using rule 108 + 'hiding' reduce using rule 108 + 'if' reduce using rule 108 + 'let' reduce using rule 108 + 'nominal' reduce using rule 108 + 'phantom' reduce using rule 108 + 'of' reduce using rule 108 + 'representational'reduce using rule 108 + 'role' reduce using rule 108 + 'then' reduce using rule 108 + 'true' reduce using rule 108 + 'where' reduce using rule 108 + '(..)' reduce using rule 108 + LOWER reduce using rule 108 + QUAL_LOWER reduce using rule 108 + UPPER reduce using rule 108 + QUAL_UPPER reduce using rule 108 + SYMBOL reduce using rule 108 + QUAL_SYMBOL reduce using rule 108 + OPERATOR reduce using rule 108 + QUAL_OPERATOR reduce using rule 108 + LIT_HOLE reduce using rule 108 + LIT_CHAR reduce using rule 108 + LIT_STRING reduce using rule 108 + LIT_RAW_STRING reduce using rule 108 + LIT_INT reduce using rule 108 + LIT_NUMBER reduce using rule 108 + %eof reduce using rule 108 + + +State 410 + + typeVarBinding -> '@' ident . (rule 140) + + error reduce using rule 140 + '(' reduce using rule 140 + '|' reduce using rule 140 + '.' reduce using rule 140 + '@' reduce using rule 140 + 'as' reduce using rule 140 + 'hiding' reduce using rule 140 + 'nominal' reduce using rule 140 + 'phantom' reduce using rule 140 + 'representational'reduce using rule 140 + 'role' reduce using rule 140 + LOWER reduce using rule 140 + + +State 411 + + typeVarBinding -> '(' ident . '::' type ')' (rule 141) + + '::' shift, and enter state 526 + + +State 412 + + typeVarBinding -> '(' '@' . ident '::' type ')' (rule 142) + + 'as' shift, and enter state 45 + 'hiding' shift, and enter state 47 + 'nominal' shift, and enter state 48 + 'phantom' shift, and enter state 49 + 'representational'shift, and enter state 50 + 'role' shift, and enter state 51 + LOWER shift, and enter state 53 + + ident goto state 525 + +State 413 + + many1__typeVarBinding__ -> many1__typeVarBinding__ typeVarBinding . (rule 387) + + error reduce using rule 387 + '(' reduce using rule 387 + '|' reduce using rule 387 + '.' reduce using rule 387 + '@' reduce using rule 387 + 'as' reduce using rule 387 + 'hiding' reduce using rule 387 + 'nominal' reduce using rule 387 + 'phantom' reduce using rule 387 + 'representational'reduce using rule 387 + 'role' reduce using rule 387 + LOWER reduce using rule 387 + + +State 414 + + type1 -> forall many__typeVarBinding__ '.' . type1 (rule 103) + + '(' shift, and enter state 148 + '{' shift, and enter state 149 + '_' shift, and enter state 150 + '-' shift, and enter state 151 + 'as' shift, and enter state 45 + 'forall' shift, and enter state 152 + 'forallu' shift, and enter state 153 + 'hiding' shift, and enter state 47 + 'nominal' shift, and enter state 48 + 'phantom' shift, and enter state 49 + 'representational'shift, and enter state 50 + 'role' shift, and enter state 51 + '(->)' shift, and enter state 154 + '(..)' shift, and enter state 112 + LOWER shift, and enter state 53 + UPPER shift, and enter state 54 + QUAL_UPPER shift, and enter state 55 + SYMBOL shift, and enter state 115 + QUAL_SYMBOL shift, and enter state 116 + LIT_HOLE shift, and enter state 117 + LIT_STRING shift, and enter state 57 + LIT_RAW_STRING shift, and enter state 58 + LIT_INT shift, and enter state 155 + + qualProperName goto state 133 + ident goto state 134 + qualSymbol goto state 135 + hole goto state 136 + string goto state 137 + int goto state 138 + type1 goto state 524 + type2 goto state 141 + type3 goto state 142 + type4 goto state 143 + type5 goto state 144 + typeAtom goto state 145 + forall goto state 146 + +State 415 + + typeAtom -> '{' row . '}' (rule 121) + typeKindedAtom -> '{' row . '}' (rule 130) + + '}' shift, and enter state 523 + + +State 416 + + typeAtom -> '(' type1 . ')' (rule 123) + typeKindedAtom -> '(' type1 . ')' (rule 132) + + ')' shift, and enter state 522 + + +State 417 + + typeAtom -> '(' typeKindedAtom . '::' type ')' (rule 124) + typeKindedAtom -> '(' typeKindedAtom . '::' type ')' (rule 133) + + '::' shift, and enter state 521 + + +State 418 + + typeAtom -> '(' row . ')' (rule 122) + typeKindedAtom -> '(' row . ')' (rule 131) + + ')' shift, and enter state 520 + + +State 419 + + typeAtom -> '(' row ')' . (rule 122) + + error reduce using rule 122 + '(' reduce using rule 122 + ')' reduce using rule 122 + '{' reduce using rule 122 + '}' reduce using rule 122 + '[' reduce using rule 122 + ']' reduce using rule 122 + '\}' reduce using rule 122 + '\;' reduce using rule 122 + '<-' reduce using rule 122 + '->' reduce using rule 122 + '<=' reduce using rule 122 + '=>' reduce using rule 122 + ':' reduce using rule 122 + '::' reduce using rule 122 + '|' reduce using rule 122 + '`' reduce using rule 122 + ',' reduce using rule 122 + '_' reduce using rule 122 + '\\' reduce using rule 122 + '-' reduce using rule 122 + '@' reduce using rule 122 + 'ado' reduce using rule 122 + 'as' reduce using rule 122 + 'case' reduce using rule 122 + 'do' reduce using rule 122 + 'else' reduce using rule 122 + 'false' reduce using rule 122 + 'hiding' reduce using rule 122 + 'if' reduce using rule 122 + 'let' reduce using rule 122 + 'nominal' reduce using rule 122 + 'phantom' reduce using rule 122 + 'of' reduce using rule 122 + 'representational'reduce using rule 122 + 'role' reduce using rule 122 + 'then' reduce using rule 122 + 'true' reduce using rule 122 + 'where' reduce using rule 122 + '(->)' reduce using rule 122 + '(..)' reduce using rule 122 + LOWER reduce using rule 122 + QUAL_LOWER reduce using rule 122 + UPPER reduce using rule 122 + QUAL_UPPER reduce using rule 122 + SYMBOL reduce using rule 122 + QUAL_SYMBOL reduce using rule 122 + OPERATOR reduce using rule 122 + QUAL_OPERATOR reduce using rule 122 + LIT_HOLE reduce using rule 122 + LIT_CHAR reduce using rule 122 + LIT_STRING reduce using rule 122 + LIT_RAW_STRING reduce using rule 122 + LIT_INT reduce using rule 122 + LIT_NUMBER reduce using rule 122 + %eof reduce using rule 122 + + +State 420 + + typeAtom -> '(' typeKindedAtom '::' . type ')' (rule 124) + + '(' shift, and enter state 148 + '{' shift, and enter state 149 + '_' shift, and enter state 150 + '-' shift, and enter state 151 + 'as' shift, and enter state 45 + 'forall' shift, and enter state 152 + 'forallu' shift, and enter state 153 + 'hiding' shift, and enter state 47 + 'nominal' shift, and enter state 48 + 'phantom' shift, and enter state 49 + 'representational'shift, and enter state 50 + 'role' shift, and enter state 51 + '(->)' shift, and enter state 154 + '(..)' shift, and enter state 112 + LOWER shift, and enter state 53 + UPPER shift, and enter state 54 + QUAL_UPPER shift, and enter state 55 + SYMBOL shift, and enter state 115 + QUAL_SYMBOL shift, and enter state 116 + LIT_HOLE shift, and enter state 117 + LIT_STRING shift, and enter state 57 + LIT_RAW_STRING shift, and enter state 58 + LIT_INT shift, and enter state 155 + + qualProperName goto state 133 + ident goto state 134 + qualSymbol goto state 135 + hole goto state 136 + string goto state 137 + int goto state 138 + type goto state 519 + type1 goto state 140 + type2 goto state 141 + type3 goto state 142 + type4 goto state 143 + type5 goto state 144 + typeAtom goto state 145 + forall goto state 146 + +State 421 + + typeAtom -> '(' type1 ')' . (rule 123) + + error reduce using rule 123 + '(' reduce using rule 123 + ')' reduce using rule 123 + '{' reduce using rule 123 + '}' reduce using rule 123 + '[' reduce using rule 123 + ']' reduce using rule 123 + '\}' reduce using rule 123 + '\;' reduce using rule 123 + '<-' reduce using rule 123 + '->' reduce using rule 123 + '<=' reduce using rule 123 + '=>' reduce using rule 123 + ':' reduce using rule 123 + '::' reduce using rule 123 + '|' reduce using rule 123 + '`' reduce using rule 123 + ',' reduce using rule 123 + '_' reduce using rule 123 + '\\' reduce using rule 123 + '-' reduce using rule 123 + '@' reduce using rule 123 + 'ado' reduce using rule 123 + 'as' reduce using rule 123 + 'case' reduce using rule 123 + 'do' reduce using rule 123 + 'else' reduce using rule 123 + 'false' reduce using rule 123 + 'hiding' reduce using rule 123 + 'if' reduce using rule 123 + 'let' reduce using rule 123 + 'nominal' reduce using rule 123 + 'phantom' reduce using rule 123 + 'of' reduce using rule 123 + 'representational'reduce using rule 123 + 'role' reduce using rule 123 + 'then' reduce using rule 123 + 'true' reduce using rule 123 + 'where' reduce using rule 123 + '(->)' reduce using rule 123 + '(..)' reduce using rule 123 + LOWER reduce using rule 123 + QUAL_LOWER reduce using rule 123 + UPPER reduce using rule 123 + QUAL_UPPER reduce using rule 123 + SYMBOL reduce using rule 123 + QUAL_SYMBOL reduce using rule 123 + OPERATOR reduce using rule 123 + QUAL_OPERATOR reduce using rule 123 + LIT_HOLE reduce using rule 123 + LIT_CHAR reduce using rule 123 + LIT_STRING reduce using rule 123 + LIT_RAW_STRING reduce using rule 123 + LIT_INT reduce using rule 123 + LIT_NUMBER reduce using rule 123 + %eof reduce using rule 123 + + +State 422 + + row -> '|' type . (rule 135) + + ')' reduce using rule 135 + '}' reduce using rule 135 + + +State 423 + + sep1__rowLabel__','__ -> sep1__rowLabel__','__ ',' . rowLabel (rule 426) + + 'ado' shift, and enter state 230 + 'as' shift, and enter state 231 + 'case' shift, and enter state 232 + 'class' shift, and enter state 233 + 'data' shift, and enter state 234 + 'derive' shift, and enter state 235 + 'do' shift, and enter state 236 + 'else' shift, and enter state 237 + 'false' shift, and enter state 238 + 'forall' shift, and enter state 239 + 'foreign' shift, and enter state 240 + 'hiding' shift, and enter state 241 + 'import' shift, and enter state 242 + 'if' shift, and enter state 243 + 'in' shift, and enter state 244 + 'infix' shift, and enter state 245 + 'infixl' shift, and enter state 246 + 'infixr' shift, and enter state 247 + 'instance' shift, and enter state 248 + 'let' shift, and enter state 249 + 'module' shift, and enter state 250 + 'newtype' shift, and enter state 251 + 'nominal' shift, and enter state 252 + 'phantom' shift, and enter state 253 + 'of' shift, and enter state 254 + 'representational'shift, and enter state 255 + 'role' shift, and enter state 256 + 'then' shift, and enter state 257 + 'true' shift, and enter state 258 + 'type' shift, and enter state 259 + 'where' shift, and enter state 260 + LOWER shift, and enter state 261 + LIT_STRING shift, and enter state 262 + LIT_RAW_STRING shift, and enter state 263 + + label goto state 224 + rowLabel goto state 518 + +State 424 + + row -> sep__rowLabel__','__ '|' . type (rule 137) + + '(' shift, and enter state 148 + '{' shift, and enter state 149 + '_' shift, and enter state 150 + '-' shift, and enter state 151 + 'as' shift, and enter state 45 + 'forall' shift, and enter state 152 + 'forallu' shift, and enter state 153 + 'hiding' shift, and enter state 47 + 'nominal' shift, and enter state 48 + 'phantom' shift, and enter state 49 + 'representational'shift, and enter state 50 + 'role' shift, and enter state 51 + '(->)' shift, and enter state 154 + '(..)' shift, and enter state 112 + LOWER shift, and enter state 53 + UPPER shift, and enter state 54 + QUAL_UPPER shift, and enter state 55 + SYMBOL shift, and enter state 115 + QUAL_SYMBOL shift, and enter state 116 + LIT_HOLE shift, and enter state 117 + LIT_STRING shift, and enter state 57 + LIT_RAW_STRING shift, and enter state 58 + LIT_INT shift, and enter state 155 + + qualProperName goto state 133 + ident goto state 134 + qualSymbol goto state 135 + hole goto state 136 + string goto state 137 + int goto state 138 + type goto state 517 + type1 goto state 140 + type2 goto state 141 + type3 goto state 142 + type4 goto state 143 + type5 goto state 144 + typeAtom goto state 145 + forall goto state 146 + +State 425 + + typeAtom -> '{' row '}' . (rule 121) + + error reduce using rule 121 + '(' reduce using rule 121 + ')' reduce using rule 121 + '{' reduce using rule 121 + '}' reduce using rule 121 + '[' reduce using rule 121 + ']' reduce using rule 121 + '\}' reduce using rule 121 + '\;' reduce using rule 121 + '<-' reduce using rule 121 + '->' reduce using rule 121 + '<=' reduce using rule 121 + '=>' reduce using rule 121 + ':' reduce using rule 121 + '::' reduce using rule 121 + '|' reduce using rule 121 + '`' reduce using rule 121 + ',' reduce using rule 121 + '_' reduce using rule 121 + '\\' reduce using rule 121 + '-' reduce using rule 121 + '@' reduce using rule 121 + 'ado' reduce using rule 121 + 'as' reduce using rule 121 + 'case' reduce using rule 121 + 'do' reduce using rule 121 + 'else' reduce using rule 121 + 'false' reduce using rule 121 + 'hiding' reduce using rule 121 + 'if' reduce using rule 121 + 'let' reduce using rule 121 + 'nominal' reduce using rule 121 + 'phantom' reduce using rule 121 + 'of' reduce using rule 121 + 'representational'reduce using rule 121 + 'role' reduce using rule 121 + 'then' reduce using rule 121 + 'true' reduce using rule 121 + 'where' reduce using rule 121 + '(->)' reduce using rule 121 + '(..)' reduce using rule 121 + LOWER reduce using rule 121 + QUAL_LOWER reduce using rule 121 + UPPER reduce using rule 121 + QUAL_UPPER reduce using rule 121 + SYMBOL reduce using rule 121 + QUAL_SYMBOL reduce using rule 121 + OPERATOR reduce using rule 121 + QUAL_OPERATOR reduce using rule 121 + LIT_HOLE reduce using rule 121 + LIT_CHAR reduce using rule 121 + LIT_STRING reduce using rule 121 + LIT_RAW_STRING reduce using rule 121 + LIT_INT reduce using rule 121 + LIT_NUMBER reduce using rule 121 + %eof reduce using rule 121 + + +State 426 + + rowLabel -> label '::' . type (rule 138) + + '(' shift, and enter state 148 + '{' shift, and enter state 149 + '_' shift, and enter state 150 + '-' shift, and enter state 151 + 'as' shift, and enter state 45 + 'forall' shift, and enter state 152 + 'forallu' shift, and enter state 153 + 'hiding' shift, and enter state 47 + 'nominal' shift, and enter state 48 + 'phantom' shift, and enter state 49 + 'representational'shift, and enter state 50 + 'role' shift, and enter state 51 + '(->)' shift, and enter state 154 + '(..)' shift, and enter state 112 + LOWER shift, and enter state 53 + UPPER shift, and enter state 54 + QUAL_UPPER shift, and enter state 55 + SYMBOL shift, and enter state 115 + QUAL_SYMBOL shift, and enter state 116 + LIT_HOLE shift, and enter state 117 + LIT_STRING shift, and enter state 57 + LIT_RAW_STRING shift, and enter state 58 + LIT_INT shift, and enter state 155 + + qualProperName goto state 133 + ident goto state 134 + qualSymbol goto state 135 + hole goto state 136 + string goto state 137 + int goto state 138 + type goto state 516 + type1 goto state 140 + type2 goto state 141 + type3 goto state 142 + type4 goto state 143 + type5 goto state 144 + typeAtom goto state 145 + forall goto state 146 + +State 427 + + decl -> ident '::' type . (rule 290) + + error reduce using rule 290 + '\}' reduce using rule 290 + '\;' reduce using rule 290 + 'else' reduce using rule 290 + %eof reduce using rule 290 + + +State 428 + + decl -> ident manyOrEmpty__binderAtom__ guardedDecl . (rule 291) + + error reduce using rule 291 + '\}' reduce using rule 291 + '\;' reduce using rule 291 + 'else' reduce using rule 291 + %eof reduce using rule 291 + + +State 429 + + many1__guardedDeclExpr__ -> guardedDeclExpr . (rule 380) + + error reduce using rule 380 + '\}' reduce using rule 380 + '\;' reduce using rule 380 + '|' reduce using rule 380 + 'else' reduce using rule 380 + %eof reduce using rule 380 + + +State 430 + + guardedDeclExpr -> guard . '=' exprWhere (rule 204) + + '=' shift, and enter state 515 + + +State 431 + + guardedDecl -> many__guardedDeclExpr__ . (rule 203) + + error reduce using rule 203 + '\}' reduce using rule 203 + '\;' reduce using rule 203 + 'else' reduce using rule 203 + %eof reduce using rule 203 + + +State 432 + + many__guardedDeclExpr__ -> many1__guardedDeclExpr__ . (rule 344) + many1__guardedDeclExpr__ -> many1__guardedDeclExpr__ . guardedDeclExpr (rule 381) + + error reduce using rule 344 + '\}' reduce using rule 344 + '\;' reduce using rule 344 + '|' shift, and enter state 434 + 'else' reduce using rule 344 + %eof reduce using rule 344 + + guardedDeclExprgoto state 514 + guard goto state 430 + +State 433 + + guardedDecl -> '=' . exprWhere (rule 202) + + '(' shift, and enter state 95 + '{' shift, and enter state 96 + '[' shift, and enter state 97 + '_' shift, and enter state 98 + '\\' shift, and enter state 99 + '-' shift, and enter state 100 + 'ado' shift, and enter state 101 + 'as' shift, and enter state 102 + 'case' shift, and enter state 103 + 'do' shift, and enter state 104 + 'false' shift, and enter state 46 + 'hiding' shift, and enter state 105 + 'if' shift, and enter state 106 + 'let' shift, and enter state 107 + 'nominal' shift, and enter state 108 + 'phantom' shift, and enter state 109 + 'representational'shift, and enter state 110 + 'role' shift, and enter state 111 + 'true' shift, and enter state 52 + '(..)' shift, and enter state 112 + LOWER shift, and enter state 113 + QUAL_LOWER shift, and enter state 114 + UPPER shift, and enter state 54 + QUAL_UPPER shift, and enter state 55 + SYMBOL shift, and enter state 115 + QUAL_SYMBOL shift, and enter state 116 + LIT_HOLE shift, and enter state 117 + LIT_CHAR shift, and enter state 56 + LIT_STRING shift, and enter state 57 + LIT_RAW_STRING shift, and enter state 58 + LIT_INT shift, and enter state 59 + LIT_NUMBER shift, and enter state 60 + + qualProperName goto state 74 + qualIdent goto state 75 + qualSymbol goto state 76 + hole goto state 77 + string goto state 78 + char goto state 79 + number goto state 80 + boolean goto state 81 + exprWhere goto state 512 + expr goto state 513 + expr1 goto state 122 + expr2 goto state 83 + expr3 goto state 84 + expr4 goto state 85 + expr5 goto state 86 + expr6 goto state 87 + expr7 goto state 88 + exprAtom goto state 89 + doBlock goto state 90 + adoBlock goto state 91 + delim__'['__expr__','__']'__goto state 93 + delim__'{'__recordLabel__','__'}'__goto state 94 + +State 434 + + guard -> '|' . (rule 216) + + '->' reduce using rule 216 + '=' reduce using rule 216 + + +State 435 + + dataCtor -> properName . manyOrEmpty__typeAtom__ (rule 299) + + error reduce using rule 350 + '(' shift, and enter state 148 + '{' shift, and enter state 149 + '\}' reduce using rule 350 + '\;' reduce using rule 350 + '|' reduce using rule 350 + '_' shift, and enter state 150 + 'as' shift, and enter state 45 + 'else' reduce using rule 350 + 'hiding' shift, and enter state 47 + 'nominal' shift, and enter state 48 + 'phantom' shift, and enter state 49 + 'representational'shift, and enter state 50 + 'role' shift, and enter state 51 + '(->)' shift, and enter state 154 + '(..)' shift, and enter state 112 + LOWER shift, and enter state 53 + UPPER shift, and enter state 54 + QUAL_UPPER shift, and enter state 55 + SYMBOL shift, and enter state 115 + QUAL_SYMBOL shift, and enter state 116 + LIT_HOLE shift, and enter state 117 + LIT_STRING shift, and enter state 57 + LIT_RAW_STRING shift, and enter state 58 + LIT_INT shift, and enter state 155 + %eof reduce using rule 350 + + qualProperName goto state 133 + ident goto state 134 + qualSymbol goto state 135 + hole goto state 136 + string goto state 137 + int goto state 138 + typeAtom goto state 333 + manyOrEmpty__typeAtom__goto state 511 + many__typeAtom__goto state 335 + many1__typeAtom__goto state 336 + +State 436 + + sep1__dataCtor__'|'__ -> dataCtor . (rule 405) + + error reduce using rule 405 + '\}' reduce using rule 405 + '\;' reduce using rule 405 + '|' reduce using rule 405 + 'else' reduce using rule 405 + %eof reduce using rule 405 + + +State 437 + + decl -> dataHead '=' sep__dataCtor__'|'__ . (rule 278) + + error reduce using rule 278 + '\}' reduce using rule 278 + '\;' reduce using rule 278 + 'else' reduce using rule 278 + %eof reduce using rule 278 + + +State 438 + + sep__dataCtor__'|'__ -> sep1__dataCtor__'|'__ . (rule 363) + sep1__dataCtor__'|'__ -> sep1__dataCtor__'|'__ . '|' dataCtor (rule 406) + + error reduce using rule 363 + '\}' reduce using rule 363 + '\;' reduce using rule 363 + '|' shift, and enter state 510 + 'else' reduce using rule 363 + %eof reduce using rule 363 + + +State 439 + + decl -> typeHead '=' type . (rule 279) + + error reduce using rule 279 + '\}' reduce using rule 279 + '\;' reduce using rule 279 + 'else' reduce using rule 279 + %eof reduce using rule 279 + + +State 440 + + decl -> newtypeHead '=' properName . typeAtom (rule 280) + + '(' shift, and enter state 148 + '{' shift, and enter state 149 + '_' shift, and enter state 150 + 'as' shift, and enter state 45 + 'hiding' shift, and enter state 47 + 'nominal' shift, and enter state 48 + 'phantom' shift, and enter state 49 + 'representational'shift, and enter state 50 + 'role' shift, and enter state 51 + '(->)' shift, and enter state 154 + '(..)' shift, and enter state 112 + LOWER shift, and enter state 53 + UPPER shift, and enter state 54 + QUAL_UPPER shift, and enter state 55 + SYMBOL shift, and enter state 115 + QUAL_SYMBOL shift, and enter state 116 + LIT_HOLE shift, and enter state 117 + LIT_STRING shift, and enter state 57 + LIT_RAW_STRING shift, and enter state 58 + LIT_INT shift, and enter state 155 + + qualProperName goto state 133 + ident goto state 134 + qualSymbol goto state 135 + hole goto state 136 + string goto state 137 + int goto state 138 + typeAtom goto state 509 + +State 441 + + decl -> classHead 'where' '\{' . manySep__classMember__'\;'__ '\}' (rule 282) + + 'as' shift, and enter state 45 + 'hiding' shift, and enter state 47 + 'nominal' shift, and enter state 48 + 'phantom' shift, and enter state 49 + 'representational'shift, and enter state 50 + 'role' shift, and enter state 51 + LOWER shift, and enter state 53 + + ident goto state 505 + classMember goto state 506 + manySep__classMember__'\;'__goto state 507 + manySep1__classMember__'\;'__goto state 508 + +State 442 + + decl -> instHead 'where' '\{' . manySep__instBinding__'\;'__ '\}' (rule 284) + + 'as' shift, and enter state 45 + 'hiding' shift, and enter state 47 + 'nominal' shift, and enter state 48 + 'phantom' shift, and enter state 49 + 'representational'shift, and enter state 50 + 'role' shift, and enter state 51 + LOWER shift, and enter state 53 + + ident goto state 501 + instBinding goto state 502 + manySep__instBinding__'\;'__goto state 503 + manySep1__instBinding__'\;'__goto state 504 + +State 443 + + fixity -> infix int qualProperName . 'as' op (rule 320) + + 'as' shift, and enter state 500 + + +State 444 + + fixity -> infix int qualIdent . 'as' op (rule 319) + + 'as' shift, and enter state 499 + + +State 445 + + fixity -> infix int 'type' . qualProperName 'as' op (rule 321) + + UPPER shift, and enter state 54 + QUAL_UPPER shift, and enter state 55 + + qualProperName goto state 498 + +State 446 + + typeVarBindingPlain -> ident . (rule 143) + + error reduce using rule 143 + '(' reduce using rule 143 + '\}' reduce using rule 143 + '\;' reduce using rule 143 + '=' reduce using rule 143 + 'as' reduce using rule 143 + 'else' reduce using rule 143 + 'hiding' reduce using rule 143 + 'nominal' reduce using rule 143 + 'phantom' reduce using rule 143 + 'representational'reduce using rule 143 + 'role' reduce using rule 143 + LOWER reduce using rule 143 + %eof reduce using rule 143 + + +State 447 + + many1__typeVarBindingPlain__ -> typeVarBindingPlain . (rule 429) + + error reduce using rule 429 + '(' reduce using rule 429 + '\}' reduce using rule 429 + '\;' reduce using rule 429 + '=' reduce using rule 429 + 'as' reduce using rule 429 + 'else' reduce using rule 429 + 'hiding' reduce using rule 429 + 'nominal' reduce using rule 429 + 'phantom' reduce using rule 429 + 'representational'reduce using rule 429 + 'role' reduce using rule 429 + LOWER reduce using rule 429 + %eof reduce using rule 429 + + +State 448 + + dataHead -> 'data' properName manyOrEmpty__typeVarBindingPlain__ . (rule 296) + + error reduce using rule 296 + '\}' reduce using rule 296 + '\;' reduce using rule 296 + '=' reduce using rule 296 + 'else' reduce using rule 296 + %eof reduce using rule 296 + + +State 449 + + manyOrEmpty__typeVarBindingPlain__ -> many__typeVarBindingPlain__ . (rule 355) + + error reduce using rule 355 + '\}' reduce using rule 355 + '\;' reduce using rule 355 + '=' reduce using rule 355 + 'else' reduce using rule 355 + %eof reduce using rule 355 + + +State 450 + + many__typeVarBindingPlain__ -> many1__typeVarBindingPlain__ . (rule 375) + many1__typeVarBindingPlain__ -> many1__typeVarBindingPlain__ . typeVarBindingPlain (rule 430) + + error reduce using rule 375 + '(' shift, and enter state 451 + '\}' reduce using rule 375 + '\;' reduce using rule 375 + '=' reduce using rule 375 + 'as' shift, and enter state 45 + 'else' reduce using rule 375 + 'hiding' shift, and enter state 47 + 'nominal' shift, and enter state 48 + 'phantom' shift, and enter state 49 + 'representational'shift, and enter state 50 + 'role' shift, and enter state 51 + LOWER shift, and enter state 53 + %eof reduce using rule 375 + + ident goto state 446 + typeVarBindingPlaingoto state 497 + +State 451 + + typeVarBindingPlain -> '(' . ident '::' type ')' (rule 144) + + 'as' shift, and enter state 45 + 'hiding' shift, and enter state 47 + 'nominal' shift, and enter state 48 + 'phantom' shift, and enter state 49 + 'representational'shift, and enter state 50 + 'role' shift, and enter state 51 + LOWER shift, and enter state 53 + + ident goto state 496 + +State 452 + + decl -> 'data' properName '::' . type (rule 285) + + '(' shift, and enter state 148 + '{' shift, and enter state 149 + '_' shift, and enter state 150 + '-' shift, and enter state 151 + 'as' shift, and enter state 45 + 'forall' shift, and enter state 152 + 'forallu' shift, and enter state 153 + 'hiding' shift, and enter state 47 + 'nominal' shift, and enter state 48 + 'phantom' shift, and enter state 49 + 'representational'shift, and enter state 50 + 'role' shift, and enter state 51 + '(->)' shift, and enter state 154 + '(..)' shift, and enter state 112 + LOWER shift, and enter state 53 + UPPER shift, and enter state 54 + QUAL_UPPER shift, and enter state 55 + SYMBOL shift, and enter state 115 + QUAL_SYMBOL shift, and enter state 116 + LIT_HOLE shift, and enter state 117 + LIT_STRING shift, and enter state 57 + LIT_RAW_STRING shift, and enter state 58 + LIT_INT shift, and enter state 155 + + qualProperName goto state 133 + ident goto state 134 + qualSymbol goto state 135 + hole goto state 136 + string goto state 137 + int goto state 138 + type goto state 495 + type1 goto state 140 + type2 goto state 141 + type3 goto state 142 + type4 goto state 143 + type5 goto state 144 + typeAtom goto state 145 + forall goto state 146 + +State 453 + + decl -> 'derive' 'newtype' instHead . (rule 289) + + error reduce using rule 289 + '\}' reduce using rule 289 + '\;' reduce using rule 289 + 'else' reduce using rule 289 + %eof reduce using rule 289 + + +State 454 + + decl -> 'foreign' 'import' ident . '::' type (rule 293) + + '::' shift, and enter state 494 + + +State 455 + + decl -> 'foreign' 'import' 'data' . properName '::' type (rule 294) + + UPPER shift, and enter state 63 + + properName goto state 493 + +State 456 + + instHead -> 'instance' constraints '=>' . qualProperName manyOrEmpty__typeAtom__ (rule 309) + + UPPER shift, and enter state 54 + QUAL_UPPER shift, and enter state 55 + + qualProperName goto state 492 + +State 457 + + instHead -> 'instance' ident '::' . constraints '=>' qualProperName manyOrEmpty__typeAtom__ (rule 311) + instHead -> 'instance' ident '::' . qualProperName manyOrEmpty__typeAtom__ (rule 312) + + '(' shift, and enter state 68 + UPPER shift, and enter state 54 + QUAL_UPPER shift, and enter state 55 + + qualProperName goto state 490 + constraints goto state 491 + constraint goto state 67 + +State 458 + + instHead -> 'instance' qualProperName manyOrEmpty__typeAtom__ . (rule 310) + constraint -> qualProperName manyOrEmpty__typeAtom__ . (rule 315) + + error reduce using rule 310 + '\}' reduce using rule 310 + '\;' reduce using rule 310 + '=>' reduce using rule 315 + 'else' reduce using rule 310 + 'where' reduce using rule 310 + %eof reduce using rule 310 + + +State 459 + + newtypeHead -> 'newtype' properName manyOrEmpty__typeVarBindingPlain__ . (rule 298) + + '=' reduce using rule 298 + + +State 460 + + decl -> 'newtype' properName '::' . type (rule 286) + + '(' shift, and enter state 148 + '{' shift, and enter state 149 + '_' shift, and enter state 150 + '-' shift, and enter state 151 + 'as' shift, and enter state 45 + 'forall' shift, and enter state 152 + 'forallu' shift, and enter state 153 + 'hiding' shift, and enter state 47 + 'nominal' shift, and enter state 48 + 'phantom' shift, and enter state 49 + 'representational'shift, and enter state 50 + 'role' shift, and enter state 51 + '(->)' shift, and enter state 154 + '(..)' shift, and enter state 112 + LOWER shift, and enter state 53 + UPPER shift, and enter state 54 + QUAL_UPPER shift, and enter state 55 + SYMBOL shift, and enter state 115 + QUAL_SYMBOL shift, and enter state 116 + LIT_HOLE shift, and enter state 117 + LIT_STRING shift, and enter state 57 + LIT_RAW_STRING shift, and enter state 58 + LIT_INT shift, and enter state 155 + + qualProperName goto state 133 + ident goto state 134 + qualSymbol goto state 135 + hole goto state 136 + string goto state 137 + int goto state 138 + type goto state 489 + type1 goto state 140 + type2 goto state 141 + type3 goto state 142 + type4 goto state 143 + type5 goto state 144 + typeAtom goto state 145 + forall goto state 146 + +State 461 + + decl -> 'type' 'role' properName . many__role__ (rule 295) + + 'nominal' shift, and enter state 486 + 'phantom' shift, and enter state 487 + 'representational'shift, and enter state 488 + + role goto state 483 + many__role__ goto state 484 + many1__role__ goto state 485 + +State 462 + + typeHead -> 'type' properName manyOrEmpty__typeVarBindingPlain__ . (rule 297) + + '=' reduce using rule 297 + + +State 463 + + decl -> 'type' properName '::' . type (rule 287) + + '(' shift, and enter state 148 + '{' shift, and enter state 149 + '_' shift, and enter state 150 + '-' shift, and enter state 151 + 'as' shift, and enter state 45 + 'forall' shift, and enter state 152 + 'forallu' shift, and enter state 153 + 'hiding' shift, and enter state 47 + 'nominal' shift, and enter state 48 + 'phantom' shift, and enter state 49 + 'representational'shift, and enter state 50 + 'role' shift, and enter state 51 + '(->)' shift, and enter state 154 + '(..)' shift, and enter state 112 + LOWER shift, and enter state 53 + UPPER shift, and enter state 54 + QUAL_UPPER shift, and enter state 55 + SYMBOL shift, and enter state 115 + QUAL_SYMBOL shift, and enter state 116 + LIT_HOLE shift, and enter state 117 + LIT_STRING shift, and enter state 57 + LIT_RAW_STRING shift, and enter state 58 + LIT_INT shift, and enter state 155 + + qualProperName goto state 133 + ident goto state 134 + qualSymbol goto state 135 + hole goto state 136 + string goto state 137 + int goto state 138 + type goto state 482 + type1 goto state 140 + type2 goto state 141 + type3 goto state 142 + type4 goto state 143 + type5 goto state 144 + typeAtom goto state 145 + forall goto state 146 + +State 464 + + importDecl -> 'import' moduleName imports . (rule 266) + importDecl -> 'import' moduleName imports . 'as' moduleName (rule 267) + + error reduce using rule 266 + '\}' reduce using rule 266 + '\;' reduce using rule 266 + 'as' shift, and enter state 481 + + +State 465 + + imports -> '(' . sep__import__','__ ')' (rule 269) + + 'as' shift, and enter state 45 + 'class' shift, and enter state 477 + 'hiding' shift, and enter state 47 + 'nominal' shift, and enter state 48 + 'phantom' shift, and enter state 49 + 'representational'shift, and enter state 50 + 'role' shift, and enter state 51 + 'type' shift, and enter state 478 + '(..)' shift, and enter state 479 + LOWER shift, and enter state 53 + UPPER shift, and enter state 63 + SYMBOL shift, and enter state 480 + + properName goto state 471 + ident goto state 472 + symbol goto state 473 + import goto state 474 + sep__import__','__goto state 475 + sep1__import__','__goto state 476 + +State 466 + + imports -> 'hiding' . '(' sep__import__','__ ')' (rule 270) + + '(' shift, and enter state 470 + + +State 467 + + manySep1__moduleDecl__'\;'__ -> manySep1__moduleDecl__'\;'__ '\;' moduleDecl . (rule 397) + + '\}' reduce using rule 397 + '\;' reduce using rule 397 + + +State 468 + + declElse -> 'else' '\;' . (rule 253) + + 'as' reduce using rule 253 + 'class' reduce using rule 253 + 'data' reduce using rule 253 + 'derive' reduce using rule 253 + 'foreign' reduce using rule 253 + 'hiding' reduce using rule 253 + 'infix' reduce using rule 253 + 'infixl' reduce using rule 253 + 'infixr' reduce using rule 253 + 'instance' reduce using rule 253 + 'newtype' reduce using rule 253 + 'nominal' reduce using rule 253 + 'phantom' reduce using rule 253 + 'representational'reduce using rule 253 + 'role' reduce using rule 253 + 'type' reduce using rule 253 + LOWER reduce using rule 253 + + +State 469 + + sep1__decl__declElse__ -> sep1__decl__declElse__ declElse decl . (rule 408) + + '\}' reduce using rule 408 + '\;' reduce using rule 408 + 'else' reduce using rule 408 + + +State 470 + + imports -> 'hiding' '(' . sep__import__','__ ')' (rule 270) + + 'as' shift, and enter state 45 + 'class' shift, and enter state 477 + 'hiding' shift, and enter state 47 + 'nominal' shift, and enter state 48 + 'phantom' shift, and enter state 49 + 'representational'shift, and enter state 50 + 'role' shift, and enter state 51 + 'type' shift, and enter state 478 + '(..)' shift, and enter state 479 + LOWER shift, and enter state 53 + UPPER shift, and enter state 63 + SYMBOL shift, and enter state 480 + + properName goto state 471 + ident goto state 472 + symbol goto state 473 + import goto state 474 + sep__import__','__goto state 636 + sep1__import__','__goto state 476 + +State 471 + + import -> properName . (rule 273) + import -> properName . dataMembers (rule 274) + + '(' shift, and enter state 604 + ')' reduce using rule 273 + ',' reduce using rule 273 + '(..)' shift, and enter state 605 + + dataMembers goto state 635 + +State 472 + + import -> ident . (rule 271) + + ')' reduce using rule 271 + ',' reduce using rule 271 + + +State 473 + + import -> symbol . (rule 272) + + ')' reduce using rule 272 + ',' reduce using rule 272 + + +State 474 + + sep1__import__','__ -> import . (rule 415) + + ')' reduce using rule 415 + ',' reduce using rule 415 + + +State 475 + + imports -> '(' sep__import__','__ . ')' (rule 269) + + ')' shift, and enter state 634 + + +State 476 + + sep__import__','__ -> sep1__import__','__ . (rule 368) + sep1__import__','__ -> sep1__import__','__ . ',' import (rule 416) + + ')' reduce using rule 368 + ',' shift, and enter state 633 + + +State 477 + + import -> 'class' . properName (rule 276) + + UPPER shift, and enter state 63 + + properName goto state 632 + +State 478 + + import -> 'type' . symbol (rule 275) + + '(..)' shift, and enter state 479 + SYMBOL shift, and enter state 480 + + symbol goto state 631 + +State 479 + + symbol -> '(..)' . (rule 56) + + ')' reduce using rule 56 + ',' reduce using rule 56 + + +State 480 + + symbol -> SYMBOL . (rule 55) + + ')' reduce using rule 55 + ',' reduce using rule 55 + + +State 481 + + importDecl -> 'import' moduleName imports 'as' . moduleName (rule 267) + + UPPER shift, and enter state 24 + QUAL_UPPER shift, and enter state 132 + + moduleName goto state 630 + +State 482 + + decl -> 'type' properName '::' type . (rule 287) + + error reduce using rule 287 + '\}' reduce using rule 287 + '\;' reduce using rule 287 + 'else' reduce using rule 287 + %eof reduce using rule 287 + + +State 483 + + many1__role__ -> role . (rule 384) + + error reduce using rule 384 + '\}' reduce using rule 384 + '\;' reduce using rule 384 + 'else' reduce using rule 384 + 'nominal' reduce using rule 384 + 'phantom' reduce using rule 384 + 'representational'reduce using rule 384 + %eof reduce using rule 384 + + +State 484 + + decl -> 'type' 'role' properName many__role__ . (rule 295) + + error reduce using rule 295 + '\}' reduce using rule 295 + '\;' reduce using rule 295 + 'else' reduce using rule 295 + %eof reduce using rule 295 + + +State 485 + + many__role__ -> many1__role__ . (rule 346) + many1__role__ -> many1__role__ . role (rule 385) + + error reduce using rule 346 + '\}' reduce using rule 346 + '\;' reduce using rule 346 + 'else' reduce using rule 346 + 'nominal' shift, and enter state 486 + 'phantom' shift, and enter state 487 + 'representational'shift, and enter state 488 + %eof reduce using rule 346 + + role goto state 629 + +State 486 + + role -> 'nominal' . (rule 325) + + error reduce using rule 325 + '\}' reduce using rule 325 + '\;' reduce using rule 325 + 'else' reduce using rule 325 + 'nominal' reduce using rule 325 + 'phantom' reduce using rule 325 + 'representational'reduce using rule 325 + %eof reduce using rule 325 + + +State 487 + + role -> 'phantom' . (rule 327) + + error reduce using rule 327 + '\}' reduce using rule 327 + '\;' reduce using rule 327 + 'else' reduce using rule 327 + 'nominal' reduce using rule 327 + 'phantom' reduce using rule 327 + 'representational'reduce using rule 327 + %eof reduce using rule 327 + + +State 488 + + role -> 'representational' . (rule 326) + + error reduce using rule 326 + '\}' reduce using rule 326 + '\;' reduce using rule 326 + 'else' reduce using rule 326 + 'nominal' reduce using rule 326 + 'phantom' reduce using rule 326 + 'representational'reduce using rule 326 + %eof reduce using rule 326 + + +State 489 + + decl -> 'newtype' properName '::' type . (rule 286) + + error reduce using rule 286 + '\}' reduce using rule 286 + '\;' reduce using rule 286 + 'else' reduce using rule 286 + %eof reduce using rule 286 + + +State 490 + + instHead -> 'instance' ident '::' qualProperName . manyOrEmpty__typeAtom__ (rule 312) + constraint -> qualProperName . manyOrEmpty__typeAtom__ (rule 315) + + error reduce using rule 350 + '(' shift, and enter state 148 + '{' shift, and enter state 149 + '\}' reduce using rule 350 + '\;' reduce using rule 350 + '=>' reduce using rule 350 + '_' shift, and enter state 150 + 'as' shift, and enter state 45 + 'else' reduce using rule 350 + 'hiding' shift, and enter state 47 + 'nominal' shift, and enter state 48 + 'phantom' shift, and enter state 49 + 'representational'shift, and enter state 50 + 'role' shift, and enter state 51 + 'where' reduce using rule 350 + '(->)' shift, and enter state 154 + '(..)' shift, and enter state 112 + LOWER shift, and enter state 53 + UPPER shift, and enter state 54 + QUAL_UPPER shift, and enter state 55 + SYMBOL shift, and enter state 115 + QUAL_SYMBOL shift, and enter state 116 + LIT_HOLE shift, and enter state 117 + LIT_STRING shift, and enter state 57 + LIT_RAW_STRING shift, and enter state 58 + LIT_INT shift, and enter state 155 + %eof reduce using rule 350 + + qualProperName goto state 133 + ident goto state 134 + qualSymbol goto state 135 + hole goto state 136 + string goto state 137 + int goto state 138 + typeAtom goto state 333 + manyOrEmpty__typeAtom__goto state 628 + many__typeAtom__goto state 335 + many1__typeAtom__goto state 336 + +State 491 + + instHead -> 'instance' ident '::' constraints . '=>' qualProperName manyOrEmpty__typeAtom__ (rule 311) + + '=>' shift, and enter state 627 + + +State 492 + + instHead -> 'instance' constraints '=>' qualProperName . manyOrEmpty__typeAtom__ (rule 309) + + error reduce using rule 350 + '(' shift, and enter state 148 + '{' shift, and enter state 149 + '\}' reduce using rule 350 + '\;' reduce using rule 350 + '_' shift, and enter state 150 + 'as' shift, and enter state 45 + 'else' reduce using rule 350 + 'hiding' shift, and enter state 47 + 'nominal' shift, and enter state 48 + 'phantom' shift, and enter state 49 + 'representational'shift, and enter state 50 + 'role' shift, and enter state 51 + 'where' reduce using rule 350 + '(->)' shift, and enter state 154 + '(..)' shift, and enter state 112 + LOWER shift, and enter state 53 + UPPER shift, and enter state 54 + QUAL_UPPER shift, and enter state 55 + SYMBOL shift, and enter state 115 + QUAL_SYMBOL shift, and enter state 116 + LIT_HOLE shift, and enter state 117 + LIT_STRING shift, and enter state 57 + LIT_RAW_STRING shift, and enter state 58 + LIT_INT shift, and enter state 155 + %eof reduce using rule 350 + + qualProperName goto state 133 + ident goto state 134 + qualSymbol goto state 135 + hole goto state 136 + string goto state 137 + int goto state 138 + typeAtom goto state 333 + manyOrEmpty__typeAtom__goto state 626 + many__typeAtom__goto state 335 + many1__typeAtom__goto state 336 + +State 493 + + decl -> 'foreign' 'import' 'data' properName . '::' type (rule 294) + + '::' shift, and enter state 625 + + +State 494 + + decl -> 'foreign' 'import' ident '::' . type (rule 293) + + '(' shift, and enter state 148 + '{' shift, and enter state 149 + '_' shift, and enter state 150 + '-' shift, and enter state 151 + 'as' shift, and enter state 45 + 'forall' shift, and enter state 152 + 'forallu' shift, and enter state 153 + 'hiding' shift, and enter state 47 + 'nominal' shift, and enter state 48 + 'phantom' shift, and enter state 49 + 'representational'shift, and enter state 50 + 'role' shift, and enter state 51 + '(->)' shift, and enter state 154 + '(..)' shift, and enter state 112 + LOWER shift, and enter state 53 + UPPER shift, and enter state 54 + QUAL_UPPER shift, and enter state 55 + SYMBOL shift, and enter state 115 + QUAL_SYMBOL shift, and enter state 116 + LIT_HOLE shift, and enter state 117 + LIT_STRING shift, and enter state 57 + LIT_RAW_STRING shift, and enter state 58 + LIT_INT shift, and enter state 155 + + qualProperName goto state 133 + ident goto state 134 + qualSymbol goto state 135 + hole goto state 136 + string goto state 137 + int goto state 138 + type goto state 624 + type1 goto state 140 + type2 goto state 141 + type3 goto state 142 + type4 goto state 143 + type5 goto state 144 + typeAtom goto state 145 + forall goto state 146 + +State 495 + + decl -> 'data' properName '::' type . (rule 285) + + error reduce using rule 285 + '\}' reduce using rule 285 + '\;' reduce using rule 285 + 'else' reduce using rule 285 + %eof reduce using rule 285 + + +State 496 + + typeVarBindingPlain -> '(' ident . '::' type ')' (rule 144) + + '::' shift, and enter state 623 + + +State 497 + + many1__typeVarBindingPlain__ -> many1__typeVarBindingPlain__ typeVarBindingPlain . (rule 430) + + error reduce using rule 430 + '(' reduce using rule 430 + '\}' reduce using rule 430 + '\;' reduce using rule 430 + '=' reduce using rule 430 + 'as' reduce using rule 430 + 'else' reduce using rule 430 + 'hiding' reduce using rule 430 + 'nominal' reduce using rule 430 + 'phantom' reduce using rule 430 + 'representational'reduce using rule 430 + 'role' reduce using rule 430 + LOWER reduce using rule 430 + %eof reduce using rule 430 + + +State 498 + + fixity -> infix int 'type' qualProperName . 'as' op (rule 321) + + 'as' shift, and enter state 622 + + +State 499 + + fixity -> infix int qualIdent 'as' . op (rule 319) + + '<=' shift, and enter state 192 + ':' shift, and enter state 193 + '-' shift, and enter state 194 + OPERATOR shift, and enter state 195 + + op goto state 621 + +State 500 + + fixity -> infix int qualProperName 'as' . op (rule 320) + + '<=' shift, and enter state 192 + ':' shift, and enter state 193 + '-' shift, and enter state 194 + OPERATOR shift, and enter state 195 + + op goto state 620 + +State 501 + + instBinding -> ident . '::' type (rule 317) + instBinding -> ident . manyOrEmpty__binderAtom__ guardedDecl (rule 318) + + '(' shift, and enter state 40 + '{' shift, and enter state 41 + '[' shift, and enter state 42 + '::' shift, and enter state 619 + '=' reduce using rule 348 + '|' reduce using rule 348 + '_' shift, and enter state 43 + 'as' shift, and enter state 45 + 'false' shift, and enter state 46 + 'hiding' shift, and enter state 47 + 'nominal' shift, and enter state 48 + 'phantom' shift, and enter state 49 + 'representational'shift, and enter state 50 + 'role' shift, and enter state 51 + 'true' shift, and enter state 52 + LOWER shift, and enter state 53 + UPPER shift, and enter state 54 + QUAL_UPPER shift, and enter state 55 + LIT_CHAR shift, and enter state 56 + LIT_STRING shift, and enter state 57 + LIT_RAW_STRING shift, and enter state 58 + LIT_INT shift, and enter state 59 + LIT_NUMBER shift, and enter state 60 + + qualProperName goto state 25 + ident goto state 26 + string goto state 27 + char goto state 28 + number goto state 29 + boolean goto state 30 + binderAtom goto state 35 + delim__'['__binder__','__']'__goto state 36 + delim__'{'__recordBinder__','__'}'__goto state 37 + many__binderAtom__goto state 220 + manyOrEmpty__binderAtom__goto state 618 + many1__binderAtom__goto state 39 + +State 502 + + manySep1__instBinding__'\;'__ -> instBinding . (rule 392) + + '\}' reduce using rule 392 + '\;' reduce using rule 392 + + +State 503 + + decl -> instHead 'where' '\{' manySep__instBinding__'\;'__ . '\}' (rule 284) + + '\}' shift, and enter state 617 + + +State 504 + + manySep__instBinding__'\;'__ -> manySep1__instBinding__'\;'__ . (rule 358) + manySep1__instBinding__'\;'__ -> manySep1__instBinding__'\;'__ . '\;' instBinding (rule 393) + + '\}' reduce using rule 358 + '\;' shift, and enter state 616 + + +State 505 + + classMember -> ident . '::' type (rule 308) + + '::' shift, and enter state 615 + + +State 506 + + manySep1__classMember__'\;'__ -> classMember . (rule 390) + + '\}' reduce using rule 390 + '\;' reduce using rule 390 + + +State 507 + + decl -> classHead 'where' '\{' manySep__classMember__'\;'__ . '\}' (rule 282) + + '\}' shift, and enter state 614 + + +State 508 + + manySep__classMember__'\;'__ -> manySep1__classMember__'\;'__ . (rule 357) + manySep1__classMember__'\;'__ -> manySep1__classMember__'\;'__ . '\;' classMember (rule 391) + + '\}' reduce using rule 357 + '\;' shift, and enter state 613 + + +State 509 + + decl -> newtypeHead '=' properName typeAtom . (rule 280) + + error reduce using rule 280 + '\}' reduce using rule 280 + '\;' reduce using rule 280 + 'else' reduce using rule 280 + %eof reduce using rule 280 + + +State 510 + + sep1__dataCtor__'|'__ -> sep1__dataCtor__'|'__ '|' . dataCtor (rule 406) + + UPPER shift, and enter state 63 + + properName goto state 435 + dataCtor goto state 612 + +State 511 + + dataCtor -> properName manyOrEmpty__typeAtom__ . (rule 299) + + error reduce using rule 299 + '\}' reduce using rule 299 + '\;' reduce using rule 299 + '|' reduce using rule 299 + 'else' reduce using rule 299 + %eof reduce using rule 299 + + +State 512 + + guardedDecl -> '=' exprWhere . (rule 202) + + error reduce using rule 202 + '\}' reduce using rule 202 + '\;' reduce using rule 202 + 'else' reduce using rule 202 + %eof reduce using rule 202 + + +State 513 + + exprWhere -> expr . (rule 147) + exprWhere -> expr . 'where' '\{' manySep__letBinding__'\;'__ '\}' (rule 148) + + error reduce using rule 147 + '(' reduce using rule 147 + ')' reduce using rule 147 + '{' reduce using rule 147 + '}' reduce using rule 147 + '[' reduce using rule 147 + ']' reduce using rule 147 + '\}' reduce using rule 147 + '\;' reduce using rule 147 + '<=' reduce using rule 147 + ':' reduce using rule 147 + '::' reduce using rule 147 + '|' reduce using rule 147 + '`' reduce using rule 147 + ',' reduce using rule 147 + '_' reduce using rule 147 + '\\' reduce using rule 147 + '-' reduce using rule 147 + '@' reduce using rule 147 + 'ado' reduce using rule 147 + 'as' reduce using rule 147 + 'case' reduce using rule 147 + 'do' reduce using rule 147 + 'else' reduce using rule 147 + 'false' reduce using rule 147 + 'hiding' reduce using rule 147 + 'if' reduce using rule 147 + 'let' reduce using rule 147 + 'nominal' reduce using rule 147 + 'phantom' reduce using rule 147 + 'of' reduce using rule 147 + 'representational'reduce using rule 147 + 'role' reduce using rule 147 + 'then' reduce using rule 147 + 'true' reduce using rule 147 + 'where' shift, and enter state 611 + '(..)' reduce using rule 147 + LOWER reduce using rule 147 + QUAL_LOWER reduce using rule 147 + UPPER reduce using rule 147 + QUAL_UPPER reduce using rule 147 + SYMBOL reduce using rule 147 + QUAL_SYMBOL reduce using rule 147 + OPERATOR reduce using rule 147 + QUAL_OPERATOR reduce using rule 147 + LIT_HOLE reduce using rule 147 + LIT_CHAR reduce using rule 147 + LIT_STRING reduce using rule 147 + LIT_RAW_STRING reduce using rule 147 + LIT_INT reduce using rule 147 + LIT_NUMBER reduce using rule 147 + %eof reduce using rule 147 + + +State 514 + + many1__guardedDeclExpr__ -> many1__guardedDeclExpr__ guardedDeclExpr . (rule 381) + + error reduce using rule 381 + '\}' reduce using rule 381 + '\;' reduce using rule 381 + '|' reduce using rule 381 + 'else' reduce using rule 381 + %eof reduce using rule 381 + + +State 515 + + guardedDeclExpr -> guard '=' . exprWhere (rule 204) + + '(' shift, and enter state 95 + '{' shift, and enter state 96 + '[' shift, and enter state 97 + '_' shift, and enter state 98 + '\\' shift, and enter state 99 + '-' shift, and enter state 100 + 'ado' shift, and enter state 101 + 'as' shift, and enter state 102 + 'case' shift, and enter state 103 + 'do' shift, and enter state 104 + 'false' shift, and enter state 46 + 'hiding' shift, and enter state 105 + 'if' shift, and enter state 106 + 'let' shift, and enter state 107 + 'nominal' shift, and enter state 108 + 'phantom' shift, and enter state 109 + 'representational'shift, and enter state 110 + 'role' shift, and enter state 111 + 'true' shift, and enter state 52 + '(..)' shift, and enter state 112 + LOWER shift, and enter state 113 + QUAL_LOWER shift, and enter state 114 + UPPER shift, and enter state 54 + QUAL_UPPER shift, and enter state 55 + SYMBOL shift, and enter state 115 + QUAL_SYMBOL shift, and enter state 116 + LIT_HOLE shift, and enter state 117 + LIT_CHAR shift, and enter state 56 + LIT_STRING shift, and enter state 57 + LIT_RAW_STRING shift, and enter state 58 + LIT_INT shift, and enter state 59 + LIT_NUMBER shift, and enter state 60 + + qualProperName goto state 74 + qualIdent goto state 75 + qualSymbol goto state 76 + hole goto state 77 + string goto state 78 + char goto state 79 + number goto state 80 + boolean goto state 81 + exprWhere goto state 610 + expr goto state 513 + expr1 goto state 122 + expr2 goto state 83 + expr3 goto state 84 + expr4 goto state 85 + expr5 goto state 86 + expr6 goto state 87 + expr7 goto state 88 + exprAtom goto state 89 + doBlock goto state 90 + adoBlock goto state 91 + delim__'['__expr__','__']'__goto state 93 + delim__'{'__recordLabel__','__'}'__goto state 94 + +State 516 + + rowLabel -> label '::' type . (rule 138) + + ')' reduce using rule 138 + '}' reduce using rule 138 + '|' reduce using rule 138 + ',' reduce using rule 138 + + +State 517 + + row -> sep__rowLabel__','__ '|' type . (rule 137) + + ')' reduce using rule 137 + '}' reduce using rule 137 + + +State 518 + + sep1__rowLabel__','__ -> sep1__rowLabel__','__ ',' rowLabel . (rule 426) + + ')' reduce using rule 426 + '}' reduce using rule 426 + '|' reduce using rule 426 + ',' reduce using rule 426 + + +State 519 + + typeAtom -> '(' typeKindedAtom '::' type . ')' (rule 124) + + ')' shift, and enter state 609 + + +State 520 + + typeAtom -> '(' row ')' . (rule 122) + typeKindedAtom -> '(' row ')' . (rule 131) + + '(' reduce using rule 122 + ')' reduce using rule 122 + '{' reduce using rule 122 + '->' reduce using rule 122 + '<=' reduce using rule 122 + '=>' reduce using rule 122 + ':' reduce using rule 122 + '::' reduce using rule 131 + '_' reduce using rule 122 + '-' reduce using rule 122 + 'as' reduce using rule 122 + 'hiding' reduce using rule 122 + 'nominal' reduce using rule 122 + 'phantom' reduce using rule 122 + 'representational'reduce using rule 122 + 'role' reduce using rule 122 + '(->)' reduce using rule 122 + '(..)' reduce using rule 122 + LOWER reduce using rule 122 + UPPER reduce using rule 122 + QUAL_UPPER reduce using rule 122 + SYMBOL reduce using rule 122 + QUAL_SYMBOL reduce using rule 122 + OPERATOR reduce using rule 122 + QUAL_OPERATOR reduce using rule 122 + LIT_HOLE reduce using rule 122 + LIT_STRING reduce using rule 122 + LIT_RAW_STRING reduce using rule 122 + LIT_INT reduce using rule 122 + + +State 521 + + typeAtom -> '(' typeKindedAtom '::' . type ')' (rule 124) + typeKindedAtom -> '(' typeKindedAtom '::' . type ')' (rule 133) + + '(' shift, and enter state 148 + '{' shift, and enter state 149 + '_' shift, and enter state 150 + '-' shift, and enter state 151 + 'as' shift, and enter state 45 + 'forall' shift, and enter state 152 + 'forallu' shift, and enter state 153 + 'hiding' shift, and enter state 47 + 'nominal' shift, and enter state 48 + 'phantom' shift, and enter state 49 + 'representational'shift, and enter state 50 + 'role' shift, and enter state 51 + '(->)' shift, and enter state 154 + '(..)' shift, and enter state 112 + LOWER shift, and enter state 53 + UPPER shift, and enter state 54 + QUAL_UPPER shift, and enter state 55 + SYMBOL shift, and enter state 115 + QUAL_SYMBOL shift, and enter state 116 + LIT_HOLE shift, and enter state 117 + LIT_STRING shift, and enter state 57 + LIT_RAW_STRING shift, and enter state 58 + LIT_INT shift, and enter state 155 + + qualProperName goto state 133 + ident goto state 134 + qualSymbol goto state 135 + hole goto state 136 + string goto state 137 + int goto state 138 + type goto state 608 + type1 goto state 140 + type2 goto state 141 + type3 goto state 142 + type4 goto state 143 + type5 goto state 144 + typeAtom goto state 145 + forall goto state 146 + +State 522 + + typeAtom -> '(' type1 ')' . (rule 123) + typeKindedAtom -> '(' type1 ')' . (rule 132) + + '(' reduce using rule 123 + ')' reduce using rule 123 + '{' reduce using rule 123 + '->' reduce using rule 123 + '<=' reduce using rule 123 + '=>' reduce using rule 123 + ':' reduce using rule 123 + '::' reduce using rule 132 + '_' reduce using rule 123 + '-' reduce using rule 123 + 'as' reduce using rule 123 + 'hiding' reduce using rule 123 + 'nominal' reduce using rule 123 + 'phantom' reduce using rule 123 + 'representational'reduce using rule 123 + 'role' reduce using rule 123 + '(->)' reduce using rule 123 + '(..)' reduce using rule 123 + LOWER reduce using rule 123 + UPPER reduce using rule 123 + QUAL_UPPER reduce using rule 123 + SYMBOL reduce using rule 123 + QUAL_SYMBOL reduce using rule 123 + OPERATOR reduce using rule 123 + QUAL_OPERATOR reduce using rule 123 + LIT_HOLE reduce using rule 123 + LIT_STRING reduce using rule 123 + LIT_RAW_STRING reduce using rule 123 + LIT_INT reduce using rule 123 + + +State 523 + + typeAtom -> '{' row '}' . (rule 121) + typeKindedAtom -> '{' row '}' . (rule 130) + + '(' reduce using rule 121 + ')' reduce using rule 121 + '{' reduce using rule 121 + '->' reduce using rule 121 + '<=' reduce using rule 121 + '=>' reduce using rule 121 + ':' reduce using rule 121 + '::' reduce using rule 130 + '_' reduce using rule 121 + '-' reduce using rule 121 + 'as' reduce using rule 121 + 'hiding' reduce using rule 121 + 'nominal' reduce using rule 121 + 'phantom' reduce using rule 121 + 'representational'reduce using rule 121 + 'role' reduce using rule 121 + '(->)' reduce using rule 121 + '(..)' reduce using rule 121 + LOWER reduce using rule 121 + UPPER reduce using rule 121 + QUAL_UPPER reduce using rule 121 + SYMBOL reduce using rule 121 + QUAL_SYMBOL reduce using rule 121 + OPERATOR reduce using rule 121 + QUAL_OPERATOR reduce using rule 121 + LIT_HOLE reduce using rule 121 + LIT_STRING reduce using rule 121 + LIT_RAW_STRING reduce using rule 121 + LIT_INT reduce using rule 121 + + +State 524 + + type1 -> forall many__typeVarBinding__ '.' type1 . (rule 103) + + error reduce using rule 103 + '(' reduce using rule 103 + ')' reduce using rule 103 + '{' reduce using rule 103 + '}' reduce using rule 103 + '[' reduce using rule 103 + ']' reduce using rule 103 + '\}' reduce using rule 103 + '\;' reduce using rule 103 + '<-' reduce using rule 103 + '<=' reduce using rule 103 + ':' reduce using rule 103 + '::' reduce using rule 103 + '|' reduce using rule 103 + '`' reduce using rule 103 + ',' reduce using rule 103 + '_' reduce using rule 103 + '\\' reduce using rule 103 + '-' reduce using rule 103 + '@' reduce using rule 103 + 'ado' reduce using rule 103 + 'as' reduce using rule 103 + 'case' reduce using rule 103 + 'do' reduce using rule 103 + 'else' reduce using rule 103 + 'false' reduce using rule 103 + 'hiding' reduce using rule 103 + 'if' reduce using rule 103 + 'let' reduce using rule 103 + 'nominal' reduce using rule 103 + 'phantom' reduce using rule 103 + 'of' reduce using rule 103 + 'representational'reduce using rule 103 + 'role' reduce using rule 103 + 'then' reduce using rule 103 + 'true' reduce using rule 103 + 'where' reduce using rule 103 + '(..)' reduce using rule 103 + LOWER reduce using rule 103 + QUAL_LOWER reduce using rule 103 + UPPER reduce using rule 103 + QUAL_UPPER reduce using rule 103 + SYMBOL reduce using rule 103 + QUAL_SYMBOL reduce using rule 103 + OPERATOR reduce using rule 103 + QUAL_OPERATOR reduce using rule 103 + LIT_HOLE reduce using rule 103 + LIT_CHAR reduce using rule 103 + LIT_STRING reduce using rule 103 + LIT_RAW_STRING reduce using rule 103 + LIT_INT reduce using rule 103 + LIT_NUMBER reduce using rule 103 + %eof reduce using rule 103 + + +State 525 + + typeVarBinding -> '(' '@' ident . '::' type ')' (rule 142) + + '::' shift, and enter state 607 + + +State 526 + + typeVarBinding -> '(' ident '::' . type ')' (rule 141) + + '(' shift, and enter state 148 + '{' shift, and enter state 149 + '_' shift, and enter state 150 + '-' shift, and enter state 151 + 'as' shift, and enter state 45 + 'forall' shift, and enter state 152 + 'forallu' shift, and enter state 153 + 'hiding' shift, and enter state 47 + 'nominal' shift, and enter state 48 + 'phantom' shift, and enter state 49 + 'representational'shift, and enter state 50 + 'role' shift, and enter state 51 + '(->)' shift, and enter state 154 + '(..)' shift, and enter state 112 + LOWER shift, and enter state 53 + UPPER shift, and enter state 54 + QUAL_UPPER shift, and enter state 55 + SYMBOL shift, and enter state 115 + QUAL_SYMBOL shift, and enter state 116 + LIT_HOLE shift, and enter state 117 + LIT_STRING shift, and enter state 57 + LIT_RAW_STRING shift, and enter state 58 + LIT_INT shift, and enter state 155 + + qualProperName goto state 133 + ident goto state 134 + qualSymbol goto state 135 + hole goto state 136 + string goto state 137 + int goto state 138 + type goto state 606 + type1 goto state 140 + type2 goto state 141 + type3 goto state 142 + type4 goto state 143 + type5 goto state 144 + typeAtom goto state 145 + forall goto state 146 + +State 527 + + export -> properName . (rule 258) + export -> properName . dataMembers (rule 259) + + '(' shift, and enter state 604 + ')' reduce using rule 258 + ',' reduce using rule 258 + '(..)' shift, and enter state 605 + + dataMembers goto state 603 + +State 528 + + export -> ident . (rule 256) + + ')' reduce using rule 256 + ',' reduce using rule 256 + + +State 529 + + export -> symbol . (rule 257) + + ')' reduce using rule 257 + ',' reduce using rule 257 + + +State 530 + + sep1__export__','__ -> export . (rule 409) + + ')' reduce using rule 409 + ',' reduce using rule 409 + + +State 531 + + exports -> '(' sep__export__','__ . ')' (rule 255) + + ')' shift, and enter state 602 + + +State 532 + + sep__export__','__ -> sep1__export__','__ . (rule 365) + sep1__export__','__ -> sep1__export__','__ . ',' export (rule 410) + + ')' reduce using rule 365 + ',' shift, and enter state 601 + + +State 533 + + export -> 'class' . properName (rule 261) + + UPPER shift, and enter state 63 + + properName goto state 600 + +State 534 + + export -> 'module' . moduleName (rule 262) + + UPPER shift, and enter state 24 + QUAL_UPPER shift, and enter state 132 + + moduleName goto state 599 + +State 535 + + export -> 'type' . symbol (rule 260) + + '(..)' shift, and enter state 479 + SYMBOL shift, and enter state 480 + + symbol goto state 598 + +State 536 + + moduleHeader -> 'module' moduleName exports 'where' . '\{' moduleImports (rule 242) + + '\{' shift, and enter state 597 + + +State 537 + + doStatement -> 'let' '\{' manySep__letBinding__'\;'__ '\}' . (rule 211) + + error reduce using rule 211 + + +State 538 + + manySep1__letBinding__'\;'__ -> manySep1__letBinding__'\;'__ '\;' . letBinding (rule 395) + + '(' shift, and enter state 40 + '{' shift, and enter state 41 + '[' shift, and enter state 42 + '_' shift, and enter state 43 + '-' shift, and enter state 44 + 'as' shift, and enter state 45 + 'false' shift, and enter state 46 + 'hiding' shift, and enter state 47 + 'nominal' shift, and enter state 48 + 'phantom' shift, and enter state 49 + 'representational'shift, and enter state 50 + 'role' shift, and enter state 51 + 'true' shift, and enter state 52 + LOWER shift, and enter state 53 + UPPER shift, and enter state 54 + QUAL_UPPER shift, and enter state 55 + LIT_CHAR shift, and enter state 56 + LIT_STRING shift, and enter state 57 + LIT_RAW_STRING shift, and enter state 58 + LIT_INT shift, and enter state 59 + LIT_NUMBER shift, and enter state 60 + + qualProperName goto state 25 + ident goto state 396 + string goto state 27 + char goto state 28 + number goto state 29 + boolean goto state 30 + letBinding goto state 596 + binder1 goto state 398 + binder2 goto state 34 + binderAtom goto state 35 + delim__'['__binder__','__']'__goto state 36 + delim__'{'__recordBinder__','__'}'__goto state 37 + many__binderAtom__goto state 38 + many1__binderAtom__goto state 39 + +State 539 + + expr5 -> 'let' '\{' manySep__letBinding__'\;'__ '\}' . 'in' expr (rule 167) + + 'in' shift, and enter state 595 + + +State 540 + + letBinding -> binder1 '=' . exprWhere (rule 200) + + '(' shift, and enter state 95 + '{' shift, and enter state 96 + '[' shift, and enter state 97 + '_' shift, and enter state 98 + '\\' shift, and enter state 99 + '-' shift, and enter state 100 + 'ado' shift, and enter state 101 + 'as' shift, and enter state 102 + 'case' shift, and enter state 103 + 'do' shift, and enter state 104 + 'false' shift, and enter state 46 + 'hiding' shift, and enter state 105 + 'if' shift, and enter state 106 + 'let' shift, and enter state 107 + 'nominal' shift, and enter state 108 + 'phantom' shift, and enter state 109 + 'representational'shift, and enter state 110 + 'role' shift, and enter state 111 + 'true' shift, and enter state 52 + '(..)' shift, and enter state 112 + LOWER shift, and enter state 113 + QUAL_LOWER shift, and enter state 114 + UPPER shift, and enter state 54 + QUAL_UPPER shift, and enter state 55 + SYMBOL shift, and enter state 115 + QUAL_SYMBOL shift, and enter state 116 + LIT_HOLE shift, and enter state 117 + LIT_CHAR shift, and enter state 56 + LIT_STRING shift, and enter state 57 + LIT_RAW_STRING shift, and enter state 58 + LIT_INT shift, and enter state 59 + LIT_NUMBER shift, and enter state 60 + + qualProperName goto state 74 + qualIdent goto state 75 + qualSymbol goto state 76 + hole goto state 77 + string goto state 78 + char goto state 79 + number goto state 80 + boolean goto state 81 + exprWhere goto state 594 + expr goto state 513 + expr1 goto state 122 + expr2 goto state 83 + expr3 goto state 84 + expr4 goto state 85 + expr5 goto state 86 + expr6 goto state 87 + expr7 goto state 88 + exprAtom goto state 89 + doBlock goto state 90 + adoBlock goto state 91 + delim__'['__expr__','__']'__goto state 93 + delim__'{'__recordLabel__','__'}'__goto state 94 + +State 541 + + letBinding -> ident guardedDecl . (rule 198) + + '\}' reduce using rule 198 + '\;' reduce using rule 198 + + +State 542 + + letBinding -> ident many__binderAtom__ . guardedDecl (rule 199) + + '=' shift, and enter state 433 + '|' shift, and enter state 434 + + guardedDecl goto state 593 + guardedDeclExprgoto state 429 + guard goto state 430 + many__guardedDeclExpr__goto state 431 + many1__guardedDeclExpr__goto state 432 + +State 543 + + letBinding -> ident '::' . type (rule 197) + + '(' shift, and enter state 148 + '{' shift, and enter state 149 + '_' shift, and enter state 150 + '-' shift, and enter state 151 + 'as' shift, and enter state 45 + 'forall' shift, and enter state 152 + 'forallu' shift, and enter state 153 + 'hiding' shift, and enter state 47 + 'nominal' shift, and enter state 48 + 'phantom' shift, and enter state 49 + 'representational'shift, and enter state 50 + 'role' shift, and enter state 51 + '(->)' shift, and enter state 154 + '(..)' shift, and enter state 112 + LOWER shift, and enter state 53 + UPPER shift, and enter state 54 + QUAL_UPPER shift, and enter state 55 + SYMBOL shift, and enter state 115 + QUAL_SYMBOL shift, and enter state 116 + LIT_HOLE shift, and enter state 117 + LIT_STRING shift, and enter state 57 + LIT_RAW_STRING shift, and enter state 58 + LIT_INT shift, and enter state 155 + + qualProperName goto state 133 + ident goto state 134 + qualSymbol goto state 135 + hole goto state 136 + string goto state 137 + int goto state 138 + type goto state 592 + type1 goto state 140 + type2 goto state 141 + type3 goto state 142 + type4 goto state 143 + type5 goto state 144 + typeAtom goto state 145 + forall goto state 146 + +State 544 + + expr5 -> 'if' expr 'then' expr . 'else' expr (rule 163) + + 'else' shift, and enter state 591 + + +State 545 + + expr5 -> 'case' sep__expr__','__ 'of' '\{' . manySep__caseBranch__'\;'__ '\}' (rule 168) + expr5 -> 'case' sep__expr__','__ 'of' '\{' . sep__binder1__','__ '->' '\}' exprWhere (rule 169) + expr5 -> 'case' sep__expr__','__ 'of' '\{' . sep__binder1__','__ '\}' guardedCase (rule 170) + + '(' shift, and enter state 40 + '{' shift, and enter state 41 + '[' shift, and enter state 42 + '_' shift, and enter state 43 + '-' shift, and enter state 44 + 'as' shift, and enter state 45 + 'false' shift, and enter state 46 + 'hiding' shift, and enter state 47 + 'nominal' shift, and enter state 48 + 'phantom' shift, and enter state 49 + 'representational'shift, and enter state 50 + 'role' shift, and enter state 51 + 'true' shift, and enter state 52 + LOWER shift, and enter state 53 + UPPER shift, and enter state 54 + QUAL_UPPER shift, and enter state 55 + LIT_CHAR shift, and enter state 56 + LIT_STRING shift, and enter state 57 + LIT_RAW_STRING shift, and enter state 58 + LIT_INT shift, and enter state 59 + LIT_NUMBER shift, and enter state 60 + + qualProperName goto state 25 + ident goto state 26 + string goto state 27 + char goto state 28 + number goto state 29 + boolean goto state 30 + caseBranch goto state 585 + binder1 goto state 586 + binder2 goto state 34 + binderAtom goto state 35 + delim__'['__binder__','__']'__goto state 36 + delim__'{'__recordBinder__','__'}'__goto state 37 + many__binderAtom__goto state 38 + manySep__caseBranch__'\;'__goto state 587 + sep__binder1__','__goto state 588 + many1__binderAtom__goto state 39 + manySep1__caseBranch__'\;'__goto state 589 + sep1__binder1__','__goto state 590 + +State 546 + + sep1__expr__','__ -> sep1__expr__','__ ',' expr . (rule 412) + + ']' reduce using rule 412 + ',' reduce using rule 412 + 'of' reduce using rule 412 + + +State 547 + + expr5 -> '\\' many__binderAtom__ '->' expr . (rule 166) + + error reduce using rule 166 + '(' reduce using rule 166 + ')' reduce using rule 166 + '{' reduce using rule 166 + '}' reduce using rule 166 + '[' reduce using rule 166 + ']' reduce using rule 166 + '\}' reduce using rule 166 + '\;' reduce using rule 166 + '<=' reduce using rule 166 + ':' reduce using rule 166 + '::' reduce using rule 166 + '|' reduce using rule 166 + '`' reduce using rule 166 + ',' reduce using rule 166 + '_' reduce using rule 166 + '\\' reduce using rule 166 + '-' reduce using rule 166 + '@' reduce using rule 166 + 'ado' reduce using rule 166 + 'as' reduce using rule 166 + 'case' reduce using rule 166 + 'do' reduce using rule 166 + 'else' reduce using rule 166 + 'false' reduce using rule 166 + 'hiding' reduce using rule 166 + 'if' reduce using rule 166 + 'let' reduce using rule 166 + 'nominal' reduce using rule 166 + 'phantom' reduce using rule 166 + 'of' reduce using rule 166 + 'representational'reduce using rule 166 + 'role' reduce using rule 166 + 'then' reduce using rule 166 + 'true' reduce using rule 166 + 'where' reduce using rule 166 + '(..)' reduce using rule 166 + LOWER reduce using rule 166 + QUAL_LOWER reduce using rule 166 + UPPER reduce using rule 166 + QUAL_UPPER reduce using rule 166 + SYMBOL reduce using rule 166 + QUAL_SYMBOL reduce using rule 166 + OPERATOR reduce using rule 166 + QUAL_OPERATOR reduce using rule 166 + LIT_HOLE reduce using rule 166 + LIT_CHAR reduce using rule 166 + LIT_STRING reduce using rule 166 + LIT_RAW_STRING reduce using rule 166 + LIT_INT reduce using rule 166 + LIT_NUMBER reduce using rule 166 + %eof reduce using rule 166 + + +State 548 + + recordLabel -> label '=' expr . (rule 189) + + '}' reduce using rule 189 + ',' reduce using rule 189 + + +State 549 + + recordLabel -> label ':' expr . (rule 190) + + '}' reduce using rule 190 + ',' reduce using rule 190 + + +State 550 + + sep1__recordLabel__','__ -> sep1__recordLabel__','__ ',' recordLabel . (rule 436) + + '}' reduce using rule 436 + ',' reduce using rule 436 + + +State 551 + + sep1__label__'.'__ -> sep1__label__'.'__ '.' . label (rule 418) + + 'ado' shift, and enter state 230 + 'as' shift, and enter state 231 + 'case' shift, and enter state 232 + 'class' shift, and enter state 233 + 'data' shift, and enter state 234 + 'derive' shift, and enter state 235 + 'do' shift, and enter state 236 + 'else' shift, and enter state 237 + 'false' shift, and enter state 238 + 'forall' shift, and enter state 239 + 'foreign' shift, and enter state 240 + 'hiding' shift, and enter state 241 + 'import' shift, and enter state 242 + 'if' shift, and enter state 243 + 'in' shift, and enter state 244 + 'infix' shift, and enter state 245 + 'infixl' shift, and enter state 246 + 'infixr' shift, and enter state 247 + 'instance' shift, and enter state 248 + 'let' shift, and enter state 249 + 'module' shift, and enter state 250 + 'newtype' shift, and enter state 251 + 'nominal' shift, and enter state 252 + 'phantom' shift, and enter state 253 + 'of' shift, and enter state 254 + 'representational'shift, and enter state 255 + 'role' shift, and enter state 256 + 'then' shift, and enter state 257 + 'true' shift, and enter state 258 + 'type' shift, and enter state 259 + 'where' shift, and enter state 260 + LOWER shift, and enter state 261 + LIT_STRING shift, and enter state 262 + LIT_RAW_STRING shift, and enter state 263 + + label goto state 584 + +State 552 + + sep1__recordUpdateOrLabel__','__ -> sep1__recordUpdateOrLabel__','__ ',' . recordUpdateOrLabel (rule 424) + + 'ado' shift, and enter state 230 + 'as' shift, and enter state 231 + 'case' shift, and enter state 232 + 'class' shift, and enter state 233 + 'data' shift, and enter state 234 + 'derive' shift, and enter state 235 + 'do' shift, and enter state 236 + 'else' shift, and enter state 237 + 'false' shift, and enter state 238 + 'forall' shift, and enter state 239 + 'foreign' shift, and enter state 240 + 'hiding' shift, and enter state 241 + 'import' shift, and enter state 242 + 'if' shift, and enter state 243 + 'in' shift, and enter state 244 + 'infix' shift, and enter state 245 + 'infixl' shift, and enter state 246 + 'infixr' shift, and enter state 247 + 'instance' shift, and enter state 248 + 'let' shift, and enter state 249 + 'module' shift, and enter state 250 + 'newtype' shift, and enter state 251 + 'nominal' shift, and enter state 252 + 'phantom' shift, and enter state 253 + 'of' shift, and enter state 254 + 'representational'shift, and enter state 255 + 'role' shift, and enter state 256 + 'then' shift, and enter state 257 + 'true' shift, and enter state 258 + 'type' shift, and enter state 259 + 'where' shift, and enter state 260 + LOWER shift, and enter state 261 + LIT_STRING shift, and enter state 262 + LIT_RAW_STRING shift, and enter state 263 + + label goto state 376 + recordUpdateOrLabelgoto state 583 + +State 553 + + expr6 -> expr7 '{' sep__recordUpdateOrLabel__','__ '}' . (rule 173) + + error reduce using rule 173 + '(' reduce using rule 173 + ')' reduce using rule 173 + '{' reduce using rule 173 + '}' reduce using rule 173 + '[' reduce using rule 173 + ']' reduce using rule 173 + '\}' reduce using rule 173 + '\;' reduce using rule 173 + '<=' reduce using rule 173 + ':' reduce using rule 173 + '::' reduce using rule 173 + '|' reduce using rule 173 + '`' reduce using rule 173 + ',' reduce using rule 173 + '_' reduce using rule 173 + '\\' reduce using rule 173 + '-' reduce using rule 173 + '@' reduce using rule 173 + 'ado' reduce using rule 173 + 'as' reduce using rule 173 + 'case' reduce using rule 173 + 'do' reduce using rule 173 + 'else' reduce using rule 173 + 'false' reduce using rule 173 + 'hiding' reduce using rule 173 + 'if' reduce using rule 173 + 'let' reduce using rule 173 + 'nominal' reduce using rule 173 + 'phantom' reduce using rule 173 + 'of' reduce using rule 173 + 'representational'reduce using rule 173 + 'role' reduce using rule 173 + 'then' reduce using rule 173 + 'true' reduce using rule 173 + 'where' reduce using rule 173 + '(..)' reduce using rule 173 + LOWER reduce using rule 173 + QUAL_LOWER reduce using rule 173 + UPPER reduce using rule 173 + QUAL_UPPER reduce using rule 173 + SYMBOL reduce using rule 173 + QUAL_SYMBOL reduce using rule 173 + OPERATOR reduce using rule 173 + QUAL_OPERATOR reduce using rule 173 + LIT_HOLE reduce using rule 173 + LIT_CHAR reduce using rule 173 + LIT_STRING reduce using rule 173 + LIT_RAW_STRING reduce using rule 173 + LIT_INT reduce using rule 173 + LIT_NUMBER reduce using rule 173 + %eof reduce using rule 173 + + +State 554 + + recordUpdateOrLabel -> label '{' . sep__recordUpdate__','__ '}' (rule 194) + + 'ado' shift, and enter state 230 + 'as' shift, and enter state 231 + 'case' shift, and enter state 232 + 'class' shift, and enter state 233 + 'data' shift, and enter state 234 + 'derive' shift, and enter state 235 + 'do' shift, and enter state 236 + 'else' shift, and enter state 237 + 'false' shift, and enter state 238 + 'forall' shift, and enter state 239 + 'foreign' shift, and enter state 240 + 'hiding' shift, and enter state 241 + 'import' shift, and enter state 242 + 'if' shift, and enter state 243 + 'in' shift, and enter state 244 + 'infix' shift, and enter state 245 + 'infixl' shift, and enter state 246 + 'infixr' shift, and enter state 247 + 'instance' shift, and enter state 248 + 'let' shift, and enter state 249 + 'module' shift, and enter state 250 + 'newtype' shift, and enter state 251 + 'nominal' shift, and enter state 252 + 'phantom' shift, and enter state 253 + 'of' shift, and enter state 254 + 'representational'shift, and enter state 255 + 'role' shift, and enter state 256 + 'then' shift, and enter state 257 + 'true' shift, and enter state 258 + 'type' shift, and enter state 259 + 'where' shift, and enter state 260 + LOWER shift, and enter state 261 + LIT_STRING shift, and enter state 262 + LIT_RAW_STRING shift, and enter state 263 + + label goto state 579 + recordUpdate goto state 580 + sep__recordUpdate__','__goto state 581 + sep1__recordUpdate__','__goto state 582 + +State 555 + + recordUpdateOrLabel -> label ':' . expr (rule 191) + + '(' shift, and enter state 95 + '{' shift, and enter state 96 + '[' shift, and enter state 97 + '_' shift, and enter state 98 + '\\' shift, and enter state 99 + '-' shift, and enter state 100 + 'ado' shift, and enter state 101 + 'as' shift, and enter state 102 + 'case' shift, and enter state 103 + 'do' shift, and enter state 104 + 'false' shift, and enter state 46 + 'hiding' shift, and enter state 105 + 'if' shift, and enter state 106 + 'let' shift, and enter state 107 + 'nominal' shift, and enter state 108 + 'phantom' shift, and enter state 109 + 'representational'shift, and enter state 110 + 'role' shift, and enter state 111 + 'true' shift, and enter state 52 + '(..)' shift, and enter state 112 + LOWER shift, and enter state 113 + QUAL_LOWER shift, and enter state 114 + UPPER shift, and enter state 54 + QUAL_UPPER shift, and enter state 55 + SYMBOL shift, and enter state 115 + QUAL_SYMBOL shift, and enter state 116 + LIT_HOLE shift, and enter state 117 + LIT_CHAR shift, and enter state 56 + LIT_STRING shift, and enter state 57 + LIT_RAW_STRING shift, and enter state 58 + LIT_INT shift, and enter state 59 + LIT_NUMBER shift, and enter state 60 + + qualProperName goto state 74 + qualIdent goto state 75 + qualSymbol goto state 76 + hole goto state 77 + string goto state 78 + char goto state 79 + number goto state 80 + boolean goto state 81 + expr goto state 578 + expr1 goto state 122 + expr2 goto state 83 + expr3 goto state 84 + expr4 goto state 85 + expr5 goto state 86 + expr6 goto state 87 + expr7 goto state 88 + exprAtom goto state 89 + doBlock goto state 90 + adoBlock goto state 91 + delim__'['__expr__','__']'__goto state 93 + delim__'{'__recordLabel__','__'}'__goto state 94 + +State 556 + + recordUpdateOrLabel -> label '=' . expr (rule 193) + + '(' shift, and enter state 95 + '{' shift, and enter state 96 + '[' shift, and enter state 97 + '_' shift, and enter state 98 + '\\' shift, and enter state 99 + '-' shift, and enter state 100 + 'ado' shift, and enter state 101 + 'as' shift, and enter state 102 + 'case' shift, and enter state 103 + 'do' shift, and enter state 104 + 'false' shift, and enter state 46 + 'hiding' shift, and enter state 105 + 'if' shift, and enter state 106 + 'let' shift, and enter state 107 + 'nominal' shift, and enter state 108 + 'phantom' shift, and enter state 109 + 'representational'shift, and enter state 110 + 'role' shift, and enter state 111 + 'true' shift, and enter state 52 + '(..)' shift, and enter state 112 + LOWER shift, and enter state 113 + QUAL_LOWER shift, and enter state 114 + UPPER shift, and enter state 54 + QUAL_UPPER shift, and enter state 55 + SYMBOL shift, and enter state 115 + QUAL_SYMBOL shift, and enter state 116 + LIT_HOLE shift, and enter state 117 + LIT_CHAR shift, and enter state 56 + LIT_STRING shift, and enter state 57 + LIT_RAW_STRING shift, and enter state 58 + LIT_INT shift, and enter state 59 + LIT_NUMBER shift, and enter state 60 + + qualProperName goto state 74 + qualIdent goto state 75 + qualSymbol goto state 76 + hole goto state 77 + string goto state 78 + char goto state 79 + number goto state 80 + boolean goto state 81 + expr goto state 577 + expr1 goto state 122 + expr2 goto state 83 + expr3 goto state 84 + expr4 goto state 85 + expr5 goto state 86 + expr6 goto state 87 + expr7 goto state 88 + exprAtom goto state 89 + doBlock goto state 90 + adoBlock goto state 91 + delim__'['__expr__','__']'__goto state 93 + delim__'{'__recordLabel__','__'}'__goto state 94 + +State 557 + + exprBacktick -> exprBacktick qualOp . expr3 (rule 156) + + '(' shift, and enter state 95 + '{' shift, and enter state 96 + '[' shift, and enter state 97 + '_' shift, and enter state 98 + '\\' shift, and enter state 99 + '-' shift, and enter state 100 + 'ado' shift, and enter state 101 + 'as' shift, and enter state 102 + 'case' shift, and enter state 103 + 'do' shift, and enter state 104 + 'false' shift, and enter state 46 + 'hiding' shift, and enter state 105 + 'if' shift, and enter state 106 + 'let' shift, and enter state 107 + 'nominal' shift, and enter state 108 + 'phantom' shift, and enter state 109 + 'representational'shift, and enter state 110 + 'role' shift, and enter state 111 + 'true' shift, and enter state 52 + '(..)' shift, and enter state 112 + LOWER shift, and enter state 113 + QUAL_LOWER shift, and enter state 114 + UPPER shift, and enter state 54 + QUAL_UPPER shift, and enter state 55 + SYMBOL shift, and enter state 115 + QUAL_SYMBOL shift, and enter state 116 + LIT_HOLE shift, and enter state 117 + LIT_CHAR shift, and enter state 56 + LIT_STRING shift, and enter state 57 + LIT_RAW_STRING shift, and enter state 58 + LIT_INT shift, and enter state 59 + LIT_NUMBER shift, and enter state 60 + + qualProperName goto state 74 + qualIdent goto state 75 + qualSymbol goto state 76 + hole goto state 77 + string goto state 78 + char goto state 79 + number goto state 80 + boolean goto state 81 + expr3 goto state 576 + expr4 goto state 85 + expr5 goto state 86 + expr6 goto state 87 + expr7 goto state 88 + exprAtom goto state 89 + doBlock goto state 90 + adoBlock goto state 91 + delim__'['__expr__','__']'__goto state 93 + delim__'{'__recordLabel__','__'}'__goto state 94 + +State 558 + + expr2 -> expr2 '`' exprBacktick '`' . expr3 (rule 154) + + '(' shift, and enter state 95 + '{' shift, and enter state 96 + '[' shift, and enter state 97 + '_' shift, and enter state 98 + '\\' shift, and enter state 99 + '-' shift, and enter state 100 + 'ado' shift, and enter state 101 + 'as' shift, and enter state 102 + 'case' shift, and enter state 103 + 'do' shift, and enter state 104 + 'false' shift, and enter state 46 + 'hiding' shift, and enter state 105 + 'if' shift, and enter state 106 + 'let' shift, and enter state 107 + 'nominal' shift, and enter state 108 + 'phantom' shift, and enter state 109 + 'representational'shift, and enter state 110 + 'role' shift, and enter state 111 + 'true' shift, and enter state 52 + '(..)' shift, and enter state 112 + LOWER shift, and enter state 113 + QUAL_LOWER shift, and enter state 114 + UPPER shift, and enter state 54 + QUAL_UPPER shift, and enter state 55 + SYMBOL shift, and enter state 115 + QUAL_SYMBOL shift, and enter state 116 + LIT_HOLE shift, and enter state 117 + LIT_CHAR shift, and enter state 56 + LIT_STRING shift, and enter state 57 + LIT_RAW_STRING shift, and enter state 58 + LIT_INT shift, and enter state 59 + LIT_NUMBER shift, and enter state 60 + + qualProperName goto state 74 + qualIdent goto state 75 + qualSymbol goto state 76 + hole goto state 77 + string goto state 78 + char goto state 79 + number goto state 80 + boolean goto state 81 + expr3 goto state 575 + expr4 goto state 85 + expr5 goto state 86 + expr6 goto state 87 + expr7 goto state 88 + exprAtom goto state 89 + doBlock goto state 90 + adoBlock goto state 91 + delim__'['__expr__','__']'__goto state 93 + delim__'{'__recordLabel__','__'}'__goto state 94 + +State 559 + + sep1__constraint__','__ -> sep1__constraint__','__ ',' constraint . (rule 404) + + ')' reduce using rule 404 + ',' reduce using rule 404 + + +State 560 + + many1__ident__ -> ident . (rule 382) + + error reduce using rule 382 + '->' reduce using rule 382 + ',' reduce using rule 382 + 'as' reduce using rule 382 + 'hiding' reduce using rule 382 + 'nominal' reduce using rule 382 + 'phantom' reduce using rule 382 + 'representational'reduce using rule 382 + 'role' reduce using rule 382 + LOWER reduce using rule 382 + + +State 561 + + sep1__fundep__','__ -> fundep . (rule 413) + + error reduce using rule 413 + ',' reduce using rule 413 + + +State 562 + + fundep -> many__ident__ . '->' many__ident__ (rule 307) + + '->' shift, and enter state 574 + + +State 563 + + fundeps -> '|' sep__fundep__','__ . (rule 305) + + error reduce using rule 305 + + +State 564 + + many__ident__ -> many1__ident__ . (rule 345) + many1__ident__ -> many1__ident__ . ident (rule 383) + + error reduce using rule 345 + '->' reduce using rule 345 + ',' reduce using rule 345 + 'as' shift, and enter state 45 + 'hiding' shift, and enter state 47 + 'nominal' shift, and enter state 48 + 'phantom' shift, and enter state 49 + 'representational'shift, and enter state 50 + 'role' shift, and enter state 51 + LOWER shift, and enter state 53 + + ident goto state 573 + +State 565 + + sep__fundep__','__ -> sep1__fundep__','__ . (rule 367) + sep1__fundep__','__ -> sep1__fundep__','__ . ',' fundep (rule 414) + + error reduce using rule 367 + ',' shift, and enter state 572 + + +State 566 + + fundep -> '->' . many__ident__ (rule 306) + + 'as' shift, and enter state 45 + 'hiding' shift, and enter state 47 + 'nominal' shift, and enter state 48 + 'phantom' shift, and enter state 49 + 'representational'shift, and enter state 50 + 'role' shift, and enter state 51 + LOWER shift, and enter state 53 + + ident goto state 560 + many__ident__ goto state 571 + many1__ident__ goto state 564 + +State 567 + + sep1__binder__','__ -> sep1__binder__','__ ',' binder . (rule 432) + + ']' reduce using rule 432 + ',' reduce using rule 432 + + +State 568 + + recordBinder -> label '=' binder . (rule 240) + + '}' reduce using rule 240 + ',' reduce using rule 240 + + +State 569 + + recordBinder -> label ':' binder . (rule 241) + + '}' reduce using rule 241 + ',' reduce using rule 241 + + +State 570 + + sep1__recordBinder__','__ -> sep1__recordBinder__','__ ',' recordBinder . (rule 434) + + '}' reduce using rule 434 + ',' reduce using rule 434 + + +State 571 + + fundep -> '->' many__ident__ . (rule 306) + + error reduce using rule 306 + ',' reduce using rule 306 + + +State 572 + + sep1__fundep__','__ -> sep1__fundep__','__ ',' . fundep (rule 414) + + '->' shift, and enter state 566 + 'as' shift, and enter state 45 + 'hiding' shift, and enter state 47 + 'nominal' shift, and enter state 48 + 'phantom' shift, and enter state 49 + 'representational'shift, and enter state 50 + 'role' shift, and enter state 51 + LOWER shift, and enter state 53 + + ident goto state 560 + fundep goto state 676 + many__ident__ goto state 562 + many1__ident__ goto state 564 + +State 573 + + many1__ident__ -> many1__ident__ ident . (rule 383) + + error reduce using rule 383 + '->' reduce using rule 383 + ',' reduce using rule 383 + 'as' reduce using rule 383 + 'hiding' reduce using rule 383 + 'nominal' reduce using rule 383 + 'phantom' reduce using rule 383 + 'representational'reduce using rule 383 + 'role' reduce using rule 383 + LOWER reduce using rule 383 + + +State 574 + + fundep -> many__ident__ '->' . many__ident__ (rule 307) + + 'as' shift, and enter state 45 + 'hiding' shift, and enter state 47 + 'nominal' shift, and enter state 48 + 'phantom' shift, and enter state 49 + 'representational'shift, and enter state 50 + 'role' shift, and enter state 51 + LOWER shift, and enter state 53 + + ident goto state 560 + many__ident__ goto state 675 + many1__ident__ goto state 564 + +State 575 + + expr2 -> expr2 '`' exprBacktick '`' expr3 . (rule 154) + + error reduce using rule 154 + '(' reduce using rule 154 + ')' reduce using rule 154 + '{' reduce using rule 154 + '}' reduce using rule 154 + '[' reduce using rule 154 + ']' reduce using rule 154 + '\}' reduce using rule 154 + '\;' reduce using rule 154 + '<=' reduce using rule 154 + ':' reduce using rule 154 + '::' reduce using rule 154 + '|' reduce using rule 154 + '`' reduce using rule 154 + ',' reduce using rule 154 + '_' reduce using rule 154 + '\\' reduce using rule 154 + '-' reduce using rule 154 + '@' reduce using rule 154 + 'ado' reduce using rule 154 + 'as' reduce using rule 154 + 'case' reduce using rule 154 + 'do' reduce using rule 154 + 'else' reduce using rule 154 + 'false' reduce using rule 154 + 'hiding' reduce using rule 154 + 'if' reduce using rule 154 + 'let' reduce using rule 154 + 'nominal' reduce using rule 154 + 'phantom' reduce using rule 154 + 'of' reduce using rule 154 + 'representational'reduce using rule 154 + 'role' reduce using rule 154 + 'then' reduce using rule 154 + 'true' reduce using rule 154 + 'where' reduce using rule 154 + '(..)' reduce using rule 154 + LOWER reduce using rule 154 + QUAL_LOWER reduce using rule 154 + UPPER reduce using rule 154 + QUAL_UPPER reduce using rule 154 + SYMBOL reduce using rule 154 + QUAL_SYMBOL reduce using rule 154 + OPERATOR reduce using rule 154 + QUAL_OPERATOR reduce using rule 154 + LIT_HOLE reduce using rule 154 + LIT_CHAR reduce using rule 154 + LIT_STRING reduce using rule 154 + LIT_RAW_STRING reduce using rule 154 + LIT_INT reduce using rule 154 + LIT_NUMBER reduce using rule 154 + %eof reduce using rule 154 + + +State 576 + + exprBacktick -> exprBacktick qualOp expr3 . (rule 156) + + '<=' reduce using rule 156 + ':' reduce using rule 156 + '`' reduce using rule 156 + '-' reduce using rule 156 + OPERATOR reduce using rule 156 + QUAL_OPERATOR reduce using rule 156 + + +State 577 + + recordUpdateOrLabel -> label '=' expr . (rule 193) + + '}' reduce using rule 193 + ',' reduce using rule 193 + + +State 578 + + recordUpdateOrLabel -> label ':' expr . (rule 191) + + '}' reduce using rule 191 + ',' reduce using rule 191 + + +State 579 + + recordUpdate -> label . '=' expr (rule 195) + recordUpdate -> label . '{' sep__recordUpdate__','__ '}' (rule 196) + + '{' shift, and enter state 673 + '=' shift, and enter state 674 + + +State 580 + + sep1__recordUpdate__','__ -> recordUpdate . (rule 421) + + '}' reduce using rule 421 + ',' reduce using rule 421 + + +State 581 + + recordUpdateOrLabel -> label '{' sep__recordUpdate__','__ . '}' (rule 194) + + '}' shift, and enter state 672 + + +State 582 + + sep__recordUpdate__','__ -> sep1__recordUpdate__','__ . (rule 371) + sep1__recordUpdate__','__ -> sep1__recordUpdate__','__ . ',' recordUpdate (rule 422) + + '}' reduce using rule 371 + ',' shift, and enter state 671 + + +State 583 + + sep1__recordUpdateOrLabel__','__ -> sep1__recordUpdateOrLabel__','__ ',' recordUpdateOrLabel . (rule 424) + + '}' reduce using rule 424 + ',' reduce using rule 424 + + +State 584 + + sep1__label__'.'__ -> sep1__label__'.'__ '.' label . (rule 418) + + error reduce using rule 418 + '(' reduce using rule 418 + ')' reduce using rule 418 + '{' reduce using rule 418 + '}' reduce using rule 418 + '[' reduce using rule 418 + ']' reduce using rule 418 + '\}' reduce using rule 418 + '\;' reduce using rule 418 + '<=' reduce using rule 418 + ':' reduce using rule 418 + '::' reduce using rule 418 + '|' reduce using rule 418 + '`' reduce using rule 418 + '.' reduce using rule 418 + ',' reduce using rule 418 + '_' reduce using rule 418 + '\\' reduce using rule 418 + '-' reduce using rule 418 + '@' reduce using rule 418 + 'ado' reduce using rule 418 + 'as' reduce using rule 418 + 'case' reduce using rule 418 + 'do' reduce using rule 418 + 'else' reduce using rule 418 + 'false' reduce using rule 418 + 'hiding' reduce using rule 418 + 'if' reduce using rule 418 + 'let' reduce using rule 418 + 'nominal' reduce using rule 418 + 'phantom' reduce using rule 418 + 'of' reduce using rule 418 + 'representational'reduce using rule 418 + 'role' reduce using rule 418 + 'then' reduce using rule 418 + 'true' reduce using rule 418 + 'where' reduce using rule 418 + '(..)' reduce using rule 418 + LOWER reduce using rule 418 + QUAL_LOWER reduce using rule 418 + UPPER reduce using rule 418 + QUAL_UPPER reduce using rule 418 + SYMBOL reduce using rule 418 + QUAL_SYMBOL reduce using rule 418 + OPERATOR reduce using rule 418 + QUAL_OPERATOR reduce using rule 418 + LIT_HOLE reduce using rule 418 + LIT_CHAR reduce using rule 418 + LIT_STRING reduce using rule 418 + LIT_RAW_STRING reduce using rule 418 + LIT_INT reduce using rule 418 + LIT_NUMBER reduce using rule 418 + %eof reduce using rule 418 + + +State 585 + + manySep1__caseBranch__'\;'__ -> caseBranch . (rule 388) + + '\}' reduce using rule 388 + '\;' reduce using rule 388 + + +State 586 + + binder1 -> binder1 . qualOp binder2 (rule 225) + sep1__binder1__','__ -> binder1 . (rule 401) + + '\}' reduce using rule 401 + '->' reduce using rule 401 + '<=' shift, and enter state 293 + ':' shift, and enter state 295 + '|' reduce using rule 401 + ',' reduce using rule 401 + '-' shift, and enter state 296 + OPERATOR shift, and enter state 297 + QUAL_OPERATOR shift, and enter state 298 + + qualOp goto state 351 + +State 587 + + expr5 -> 'case' sep__expr__','__ 'of' '\{' manySep__caseBranch__'\;'__ . '\}' (rule 168) + + '\}' shift, and enter state 670 + + +State 588 + + expr5 -> 'case' sep__expr__','__ 'of' '\{' sep__binder1__','__ . '->' '\}' exprWhere (rule 169) + expr5 -> 'case' sep__expr__','__ 'of' '\{' sep__binder1__','__ . '\}' guardedCase (rule 170) + caseBranch -> sep__binder1__','__ . guardedCase (rule 201) + + '\}' shift, and enter state 668 + '->' shift, and enter state 669 + '|' shift, and enter state 434 + + guardedCase goto state 663 + guardedCaseExprgoto state 664 + guard goto state 665 + many__guardedCaseExpr__goto state 666 + many1__guardedCaseExpr__goto state 667 + +State 589 + + manySep__caseBranch__'\;'__ -> manySep1__caseBranch__'\;'__ . (rule 356) + manySep1__caseBranch__'\;'__ -> manySep1__caseBranch__'\;'__ . '\;' caseBranch (rule 389) + + '\}' reduce using rule 356 + '\;' shift, and enter state 662 + + +State 590 + + sep__binder1__','__ -> sep1__binder1__','__ . (rule 361) + sep1__binder1__','__ -> sep1__binder1__','__ . ',' binder1 (rule 402) + + '\}' reduce using rule 361 + '->' reduce using rule 361 + '|' reduce using rule 361 + ',' shift, and enter state 661 + + +State 591 + + expr5 -> 'if' expr 'then' expr 'else' . expr (rule 163) + + '(' shift, and enter state 95 + '{' shift, and enter state 96 + '[' shift, and enter state 97 + '_' shift, and enter state 98 + '\\' shift, and enter state 99 + '-' shift, and enter state 100 + 'ado' shift, and enter state 101 + 'as' shift, and enter state 102 + 'case' shift, and enter state 103 + 'do' shift, and enter state 104 + 'false' shift, and enter state 46 + 'hiding' shift, and enter state 105 + 'if' shift, and enter state 106 + 'let' shift, and enter state 107 + 'nominal' shift, and enter state 108 + 'phantom' shift, and enter state 109 + 'representational'shift, and enter state 110 + 'role' shift, and enter state 111 + 'true' shift, and enter state 52 + '(..)' shift, and enter state 112 + LOWER shift, and enter state 113 + QUAL_LOWER shift, and enter state 114 + UPPER shift, and enter state 54 + QUAL_UPPER shift, and enter state 55 + SYMBOL shift, and enter state 115 + QUAL_SYMBOL shift, and enter state 116 + LIT_HOLE shift, and enter state 117 + LIT_CHAR shift, and enter state 56 + LIT_STRING shift, and enter state 57 + LIT_RAW_STRING shift, and enter state 58 + LIT_INT shift, and enter state 59 + LIT_NUMBER shift, and enter state 60 + + qualProperName goto state 74 + qualIdent goto state 75 + qualSymbol goto state 76 + hole goto state 77 + string goto state 78 + char goto state 79 + number goto state 80 + boolean goto state 81 + expr goto state 660 + expr1 goto state 122 + expr2 goto state 83 + expr3 goto state 84 + expr4 goto state 85 + expr5 goto state 86 + expr6 goto state 87 + expr7 goto state 88 + exprAtom goto state 89 + doBlock goto state 90 + adoBlock goto state 91 + delim__'['__expr__','__']'__goto state 93 + delim__'{'__recordLabel__','__'}'__goto state 94 + +State 592 + + letBinding -> ident '::' type . (rule 197) + + '\}' reduce using rule 197 + '\;' reduce using rule 197 + + +State 593 + + letBinding -> ident many__binderAtom__ guardedDecl . (rule 199) + + '\}' reduce using rule 199 + '\;' reduce using rule 199 + + +State 594 + + letBinding -> binder1 '=' exprWhere . (rule 200) + + '\}' reduce using rule 200 + '\;' reduce using rule 200 + + +State 595 + + expr5 -> 'let' '\{' manySep__letBinding__'\;'__ '\}' 'in' . expr (rule 167) + + '(' shift, and enter state 95 + '{' shift, and enter state 96 + '[' shift, and enter state 97 + '_' shift, and enter state 98 + '\\' shift, and enter state 99 + '-' shift, and enter state 100 + 'ado' shift, and enter state 101 + 'as' shift, and enter state 102 + 'case' shift, and enter state 103 + 'do' shift, and enter state 104 + 'false' shift, and enter state 46 + 'hiding' shift, and enter state 105 + 'if' shift, and enter state 106 + 'let' shift, and enter state 107 + 'nominal' shift, and enter state 108 + 'phantom' shift, and enter state 109 + 'representational'shift, and enter state 110 + 'role' shift, and enter state 111 + 'true' shift, and enter state 52 + '(..)' shift, and enter state 112 + LOWER shift, and enter state 113 + QUAL_LOWER shift, and enter state 114 + UPPER shift, and enter state 54 + QUAL_UPPER shift, and enter state 55 + SYMBOL shift, and enter state 115 + QUAL_SYMBOL shift, and enter state 116 + LIT_HOLE shift, and enter state 117 + LIT_CHAR shift, and enter state 56 + LIT_STRING shift, and enter state 57 + LIT_RAW_STRING shift, and enter state 58 + LIT_INT shift, and enter state 59 + LIT_NUMBER shift, and enter state 60 + + qualProperName goto state 74 + qualIdent goto state 75 + qualSymbol goto state 76 + hole goto state 77 + string goto state 78 + char goto state 79 + number goto state 80 + boolean goto state 81 + expr goto state 659 + expr1 goto state 122 + expr2 goto state 83 + expr3 goto state 84 + expr4 goto state 85 + expr5 goto state 86 + expr6 goto state 87 + expr7 goto state 88 + exprAtom goto state 89 + doBlock goto state 90 + adoBlock goto state 91 + delim__'['__expr__','__']'__goto state 93 + delim__'{'__recordLabel__','__'}'__goto state 94 + +State 596 + + manySep1__letBinding__'\;'__ -> manySep1__letBinding__'\;'__ '\;' letBinding . (rule 395) + + '\}' reduce using rule 395 + '\;' reduce using rule 395 + + +State 597 + + moduleHeader -> 'module' moduleName exports 'where' '\{' . moduleImports (rule 242) + + error reduce using rule 247 + 'import' reduce using rule 247 + + moduleImports goto state 657 + importDecls goto state 658 + +State 598 + + export -> 'type' symbol . (rule 260) + + ')' reduce using rule 260 + ',' reduce using rule 260 + + +State 599 + + export -> 'module' moduleName . (rule 262) + + ')' reduce using rule 262 + ',' reduce using rule 262 + + +State 600 + + export -> 'class' properName . (rule 261) + + ')' reduce using rule 261 + ',' reduce using rule 261 + + +State 601 + + sep1__export__','__ -> sep1__export__','__ ',' . export (rule 410) + + 'as' shift, and enter state 45 + 'class' shift, and enter state 533 + 'hiding' shift, and enter state 47 + 'module' shift, and enter state 534 + 'nominal' shift, and enter state 48 + 'phantom' shift, and enter state 49 + 'representational'shift, and enter state 50 + 'role' shift, and enter state 51 + 'type' shift, and enter state 535 + '(..)' shift, and enter state 479 + LOWER shift, and enter state 53 + UPPER shift, and enter state 63 + SYMBOL shift, and enter state 480 + + properName goto state 527 + ident goto state 528 + symbol goto state 529 + export goto state 656 + +State 602 + + exports -> '(' sep__export__','__ ')' . (rule 255) + + 'where' reduce using rule 255 + + +State 603 + + export -> properName dataMembers . (rule 259) + + ')' reduce using rule 259 + ',' reduce using rule 259 + + +State 604 + + dataMembers -> '(' . ')' (rule 264) + dataMembers -> '(' . sep__properName__','__ ')' (rule 265) + + ')' shift, and enter state 655 + UPPER shift, and enter state 63 + + properName goto state 652 + sep__properName__','__goto state 653 + sep1__properName__','__goto state 654 + +State 605 + + dataMembers -> '(..)' . (rule 263) + + ')' reduce using rule 263 + ',' reduce using rule 263 + + +State 606 + + typeVarBinding -> '(' ident '::' type . ')' (rule 141) + + ')' shift, and enter state 651 + + +State 607 + + typeVarBinding -> '(' '@' ident '::' . type ')' (rule 142) + + '(' shift, and enter state 148 + '{' shift, and enter state 149 + '_' shift, and enter state 150 + '-' shift, and enter state 151 + 'as' shift, and enter state 45 + 'forall' shift, and enter state 152 + 'forallu' shift, and enter state 153 + 'hiding' shift, and enter state 47 + 'nominal' shift, and enter state 48 + 'phantom' shift, and enter state 49 + 'representational'shift, and enter state 50 + 'role' shift, and enter state 51 + '(->)' shift, and enter state 154 + '(..)' shift, and enter state 112 + LOWER shift, and enter state 53 + UPPER shift, and enter state 54 + QUAL_UPPER shift, and enter state 55 + SYMBOL shift, and enter state 115 + QUAL_SYMBOL shift, and enter state 116 + LIT_HOLE shift, and enter state 117 + LIT_STRING shift, and enter state 57 + LIT_RAW_STRING shift, and enter state 58 + LIT_INT shift, and enter state 155 + + qualProperName goto state 133 + ident goto state 134 + qualSymbol goto state 135 + hole goto state 136 + string goto state 137 + int goto state 138 + type goto state 650 + type1 goto state 140 + type2 goto state 141 + type3 goto state 142 + type4 goto state 143 + type5 goto state 144 + typeAtom goto state 145 + forall goto state 146 + +State 608 + + typeAtom -> '(' typeKindedAtom '::' type . ')' (rule 124) + typeKindedAtom -> '(' typeKindedAtom '::' type . ')' (rule 133) + + ')' shift, and enter state 649 + + +State 609 + + typeAtom -> '(' typeKindedAtom '::' type ')' . (rule 124) + + error reduce using rule 124 + '(' reduce using rule 124 + ')' reduce using rule 124 + '{' reduce using rule 124 + '}' reduce using rule 124 + '[' reduce using rule 124 + ']' reduce using rule 124 + '\}' reduce using rule 124 + '\;' reduce using rule 124 + '<-' reduce using rule 124 + '->' reduce using rule 124 + '<=' reduce using rule 124 + '=>' reduce using rule 124 + ':' reduce using rule 124 + '::' reduce using rule 124 + '|' reduce using rule 124 + '`' reduce using rule 124 + ',' reduce using rule 124 + '_' reduce using rule 124 + '\\' reduce using rule 124 + '-' reduce using rule 124 + '@' reduce using rule 124 + 'ado' reduce using rule 124 + 'as' reduce using rule 124 + 'case' reduce using rule 124 + 'do' reduce using rule 124 + 'else' reduce using rule 124 + 'false' reduce using rule 124 + 'hiding' reduce using rule 124 + 'if' reduce using rule 124 + 'let' reduce using rule 124 + 'nominal' reduce using rule 124 + 'phantom' reduce using rule 124 + 'of' reduce using rule 124 + 'representational'reduce using rule 124 + 'role' reduce using rule 124 + 'then' reduce using rule 124 + 'true' reduce using rule 124 + 'where' reduce using rule 124 + '(->)' reduce using rule 124 + '(..)' reduce using rule 124 + LOWER reduce using rule 124 + QUAL_LOWER reduce using rule 124 + UPPER reduce using rule 124 + QUAL_UPPER reduce using rule 124 + SYMBOL reduce using rule 124 + QUAL_SYMBOL reduce using rule 124 + OPERATOR reduce using rule 124 + QUAL_OPERATOR reduce using rule 124 + LIT_HOLE reduce using rule 124 + LIT_CHAR reduce using rule 124 + LIT_STRING reduce using rule 124 + LIT_RAW_STRING reduce using rule 124 + LIT_INT reduce using rule 124 + LIT_NUMBER reduce using rule 124 + %eof reduce using rule 124 + + +State 610 + + guardedDeclExpr -> guard '=' exprWhere . (rule 204) + + error reduce using rule 204 + '\}' reduce using rule 204 + '\;' reduce using rule 204 + '|' reduce using rule 204 + 'else' reduce using rule 204 + %eof reduce using rule 204 + + +State 611 + + exprWhere -> expr 'where' . '\{' manySep__letBinding__'\;'__ '\}' (rule 148) + + '\{' shift, and enter state 648 + + +State 612 + + sep1__dataCtor__'|'__ -> sep1__dataCtor__'|'__ '|' dataCtor . (rule 406) + + error reduce using rule 406 + '\}' reduce using rule 406 + '\;' reduce using rule 406 + '|' reduce using rule 406 + 'else' reduce using rule 406 + %eof reduce using rule 406 + + +State 613 + + manySep1__classMember__'\;'__ -> manySep1__classMember__'\;'__ '\;' . classMember (rule 391) + + 'as' shift, and enter state 45 + 'hiding' shift, and enter state 47 + 'nominal' shift, and enter state 48 + 'phantom' shift, and enter state 49 + 'representational'shift, and enter state 50 + 'role' shift, and enter state 51 + LOWER shift, and enter state 53 + + ident goto state 505 + classMember goto state 647 + +State 614 + + decl -> classHead 'where' '\{' manySep__classMember__'\;'__ '\}' . (rule 282) + + error reduce using rule 282 + '\}' reduce using rule 282 + '\;' reduce using rule 282 + 'else' reduce using rule 282 + %eof reduce using rule 282 + + +State 615 + + classMember -> ident '::' . type (rule 308) + + '(' shift, and enter state 148 + '{' shift, and enter state 149 + '_' shift, and enter state 150 + '-' shift, and enter state 151 + 'as' shift, and enter state 45 + 'forall' shift, and enter state 152 + 'forallu' shift, and enter state 153 + 'hiding' shift, and enter state 47 + 'nominal' shift, and enter state 48 + 'phantom' shift, and enter state 49 + 'representational'shift, and enter state 50 + 'role' shift, and enter state 51 + '(->)' shift, and enter state 154 + '(..)' shift, and enter state 112 + LOWER shift, and enter state 53 + UPPER shift, and enter state 54 + QUAL_UPPER shift, and enter state 55 + SYMBOL shift, and enter state 115 + QUAL_SYMBOL shift, and enter state 116 + LIT_HOLE shift, and enter state 117 + LIT_STRING shift, and enter state 57 + LIT_RAW_STRING shift, and enter state 58 + LIT_INT shift, and enter state 155 + + qualProperName goto state 133 + ident goto state 134 + qualSymbol goto state 135 + hole goto state 136 + string goto state 137 + int goto state 138 + type goto state 646 + type1 goto state 140 + type2 goto state 141 + type3 goto state 142 + type4 goto state 143 + type5 goto state 144 + typeAtom goto state 145 + forall goto state 146 + +State 616 + + manySep1__instBinding__'\;'__ -> manySep1__instBinding__'\;'__ '\;' . instBinding (rule 393) + + 'as' shift, and enter state 45 + 'hiding' shift, and enter state 47 + 'nominal' shift, and enter state 48 + 'phantom' shift, and enter state 49 + 'representational'shift, and enter state 50 + 'role' shift, and enter state 51 + LOWER shift, and enter state 53 + + ident goto state 501 + instBinding goto state 645 + +State 617 + + decl -> instHead 'where' '\{' manySep__instBinding__'\;'__ '\}' . (rule 284) + + error reduce using rule 284 + '\}' reduce using rule 284 + '\;' reduce using rule 284 + 'else' reduce using rule 284 + %eof reduce using rule 284 + + +State 618 + + instBinding -> ident manyOrEmpty__binderAtom__ . guardedDecl (rule 318) + + '=' shift, and enter state 433 + '|' shift, and enter state 434 + + guardedDecl goto state 644 + guardedDeclExprgoto state 429 + guard goto state 430 + many__guardedDeclExpr__goto state 431 + many1__guardedDeclExpr__goto state 432 + +State 619 + + instBinding -> ident '::' . type (rule 317) + + '(' shift, and enter state 148 + '{' shift, and enter state 149 + '_' shift, and enter state 150 + '-' shift, and enter state 151 + 'as' shift, and enter state 45 + 'forall' shift, and enter state 152 + 'forallu' shift, and enter state 153 + 'hiding' shift, and enter state 47 + 'nominal' shift, and enter state 48 + 'phantom' shift, and enter state 49 + 'representational'shift, and enter state 50 + 'role' shift, and enter state 51 + '(->)' shift, and enter state 154 + '(..)' shift, and enter state 112 + LOWER shift, and enter state 53 + UPPER shift, and enter state 54 + QUAL_UPPER shift, and enter state 55 + SYMBOL shift, and enter state 115 + QUAL_SYMBOL shift, and enter state 116 + LIT_HOLE shift, and enter state 117 + LIT_STRING shift, and enter state 57 + LIT_RAW_STRING shift, and enter state 58 + LIT_INT shift, and enter state 155 + + qualProperName goto state 133 + ident goto state 134 + qualSymbol goto state 135 + hole goto state 136 + string goto state 137 + int goto state 138 + type goto state 643 + type1 goto state 140 + type2 goto state 141 + type3 goto state 142 + type4 goto state 143 + type5 goto state 144 + typeAtom goto state 145 + forall goto state 146 + +State 620 + + fixity -> infix int qualProperName 'as' op . (rule 320) + + error reduce using rule 320 + '\}' reduce using rule 320 + '\;' reduce using rule 320 + 'else' reduce using rule 320 + %eof reduce using rule 320 + + +State 621 + + fixity -> infix int qualIdent 'as' op . (rule 319) + + error reduce using rule 319 + '\}' reduce using rule 319 + '\;' reduce using rule 319 + 'else' reduce using rule 319 + %eof reduce using rule 319 + + +State 622 + + fixity -> infix int 'type' qualProperName 'as' . op (rule 321) + + '<=' shift, and enter state 192 + ':' shift, and enter state 193 + '-' shift, and enter state 194 + OPERATOR shift, and enter state 195 + + op goto state 642 + +State 623 + + typeVarBindingPlain -> '(' ident '::' . type ')' (rule 144) + + '(' shift, and enter state 148 + '{' shift, and enter state 149 + '_' shift, and enter state 150 + '-' shift, and enter state 151 + 'as' shift, and enter state 45 + 'forall' shift, and enter state 152 + 'forallu' shift, and enter state 153 + 'hiding' shift, and enter state 47 + 'nominal' shift, and enter state 48 + 'phantom' shift, and enter state 49 + 'representational'shift, and enter state 50 + 'role' shift, and enter state 51 + '(->)' shift, and enter state 154 + '(..)' shift, and enter state 112 + LOWER shift, and enter state 53 + UPPER shift, and enter state 54 + QUAL_UPPER shift, and enter state 55 + SYMBOL shift, and enter state 115 + QUAL_SYMBOL shift, and enter state 116 + LIT_HOLE shift, and enter state 117 + LIT_STRING shift, and enter state 57 + LIT_RAW_STRING shift, and enter state 58 + LIT_INT shift, and enter state 155 + + qualProperName goto state 133 + ident goto state 134 + qualSymbol goto state 135 + hole goto state 136 + string goto state 137 + int goto state 138 + type goto state 641 + type1 goto state 140 + type2 goto state 141 + type3 goto state 142 + type4 goto state 143 + type5 goto state 144 + typeAtom goto state 145 + forall goto state 146 + +State 624 + + decl -> 'foreign' 'import' ident '::' type . (rule 293) + + error reduce using rule 293 + '\}' reduce using rule 293 + '\;' reduce using rule 293 + 'else' reduce using rule 293 + %eof reduce using rule 293 + + +State 625 + + decl -> 'foreign' 'import' 'data' properName '::' . type (rule 294) + + '(' shift, and enter state 148 + '{' shift, and enter state 149 + '_' shift, and enter state 150 + '-' shift, and enter state 151 + 'as' shift, and enter state 45 + 'forall' shift, and enter state 152 + 'forallu' shift, and enter state 153 + 'hiding' shift, and enter state 47 + 'nominal' shift, and enter state 48 + 'phantom' shift, and enter state 49 + 'representational'shift, and enter state 50 + 'role' shift, and enter state 51 + '(->)' shift, and enter state 154 + '(..)' shift, and enter state 112 + LOWER shift, and enter state 53 + UPPER shift, and enter state 54 + QUAL_UPPER shift, and enter state 55 + SYMBOL shift, and enter state 115 + QUAL_SYMBOL shift, and enter state 116 + LIT_HOLE shift, and enter state 117 + LIT_STRING shift, and enter state 57 + LIT_RAW_STRING shift, and enter state 58 + LIT_INT shift, and enter state 155 + + qualProperName goto state 133 + ident goto state 134 + qualSymbol goto state 135 + hole goto state 136 + string goto state 137 + int goto state 138 + type goto state 640 + type1 goto state 140 + type2 goto state 141 + type3 goto state 142 + type4 goto state 143 + type5 goto state 144 + typeAtom goto state 145 + forall goto state 146 + +State 626 + + instHead -> 'instance' constraints '=>' qualProperName manyOrEmpty__typeAtom__ . (rule 309) + + error reduce using rule 309 + '\}' reduce using rule 309 + '\;' reduce using rule 309 + 'else' reduce using rule 309 + 'where' reduce using rule 309 + %eof reduce using rule 309 + + +State 627 + + instHead -> 'instance' ident '::' constraints '=>' . qualProperName manyOrEmpty__typeAtom__ (rule 311) + + UPPER shift, and enter state 54 + QUAL_UPPER shift, and enter state 55 + + qualProperName goto state 639 + +State 628 + + instHead -> 'instance' ident '::' qualProperName manyOrEmpty__typeAtom__ . (rule 312) + constraint -> qualProperName manyOrEmpty__typeAtom__ . (rule 315) + + error reduce using rule 312 + '\}' reduce using rule 312 + '\;' reduce using rule 312 + '=>' reduce using rule 315 + 'else' reduce using rule 312 + 'where' reduce using rule 312 + %eof reduce using rule 312 + + +State 629 + + many1__role__ -> many1__role__ role . (rule 385) + + error reduce using rule 385 + '\}' reduce using rule 385 + '\;' reduce using rule 385 + 'else' reduce using rule 385 + 'nominal' reduce using rule 385 + 'phantom' reduce using rule 385 + 'representational'reduce using rule 385 + %eof reduce using rule 385 + + +State 630 + + importDecl -> 'import' moduleName imports 'as' moduleName . (rule 267) + + error reduce using rule 267 + '\}' reduce using rule 267 + '\;' reduce using rule 267 + + +State 631 + + import -> 'type' symbol . (rule 275) + + ')' reduce using rule 275 + ',' reduce using rule 275 + + +State 632 + + import -> 'class' properName . (rule 276) + + ')' reduce using rule 276 + ',' reduce using rule 276 + + +State 633 + + sep1__import__','__ -> sep1__import__','__ ',' . import (rule 416) + + 'as' shift, and enter state 45 + 'class' shift, and enter state 477 + 'hiding' shift, and enter state 47 + 'nominal' shift, and enter state 48 + 'phantom' shift, and enter state 49 + 'representational'shift, and enter state 50 + 'role' shift, and enter state 51 + 'type' shift, and enter state 478 + '(..)' shift, and enter state 479 + LOWER shift, and enter state 53 + UPPER shift, and enter state 63 + SYMBOL shift, and enter state 480 + + properName goto state 471 + ident goto state 472 + symbol goto state 473 + import goto state 638 + +State 634 + + imports -> '(' sep__import__','__ ')' . (rule 269) + + error reduce using rule 269 + '\}' reduce using rule 269 + '\;' reduce using rule 269 + 'as' reduce using rule 269 + + +State 635 + + import -> properName dataMembers . (rule 274) + + ')' reduce using rule 274 + ',' reduce using rule 274 + + +State 636 + + imports -> 'hiding' '(' sep__import__','__ . ')' (rule 270) + + ')' shift, and enter state 637 + + +State 637 + + imports -> 'hiding' '(' sep__import__','__ ')' . (rule 270) + + error reduce using rule 270 + '\}' reduce using rule 270 + '\;' reduce using rule 270 + 'as' reduce using rule 270 + + +State 638 + + sep1__import__','__ -> sep1__import__','__ ',' import . (rule 416) + + ')' reduce using rule 416 + ',' reduce using rule 416 + + +State 639 + + instHead -> 'instance' ident '::' constraints '=>' qualProperName . manyOrEmpty__typeAtom__ (rule 311) + + error reduce using rule 350 + '(' shift, and enter state 148 + '{' shift, and enter state 149 + '\}' reduce using rule 350 + '\;' reduce using rule 350 + '_' shift, and enter state 150 + 'as' shift, and enter state 45 + 'else' reduce using rule 350 + 'hiding' shift, and enter state 47 + 'nominal' shift, and enter state 48 + 'phantom' shift, and enter state 49 + 'representational'shift, and enter state 50 + 'role' shift, and enter state 51 + 'where' reduce using rule 350 + '(->)' shift, and enter state 154 + '(..)' shift, and enter state 112 + LOWER shift, and enter state 53 + UPPER shift, and enter state 54 + QUAL_UPPER shift, and enter state 55 + SYMBOL shift, and enter state 115 + QUAL_SYMBOL shift, and enter state 116 + LIT_HOLE shift, and enter state 117 + LIT_STRING shift, and enter state 57 + LIT_RAW_STRING shift, and enter state 58 + LIT_INT shift, and enter state 155 + %eof reduce using rule 350 + + qualProperName goto state 133 + ident goto state 134 + qualSymbol goto state 135 + hole goto state 136 + string goto state 137 + int goto state 138 + typeAtom goto state 333 + manyOrEmpty__typeAtom__goto state 695 + many__typeAtom__goto state 335 + many1__typeAtom__goto state 336 + +State 640 + + decl -> 'foreign' 'import' 'data' properName '::' type . (rule 294) + + error reduce using rule 294 + '\}' reduce using rule 294 + '\;' reduce using rule 294 + 'else' reduce using rule 294 + %eof reduce using rule 294 + + +State 641 + + typeVarBindingPlain -> '(' ident '::' type . ')' (rule 144) + + ')' shift, and enter state 694 + + +State 642 + + fixity -> infix int 'type' qualProperName 'as' op . (rule 321) + + error reduce using rule 321 + '\}' reduce using rule 321 + '\;' reduce using rule 321 + 'else' reduce using rule 321 + %eof reduce using rule 321 + + +State 643 + + instBinding -> ident '::' type . (rule 317) + + '\}' reduce using rule 317 + '\;' reduce using rule 317 + + +State 644 + + instBinding -> ident manyOrEmpty__binderAtom__ guardedDecl . (rule 318) + + '\}' reduce using rule 318 + '\;' reduce using rule 318 + + +State 645 + + manySep1__instBinding__'\;'__ -> manySep1__instBinding__'\;'__ '\;' instBinding . (rule 393) + + '\}' reduce using rule 393 + '\;' reduce using rule 393 + + +State 646 + + classMember -> ident '::' type . (rule 308) + + '\}' reduce using rule 308 + '\;' reduce using rule 308 + + +State 647 + + manySep1__classMember__'\;'__ -> manySep1__classMember__'\;'__ '\;' classMember . (rule 391) + + '\}' reduce using rule 391 + '\;' reduce using rule 391 + + +State 648 + + exprWhere -> expr 'where' '\{' . manySep__letBinding__'\;'__ '\}' (rule 148) + + '(' shift, and enter state 40 + '{' shift, and enter state 41 + '[' shift, and enter state 42 + '_' shift, and enter state 43 + '-' shift, and enter state 44 + 'as' shift, and enter state 45 + 'false' shift, and enter state 46 + 'hiding' shift, and enter state 47 + 'nominal' shift, and enter state 48 + 'phantom' shift, and enter state 49 + 'representational'shift, and enter state 50 + 'role' shift, and enter state 51 + 'true' shift, and enter state 52 + LOWER shift, and enter state 53 + UPPER shift, and enter state 54 + QUAL_UPPER shift, and enter state 55 + LIT_CHAR shift, and enter state 56 + LIT_STRING shift, and enter state 57 + LIT_RAW_STRING shift, and enter state 58 + LIT_INT shift, and enter state 59 + LIT_NUMBER shift, and enter state 60 + + qualProperName goto state 25 + ident goto state 396 + string goto state 27 + char goto state 28 + number goto state 29 + boolean goto state 30 + letBinding goto state 397 + binder1 goto state 398 + binder2 goto state 34 + binderAtom goto state 35 + delim__'['__binder__','__']'__goto state 36 + delim__'{'__recordBinder__','__'}'__goto state 37 + many__binderAtom__goto state 38 + manySep__letBinding__'\;'__goto state 693 + many1__binderAtom__goto state 39 + manySep1__letBinding__'\;'__goto state 400 + +State 649 + + typeAtom -> '(' typeKindedAtom '::' type ')' . (rule 124) + typeKindedAtom -> '(' typeKindedAtom '::' type ')' . (rule 133) + + '(' reduce using rule 124 + ')' reduce using rule 124 + '{' reduce using rule 124 + '->' reduce using rule 124 + '<=' reduce using rule 124 + '=>' reduce using rule 124 + ':' reduce using rule 124 + '::' reduce using rule 133 + '_' reduce using rule 124 + '-' reduce using rule 124 + 'as' reduce using rule 124 + 'hiding' reduce using rule 124 + 'nominal' reduce using rule 124 + 'phantom' reduce using rule 124 + 'representational'reduce using rule 124 + 'role' reduce using rule 124 + '(->)' reduce using rule 124 + '(..)' reduce using rule 124 + LOWER reduce using rule 124 + UPPER reduce using rule 124 + QUAL_UPPER reduce using rule 124 + SYMBOL reduce using rule 124 + QUAL_SYMBOL reduce using rule 124 + OPERATOR reduce using rule 124 + QUAL_OPERATOR reduce using rule 124 + LIT_HOLE reduce using rule 124 + LIT_STRING reduce using rule 124 + LIT_RAW_STRING reduce using rule 124 + LIT_INT reduce using rule 124 + + +State 650 + + typeVarBinding -> '(' '@' ident '::' type . ')' (rule 142) + + ')' shift, and enter state 692 + + +State 651 + + typeVarBinding -> '(' ident '::' type ')' . (rule 141) + + error reduce using rule 141 + '(' reduce using rule 141 + '|' reduce using rule 141 + '.' reduce using rule 141 + '@' reduce using rule 141 + 'as' reduce using rule 141 + 'hiding' reduce using rule 141 + 'nominal' reduce using rule 141 + 'phantom' reduce using rule 141 + 'representational'reduce using rule 141 + 'role' reduce using rule 141 + LOWER reduce using rule 141 + + +State 652 + + sep1__properName__','__ -> properName . (rule 419) + + ')' reduce using rule 419 + ',' reduce using rule 419 + + +State 653 + + dataMembers -> '(' sep__properName__','__ . ')' (rule 265) + + ')' shift, and enter state 691 + + +State 654 + + sep__properName__','__ -> sep1__properName__','__ . (rule 370) + sep1__properName__','__ -> sep1__properName__','__ . ',' properName (rule 420) + + ')' reduce using rule 370 + ',' shift, and enter state 690 + + +State 655 + + dataMembers -> '(' ')' . (rule 264) + + ')' reduce using rule 264 + ',' reduce using rule 264 + + +State 656 + + sep1__export__','__ -> sep1__export__','__ ',' export . (rule 410) + + ')' reduce using rule 410 + ',' reduce using rule 410 + + +State 657 + + moduleHeader -> 'module' moduleName exports 'where' '\{' moduleImports . (rule 242) + + error reduce using rule 242 + + +State 658 + + moduleImports -> importDecls . importDecl '\}' (rule 244) + moduleImports -> importDecls . (rule 245) + importDecls -> importDecls . importDecl '\;' (rule 246) + + error reduce using rule 245 + 'import' shift, and enter state 180 + + importDecl goto state 689 + +State 659 + + expr5 -> 'let' '\{' manySep__letBinding__'\;'__ '\}' 'in' expr . (rule 167) + + error reduce using rule 167 + '(' reduce using rule 167 + ')' reduce using rule 167 + '{' reduce using rule 167 + '}' reduce using rule 167 + '[' reduce using rule 167 + ']' reduce using rule 167 + '\}' reduce using rule 167 + '\;' reduce using rule 167 + '<=' reduce using rule 167 + ':' reduce using rule 167 + '::' reduce using rule 167 + '|' reduce using rule 167 + '`' reduce using rule 167 + ',' reduce using rule 167 + '_' reduce using rule 167 + '\\' reduce using rule 167 + '-' reduce using rule 167 + '@' reduce using rule 167 + 'ado' reduce using rule 167 + 'as' reduce using rule 167 + 'case' reduce using rule 167 + 'do' reduce using rule 167 + 'else' reduce using rule 167 + 'false' reduce using rule 167 + 'hiding' reduce using rule 167 + 'if' reduce using rule 167 + 'let' reduce using rule 167 + 'nominal' reduce using rule 167 + 'phantom' reduce using rule 167 + 'of' reduce using rule 167 + 'representational'reduce using rule 167 + 'role' reduce using rule 167 + 'then' reduce using rule 167 + 'true' reduce using rule 167 + 'where' reduce using rule 167 + '(..)' reduce using rule 167 + LOWER reduce using rule 167 + QUAL_LOWER reduce using rule 167 + UPPER reduce using rule 167 + QUAL_UPPER reduce using rule 167 + SYMBOL reduce using rule 167 + QUAL_SYMBOL reduce using rule 167 + OPERATOR reduce using rule 167 + QUAL_OPERATOR reduce using rule 167 + LIT_HOLE reduce using rule 167 + LIT_CHAR reduce using rule 167 + LIT_STRING reduce using rule 167 + LIT_RAW_STRING reduce using rule 167 + LIT_INT reduce using rule 167 + LIT_NUMBER reduce using rule 167 + %eof reduce using rule 167 + + +State 660 + + expr5 -> 'if' expr 'then' expr 'else' expr . (rule 163) + + error reduce using rule 163 + '(' reduce using rule 163 + ')' reduce using rule 163 + '{' reduce using rule 163 + '}' reduce using rule 163 + '[' reduce using rule 163 + ']' reduce using rule 163 + '\}' reduce using rule 163 + '\;' reduce using rule 163 + '<=' reduce using rule 163 + ':' reduce using rule 163 + '::' reduce using rule 163 + '|' reduce using rule 163 + '`' reduce using rule 163 + ',' reduce using rule 163 + '_' reduce using rule 163 + '\\' reduce using rule 163 + '-' reduce using rule 163 + '@' reduce using rule 163 + 'ado' reduce using rule 163 + 'as' reduce using rule 163 + 'case' reduce using rule 163 + 'do' reduce using rule 163 + 'else' reduce using rule 163 + 'false' reduce using rule 163 + 'hiding' reduce using rule 163 + 'if' reduce using rule 163 + 'let' reduce using rule 163 + 'nominal' reduce using rule 163 + 'phantom' reduce using rule 163 + 'of' reduce using rule 163 + 'representational'reduce using rule 163 + 'role' reduce using rule 163 + 'then' reduce using rule 163 + 'true' reduce using rule 163 + 'where' reduce using rule 163 + '(..)' reduce using rule 163 + LOWER reduce using rule 163 + QUAL_LOWER reduce using rule 163 + UPPER reduce using rule 163 + QUAL_UPPER reduce using rule 163 + SYMBOL reduce using rule 163 + QUAL_SYMBOL reduce using rule 163 + OPERATOR reduce using rule 163 + QUAL_OPERATOR reduce using rule 163 + LIT_HOLE reduce using rule 163 + LIT_CHAR reduce using rule 163 + LIT_STRING reduce using rule 163 + LIT_RAW_STRING reduce using rule 163 + LIT_INT reduce using rule 163 + LIT_NUMBER reduce using rule 163 + %eof reduce using rule 163 + + +State 661 + + sep1__binder1__','__ -> sep1__binder1__','__ ',' . binder1 (rule 402) + + '(' shift, and enter state 40 + '{' shift, and enter state 41 + '[' shift, and enter state 42 + '_' shift, and enter state 43 + '-' shift, and enter state 44 + 'as' shift, and enter state 45 + 'false' shift, and enter state 46 + 'hiding' shift, and enter state 47 + 'nominal' shift, and enter state 48 + 'phantom' shift, and enter state 49 + 'representational'shift, and enter state 50 + 'role' shift, and enter state 51 + 'true' shift, and enter state 52 + LOWER shift, and enter state 53 + UPPER shift, and enter state 54 + QUAL_UPPER shift, and enter state 55 + LIT_CHAR shift, and enter state 56 + LIT_STRING shift, and enter state 57 + LIT_RAW_STRING shift, and enter state 58 + LIT_INT shift, and enter state 59 + LIT_NUMBER shift, and enter state 60 + + qualProperName goto state 25 + ident goto state 26 + string goto state 27 + char goto state 28 + number goto state 29 + boolean goto state 30 + binder1 goto state 688 + binder2 goto state 34 + binderAtom goto state 35 + delim__'['__binder__','__']'__goto state 36 + delim__'{'__recordBinder__','__'}'__goto state 37 + many__binderAtom__goto state 38 + many1__binderAtom__goto state 39 + +State 662 + + manySep1__caseBranch__'\;'__ -> manySep1__caseBranch__'\;'__ '\;' . caseBranch (rule 389) + + '(' shift, and enter state 40 + '{' shift, and enter state 41 + '[' shift, and enter state 42 + '_' shift, and enter state 43 + '-' shift, and enter state 44 + 'as' shift, and enter state 45 + 'false' shift, and enter state 46 + 'hiding' shift, and enter state 47 + 'nominal' shift, and enter state 48 + 'phantom' shift, and enter state 49 + 'representational'shift, and enter state 50 + 'role' shift, and enter state 51 + 'true' shift, and enter state 52 + LOWER shift, and enter state 53 + UPPER shift, and enter state 54 + QUAL_UPPER shift, and enter state 55 + LIT_CHAR shift, and enter state 56 + LIT_STRING shift, and enter state 57 + LIT_RAW_STRING shift, and enter state 58 + LIT_INT shift, and enter state 59 + LIT_NUMBER shift, and enter state 60 + + qualProperName goto state 25 + ident goto state 26 + string goto state 27 + char goto state 28 + number goto state 29 + boolean goto state 30 + caseBranch goto state 686 + binder1 goto state 586 + binder2 goto state 34 + binderAtom goto state 35 + delim__'['__binder__','__']'__goto state 36 + delim__'{'__recordBinder__','__'}'__goto state 37 + many__binderAtom__goto state 38 + sep__binder1__','__goto state 687 + many1__binderAtom__goto state 39 + sep1__binder1__','__goto state 590 + +State 663 + + caseBranch -> sep__binder1__','__ guardedCase . (rule 201) + + '\}' reduce using rule 201 + '\;' reduce using rule 201 + + +State 664 + + many1__guardedCaseExpr__ -> guardedCaseExpr . (rule 378) + + error reduce using rule 378 + '(' reduce using rule 378 + ')' reduce using rule 378 + '{' reduce using rule 378 + '}' reduce using rule 378 + '[' reduce using rule 378 + ']' reduce using rule 378 + '\}' reduce using rule 378 + '\;' reduce using rule 378 + '<=' reduce using rule 378 + ':' reduce using rule 378 + '::' reduce using rule 378 + '|' reduce using rule 378 + '`' reduce using rule 378 + ',' reduce using rule 378 + '_' reduce using rule 378 + '\\' reduce using rule 378 + '-' reduce using rule 378 + '@' reduce using rule 378 + 'ado' reduce using rule 378 + 'as' reduce using rule 378 + 'case' reduce using rule 378 + 'do' reduce using rule 378 + 'else' reduce using rule 378 + 'false' reduce using rule 378 + 'hiding' reduce using rule 378 + 'if' reduce using rule 378 + 'let' reduce using rule 378 + 'nominal' reduce using rule 378 + 'phantom' reduce using rule 378 + 'of' reduce using rule 378 + 'representational'reduce using rule 378 + 'role' reduce using rule 378 + 'then' reduce using rule 378 + 'true' reduce using rule 378 + 'where' reduce using rule 378 + '(..)' reduce using rule 378 + LOWER reduce using rule 378 + QUAL_LOWER reduce using rule 378 + UPPER reduce using rule 378 + QUAL_UPPER reduce using rule 378 + SYMBOL reduce using rule 378 + QUAL_SYMBOL reduce using rule 378 + OPERATOR reduce using rule 378 + QUAL_OPERATOR reduce using rule 378 + LIT_HOLE reduce using rule 378 + LIT_CHAR reduce using rule 378 + LIT_STRING reduce using rule 378 + LIT_RAW_STRING reduce using rule 378 + LIT_INT reduce using rule 378 + LIT_NUMBER reduce using rule 378 + %eof reduce using rule 378 + + +State 665 + + guardedCaseExpr -> guard . '->' exprWhere (rule 207) + + '->' shift, and enter state 685 + + +State 666 + + guardedCase -> many__guardedCaseExpr__ . (rule 206) + + error reduce using rule 206 + '(' reduce using rule 206 + ')' reduce using rule 206 + '{' reduce using rule 206 + '}' reduce using rule 206 + '[' reduce using rule 206 + ']' reduce using rule 206 + '\}' reduce using rule 206 + '\;' reduce using rule 206 + '<=' reduce using rule 206 + ':' reduce using rule 206 + '::' reduce using rule 206 + '|' reduce using rule 206 + '`' reduce using rule 206 + ',' reduce using rule 206 + '_' reduce using rule 206 + '\\' reduce using rule 206 + '-' reduce using rule 206 + '@' reduce using rule 206 + 'ado' reduce using rule 206 + 'as' reduce using rule 206 + 'case' reduce using rule 206 + 'do' reduce using rule 206 + 'else' reduce using rule 206 + 'false' reduce using rule 206 + 'hiding' reduce using rule 206 + 'if' reduce using rule 206 + 'let' reduce using rule 206 + 'nominal' reduce using rule 206 + 'phantom' reduce using rule 206 + 'of' reduce using rule 206 + 'representational'reduce using rule 206 + 'role' reduce using rule 206 + 'then' reduce using rule 206 + 'true' reduce using rule 206 + 'where' reduce using rule 206 + '(..)' reduce using rule 206 + LOWER reduce using rule 206 + QUAL_LOWER reduce using rule 206 + UPPER reduce using rule 206 + QUAL_UPPER reduce using rule 206 + SYMBOL reduce using rule 206 + QUAL_SYMBOL reduce using rule 206 + OPERATOR reduce using rule 206 + QUAL_OPERATOR reduce using rule 206 + LIT_HOLE reduce using rule 206 + LIT_CHAR reduce using rule 206 + LIT_STRING reduce using rule 206 + LIT_RAW_STRING reduce using rule 206 + LIT_INT reduce using rule 206 + LIT_NUMBER reduce using rule 206 + %eof reduce using rule 206 + + +State 667 + + many__guardedCaseExpr__ -> many1__guardedCaseExpr__ . (rule 343) + many1__guardedCaseExpr__ -> many1__guardedCaseExpr__ . guardedCaseExpr (rule 379) + + error reduce using rule 343 + '(' reduce using rule 343 + ')' reduce using rule 343 + '{' reduce using rule 343 + '}' reduce using rule 343 + '[' reduce using rule 343 + ']' reduce using rule 343 + '\}' reduce using rule 343 + '\;' reduce using rule 343 + '<=' reduce using rule 343 + ':' reduce using rule 343 + '::' reduce using rule 343 + '|' shift, and enter state 434 + '`' reduce using rule 343 + ',' reduce using rule 343 + '_' reduce using rule 343 + '\\' reduce using rule 343 + '-' reduce using rule 343 + '@' reduce using rule 343 + 'ado' reduce using rule 343 + 'as' reduce using rule 343 + 'case' reduce using rule 343 + 'do' reduce using rule 343 + 'else' reduce using rule 343 + 'false' reduce using rule 343 + 'hiding' reduce using rule 343 + 'if' reduce using rule 343 + 'let' reduce using rule 343 + 'nominal' reduce using rule 343 + 'phantom' reduce using rule 343 + 'of' reduce using rule 343 + 'representational'reduce using rule 343 + 'role' reduce using rule 343 + 'then' reduce using rule 343 + 'true' reduce using rule 343 + 'where' reduce using rule 343 + '(..)' reduce using rule 343 + LOWER reduce using rule 343 + QUAL_LOWER reduce using rule 343 + UPPER reduce using rule 343 + QUAL_UPPER reduce using rule 343 + SYMBOL reduce using rule 343 + QUAL_SYMBOL reduce using rule 343 + OPERATOR reduce using rule 343 + QUAL_OPERATOR reduce using rule 343 + LIT_HOLE reduce using rule 343 + LIT_CHAR reduce using rule 343 + LIT_STRING reduce using rule 343 + LIT_RAW_STRING reduce using rule 343 + LIT_INT reduce using rule 343 + LIT_NUMBER reduce using rule 343 + %eof reduce using rule 343 + + guardedCaseExprgoto state 684 + guard goto state 665 + +State 668 + + expr5 -> 'case' sep__expr__','__ 'of' '\{' sep__binder1__','__ '\}' . guardedCase (rule 170) + + '->' shift, and enter state 683 + '|' shift, and enter state 434 + + guardedCase goto state 682 + guardedCaseExprgoto state 664 + guard goto state 665 + many__guardedCaseExpr__goto state 666 + many1__guardedCaseExpr__goto state 667 + +State 669 + + expr5 -> 'case' sep__expr__','__ 'of' '\{' sep__binder1__','__ '->' . '\}' exprWhere (rule 169) + guardedCase -> '->' . exprWhere (rule 205) + + '(' shift, and enter state 95 + '{' shift, and enter state 96 + '[' shift, and enter state 97 + '\}' shift, and enter state 681 + '_' shift, and enter state 98 + '\\' shift, and enter state 99 + '-' shift, and enter state 100 + 'ado' shift, and enter state 101 + 'as' shift, and enter state 102 + 'case' shift, and enter state 103 + 'do' shift, and enter state 104 + 'false' shift, and enter state 46 + 'hiding' shift, and enter state 105 + 'if' shift, and enter state 106 + 'let' shift, and enter state 107 + 'nominal' shift, and enter state 108 + 'phantom' shift, and enter state 109 + 'representational'shift, and enter state 110 + 'role' shift, and enter state 111 + 'true' shift, and enter state 52 + '(..)' shift, and enter state 112 + LOWER shift, and enter state 113 + QUAL_LOWER shift, and enter state 114 + UPPER shift, and enter state 54 + QUAL_UPPER shift, and enter state 55 + SYMBOL shift, and enter state 115 + QUAL_SYMBOL shift, and enter state 116 + LIT_HOLE shift, and enter state 117 + LIT_CHAR shift, and enter state 56 + LIT_STRING shift, and enter state 57 + LIT_RAW_STRING shift, and enter state 58 + LIT_INT shift, and enter state 59 + LIT_NUMBER shift, and enter state 60 + + qualProperName goto state 74 + qualIdent goto state 75 + qualSymbol goto state 76 + hole goto state 77 + string goto state 78 + char goto state 79 + number goto state 80 + boolean goto state 81 + exprWhere goto state 680 + expr goto state 513 + expr1 goto state 122 + expr2 goto state 83 + expr3 goto state 84 + expr4 goto state 85 + expr5 goto state 86 + expr6 goto state 87 + expr7 goto state 88 + exprAtom goto state 89 + doBlock goto state 90 + adoBlock goto state 91 + delim__'['__expr__','__']'__goto state 93 + delim__'{'__recordLabel__','__'}'__goto state 94 + +State 670 + + expr5 -> 'case' sep__expr__','__ 'of' '\{' manySep__caseBranch__'\;'__ '\}' . (rule 168) + + error reduce using rule 168 + '(' reduce using rule 168 + ')' reduce using rule 168 + '{' reduce using rule 168 + '}' reduce using rule 168 + '[' reduce using rule 168 + ']' reduce using rule 168 + '\}' reduce using rule 168 + '\;' reduce using rule 168 + '<=' reduce using rule 168 + ':' reduce using rule 168 + '::' reduce using rule 168 + '|' reduce using rule 168 + '`' reduce using rule 168 + ',' reduce using rule 168 + '_' reduce using rule 168 + '\\' reduce using rule 168 + '-' reduce using rule 168 + '@' reduce using rule 168 + 'ado' reduce using rule 168 + 'as' reduce using rule 168 + 'case' reduce using rule 168 + 'do' reduce using rule 168 + 'else' reduce using rule 168 + 'false' reduce using rule 168 + 'hiding' reduce using rule 168 + 'if' reduce using rule 168 + 'let' reduce using rule 168 + 'nominal' reduce using rule 168 + 'phantom' reduce using rule 168 + 'of' reduce using rule 168 + 'representational'reduce using rule 168 + 'role' reduce using rule 168 + 'then' reduce using rule 168 + 'true' reduce using rule 168 + 'where' reduce using rule 168 + '(..)' reduce using rule 168 + LOWER reduce using rule 168 + QUAL_LOWER reduce using rule 168 + UPPER reduce using rule 168 + QUAL_UPPER reduce using rule 168 + SYMBOL reduce using rule 168 + QUAL_SYMBOL reduce using rule 168 + OPERATOR reduce using rule 168 + QUAL_OPERATOR reduce using rule 168 + LIT_HOLE reduce using rule 168 + LIT_CHAR reduce using rule 168 + LIT_STRING reduce using rule 168 + LIT_RAW_STRING reduce using rule 168 + LIT_INT reduce using rule 168 + LIT_NUMBER reduce using rule 168 + %eof reduce using rule 168 + + +State 671 + + sep1__recordUpdate__','__ -> sep1__recordUpdate__','__ ',' . recordUpdate (rule 422) + + 'ado' shift, and enter state 230 + 'as' shift, and enter state 231 + 'case' shift, and enter state 232 + 'class' shift, and enter state 233 + 'data' shift, and enter state 234 + 'derive' shift, and enter state 235 + 'do' shift, and enter state 236 + 'else' shift, and enter state 237 + 'false' shift, and enter state 238 + 'forall' shift, and enter state 239 + 'foreign' shift, and enter state 240 + 'hiding' shift, and enter state 241 + 'import' shift, and enter state 242 + 'if' shift, and enter state 243 + 'in' shift, and enter state 244 + 'infix' shift, and enter state 245 + 'infixl' shift, and enter state 246 + 'infixr' shift, and enter state 247 + 'instance' shift, and enter state 248 + 'let' shift, and enter state 249 + 'module' shift, and enter state 250 + 'newtype' shift, and enter state 251 + 'nominal' shift, and enter state 252 + 'phantom' shift, and enter state 253 + 'of' shift, and enter state 254 + 'representational'shift, and enter state 255 + 'role' shift, and enter state 256 + 'then' shift, and enter state 257 + 'true' shift, and enter state 258 + 'type' shift, and enter state 259 + 'where' shift, and enter state 260 + LOWER shift, and enter state 261 + LIT_STRING shift, and enter state 262 + LIT_RAW_STRING shift, and enter state 263 + + label goto state 579 + recordUpdate goto state 679 + +State 672 + + recordUpdateOrLabel -> label '{' sep__recordUpdate__','__ '}' . (rule 194) + + '}' reduce using rule 194 + ',' reduce using rule 194 + + +State 673 + + recordUpdate -> label '{' . sep__recordUpdate__','__ '}' (rule 196) + + 'ado' shift, and enter state 230 + 'as' shift, and enter state 231 + 'case' shift, and enter state 232 + 'class' shift, and enter state 233 + 'data' shift, and enter state 234 + 'derive' shift, and enter state 235 + 'do' shift, and enter state 236 + 'else' shift, and enter state 237 + 'false' shift, and enter state 238 + 'forall' shift, and enter state 239 + 'foreign' shift, and enter state 240 + 'hiding' shift, and enter state 241 + 'import' shift, and enter state 242 + 'if' shift, and enter state 243 + 'in' shift, and enter state 244 + 'infix' shift, and enter state 245 + 'infixl' shift, and enter state 246 + 'infixr' shift, and enter state 247 + 'instance' shift, and enter state 248 + 'let' shift, and enter state 249 + 'module' shift, and enter state 250 + 'newtype' shift, and enter state 251 + 'nominal' shift, and enter state 252 + 'phantom' shift, and enter state 253 + 'of' shift, and enter state 254 + 'representational'shift, and enter state 255 + 'role' shift, and enter state 256 + 'then' shift, and enter state 257 + 'true' shift, and enter state 258 + 'type' shift, and enter state 259 + 'where' shift, and enter state 260 + LOWER shift, and enter state 261 + LIT_STRING shift, and enter state 262 + LIT_RAW_STRING shift, and enter state 263 + + label goto state 579 + recordUpdate goto state 580 + sep__recordUpdate__','__goto state 678 + sep1__recordUpdate__','__goto state 582 + +State 674 + + recordUpdate -> label '=' . expr (rule 195) + + '(' shift, and enter state 95 + '{' shift, and enter state 96 + '[' shift, and enter state 97 + '_' shift, and enter state 98 + '\\' shift, and enter state 99 + '-' shift, and enter state 100 + 'ado' shift, and enter state 101 + 'as' shift, and enter state 102 + 'case' shift, and enter state 103 + 'do' shift, and enter state 104 + 'false' shift, and enter state 46 + 'hiding' shift, and enter state 105 + 'if' shift, and enter state 106 + 'let' shift, and enter state 107 + 'nominal' shift, and enter state 108 + 'phantom' shift, and enter state 109 + 'representational'shift, and enter state 110 + 'role' shift, and enter state 111 + 'true' shift, and enter state 52 + '(..)' shift, and enter state 112 + LOWER shift, and enter state 113 + QUAL_LOWER shift, and enter state 114 + UPPER shift, and enter state 54 + QUAL_UPPER shift, and enter state 55 + SYMBOL shift, and enter state 115 + QUAL_SYMBOL shift, and enter state 116 + LIT_HOLE shift, and enter state 117 + LIT_CHAR shift, and enter state 56 + LIT_STRING shift, and enter state 57 + LIT_RAW_STRING shift, and enter state 58 + LIT_INT shift, and enter state 59 + LIT_NUMBER shift, and enter state 60 + + qualProperName goto state 74 + qualIdent goto state 75 + qualSymbol goto state 76 + hole goto state 77 + string goto state 78 + char goto state 79 + number goto state 80 + boolean goto state 81 + expr goto state 677 + expr1 goto state 122 + expr2 goto state 83 + expr3 goto state 84 + expr4 goto state 85 + expr5 goto state 86 + expr6 goto state 87 + expr7 goto state 88 + exprAtom goto state 89 + doBlock goto state 90 + adoBlock goto state 91 + delim__'['__expr__','__']'__goto state 93 + delim__'{'__recordLabel__','__'}'__goto state 94 + +State 675 + + fundep -> many__ident__ '->' many__ident__ . (rule 307) + + error reduce using rule 307 + ',' reduce using rule 307 + + +State 676 + + sep1__fundep__','__ -> sep1__fundep__','__ ',' fundep . (rule 414) + + error reduce using rule 414 + ',' reduce using rule 414 + + +State 677 + + recordUpdate -> label '=' expr . (rule 195) + + '}' reduce using rule 195 + ',' reduce using rule 195 + + +State 678 + + recordUpdate -> label '{' sep__recordUpdate__','__ . '}' (rule 196) + + '}' shift, and enter state 702 + + +State 679 + + sep1__recordUpdate__','__ -> sep1__recordUpdate__','__ ',' recordUpdate . (rule 422) + + '}' reduce using rule 422 + ',' reduce using rule 422 + + +State 680 + + guardedCase -> '->' exprWhere . (rule 205) + + error reduce using rule 205 + '(' reduce using rule 205 + ')' reduce using rule 205 + '{' reduce using rule 205 + '}' reduce using rule 205 + '[' reduce using rule 205 + ']' reduce using rule 205 + '\}' reduce using rule 205 + '\;' reduce using rule 205 + '<=' reduce using rule 205 + ':' reduce using rule 205 + '::' reduce using rule 205 + '|' reduce using rule 205 + '`' reduce using rule 205 + ',' reduce using rule 205 + '_' reduce using rule 205 + '\\' reduce using rule 205 + '-' reduce using rule 205 + '@' reduce using rule 205 + 'ado' reduce using rule 205 + 'as' reduce using rule 205 + 'case' reduce using rule 205 + 'do' reduce using rule 205 + 'else' reduce using rule 205 + 'false' reduce using rule 205 + 'hiding' reduce using rule 205 + 'if' reduce using rule 205 + 'let' reduce using rule 205 + 'nominal' reduce using rule 205 + 'phantom' reduce using rule 205 + 'of' reduce using rule 205 + 'representational'reduce using rule 205 + 'role' reduce using rule 205 + 'then' reduce using rule 205 + 'true' reduce using rule 205 + 'where' reduce using rule 205 + '(..)' reduce using rule 205 + LOWER reduce using rule 205 + QUAL_LOWER reduce using rule 205 + UPPER reduce using rule 205 + QUAL_UPPER reduce using rule 205 + SYMBOL reduce using rule 205 + QUAL_SYMBOL reduce using rule 205 + OPERATOR reduce using rule 205 + QUAL_OPERATOR reduce using rule 205 + LIT_HOLE reduce using rule 205 + LIT_CHAR reduce using rule 205 + LIT_STRING reduce using rule 205 + LIT_RAW_STRING reduce using rule 205 + LIT_INT reduce using rule 205 + LIT_NUMBER reduce using rule 205 + %eof reduce using rule 205 + + +State 681 + + expr5 -> 'case' sep__expr__','__ 'of' '\{' sep__binder1__','__ '->' '\}' . exprWhere (rule 169) + + '(' shift, and enter state 95 + '{' shift, and enter state 96 + '[' shift, and enter state 97 + '_' shift, and enter state 98 + '\\' shift, and enter state 99 + '-' shift, and enter state 100 + 'ado' shift, and enter state 101 + 'as' shift, and enter state 102 + 'case' shift, and enter state 103 + 'do' shift, and enter state 104 + 'false' shift, and enter state 46 + 'hiding' shift, and enter state 105 + 'if' shift, and enter state 106 + 'let' shift, and enter state 107 + 'nominal' shift, and enter state 108 + 'phantom' shift, and enter state 109 + 'representational'shift, and enter state 110 + 'role' shift, and enter state 111 + 'true' shift, and enter state 52 + '(..)' shift, and enter state 112 + LOWER shift, and enter state 113 + QUAL_LOWER shift, and enter state 114 + UPPER shift, and enter state 54 + QUAL_UPPER shift, and enter state 55 + SYMBOL shift, and enter state 115 + QUAL_SYMBOL shift, and enter state 116 + LIT_HOLE shift, and enter state 117 + LIT_CHAR shift, and enter state 56 + LIT_STRING shift, and enter state 57 + LIT_RAW_STRING shift, and enter state 58 + LIT_INT shift, and enter state 59 + LIT_NUMBER shift, and enter state 60 + + qualProperName goto state 74 + qualIdent goto state 75 + qualSymbol goto state 76 + hole goto state 77 + string goto state 78 + char goto state 79 + number goto state 80 + boolean goto state 81 + exprWhere goto state 701 + expr goto state 513 + expr1 goto state 122 + expr2 goto state 83 + expr3 goto state 84 + expr4 goto state 85 + expr5 goto state 86 + expr6 goto state 87 + expr7 goto state 88 + exprAtom goto state 89 + doBlock goto state 90 + adoBlock goto state 91 + delim__'['__expr__','__']'__goto state 93 + delim__'{'__recordLabel__','__'}'__goto state 94 + +State 682 + + expr5 -> 'case' sep__expr__','__ 'of' '\{' sep__binder1__','__ '\}' guardedCase . (rule 170) + + error reduce using rule 170 + '(' reduce using rule 170 + ')' reduce using rule 170 + '{' reduce using rule 170 + '}' reduce using rule 170 + '[' reduce using rule 170 + ']' reduce using rule 170 + '\}' reduce using rule 170 + '\;' reduce using rule 170 + '<=' reduce using rule 170 + ':' reduce using rule 170 + '::' reduce using rule 170 + '|' reduce using rule 170 + '`' reduce using rule 170 + ',' reduce using rule 170 + '_' reduce using rule 170 + '\\' reduce using rule 170 + '-' reduce using rule 170 + '@' reduce using rule 170 + 'ado' reduce using rule 170 + 'as' reduce using rule 170 + 'case' reduce using rule 170 + 'do' reduce using rule 170 + 'else' reduce using rule 170 + 'false' reduce using rule 170 + 'hiding' reduce using rule 170 + 'if' reduce using rule 170 + 'let' reduce using rule 170 + 'nominal' reduce using rule 170 + 'phantom' reduce using rule 170 + 'of' reduce using rule 170 + 'representational'reduce using rule 170 + 'role' reduce using rule 170 + 'then' reduce using rule 170 + 'true' reduce using rule 170 + 'where' reduce using rule 170 + '(..)' reduce using rule 170 + LOWER reduce using rule 170 + QUAL_LOWER reduce using rule 170 + UPPER reduce using rule 170 + QUAL_UPPER reduce using rule 170 + SYMBOL reduce using rule 170 + QUAL_SYMBOL reduce using rule 170 + OPERATOR reduce using rule 170 + QUAL_OPERATOR reduce using rule 170 + LIT_HOLE reduce using rule 170 + LIT_CHAR reduce using rule 170 + LIT_STRING reduce using rule 170 + LIT_RAW_STRING reduce using rule 170 + LIT_INT reduce using rule 170 + LIT_NUMBER reduce using rule 170 + %eof reduce using rule 170 + + +State 683 + + guardedCase -> '->' . exprWhere (rule 205) + + '(' shift, and enter state 95 + '{' shift, and enter state 96 + '[' shift, and enter state 97 + '_' shift, and enter state 98 + '\\' shift, and enter state 99 + '-' shift, and enter state 100 + 'ado' shift, and enter state 101 + 'as' shift, and enter state 102 + 'case' shift, and enter state 103 + 'do' shift, and enter state 104 + 'false' shift, and enter state 46 + 'hiding' shift, and enter state 105 + 'if' shift, and enter state 106 + 'let' shift, and enter state 107 + 'nominal' shift, and enter state 108 + 'phantom' shift, and enter state 109 + 'representational'shift, and enter state 110 + 'role' shift, and enter state 111 + 'true' shift, and enter state 52 + '(..)' shift, and enter state 112 + LOWER shift, and enter state 113 + QUAL_LOWER shift, and enter state 114 + UPPER shift, and enter state 54 + QUAL_UPPER shift, and enter state 55 + SYMBOL shift, and enter state 115 + QUAL_SYMBOL shift, and enter state 116 + LIT_HOLE shift, and enter state 117 + LIT_CHAR shift, and enter state 56 + LIT_STRING shift, and enter state 57 + LIT_RAW_STRING shift, and enter state 58 + LIT_INT shift, and enter state 59 + LIT_NUMBER shift, and enter state 60 + + qualProperName goto state 74 + qualIdent goto state 75 + qualSymbol goto state 76 + hole goto state 77 + string goto state 78 + char goto state 79 + number goto state 80 + boolean goto state 81 + exprWhere goto state 680 + expr goto state 513 + expr1 goto state 122 + expr2 goto state 83 + expr3 goto state 84 + expr4 goto state 85 + expr5 goto state 86 + expr6 goto state 87 + expr7 goto state 88 + exprAtom goto state 89 + doBlock goto state 90 + adoBlock goto state 91 + delim__'['__expr__','__']'__goto state 93 + delim__'{'__recordLabel__','__'}'__goto state 94 + +State 684 + + many1__guardedCaseExpr__ -> many1__guardedCaseExpr__ guardedCaseExpr . (rule 379) + + error reduce using rule 379 + '(' reduce using rule 379 + ')' reduce using rule 379 + '{' reduce using rule 379 + '}' reduce using rule 379 + '[' reduce using rule 379 + ']' reduce using rule 379 + '\}' reduce using rule 379 + '\;' reduce using rule 379 + '<=' reduce using rule 379 + ':' reduce using rule 379 + '::' reduce using rule 379 + '|' reduce using rule 379 + '`' reduce using rule 379 + ',' reduce using rule 379 + '_' reduce using rule 379 + '\\' reduce using rule 379 + '-' reduce using rule 379 + '@' reduce using rule 379 + 'ado' reduce using rule 379 + 'as' reduce using rule 379 + 'case' reduce using rule 379 + 'do' reduce using rule 379 + 'else' reduce using rule 379 + 'false' reduce using rule 379 + 'hiding' reduce using rule 379 + 'if' reduce using rule 379 + 'let' reduce using rule 379 + 'nominal' reduce using rule 379 + 'phantom' reduce using rule 379 + 'of' reduce using rule 379 + 'representational'reduce using rule 379 + 'role' reduce using rule 379 + 'then' reduce using rule 379 + 'true' reduce using rule 379 + 'where' reduce using rule 379 + '(..)' reduce using rule 379 + LOWER reduce using rule 379 + QUAL_LOWER reduce using rule 379 + UPPER reduce using rule 379 + QUAL_UPPER reduce using rule 379 + SYMBOL reduce using rule 379 + QUAL_SYMBOL reduce using rule 379 + OPERATOR reduce using rule 379 + QUAL_OPERATOR reduce using rule 379 + LIT_HOLE reduce using rule 379 + LIT_CHAR reduce using rule 379 + LIT_STRING reduce using rule 379 + LIT_RAW_STRING reduce using rule 379 + LIT_INT reduce using rule 379 + LIT_NUMBER reduce using rule 379 + %eof reduce using rule 379 + + +State 685 + + guardedCaseExpr -> guard '->' . exprWhere (rule 207) + + '(' shift, and enter state 95 + '{' shift, and enter state 96 + '[' shift, and enter state 97 + '_' shift, and enter state 98 + '\\' shift, and enter state 99 + '-' shift, and enter state 100 + 'ado' shift, and enter state 101 + 'as' shift, and enter state 102 + 'case' shift, and enter state 103 + 'do' shift, and enter state 104 + 'false' shift, and enter state 46 + 'hiding' shift, and enter state 105 + 'if' shift, and enter state 106 + 'let' shift, and enter state 107 + 'nominal' shift, and enter state 108 + 'phantom' shift, and enter state 109 + 'representational'shift, and enter state 110 + 'role' shift, and enter state 111 + 'true' shift, and enter state 52 + '(..)' shift, and enter state 112 + LOWER shift, and enter state 113 + QUAL_LOWER shift, and enter state 114 + UPPER shift, and enter state 54 + QUAL_UPPER shift, and enter state 55 + SYMBOL shift, and enter state 115 + QUAL_SYMBOL shift, and enter state 116 + LIT_HOLE shift, and enter state 117 + LIT_CHAR shift, and enter state 56 + LIT_STRING shift, and enter state 57 + LIT_RAW_STRING shift, and enter state 58 + LIT_INT shift, and enter state 59 + LIT_NUMBER shift, and enter state 60 + + qualProperName goto state 74 + qualIdent goto state 75 + qualSymbol goto state 76 + hole goto state 77 + string goto state 78 + char goto state 79 + number goto state 80 + boolean goto state 81 + exprWhere goto state 700 + expr goto state 513 + expr1 goto state 122 + expr2 goto state 83 + expr3 goto state 84 + expr4 goto state 85 + expr5 goto state 86 + expr6 goto state 87 + expr7 goto state 88 + exprAtom goto state 89 + doBlock goto state 90 + adoBlock goto state 91 + delim__'['__expr__','__']'__goto state 93 + delim__'{'__recordLabel__','__'}'__goto state 94 + +State 686 + + manySep1__caseBranch__'\;'__ -> manySep1__caseBranch__'\;'__ '\;' caseBranch . (rule 389) + + '\}' reduce using rule 389 + '\;' reduce using rule 389 + + +State 687 + + caseBranch -> sep__binder1__','__ . guardedCase (rule 201) + + '->' shift, and enter state 683 + '|' shift, and enter state 434 + + guardedCase goto state 663 + guardedCaseExprgoto state 664 + guard goto state 665 + many__guardedCaseExpr__goto state 666 + many1__guardedCaseExpr__goto state 667 + +State 688 + + binder1 -> binder1 . qualOp binder2 (rule 225) + sep1__binder1__','__ -> sep1__binder1__','__ ',' binder1 . (rule 402) + + '\}' reduce using rule 402 + '->' reduce using rule 402 + '<=' shift, and enter state 293 + ':' shift, and enter state 295 + '|' reduce using rule 402 + ',' reduce using rule 402 + '-' shift, and enter state 296 + OPERATOR shift, and enter state 297 + QUAL_OPERATOR shift, and enter state 298 + + qualOp goto state 351 + +State 689 + + moduleImports -> importDecls importDecl . '\}' (rule 244) + importDecls -> importDecls importDecl . '\;' (rule 246) + + '\}' shift, and enter state 698 + '\;' shift, and enter state 699 + + +State 690 + + sep1__properName__','__ -> sep1__properName__','__ ',' . properName (rule 420) + + UPPER shift, and enter state 63 + + properName goto state 697 + +State 691 + + dataMembers -> '(' sep__properName__','__ ')' . (rule 265) + + ')' reduce using rule 265 + ',' reduce using rule 265 + + +State 692 + + typeVarBinding -> '(' '@' ident '::' type ')' . (rule 142) + + error reduce using rule 142 + '(' reduce using rule 142 + '|' reduce using rule 142 + '.' reduce using rule 142 + '@' reduce using rule 142 + 'as' reduce using rule 142 + 'hiding' reduce using rule 142 + 'nominal' reduce using rule 142 + 'phantom' reduce using rule 142 + 'representational'reduce using rule 142 + 'role' reduce using rule 142 + LOWER reduce using rule 142 + + +State 693 + + exprWhere -> expr 'where' '\{' manySep__letBinding__'\;'__ . '\}' (rule 148) + + '\}' shift, and enter state 696 + + +State 694 + + typeVarBindingPlain -> '(' ident '::' type ')' . (rule 144) + + error reduce using rule 144 + '(' reduce using rule 144 + '\}' reduce using rule 144 + '\;' reduce using rule 144 + '=' reduce using rule 144 + 'as' reduce using rule 144 + 'else' reduce using rule 144 + 'hiding' reduce using rule 144 + 'nominal' reduce using rule 144 + 'phantom' reduce using rule 144 + 'representational'reduce using rule 144 + 'role' reduce using rule 144 + LOWER reduce using rule 144 + %eof reduce using rule 144 + + +State 695 + + instHead -> 'instance' ident '::' constraints '=>' qualProperName manyOrEmpty__typeAtom__ . (rule 311) + + error reduce using rule 311 + '\}' reduce using rule 311 + '\;' reduce using rule 311 + 'else' reduce using rule 311 + 'where' reduce using rule 311 + %eof reduce using rule 311 + + +State 696 + + exprWhere -> expr 'where' '\{' manySep__letBinding__'\;'__ '\}' . (rule 148) + + error reduce using rule 148 + '(' reduce using rule 148 + ')' reduce using rule 148 + '{' reduce using rule 148 + '}' reduce using rule 148 + '[' reduce using rule 148 + ']' reduce using rule 148 + '\}' reduce using rule 148 + '\;' reduce using rule 148 + '<=' reduce using rule 148 + ':' reduce using rule 148 + '::' reduce using rule 148 + '|' reduce using rule 148 + '`' reduce using rule 148 + ',' reduce using rule 148 + '_' reduce using rule 148 + '\\' reduce using rule 148 + '-' reduce using rule 148 + '@' reduce using rule 148 + 'ado' reduce using rule 148 + 'as' reduce using rule 148 + 'case' reduce using rule 148 + 'do' reduce using rule 148 + 'else' reduce using rule 148 + 'false' reduce using rule 148 + 'hiding' reduce using rule 148 + 'if' reduce using rule 148 + 'let' reduce using rule 148 + 'nominal' reduce using rule 148 + 'phantom' reduce using rule 148 + 'of' reduce using rule 148 + 'representational'reduce using rule 148 + 'role' reduce using rule 148 + 'then' reduce using rule 148 + 'true' reduce using rule 148 + 'where' reduce using rule 148 + '(..)' reduce using rule 148 + LOWER reduce using rule 148 + QUAL_LOWER reduce using rule 148 + UPPER reduce using rule 148 + QUAL_UPPER reduce using rule 148 + SYMBOL reduce using rule 148 + QUAL_SYMBOL reduce using rule 148 + OPERATOR reduce using rule 148 + QUAL_OPERATOR reduce using rule 148 + LIT_HOLE reduce using rule 148 + LIT_CHAR reduce using rule 148 + LIT_STRING reduce using rule 148 + LIT_RAW_STRING reduce using rule 148 + LIT_INT reduce using rule 148 + LIT_NUMBER reduce using rule 148 + %eof reduce using rule 148 + + +State 697 + + sep1__properName__','__ -> sep1__properName__','__ ',' properName . (rule 420) + + ')' reduce using rule 420 + ',' reduce using rule 420 + + +State 698 + + moduleImports -> importDecls importDecl '\}' . (rule 244) + + error reduce using rule 244 + + +State 699 + + importDecls -> importDecls importDecl '\;' . (rule 246) + + error reduce using rule 246 + 'import' reduce using rule 246 + + +State 700 + + guardedCaseExpr -> guard '->' exprWhere . (rule 207) + + error reduce using rule 207 + '(' reduce using rule 207 + ')' reduce using rule 207 + '{' reduce using rule 207 + '}' reduce using rule 207 + '[' reduce using rule 207 + ']' reduce using rule 207 + '\}' reduce using rule 207 + '\;' reduce using rule 207 + '<=' reduce using rule 207 + ':' reduce using rule 207 + '::' reduce using rule 207 + '|' reduce using rule 207 + '`' reduce using rule 207 + ',' reduce using rule 207 + '_' reduce using rule 207 + '\\' reduce using rule 207 + '-' reduce using rule 207 + '@' reduce using rule 207 + 'ado' reduce using rule 207 + 'as' reduce using rule 207 + 'case' reduce using rule 207 + 'do' reduce using rule 207 + 'else' reduce using rule 207 + 'false' reduce using rule 207 + 'hiding' reduce using rule 207 + 'if' reduce using rule 207 + 'let' reduce using rule 207 + 'nominal' reduce using rule 207 + 'phantom' reduce using rule 207 + 'of' reduce using rule 207 + 'representational'reduce using rule 207 + 'role' reduce using rule 207 + 'then' reduce using rule 207 + 'true' reduce using rule 207 + 'where' reduce using rule 207 + '(..)' reduce using rule 207 + LOWER reduce using rule 207 + QUAL_LOWER reduce using rule 207 + UPPER reduce using rule 207 + QUAL_UPPER reduce using rule 207 + SYMBOL reduce using rule 207 + QUAL_SYMBOL reduce using rule 207 + OPERATOR reduce using rule 207 + QUAL_OPERATOR reduce using rule 207 + LIT_HOLE reduce using rule 207 + LIT_CHAR reduce using rule 207 + LIT_STRING reduce using rule 207 + LIT_RAW_STRING reduce using rule 207 + LIT_INT reduce using rule 207 + LIT_NUMBER reduce using rule 207 + %eof reduce using rule 207 + + +State 701 + + expr5 -> 'case' sep__expr__','__ 'of' '\{' sep__binder1__','__ '->' '\}' exprWhere . (rule 169) + + error reduce using rule 169 + '(' reduce using rule 169 + ')' reduce using rule 169 + '{' reduce using rule 169 + '}' reduce using rule 169 + '[' reduce using rule 169 + ']' reduce using rule 169 + '\}' reduce using rule 169 + '\;' reduce using rule 169 + '<=' reduce using rule 169 + ':' reduce using rule 169 + '::' reduce using rule 169 + '|' reduce using rule 169 + '`' reduce using rule 169 + ',' reduce using rule 169 + '_' reduce using rule 169 + '\\' reduce using rule 169 + '-' reduce using rule 169 + '@' reduce using rule 169 + 'ado' reduce using rule 169 + 'as' reduce using rule 169 + 'case' reduce using rule 169 + 'do' reduce using rule 169 + 'else' reduce using rule 169 + 'false' reduce using rule 169 + 'hiding' reduce using rule 169 + 'if' reduce using rule 169 + 'let' reduce using rule 169 + 'nominal' reduce using rule 169 + 'phantom' reduce using rule 169 + 'of' reduce using rule 169 + 'representational'reduce using rule 169 + 'role' reduce using rule 169 + 'then' reduce using rule 169 + 'true' reduce using rule 169 + 'where' reduce using rule 169 + '(..)' reduce using rule 169 + LOWER reduce using rule 169 + QUAL_LOWER reduce using rule 169 + UPPER reduce using rule 169 + QUAL_UPPER reduce using rule 169 + SYMBOL reduce using rule 169 + QUAL_SYMBOL reduce using rule 169 + OPERATOR reduce using rule 169 + QUAL_OPERATOR reduce using rule 169 + LIT_HOLE reduce using rule 169 + LIT_CHAR reduce using rule 169 + LIT_STRING reduce using rule 169 + LIT_RAW_STRING reduce using rule 169 + LIT_INT reduce using rule 169 + LIT_NUMBER reduce using rule 169 + %eof reduce using rule 169 + + +State 702 + + recordUpdate -> label '{' sep__recordUpdate__','__ '}' . (rule 196) + + '}' reduce using rule 196 + ',' reduce using rule 196 + + +----------------------------------------------------------------------------- +Grammar Totals +----------------------------------------------------------------------------- +Number of rules: 437 +Number of terminals: 72 +Number of non-terminals: 191 +Number of states: 703 diff --git a/src/Language/PureScript/CST/Parser.y b/src/Language/PureScript/CST/Parser.y index edb60d93e..f4730d8ba 100644 --- a/src/Language/PureScript/CST/Parser.y +++ b/src/Language/PureScript/CST/Parser.y @@ -284,9 +284,23 @@ boolean :: { (SourceToken, Bool) } : 'true' { toBoolean $1 } | 'false' { toBoolean $1 } +kind :: { Type () } + : kind1 %shift { $1 } + | kind1 '->' kind { TypeArr () $1 $2 $3 } + +kind1 :: { Type () } + : kindAtom { $1 } + | kind1 kindAtom { TypeApp () $1 $2 } + +kindAtom :: { Type () } + : '_' { TypeWildcard () $1 } + | qualProperName { TypeConstructor () (getQualifiedProperName $1) } + | hole { TypeHole () $1 } + | '(' kind ')' { TypeParens () (Wrapped $1 $2 $3) } + type :: { Type () } : type1 %shift { $1 } - | type1 '::' type { TypeKinded () $1 $2 $3 } + | type1 '::' kind { TypeKinded () $1 $2 $3 } type1 :: { Type () } : type2 { $1 } @@ -319,9 +333,9 @@ typeAtom :: { Type ()} | hole { TypeHole () $1 } | '(->)' { TypeArrName () $1 } | '{' row '}' { TypeRecord () (Wrapped $1 $2 $3) } - | '(' row ')' { TypeRow () (Wrapped $1 $2 $3) } + | '[' row ']' { TypeRow () (Wrapped $1 $2 $3) } | '(' type1 ')' { TypeParens () (Wrapped $1 $2 $3) } - | '(' typeKindedAtom '::' type ')' { TypeParens () (Wrapped $1 (TypeKinded () $2 $3 $4) $5) } + | '(' typeKindedAtom '::' kind ')' %shift { TypeParens () (Wrapped $1 (TypeKinded () $2 $3 $4) $5) } -- Due to a conflict between row syntax and kinded type syntax, we require -- kinded type variables to be wrapped in parens. Thus `(a :: Foo)` is always a @@ -333,9 +347,9 @@ typeKindedAtom :: { Type () } | int { uncurry (TypeInt () Nothing) $1 } | hole { TypeHole () $1 } | '{' row '}' { TypeRecord () (Wrapped $1 $2 $3) } - | '(' row ')' { TypeRow () (Wrapped $1 $2 $3) } + | '[' row ']' { TypeRow () (Wrapped $1 $2 $3) } | '(' type1 ')' { TypeParens () (Wrapped $1 $2 $3) } - | '(' typeKindedAtom '::' type ')' { TypeParens () (Wrapped $1 (TypeKinded () $2 $3 $4) $5) } + | '(' typeKindedAtom '::' kind ')' { TypeParens () (Wrapped $1 (TypeKinded () $2 $3 $4) $5) } row :: { Row () } : {- empty -} { Row Nothing Nothing } @@ -349,12 +363,12 @@ rowLabel :: { Labeled Label (Type ()) } typeVarBinding :: { TypeVarBinding () } : ident { TypeVarName (Nothing, $1) } | '@' ident { TypeVarName (Just $1, $2) } - | '(' ident '::' type ')' {% checkNoWildcards $4 *> pure (TypeVarKinded (Wrapped $1 (Labeled (Nothing, $2) $3 $4) $5)) } - | '(' '@' ident '::' type ')' {% checkNoWildcards $5 *> pure (TypeVarKinded (Wrapped $1 (Labeled (Just $2, $3) $4 $5) $6)) } + | '(' ident '::' kind ')' {% checkNoWildcards $4 *> pure (TypeVarKinded (Wrapped $1 (Labeled (Nothing, $2) $3 $4) $5)) } + | '(' '@' ident '::' kind ')' {% checkNoWildcards $5 *> pure (TypeVarKinded (Wrapped $1 (Labeled (Just $2, $3) $4 $5) $6)) } typeVarBindingPlain :: { TypeVarBinding () } : ident { TypeVarName (Nothing, $1) } - | '(' ident '::' type ')' {% checkNoWildcards $4 *> pure (TypeVarKinded (Wrapped $1 (Labeled (Nothing, $2) $3 $4) $5)) } + | '(' ident '::' kind ')' {% checkNoWildcards $4 *> pure (TypeVarKinded (Wrapped $1 (Labeled (Nothing, $2) $3 $4) $5)) } forall :: { SourceToken } : 'forall' { $1 } @@ -436,7 +450,7 @@ exprAtom :: { Expr () } | char { uncurry (ExprChar ()) $1 } | string { uncurry (ExprString ()) $1 } | number { uncurry (ExprNumber ()) $1 } - | delim('[', expr, ',', ']') { ExprArray () $1 } + | delim('[', expr, ',', ']') { ExprList () $1 } | delim('{', recordLabel, ',', '}') { ExprRecord () $1 } | '(' expr ')' { ExprParens () (Wrapped $1 $2 $3) } @@ -584,7 +598,7 @@ binderAtom :: { Binder () } | char { uncurry (BinderChar ()) $1 } | string { uncurry (BinderString ()) $1 } | number { uncurry (BinderNumber () Nothing) $1 } - | delim('[', binder, ',', ']') { BinderArray () $1 } + | delim('[', binder, ',', ']') { BinderList () $1 } | delim('{', recordBinder, ',', '}') { BinderRecord () $1 } | '(' binder ')' { BinderParens () (Wrapped $1 $2 $3) } @@ -736,14 +750,17 @@ classMember :: { Labeled (Name Ident) (Type ()) } : ident '::' type {% checkNoWildcards $3 *> pure (Labeled $1 $2 $3) } instHead :: { InstanceHead () } - : 'instance' constraints '=>' qualProperName manyOrEmpty(typeAtom) - { InstanceHead $1 Nothing (Just ($2, $3)) (getQualifiedProperName $4) $5 } + : 'instance' instForall constraints '=>' qualProperName manyOrEmpty(typeAtom) + { InstanceHead $1 (Just $2) Nothing (Just ($3, $4)) (getQualifiedProperName $5) $6 } + | 'instance' instForall qualProperName manyOrEmpty(typeAtom) + { InstanceHead $1 (Just $2) Nothing Nothing (getQualifiedProperName $3) $4 } + | 'instance' constraints '=>' qualProperName manyOrEmpty(typeAtom) + { InstanceHead $1 Nothing Nothing (Just ($2, $3)) (getQualifiedProperName $4) $5 } | 'instance' qualProperName manyOrEmpty(typeAtom) - { InstanceHead $1 Nothing Nothing (getQualifiedProperName $2) $3 } - | 'instance' ident '::' constraints '=>' qualProperName manyOrEmpty(typeAtom) - { InstanceHead $1 (Just ($2, $3)) (Just ($4, $5)) (getQualifiedProperName $6) $7 } - | 'instance' ident '::' qualProperName manyOrEmpty(typeAtom) - { InstanceHead $1 (Just ($2, $3)) Nothing (getQualifiedProperName $4) $5 } + { InstanceHead $1 Nothing Nothing Nothing (getQualifiedProperName $2) $3 } + +instForall :: { (SourceToken, NE.NonEmpty (TypeVarBinding ())) } + : forall many(typeVarBinding) '.' { ( $1, $2 ) } constraints :: { OneOrDelimited (Constraint ()) } : constraint { One $1 } diff --git a/src/Language/PureScript/CST/Positions.hs b/src/Language/PureScript/CST/Positions.hs index 20d572427..d4579793e 100644 --- a/src/Language/PureScript/CST/Positions.hs +++ b/src/Language/PureScript/CST/Positions.hs @@ -1,8 +1,8 @@ --- | This module contains utilities for calculating positions and offsets. While --- tokens are annotated with ranges, CST nodes are not, but they can be --- dynamically derived with the functions in this module, which will return the --- first and last tokens for a given node. - +{- | This module contains utilities for calculating positions and offsets. While +tokens are annotated with ranges, CST nodes are not, but they can be +dynamically derived with the functions in this module, which will return the +first and last tokens for a given node. +-} module Language.PureScript.CST.Positions where import Prelude @@ -11,8 +11,8 @@ import Data.Foldable (foldl') import Data.List.NonEmpty qualified as NE import Data.Maybe (fromMaybe) import Data.Text (Text) -import Data.Void (Void) import Data.Text qualified as Text +import Data.Void (Void) import Language.PureScript.CST.Types advanceToken :: SourcePos -> Token -> SourcePos @@ -26,45 +26,45 @@ advanceTrailing = foldl' $ \a -> applyDelta a . commentDelta (const (0, 0)) tokenDelta :: Token -> (Int, Int) tokenDelta = \case - TokLeftParen -> (0, 1) - TokRightParen -> (0, 1) - TokLeftBrace -> (0, 1) - TokRightBrace -> (0, 1) - TokLeftSquare -> (0, 1) - TokRightSquare -> (0, 1) - TokLeftArrow ASCII -> (0, 2) - TokLeftArrow Unicode -> (0, 1) - TokRightArrow ASCII -> (0, 2) - TokRightArrow Unicode -> (0, 1) - TokRightFatArrow ASCII -> (0, 2) + TokLeftParen -> (0, 1) + TokRightParen -> (0, 1) + TokLeftBrace -> (0, 1) + TokRightBrace -> (0, 1) + TokLeftSquare -> (0, 1) + TokRightSquare -> (0, 1) + TokLeftArrow ASCII -> (0, 2) + TokLeftArrow Unicode -> (0, 1) + TokRightArrow ASCII -> (0, 2) + TokRightArrow Unicode -> (0, 1) + TokRightFatArrow ASCII -> (0, 2) TokRightFatArrow Unicode -> (0, 1) - TokDoubleColon ASCII -> (0, 2) - TokDoubleColon Unicode -> (0, 1) - TokForall ASCII -> (0, 6) - TokForall Unicode -> (0, 1) - TokEquals -> (0, 1) - TokPipe -> (0, 1) - TokTick -> (0, 1) - TokDot -> (0, 1) - TokComma -> (0, 1) - TokUnderscore -> (0, 1) - TokBackslash -> (0, 1) - TokLowerName qual name -> (0, qualDelta qual + Text.length name) - TokUpperName qual name -> (0, qualDelta qual + Text.length name) - TokOperator qual sym -> (0, qualDelta qual + Text.length sym) - TokSymbolName qual sym -> (0, qualDelta qual + Text.length sym + 2) - TokSymbolArr Unicode -> (0, 3) - TokSymbolArr ASCII -> (0, 4) - TokHole hole -> (0, Text.length hole + 1) - TokChar raw _ -> (0, Text.length raw + 2) - TokInt raw _ -> (0, Text.length raw) - TokNumber raw _ -> (0, Text.length raw) - TokString raw _ -> multiLine 1 $ textDelta raw - TokRawString raw -> multiLine 3 $ textDelta raw - TokLayoutStart -> (0, 0) - TokLayoutSep -> (0, 0) - TokLayoutEnd -> (0, 0) - TokEof -> (0, 0) + TokDoubleColon ASCII -> (0, 2) + TokDoubleColon Unicode -> (0, 1) + TokForall ASCII -> (0, 6) + TokForall Unicode -> (0, 1) + TokEquals -> (0, 1) + TokPipe -> (0, 1) + TokTick -> (0, 1) + TokDot -> (0, 1) + TokComma -> (0, 1) + TokUnderscore -> (0, 1) + TokBackslash -> (0, 1) + TokLowerName qual name -> (0, qualDelta qual + Text.length name) + TokUpperName qual name -> (0, qualDelta qual + Text.length name) + TokOperator qual sym -> (0, qualDelta qual + Text.length sym) + TokSymbolName qual sym -> (0, qualDelta qual + Text.length sym + 2) + TokSymbolArr Unicode -> (0, 3) + TokSymbolArr ASCII -> (0, 4) + TokHole hole -> (0, Text.length hole + 1) + TokChar raw _ -> (0, Text.length raw + 2) + TokInt raw _ -> (0, Text.length raw) + TokNumber raw _ -> (0, Text.length raw) + TokString raw _ -> multiLine 1 $ textDelta raw + TokRawString raw -> multiLine 3 $ textDelta raw + TokLayoutStart -> (0, 0) + TokLayoutSep -> (0, 0) + TokLayoutEnd -> (0, 0) + TokEof -> (0, 0) qualDelta :: [Text] -> Int qualDelta = foldr ((+) . (+ 1) . Text.length) 0 @@ -85,9 +85,9 @@ lineDelta _ = (1, 1) textDelta :: Text -> (Int, Int) textDelta = Text.foldl' go (0, 0) where - go (!l, !c) = \case - '\n' -> (l + 1, 1) - _ -> (l, c + 1) + go (!l, !c) = \case + '\n' -> (l + 1, 1) + _ -> (l, c + 1) applyDelta :: SourcePos -> (Int, Int) -> SourcePos applyDelta (SourcePos l c) = \case @@ -98,6 +98,9 @@ sepLast :: Separated a -> a sepLast (Separated hd []) = hd sepLast (Separated _ tl) = snd $ last tl +{- | Contains the first and the last source token of a definition, +used to track line numbers for the error messages. +-} type TokenRange = (SourceToken, SourceToken) toSourceRange :: TokenRange -> SourceRange @@ -116,14 +119,14 @@ qualRange :: QualifiedName a -> TokenRange qualRange a = (qualTok a, qualTok a) wrappedRange :: Wrapped a -> TokenRange -wrappedRange Wrapped { wrpOpen, wrpClose } = (wrpOpen, wrpClose) +wrappedRange Wrapped {wrpOpen, wrpClose} = (wrpOpen, wrpClose) moduleRange :: Module a -> TokenRange -moduleRange Module { modKeyword, modWhere, modImports, modDecls } = +moduleRange Module {modKeyword, modWhere, modImports, modDecls} = case (modImports, modDecls) of ([], []) -> (modKeyword, modWhere) (is, []) -> (modKeyword, snd . importDeclRange $ last is) - (_, ds) -> (modKeyword, snd . declRange $ last ds) + (_, ds) -> (modKeyword, snd . declRange $ last ds) exportRange :: Export a -> TokenRange exportRange = \case @@ -137,7 +140,7 @@ exportRange = \case ExportModule _ a b -> (a, nameTok b) importDeclRange :: ImportDecl a -> TokenRange -importDeclRange ImportDecl { impKeyword, impModule, impNames, impQual } +importDeclRange ImportDecl {impKeyword, impModule, impNames, impQual} | Just (_, modName) <- impQual = (impKeyword, nameTok modName) | Just (_, imports) <- impNames = (impKeyword, wrpClose imports) | otherwise = (impKeyword, nameTok impModule) @@ -162,13 +165,15 @@ declRange = \case DeclData _ hd ctors | Just (_, cs) <- ctors -> (fst start, snd . dataCtorRange $ sepLast cs) | otherwise -> start - where start = dataHeadRange hd - DeclType _ a _ b -> (fst $ dataHeadRange a, snd $ typeRange b) + where + start = dataHeadRange hd + DeclType _ a _ b -> (fst $ dataHeadRange a, snd $ typeRange b) DeclNewtype _ a _ _ b -> (fst $ dataHeadRange a, snd $ typeRange b) DeclClass _ hd body | Just (_, ts) <- body -> (fst start, snd . typeRange . lblValue $ NE.last ts) | otherwise -> start - where start = classHeadRange hd + where + start = classHeadRange hd DeclInstanceChain _ a -> (fst . instanceRange $ sepHead a, snd . instanceRange $ sepLast a) DeclDerive _ a _ b -> (a, snd $ instanceHeadRange b) DeclKindSignature _ a (Labeled _ _ b) -> (a, snd $ typeRange b) @@ -204,10 +209,11 @@ instanceRange :: Instance a -> TokenRange instanceRange (Instance hd bd) | Just (_, ts) <- bd = (fst start, snd . instanceBindingRange $ NE.last ts) | otherwise = start - where start = instanceHeadRange hd + where + start = instanceHeadRange hd instanceHeadRange :: InstanceHead a -> TokenRange -instanceHeadRange (InstanceHead kw _ _ cls types) +instanceHeadRange (InstanceHead kw _ _ _ cls types) | [] <- types = (kw, qualTok cls) | otherwise = (kw, snd . typeRange $ last types) @@ -281,7 +287,7 @@ exprRange = \case ExprChar _ a _ -> (a, a) ExprString _ a _ -> (a, a) ExprNumber _ a _ -> (a, a) - ExprArray _ a -> wrappedRange a + ExprList _ a -> wrappedRange a ExprRecord _ a -> wrappedRange a ExprParens _ a -> wrappedRange a ExprTyped _ a _ b -> (fst $ exprRange a, snd $ typeRange b) @@ -297,7 +303,7 @@ exprRange = \case ExprIf _ (IfThenElse a _ _ _ _ b) -> (a, snd $ exprRange b) ExprCase _ (CaseOf a _ _ c) -> (a, snd . guardedRange . snd $ NE.last c) ExprLet _ (LetIn a _ _ b) -> (a, snd $ exprRange b) - ExprDo _ (DoBlock a b) -> (a, snd . doStatementRange $ NE.last b) + ExprDo _ (DoBlock a b) -> (a, snd . doStatementRange $ NE.last b) ExprAdo _ (AdoBlock a _ _ b) -> (a, snd $ exprRange b) letBindingRange :: LetBinding a -> TokenRange @@ -326,7 +332,7 @@ binderRange = \case BinderNumber _ a b _ | Just a' <- a -> (a', b) | otherwise -> (b, b) - BinderArray _ a -> wrappedRange a + BinderList _ a -> wrappedRange a BinderRecord _ a -> wrappedRange a BinderParens _ a -> wrappedRange a BinderTyped _ a _ b -> (fst $ binderRange a, snd $ typeRange b) diff --git a/src/Language/PureScript/CST/Print.hs b/src/Language/PureScript/CST/Print.hs index f6d300ab6..2495d4186 100644 --- a/src/Language/PureScript/CST/Print.hs +++ b/src/Language/PureScript/CST/Print.hs @@ -1,69 +1,70 @@ --- | This is just a simple token printer. It's not a full fledged formatter, but --- it is used by the layout golden tests. Printing each token in the tree with --- this printer will result in the exact input that was given to the lexer. - -module Language.PureScript.CST.Print - ( printToken - , printTokens - , printModule - , printLeadingComment - , printTrailingComment - ) where +{- | This is just a simple token printer. It's not a full fledged formatter, but +it is used by the layout golden tests. Printing each token in the tree with +this printer will result in the exact input that was given to the lexer. +-} +module Language.PureScript.CST.Print ( + printToken, + printTokens, + printModule, + printLeadingComment, + printTrailingComment, +) where import Prelude import Data.DList qualified as DList import Data.Text (Text) import Data.Text qualified as Text -import Language.PureScript.CST.Types (Comment(..), LineFeed(..), Module, SourceStyle(..), SourceToken(..), Token(..), TokenAnn(..)) import Language.PureScript.CST.Flatten (flattenModule) +import Language.PureScript.CST.Types (Comment (..), LineFeed (..), Module, SourceStyle (..), SourceToken (..), Token (..), TokenAnn (..)) printToken :: Token -> Text printToken = printToken' True --- | Prints a given Token. The bool controls whether or not layout --- tokens should be printed. +{- | Prints a given Token. The bool controls whether or not layout +tokens should be printed. +-} printToken' :: Bool -> Token -> Text printToken' showLayout = \case - TokLeftParen -> "(" - TokRightParen -> ")" - TokLeftBrace -> "{" - TokRightBrace -> "}" - TokLeftSquare -> "[" - TokRightSquare -> "]" - TokLeftArrow ASCII -> "<-" - TokLeftArrow Unicode -> "←" - TokRightArrow ASCII -> "->" - TokRightArrow Unicode -> "→" - TokRightFatArrow ASCII -> "=>" + TokLeftParen -> "(" + TokRightParen -> ")" + TokLeftBrace -> "{" + TokRightBrace -> "}" + TokLeftSquare -> "[" + TokRightSquare -> "]" + TokLeftArrow ASCII -> "<-" + TokLeftArrow Unicode -> "←" + TokRightArrow ASCII -> "->" + TokRightArrow Unicode -> "→" + TokRightFatArrow ASCII -> "=>" TokRightFatArrow Unicode -> "⇒" - TokDoubleColon ASCII -> "::" - TokDoubleColon Unicode -> "∷" - TokForall ASCII -> "forall" - TokForall Unicode -> "∀" - TokEquals -> "=" - TokPipe -> "|" - TokTick -> "`" - TokDot -> "." - TokComma -> "," - TokUnderscore -> "_" - TokBackslash -> "\\" - TokLowerName qual name -> printQual qual <> name - TokUpperName qual name -> printQual qual <> name - TokOperator qual sym -> printQual qual <> sym - TokSymbolName qual sym -> printQual qual <> "(" <> sym <> ")" - TokSymbolArr Unicode -> "(→)" - TokSymbolArr ASCII -> "(->)" - TokHole hole -> "?" <> hole - TokChar raw _ -> "'" <> raw <> "'" - TokString raw _ -> "\"" <> raw <> "\"" - TokRawString raw -> "\"\"\"" <> raw <> "\"\"\"" - TokInt raw _ -> raw - TokNumber raw _ -> raw - TokLayoutStart -> if showLayout then "{" else "" - TokLayoutSep -> if showLayout then ";" else "" - TokLayoutEnd -> if showLayout then "}" else "" - TokEof -> if showLayout then "" else "" + TokDoubleColon ASCII -> "::" + TokDoubleColon Unicode -> "∷" + TokForall ASCII -> "forall" + TokForall Unicode -> "∀" + TokEquals -> "=" + TokPipe -> "|" + TokTick -> "`" + TokDot -> "." + TokComma -> "," + TokUnderscore -> "_" + TokBackslash -> "\\" + TokLowerName qual name -> printQual qual <> name + TokUpperName qual name -> printQual qual <> name + TokOperator qual sym -> printQual qual <> sym + TokSymbolName qual sym -> printQual qual <> "(" <> sym <> ")" + TokSymbolArr Unicode -> "(→)" + TokSymbolArr ASCII -> "(->)" + TokHole hole -> "?" <> hole + TokChar raw _ -> "'" <> raw <> "'" + TokString raw _ -> "\"" <> raw <> "\"" + TokRawString raw -> "\"\"\"" <> raw <> "\"\"\"" + TokInt raw _ -> raw + TokNumber raw _ -> raw + TokLayoutStart -> if showLayout then "{" else "" + TokLayoutSep -> if showLayout then ";" else "" + TokLayoutEnd -> if showLayout then "}" else "" + TokEof -> if showLayout then "" else "" printQual :: [Text] -> Text printQual = Text.concat . map (<> ".") @@ -74,10 +75,10 @@ printTokens = printTokens' True printTokens' :: Bool -> [SourceToken] -> Text printTokens' showLayout toks = Text.concat (map pp toks) where - pp (SourceToken (TokenAnn _ leading trailing) tok) = - Text.concat (map printLeadingComment leading) - <> printToken' showLayout tok - <> Text.concat (map printTrailingComment trailing) + pp (SourceToken (TokenAnn _ leading trailing) tok) = + Text.concat (map printLeadingComment leading) + <> printToken' showLayout tok + <> Text.concat (map printTrailingComment trailing) printModule :: Module a -> Text printModule = printTokens' False . DList.toList . flattenModule diff --git a/src/Language/PureScript/CST/Traversals.hs b/src/Language/PureScript/CST/Traversals.hs index 23532915f..b5085d093 100644 --- a/src/Language/PureScript/CST/Traversals.hs +++ b/src/Language/PureScript/CST/Traversals.hs @@ -2,10 +2,10 @@ module Language.PureScript.CST.Traversals where import Prelude -import Language.PureScript.CST.Types (Separated(..)) +import Language.PureScript.CST.Types (Separated (..)) everythingOnSeparated :: (r -> r -> r) -> (a -> r) -> Separated a -> r everythingOnSeparated op k (Separated hd tl) = go hd tl where - go a [] = k a - go a (b : bs) = k a `op` go (snd b) bs + go a [] = k a + go a (b : bs) = k a `op` go (snd b) bs diff --git a/src/Language/PureScript/CST/Traversals/Type.hs b/src/Language/PureScript/CST/Traversals/Type.hs index c61e65ca3..6421a6460 100644 --- a/src/Language/PureScript/CST/Traversals/Type.hs +++ b/src/Language/PureScript/CST/Traversals/Type.hs @@ -2,40 +2,40 @@ module Language.PureScript.CST.Traversals.Type where import Prelude -import Language.PureScript.CST.Types (Constraint(..), Labeled(..), Row(..), Type(..), Wrapped(..)) import Language.PureScript.CST.Traversals (everythingOnSeparated) +import Language.PureScript.CST.Types (Constraint (..), Labeled (..), Row (..), Type (..), Wrapped (..)) everythingOnTypes :: (r -> r -> r) -> (Type a -> r) -> Type a -> r everythingOnTypes op k = goTy where - goTy ty = case ty of - TypeVar _ _ -> k ty - TypeConstructor _ _ -> k ty - TypeWildcard _ _ -> k ty - TypeHole _ _ -> k ty - TypeString _ _ _ -> k ty - TypeInt _ _ _ _ -> k ty - TypeRow _ (Wrapped _ row _) -> goRow ty row - TypeRecord _ (Wrapped _ row _) -> goRow ty row - TypeForall _ _ _ _ ty2 -> k ty `op` goTy ty2 - TypeKinded _ ty2 _ ty3 -> k ty `op` (goTy ty2 `op` goTy ty3) - TypeApp _ ty2 ty3 -> k ty `op` (goTy ty2 `op` goTy ty3) - TypeOp _ ty2 _ ty3 -> k ty `op` (goTy ty2 `op` goTy ty3) - TypeOpName _ _ -> k ty - TypeArr _ ty2 _ ty3 -> k ty `op` (goTy ty2 `op` goTy ty3) - TypeArrName _ _ -> k ty - TypeConstrained _ (constraintTys -> ty2) _ ty3 - | null ty2 -> k ty `op` goTy ty3 - | otherwise -> k ty `op` (foldr1 op (k <$> ty2) `op` goTy ty3) - TypeParens _ (Wrapped _ ty2 _) -> k ty `op` goTy ty2 - TypeUnaryRow _ _ ty2 -> k ty `op` goTy ty2 + goTy ty = case ty of + TypeVar _ _ -> k ty + TypeConstructor _ _ -> k ty + TypeWildcard _ _ -> k ty + TypeHole _ _ -> k ty + TypeString _ _ _ -> k ty + TypeInt _ _ _ _ -> k ty + TypeRow _ (Wrapped _ row _) -> goRow ty row + TypeRecord _ (Wrapped _ row _) -> goRow ty row + TypeForall _ _ _ _ ty2 -> k ty `op` goTy ty2 + TypeKinded _ ty2 _ ty3 -> k ty `op` (goTy ty2 `op` goTy ty3) + TypeApp _ ty2 ty3 -> k ty `op` (goTy ty2 `op` goTy ty3) + TypeOp _ ty2 _ ty3 -> k ty `op` (goTy ty2 `op` goTy ty3) + TypeOpName _ _ -> k ty + TypeArr _ ty2 _ ty3 -> k ty `op` (goTy ty2 `op` goTy ty3) + TypeArrName _ _ -> k ty + TypeConstrained _ (constraintTys -> ty2) _ ty3 + | null ty2 -> k ty `op` goTy ty3 + | otherwise -> k ty `op` (foldr1 op (k <$> ty2) `op` goTy ty3) + TypeParens _ (Wrapped _ ty2 _) -> k ty `op` goTy ty2 + TypeUnaryRow _ _ ty2 -> k ty `op` goTy ty2 - goRow ty = \case - Row Nothing Nothing -> k ty - Row Nothing (Just (_, ty2)) -> k ty `op` goTy ty2 - Row (Just lbls) Nothing -> k ty `op` everythingOnSeparated op (goTy . lblValue) lbls - Row (Just lbls) (Just (_, ty2)) -> k ty `op` (everythingOnSeparated op (goTy . lblValue) lbls `op` goTy ty2) + goRow ty = \case + Row Nothing Nothing -> k ty + Row Nothing (Just (_, ty2)) -> k ty `op` goTy ty2 + Row (Just lbls) Nothing -> k ty `op` everythingOnSeparated op (goTy . lblValue) lbls + Row (Just lbls) (Just (_, ty2)) -> k ty `op` (everythingOnSeparated op (goTy . lblValue) lbls `op` goTy ty2) - constraintTys = \case - Constraint _ _ tys -> tys - ConstraintParens _ (Wrapped _ c _) -> constraintTys c + constraintTys = \case + Constraint _ _ tys -> tys + ConstraintParens _ (Wrapped _ c _) -> constraintTys c diff --git a/src/Language/PureScript/CST/Types.hs b/src/Language/PureScript/CST/Types.hs index a89532f1f..da04b5f49 100644 --- a/src/Language/PureScript/CST/Types.hs +++ b/src/Language/PureScript/CST/Types.hs @@ -1,10 +1,10 @@ --- | This module contains data types for the entire PureScript surface language. Every --- token is represented in the tree, and every token is annotated with --- whitespace and comments (both leading and trailing). This means one can write --- an exact printer so that `print . parse = id`. Every constructor is laid out --- with tokens in left-to-right order. The core productions are given a slot for --- arbitrary annotations, however this is not used by the parser. - +{- | This module contains data types for the entire PureScript surface language. Every +token is represented in the tree, and every token is annotated with +whitespace and comments (both leading and trailing). This means one can write +an exact printer so that `print . parse = id`. Every constructor is laid out +with tokens in left-to-right order. The core productions are given a slot for +arbitrary annotations, however this is not used by the parser. +-} module Language.PureScript.CST.Types where import Prelude @@ -14,18 +14,20 @@ import Data.Text (Text) import Data.Void (Void) import GHC.Generics (Generic) import Language.PureScript.Names qualified as N -import Language.PureScript.Roles qualified as R import Language.PureScript.PSString (PSString) +import Language.PureScript.Roles qualified as R data SourcePos = SourcePos { srcLine :: {-# UNPACK #-} !Int , srcColumn :: {-# UNPACK #-} !Int - } deriving (Show, Eq, Ord, Generic) + } + deriving (Show, Eq, Ord, Generic) data SourceRange = SourceRange { srcStart :: !SourcePos , srcEnd :: !SourcePos - } deriving (Show, Eq, Ord, Generic) + } + deriving (Show, Eq, Ord, Generic) data Comment l = Comment !Text @@ -40,7 +42,8 @@ data TokenAnn = TokenAnn { tokRange :: !SourceRange , tokLeadingComments :: ![Comment LineFeed] , tokTrailingComments :: ![Comment Void] - } deriving (Show, Eq, Ord, Generic) + } + deriving (Show, Eq, Ord, Generic) data SourceStyle = ASCII | Unicode deriving (Show, Eq, Ord, Generic) @@ -84,44 +87,52 @@ data Token data SourceToken = SourceToken { tokAnn :: !TokenAnn , tokValue :: !Token - } deriving (Show, Eq, Ord, Generic) + } + deriving (Show, Eq, Ord, Generic) data Ident = Ident { getIdent :: Text - } deriving (Show, Eq, Ord, Generic) + } + deriving (Show, Eq, Ord, Generic) data Name a = Name { nameTok :: SourceToken , nameValue :: a - } deriving (Show, Eq, Ord, Functor, Foldable, Traversable, Generic) + } + deriving (Show, Eq, Ord, Functor, Foldable, Traversable, Generic) data QualifiedName a = QualifiedName { qualTok :: SourceToken , qualModule :: Maybe N.ModuleName , qualName :: a - } deriving (Show, Eq, Ord, Functor, Foldable, Traversable, Generic) + } + deriving (Show, Eq, Ord, Functor, Foldable, Traversable, Generic) data Label = Label { lblTok :: SourceToken , lblName :: PSString - } deriving (Show, Eq, Ord, Generic) + } + deriving (Show, Eq, Ord, Generic) data Wrapped a = Wrapped { wrpOpen :: SourceToken , wrpValue :: a , wrpClose :: SourceToken - } deriving (Show, Eq, Ord, Functor, Foldable, Traversable, Generic) + } + deriving (Show, Eq, Ord, Functor, Foldable, Traversable, Generic) data Separated a = Separated { sepHead :: a , sepTail :: [(SourceToken, a)] - } deriving (Show, Eq, Ord, Functor, Foldable, Traversable, Generic) + } + deriving (Show, Eq, Ord, Functor, Foldable, Traversable, Generic) data Labeled a b = Labeled { lblLabel :: a , lblSep :: SourceToken - , lblValue :: b - } deriving (Show, Eq, Ord, Functor, Foldable, Traversable, Generic) + , lblValue :: b + } + deriving (Show, Eq, Ord, Functor, Foldable, Traversable, Generic) type Delimited a = Wrapped (Maybe (Separated a)) type DelimitedNonEmpty a = Wrapped (Separated a) @@ -165,7 +176,8 @@ data Constraint a data Row a = Row { rowLabels :: Maybe (Separated (Labeled Label (Type a))) , rowTail :: Maybe (SourceToken, Type a) - } deriving (Show, Eq, Ord, Functor, Foldable, Traversable, Generic) + } + deriving (Show, Eq, Ord, Functor, Foldable, Traversable, Generic) data Module a = Module { modAnn :: a @@ -176,7 +188,8 @@ data Module a = Module , modImports :: [ImportDecl a] , modDecls :: [Declaration a] , modTrailingComments :: [Comment LineFeed] - } deriving (Show, Eq, Ord, Functor, Foldable, Traversable, Generic) + } + deriving (Show, Eq, Ord, Functor, Foldable, Traversable, Generic) data Export a = ExportValue a (Name Ident) @@ -193,14 +206,14 @@ data DataMembers a deriving (Show, Eq, Ord, Functor, Foldable, Traversable, Generic) data Declaration a - = DeclData a (DataHead a) (Maybe (SourceToken, Separated (DataCtor a))) + = DeclKindSignature a SourceToken (Labeled (Name (N.ProperName 'N.TypeName)) (Type a)) + | DeclSignature a (Labeled (Name Ident) (Type a)) + | DeclData a (DataHead a) (Maybe (SourceToken, Separated (DataCtor a))) | DeclType a (DataHead a) SourceToken (Type a) | DeclNewtype a (DataHead a) SourceToken (Name (N.ProperName 'N.ConstructorName)) (Type a) | DeclClass a (ClassHead a) (Maybe (SourceToken, NonEmpty (Labeled (Name Ident) (Type a)))) | DeclInstanceChain a (Separated (Instance a)) | DeclDerive a SourceToken (Maybe SourceToken) (InstanceHead a) - | DeclKindSignature a SourceToken (Labeled (Name (N.ProperName 'N.TypeName)) (Type a)) - | DeclSignature a (Labeled (Name Ident) (Type a)) | DeclValue a (ValueBindingFields a) | DeclFixity a FixityFields | DeclForeign a SourceToken SourceToken (Foreign a) @@ -210,7 +223,8 @@ data Declaration a data Instance a = Instance { instHead :: InstanceHead a , instBody :: Maybe (SourceToken, NonEmpty (InstanceBinding a)) - } deriving (Show, Eq, Ord, Functor, Foldable, Traversable, Generic) + } + deriving (Show, Eq, Ord, Functor, Foldable, Traversable, Generic) data InstanceBinding a = InstanceBindingSignature a (Labeled (Name Ident) (Type a)) @@ -223,7 +237,8 @@ data ImportDecl a = ImportDecl , impModule :: Name N.ModuleName , impNames :: Maybe (Maybe SourceToken, DelimitedNonEmpty (Import a)) , impQual :: Maybe (SourceToken, Name N.ModuleName) - } deriving (Show, Eq, Ord, Functor, Foldable, Traversable, Generic) + } + deriving (Show, Eq, Ord, Functor, Foldable, Traversable, Generic) data Import a = ImportValue a (Name Ident) @@ -237,13 +252,15 @@ data DataHead a = DataHead { dataHdKeyword :: SourceToken , dataHdName :: Name (N.ProperName 'N.TypeName) , dataHdVars :: [TypeVarBinding a] - } deriving (Show, Eq, Ord, Functor, Foldable, Traversable, Generic) + } + deriving (Show, Eq, Ord, Functor, Foldable, Traversable, Generic) data DataCtor a = DataCtor { dataCtorAnn :: a , dataCtorName :: Name (N.ProperName 'N.ConstructorName) , dataCtorFields :: [Type a] - } deriving (Show, Eq, Ord, Functor, Foldable, Traversable, Generic) + } + deriving (Show, Eq, Ord, Functor, Foldable, Traversable, Generic) data ClassHead a = ClassHead { clsKeyword :: SourceToken @@ -251,7 +268,8 @@ data ClassHead a = ClassHead , clsName :: Name (N.ProperName 'N.ClassName) , clsVars :: [TypeVarBinding a] , clsFundeps :: Maybe (SourceToken, Separated ClassFundep) - } deriving (Show, Eq, Ord, Functor, Foldable, Traversable, Generic) + } + deriving (Show, Eq, Ord, Functor, Foldable, Traversable, Generic) data ClassFundep = FundepDetermined SourceToken (NonEmpty (Name Ident)) @@ -260,11 +278,15 @@ data ClassFundep data InstanceHead a = InstanceHead { instKeyword :: SourceToken - , instNameSep :: Maybe (Name Ident, SourceToken) + , instForall :: Maybe (SourceToken, NonEmpty (TypeVarBinding a)) + , -- we modified the parser to disallow named instances. + -- TODO: remove `instNameSep` field. + instNameSep :: Maybe (Name Ident, SourceToken) , instConstraints :: Maybe (OneOrDelimited (Constraint a), SourceToken) , instClass :: QualifiedName (N.ProperName 'N.ClassName) , instTypes :: [Type a] - } deriving (Show, Eq, Ord, Functor, Foldable, Traversable, Generic) + } + deriving (Show, Eq, Ord, Functor, Foldable, Traversable, Generic) data Fixity = Infix @@ -281,13 +303,15 @@ data FixityFields = FixityFields { fxtKeyword :: (SourceToken, Fixity) , fxtPrec :: (SourceToken, Integer) , fxtOp :: FixityOp - } deriving (Show, Eq, Ord, Generic) + } + deriving (Show, Eq, Ord, Generic) data ValueBindingFields a = ValueBindingFields { valName :: Name Ident , valBinders :: [Binder a] , valGuarded :: Guarded a - } deriving (Show, Eq, Ord, Functor, Foldable, Traversable, Generic) + } + deriving (Show, Eq, Ord, Functor, Foldable, Traversable, Generic) data Guarded a = Unconditional SourceToken (Where a) @@ -299,12 +323,14 @@ data GuardedExpr a = GuardedExpr , grdPatterns :: Separated (PatternGuard a) , grdSep :: SourceToken , grdWhere :: Where a - } deriving (Show, Eq, Ord, Functor, Foldable, Traversable, Generic) + } + deriving (Show, Eq, Ord, Functor, Foldable, Traversable, Generic) data PatternGuard a = PatternGuard { patBinder :: Maybe (Binder a, SourceToken) , patExpr :: Expr a - } deriving (Show, Eq, Ord, Functor, Foldable, Traversable, Generic) + } + deriving (Show, Eq, Ord, Functor, Foldable, Traversable, Generic) data Foreign a = ForeignValue (Labeled (Name Ident) (Type a)) @@ -315,7 +341,8 @@ data Foreign a data Role = Role { roleTok :: SourceToken , roleValue :: R.Role - } deriving (Show, Eq, Ord, Generic) + } + deriving (Show, Eq, Ord, Generic) data Expr a = ExprHole a (Name Ident) @@ -326,7 +353,7 @@ data Expr a | ExprChar a SourceToken Char | ExprString a SourceToken PSString | ExprNumber a SourceToken (Either Integer Double) - | ExprArray a (Delimited (Expr a)) + | ExprList a (Delimited (Expr a)) | ExprRecord a (Delimited (RecordLabeled (Expr a))) | ExprParens a (Wrapped (Expr a)) | ExprTyped a (Expr a) SourceToken (Type a) @@ -360,14 +387,16 @@ data RecordAccessor a = RecordAccessor { recExpr :: Expr a , recDot :: SourceToken , recPath :: Separated Label - } deriving (Show, Eq, Ord, Functor, Foldable, Traversable, Generic) + } + deriving (Show, Eq, Ord, Functor, Foldable, Traversable, Generic) data Lambda a = Lambda { lmbSymbol :: SourceToken , lmbBinders :: NonEmpty (Binder a) , lmbArr :: SourceToken , lmbBody :: Expr a - } deriving (Show, Eq, Ord, Functor, Foldable, Traversable, Generic) + } + deriving (Show, Eq, Ord, Functor, Foldable, Traversable, Generic) data IfThenElse a = IfThenElse { iteIf :: SourceToken @@ -376,26 +405,30 @@ data IfThenElse a = IfThenElse , iteTrue :: Expr a , iteElse :: SourceToken , iteFalse :: Expr a - } deriving (Show, Eq, Ord, Functor, Foldable, Traversable, Generic) + } + deriving (Show, Eq, Ord, Functor, Foldable, Traversable, Generic) data CaseOf a = CaseOf { caseKeyword :: SourceToken , caseHead :: Separated (Expr a) , caseOf :: SourceToken , caseBranches :: NonEmpty (Separated (Binder a), Guarded a) - } deriving (Show, Eq, Ord, Functor, Foldable, Traversable, Generic) + } + deriving (Show, Eq, Ord, Functor, Foldable, Traversable, Generic) data LetIn a = LetIn { letKeyword :: SourceToken , letBindings :: NonEmpty (LetBinding a) , letIn :: SourceToken , letBody :: Expr a - } deriving (Show, Eq, Ord, Functor, Foldable, Traversable, Generic) + } + deriving (Show, Eq, Ord, Functor, Foldable, Traversable, Generic) data Where a = Where { whereExpr :: Expr a , whereBindings :: Maybe (SourceToken, NonEmpty (LetBinding a)) - } deriving (Show, Eq, Ord, Functor, Foldable, Traversable, Generic) + } + deriving (Show, Eq, Ord, Functor, Foldable, Traversable, Generic) data LetBinding a = LetBindingSignature a (Labeled (Name Ident) (Type a)) @@ -406,7 +439,8 @@ data LetBinding a data DoBlock a = DoBlock { doKeyword :: SourceToken , doStatements :: NonEmpty (DoStatement a) - } deriving (Show, Eq, Ord, Functor, Foldable, Traversable, Generic) + } + deriving (Show, Eq, Ord, Functor, Foldable, Traversable, Generic) data DoStatement a = DoLet SourceToken (NonEmpty (LetBinding a)) @@ -419,7 +453,8 @@ data AdoBlock a = AdoBlock , adoStatements :: [DoStatement a] , adoIn :: SourceToken , adoResult :: Expr a - } deriving (Show, Eq, Ord, Functor, Foldable, Traversable, Generic) + } + deriving (Show, Eq, Ord, Functor, Foldable, Traversable, Generic) data Binder a = BinderWildcard a SourceToken @@ -430,7 +465,7 @@ data Binder a | BinderChar a SourceToken Char | BinderString a SourceToken PSString | BinderNumber a (Maybe SourceToken) SourceToken (Either Integer Double) - | BinderArray a (Delimited (Binder a)) + | BinderList a (Delimited (Binder a)) | BinderRecord a (Delimited (RecordLabeled (Binder a))) | BinderParens a (Wrapped (Binder a)) | BinderTyped a (Binder a) SourceToken (Type a) diff --git a/src/Language/PureScript/CST/Utils.hs b/src/Language/PureScript/CST/Utils.hs index b941cf5fc..0032e61a1 100644 --- a/src/Language/PureScript/CST/Utils.hs +++ b/src/Language/PureScript/CST/Utils.hs @@ -11,7 +11,7 @@ import Data.Set (Set) import Data.Set qualified as Set import Data.Text (Text) import Data.Text qualified as Text -import Language.PureScript.CST.Errors (ParserErrorType(..)) +import Language.PureScript.CST.Errors (ParserErrorType (..)) import Language.PureScript.CST.Monad (Parser, addFailure, parseFail, pushBack) import Language.PureScript.CST.Positions (TokenRange, binderRange, importDeclRange, recordUpdateRange, typeRange) import Language.PureScript.CST.Traversals.Type (everythingOnTypes) @@ -19,26 +19,26 @@ import Language.PureScript.CST.Types import Language.PureScript.Names qualified as N import Language.PureScript.PSString (PSString, mkString) --- | --- A newtype for a qualified proper name whose ProperNameType has not yet been determined. --- This is a workaround for Happy's limited support for polymorphism; it is used --- inside the parser to allow us to write just one parser for qualified proper names --- which can be used for all of the different ProperNameTypes --- (via a call to getQualifiedProperName). -newtype QualifiedProperName = - QualifiedProperName { getQualifiedProperName :: forall a. QualifiedName (N.ProperName a) } +{- | +A newtype for a qualified proper name whose ProperNameType has not yet been determined. +This is a workaround for Happy's limited support for polymorphism; it is used +inside the parser to allow us to write just one parser for qualified proper names +which can be used for all of the different ProperNameTypes +(via a call to getQualifiedProperName). +-} +newtype QualifiedProperName = QualifiedProperName {getQualifiedProperName :: forall a. QualifiedName (N.ProperName a)} qualifiedProperName :: QualifiedName (N.ProperName a) -> QualifiedProperName qualifiedProperName n = QualifiedProperName (N.coerceProperName <$> n) --- | --- A newtype for a proper name whose ProperNameType has not yet been determined. --- This is a workaround for Happy's limited support for polymorphism; it is used --- inside the parser to allow us to write just one parser for proper names --- which can be used for all of the different ProperNameTypes --- (via a call to getProperName). -newtype ProperName = - ProperName { _getProperName :: forall a. Name (N.ProperName a) } +{- | +A newtype for a proper name whose ProperNameType has not yet been determined. +This is a workaround for Happy's limited support for polymorphism; it is used +inside the parser to allow us to write just one parser for proper names +which can be used for all of the different ProperNameTypes +(via a call to getProperName). +-} +newtype ProperName = ProperName {_getProperName :: forall a. Name (N.ProperName a)} properName :: Name (N.ProperName a) -> ProperName properName n = ProperName (N.coerceProperName <$> n) @@ -46,35 +46,36 @@ properName n = ProperName (N.coerceProperName <$> n) getProperName :: forall a. ProperName -> Name (N.ProperName a) getProperName pn = _getProperName pn -- eta expansion needed here due to simplified subsumption --- | --- A newtype for a qualified operator name whose OpNameType has not yet been determined. --- This is a workaround for Happy's limited support for polymorphism; it is used --- inside the parser to allow us to write just one parser for qualified operator names --- which can be used for all of the different OpNameTypes --- (via a call to getQualifiedOpName). -newtype QualifiedOpName = - QualifiedOpName { getQualifiedOpName :: forall a. QualifiedName (N.OpName a) } +{- | +A newtype for a qualified operator name whose OpNameType has not yet been determined. +This is a workaround for Happy's limited support for polymorphism; it is used +inside the parser to allow us to write just one parser for qualified operator names +which can be used for all of the different OpNameTypes +(via a call to getQualifiedOpName). +-} +newtype QualifiedOpName = QualifiedOpName {getQualifiedOpName :: forall a. QualifiedName (N.OpName a)} qualifiedOpName :: QualifiedName (N.OpName a) -> QualifiedOpName qualifiedOpName n = QualifiedOpName (N.coerceOpName <$> n) --- | --- A newtype for a operator name whose OpNameType has not yet been determined. --- This is a workaround for Happy's limited support for polymorphism; it is used --- inside the parser to allow us to write just one parser for operator names --- which can be used for all of the different OpNameTypes --- (via a call to getOpName). -newtype OpName = - OpName { getOpName :: forall a. Name (N.OpName a) } +{- | +A newtype for a operator name whose OpNameType has not yet been determined. +This is a workaround for Happy's limited support for polymorphism; it is used +inside the parser to allow us to write just one parser for operator names +which can be used for all of the different OpNameTypes +(via a call to getOpName). +-} +newtype OpName = OpName {getOpName :: forall a. Name (N.OpName a)} opName :: Name (N.OpName a) -> OpName opName n = OpName (N.coerceOpName <$> n) placeholder :: SourceToken -placeholder = SourceToken - { tokAnn = TokenAnn (SourceRange (SourcePos 0 0) (SourcePos 0 0)) [] [] - , tokValue = TokLowerName [] "" - } +placeholder = + SourceToken + { tokAnn = TokenAnn (SourceRange (SourcePos 0 0) (SourcePos 0 0)) [] [] + , tokValue = TokLowerName [] "" + } unexpectedName :: SourceToken -> Name Ident unexpectedName tok = Name tok (Ident "") @@ -85,13 +86,13 @@ unexpectedQual tok = QualifiedName tok Nothing (Ident "") unexpectedLabel :: SourceToken -> Label unexpectedLabel tok = Label tok "" -unexpectedExpr :: Monoid a => [SourceToken] -> Expr a +unexpectedExpr :: (Monoid a) => [SourceToken] -> Expr a unexpectedExpr toks = ExprIdent mempty (unexpectedQual (head toks)) -unexpectedBinder :: Monoid a => [SourceToken] -> Binder a +unexpectedBinder :: (Monoid a) => [SourceToken] -> Binder a unexpectedBinder toks = BinderVar mempty (unexpectedName (head toks)) -unexpectedRecordUpdate :: Monoid a => [SourceToken] -> RecordUpdate a +unexpectedRecordUpdate :: (Monoid a) => [SourceToken] -> RecordUpdate a unexpectedRecordUpdate toks = RecordUpdateLeaf (unexpectedLabel (head toks)) (head toks) (unexpectedExpr toks) unexpectedRecordLabeled :: [SourceToken] -> RecordLabeled a @@ -109,9 +110,9 @@ unexpectedToks toRange toCst err old = do separated :: [(SourceToken, a)] -> Separated a separated = go [] where - go accum [(_, a)] = Separated a accum - go accum (x : xs) = go (x : accum) xs - go _ [] = internalError "Separated should not be empty" + go accum [(_, a)] = Separated a accum + go accum (x : xs) = go (x : accum) xs + go _ [] = internalError "Separated should not be empty" internalError :: String -> a internalError = error . ("Internal parser error: " <>) @@ -135,10 +136,10 @@ toQualifiedName k tok = case tokValue tok of TokLowerName q a | not (Set.member a reservedNames) -> flip (QualifiedName tok) (k a) <$> toModuleName tok q | otherwise -> addFailure [tok] ErrKeywordVar $> QualifiedName tok Nothing (k "") - TokUpperName q a -> flip (QualifiedName tok) (k a) <$> toModuleName tok q + TokUpperName q a -> flip (QualifiedName tok) (k a) <$> toModuleName tok q TokSymbolName q a -> flip (QualifiedName tok) (k a) <$> toModuleName tok q - TokOperator q a -> flip (QualifiedName tok) (k a) <$> toModuleName tok q - _ -> internalError $ "Invalid qualified name: " <> show tok + TokOperator q a -> flip (QualifiedName tok) (k a) <$> toModuleName tok q + _ -> internalError $ "Invalid qualified name: " <> show tok toName :: (Text -> a) -> SourceToken -> Parser (Name a) toName k tok = case tokValue tok of @@ -147,102 +148,102 @@ toName k tok = case tokValue tok of | otherwise -> addFailure [tok] ErrKeywordVar $> Name tok (k "") TokString _ _ -> parseFail tok ErrQuotedPun TokRawString _ -> parseFail tok ErrQuotedPun - TokUpperName [] a -> pure $ Name tok (k a) + TokUpperName [] a -> pure $ Name tok (k a) TokSymbolName [] a -> pure $ Name tok (k a) - TokOperator [] a -> pure $ Name tok (k a) - TokHole a -> pure $ Name tok (k a) - _ -> internalError $ "Invalid name: " <> show tok + TokOperator [] a -> pure $ Name tok (k a) + TokHole a -> pure $ Name tok (k a) + _ -> internalError $ "Invalid name: " <> show tok toLabel :: SourceToken -> Label toLabel tok = case tokValue tok of TokLowerName [] a -> Label tok $ mkString a - TokString _ a -> Label tok a - TokRawString a -> Label tok $ mkString a - TokForall ASCII -> Label tok $ mkString "forall" - _ -> internalError $ "Invalid label: " <> show tok + TokString _ a -> Label tok a + TokRawString a -> Label tok $ mkString a + TokForall ASCII -> Label tok $ mkString "forall" + _ -> internalError $ "Invalid label: " <> show tok toString :: SourceToken -> (SourceToken, PSString) toString tok = case tokValue tok of - TokString _ a -> (tok, a) + TokString _ a -> (tok, a) TokRawString a -> (tok, mkString a) - _ -> internalError $ "Invalid string literal: " <> show tok + _ -> internalError $ "Invalid string literal: " <> show tok toChar :: SourceToken -> (SourceToken, Char) toChar tok = case tokValue tok of TokChar _ a -> (tok, a) - _ -> internalError $ "Invalid char literal: " <> show tok + _ -> internalError $ "Invalid char literal: " <> show tok toNumber :: SourceToken -> (SourceToken, Either Integer Double) toNumber tok = case tokValue tok of - TokInt _ a -> (tok, Left a) + TokInt _ a -> (tok, Left a) TokNumber _ a -> (tok, Right a) - _ -> internalError $ "Invalid number literal: " <> show tok + _ -> internalError $ "Invalid number literal: " <> show tok toInt :: SourceToken -> (SourceToken, Integer) toInt tok = case tokValue tok of - TokInt _ a -> (tok, a) - _ -> internalError $ "Invalid integer literal: " <> show tok + TokInt _ a -> (tok, a) + _ -> internalError $ "Invalid integer literal: " <> show tok toBoolean :: SourceToken -> (SourceToken, Bool) toBoolean tok = case tokValue tok of - TokLowerName [] "true" -> (tok, True) + TokLowerName [] "true" -> (tok, True) TokLowerName [] "false" -> (tok, False) - _ -> internalError $ "Invalid boolean literal: " <> show tok + _ -> internalError $ "Invalid boolean literal: " <> show tok -toConstraint :: forall a. Monoid a => Type a -> Parser (Constraint a) +toConstraint :: forall a. (Monoid a) => Type a -> Parser (Constraint a) toConstraint = convertParens where - convertParens :: Type a -> Parser (Constraint a) - convertParens = \case - TypeParens a (Wrapped b c d) -> do - c' <- convertParens c - pure $ ConstraintParens a (Wrapped b c' d) - ty -> convert mempty [] ty - - convert :: a -> [Type a] -> Type a -> Parser (Constraint a) - convert ann acc = \case - TypeApp a lhs rhs -> convert (a <> ann) (rhs : acc) lhs - TypeConstructor a name -> do - for_ acc checkNoForalls - pure $ Constraint (a <> ann) (coerce name) acc - ty -> do - let (tok1, tok2) = typeRange ty - addFailure [tok1, tok2] ErrTypeInConstraint - pure $ Constraint mempty (QualifiedName tok1 Nothing (N.ProperName " Parser (Constraint a) + convertParens = \case + TypeParens a (Wrapped b c d) -> do + c' <- convertParens c + pure $ ConstraintParens a (Wrapped b c' d) + ty -> convert mempty [] ty + + convert :: a -> [Type a] -> Type a -> Parser (Constraint a) + convert ann acc = \case + TypeApp a lhs rhs -> convert (a <> ann) (rhs : acc) lhs + TypeConstructor a name -> do + for_ acc checkNoForalls + pure $ Constraint (a <> ann) (coerce name) acc + ty -> do + let (tok1, tok2) = typeRange ty + addFailure [tok1, tok2] ErrTypeInConstraint + pure $ Constraint mempty (QualifiedName tok1 Nothing (N.ProperName " Bool isConstrained = everythingOnTypes (||) $ \case - TypeConstrained{} -> True + TypeConstrained {} -> True _ -> False -toBinderConstructor :: Monoid a => NE.NonEmpty (Binder a) -> Parser (Binder a) +toBinderConstructor :: (Monoid a) => NE.NonEmpty (Binder a) -> Parser (Binder a) toBinderConstructor = \case BinderConstructor a name [] NE.:| bs -> pure $ BinderConstructor a name bs a NE.:| [] -> pure a a NE.:| _ -> unexpectedToks binderRange unexpectedBinder ErrExprInBinder a -toRecordFields - :: Monoid a - => Separated (Either (RecordLabeled (Expr a)) (RecordUpdate a)) - -> Parser (Either (Separated (RecordLabeled (Expr a))) (Separated (RecordUpdate a))) +toRecordFields :: + (Monoid a) => + Separated (Either (RecordLabeled (Expr a)) (RecordUpdate a)) -> + Parser (Either (Separated (RecordLabeled (Expr a))) (Separated (RecordUpdate a))) toRecordFields = \case Separated (Left a) as -> Left . Separated a <$> traverse (traverse unLeft) as Separated (Right a) as -> Right . Separated a <$> traverse (traverse unRight) as where - unLeft (Left tok) = pure tok - unLeft (Right tok) = - unexpectedToks recordUpdateRange unexpectedRecordLabeled ErrRecordUpdateInCtr tok - - unRight (Right tok) = pure tok - unRight (Left (RecordPun (Name tok _))) = do - addFailure [tok] ErrRecordPunInUpdate - pure $ unexpectedRecordUpdate [tok] - unRight (Left (RecordField _ tok _)) = do - addFailure [tok] ErrRecordCtrInUpdate - pure $ unexpectedRecordUpdate [tok] + unLeft (Left tok) = pure tok + unLeft (Right tok) = + unexpectedToks recordUpdateRange unexpectedRecordLabeled ErrRecordUpdateInCtr tok + + unRight (Right tok) = pure tok + unRight (Left (RecordPun (Name tok _))) = do + addFailure [tok] ErrRecordPunInUpdate + pure $ unexpectedRecordUpdate [tok] + unRight (Left (RecordField _ tok _)) = do + addFailure [tok] ErrRecordCtrInUpdate + pure $ unexpectedRecordUpdate [tok] checkFundeps :: ClassHead a -> Parser () checkFundeps (ClassHead _ _ _ _ Nothing) = pure () @@ -265,36 +266,36 @@ data TmpModuleDecl a | TmpChain (Separated (Declaration a)) deriving (Show) -toModuleDecls :: Monoid a => [TmpModuleDecl a] -> Parser ([ImportDecl a], [Declaration a]) +toModuleDecls :: (Monoid a) => [TmpModuleDecl a] -> Parser ([ImportDecl a], [Declaration a]) toModuleDecls = goImport [] where - goImport acc (TmpImport x : xs) = goImport (x : acc) xs - goImport acc xs = (reverse acc,) <$> goDecl [] xs - - goDecl acc [] = pure $ reverse acc - goDecl acc (TmpChain (Separated x []) : xs) = goDecl (x : acc) xs - goDecl acc (TmpChain (Separated (DeclInstanceChain a (Separated h t)) t') : xs) = do - (a', instances) <- goChain (getName h) a [] t' - goDecl (DeclInstanceChain a' (Separated h (t <> instances)) : acc) xs - goDecl acc (TmpChain (Separated _ t) : xs) = do - for_ t $ \(tok, _) -> addFailure [tok] ErrElseInDecl - goDecl acc xs - goDecl acc (TmpImport imp : xs) = do - unexpectedToks importDeclRange (const ()) ErrImportInDecl imp - goDecl acc xs - - goChain _ ann acc [] = pure (ann, reverse acc) - goChain name ann acc ((tok, DeclInstanceChain a (Separated h t)) : xs) - | eqName (getName h) name = goChain name (ann <> a) (reverse ((tok, h) : t) <> acc) xs - | otherwise = do - addFailure [qualTok $ getName h] ErrInstanceNameMismatch - goChain name ann acc xs - goChain name ann acc ((tok, _) : xs) = do - addFailure [tok] ErrElseInDecl - goChain name ann acc xs - - getName = instClass . instHead - eqName (QualifiedName _ a b) (QualifiedName _ c d) = a == c && b == d + goImport acc (TmpImport x : xs) = goImport (x : acc) xs + goImport acc xs = (reverse acc,) <$> goDecl [] xs + + goDecl acc [] = pure $ reverse acc + goDecl acc (TmpChain (Separated x []) : xs) = goDecl (x : acc) xs + goDecl acc (TmpChain (Separated (DeclInstanceChain a (Separated h t)) t') : xs) = do + (a', instances) <- goChain (getName h) a [] t' + goDecl (DeclInstanceChain a' (Separated h (t <> instances)) : acc) xs + goDecl acc (TmpChain (Separated _ t) : xs) = do + for_ t $ \(tok, _) -> addFailure [tok] ErrElseInDecl + goDecl acc xs + goDecl acc (TmpImport imp : xs) = do + unexpectedToks importDeclRange (const ()) ErrImportInDecl imp + goDecl acc xs + + goChain _ ann acc [] = pure (ann, reverse acc) + goChain name ann acc ((tok, DeclInstanceChain a (Separated h t)) : xs) + | eqName (getName h) name = goChain name (ann <> a) (reverse ((tok, h) : t) <> acc) xs + | otherwise = do + addFailure [qualTok $ getName h] ErrInstanceNameMismatch + goChain name ann acc xs + goChain name ann acc ((tok, _) : xs) = do + addFailure [tok] ErrElseInDecl + goChain name ann acc xs + + getName = instClass . instHead + eqName (QualifiedName _ a b) (QualifiedName _ c d) = a == c && b == d checkNoWildcards :: Type a -> Parser () checkNoWildcards ty = do @@ -317,39 +318,41 @@ revert :: Parser a -> SourceToken -> Parser a revert p lk = pushBack lk *> p reservedNames :: Set Text -reservedNames = Set.fromList - [ "ado" - , "case" - , "class" - , "data" - , "derive" - , "do" - , "else" - , "false" - , "forall" - , "foreign" - , "import" - , "if" - , "in" - , "infix" - , "infixl" - , "infixr" - , "instance" - , "let" - , "module" - , "newtype" - , "of" - , "true" - , "type" - , "where" - ] +reservedNames = + Set.fromList + [ "ado" + , "case" + , "class" + , "data" + , "derive" + , "do" + , "else" + , "false" + , "forall" + , "foreign" + , "import" + , "if" + , "in" + , "infix" + , "infixl" + , "infixr" + , "instance" + , "let" + , "module" + , "newtype" + , "of" + , "true" + , "type" + , "where" + ] isValidModuleNamespace :: Text -> Bool isValidModuleNamespace = Text.null . snd . Text.span (\c -> c /= '_' && c /= '\'') --- | This is to keep the @Parser.y@ file ASCII, otherwise @happy@ will break --- in non-unicode locales. --- --- Related GHC issue: https://gitlab.haskell.org/ghc/ghc/issues/8167 +{- | This is to keep the @Parser.y@ file ASCII, otherwise @happy@ will break +in non-unicode locales. + +Related GHC issue: https://gitlab.haskell.org/ghc/ghc/issues/8167 +-} isLeftFatArrow :: Text -> Bool isLeftFatArrow str = str == "<=" || str == "⇐" diff --git a/src/Language/PureScript/CodeGen.hs b/src/Language/PureScript/CodeGen.hs index 02edf9ec4..28fc65adc 100644 --- a/src/Language/PureScript/CodeGen.hs +++ b/src/Language/PureScript/CodeGen.hs @@ -1,8 +1,8 @@ --- | --- A collection of modules related to code generation: --- --- [@Language.PureScript.CodeGen.JS@] Code generator for JavaScript --- -module Language.PureScript.CodeGen (module C) where - -import Language.PureScript.CodeGen.JS as C +{- | +A collection of modules related to code generation: + + [@Language.PureScript.CodeGen.JS@] Code generator for JavaScript +-} +module Language.PureScript.CodeGen (module C) where + +import Language.PureScript.CodeGen.UPLC as C diff --git a/src/Language/PureScript/CodeGen/JS.hs b/src/Language/PureScript/CodeGen/JS.hs deleted file mode 100644 index 14d122a37..000000000 --- a/src/Language/PureScript/CodeGen/JS.hs +++ /dev/null @@ -1,519 +0,0 @@ --- | This module generates code in the core imperative representation from --- elaborated PureScript code. -module Language.PureScript.CodeGen.JS - ( module AST - , module Common - , moduleToJs - ) where - -import Prelude -import Protolude (ordNub) - -import Control.Applicative (liftA2) -import Control.Monad (forM, replicateM, void) -import Control.Monad.Except (MonadError, throwError) -import Control.Monad.Reader (MonadReader, asks) -import Control.Monad.Supply.Class (MonadSupply, freshName) -import Control.Monad.Writer (MonadWriter, runWriterT, writer) - -import Data.Bifunctor (first) -import Data.List ((\\), intersect) -import Data.List.NonEmpty qualified as NEL (nonEmpty) -import Data.Foldable qualified as F -import Data.Map qualified as M -import Data.Set qualified as S -import Data.Maybe (fromMaybe, mapMaybe, maybeToList) -import Data.Monoid (Any(..)) -import Data.String (fromString) -import Data.Text (Text) -import Data.Text qualified as T - -import Language.PureScript.AST.SourcePos (SourceSpan, displayStartEndPos) -import Language.PureScript.CodeGen.JS.Common as Common -import Language.PureScript.CoreImp.AST (AST, InitializerEffects(..), everywhere, everywhereTopDownM, withSourceSpan) -import Language.PureScript.CoreImp.AST qualified as AST -import Language.PureScript.CoreImp.Module qualified as AST -import Language.PureScript.CoreImp.Optimizer (optimize) -import Language.PureScript.CoreFn (Ann, Bind(..), Binder(..), CaseAlternative(..), ConstructorType(..), Expr(..), Guard, Literal(..), Meta(..), Module(..), extractAnn, extractBinderAnn, modifyAnn, removeComments) -import Language.PureScript.CoreFn.Laziness (applyLazinessTransform) -import Language.PureScript.Crash (internalError) -import Language.PureScript.Errors (ErrorMessageHint(..), SimpleErrorMessage(..), - MultipleErrors(..), rethrow, errorMessage, - errorMessage', rethrowWithPosition, addHint) -import Language.PureScript.Names (Ident(..), ModuleName, ProperName(..), Qualified(..), QualifiedBy(..), runIdent, runModuleName, showIdent, showQualified) -import Language.PureScript.Options (CodegenTarget(..), Options(..)) -import Language.PureScript.PSString (PSString, mkString) -import Language.PureScript.Traversals (sndM) -import Language.PureScript.Constants.Prim qualified as C - -import System.FilePath.Posix (()) - --- | Generate code in the simplified JavaScript intermediate representation for all declarations in a --- module. -moduleToJs - :: forall m - . (MonadReader Options m, MonadSupply m, MonadError MultipleErrors m) - => Module Ann - -> Maybe PSString - -> m AST.Module -moduleToJs (Module _ coms mn _ imps exps reExps foreigns decls) foreignInclude = - rethrow (addHint (ErrorInModule mn)) $ do - let usedNames = concatMap getNames decls - let imps' = ordNub $ map snd imps - let mnLookup = renameImports usedNames imps' - (jsDecls, Any needRuntimeLazy) <- runWriterT $ mapM (moduleBindToJs mn) decls - optimized <- fmap (fmap (fmap annotatePure)) . optimize (map identToJs exps) $ if needRuntimeLazy then [runtimeLazy] : jsDecls else jsDecls - F.traverse_ (F.traverse_ checkIntegers) optimized - comments <- not <$> asks optionsNoComments - let header = if comments then coms else [] - let foreign' = maybe [] (pure . AST.Import FFINamespace) $ if null foreigns then Nothing else foreignInclude - let moduleBody = concat optimized - let (S.union (M.keysSet reExps) -> usedModuleNames, renamedModuleBody) = traverse (replaceModuleAccessors mnLookup) moduleBody - let jsImports - = map (importToJs mnLookup) - . filter (flip S.member usedModuleNames) - $ (\\ (mn : C.primModules)) imps' - let foreignExps = exps `intersect` foreigns - let standardExps = exps \\ foreignExps - let reExps' = M.toList (M.withoutKeys reExps (S.fromList C.primModules)) - let jsExports - = (maybeToList . exportsToJs foreignInclude $ foreignExps) - ++ (maybeToList . exportsToJs Nothing $ standardExps) - ++ mapMaybe reExportsToJs reExps' - return $ AST.Module header (foreign' ++ jsImports) renamedModuleBody jsExports - - where - -- Adds purity annotations to top-level values for bundlers. - -- The semantics here derive from treating top-level module evaluation as pure, which lets - -- us remove any unreferenced top-level declarations. To achieve this, we wrap any non-trivial - -- top-level values in an IIFE marked with a pure annotation. - annotatePure :: AST -> AST - annotatePure = annotateOrWrap - where - annotateOrWrap = liftA2 fromMaybe pureIife maybePure - - -- If the JS is potentially effectful (in the eyes of a bundler that - -- doesn't know about PureScript), return Nothing. Otherwise, return Just - -- the JS with any needed pure annotations added, and, in the case of a - -- variable declaration, an IIFE to be annotated. - maybePure :: AST -> Maybe AST - maybePure = maybePureGen False - - -- Like maybePure, but doesn't add a pure annotation to App. This exists - -- to prevent from doubling up on annotation comments on curried - -- applications; from experimentation, it turns out that a comment on the - -- outermost App is sufficient for the entire curried chain to be - -- considered effect-free. - maybePure' :: AST -> Maybe AST - maybePure' = maybePureGen True - - maybePureGen alreadyAnnotated = \case - AST.VariableIntroduction ss name j -> Just (AST.VariableIntroduction ss name (fmap annotateOrWrap <$> j)) - AST.App ss f args -> (if alreadyAnnotated then AST.App else pureApp) ss <$> maybePure' f <*> traverse maybePure args - AST.ArrayLiteral ss jss -> AST.ArrayLiteral ss <$> traverse maybePure jss - AST.ObjectLiteral ss props -> AST.ObjectLiteral ss <$> traverse (traverse maybePure) props - AST.Comment c js -> AST.Comment c <$> maybePure js - - js@(AST.Indexer _ _ (AST.Var _ FFINamespace)) -> Just js - - js@AST.NumericLiteral{} -> Just js - js@AST.StringLiteral{} -> Just js - js@AST.BooleanLiteral{} -> Just js - js@AST.Function{} -> Just js - js@AST.Var{} -> Just js - js@AST.ModuleAccessor{} -> Just js - - _ -> Nothing - - pureIife :: AST -> AST - pureIife val = pureApp Nothing (AST.Function Nothing Nothing [] (AST.Block Nothing [AST.Return Nothing val])) [] - - pureApp :: Maybe SourceSpan -> AST -> [AST] -> AST - pureApp ss f = AST.Comment AST.PureAnnotation . AST.App ss f - - -- Extracts all declaration names from a binding group. - getNames :: Bind Ann -> [Ident] - getNames (NonRec _ ident _) = [ident] - getNames (Rec vals) = map (snd . fst) vals - - -- Creates alternative names for each module to ensure they don't collide - -- with declaration names. - renameImports :: [Ident] -> [ModuleName] -> M.Map ModuleName Text - renameImports = go M.empty - where - go :: M.Map ModuleName Text -> [Ident] -> [ModuleName] -> M.Map ModuleName Text - go acc used (mn' : mns') = - let mnj = moduleNameToJs mn' - in if mn' /= mn && Ident mnj `elem` used - then let newName = freshModuleName 1 mnj used - in go (M.insert mn' newName acc) (Ident newName : used) mns' - else go (M.insert mn' mnj acc) used mns' - go acc _ [] = acc - - freshModuleName :: Integer -> Text -> [Ident] -> Text - freshModuleName i mn' used = - let newName = mn' <> "_" <> T.pack (show i) - in if Ident newName `elem` used - then freshModuleName (i + 1) mn' used - else newName - - -- Generates JavaScript code for a module import, binding the required module - -- to the alternative - importToJs :: M.Map ModuleName Text -> ModuleName -> AST.Import - importToJs mnLookup mn' = - let mnSafe = fromMaybe (internalError "Missing value in mnLookup") $ M.lookup mn' mnLookup - in AST.Import mnSafe (moduleImportPath mn') - - -- Generates JavaScript code for exporting at least one identifier, - -- eventually from another module. - exportsToJs :: Maybe PSString -> [Ident] -> Maybe AST.Export - exportsToJs from = fmap (flip AST.Export from) . NEL.nonEmpty . fmap runIdent - - -- Generates JavaScript code for re-exporting at least one identifier from - -- from another module. - reExportsToJs :: (ModuleName, [Ident]) -> Maybe AST.Export - reExportsToJs = uncurry exportsToJs . first (Just . moduleImportPath) - - moduleImportPath :: ModuleName -> PSString - moduleImportPath mn' = fromString (".." T.unpack (runModuleName mn') "index.js") - - -- Replaces the `ModuleAccessor`s in the AST with `Indexer`s, ensuring that - -- the generated code refers to the collision-avoiding renamed module - -- imports. Also returns set of used module names. - replaceModuleAccessors :: M.Map ModuleName Text -> AST -> (S.Set ModuleName, AST) - replaceModuleAccessors mnLookup = everywhereTopDownM $ \case - AST.ModuleAccessor _ mn' name -> - let mnSafe = fromMaybe (internalError "Missing value in mnLookup") $ M.lookup mn' mnLookup - in (S.singleton mn', accessorString name $ AST.Var Nothing mnSafe) - other -> pure other - - -- Check that all integers fall within the valid int range for JavaScript. - checkIntegers :: AST -> m () - checkIntegers = void . everywhereTopDownM go - where - go :: AST -> m AST - go (AST.Unary _ AST.Negate (AST.NumericLiteral ss (Left i))) = - -- Move the negation inside the literal; since this is a top-down - -- traversal doing this replacement will stop the next case from raising - -- the error when attempting to use -2147483648, as if left unrewritten - -- the value is `Unary Negate (NumericLiteral (Left 2147483648))`, and - -- 2147483648 is larger than the maximum allowed int. - return $ AST.NumericLiteral ss (Left (-i)) - go js@(AST.NumericLiteral ss (Left i)) = - let minInt = -2147483648 - maxInt = 2147483647 - in if i < minInt || i > maxInt - then throwError . maybe errorMessage errorMessage' ss $ IntOutOfRange i "JavaScript" minInt maxInt - else return js - go other = return other - - runtimeLazy :: AST - runtimeLazy = - AST.VariableIntroduction Nothing "$runtime_lazy" . Just . (UnknownEffects, ) . AST.Function Nothing Nothing ["name", "moduleName", "init"] . AST.Block Nothing $ - [ AST.VariableIntroduction Nothing "state" . Just . (UnknownEffects, ) . AST.NumericLiteral Nothing $ Left 0 - , AST.VariableIntroduction Nothing "val" Nothing - , AST.Return Nothing . AST.Function Nothing Nothing ["lineNumber"] . AST.Block Nothing $ - [ AST.IfElse Nothing (AST.Binary Nothing AST.EqualTo (AST.Var Nothing "state") (AST.NumericLiteral Nothing (Left 2))) (AST.Return Nothing $ AST.Var Nothing "val") Nothing - , AST.IfElse Nothing (AST.Binary Nothing AST.EqualTo (AST.Var Nothing "state") (AST.NumericLiteral Nothing (Left 1))) (AST.Throw Nothing $ AST.Unary Nothing AST.New (AST.App Nothing (AST.Var Nothing "ReferenceError") [foldl1 (AST.Binary Nothing AST.Add) - [ AST.Var Nothing "name" - , AST.StringLiteral Nothing " was needed before it finished initializing (module " - , AST.Var Nothing "moduleName" - , AST.StringLiteral Nothing ", line " - , AST.Var Nothing "lineNumber" - , AST.StringLiteral Nothing ")" - ], AST.Var Nothing "moduleName", AST.Var Nothing "lineNumber"])) Nothing - , AST.Assignment Nothing (AST.Var Nothing "state") . AST.NumericLiteral Nothing $ Left 1 - , AST.Assignment Nothing (AST.Var Nothing "val") $ AST.App Nothing (AST.Var Nothing "init") [] - , AST.Assignment Nothing (AST.Var Nothing "state") . AST.NumericLiteral Nothing $ Left 2 - , AST.Return Nothing $ AST.Var Nothing "val" - ] - ] - - -moduleBindToJs - :: forall m - . (MonadReader Options m, MonadSupply m, MonadWriter Any m, MonadError MultipleErrors m) - => ModuleName - -> Bind Ann - -> m [AST] -moduleBindToJs mn = bindToJs - where - -- Generate code in the simplified JavaScript intermediate representation for a declaration - bindToJs :: Bind Ann -> m [AST] - bindToJs (NonRec (_, _, Just IsTypeClassConstructor) _ _) = pure [] - -- Unlike other newtype constructors, type class constructors are only - -- ever applied; it's not possible to use them as values. So it's safe to - -- erase them. - bindToJs (NonRec ann ident val) = return <$> nonRecToJS ann ident val - bindToJs (Rec vals) = writer (applyLazinessTransform mn vals) >>= traverse (uncurry . uncurry $ nonRecToJS) - - -- Generate code in the simplified JavaScript intermediate representation for a single non-recursive - -- declaration. - -- - -- The main purpose of this function is to handle code generation for comments. - nonRecToJS :: Ann -> Ident -> Expr Ann -> m AST - nonRecToJS a i e@(extractAnn -> (_, com, _)) | not (null com) = do - withoutComment <- asks optionsNoComments - if withoutComment - then nonRecToJS a i (modifyAnn removeComments e) - else AST.Comment (AST.SourceComments com) <$> nonRecToJS a i (modifyAnn removeComments e) - nonRecToJS (ss, _, _) ident val = do - js <- valueToJs val - withPos ss $ AST.VariableIntroduction Nothing (identToJs ident) (Just (guessEffects val, js)) - - guessEffects :: Expr Ann -> AST.InitializerEffects - guessEffects = \case - Var _ (Qualified (BySourcePos _) _) -> NoEffects - App (_, _, Just IsSyntheticApp) _ _ -> NoEffects - _ -> UnknownEffects - - withPos :: SourceSpan -> AST -> m AST - withPos ss js = do - withSM <- asks (elem JSSourceMap . optionsCodegenTargets) - return $ if withSM - then withSourceSpan ss js - else js - - -- Generate code in the simplified JavaScript intermediate representation for a variable based on a - -- PureScript identifier. - var :: Ident -> AST - var = AST.Var Nothing . identToJs - - -- Generate code in the simplified JavaScript intermediate representation for a value or expression. - valueToJs :: Expr Ann -> m AST - valueToJs e = - let (ss, _, _) = extractAnn e in - withPos ss =<< valueToJs' e - - valueToJs' :: Expr Ann -> m AST - valueToJs' (Literal (pos, _, _) l) = - rethrowWithPosition pos $ literalToValueJS pos l - valueToJs' (Var (_, _, Just (IsConstructor _ [])) name) = - return $ accessorString "value" $ qualifiedToJS id name - valueToJs' (Var (_, _, Just (IsConstructor _ _)) name) = - return $ accessorString "create" $ qualifiedToJS id name - valueToJs' (Accessor _ prop val) = - accessorString prop <$> valueToJs val - valueToJs' (ObjectUpdate (pos, _, _) o copy ps) = do - obj <- valueToJs o - sts <- mapM (sndM valueToJs) ps - case copy of - Nothing -> extendObj obj sts - Just names -> pure $ AST.ObjectLiteral (Just pos) (map f names ++ sts) - where f name = (name, accessorString name obj) - valueToJs' (Abs _ arg val) = do - ret <- valueToJs val - let jsArg = case arg of - UnusedIdent -> [] - _ -> [identToJs arg] - return $ AST.Function Nothing Nothing jsArg (AST.Block Nothing [AST.Return Nothing ret]) - valueToJs' e@App{} = do - let (f, args) = unApp e [] - args' <- mapM valueToJs args - case f of - Var (_, _, Just IsNewtype) _ -> return (head args') - Var (_, _, Just (IsConstructor _ fields)) name | length args == length fields -> - return $ AST.Unary Nothing AST.New $ AST.App Nothing (qualifiedToJS id name) args' - _ -> flip (foldl (\fn a -> AST.App Nothing fn [a])) args' <$> valueToJs f - where - unApp :: Expr Ann -> [Expr Ann] -> (Expr Ann, [Expr Ann]) - unApp (App _ val arg) args = unApp val (arg : args) - unApp other args = (other, args) - valueToJs' (Var (_, _, Just IsForeign) qi@(Qualified (ByModuleName mn') ident)) = - return $ if mn' == mn - then foreignIdent ident - else varToJs qi - valueToJs' (Var (_, _, Just IsForeign) ident) = - internalError $ "Encountered an unqualified reference to a foreign ident " ++ T.unpack (showQualified showIdent ident) - valueToJs' (Var _ ident) = return $ varToJs ident - valueToJs' (Case (ss, _, _) values binders) = do - vals <- mapM valueToJs values - bindersToJs ss binders vals - valueToJs' (Let _ ds val) = do - ds' <- concat <$> mapM bindToJs ds - ret <- valueToJs val - return $ AST.App Nothing (AST.Function Nothing Nothing [] (AST.Block Nothing (ds' ++ [AST.Return Nothing ret]))) [] - valueToJs' (Constructor (_, _, Just IsNewtype) _ ctor _) = - return $ AST.VariableIntroduction Nothing (properToJs ctor) (Just . (UnknownEffects, ) $ - AST.ObjectLiteral Nothing [("create", - AST.Function Nothing Nothing ["value"] - (AST.Block Nothing [AST.Return Nothing $ AST.Var Nothing "value"]))]) - valueToJs' (Constructor _ _ ctor []) = - return $ iife (properToJs ctor) [ AST.Function Nothing (Just (properToJs ctor)) [] (AST.Block Nothing []) - , AST.Assignment Nothing (accessorString "value" (AST.Var Nothing (properToJs ctor))) - (AST.Unary Nothing AST.New $ AST.App Nothing (AST.Var Nothing (properToJs ctor)) []) ] - valueToJs' (Constructor _ _ ctor fields) = - let constructor = - let body = [ AST.Assignment Nothing ((accessorString $ mkString $ identToJs f) (AST.Var Nothing "this")) (var f) | f <- fields ] - in AST.Function Nothing (Just (properToJs ctor)) (identToJs `map` fields) (AST.Block Nothing body) - createFn = - let body = AST.Unary Nothing AST.New $ AST.App Nothing (AST.Var Nothing (properToJs ctor)) (var `map` fields) - in foldr (\f inner -> AST.Function Nothing Nothing [identToJs f] (AST.Block Nothing [AST.Return Nothing inner])) body fields - in return $ iife (properToJs ctor) [ constructor - , AST.Assignment Nothing (accessorString "create" (AST.Var Nothing (properToJs ctor))) createFn - ] - - iife :: Text -> [AST] -> AST - iife v exprs = AST.App Nothing (AST.Function Nothing Nothing [] (AST.Block Nothing $ exprs ++ [AST.Return Nothing $ AST.Var Nothing v])) [] - - literalToValueJS :: SourceSpan -> Literal (Expr Ann) -> m AST - literalToValueJS ss (NumericLiteral (Left i)) = return $ AST.NumericLiteral (Just ss) (Left i) - literalToValueJS ss (NumericLiteral (Right n)) = return $ AST.NumericLiteral (Just ss) (Right n) - literalToValueJS ss (StringLiteral s) = return $ AST.StringLiteral (Just ss) s - literalToValueJS ss (CharLiteral c) = return $ AST.StringLiteral (Just ss) (fromString [c]) - literalToValueJS ss (BooleanLiteral b) = return $ AST.BooleanLiteral (Just ss) b - literalToValueJS ss (ArrayLiteral xs) = AST.ArrayLiteral (Just ss) <$> mapM valueToJs xs - literalToValueJS ss (ObjectLiteral ps) = AST.ObjectLiteral (Just ss) <$> mapM (sndM valueToJs) ps - - -- Shallow copy an object. - extendObj :: AST -> [(PSString, AST)] -> m AST - extendObj obj sts = do - newObj <- freshName - key <- freshName - evaluatedObj <- freshName - let - jsKey = AST.Var Nothing key - jsNewObj = AST.Var Nothing newObj - jsEvaluatedObj = AST.Var Nothing evaluatedObj - block = AST.Block Nothing (evaluate:objAssign:copy:extend ++ [AST.Return Nothing jsNewObj]) - evaluate = AST.VariableIntroduction Nothing evaluatedObj (Just (UnknownEffects, obj)) - objAssign = AST.VariableIntroduction Nothing newObj (Just (NoEffects, AST.ObjectLiteral Nothing [])) - copy = AST.ForIn Nothing key jsEvaluatedObj $ AST.Block Nothing [AST.IfElse Nothing cond assign Nothing] - cond = AST.App Nothing (accessorString "call" (accessorString "hasOwnProperty" (AST.ObjectLiteral Nothing []))) [jsEvaluatedObj, jsKey] - assign = AST.Block Nothing [AST.Assignment Nothing (AST.Indexer Nothing jsKey jsNewObj) (AST.Indexer Nothing jsKey jsEvaluatedObj)] - stToAssign (s, js) = AST.Assignment Nothing (accessorString s jsNewObj) js - extend = map stToAssign sts - return $ AST.App Nothing (AST.Function Nothing Nothing [] block) [] - - -- Generate code in the simplified JavaScript intermediate representation for a reference to a - -- variable. - varToJs :: Qualified Ident -> AST - varToJs (Qualified (BySourcePos _) ident) = var ident - varToJs qual = qualifiedToJS id qual - - -- Generate code in the simplified JavaScript intermediate representation for a reference to a - -- variable that may have a qualified name. - qualifiedToJS :: (a -> Ident) -> Qualified a -> AST - qualifiedToJS f (Qualified (ByModuleName C.M_Prim) a) = AST.Var Nothing . runIdent $ f a - qualifiedToJS f (Qualified (ByModuleName mn') a) | mn /= mn' = AST.ModuleAccessor Nothing mn' . mkString . T.concatMap identCharToText . runIdent $ f a - qualifiedToJS f (Qualified _ a) = AST.Var Nothing $ identToJs (f a) - - foreignIdent :: Ident -> AST - foreignIdent ident = accessorString (mkString $ runIdent ident) (AST.Var Nothing FFINamespace) - - -- Generate code in the simplified JavaScript intermediate representation for pattern match binders - -- and guards. - bindersToJs :: SourceSpan -> [CaseAlternative Ann] -> [AST] -> m AST - bindersToJs ss binders vals = do - valNames <- replicateM (length vals) freshName - let assignments = zipWith (AST.VariableIntroduction Nothing) valNames (map (Just . (UnknownEffects, )) vals) - jss <- forM binders $ \(CaseAlternative bs result) -> do - ret <- guardsToJs result - go valNames ret bs - return $ AST.App Nothing (AST.Function Nothing Nothing [] (AST.Block Nothing (assignments ++ concat jss ++ [AST.Throw Nothing $ failedPatternError valNames]))) - [] - where - go :: [Text] -> [AST] -> [Binder Ann] -> m [AST] - go _ done [] = return done - go (v:vs) done' (b:bs) = do - done'' <- go vs done' bs - binderToJs v done'' b - go _ _ _ = internalError "Invalid arguments to bindersToJs" - - failedPatternError :: [Text] -> AST - failedPatternError names = AST.Unary Nothing AST.New $ AST.App Nothing (AST.Var Nothing "Error") [AST.Binary Nothing AST.Add (AST.StringLiteral Nothing $ mkString failedPatternMessage) (AST.ArrayLiteral Nothing $ zipWith valueError names vals)] - - failedPatternMessage :: Text - failedPatternMessage = "Failed pattern match at " <> runModuleName mn <> " " <> displayStartEndPos ss <> ": " - - valueError :: Text -> AST -> AST - valueError _ l@(AST.NumericLiteral _ _) = l - valueError _ l@(AST.StringLiteral _ _) = l - valueError _ l@(AST.BooleanLiteral _ _) = l - valueError s _ = accessorString "name" . accessorString "constructor" $ AST.Var Nothing s - - guardsToJs :: Either [(Guard Ann, Expr Ann)] (Expr Ann) -> m [AST] - guardsToJs (Left gs) = traverse genGuard gs where - genGuard (cond, val) = do - cond' <- valueToJs cond - val' <- valueToJs val - return - (AST.IfElse Nothing cond' - (AST.Block Nothing [AST.Return Nothing val']) Nothing) - - guardsToJs (Right v) = return . AST.Return Nothing <$> valueToJs v - - binderToJs :: Text -> [AST] -> Binder Ann -> m [AST] - binderToJs s done binder = - let (ss, _, _) = extractBinderAnn binder in - traverse (withPos ss) =<< binderToJs' s done binder - - -- Generate code in the simplified JavaScript intermediate representation for a pattern match - -- binder. - binderToJs' :: Text -> [AST] -> Binder Ann -> m [AST] - binderToJs' _ done NullBinder{} = return done - binderToJs' varName done (LiteralBinder _ l) = - literalToBinderJS varName done l - binderToJs' varName done (VarBinder _ ident) = - return (AST.VariableIntroduction Nothing (identToJs ident) (Just (NoEffects, AST.Var Nothing varName)) : done) - binderToJs' varName done (ConstructorBinder (_, _, Just IsNewtype) _ _ [b]) = - binderToJs varName done b - binderToJs' varName done (ConstructorBinder (_, _, Just (IsConstructor ctorType fields)) _ ctor bs) = do - js <- go (zip fields bs) done - return $ case ctorType of - ProductType -> js - SumType -> - [AST.IfElse Nothing (AST.InstanceOf Nothing (AST.Var Nothing varName) (qualifiedToJS (Ident . runProperName) ctor)) - (AST.Block Nothing js) - Nothing] - where - go :: [(Ident, Binder Ann)] -> [AST] -> m [AST] - go [] done' = return done' - go ((field, binder) : remain) done' = do - argVar <- freshName - done'' <- go remain done' - js <- binderToJs argVar done'' binder - return (AST.VariableIntroduction Nothing argVar (Just (UnknownEffects, accessorString (mkString $ identToJs field) $ AST.Var Nothing varName)) : js) - binderToJs' _ _ ConstructorBinder{} = - internalError "binderToJs: Invalid ConstructorBinder in binderToJs" - binderToJs' varName done (NamedBinder _ ident binder) = do - js <- binderToJs varName done binder - return (AST.VariableIntroduction Nothing (identToJs ident) (Just (NoEffects, AST.Var Nothing varName)) : js) - - literalToBinderJS :: Text -> [AST] -> Literal (Binder Ann) -> m [AST] - literalToBinderJS varName done (NumericLiteral num) = - return [AST.IfElse Nothing (AST.Binary Nothing AST.EqualTo (AST.Var Nothing varName) (AST.NumericLiteral Nothing num)) (AST.Block Nothing done) Nothing] - literalToBinderJS varName done (CharLiteral c) = - return [AST.IfElse Nothing (AST.Binary Nothing AST.EqualTo (AST.Var Nothing varName) (AST.StringLiteral Nothing (fromString [c]))) (AST.Block Nothing done) Nothing] - literalToBinderJS varName done (StringLiteral str) = - return [AST.IfElse Nothing (AST.Binary Nothing AST.EqualTo (AST.Var Nothing varName) (AST.StringLiteral Nothing str)) (AST.Block Nothing done) Nothing] - literalToBinderJS varName done (BooleanLiteral True) = - return [AST.IfElse Nothing (AST.Var Nothing varName) (AST.Block Nothing done) Nothing] - literalToBinderJS varName done (BooleanLiteral False) = - return [AST.IfElse Nothing (AST.Unary Nothing AST.Not (AST.Var Nothing varName)) (AST.Block Nothing done) Nothing] - literalToBinderJS varName done (ObjectLiteral bs) = go done bs - where - go :: [AST] -> [(PSString, Binder Ann)] -> m [AST] - go done' [] = return done' - go done' ((prop, binder):bs') = do - propVar <- freshName - done'' <- go done' bs' - js <- binderToJs propVar done'' binder - return (AST.VariableIntroduction Nothing propVar (Just (UnknownEffects, accessorString prop (AST.Var Nothing varName))) : js) - literalToBinderJS varName done (ArrayLiteral bs) = do - js <- go done 0 bs - return [AST.IfElse Nothing (AST.Binary Nothing AST.EqualTo (accessorString "length" (AST.Var Nothing varName)) (AST.NumericLiteral Nothing (Left (fromIntegral $ length bs)))) (AST.Block Nothing js) Nothing] - where - go :: [AST] -> Integer -> [Binder Ann] -> m [AST] - go done' _ [] = return done' - go done' index (binder:bs') = do - elVar <- freshName - done'' <- go done' (index + 1) bs' - js <- binderToJs elVar done'' binder - return (AST.VariableIntroduction Nothing elVar (Just (UnknownEffects, AST.Indexer Nothing (AST.NumericLiteral Nothing (Left index)) (AST.Var Nothing varName))) : js) - -accessorString :: PSString -> AST -> AST -accessorString prop = AST.Indexer Nothing (AST.StringLiteral Nothing prop) - -pattern FFINamespace :: Text -pattern FFINamespace = "$foreign" diff --git a/src/Language/PureScript/CodeGen/JS/Common.hs b/src/Language/PureScript/CodeGen/JS/Common.hs deleted file mode 100644 index e02946890..000000000 --- a/src/Language/PureScript/CodeGen/JS/Common.hs +++ /dev/null @@ -1,249 +0,0 @@ --- | Common code generation utility functions -module Language.PureScript.CodeGen.JS.Common where - -import Prelude - -import Data.Char (isAlpha, isAlphaNum, isDigit, ord) -import Data.Text (Text) -import Data.Text qualified as T - -import Language.PureScript.Crash (internalError) -import Language.PureScript.Names (Ident(..), InternalIdentData(..), ModuleName(..), ProperName(..), unusedIdent) - -moduleNameToJs :: ModuleName -> Text -moduleNameToJs (ModuleName mn) = - let name = T.replace "." "_" mn - in if nameIsJsBuiltIn name then "$$" <> name else name - --- | Convert an 'Ident' into a valid JavaScript identifier: --- --- * Alphanumeric characters are kept unmodified. --- --- * Reserved javascript identifiers and identifiers starting with digits are --- prefixed with '$$'. -identToJs :: Ident -> Text -identToJs (Ident name) - | not (T.null name) && isDigit (T.head name) = "$$" <> T.concatMap identCharToText name - | otherwise = anyNameToJs name -identToJs (GenIdent _ _) = internalError "GenIdent in identToJs" -identToJs UnusedIdent = unusedIdent -identToJs (InternalIdent RuntimeLazyFactory) = "$runtime_lazy" -identToJs (InternalIdent (Lazy name)) = "$lazy_" <> anyNameToJs name - --- | Convert a 'ProperName' into a valid JavaScript identifier: --- --- * Alphanumeric characters are kept unmodified. --- --- * Reserved javascript identifiers are prefixed with '$$'. -properToJs :: ProperName a -> Text -properToJs = anyNameToJs . runProperName - --- | Convert any name into a valid JavaScript identifier. --- --- Note that this function assumes that the argument is a valid PureScript --- identifier (either an 'Ident' or a 'ProperName') to begin with; as such it --- will not produce valid JavaScript identifiers if the argument e.g. begins --- with a digit. Prefer 'identToJs' or 'properToJs' where possible. -anyNameToJs :: Text -> Text -anyNameToJs name - | nameIsJsReserved name || nameIsJsBuiltIn name = "$$" <> name - | otherwise = T.concatMap identCharToText name - --- | Test if a string is a valid JavaScript identifier as-is. Note that, while --- a return value of 'True' guarantees that the string is a valid JS --- identifier, a return value of 'False' does not guarantee that the string is --- not a valid JS identifier. That is, this check is more conservative than --- absolutely necessary. -isValidJsIdentifier :: Text -> Bool -isValidJsIdentifier s = - not (T.null s) && - isAlpha (T.head s) && - s == anyNameToJs s - --- | Attempts to find a human-readable name for a symbol, if none has been specified returns the --- ordinal value. -identCharToText :: Char -> Text -identCharToText c | isAlphaNum c = T.singleton c -identCharToText '_' = "_" -identCharToText '.' = "$dot" -identCharToText '$' = "$dollar" -identCharToText '~' = "$tilde" -identCharToText '=' = "$eq" -identCharToText '<' = "$less" -identCharToText '>' = "$greater" -identCharToText '!' = "$bang" -identCharToText '#' = "$hash" -identCharToText '%' = "$percent" -identCharToText '^' = "$up" -identCharToText '&' = "$amp" -identCharToText '|' = "$bar" -identCharToText '*' = "$times" -identCharToText '/' = "$div" -identCharToText '+' = "$plus" -identCharToText '-' = "$minus" -identCharToText ':' = "$colon" -identCharToText '\\' = "$bslash" -identCharToText '?' = "$qmark" -identCharToText '@' = "$at" -identCharToText '\'' = "$prime" -identCharToText c = '$' `T.cons` T.pack (show (ord c)) - --- | Checks whether an identifier name is reserved in JavaScript. -nameIsJsReserved :: Text -> Bool -nameIsJsReserved name = - name `elem` jsAnyReserved - --- | Checks whether a name matches a built-in value in JavaScript. -nameIsJsBuiltIn :: Text -> Bool -nameIsJsBuiltIn name = - name `elem` - [ "arguments" - , "Array" - , "ArrayBuffer" - , "Boolean" - , "DataView" - , "Date" - , "decodeURI" - , "decodeURIComponent" - , "encodeURI" - , "encodeURIComponent" - , "Error" - , "escape" - , "eval" - , "EvalError" - , "Float32Array" - , "Float64Array" - , "Function" - , "Infinity" - , "Int16Array" - , "Int32Array" - , "Int8Array" - , "Intl" - , "isFinite" - , "isNaN" - , "JSON" - , "Map" - , "Math" - , "NaN" - , "Number" - , "Object" - , "parseFloat" - , "parseInt" - , "Promise" - , "Proxy" - , "RangeError" - , "ReferenceError" - , "Reflect" - , "RegExp" - , "Set" - , "SIMD" - , "String" - , "Symbol" - , "SyntaxError" - , "TypeError" - , "Uint16Array" - , "Uint32Array" - , "Uint8Array" - , "Uint8ClampedArray" - , "undefined" - , "unescape" - , "URIError" - , "WeakMap" - , "WeakSet" - ] - -jsAnyReserved :: [Text] -jsAnyReserved = - concat - [ jsKeywords - , jsSometimesReserved - , jsFutureReserved - , jsFutureReservedStrict - , jsOldReserved - , jsLiterals - ] - -jsKeywords :: [Text] -jsKeywords = - [ "break" - , "case" - , "catch" - , "class" - , "const" - , "continue" - , "debugger" - , "default" - , "delete" - , "do" - , "else" - , "export" - , "extends" - , "finally" - , "for" - , "function" - , "if" - , "import" - , "in" - , "instanceof" - , "new" - , "return" - , "super" - , "switch" - , "this" - , "throw" - , "try" - , "typeof" - , "var" - , "void" - , "while" - , "with" - ] - -jsSometimesReserved :: [Text] -jsSometimesReserved = - [ "await" - , "let" - , "static" - , "yield" - ] - -jsFutureReserved :: [Text] -jsFutureReserved = - [ "enum" ] - -jsFutureReservedStrict :: [Text] -jsFutureReservedStrict = - [ "implements" - , "interface" - , "package" - , "private" - , "protected" - , "public" - ] - -jsOldReserved :: [Text] -jsOldReserved = - [ "abstract" - , "boolean" - , "byte" - , "char" - , "double" - , "final" - , "float" - , "goto" - , "int" - , "long" - , "native" - , "short" - , "synchronized" - , "throws" - , "transient" - , "volatile" - ] - -jsLiterals :: [Text] -jsLiterals = - [ "null" - , "true" - , "false" - ] diff --git a/src/Language/PureScript/CodeGen/JS/Printer.hs b/src/Language/PureScript/CodeGen/JS/Printer.hs deleted file mode 100644 index 6740e2a7a..000000000 --- a/src/Language/PureScript/CodeGen/JS/Printer.hs +++ /dev/null @@ -1,310 +0,0 @@ --- | Pretty printer for the JavaScript AST -module Language.PureScript.CodeGen.JS.Printer - ( prettyPrintJS - , prettyPrintJSWithSourceMaps - ) where - -import Prelude - -import Control.Arrow ((<+>)) -import Control.Monad (forM, mzero) -import Control.Monad.State (StateT, evalStateT) -import Control.PatternArrows (Operator(..), OperatorTable(..), Pattern(..), buildPrettyPrinter, mkPattern, mkPattern') -import Control.Arrow qualified as A - -import Data.Maybe (fromMaybe) -import Data.Text (Text) -import Data.Text qualified as T -import Data.List.NonEmpty qualified as NEL (toList) - -import Language.PureScript.AST (SourceSpan(..)) -import Language.PureScript.CodeGen.JS.Common (identCharToText, isValidJsIdentifier, nameIsJsBuiltIn, nameIsJsReserved) -import Language.PureScript.CoreImp.AST (AST(..), BinaryOperator(..), CIComments(..), UnaryOperator(..), getSourceSpan) -import Language.PureScript.CoreImp.Module (Export(..), Import(..), Module(..)) -import Language.PureScript.Comments (Comment(..)) -import Language.PureScript.Crash (internalError) -import Language.PureScript.Pretty.Common (Emit(..), PrinterState(..), SMap, StrPos(..), addMapping', currentIndent, intercalate, parensPos, runPlainString, withIndent) -import Language.PureScript.PSString (PSString, decodeString, prettyPrintStringJS) - --- TODO (Christoph): Get rid of T.unpack / pack - -literals :: (Emit gen) => Pattern PrinterState AST gen -literals = mkPattern' match' - where - match' :: (Emit gen) => AST -> StateT PrinterState Maybe gen - match' js = (addMapping' (getSourceSpan js) <>) <$> match js - - match :: (Emit gen) => AST -> StateT PrinterState Maybe gen - match (NumericLiteral _ n) = return $ emit $ T.pack $ either show show n - match (StringLiteral _ s) = return $ emit $ prettyPrintStringJS s - match (BooleanLiteral _ True) = return $ emit "true" - match (BooleanLiteral _ False) = return $ emit "false" - match (ArrayLiteral _ xs) = mconcat <$> sequence - [ return $ emit "[ " - , intercalate (emit ", ") <$> forM xs prettyPrintJS' - , return $ emit " ]" - ] - match (ObjectLiteral _ []) = return $ emit "{}" - match (ObjectLiteral _ ps) = mconcat <$> sequence - [ return $ emit "{\n" - , withIndent $ do - jss <- forM ps $ \(key, value) -> fmap ((objectPropertyToString key <> emit ": ") <>) . prettyPrintJS' $ value - indentString <- currentIndent - return $ intercalate (emit ",\n") $ map (indentString <>) jss - , return $ emit "\n" - , currentIndent - , return $ emit "}" - ] - where - objectPropertyToString :: (Emit gen) => PSString -> gen - objectPropertyToString s = - emit $ case decodeString s of - Just s' | isValidJsIdentifier s' -> - s' - _ -> - prettyPrintStringJS s - match (Block _ sts) = mconcat <$> sequence - [ return $ emit "{\n" - , withIndent $ prettyStatements sts - , return $ emit "\n" - , currentIndent - , return $ emit "}" - ] - match (Var _ ident) = return $ emit ident - match (VariableIntroduction _ ident value) = mconcat <$> sequence - [ return $ emit $ "var " <> ident - , maybe (return mempty) (fmap (emit " = " <>) . prettyPrintJS' . snd) value - ] - match (Assignment _ target value) = mconcat <$> sequence - [ prettyPrintJS' target - , return $ emit " = " - , prettyPrintJS' value - ] - match (While _ cond sts) = mconcat <$> sequence - [ return $ emit "while (" - , prettyPrintJS' cond - , return $ emit ") " - , prettyPrintJS' sts - ] - match (For _ ident start end sts) = mconcat <$> sequence - [ return $ emit $ "for (var " <> ident <> " = " - , prettyPrintJS' start - , return $ emit $ "; " <> ident <> " < " - , prettyPrintJS' end - , return $ emit $ "; " <> ident <> "++) " - , prettyPrintJS' sts - ] - match (ForIn _ ident obj sts) = mconcat <$> sequence - [ return $ emit $ "for (var " <> ident <> " in " - , prettyPrintJS' obj - , return $ emit ") " - , prettyPrintJS' sts - ] - match (IfElse _ cond thens elses) = mconcat <$> sequence - [ return $ emit "if (" - , prettyPrintJS' cond - , return $ emit ") " - , prettyPrintJS' thens - , maybe (return mempty) (fmap (emit " else " <>) . prettyPrintJS') elses - ] - match (Return _ value) = mconcat <$> sequence - [ return $ emit "return " - , prettyPrintJS' value - ] - match (ReturnNoResult _) = return $ emit "return" - match (Throw _ value) = mconcat <$> sequence - [ return $ emit "throw " - , prettyPrintJS' value - ] - match (Comment (SourceComments com) js) = mconcat <$> sequence - [ return $ emit "\n" - , mconcat <$> forM com comment - , prettyPrintJS' js - ] - match (Comment PureAnnotation js) = mconcat <$> sequence - [ return $ emit "/* #__PURE__ */ " - , prettyPrintJS' js - ] - match _ = mzero - -comment :: (Emit gen) => Comment -> StateT PrinterState Maybe gen -comment (LineComment com) = mconcat <$> sequence - [ currentIndent - , return $ emit "//" <> emit com <> emit "\n" - ] -comment (BlockComment com) = fmap mconcat $ sequence $ - [ currentIndent - , return $ emit "/**\n" - ] ++ - map asLine (T.lines com) ++ - [ currentIndent - , return $ emit " */\n" - , currentIndent - ] - where - asLine :: (Emit gen) => Text -> StateT PrinterState Maybe gen - asLine s = do - i <- currentIndent - return $ i <> emit " * " <> (emit . removeComments) s <> emit "\n" - - removeComments :: Text -> Text - removeComments t = - case T.stripPrefix "*/" t of - Just rest -> removeComments rest - Nothing -> case T.uncons t of - Just (x, xs) -> x `T.cons` removeComments xs - Nothing -> "" - -prettyImport :: (Emit gen) => Import -> StateT PrinterState Maybe gen -prettyImport (Import ident from) = - return . emit $ - "import * as " <> ident <> " from " <> prettyPrintStringJS from <> ";" - -prettyExport :: (Emit gen) => Export -> StateT PrinterState Maybe gen -prettyExport (Export idents from) = - mconcat <$> sequence - [ return $ emit "export {\n" - , withIndent $ do - let exportsStrings = emit . exportedIdentToString from <$> idents - indentString <- currentIndent - return . intercalate (emit ",\n") . NEL.toList $ (indentString <>) <$> exportsStrings - , return $ emit "\n" - , currentIndent - , return . emit $ "}" <> maybe "" ((" from " <>) . prettyPrintStringJS) from <> ";" - ] - where - exportedIdentToString Nothing ident - | nameIsJsReserved ident || nameIsJsBuiltIn ident - = "$$" <> ident <> " as " <> ident - exportedIdentToString _ "$main" - = T.concatMap identCharToText "$main" <> " as $main" - exportedIdentToString _ ident - = T.concatMap identCharToText ident - -accessor :: Pattern PrinterState AST (Text, AST) -accessor = mkPattern match - where - match (Indexer _ (StringLiteral _ prop) val) = - case decodeString prop of - Just s | isValidJsIdentifier s -> Just (s, val) - _ -> Nothing - match _ = Nothing - -indexer :: (Emit gen) => Pattern PrinterState AST (gen, AST) -indexer = mkPattern' match - where - match (Indexer _ index val) = (,) <$> prettyPrintJS' index <*> pure val - match _ = mzero - -lam :: Pattern PrinterState AST ((Maybe Text, [Text], Maybe SourceSpan), AST) -lam = mkPattern match - where - match (Function ss name args ret) = Just ((name, args, ss), ret) - match _ = Nothing - -app :: (Emit gen) => Pattern PrinterState AST (gen, AST) -app = mkPattern' match - where - match (App _ val args) = do - jss <- traverse prettyPrintJS' args - return (intercalate (emit ", ") jss, val) - match _ = mzero - -instanceOf :: Pattern PrinterState AST (AST, AST) -instanceOf = mkPattern match - where - match (InstanceOf _ val ty) = Just (val, ty) - match _ = Nothing - -unary' :: (Emit gen) => UnaryOperator -> (AST -> Text) -> Operator PrinterState AST gen -unary' op mkStr = Wrap match (<>) - where - match :: (Emit gen) => Pattern PrinterState AST (gen, AST) - match = mkPattern match' - where - match' (Unary _ op' val) | op' == op = Just (emit $ mkStr val, val) - match' _ = Nothing - -unary :: (Emit gen) => UnaryOperator -> Text -> Operator PrinterState AST gen -unary op str = unary' op (const str) - -negateOperator :: (Emit gen) => Operator PrinterState AST gen -negateOperator = unary' Negate (\v -> if isNegate v then "- " else "-") - where - isNegate (Unary _ Negate _) = True - isNegate _ = False - -binary :: (Emit gen) => BinaryOperator -> Text -> Operator PrinterState AST gen -binary op str = AssocL match (\v1 v2 -> v1 <> emit (" " <> str <> " ") <> v2) - where - match :: Pattern PrinterState AST (AST, AST) - match = mkPattern match' - where - match' (Binary _ op' v1 v2) | op' == op = Just (v1, v2) - match' _ = Nothing - -prettyStatements :: (Emit gen) => [AST] -> StateT PrinterState Maybe gen -prettyStatements sts = do - jss <- forM sts prettyPrintJS' - indentString <- currentIndent - return $ intercalate (emit "\n") $ map ((<> emit ";") . (indentString <>)) jss - -prettyModule :: (Emit gen) => Module -> StateT PrinterState Maybe gen -prettyModule Module{..} = do - header <- mconcat <$> traverse comment modHeader - imps <- traverse prettyImport modImports - body <- prettyStatements modBody - exps <- traverse prettyExport modExports - pure $ header <> intercalate (emit "\n") (imps ++ body : exps) - --- | Generate a pretty-printed string representing a collection of JavaScript expressions at the same indentation level -prettyPrintJSWithSourceMaps :: Module -> (Text, [SMap]) -prettyPrintJSWithSourceMaps js = - let StrPos (_, s, mp) = (fromMaybe (internalError "Incomplete pattern") . flip evalStateT (PrinterState 0) . prettyModule) js - in (s, mp) - -prettyPrintJS :: Module -> Text -prettyPrintJS = maybe (internalError "Incomplete pattern") runPlainString . flip evalStateT (PrinterState 0) . prettyModule - --- | Generate an indented, pretty-printed string representing a JavaScript expression -prettyPrintJS' :: (Emit gen) => AST -> StateT PrinterState Maybe gen -prettyPrintJS' = A.runKleisli $ runPattern matchValue - where - matchValue :: (Emit gen) => Pattern PrinterState AST gen - matchValue = buildPrettyPrinter operators (literals <+> fmap parensPos matchValue) - operators :: (Emit gen) => OperatorTable PrinterState AST gen - operators = - OperatorTable [ [ Wrap indexer $ \index val -> val <> emit "[" <> index <> emit "]" ] - , [ Wrap accessor $ \prop val -> val <> emit "." <> emit prop ] - , [ Wrap app $ \args val -> val <> emit "(" <> args <> emit ")" ] - , [ unary New "new " ] - , [ Wrap lam $ \(name, args, ss) ret -> addMapping' ss <> - emit ("function " - <> fromMaybe "" name - <> "(" <> intercalate ", " args <> ") ") - <> ret ] - , [ unary Not "!" - , unary BitwiseNot "~" - , unary Positive "+" - , negateOperator ] - , [ binary Multiply "*" - , binary Divide "/" - , binary Modulus "%" ] - , [ binary Add "+" - , binary Subtract "-" ] - , [ binary ShiftLeft "<<" - , binary ShiftRight ">>" - , binary ZeroFillShiftRight ">>>" ] - , [ binary LessThan "<" - , binary LessThanOrEqualTo "<=" - , binary GreaterThan ">" - , binary GreaterThanOrEqualTo ">=" - , AssocR instanceOf $ \v1 v2 -> v1 <> emit " instanceof " <> v2 ] - , [ binary EqualTo "===" - , binary NotEqualTo "!==" ] - , [ binary BitwiseAnd "&" ] - , [ binary BitwiseXor "^" ] - , [ binary BitwiseOr "|" ] - , [ binary And "&&" ] - , [ binary Or "||" ] - ] diff --git a/src/Language/PureScript/CodeGen/UPLC.hs b/src/Language/PureScript/CodeGen/UPLC.hs new file mode 100644 index 000000000..20469d8bd --- /dev/null +++ b/src/Language/PureScript/CodeGen/UPLC.hs @@ -0,0 +1,155 @@ +{-# LANGUAGE TypeApplications #-} +-- TODO: Remove this module +{-# OPTIONS_GHC -Wno-redundant-constraints #-} + +module Language.PureScript.CodeGen.UPLC where + +import Protolude ( + Maybe, + Monad, + MonadError, + MonadIO (..), + MonadReader, + MonadState, + print, + undefined, + ($), + (.), + (<$>), + ) +import Protolude.Error (error) +import Prelude (($), (.)) + +import Control.Monad.Except (MonadError) +import Control.Monad.IO.Class (MonadIO (liftIO)) +import Control.Monad.Reader (MonadReader) +import Control.Monad.Supply.Class (MonadSupply) + +import Language.PureScript.AST qualified as AST +import Language.PureScript.CoreFn (Ann, Bind, Expr (..), Literal (..), Meta, Module (..)) +import Language.PureScript.Errors (MultipleErrors (..)) +import Language.PureScript.Options (Options (..)) + +import Control.Monad.Writer.Class (MonadWriter) +import Data.String (IsString (fromString)) +import Language.PureScript.Comments (Comment) +import Language.PureScript.Names (Ident (..)) +import Language.PureScript.TypeChecker (CheckState) +import Language.PureScript.TypeChecker.Types (infer) +import Language.PureScript.Types (SourceType) +import Language.PureScript.Types qualified as T +import PlutusCore (someValue) +import PlutusCore qualified as PLC +import PlutusCore.Pretty (prettyPlcReadableDef) +import PlutusIR qualified as PIR + +-- Stolen from Ply, not 100% sure if this is what we want, i.e. maybe there should be an annotation? +type PIRProgram = PIR.Program PLC.TyName PLC.DeBruijn PLC.DefaultUni PLC.DefaultFun () + +type PIRTerm ann = PIR.Term PLC.TyName PLC.Name PLC.DefaultUni PLC.DefaultFun ann + +sourceSpan :: Ann -> AST.SourceSpan +sourceSpan (x, _, _) = x + +comments :: Ann -> [Comment] +comments (_, x, _) = x + +meta :: Ann -> Maybe Meta +meta (_, _, x) = x + +moduleToUPLC :: + forall m. + (MonadReader Options m, MonadSupply m, MonadError MultipleErrors m) => + Module (Bind Ann) SourceType SourceType Ann -> + m PIRProgram +moduleToUPLC = error "Error: UPLC Backend not yet implemented!" + +type M m = (Monad m, MonadSupply m, MonadState CheckState m, MonadError MultipleErrors m, MonadWriter MultipleErrors m) + +{- +transformExpr :: forall m b + . M m + => Expr Ann + -> m (Expr (SourceType,Ann)) +transformExpr = \case + Literal ann cfnLit -> case cfnLit of + NumericLiteral x -> do + TypedValue' <- infer $ AST.Literal (sourceSpan ann) $ NumericLiteral x + pure $ Literal + StringLiteral psString -> f ann $ AST.Literal (sourceSpan ann) $ StringLiteral psString + CharLiteral c -> f ann $ AST.Literal (sourceSpan ann) $ CharLiteral c + BooleanLiteral b -> f ann $ AST.Literal (sourceSpan ann) $ BooleanLiteral b + ArrayLiteral xs -> Literal $ ArrayLiteral $ foldExpr f <$> xs + + Constructor ann tyName ctorName fields -> undefined + Accessor ann l t -> undefined + ObjectUpdate a orig copyFields updateFields -> undefined + Abs ann identifier body -> undefined + App ann e1 e2 -> undefined + Var ann qualIdent -> undefined + Case ann es alts -> undefined + Let ann binds expr -> undefined +-} + +inferExprTypes :: + forall m a. + (MonadSupply m, MonadState CheckState m, MonadError MultipleErrors m, MonadWriter MultipleErrors m) => + Expr a -> + m (Expr (T.Type a)) +inferExprTypes = \case + _ -> undefined + +{- | nil = constr 0 [] + cons x xs = constr 1 x xs + +sopList :: forall name ann. ann -> [PIRTerm ann] -> PIRTerm ann +sopList ann = \case -- ann is the default annotation for an empty list + [] -> PIR.Constr ann 0 [] + (x:xs) -> PIR.Constr ann 1 [x,sopList ann xs] + + + +exprToTerm :: forall m ann + . (MonadReader Options m, + MonadSupply m, + MonadError MultipleErrors m, + Monoid ann + ) => Expr ann -> m (PIRTerm ann) +exprToTerm = \case + Literal ann lit -> litToTerm ann lit + Constructor ann tyName ctorName identifiers -> undefined + Accessor ann label expr -> undefined + ObjectUpdate ann expr copyFields updateFields -> undefined + Abs ann identifier expr -> do + name <- identifierToName identifier + body <- exprToTerm expr + pure $PIR.LamAbs ann name body + App ann e1 e2 -> undefined + Var ann qIdentifier -> undefined + Case ann es cas -> undefined + Let ann binds expr -> undefined + where + identifierToName :: Ident -> m PIR.Name + identifierToName = \case + GenIdent (Just nm) i -> pure $ PIR.Name nm (PLC.Unique $ fromIntegral i) + _ -> error "WIP" + + litToTerm :: ann -> Literal (Expr ann) -> m (PIRTerm ann) + litToTerm a = \case + NumericLiteral (Left integer) -> pure $ PIR.Constant a (someValue integer) + NumericLiteral (Right _double) -> error "Figure out what to do w/ Doubles" + StringLiteral psString -> do + let bs :: ByteString = fromString (show psString) + pure $ PIR.Constant a (someValue bs) + CharLiteral _char -> error "Figure out what to do with Chars" + BooleanLiteral boolean -> pure $ PIR.Constant a (someValue boolean) + ArrayLiteral array -> sopList mempty <$> traverse exprToTerm array + {\- ObjectLiterals, aka Record literals, get represented onchain as products with field order determined by lexicographic sorting of the labels. + -\} + ObjectLiteral fields -> do + let sorted = map snd . sortOn fst $ fields -- these are probably already sorted somewhere, but not 100% sure + terms <- traverse exprToTerm sorted + pure $ PIR.Constr a 0 terms -- the evaluator should use 0 based indices? i hope? +-} +printUPLC :: forall m. (MonadIO m) => PIRProgram -> m () +printUPLC program = liftIO . print $ prettyPlcReadableDef program diff --git a/src/Language/PureScript/Comments.hs b/src/Language/PureScript/Comments.hs index ee05cd9c3..179a22219 100644 --- a/src/Language/PureScript/Comments.hs +++ b/src/Language/PureScript/Comments.hs @@ -1,17 +1,17 @@ {-# LANGUAGE TemplateHaskell #-} --- | --- Defines the types of source code comments --- +{- | +Defines the types of source code comments +-} module Language.PureScript.Comments where -import Prelude import Codec.Serialise (Serialise) import Control.DeepSeq (NFData) import Data.Text (Text) import GHC.Generics (Generic) +import Prelude -import Data.Aeson.TH (Options(..), SumEncoding(..), defaultOptions, deriveJSON) +import Data.Aeson.TH (Options (..), SumEncoding (..), defaultOptions, deriveJSON) data Comment = LineComment Text @@ -21,4 +21,4 @@ data Comment instance NFData Comment instance Serialise Comment -$(deriveJSON (defaultOptions { sumEncoding = ObjectWithSingleField }) ''Comment) +$(deriveJSON (defaultOptions {sumEncoding = ObjectWithSingleField}) ''Comment) diff --git a/src/Language/PureScript/Constants/Libs.hs b/src/Language/PureScript/Constants/Libs.hs index 75c7385e0..e12104bb6 100644 --- a/src/Language/PureScript/Constants/Libs.hs +++ b/src/Language/PureScript/Constants/Libs.hs @@ -1,17 +1,18 @@ {-# LANGUAGE BlockArguments #-} {-# LANGUAGE TemplateHaskell #-} + -- | Various constants which refer to things in the Prelude and other core libraries module Language.PureScript.Constants.Libs where import Protolude qualified as P import Data.String (IsString) -import Language.PureScript.PSString (PSString) import Language.PureScript.Constants.TH qualified as TH +import Language.PureScript.PSString (PSString) -- Core lib values -stRefValue :: forall a. IsString a => a +stRefValue :: forall a. (IsString a) => a stRefValue = "value" -- Type Class Dictionary Names @@ -25,240 +26,250 @@ data EffectDictionaries = EffectDictionaries } effDictionaries :: EffectDictionaries -effDictionaries = EffectDictionaries - { edApplicativeDict = "applicativeEff" - , edBindDict = "bindEff" - , edMonadDict = "monadEff" - , edWhile = "whileE" - , edUntil = "untilE" - } +effDictionaries = + EffectDictionaries + { edApplicativeDict = "applicativeEff" + , edBindDict = "bindEff" + , edMonadDict = "monadEff" + , edWhile = "whileE" + , edUntil = "untilE" + } effectDictionaries :: EffectDictionaries -effectDictionaries = EffectDictionaries - { edApplicativeDict = "applicativeEffect" - , edBindDict = "bindEffect" - , edMonadDict = "monadEffect" - , edWhile = "whileE" - , edUntil = "untilE" - } +effectDictionaries = + EffectDictionaries + { edApplicativeDict = "applicativeEffect" + , edBindDict = "bindEffect" + , edMonadDict = "monadEffect" + , edWhile = "whileE" + , edUntil = "untilE" + } stDictionaries :: EffectDictionaries -stDictionaries = EffectDictionaries - { edApplicativeDict = "applicativeST" - , edBindDict = "bindST" - , edMonadDict = "monadST" - , edWhile = "while" - , edUntil = "until" - } - -$(TH.declare do - - -- purescript-prelude - - TH.mod "Control.Apply" do - TH.asIdent do TH.asString do TH.var "apply" - - TH.mod "Control.Applicative" do - TH.asIdent do TH.asPair do TH.asString do TH.var "pure" - - TH.mod "Control.Bind" do - TH.asPair do - TH.asString do - TH.var "bind" - TH.cls "Discard" ; TH.var "discard" - - TH.var "discardUnit" - - TH.mod "Control.Category" do - TH.asPair do - TH.asIdent do TH.var "identity" - - TH.var "categoryFn" - - TH.mod "Control.Semigroupoid" do - TH.asPair do - TH.vars ["compose", "composeFlipped"] - TH.var "semigroupoidFn" - - TH.mod "Data.Bounded" do - TH.asPair do - TH.vars ["bottom", "top"] - TH.var "boundedBoolean" +stDictionaries = + EffectDictionaries + { edApplicativeDict = "applicativeST" + , edBindDict = "bindST" + , edMonadDict = "monadST" + , edWhile = "while" + , edUntil = "until" + } + +$( TH.declare do + -- purescript-prelude + + TH.mod "Control.Apply" do + TH.asIdent do TH.asString do TH.var "apply" + + TH.mod "Control.Applicative" do + TH.asIdent do TH.asPair do TH.asString do TH.var "pure" + + TH.mod "Control.Bind" do + TH.asPair do + TH.asString do + TH.var "bind" + TH.cls "Discard" + TH.var "discard" + + TH.var "discardUnit" + + TH.mod "Control.Category" do + TH.asPair do + TH.asIdent do TH.var "identity" + + TH.var "categoryFn" + + TH.mod "Control.Semigroupoid" do + TH.asPair do + TH.vars ["compose", "composeFlipped"] + TH.var "semigroupoidFn" - TH.mod "Data.Eq" do - TH.cls "Eq" ; TH.asIdent do TH.asPair do TH.asString do TH.var "eq" - TH.cls "Eq1" ; TH.asIdent do TH.asString do TH.var "eq1" - TH.asPair do - TH.var "notEq" + TH.mod "Data.Bounded" do + TH.asPair do + TH.vars ["bottom", "top"] + TH.var "boundedBoolean" - TH.var "eqBoolean" - TH.var "eqChar" - TH.var "eqInt" - TH.var "eqNumber" - TH.var "eqString" + TH.mod "Data.Eq" do + TH.cls "Eq" + TH.asIdent do TH.asPair do TH.asString do TH.var "eq" + TH.cls "Eq1" + TH.asIdent do TH.asString do TH.var "eq1" + TH.asPair do + TH.var "notEq" - TH.mod "Data.EuclideanRing" do - TH.asPair do - TH.var "div" + TH.var "eqBoolean" + TH.var "eqChar" + TH.var "eqInt" + TH.var "eqNumber" + TH.var "eqString" - TH.var "euclideanRingNumber" + TH.mod "Data.EuclideanRing" do + TH.asPair do + TH.var "div" - TH.mod "Data.Function" do - TH.asIdent do - TH.prefixWith "function" do TH.vars ["apply", "applyFlipped"] - TH.var "const" - TH.var "flip" + TH.var "euclideanRingNumber" - TH.mod "Data.Functor" do - TH.cls "Functor" ; TH.asIdent do TH.asString do TH.var "map" + TH.mod "Data.Function" do + TH.asIdent do + TH.prefixWith "function" do TH.vars ["apply", "applyFlipped"] + TH.var "const" + TH.var "flip" - TH.mod "Data.Generic.Rep" do - TH.cls "Generic" ; TH.asIdent do TH.vars ["from", "to"] - TH.ntys ["Argument", "Constructor", "NoArguments", "NoConstructors", "Product"] - TH.dty "Sum" ["Inl", "Inr"] + TH.mod "Data.Functor" do + TH.cls "Functor"; TH.asIdent do TH.asString do TH.var "map" - TH.mod "Data.HeytingAlgebra" do - TH.asPair do - TH.asIdent do TH.vars ["conj", "disj", "not"] + TH.mod "Data.Generic.Rep" do + TH.cls "Generic" + TH.asIdent do TH.vars ["from", "to"] + TH.ntys ["Argument", "Constructor", "NoArguments", "NoConstructors", "Product"] + TH.dty "Sum" ["Inl", "Inr"] - TH.var "heytingAlgebraBoolean" + TH.mod "Data.HeytingAlgebra" do + TH.asPair do + TH.asIdent do TH.vars ["conj", "disj", "not"] - TH.mod "Data.Monoid" do - TH.asIdent do TH.var "mempty" + TH.var "heytingAlgebraBoolean" - TH.mod "Data.Ord" do - TH.cls "Ord" ; TH.asIdent do TH.asString do TH.var "compare" - TH.cls "Ord1" ; TH.asIdent do TH.asString do TH.var "compare1" - TH.asPair do - TH.vars ["greaterThan", "greaterThanOrEq", "lessThan", "lessThanOrEq"] + TH.mod "Data.Monoid" do + TH.asIdent do TH.var "mempty" - TH.var "ordBoolean" - TH.var "ordChar" - TH.var "ordInt" - TH.var "ordNumber" - TH.var "ordString" + TH.mod "Data.Ord" do + TH.cls "Ord" + TH.asIdent do TH.asString do TH.var "compare" + TH.cls "Ord1" + TH.asIdent do TH.asString do TH.var "compare1" + TH.asPair do + TH.vars ["greaterThan", "greaterThanOrEq", "lessThan", "lessThanOrEq"] - TH.mod "Data.Ordering" do - TH.dty "Ordering" ["EQ", "GT", "LT"] + TH.var "ordBoolean" + TH.var "ordChar" + TH.var "ordInt" + TH.var "ordNumber" + TH.var "ordString" - TH.mod "Data.Reflectable" do - TH.cls "Reflectable" + TH.mod "Data.Ordering" do + TH.dty "Ordering" ["EQ", "GT", "LT"] - TH.mod "Data.Ring" do - TH.asPair do - TH.asString do TH.vars ["negate", "sub"] + TH.mod "Data.Reflectable" do + TH.cls "Reflectable" - TH.var "ringInt" - TH.var "ringNumber" + TH.mod "Data.Ring" do + TH.asPair do + TH.asString do TH.vars ["negate", "sub"] - TH.mod "Data.Semigroup" do - TH.asPair do - TH.asIdent do TH.var "append" + TH.var "ringInt" + TH.var "ringNumber" - TH.var "semigroupString" + TH.mod "Data.Semigroup" do + TH.asPair do + TH.asIdent do TH.var "append" - TH.mod "Data.Semiring" do - TH.asPair do - TH.vars ["add", "mul", "one", "zero"] + TH.var "semigroupString" - TH.var "semiringInt" - TH.var "semiringNumber" + TH.mod "Data.Semiring" do + TH.asPair do + TH.vars ["add", "mul", "one", "zero"] - TH.mod "Data.Symbol" do - TH.cls "IsSymbol" + TH.var "semiringInt" + TH.var "semiringNumber" - -- purescript-arrays + TH.mod "Data.Symbol" do + TH.cls "IsSymbol" - TH.mod "Data.Array" do - TH.asPair do TH.var "unsafeIndex" + -- purescript-arrays - -- purescript-bifunctors + TH.mod "Data.Array" do + TH.asPair do TH.var "unsafeIndex" - TH.mod "Data.Bifunctor" do - TH.cls "Bifunctor" ; TH.asIdent do TH.asString do TH.var "bimap" - TH.asIdent do TH.vars ["lmap", "rmap"] + -- purescript-bifunctors - -- purescript-contravariant + TH.mod "Data.Bifunctor" do + TH.cls "Bifunctor" + TH.asIdent do TH.asString do TH.var "bimap" + TH.asIdent do TH.vars ["lmap", "rmap"] - TH.mod "Data.Functor.Contravariant" do - TH.cls "Contravariant" ; TH.asIdent do TH.asString do TH.var "cmap" + -- purescript-contravariant - -- purescript-eff + TH.mod "Data.Functor.Contravariant" do + TH.cls "Contravariant"; TH.asIdent do TH.asString do TH.var "cmap" - TH.mod "Control.Monad.Eff" (P.pure ()) + -- purescript-eff - TH.mod "Control.Monad.Eff.Uncurried" do - TH.asPair do TH.vars ["mkEffFn", "runEffFn"] + TH.mod "Control.Monad.Eff" (P.pure ()) - -- purescript-effect + TH.mod "Control.Monad.Eff.Uncurried" do + TH.asPair do TH.vars ["mkEffFn", "runEffFn"] - TH.mod "Effect" (P.pure ()) + -- purescript-effect - TH.mod "Effect.Uncurried" do - TH.asPair do TH.vars ["mkEffectFn", "runEffectFn"] + TH.mod "Effect" (P.pure ()) - -- purescript-foldable-traversable + TH.mod "Effect.Uncurried" do + TH.asPair do TH.vars ["mkEffectFn", "runEffectFn"] - TH.mod "Data.Bifoldable" do - TH.cls "Bifoldable" ; TH.asIdent do TH.asString do TH.vars ["bifoldMap", "bifoldl", "bifoldr"] + -- purescript-foldable-traversable - TH.mod "Data.Bitraversable" do - TH.cls "Bitraversable" ; TH.asString do TH.asIdent (TH.var "bitraverse"); TH.var "bisequence" - TH.asIdent do - TH.vars ["ltraverse", "rtraverse"] + TH.mod "Data.Bifoldable" do + TH.cls "Bifoldable"; TH.asIdent do TH.asString do TH.vars ["bifoldMap", "bifoldl", "bifoldr"] - TH.mod "Data.Foldable" do - TH.cls "Foldable" ; TH.asIdent do TH.asString do TH.vars ["foldMap", "foldl", "foldr"] + TH.mod "Data.Bitraversable" do + TH.cls "Bitraversable" + TH.asString do TH.asIdent (TH.var "bitraverse"); TH.var "bisequence" + TH.asIdent do + TH.vars ["ltraverse", "rtraverse"] - TH.mod "Data.Traversable" do - TH.cls "Traversable" ; TH.asString do TH.asIdent (TH.var "traverse") ; TH.var "sequence" + TH.mod "Data.Foldable" do + TH.cls "Foldable"; TH.asIdent do TH.asString do TH.vars ["foldMap", "foldl", "foldr"] - -- purescript-functions + TH.mod "Data.Traversable" do + TH.cls "Traversable"; TH.asString do TH.asIdent (TH.var "traverse"); TH.var "sequence" - TH.mod "Data.Function.Uncurried" do - TH.asPair do TH.asString do TH.vars ["mkFn", "runFn"] + -- purescript-functions - -- purescript-integers + TH.mod "Data.Function.Uncurried" do + TH.asPair do TH.asString do TH.vars ["mkFn", "runFn"] - TH.mod "Data.Int.Bits" do - TH.asPair do - TH.var "and" - TH.var "complement" - TH.var "or" - TH.var "shl" - TH.var "shr" - TH.var "xor" - TH.var "zshr" + -- purescript-integers - -- purescript-newtype + TH.mod "Data.Int.Bits" do + TH.asPair do + TH.var "and" + TH.var "complement" + TH.var "or" + TH.var "shl" + TH.var "shr" + TH.var "xor" + TH.var "zshr" - TH.mod "Data.Newtype" do - TH.cls "Newtype" + -- purescript-newtype - -- purescript-partial + TH.mod "Data.Newtype" do + TH.cls "Newtype" - TH.mod "Partial.Unsafe" do - TH.asIdent do TH.asPair do TH.var "unsafePartial" + -- purescript-partial - -- purescript-profunctor + TH.mod "Partial.Unsafe" do + TH.asIdent do TH.asPair do TH.var "unsafePartial" - TH.mod "Data.Profunctor" do - TH.cls "Profunctor" ; TH.asIdent do TH.asString do TH.var "dimap" - TH.asIdent do - TH.var "lcmap" - TH.prefixWith "profunctor" do TH.var "rmap" + -- purescript-profunctor - -- purescript-st + TH.mod "Data.Profunctor" do + TH.cls "Profunctor" + TH.asIdent do TH.asString do TH.var "dimap" + TH.asIdent do + TH.var "lcmap" + TH.prefixWith "profunctor" do TH.var "rmap" - TH.mod "Control.Monad.ST.Internal" do - TH.asPair do TH.vars ["modify", "new", "read", "run", "write"] + -- purescript-st - TH.mod "Control.Monad.ST.Uncurried" do - TH.asPair do TH.vars ["mkSTFn", "runSTFn"] + TH.mod "Control.Monad.ST.Internal" do + TH.asPair do TH.vars ["modify", "new", "read", "run", "write"] - -- purescript-unsafe-coerce + TH.mod "Control.Monad.ST.Uncurried" do + TH.asPair do TH.vars ["mkSTFn", "runSTFn"] - TH.mod "Unsafe.Coerce" do - TH.asPair do TH.var "unsafeCoerce" + -- purescript-unsafe-coerce - ) + TH.mod "Unsafe.Coerce" do + TH.asPair do TH.var "unsafeCoerce" + ) diff --git a/src/Language/PureScript/Constants/PLC.hs b/src/Language/PureScript/Constants/PLC.hs new file mode 100644 index 000000000..513f703c9 --- /dev/null +++ b/src/Language/PureScript/Constants/PLC.hs @@ -0,0 +1,10 @@ +{-# LANGUAGE QuasiQuotes #-} +{-# LANGUAGE TemplateHaskell #-} +{-# LANGUAGE TemplateHaskellQuotes #-} + +module Language.PureScript.Constants.PLC where + +import Language.PureScript.Constants.PLC.TH (mkBuiltinMap) +import PlutusCore.Default (DefaultFun) + +mkBuiltinMap ''DefaultFun diff --git a/src/Language/PureScript/Constants/PLC/TH.hs b/src/Language/PureScript/Constants/PLC/TH.hs new file mode 100644 index 000000000..9ef4452b4 --- /dev/null +++ b/src/Language/PureScript/Constants/PLC/TH.hs @@ -0,0 +1,82 @@ +{-# LANGUAGE QuasiQuotes #-} +{-# LANGUAGE TemplateHaskell #-} +{-# LANGUAGE TemplateHaskellQuotes #-} + +module Language.PureScript.Constants.PLC.TH where + +import Prelude + +import Data.Char (toLower) +import Data.Functor ((<&>)) +import Data.Map qualified as M +import Language.Haskell.TH ( + Body (NormalB), + Clause (Clause), + Dec (FunD), + Exp (AppE, ConE, ListE, LitE, TupE), + Lit (StringL), + Name, + Q, + mkName, + nameBase, + ) +import Language.Haskell.TH.Datatype ( + ConstructorInfo (ConstructorInfo, constructorName), + ConstructorVariant (NormalConstructor), + DatatypeInfo ( + DatatypeInfo, + datatypeCons, + datatypeContext, + datatypeInstTypes, + datatypeName, + datatypeVariant, + datatypeVars + ), + reifyDatatype, + ) + +isNormalNullaryCtor :: ConstructorInfo -> Bool +isNormalNullaryCtor (ConstructorInfo _ [] [] [] [] NormalConstructor) = True +isNormalNullaryCtor _ = False + +lowerName :: Name -> String +lowerName nm = case nameBase nm of + (x : xs) -> toLower x : xs + other -> other + +ctorBaseNames :: Name -> Q [String] +ctorBaseNames nm = do + DatatypeInfo {..} <- reifyDatatype nm + pure $ lowerName . constructorName <$> datatypeCons + +{- This takes the name of a Sum type w/ only Nullary constructors (t) and + creates a `Map String t` from the name (w/ a lowercase'd first char to make PS + TH machinery happy) to the corresponding constructor. + + We need this to convert to PIR. Builtin functions are free variables, and + the only information we can embed in a Var is the qualified name. During + conversion to PIR, we have to be able to lookup the Builtin that correspond to + the string in the Var. +-} +mkBuiltinMap :: Name -> Q [Dec] +mkBuiltinMap nm = do + DatatypeInfo {..} <- reifyDatatype nm + let ctors = datatypeCons + if all isNormalNullaryCtor ctors + then do + let ctorNames = constructorName <$> ctors + baseAndQualified = + ctorNames <&> \x -> + TupE + [ Just . LitE . StringL . lowerName $ x + , Just (ConE x) + ] + fromListE <- [e|M.fromList|] + let body = AppE fromListE (ListE baseAndQualified) + + pure [FunD (mkName $ lowerName nm <> "Map") [Clause [] (NormalB body) []]] + else + fail $ + "Cannot construct a Map for type " + <> show nm + <> " because at least one ctor is not a normal, nullary ctor" diff --git a/src/Language/PureScript/Constants/Prim.hs b/src/Language/PureScript/Constants/Prim.hs index 08391155d..21974871c 100644 --- a/src/Language/PureScript/Constants/Prim.hs +++ b/src/Language/PureScript/Constants/Prim.hs @@ -1,57 +1,62 @@ {-# LANGUAGE BlockArguments #-} {-# LANGUAGE TemplateHaskell #-} + -- | Various constants which refer to things in Prim module Language.PureScript.Constants.Prim where -import Language.PureScript.Names (ModuleName) +import Data.Foldable (traverse_) +import Prelude + import Language.PureScript.Constants.TH qualified as TH +import Language.PureScript.Names (ModuleName) -$(TH.declare do - TH.mod "Prim" do - TH.cls "Partial" - TH.ty "Array" - TH.ty "Boolean" - TH.ty "Char" - TH.ty "Constraint" - TH.ty "Function" - TH.ty "Int" - TH.ty "Number" - TH.ty "Record" - TH.ty "Row" - TH.ty "String" - TH.ty "Symbol" - TH.ty "Type" - TH.asIdent do TH.asString do TH.var "undefined" - - TH.mod "Prim.Boolean" do - TH.tys ["False", "True"] - - TH.mod "Prim.Coerce" do - TH.cls "Coercible" - - TH.mod "Prim.Int" do - TH.prefixWith "Int" do TH.clss ["Add", "Compare", "Mul", "ToString"] - - TH.mod "Prim.Ordering" do - TH.prefixWith "Type" do TH.ty "Ordering" - TH.tys ["EQ", "GT", "LT"] - - TH.mod "Prim.Row" do - TH.prefixWith "Row" do TH.clss ["Cons", "Lacks", "Nub", "Union"] - - TH.mod "Prim.RowList" do - TH.ty "RowList" - TH.cls "RowToList" - TH.prefixWith "RowList" do TH.tys ["Cons", "Nil"] - - TH.mod "Prim.Symbol" do - TH.prefixWith "Symbol" do TH.clss ["Append", "Compare", "Cons"] - - TH.mod "Prim.TypeError" do - TH.clss ["Fail", "Warn"] - TH.tys ["Above", "Beside", "Doc", "Quote", "QuoteLabel", "Text"] - - ) +$( TH.declare do + TH.mod "Prim" do + TH.cls "Partial" + TH.dty "List" ["Nil", "Cons"] + TH.dty "Boolean" ["False", "True"] + traverse_ (\x -> TH.dty ("Tuple" <> show x) ["Tuple" <> show x]) [1 .. 100] -- tuples + TH.ty "Char" + TH.ty "Constraint" + TH.ty "Function" + TH.ty "Int" + TH.ty "Number" + TH.ty "Record" + TH.ty "Row" + TH.ty "String" + TH.ty "Symbol" + TH.ty "Type" + TH.ty "Unit" + TH.asIdent do TH.asString do TH.var "undefined" + + TH.mod "Prim.Boolean" do + TH.tys ["False", "True"] + + TH.mod "Prim.Coerce" do + TH.cls "Coercible" + + TH.mod "Prim.Int" do + TH.prefixWith "Int" do TH.clss ["Add", "Compare", "Mul", "ToString"] + + TH.mod "Prim.Ordering" do + TH.prefixWith "Type" do TH.ty "Ordering" + TH.tys ["EQ", "GT", "LT"] + + TH.mod "Prim.Row" do + TH.prefixWith "Row" do TH.clss ["Cons", "Lacks", "Nub", "Union"] + + TH.mod "Prim.RowList" do + TH.ty "RowList" + TH.cls "RowToList" + TH.prefixWith "RowList" do TH.tys ["Cons", "Nil"] + + TH.mod "Prim.Symbol" do + TH.prefixWith "Symbol" do TH.clss ["Append", "Compare", "Cons"] + + TH.mod "Prim.TypeError" do + TH.clss ["Fail", "Warn"] + TH.tys ["Above", "Beside", "Doc", "Quote", "QuoteLabel", "Text"] + ) primModules :: [ModuleName] primModules = [M_Prim, M_Prim_Boolean, M_Prim_Coerce, M_Prim_Ordering, M_Prim_Row, M_Prim_RowList, M_Prim_Symbol, M_Prim_Int, M_Prim_TypeError] diff --git a/src/Language/PureScript/Constants/Purus.hs b/src/Language/PureScript/Constants/Purus.hs new file mode 100644 index 000000000..550557207 --- /dev/null +++ b/src/Language/PureScript/Constants/Purus.hs @@ -0,0 +1,30 @@ +{-# LANGUAGE BlockArguments #-} +{-# LANGUAGE TemplateHaskell #-} + +module Language.PureScript.Constants.Purus where + +import Data.Foldable (traverse_) +import Language.PureScript.Constants.PLC.TH +import Language.PureScript.Constants.TH qualified as TH +import PlutusCore.Default (DefaultFun) +import Prelude + +$( ctorBaseNames ''DefaultFun >>= \builtins -> TH.declare $ do + TH.mod "Builtin" do + -- We can't really TH in the primitive types of DefaultUni + -- (and anyway some of those types don't need representation + -- here, b/c they correspond to Prim types), so we define them + -- here. + -- NOTE: Integer/ByteString/Text/Unit/Bool correspond to their Prim types, this is everything else + TH.ty "BuiltinData" -- Opaque Plutus Data *Kind* (nullary) + TH.ty "BuiltinPair" + TH.ty "BuiltinList" + TH.ty "BuiltinByteString" + TH.ty "BuiltinUnit" + + -- We'll need this sooner or later + TH.ty "AsData" + + -- Generates primitives from all the builtins + TH.asIdent $ traverse_ TH.var builtins + ) diff --git a/src/Language/PureScript/Constants/TH.hs b/src/Language/PureScript/Constants/TH.hs index 2bc8a56d8..e6f0cbd08 100644 --- a/src/Language/PureScript/Constants/TH.hs +++ b/src/Language/PureScript/Constants/TH.hs @@ -1,71 +1,77 @@ {-# LANGUAGE TemplateHaskell #-} --- | This module implements an eDSL for compactly declaring pattern synonyms --- representing known PureScript modules and their members. --- --- The following example assumes this module is imported qualified as TH and --- the BlockArguments extension is used, both of which I recommend. --- --- > $(TH.declare do --- > TH.mod "Data.Foo" do --- > TH.ty "SomeType" --- > TH.asIdent do --- > TH.var "someVariable" --- > ) --- --- will become: --- --- > pattern M_Data_Foo :: ModuleName --- > pattern M_Data_Foo = ModuleName "Data.Foo" --- > --- > pattern SomeType :: Qualified (ProperName 'TypeName) --- > pattern SomeType = Qualified (ByModuleName M_Data_Foo) (ProperName "SomeType") --- > --- > pattern I_someVariable :: Qualified Ident --- > pattern I_someVariable = Qualified (ByModuleName M_Data_Foo) (Ident "someVariable") --- --- All pattern synonyms must start with an uppercase letter. To prevent --- namespace collisions, different types of pattern are distinguished by a sort --- of Hungarian notation convention: --- --- @ --- SomeType -- a type or class name --- C_Ctor -- a constructor name --- I_name -- a Qualified Ident --- M_Data_Foo -- a module name --- P_name -- a (module name, polymorphic string) pair --- S_name -- a lone polymorphic string (this doesn't contain any module information) --- @ --- --- I_, P_, and S_ patterns are all optional and have to be enabled with --- `asIdent`, `asPair`, and `asString` modifiers respectively. --- --- Finally, to disambiguate between identifiers with the same name (such as --- Data.Function.apply and Data.Apply.apply), the `prefixWith` modifier will --- modify the names of the patterns created within it. --- --- > TH.mod "Data.Function" do --- > TH.prefixWith "function" do --- > TH.asIdent do --- > TH.var "apply" --- --- results in: --- --- > pattern I_functionApply :: Qualified Ident --- > pattern I_functionApply = Qualified (ByModuleName (M_Data_Function) (Ident "apply") --- -module Language.PureScript.Constants.TH - ( declare - , mod - , cls, clss - , dty - , nty, ntys - , ty, tys - , var, vars - , prefixWith - , asIdent - , asPair - , asString - ) where + +{- | This module implements an eDSL for compactly declaring pattern synonyms +representing known PureScript modules and their members. + +The following example assumes this module is imported qualified as TH and +the BlockArguments extension is used, both of which I recommend. + +> $(TH.declare do +> TH.mod "Data.Foo" do +> TH.ty "SomeType" +> TH.asIdent do +> TH.var "someVariable" +> ) + +will become: + +> pattern M_Data_Foo :: ModuleName +> pattern M_Data_Foo = ModuleName "Data.Foo" +> +> pattern SomeType :: Qualified (ProperName 'TypeName) +> pattern SomeType = Qualified (ByModuleName M_Data_Foo) (ProperName "SomeType") +> +> pattern I_someVariable :: Qualified Ident +> pattern I_someVariable = Qualified (ByModuleName M_Data_Foo) (Ident "someVariable") + +All pattern synonyms must start with an uppercase letter. To prevent +namespace collisions, different types of pattern are distinguished by a sort +of Hungarian notation convention: + +@ + SomeType -- a type or class name + C_Ctor -- a constructor name + I_name -- a Qualified Ident + M_Data_Foo -- a module name + P_name -- a (module name, polymorphic string) pair + S_name -- a lone polymorphic string (this doesn't contain any module information) +@ + +I_, P_, and S_ patterns are all optional and have to be enabled with +`asIdent`, `asPair`, and `asString` modifiers respectively. + +Finally, to disambiguate between identifiers with the same name (such as +Data.Function.apply and Data.Apply.apply), the `prefixWith` modifier will +modify the names of the patterns created within it. + +> TH.mod "Data.Function" do +> TH.prefixWith "function" do +> TH.asIdent do +> TH.var "apply" + +results in: + +> pattern I_functionApply :: Qualified Ident +> pattern I_functionApply = Qualified (ByModuleName (M_Data_Function) (Ident "apply") +-} +module Language.PureScript.Constants.TH ( + declare, + mod, + cls, + clss, + dty, + nty, + ntys, + ty, + tys, + var, + vars, + prefixWith, + asIdent, + asPair, + asString, + type ModDecs, +) where import Protolude hiding (Type, mod) @@ -75,10 +81,11 @@ import Control.Monad.Trans.Writer (Writer, execWriter) import Control.Monad.Writer.Class (tell) import Data.String (String) import Language.Haskell.TH (Dec, Name, Pat, Q, Type, conP, implBidir, litP, mkName, patSynD, patSynSigD, prefixPatSyn, stringL) -import Language.PureScript.Names (Ident(..), ModuleName(..), ProperName(..), ProperNameType(..), Qualified(..), QualifiedBy(..)) +import Language.PureScript.Names (Ident (..), ModuleName (..), ProperName (..), ProperNameType (..), Qualified (..), QualifiedBy (..)) --- | Generate pattern synonyms corresponding to the provided PureScript --- declarations. +{- | Generate pattern synonyms corresponding to the provided PureScript +declarations. +-} declare :: Writer (Q [Dec]) () -> Q [Dec] declare = execWriter @@ -88,51 +95,58 @@ mod mnStr inner = do -- pattern M_Data_Foo :: ModuleName -- pattern M_Data_Foo = ModuleName "Data.Foo" let mn = mkModuleName mnStr - tell $ typedPatSyn mn [t| ModuleName |] [p| ModuleName $(litP $ stringL mnStr) |] + tell $ typedPatSyn mn [t|ModuleName|] [p|ModuleName $(litP $ stringL mnStr)|] tell $ snd $ execRWS inner (mn, "", []) () --- | Declare a type class. The resulting pattern will use the name of the class --- and have type `Qualified (ProperName 'ClassName)`. +{- | Declare a type class. The resulting pattern will use the name of the class +and have type `Qualified (ProperName 'ClassName)`. +-} cls :: String -> ModDecs -cls cn = ask >>= \(mn, prefix, _) -> tell $ mkPnPat [t| 'ClassName |] mn prefix cn +cls cn = ask >>= \(mn, prefix, _) -> tell $ mkPnPat [t|'ClassName|] mn prefix cn -- | Declare a list of type classes; shorthand for repeatedly calling `cls`. clss :: [String] -> ModDecs clss = traverse_ cls --- | Declare a data type, given the name of the type and a list of constructor --- names. A pattern will be created using the name of the type and have type --- `Qualified (ProperName 'TypeName)`. A pattern will also be created for each --- constructor prefixed with "C_", having type `Qualified (ProperName --- 'ConstructorName)`. +{- | Declare a data type, given the name of the type and a list of constructor +names. A pattern will be created using the name of the type and have type +`Qualified (ProperName 'TypeName)`. A pattern will also be created for each +constructor prefixed with "C_", having type `Qualified (ProperName +'ConstructorName)`. +-} dty :: String -> [String] -> ModDecs -dty dn ctors = ask >>= \(mn, prefix, _) -> do - tell $ mkPnPat [t| 'TypeName |] mn prefix dn - tell $ map fold $ traverse (mkPnPat [t| 'ConstructorName |] mn $ "C_" <> prefix) ctors - --- | Declare a data type with a singular constructor named the same as the --- type, as is commonly the case with newtypes (but this does not require the --- type to be a newtype in reality). Shorthand for calling `dty`. +dty dn ctors = + ask >>= \(mn, prefix, _) -> do + tell $ mkPnPat [t|'TypeName|] mn prefix dn + tell $ map fold $ traverse (mkPnPat [t|'ConstructorName|] mn $ "C_" <> prefix) ctors + +{- | Declare a data type with a singular constructor named the same as the +type, as is commonly the case with newtypes (but this does not require the +type to be a newtype in reality). Shorthand for calling `dty`. +-} nty :: String -> ModDecs nty tn = dty tn [tn] --- | Declare a list of data types with singular constructors; shorthand for --- repeatedly calling `nty`, which itself is shorthand for `dty`. +{- | Declare a list of data types with singular constructors; shorthand for +repeatedly calling `nty`, which itself is shorthand for `dty`. +-} ntys :: [String] -> ModDecs ntys = traverse_ nty --- | Declare a type. The resulting pattern will use the name of the type and have --- type `Qualified (ProperName 'TypeName)`. +{- | Declare a type. The resulting pattern will use the name of the type and have +type `Qualified (ProperName 'TypeName)`. +-} ty :: String -> ModDecs -ty tn = ask >>= \(mn, prefix, _) -> tell $ mkPnPat [t| 'TypeName |] mn prefix tn +ty tn = ask >>= \(mn, prefix, _) -> tell $ mkPnPat [t|'TypeName|] mn prefix tn -- | Declare a list of types; shorthand for repeatedly calling `ty`. tys :: [String] -> ModDecs tys = traverse_ ty --- | Declare a variable, function, named instance, or generally a lower-case --- value member of a module. The patterns created depend on which of `asPair`, --- `asIdent`, or `asString` are used in the enclosing context. +{- | Declare a variable, function, named instance, or generally a lower-case +value member of a module. The patterns created depend on which of `asPair`, +`asIdent`, or `asString` are used in the enclosing context. +-} var :: String -> ModDecs var nm = ask >>= \(mn, prefix, vtds) -> tell $ foldMap (\f -> f mn prefix nm) vtds @@ -140,25 +154,29 @@ var nm = ask >>= \(mn, prefix, vtds) -> tell $ foldMap (\f -> f mn prefix nm) vt vars :: [String] -> ModDecs vars = traverse_ var --- | For every variable declared within, create a pattern synonym prefixed --- with "P_" having type `forall a. (Eq a, IsString a) => (ModuleName, a)`. +{- | For every variable declared within, create a pattern synonym prefixed +with "P_" having type `forall a. (Eq a, IsString a) => (ModuleName, a)`. +-} asPair :: ModDecs -> ModDecs asPair = local $ addToVars mkPairDec --- | For every variable declared within, cerate a pattern synonym prefixed --- with "I_" having type `Qualified Ident`. +{- | For every variable declared within, cerate a pattern synonym prefixed +with "I_" having type `Qualified Ident`. +-} asIdent :: ModDecs -> ModDecs asIdent = local $ addToVars mkIdentDec --- | For every variable declared within, cerate a pattern synonym prefixed --- with "S_" having type `forall a. (Eq a, IsString a) => a`. +{- | For every variable declared within, cerate a pattern synonym prefixed +with "S_" having type `forall a. (Eq a, IsString a) => a`. +-} asString :: ModDecs -> ModDecs asString = local $ addToVars mkStringDec --- | Prefix the names of all enclosed declarations with the provided string, to --- prevent collisions with other identifiers. For example, --- `prefixWith "function"` would turn `I_apply` into `I_functionApply`, and --- `C_Example` into `C_FunctionExample`. +{- | Prefix the names of all enclosed declarations with the provided string, to +prevent collisions with other identifiers. For example, +`prefixWith "function"` would turn `I_apply` into `I_functionApply`, and +`C_Example` into `C_FunctionExample`. +-} prefixWith :: String -> ModDecs -> ModDecs prefixWith = local . applyPrefix @@ -192,33 +210,41 @@ mkPrefixedName tag prefix = mkName . (tag <>) . camelAppend prefix -- pattern FunctionFoo :: Qualified (ProperName 'TypeName) -- pattern FunctionFoo = Qualified (ByModuleName M_Data_Foo) (ProperName "Foo") mkPnPat :: Q Type -> VarToDec -mkPnPat pnType mn prefix str = typedPatSyn (mkName $ cap prefix <> str) - [t| Qualified (ProperName $pnType) |] - [p| Qualified (ByModuleName $(conP mn [])) (ProperName $(litP $ stringL str)) |] +mkPnPat pnType mn prefix str = + typedPatSyn + (mkName $ cap prefix <> str) + [t|Qualified (ProperName $pnType)|] + [p|Qualified (ByModuleName $(conP mn [])) (ProperName $(litP $ stringL str))|] -- M_Data_Foo -> "function" -> "foo" -> -- pattern I_functionFoo :: Qualified Ident -- pattern I_functionFoo = Qualified (ByModuleName M_Data_Foo) (Ident "foo") mkIdentDec :: VarToDec -mkIdentDec mn prefix str = typedPatSyn (mkPrefixedName "I_" prefix str) - [t| Qualified Ident |] - [p| Qualified (ByModuleName $(conP mn [])) (Ident $(litP $ stringL str)) |] +mkIdentDec mn prefix str = + typedPatSyn + (mkPrefixedName "I_" prefix str) + [t|Qualified Ident|] + [p|Qualified (ByModuleName $(conP mn [])) (Ident $(litP $ stringL str))|] -- M_Data_Foo -> "function" -> "foo" -> -- pattern P_functionFoo :: forall a. (Eq a, IsString a) => (ModuleName, a) -- pattern P_functionFoo = (M_Data_Foo, "foo") mkPairDec :: VarToDec -mkPairDec mn prefix str = typedPatSyn (mkPrefixedName "P_" prefix str) - [t| forall a. (Eq a, IsString a) => (ModuleName, a) |] - [p| ($(conP mn []), $(litP $ stringL str)) |] +mkPairDec mn prefix str = + typedPatSyn + (mkPrefixedName "P_" prefix str) + [t|forall a. (Eq a, IsString a) => (ModuleName, a)|] + [p|($(conP mn []), $(litP $ stringL str))|] -- _ -> "function" -> "foo" -> -- pattern S_functionFoo :: forall a. (Eq a, IsString a) => a -- pattern S_functionFoo = "foo" mkStringDec :: VarToDec -mkStringDec _ prefix str = typedPatSyn (mkPrefixedName "S_" prefix str) - [t| forall a. (Eq a, IsString a) => a |] - (litP $ stringL str) +mkStringDec _ prefix str = + typedPatSyn + (mkPrefixedName "S_" prefix str) + [t|forall a. (Eq a, IsString a) => a|] + (litP $ stringL str) typedPatSyn :: Name -> Q Type -> Q Pat -> Q [Dec] typedPatSyn nm t p = sequence [patSynSigD nm t, patSynD nm (prefixPatSyn []) implBidir p] diff --git a/src/Language/PureScript/CoreFn.hs b/src/Language/PureScript/CoreFn.hs index b2b73343b..d999163a0 100644 --- a/src/Language/PureScript/CoreFn.hs +++ b/src/Language/PureScript/CoreFn.hs @@ -1,8 +1,8 @@ --- | --- The core functional representation --- +{- | +The core functional representation +-} module Language.PureScript.CoreFn ( - module C + module C, ) where import Language.PureScript.AST.Literals as C diff --git a/src/Language/PureScript/CoreFn/Ann.hs b/src/Language/PureScript/CoreFn/Ann.hs index 185f8beb5..e15639e8a 100644 --- a/src/Language/PureScript/CoreFn/Ann.hs +++ b/src/Language/PureScript/CoreFn/Ann.hs @@ -2,23 +2,29 @@ module Language.PureScript.CoreFn.Ann where import Prelude -import Language.PureScript.AST.SourcePos (SourceSpan) +import Language.PureScript.AST.SourcePos (SourceSpan, pattern NullSourceSpan) import Language.PureScript.Comments (Comment) import Language.PureScript.CoreFn.Meta (Meta) --- | --- Type alias for basic annotations --- +{- | +Type alias for basic annotations +-} type Ann = (SourceSpan, [Comment], Maybe Meta) --- | --- An annotation empty of metadata aside from a source span. --- +{- | +An annotation empty of metadata aside from a source span. +-} ssAnn :: SourceSpan -> Ann ssAnn ss = (ss, [], Nothing) --- | --- Remove the comments from an annotation --- +annSS :: Ann -> SourceSpan +annSS (ss, _, _) = ss + +nullAnn :: Ann +nullAnn = (NullSourceSpan, [], Nothing) + +{- | +Remove the comments from an annotation +-} removeComments :: Ann -> Ann removeComments (ss, _, meta) = (ss, [], meta) diff --git a/src/Language/PureScript/CoreFn/Binders.hs b/src/Language/PureScript/CoreFn/Binders.hs index 4b64b97c4..31b5b24d5 100644 --- a/src/Language/PureScript/CoreFn/Binders.hs +++ b/src/Language/PureScript/CoreFn/Binders.hs @@ -1,42 +1,54 @@ --- | --- The core functional representation for binders --- +{- | +The core functional representation for binders +-} module Language.PureScript.CoreFn.Binders where import Prelude import Language.PureScript.AST.Literals (Literal) -import Language.PureScript.Names (Ident, ProperName, ProperNameType(..), Qualified) +import Language.PureScript.Names (Ident, ProperName, ProperNameType (..), Qualified) +import Language.PureScript.Types --- | --- Data type for binders --- +import Data.Aeson (FromJSON, ToJSON) +import GHC.Generics +import Control.Lens.Combinators (Plated (plate)) + +{- | +Data type for binders +-} data Binder a - -- | - -- Wildcard binder - -- - = NullBinder a - -- | - -- A binder which matches a literal value - -- - | LiteralBinder a (Literal (Binder a)) - -- | - -- A binder which binds an identifier - -- - | VarBinder a Ident - -- | - -- A binder which matches a data constructor - -- - | ConstructorBinder a (Qualified (ProperName 'TypeName)) (Qualified (ProperName 'ConstructorName)) [Binder a] - -- | - -- A binder which binds its input to an identifier - -- - | NamedBinder a Ident (Binder a) deriving (Eq, Ord, Show, Functor) + = -- | + -- Wildcard binder + NullBinder a + | -- | + -- A binder which matches a literal value + LiteralBinder a (Literal (Binder a)) + | -- | + -- A binder which binds an identifier + VarBinder a Ident SourceType + | -- | + -- A binder which matches a data constructor + ConstructorBinder a (Qualified (ProperName 'TypeName)) (Qualified (ProperName 'ConstructorName)) [Binder a] + | -- | + -- A binder which binds its input to an identifier + NamedBinder a Ident (Binder a) + deriving (Eq, Ord, Show, Functor, Generic) + +instance (FromJSON a) => FromJSON (Binder a) +instance (ToJSON a) => ToJSON (Binder a) +instance Plated (Binder a) where + {-# INLINEABLE plate #-} + plate f = \case + x@(NullBinder _) -> pure x + LiteralBinder x lit -> LiteralBinder x <$> traverse f lit + x@(VarBinder _ _ _) -> pure x + ConstructorBinder x tyName conName binds -> ConstructorBinder x tyName conName <$> traverse f binds + NamedBinder x ident bind -> NamedBinder x ident <$> f bind extractBinderAnn :: Binder a -> a extractBinderAnn (NullBinder a) = a extractBinderAnn (LiteralBinder a _) = a -extractBinderAnn (VarBinder a _) = a +extractBinderAnn (VarBinder a _ _) = a extractBinderAnn (ConstructorBinder a _ _ _) = a extractBinderAnn (NamedBinder a _ _) = a diff --git a/src/Language/PureScript/CoreFn/CSE.hs b/src/Language/PureScript/CoreFn/CSE.hs index 576243c25..b73634f0d 100644 --- a/src/Language/PureScript/CoreFn/CSE.hs +++ b/src/Language/PureScript/CoreFn/CSE.hs @@ -1,442 +1,458 @@ {-# LANGUAGE TemplateHaskell #-} + -- | This module performs limited common subexpression elimination module Language.PureScript.CoreFn.CSE (optimizeCommonSubexpressions) where import Protolude hiding (pass) -import Control.Lens (At(..), makeLenses, non, view, (%~), (.=), (.~), (<>~), (^.)) +import Control.Lens (At (..), makeLenses, non, view, (%~), (.=), (.~), (<>~), (^.)) +import Control.Monad.RWS (MonadWriter, RWST, censor, evalRWST, listen, pass, tell) import Control.Monad.Supply (Supply) import Control.Monad.Supply.Class (MonadSupply) -import Control.Monad.RWS (MonadWriter, RWST, censor, evalRWST, listen, pass, tell) import Data.Bitraversable (bitraverse) -import Data.Functor.Compose (Compose(..)) +import Data.Functor.Compose (Compose (..)) import Data.IntMap.Monoidal qualified as IM import Data.IntSet qualified as IS import Data.Map qualified as M import Data.Maybe (fromJust) -import Data.Semigroup (Min(..)) -import Data.Semigroup.Generic (GenericSemigroupMonoid(..)) +import Data.Semigroup (Min (..)) +import Data.Semigroup.Generic (GenericSemigroupMonoid (..)) -import Language.PureScript.AST.Literals (Literal(..)) +import Language.PureScript.AST.Literals (Literal (..)) import Language.PureScript.AST.SourcePos (nullSourceSpan) import Language.PureScript.Constants.Libs qualified as C import Language.PureScript.CoreFn.Ann (Ann) -import Language.PureScript.CoreFn.Binders (Binder(..)) -import Language.PureScript.CoreFn.Expr (Bind(..), CaseAlternative(..), Expr(..)) -import Language.PureScript.CoreFn.Meta (Meta(IsSyntheticApp)) +import Language.PureScript.CoreFn.Binders (Binder (..)) +import Language.PureScript.CoreFn.Expr (Bind (..), CaseAlternative (..), Expr (..)) +import Language.PureScript.CoreFn.Meta (Meta (IsSyntheticApp)) import Language.PureScript.CoreFn.Traversals (everywhereOnValues, traverseCoreFn) +import Language.PureScript.CoreFn.Utils (exprType) import Language.PureScript.Environment (dictTypeName) -import Language.PureScript.Names (pattern ByNullSourcePos, Ident(..), ModuleName, ProperName(..), Qualified(..), QualifiedBy(..), freshIdent, runIdent, toMaybeModuleName) +import Language.PureScript.Names (Ident (..), ModuleName, ProperName (..), Qualified (..), QualifiedBy (..), freshIdent, runIdent, toMaybeModuleName, pattern ByNullSourcePos) import Language.PureScript.PSString (decodeString) --- | --- `discuss f m` is an action that listens to the output of `m`, passes that --- and its value through `f`, and uses (only) the value of the result to set --- the new value and output. (Any output produced via the monad in `f` is --- ignored, though other monadic effects will hold.) --- -discuss :: MonadWriter w m => ((a, w) -> m (b, w)) -> m a -> m b +{- | +`discuss f m` is an action that listens to the output of `m`, passes that +and its value through `f`, and uses (only) the value of the result to set +the new value and output. (Any output produced via the monad in `f` is +ignored, though other monadic effects will hold.) +-} +discuss :: (MonadWriter w m) => ((a, w) -> m (b, w)) -> m a -> m b discuss f = pass . fmap (second const) . (f <=< listen) --- | --- Modify the target of an optic in the state with a monadic computation that --- returns some extra information of type `r` in a tuple. --- --- I would prefer that this be a named function, but I don't know what to name --- it. I went with symbols instead because the function that this operator most --- resembles is `(%%=)`, which doesn't have a textual name as far as I know. --- Compare the following (approximate) types: --- --- @ --- (%%=) :: MonadState s m => Lens s s a b -> (a -> (r, b)) -> m r --- (%%<~) :: MonadState s m => Lens s s a b -> (a -> m (r, b)) -> m r --- @ --- --- Replacing the `=` with `<~` was inspired by analogy with the following pair: --- --- @ --- (.=) :: MonadState s m => Lens s s a b -> b -> m () --- (<~) :: MonadState s m => Lens s s a b -> m b -> m () --- @ --- --- I regret any confusion that ensues. --- --- Note that there are two interpretations that could reasonably be expected --- for this type. --- --- @ --- (%%<~) :: MonadState s m => Lens s s a b -> (a -> m (r, b)) -> m r --- @ --- --- One is: --- * Get the focused `a` value from the monad --- * Run the computation --- * Get the new state from the returned monad --- * Take the returned `b` value and set it in the new state --- --- The other is: --- * Get the focused `a` value from the monad --- * Run the computation --- * Take the returned `b` value and set it in the *original* state --- * Put the result into the returned monad --- --- This operator corresponds to the second interpretation. The purpose of this, --- and part of the purpose of having this operator at all instead of composing --- simpler operators, is to enable using the lens only once (on the original --- state) instead of twice (for a get and a set on different states). --- -(%%<~) - :: MonadState s m - => ((a -> Compose m ((,) r) b) -> s -> Compose m ((,) r) s) - -- ^ please read as Lens s s a b - -> (a -> m (r, b)) - -> m r +{- | +Modify the target of an optic in the state with a monadic computation that +returns some extra information of type `r` in a tuple. + +I would prefer that this be a named function, but I don't know what to name +it. I went with symbols instead because the function that this operator most +resembles is `(%%=)`, which doesn't have a textual name as far as I know. +Compare the following (approximate) types: + +@ +(%%=) :: MonadState s m => Lens s s a b -> (a -> (r, b)) -> m r +(%%<~) :: MonadState s m => Lens s s a b -> (a -> m (r, b)) -> m r +@ + +Replacing the `=` with `<~` was inspired by analogy with the following pair: + +@ +(.=) :: MonadState s m => Lens s s a b -> b -> m () +(<~) :: MonadState s m => Lens s s a b -> m b -> m () +@ + +I regret any confusion that ensues. + +Note that there are two interpretations that could reasonably be expected +for this type. + +@ +(%%<~) :: MonadState s m => Lens s s a b -> (a -> m (r, b)) -> m r +@ + +One is: +* Get the focused `a` value from the monad +* Run the computation +* Get the new state from the returned monad +* Take the returned `b` value and set it in the new state + +The other is: +* Get the focused `a` value from the monad +* Run the computation +* Take the returned `b` value and set it in the *original* state +* Put the result into the returned monad + +This operator corresponds to the second interpretation. The purpose of this, +and part of the purpose of having this operator at all instead of composing +simpler operators, is to enable using the lens only once (on the original +state) instead of twice (for a get and a set on different states). +-} +(%%<~) :: + (MonadState s m) => + -- | please read as Lens s s a b + ((a -> Compose m ((,) r) b) -> s -> Compose m ((,) r) s) -> + (a -> m (r, b)) -> + m r l %%<~ f = get >>= getCompose . l (Compose . f) >>= state . const + infix 4 %%<~ --- | --- A PluralityMap is like a weaker multiset: like a multiset, it can hold --- several of the same value, but instead of keeping track of their exact --- counts, it only records whether there is one (False) or more than one --- (True). --- -newtype PluralityMap k = PluralityMap { getPluralityMap :: M.Map k Bool } +{- | +A PluralityMap is like a weaker multiset: like a multiset, it can hold +several of the same value, but instead of keeping track of their exact +counts, it only records whether there is one (False) or more than one +(True). +-} +newtype PluralityMap k = PluralityMap {getPluralityMap :: M.Map k Bool} -instance Ord k => Semigroup (PluralityMap k) where +instance (Ord k) => Semigroup (PluralityMap k) where PluralityMap l <> PluralityMap r = let l' = M.mapWithKey (\k -> (|| k `M.member` r)) l - in PluralityMap $ l' `M.union` r + in + PluralityMap $ l' `M.union` r -instance Ord k => Monoid (PluralityMap k) where +instance (Ord k) => Monoid (PluralityMap k) where mempty = PluralityMap M.empty -data BindingType = NonRecursive | Recursive deriving Eq +data BindingType = NonRecursive | Recursive deriving (Eq) --- | --- Record summary data about an expression. --- +{- | +Record summary data about an expression. +-} data CSESummary = CSESummary - { _scopesUsed :: IS.IntSet - -- ^ set of the scope numbers used in this expression + { _scopesUsed :: IS.IntSet + -- ^ set of the scope numbers used in this expression , _noFloatWithin :: Maybe (Min Int) - -- ^ optionally a scope within which this expression is not to be floated - -- (because the expression uses an identifier bound recursively in that - -- scope) - , _plurality :: PluralityMap Ident - -- ^ which floated identifiers are used more than once in this expression - -- (note that a single use inside an Abs will be considered multiple uses, - -- as this pass doesn't know when/how many times an Abs will be executed) - , _newBindings :: IM.MonoidalIntMap [(Ident, (PluralityMap Ident, Expr Ann))] - -- ^ floated bindings, organized by scope number + -- ^ optionally a scope within which this expression is not to be floated + -- (because the expression uses an identifier bound recursively in that + -- scope) + , _plurality :: PluralityMap Ident + -- ^ which floated identifiers are used more than once in this expression + -- (note that a single use inside an Abs will be considered multiple uses, + -- as this pass doesn't know when/how many times an Abs will be executed) + , _newBindings :: IM.MonoidalIntMap [(Ident, (PluralityMap Ident, Expr Ann))] + -- ^ floated bindings, organized by scope number , _toBeReinlined :: M.Map Ident (Expr Ann) - -- ^ a map of floated identifiers that did not end up getting bound and - -- will need to be reinlined at the end of the pass + -- ^ a map of floated identifiers that did not end up getting bound and + -- will need to be reinlined at the end of the pass } - deriving Generic + deriving (Generic) deriving (Semigroup, Monoid) via GenericSemigroupMonoid CSESummary --- | --- Append a value at a given scope depth. --- -addToScope :: Semigroup v => Int -> v -> IM.MonoidalIntMap v -> IM.MonoidalIntMap v -addToScope depth v - = IM.alter (Just . maybe v (<> v)) depth - --- | --- Remove and return an entire scope from a map of bindings. --- -popScope :: Monoid v => Int -> IM.MonoidalIntMap v -> (v, IM.MonoidalIntMap v) -popScope depth - = first fold . IM.updateLookupWithKey (\_ _ -> Nothing) depth - --- | --- Describe the context of an expression. --- +{- | +Append a value at a given scope depth. +-} +addToScope :: (Semigroup v) => Int -> v -> IM.MonoidalIntMap v -> IM.MonoidalIntMap v +addToScope depth v = + IM.alter (Just . maybe v (<> v)) depth + +{- | +Remove and return an entire scope from a map of bindings. +-} +popScope :: (Monoid v) => Int -> IM.MonoidalIntMap v -> (v, IM.MonoidalIntMap v) +popScope depth = + first fold . IM.updateLookupWithKey (\_ _ -> Nothing) depth + +{- | +Describe the context of an expression. +-} data CSEEnvironment = CSEEnvironment { _depth :: Int - -- ^ number of enclosing binding scopes (this includes not only Abs, but - -- Let and CaseAlternative bindings) + -- ^ number of enclosing binding scopes (this includes not only Abs, but + -- Let and CaseAlternative bindings) , _deepestTopLevelScope :: Int - -- ^ number of enclosing binding scopes outside the first Abs; used to - -- decide whether to qualify floated identifiers + -- ^ number of enclosing binding scopes outside the first Abs; used to + -- decide whether to qualify floated identifiers , _bound :: M.Map Ident (Int, BindingType) - -- ^ map from identifiers to depth in which they are bound and whether - -- or not the binding is recursive + -- ^ map from identifiers to depth in which they are bound and whether + -- or not the binding is recursive } makeLenses ''CSESummary makeLenses ''CSEEnvironment --- | --- Map from the shape of an expression to an identifier created to represent --- that expression, organized by scope depth. --- +{- | +Map from the shape of an expression to an identifier created to represent +that expression, organized by scope depth. +-} type CSEState = IM.MonoidalIntMap (M.Map (Expr ()) Ident) --- | --- The monad in which CSE takes place. --- +{- | +The monad in which CSE takes place. +-} type CSEMonad a = RWST CSEEnvironment CSESummary CSEState Supply a type HasCSEReader = MonadReader CSEEnvironment type HasCSEWriter = MonadWriter CSESummary type HasCSEState = MonadState CSEState --- | --- Run a CSEMonad computation; the return value is augmented with a map of --- identifiers that should be replaced in the final expression because they --- didn't end up needing to be floated. --- +{- | +Run a CSEMonad computation; the return value is augmented with a map of +identifiers that should be replaced in the final expression because they +didn't end up needing to be floated. +-} runCSEMonad :: CSEMonad a -> Supply (a, M.Map Ident (Expr Ann)) runCSEMonad x = second (^. toBeReinlined) <$> evalRWST x (CSEEnvironment 0 0 M.empty) IM.empty --- | --- Mark all expressions floated out of this computation as "plural". This pass --- assumes that any given Abs may be invoked multiple times, so any expressions --- inside the Abs but floated out of it also count as having multiple uses, --- even if they only appear once within the Abs. Consequently, any expressions --- that can be floated out of an Abs won't be reinlined at the end. --- -enterAbs :: HasCSEWriter m => m a -> m a +{- | +Mark all expressions floated out of this computation as "plural". This pass +assumes that any given Abs may be invoked multiple times, so any expressions +inside the Abs but floated out of it also count as having multiple uses, +even if they only appear once within the Abs. Consequently, any expressions +that can be floated out of an Abs won't be reinlined at the end. +-} +enterAbs :: (HasCSEWriter m) => m a -> m a enterAbs = censor $ plurality %~ PluralityMap . fmap (const True) . getPluralityMap --- | --- Run the provided computation in a new scope. --- +{- | +Run the provided computation in a new scope. +-} newScope :: (HasCSEReader m, HasCSEWriter m) => Bool -> (Int -> m a) -> m a newScope isTopLevel body = local goDeeper $ do d <- view depth censor (filterToDepth d) (body d) where - filterToDepth d - = (scopesUsed %~ IS.filter (< d)) - . (noFloatWithin %~ find (< Min d)) - goDeeper env@CSEEnvironment{..} = - if isTopLevel - then env{ _depth = depth', _deepestTopLevelScope = depth' } - else env{ _depth = depth' } - where - depth' = succ _depth - --- | --- Record a list of identifiers as being bound in the given scope. --- -withBoundIdents :: HasCSEReader m => [Ident] -> (Int, BindingType) -> m a -> m a + filterToDepth d = + (scopesUsed %~ IS.filter (< d)) + . (noFloatWithin %~ find (< Min d)) + goDeeper env@CSEEnvironment {..} = + if isTopLevel + then env {_depth = depth', _deepestTopLevelScope = depth'} + else env {_depth = depth'} + where + depth' = succ _depth + +{- | +Record a list of identifiers as being bound in the given scope. +-} +withBoundIdents :: (HasCSEReader m) => [Ident] -> (Int, BindingType) -> m a -> m a withBoundIdents idents t = local (bound %~ flip (foldl' (flip (flip M.insert t))) idents) --- | --- Run the provided computation in a new scope in which the provided --- identifiers are bound non-recursively. --- +{- | +Run the provided computation in a new scope in which the provided +identifiers are bound non-recursively. +-} newScopeWithIdents :: (HasCSEReader m, HasCSEWriter m) => Bool -> [Ident] -> m a -> m a -newScopeWithIdents isTopLevel idents = newScope isTopLevel . flip (withBoundIdents idents . (, NonRecursive)) +newScopeWithIdents isTopLevel idents = newScope isTopLevel . flip (withBoundIdents idents . (,NonRecursive)) --- | --- Produce, or retrieve from the state, an identifier for referencing the given --- expression, at and below the given depth. --- +{- | +Produce, or retrieve from the state, an identifier for referencing the given +expression, at and below the given depth. +-} generateIdentFor :: (HasCSEState m, MonadSupply m) => Int -> Expr () -> m (Bool, Ident) -generateIdentFor d e = at d . non mempty . at e %%<~ \case - Nothing -> freshIdent (nameHint e) <&> \ident -> ((True, ident), Just ident) - Just ident -> pure ((False, ident), Just ident) - -- A reminder: as with %%=, the first element of the returned pair is the - -- final result of the expression, and the second element is the value to - -- stuff back through the lens into the state. (The difference is that %%<~ - -- enables doing monadic work in the RHS, namely `freshIdent` here.) +generateIdentFor d e = + at d . non mempty . at e %%<~ \case + Nothing -> freshIdent (nameHint e) <&> \ident -> ((True, ident), Just ident) + Just ident -> pure ((False, ident), Just ident) where - nameHint = \case - App _ v1 v2 - | Var _ n <- v1 - , fmap (ProperName . runIdent) n == fmap dictTypeName C.IsSymbol - , Literal _ (ObjectLiteral [(_, Abs _ _ (Literal _ (StringLiteral str)))]) <- v2 - , Just decodedStr <- decodeString str - -> decodedStr <> "IsSymbol" - | otherwise - -> nameHint v1 - Var _ (Qualified _ ident) - | Ident name <- ident -> name - | GenIdent (Just name) _ <- ident -> name - Accessor _ prop _ - | Just decodedProp <- decodeString prop -> decodedProp - _ -> "ref" + -- A reminder: as with %%=, the first element of the returned pair is the + -- final result of the expression, and the second element is the value to + -- stuff back through the lens into the state. (The difference is that %%<~ + -- enables doing monadic work in the RHS, namely `freshIdent` here.) + + nameHint = \case + App _ v1 v2 + | Var _ _ n <- v1 + , fmap (ProperName . runIdent) n == fmap dictTypeName C.IsSymbol + , Literal _ _ (ObjectLiteral [(_, Abs _ _ _ (Literal _ _ (StringLiteral str)))]) <- v2 + , Just decodedStr <- decodeString str -> + decodedStr <> "IsSymbol" + | otherwise -> + nameHint v1 + Var _ _ (Qualified _ ident) + | Ident name <- ident -> name + | GenIdent (Just name) _ <- ident -> name + Accessor _ _ prop _ + | Just decodedProp <- decodeString prop -> decodedProp + _ -> "ref" nullAnn :: Ann nullAnn = (nullSourceSpan, [], Nothing) --- | --- Use a map to substitute local Vars in a list of Binds. --- +{- | +Use a map to substitute local Vars in a list of Binds. +-} replaceLocals :: M.Map Ident (Expr Ann) -> [Bind Ann] -> [Bind Ann] -replaceLocals m = if M.null m then identity else map f' where - (f', g', _) = everywhereOnValues identity f identity - f e@(Var _ (Qualified _ ident)) = maybe e g' $ ident `M.lookup` m - f e = e - --- | --- Store in the monad a new binding for the given expression, returning a Var --- referencing it. The provided CSESummary will be transformed to reflect the --- replacement. --- -floatExpr - :: (HasCSEReader m, HasCSEState m, MonadSupply m) - => QualifiedBy - -> (Expr Ann, CSESummary) - -> m (Expr Ann, CSESummary) +replaceLocals m = if M.null m then identity else map f' + where + (f', g', _) = everywhereOnValues identity f identity + f e@(Var _ _ (Qualified _ ident)) = maybe e g' $ ident `M.lookup` m + f e = e + +{- | +Store in the monad a new binding for the given expression, returning a Var +referencing it. The provided CSESummary will be transformed to reflect the +replacement. +-} +floatExpr :: + (HasCSEReader m, HasCSEState m, MonadSupply m) => + QualifiedBy -> + (Expr Ann, CSESummary) -> + m (Expr Ann, CSESummary) floatExpr topLevelQB = \case - (e, w@CSESummary{ _noFloatWithin = Nothing, .. }) -> do + (e, w@CSESummary {_noFloatWithin = Nothing, ..}) -> do let deepestScope = if IS.null _scopesUsed then 0 else IS.findMax _scopesUsed (isNew, ident) <- generateIdentFor deepestScope (void e) topLevel <- view deepestTopLevelScope let qb = if deepestScope > topLevel then ByNullSourcePos else topLevelQB - let w' = w - & (if isNew then newBindings %~ addToScope deepestScope [(ident, (_plurality, e))] else identity) - & plurality .~ PluralityMap (M.singleton ident False) - pure (Var nullAnn (Qualified qb ident), w') + let w' = + w + & (if isNew then newBindings %~ addToScope deepestScope [(ident, (_plurality, e))] else identity) + & plurality .~ PluralityMap (M.singleton ident False) + pure (Var nullAnn (exprType e) (Qualified qb ident), w') (e, w) -> pure (e, w) --- | --- Take possession of the Binds intended to be added to the current scope, --- removing them from the state, and return the list of Binds along with --- whatever value is returned by the provided computation. --- -getNewBinds - :: (HasCSEReader m, HasCSEState m, HasCSEWriter m) - => m a - -> m ([Bind Ann], a) +{- | +Take possession of the Binds intended to be added to the current scope, +removing them from the state, and return the list of Binds along with +whatever value is returned by the provided computation. +-} +getNewBinds :: + (HasCSEReader m, HasCSEState m, HasCSEWriter m) => + m a -> + m ([Bind Ann], a) getNewBinds = discuss $ \(a, w) -> do d <- view depth at d .= Nothing let (floatedHere, w') = newBindings (popScope d) w - pure $ first (, a) $ foldr handleFloat ([], w') floatedHere + pure $ first (,a) $ foldr handleFloat ([], w') floatedHere where - handleFloat (ident, (p, e)) (bs, w) = - if fromJust . M.lookup ident . getPluralityMap $ w ^. plurality - then (NonRec nullAnn ident e : bs, w') - else (bs, w' & toBeReinlined %~ M.insert ident e) - where w' = w & plurality <>~ p - --- | --- Like getNewBinds, but also stores the Binds in a Let wrapping the provided --- expression. If said expression is already a Let, adds these Binds to that --- Let instead. --- -getNewBindsAsLet - :: (HasCSEReader m, HasCSEWriter m, HasCSEState m) - => m (Expr Ann) - -> m (Expr Ann) -getNewBindsAsLet = fmap (uncurry go) . getNewBinds where - go bs = if null bs then identity else \case - Let a bs' e' -> Let a (bs ++ bs') e' - e' -> Let nullAnn bs e' - --- | --- Feed the Writer part of the monad with the requirements of this name. --- -summarizeName - :: (HasCSEReader m, HasCSEWriter m) - => ModuleName - -> Qualified Ident - -> m () + handleFloat (ident, (p, e)) (bs, w) = + if fromJust . M.lookup ident . getPluralityMap $ w ^. plurality + then (NonRec nullAnn ident e : bs, w') + else (bs, w' & toBeReinlined %~ M.insert ident e) + where + w' = w & plurality <>~ p + +{- | +Like getNewBinds, but also stores the Binds in a Let wrapping the provided +expression. If said expression is already a Let, adds these Binds to that +Let instead. +-} +getNewBindsAsLet :: + (HasCSEReader m, HasCSEWriter m, HasCSEState m) => + m (Expr Ann) -> + m (Expr Ann) +getNewBindsAsLet = fmap (uncurry go) . getNewBinds + where + go bs = + if null bs + then identity + else \case + Let a bs' e' -> Let a (bs ++ bs') e' + e' -> Let nullAnn bs e' + +{- | +Feed the Writer part of the monad with the requirements of this name. +-} +summarizeName :: + (HasCSEReader m, HasCSEWriter m) => + ModuleName -> + Qualified Ident -> + m () summarizeName mn (Qualified mn' ident) = do m <- view bound let (s, bt) = fromMaybe (0, NonRecursive) $ guard (all (== mn) (toMaybeModuleName mn')) *> ident `M.lookup` m - tell $ mempty - & scopesUsed .~ IS.singleton s - & noFloatWithin .~ (guard (bt == Recursive) $> Min s) - --- | --- Collect all the Idents put in scope by a list of Binders. --- + tell $ + mempty + & scopesUsed .~ IS.singleton s + & noFloatWithin .~ (guard (bt == Recursive) $> Min s) + +{- | +Collect all the Idents put in scope by a list of Binders. +-} identsFromBinders :: [Binder a] -> [Ident] -identsFromBinders = foldMap identsFromBinder where - identsFromBinder = \case - LiteralBinder _ (ArrayLiteral xs) -> identsFromBinders xs - LiteralBinder _ (ObjectLiteral xs) -> identsFromBinders (map snd xs) - VarBinder _ ident -> [ident] - ConstructorBinder _ _ _ xs -> identsFromBinders xs - NamedBinder _ ident x -> ident : identsFromBinder x - LiteralBinder _ BooleanLiteral{} -> [] - LiteralBinder _ CharLiteral{} -> [] - LiteralBinder _ NumericLiteral{} -> [] - LiteralBinder _ StringLiteral{} -> [] - NullBinder{} -> [] - --- | --- Float synthetic Apps (right now, the only Apps marked as synthetic are type --- class dictionaries being fed to functions with constraints, superclass --- accessors, and instances of IsSymbol) to a new or existing Let as close to --- the top level as possible. --- +identsFromBinders = foldMap identsFromBinder + where + identsFromBinder = \case + LiteralBinder _ (ListLiteral xs) -> identsFromBinders xs + LiteralBinder _ (ObjectLiteral xs) -> identsFromBinders (map snd xs) + VarBinder _ ident _ -> [ident] + ConstructorBinder _ _ _ xs -> identsFromBinders xs + NamedBinder _ ident x -> ident : identsFromBinder x + LiteralBinder _ BooleanLiteral {} -> [] + LiteralBinder _ CharLiteral {} -> [] + LiteralBinder _ NumericLiteral {} -> [] + LiteralBinder _ StringLiteral {} -> [] + NullBinder {} -> [] + +{- | +Float synthetic Apps (right now, the only Apps marked as synthetic are type +class dictionaries being fed to functions with constraints, superclass +accessors, and instances of IsSymbol) to a new or existing Let as close to +the top level as possible. +-} optimizeCommonSubexpressions :: ModuleName -> [Bind Ann] -> Supply [Bind Ann] -optimizeCommonSubexpressions mn - = fmap (uncurry (flip replaceLocals)) - . runCSEMonad - . fmap (uncurry (++)) - . getNewBinds - . fmap fst - . handleBinds True (pure ()) - +optimizeCommonSubexpressions mn = + fmap (uncurry (flip replaceLocals)) + . runCSEMonad + . fmap (uncurry (++)) + . getNewBinds + . fmap fst + . handleBinds True (pure ()) where - - -- This is the one place (I think?) that keeps this from being a general - -- common subexpression elimination pass. - shouldFloatExpr :: Expr Ann -> Bool - shouldFloatExpr = \case - App (_, _, Just IsSyntheticApp) e _ -> isSimple e - _ -> False - - isSimple :: Expr Ann -> Bool - isSimple = \case - Var{} -> True - Accessor _ _ e -> isSimple e - _ -> False - - handleAndWrapExpr :: Expr Ann -> CSEMonad (Expr Ann) - handleAndWrapExpr = getNewBindsAsLet . handleExpr - - (handleBind, handleExprDefault, handleBinder, _) = traverseCoreFn handleBind handleExpr handleBinder handleCaseAlternative - - topLevelQB = ByModuleName mn - - handleExpr :: Expr Ann -> CSEMonad (Expr Ann) - handleExpr = discuss (ifM (shouldFloatExpr . fst) (floatExpr topLevelQB) pure) . \case - Abs a ident e -> enterAbs $ Abs a ident <$> newScopeWithIdents False [ident] (handleAndWrapExpr e) - v@(Var _ qname) -> summarizeName mn qname $> v - Let a bs e -> uncurry (Let a) <$> handleBinds False (handleExpr e) bs - x -> handleExprDefault x - - handleCaseAlternative :: CaseAlternative Ann -> CSEMonad (CaseAlternative Ann) - handleCaseAlternative (CaseAlternative bs x) = CaseAlternative bs <$> do - newScopeWithIdents False (identsFromBinders bs) $ - bitraverse (traverse $ bitraverse handleAndWrapExpr handleAndWrapExpr) handleAndWrapExpr x - - handleBinds :: forall a. Bool -> CSEMonad a -> [Bind Ann] -> CSEMonad ([Bind Ann], a) - handleBinds isTopLevel = foldr go . fmap pure where - go :: Bind Ann -> CSEMonad ([Bind Ann], a) -> CSEMonad ([Bind Ann], a) - go b inner = case b of - -- For a NonRec Bind, traverse the bound expression in the current scope - -- and then create a new scope for any remaining Binds and/or whatever - -- inner thing all these Binds are applied to. - NonRec a ident e -> do - e' <- handleExpr e - newScopeWithIdents isTopLevel [ident] $ - prependToNewBindsFromInner $ NonRec a ident e' - Rec es -> - -- For a Rec Bind, the bound expressions need a new scope in which all - -- these identifiers are bound recursively; then the remaining Binds - -- and the inner thing can be traversed in the same scope with the same - -- identifiers now bound non-recursively. - newScope isTopLevel $ \d -> do - let idents = map (snd . fst) es - es' <- withBoundIdents idents (d, Recursive) $ traverse (traverse handleExpr) es - withBoundIdents idents (d, NonRecursive) $ - prependToNewBindsFromInner $ Rec es' - + -- This is the one place (I think?) that keeps this from being a general + -- common subexpression elimination pass. + shouldFloatExpr :: Expr Ann -> Bool + shouldFloatExpr = \case + App (_, _, Just IsSyntheticApp) e _ -> isSimple e + _ -> False + + isSimple :: Expr Ann -> Bool + isSimple = \case + Var {} -> True + Accessor _ _ _ e -> isSimple e + _ -> False + + handleAndWrapExpr :: Expr Ann -> CSEMonad (Expr Ann) + handleAndWrapExpr = getNewBindsAsLet . handleExpr + + (handleBind, handleExprDefault, handleBinder, _) = traverseCoreFn handleBind handleExpr handleBinder handleCaseAlternative + + topLevelQB = ByModuleName mn + + handleExpr :: Expr Ann -> CSEMonad (Expr Ann) + handleExpr = + discuss (ifM (shouldFloatExpr . fst) (floatExpr topLevelQB) pure) . \case + Abs a t ident e -> enterAbs $ Abs a t ident <$> newScopeWithIdents False [ident] (handleAndWrapExpr e) + v@(Var _ _ qname) -> summarizeName mn qname $> v + Let a bs e -> uncurry (Let a) <$> handleBinds False (handleExpr e) bs + x -> handleExprDefault x + + handleCaseAlternative :: CaseAlternative Ann -> CSEMonad (CaseAlternative Ann) + handleCaseAlternative (CaseAlternative bs x) = + CaseAlternative bs <$> do + newScopeWithIdents False (identsFromBinders bs) $ + bitraverse (traverse $ bitraverse handleAndWrapExpr handleAndWrapExpr) handleAndWrapExpr x + + handleBinds :: forall a. Bool -> CSEMonad a -> [Bind Ann] -> CSEMonad ([Bind Ann], a) + handleBinds isTopLevel = foldr go . fmap pure where - - prependToNewBindsFromInner :: Bind Ann -> CSEMonad ([Bind Ann], a) - prependToNewBindsFromInner hd = first (hd :) . join <$> getNewBinds inner + go :: Bind Ann -> CSEMonad ([Bind Ann], a) -> CSEMonad ([Bind Ann], a) + go b inner = case b of + -- For a NonRec Bind, traverse the bound expression in the current scope + -- and then create a new scope for any remaining Binds and/or whatever + -- inner thing all these Binds are applied to. + NonRec a ident e -> do + e' <- handleExpr e + newScopeWithIdents isTopLevel [ident] $ + prependToNewBindsFromInner $ + NonRec a ident e' + Rec es -> + -- For a Rec Bind, the bound expressions need a new scope in which all + -- these identifiers are bound recursively; then the remaining Binds + -- and the inner thing can be traversed in the same scope with the same + -- identifiers now bound non-recursively. + newScope isTopLevel $ \d -> do + let idents = map (snd . fst) es + es' <- withBoundIdents idents (d, Recursive) $ traverse (traverse handleExpr) es + withBoundIdents idents (d, NonRecursive) $ + prependToNewBindsFromInner $ + Rec es' + where + prependToNewBindsFromInner :: Bind Ann -> CSEMonad ([Bind Ann], a) + prependToNewBindsFromInner hd = first (hd :) . join <$> getNewBinds inner diff --git a/src/Language/PureScript/CoreFn/Convert/Monomorphize/Utils.hs b/src/Language/PureScript/CoreFn/Convert/Monomorphize/Utils.hs new file mode 100644 index 000000000..10383663a --- /dev/null +++ b/src/Language/PureScript/CoreFn/Convert/Monomorphize/Utils.hs @@ -0,0 +1,261 @@ +{-# LANGUAGE InstanceSigs #-} +{-# LANGUAGE PartialTypeSignatures #-} +{-# LANGUAGE RecordWildCards #-} +{-# LANGUAGE ScopedTypeVariables #-} +-- has to be here (more or less) +{-# OPTIONS_GHC -Wno-orphans #-} +{-# OPTIONS_GHC -Wno-unrecognised-pragmas #-} + +{-# HLINT ignore "Use camelCase" #-} + +module Language.PureScript.CoreFn.Convert.Monomorphize.Utils ( + Monomorphizer, + MonoError(..), + freshUnique, + unsafeApply, + mkFieldMap, + decodeModuleIO, + findDeclBody, + MonoState(..) + ) where + +import Prelude + +import Bound (abstract) +import Bound.Scope (Scope (..), fromScope, mapBound, toScope) +import Bound.Var (Var (..)) +import Control.Lens ((<&>), (^..), (^?)) +import Control.Lens.Plated (Plated (..), cosmos, transform) +import Control.Monad (join) +import Control.Monad.Except (throwError) +import Control.Monad.RWS (RWST (..)) +import Control.Monad.RWS.Class (MonadReader (..), gets, modify') +import Data.Aeson qualified as Aeson +import Data.Bifunctor (first) +import Data.Char (isUpper) +import Data.Functor.Identity (runIdentity) +import Data.List (find) +import Data.Map (Map) +import Data.Map qualified as M +import Data.Maybe (fromMaybe, mapMaybe) +import Data.Text (Text) +import Data.Text qualified as T +import GHC.IO (throwIO) +import Language.PureScript.AST.SourcePos (SourceAnn) +import Language.PureScript.CoreFn.Ann (Ann) +import Language.Purus.Debug (doTrace, prettify) +import Language.Purus.IR (Alt (..), BVar (..), BindE (..), Exp (..), FVar (..), Pat (..), expTy, expTy', ppExp, _V, Lit (..)) +import Language.PureScript.CoreFn.Expr (Bind, PurusType) +import Language.PureScript.CoreFn.FromJSON () +import Language.PureScript.CoreFn.Module (Module (..)) +import Language.Purus.Pretty (prettyAsStr) +import Language.PureScript.CoreFn.TypeLike (TypeLike (..), unQuantify) +import Language.PureScript.Label (Label (..)) +import Language.PureScript.Names (Ident (..), ModuleName (..), Qualified (..), QualifiedBy (..), runIdent, pattern ByNullSourcePos) +import Language.PureScript.PSString (PSString) +import Language.PureScript.Types ( + Constraint (..), + RowListItem (..), + SourceType, + Type (..), + TypeVarVisibility, + rowToList, + ) +import Prettyprinter (Pretty) +import Data.Set qualified as S +import Data.Set (Set) +import Data.Foldable (foldl') +import Language.Purus.IR.Utils + +{- Monomorphizer monad & related utilities -} + +-- TODO: better error messages +newtype MonoError + = MonoError String + deriving (Show) + +-- Just a newtype over `Int` +newtype MonoState = MonoState + { unique :: Int + } + +-- Reads (ModuleName,ModuleDecls), writes nothing (...yet), State is a newtype over Int for fresh names & etc +type Monomorphizer = RWST (ModuleName, [BindE PurusType (Exp WithObjects PurusType) (Vars PurusType)]) () MonoState (Either MonoError) + +getModName :: Monomorphizer ModuleName +getModName = ask <&> fst + +getModBinds :: Monomorphizer [BindE PurusType (Exp WithObjects PurusType) (Vars PurusType)] +getModBinds = ask <&> snd + +note :: String -> Maybe b -> Monomorphizer b +note err = \case + Nothing -> throwError $ MonoError err + Just x -> pure x + +freshUnique :: Monomorphizer Int +freshUnique = do + u <- gets unique + modify' $ \(MonoState _) -> MonoState (u + 1) + pure u + +freshen :: Ident -> Monomorphizer Ident +freshen ident = do + u <- gets unique + modify' $ \(MonoState _) -> MonoState (u + 1) + let uTxt = T.pack (show u) + case ident of + Ident t -> pure $ Ident $ t <> "_$$" <> uTxt + GenIdent (Just t) i -> pure $ GenIdent (Just $ t <> "_$$" <> uTxt) i -- we only care about a unique ord property for the maps + GenIdent Nothing i -> pure $ GenIdent (Just $ "var_$$" <> uTxt) i + -- other two shouldn't exist at this stage + other -> pure other + +freshBVar :: t -> Monomorphizer (BVar t) +freshBVar t = do + u <- gets unique + modify' $ \(MonoState _) -> MonoState (u + 1) + let gIdent = Ident $ T.pack ("x_$$" <> show u) + pure $ BVar u t gIdent + +{- + Misc utils for constructing/analyzing expressions +-} + + +-- REVIEW: IDK if this is right? Do we need to abstract here? +-- Construct a Let expression from a list of BindEs and a scoped body +gLet :: + [BindE PurusType (Exp WithObjects PurusType) (Vars PurusType)] -> + Scope (BVar PurusType) (Exp WithObjects PurusType) (Vars PurusType) -> + Exp WithObjects PurusType (Vars PurusType) +gLet binds e = LetE M.empty binds e + + +-- doesn't change types! +renameBoundVar :: + Ident -> + Ident -> + Scope (BVar t) (Exp WithObjects t) (FVar t) -> + Scope (BVar t) (Exp WithObjects t) (FVar t) +renameBoundVar old new = mapBound $ \case + BVar bvIx bvTy bvIdent | bvIdent == old -> BVar bvIx bvTy new + other -> other + +{- Given a function and a list of arguments that hopefully + match the type & number of the args in the functions signature, + apply the function to all of the arguments. + + TODO: Eventually we shouldn't need this but it's useful to throw errors + while debugging if we get something that's not a function +-} +unsafeApply :: + forall a x t. + (TypeLike t, Pretty t, Pretty (KindOf t)) => + (a -> Vars t) -> + Exp x t a -> + [Exp x t a] -> + Exp x t a +unsafeApply f e (arg : args) = case unFunction . snd . stripQuantifiers . expTy f $ e of + Just _ -> unsafeApply f (AppE e arg) args + other -> + Prelude.error $ + "Unexpected argument to unsafeApply:\n " + <> "Fun Expression: " + <> ppExp (f <$> e) + <> "\n Arg: " + <> ppExp (f <$> arg) + <> "\n FunType: " + <> prettyAsStr other + <> "\n ArgType: " + <> prettyAsStr (expTy f arg) +unsafeApply _ e [] = e + + + +letBindRecursive :: + (TypeLike t, Pretty t, Pretty (KindOf t)) => + (a -> Vars t) -> + Ident -> + Int -> + Scope (BVar t) (Exp x t) a -> + Scope (BVar t) (Exp x t) (Vars t) +letBindRecursive f idnt indx _scoped + | containsBVar idnt indx scoped = + let result = abstr $ LetE M.empty [NonRecursive idnt indx scoped] (toScope (V . B $ BVar indx (expTy' id scoped) idnt)) + msg = + "IDENT:\n" + <> prettyAsStr idnt + <> "#" + <> prettyAsStr indx + <> "\n\nINPUT EXPR:\n" + <> prettyAsStr (fromScope scoped) + <> "\n\nINPUT TY:\n" + <> prettyAsStr (expTy' id scoped) + <> "\n\nRESULT:\n" + <> prettyAsStr (fromScope result) + <> "\n\nRESULT TY:\n" + <> prettyAsStr (expTy' id result) + in doTrace "letBindRecursive" msg result + | otherwise = scoped + where + scoped = f <$> _scoped + abstr = abstract $ \case + B bv -> Just bv + _ -> Nothing + + + +{- Turns a Row Type into a Map of field names to Row item data. + + NOTE: Be sure to unwrap the enclosing record if you're working w/ a + record type. +-} +mkFieldMap :: SourceType -> M.Map PSString (RowListItem SourceAnn) +mkFieldMap fs = M.fromList $ (\x -> (runLabel (rowListLabel x), x)) <$> (fst . rowToList $ fs) + + +{- Updates the identifier and type of free variables using the provided Map + + Note that this erases original source position information, since it is meant to be + used during inlining (and ergo the original source position may no longer be + accurate or meaningful, e.g. in generated code) +-} +updateFreeVars :: + Map Ident (Ident, SourceType) -> + Exp WithObjects PurusType (Vars PurusType) -> + Exp WithObjects PurusType (Vars PurusType) +updateFreeVars dict = transform updateFreeVar + where + updateFreeVar :: + Exp WithObjects PurusType (Vars PurusType) -> + Exp WithObjects PurusType (Vars PurusType) + updateFreeVar expr = case expr ^? _V of + Just (F (FVar _ (Qualified (ByModuleName _) varId))) -> case M.lookup varId dict of + Nothing -> expr + Just (newId, newType) -> V $ F (FVar newType (Qualified ByNullSourcePos newId)) + _ -> expr + +{- IO utility. Reads a CoreFn module from a source file. Probably this should be somewhere else? + +-} +decodeModuleIO :: FilePath -> IO (Module (Bind Ann) PurusType PurusType Ann) +decodeModuleIO path = + Aeson.eitherDecodeFileStrict' path >>= \case + Left err -> throwIO $ userError err + Right modx -> pure modx + + +tyAbstractExpr :: + [(TypeVarVisibility, Text, KindOf PurusType)] -> + Exp WithObjects PurusType (Vars PurusType) -> + Monomorphizer (Exp WithObjects PurusType (Vars PurusType)) +tyAbstractExpr [] e = pure e +tyAbstractExpr ((_, var, kind) : rest) e = do + bvix <- freshUnique + let bv = BVar bvix kind (Ident var) + e' <- tyAbstractExpr rest e + pure $ TyAbs bv e' + +-- put this somewhere else + diff --git a/src/Language/PureScript/CoreFn/Desugar.hs b/src/Language/PureScript/CoreFn/Desugar.hs index 34bf08f1f..295050fe3 100644 --- a/src/Language/PureScript/CoreFn/Desugar.hs +++ b/src/Language/PureScript/CoreFn/Desugar.hs @@ -1,98 +1,395 @@ +{- HLINT ignore "Use void" -} +{- HLINT ignore "Use <$" -} + module Language.PureScript.CoreFn.Desugar (moduleToCoreFn) where +import Protolude (Bifunctor (bimap), MonadError (..), orEmpty, ordNub, sortOn, zipWithM) import Prelude -import Protolude (ordNub, orEmpty) - -import Control.Arrow (second) -import Data.Function (on) -import Data.Maybe (mapMaybe) -import Data.Tuple (swap) +import Data.Foldable (foldl') +import Data.List (partition) import Data.List.NonEmpty qualified as NEL import Data.Map qualified as M +import Data.Maybe (mapMaybe) -import Language.PureScript.AST.Literals (Literal(..)) -import Language.PureScript.AST.SourcePos (pattern NullSourceSpan, SourceSpan(..)) -import Language.PureScript.AST.Traversals (everythingOnValues) -import Language.PureScript.Comments (Comment) +import Control.Monad (foldM, forM, (<=<), (>=>)) +import Control.Monad.State.Strict (MonadState, gets, modify) +import Control.Monad.Writer.Class (MonadWriter) +import Data.Either (lefts) +import Data.List.NonEmpty qualified as NE +import Data.Set qualified as S +import Data.Text qualified as T +import Data.Text.Lazy qualified as LT +import Debug.Trace (traceM) +import Language.PureScript.AST.Binders qualified as A +import Language.PureScript.AST.Declarations qualified as A +import Language.PureScript.AST.Literals (Literal (..)) +import Language.PureScript.AST.SourcePos (SourceAnn, SourceSpan (..)) +import Language.PureScript.AST.SourcePos qualified as A +import Language.PureScript.Constants.Prim qualified as C import Language.PureScript.CoreFn.Ann (Ann, ssAnn) -import Language.PureScript.CoreFn.Binders (Binder(..)) -import Language.PureScript.CoreFn.Expr (Bind(..), CaseAlternative(..), Expr(..), Guard) -import Language.PureScript.CoreFn.Meta (ConstructorType(..), Meta(..)) -import Language.PureScript.CoreFn.Module (Module(..)) +import Language.PureScript.CoreFn.Binders (Binder (..)) +import Language.PureScript.CoreFn.Desugar.Utils ( + M, + analyzeCtor, + binderToCoreFn, + ctorArgs, + dedupeImports, + desugarCasesEverywhere, + desugarConstraintTypes, + desugarConstraintsInDecl, + exportToCoreFn, + externToCoreFn, + false, + findQualModules, + getConstructorMeta, + getLetMeta, + getModuleName, + getValueMeta, + importToCoreFn, + instantiate, + instantiatePolyType, + lookupDictType, + mkList, + properToIdent, + purusTy, + reExportsToCoreFn, + showIdent', + ssA, + toReExportRef, + true, + truePat, + unwrapRecord, + withInstantiatedFunType, + wrapTrace, + ) +import Language.PureScript.CoreFn.Expr (Bind (..), CaseAlternative (..), Expr (..), Guard) +import Language.PureScript.CoreFn.Meta (Meta (..)) +import Language.PureScript.CoreFn.Module hiding (properToIdent) +import Language.PureScript.CoreFn.Utils (exprType, stripQuantifiers) import Language.PureScript.Crash (internalError) -import Language.PureScript.Environment (DataDeclType(..), Environment(..), NameKind(..), isDictTypeName, lookupConstructor, lookupValue) -import Language.PureScript.Label (Label(..)) -import Language.PureScript.Names (pattern ByNullSourcePos, Ident(..), ModuleName, ProperName(..), ProperNameType(..), Qualified(..), QualifiedBy(..), getQual) +import Language.PureScript.Environment ( + DataDeclType (..), + Environment (..), + NameKind (..), + NameVisibility (..), + function, + isDictTypeName, + lookupConstructor, + lookupValue, + tyBoolean, + tyChar, + tyFunction, + tyInt, + tyNumber, + tyString, + pattern ListT, + pattern RecordT, + pattern (:->), + ) +import Language.PureScript.Errors ( + MultipleErrors, + SimpleErrorMessage (..), + errorMessage', + ) +import Language.PureScript.Label (Label (..)) +import Language.PureScript.Names ( + Ident (..), + ModuleName, + Name (DctorName), + ProperName (..), + ProperNameType (..), + Qualified (..), + QualifiedBy (..), + coerceProperName, + disqualify, + mkQualified, + runIdent, + pattern ByNullSourcePos, + ) import Language.PureScript.PSString (PSString) -import Language.PureScript.Types (pattern REmptyKinded, SourceType, Type(..)) -import Language.PureScript.AST qualified as A -import Language.PureScript.Constants.Prim qualified as C +import Language.PureScript.Pretty.Values (renderValue) +import Language.PureScript.TypeChecker.Kinds (kindOf) +import Language.PureScript.TypeChecker.Monad ( + CheckState (checkCurrentModule, checkEnv), + bindLocalVariables, + bindNames, + getEnv, + makeBindingGroupVisible, + warnAndRethrowWithPositionTC, + withBindingGroupVisible, + ) +import Language.PureScript.Types ( + RowListItem (..), + SourceType, + Type (..), + containsUnknowns, + eqType, + quantify, + rowToList, + pattern REmptyKinded, + ) +import Language.Purus.Pretty (ppType, prettyDatatypes, prettyStr, renderExprStr) +import Prettyprinter (Pretty (pretty)) + +{- + CONVERSION MACHINERY + + NOTE: We run this *after* the initial typechecking/desugaring phase, using the Environment returned from that + initial pass. It's important to keep that in mind, for a few reasons: + - We know that everything is well-typed/scoped/properly renamed/desugared/etc. This assumption lets us safely do a bunch of things that wouldn't otherwise be safe. + - We have access to all of the type signatures for top-level declarations + - We have to fix the "lies" in the type signatures that emerge after desugaring, e.g. types w/ a class constraint represent values that take an additional dict argument + + NOTE: All of the "pure" conversion functions (i.e. which don't require the typechecker monad stack) are in Language.PureScript.CoreFn.Desugar.Utils. + This module is hard enough to understand, best to minimize its size. +-} -- | Desugars a module from AST to CoreFn representation. -moduleToCoreFn :: Environment -> A.Module -> Module Ann -moduleToCoreFn _ (A.Module _ _ _ _ Nothing) = +moduleToCoreFn :: forall m. (M m) => A.Module -> m (Module (Bind Ann) SourceType SourceType Ann) +moduleToCoreFn (A.Module _ _ _ _ Nothing) = internalError "Module exports were not elaborated before moduleToCoreFn" -moduleToCoreFn env (A.Module modSS coms mn decls (Just exps)) = - let imports = mapMaybe importToCoreFn decls ++ fmap (ssAnn modSS,) (findQualModules decls) - imports' = dedupeImports imports +moduleToCoreFn (A.Module modSS coms mn _decls (Just exps)) = do + setModuleName + desugarConstraintTypes + allDecls <- traverse (fmap desugarConstraintsInDecl . desugarCasesEverywhere) _decls + let (dataDecls, nonDataDecls) = partition isDataDecl allDecls + let importHelper ds = fmap (ssAnn modSS,) (findQualModules ds) + imports = dedupeImports $ mapMaybe importToCoreFn allDecls ++ importHelper allDecls exps' = ordNub $ concatMap exportToCoreFn exps reExps = M.map ordNub $ M.unionsWith (++) (mapMaybe (fmap reExportsToCoreFn . toReExportRef) exps) - externs = ordNub $ mapMaybe externToCoreFn decls - decls' = concatMap declToCoreFn decls - in Module modSS coms mn (spanName modSS) imports' exps' reExps externs decls' + externs = ordNub $ mapMaybe externToCoreFn allDecls + decls' <- concat <$> traverse (declToCoreFn mn) nonDataDecls + let dataDecls' = mkDataDecls mn dataDecls + result = Module modSS coms mn (spanName modSS) imports exps' reExps externs decls' dataDecls' + traceM $ prettyStr dataDecls' + pure $ result + where + setModuleName = modify $ \cs -> + cs {checkCurrentModule = Just mn} + isDataDecl = \case + A.DataDeclaration {} -> True + A.DataBindingGroupDeclaration {} -> True + _ -> False + +mkDataDecls :: ModuleName -> [A.Declaration] -> Datatypes SourceType SourceType +mkDataDecls mn decls = foldl' go mempty decls where - -- Creates a map from a module name to the re-export references defined in - -- that module. - reExportsToCoreFn :: (ModuleName, A.DeclarationRef) -> M.Map ModuleName [Ident] - reExportsToCoreFn (mn', ref') = M.singleton mn' (exportToCoreFn ref') + go :: Datatypes SourceType SourceType -> A.Declaration -> Datatypes SourceType SourceType + go datatypes@(Datatypes tyDecls ctorMap) = \case + A.DataDeclaration _ ddTy nm args ctors -> + let qNm = Qualified (ByModuleName mn) nm + ctorDecls = goCtor <$> ctors + thisDecl = DataDecl ddTy qNm args ctorDecls - toReExportRef :: A.DeclarationRef -> Maybe (ModuleName, A.DeclarationRef) - toReExportRef (A.ReExportRef _ src ref) = - fmap - (, ref) - (A.exportSourceImportedFrom src) - toReExportRef _ = Nothing + tyDecls' = M.insert qNm thisDecl tyDecls + ctorMap' = + foldl' + ( \acc A.DataConstructorDeclaration {..} -> + M.insert (Qualified (ByModuleName mn) $ properToIdent dataCtorName) qNm acc + ) + ctorMap + ctors + in Datatypes tyDecls' ctorMap' + A.DataBindingGroupDeclaration neDecls -> foldl' go datatypes neDecls + _ -> datatypes - -- Remove duplicate imports - dedupeImports :: [(Ann, ModuleName)] -> [(Ann, ModuleName)] - dedupeImports = fmap swap . M.toList . M.fromListWith const . fmap swap + goCtor :: A.DataConstructorDeclaration -> CtorDecl SourceType + goCtor A.DataConstructorDeclaration {..} = + let qCtorNm = Qualified (ByModuleName mn) $ properToIdent dataCtorName + in CtorDecl qCtorNm dataCtorFields - ssA :: SourceSpan -> Ann - ssA ss = (ss, [], Nothing) +{- | Given a SourcePos and Identifier, look up the type of that identifier, also returning its NameVisiblity. - -- Desugars member declarations from AST to CoreFn representation. - declToCoreFn :: A.Declaration -> [Bind Ann] - declToCoreFn (A.DataDeclaration (ss, com) Newtype _ _ [ctor]) = - [NonRec (ss, [], declMeta) (properToIdent $ A.dataCtorName ctor) $ - Abs (ss, com, Just IsNewtype) (Ident "x") (Var (ssAnn ss) $ Qualified ByNullSourcePos (Ident "x"))] - where + NOTE: Local variables should all be qualified by their SourcePos, whereas imports (and maybe top level decls in the module? can't remember) + are qualified by their ModuleName. What we do here is first look for a "local" type for the identifier using the provided source position, + then, if that fails, look up the identifier in the "global" scope using a module name. + + I *think* this is fine but I'm not *certain*. +-} +lookupType :: forall m. (M m) => A.SourcePos -> Ident -> m (SourceType, NameVisibility) +lookupType sp tn = do + mn <- getModuleName + env <- gets checkEnv + case M.lookup (Qualified (BySourcePos sp) tn) (names env) of + Nothing -> case M.lookup (mkQualified tn mn) (names env) of + Nothing -> error $ "No type found for " <> show tn + Just (ty, _, nv) -> do + traceM $ "lookupType: " <> showIdent' tn <> " :: " <> ppType 10 ty + pure (ty, nv) + Just (ty, _, nv) -> do + traceM $ "lookupType: " <> showIdent' tn <> " :: " <> ppType 10 ty + pure (ty, nv) + +getInnerListTy :: Type a -> Maybe (Type a) +getInnerListTy (ListT arr) = Just arr +getInnerListTy (ForAll _ _ _ _ ty _) = getInnerListTy ty +getInnerListTy _ = Nothing + +-- | Extracts inner type of an object if it is behind foralls +getInnerObjectTy :: Type a -> Maybe (Type a) +getInnerObjectTy (RecordT row) = Just row +getInnerObjectTy (ForAll _ _ _ _ ty _) = getInnerObjectTy ty +getInnerObjectTy _ = Nothing + +objectToCoreFn :: forall m. (M m) => ModuleName -> SourceSpan -> SourceType -> SourceType -> [(PSString, A.Expr)] -> m (Expr Ann) +objectToCoreFn mn ss recTy row objFields = do + traceM $ "ObjLitTy: " <> show row + let (tyFields, _) = rowToList row + tyMap = M.fromList $ (\x -> (runLabel (rowListLabel x), x)) <$> tyFields + resolvedFields <- foldM (go tyMap) [] objFields + pure $ Literal (ss, [], Nothing) recTy (ObjectLiteral resolvedFields) + where + go :: M.Map PSString (RowListItem SourceAnn) -> [(PSString, Expr Ann)] -> (PSString, A.Expr) -> m [(PSString, Expr Ann)] + go tyMap acc (lbl, expr) = case M.lookup lbl tyMap of + Just rowListItem -> do + let fieldTy = rowListType rowListItem + expr' <- exprToCoreFn mn ss (Just fieldTy) expr + pure $ (lbl, expr') : acc + Nothing -> do + -- error $ "row type missing field " <> T.unpack (prettyPrintString lbl) + expr' <- exprToCoreFn mn ss Nothing expr + pure $ (lbl, expr') : acc + +{- Converts declarations from their AST to CoreFn representation, deducing types when possible & inferring them when not possible. + + TODO: The module name can be retrieved from the monadic context and doesn't need to be passed around +-} + +-- newtype T = T Foo turns into T :: Foo -> Foo +declToCoreFn :: forall m. (M m) => ModuleName -> A.Declaration -> m [Bind Ann] +declToCoreFn _ (A.DataDeclaration (ss, com) Newtype name _ [ctor]) = wrapTrace ("decltoCoreFn NEWTYPE " <> show name) $ case A.dataCtorFields ctor of + [(_, wrappedTy)] -> do + -- traceM (show ctor) + let innerFunTy = quantify $ function wrappedTy wrappedTy + pure + [ NonRec (ss, [], declMeta) (properToIdent $ A.dataCtorName ctor) $ + Abs (ss, com, Just IsNewtype) innerFunTy (Ident "x") (Var (ssAnn ss) (purusTy wrappedTy) $ Qualified ByNullSourcePos (Ident "x")) + ] + _ -> error "Found newtype with multiple fields" + where declMeta = isDictTypeName (A.dataCtorName ctor) `orEmpty` IsTypeClassConstructor - declToCoreFn d@(A.DataDeclaration _ Newtype _ _ _) = - error $ "Found newtype with multiple constructors: " ++ show d - declToCoreFn (A.DataDeclaration (ss, com) Data tyName _ ctors) = - flip fmap ctors $ \ctorDecl -> - let - ctor = A.dataCtorName ctorDecl - (_, _, _, fields) = lookupConstructor env (Qualified (ByModuleName mn) ctor) - in NonRec (ssA ss) (properToIdent ctor) $ Constructor (ss, com, Nothing) tyName ctor fields - declToCoreFn (A.DataBindingGroupDeclaration ds) = - concatMap declToCoreFn ds - declToCoreFn (A.ValueDecl (ss, com) name _ _ [A.MkUnguarded e]) = - [NonRec (ssA ss) name (exprToCoreFn ss com Nothing e)] - declToCoreFn (A.BindingGroupDeclaration ds) = - [Rec . NEL.toList $ fmap (\(((ss, com), name), _, e) -> ((ssA ss, name), exprToCoreFn ss com Nothing e)) ds] - declToCoreFn _ = [] +-- Reject newtypes w/ multiple constructors +declToCoreFn _ d@(A.DataDeclaration _ Newtype _ _ _) = + error $ "Found newtype with multiple constructors: " ++ show d +-- Data declarations shouldn't exist here +declToCoreFn mn (A.DataDeclaration (ss, com) Data tyName _ ctors) = + error $ + "declToCoreFn: INTERNAL ERROR. Encountered a data declaration in module " + <> show (pretty mn) + <> " for datatype: " + <> T.unpack (runProperName tyName) + <> "\n but datatype declarations should have been removed in a previous step" +-- NOTE: This should be OK because you can data declarations can only appear at the top-level. +-- TODO: Prettier error +declToCoreFn mn (A.DataBindingGroupDeclaration ds) = wrapTrace "declToCoreFn DATA GROUP DECL" $ concat <$> traverse (declToCoreFn mn) ds +-- Essentially a wrapper over `exprToCoreFn`. Not 100% sure if binding the type of the declaration is necessary here? +-- NOTE: Should be impossible to have a guarded expr here, make it an error +declToCoreFn mn (A.ValueDecl (ss, _) name _ _ [A.MkUnguarded e]) = wrapTrace ("decltoCoreFn VALDEC " <> show name) $ do + traceM $ renderValue 100 e + (valDeclTy, nv) <- lookupType (spanStart ss) name + traceM (ppType 100 valDeclTy) + bindLocalVariables [(ss, name, valDeclTy, nv)] $ do + expr <- exprToCoreFn mn ss (Just valDeclTy) e -- maybe wrong? might need to bind something here? + pure [NonRec (ssA ss) name expr] +-- Recursive binding groups. This is tricky. Calling `typedOf` saves us a lot of work, but it's hard to tell whether that's 100% safe here +declToCoreFn mn (A.BindingGroupDeclaration ds) = wrapTrace "declToCoreFn BINDING GROUP" $ do + let typed = NE.toList $ extractTypeAndPrepareBind <$> ds + toBind = snd <$> typed + recBody <- bindLocalVariables toBind $ traverse goRecBindings typed + pure [Rec recBody] + where + -- If we only ever call this on a top-level binding group then this should be OK, all the exprs should be explicitly typed + extractTypeAndPrepareBind :: ((A.SourceAnn, Ident), NameKind, A.Expr) -> (A.Expr, (SourceSpan, Ident, SourceType, NameVisibility)) + extractTypeAndPrepareBind (((ss', _), ident), _, A.TypedValue _ e ty) = (e, (ss', ident, ty, Defined)) + extractTypeAndPrepareBind (((_, _), ident), _, _) = error $ "Top level declaration " <> showIdent' ident <> " should have a type annotation, but does not" + + goRecBindings :: (A.Expr, (SourceSpan, Ident, SourceType, NameVisibility)) -> m ((Ann, Ident), Expr Ann) + goRecBindings (expr, (ss', ident, ty, _)) = do + expr' <- exprToCoreFn mn ss' (Just ty) expr + pure ((ssA ss', ident), expr') +-- TODO: Avoid catchall case +declToCoreFn _ _ = pure [] - -- Desugars expressions from AST to CoreFn representation. - exprToCoreFn :: SourceSpan -> [Comment] -> Maybe SourceType -> A.Expr -> Expr Ann - exprToCoreFn _ com _ (A.Literal ss lit) = - Literal (ss, com, Nothing) (fmap (exprToCoreFn ss com Nothing) lit) - exprToCoreFn ss com _ (A.Accessor name v) = - Accessor (ss, com, Nothing) name (exprToCoreFn ss [] Nothing v) - exprToCoreFn ss com ty (A.ObjectUpdate obj vs) = - ObjectUpdate (ss, com, Nothing) (exprToCoreFn ss [] Nothing obj) (ty >>= unchangedRecordFields (fmap fst vs)) $ fmap (second (exprToCoreFn ss [] Nothing)) vs - where +-- Desugars expressions from AST to typed CoreFn representation. +exprToCoreFn :: forall m. (M m) => ModuleName -> SourceSpan -> Maybe SourceType -> A.Expr -> m (Expr Ann) +-- List & Object literals can contain non-literal expressions. Both of these types should always be tagged +-- (i.e. returned as an AST.TypedValue) after the initial typechecking phase, so we expect the type to be passed in +exprToCoreFn mn ss (Just arrT) astlit@(A.Literal _ (ListLiteral ts)) + | Just ty <- getInnerListTy arrT = + wrapTrace ("exprToCoreFn ARRAYLIT " <> renderValue 100 astlit) $ do + traceM $ ppType 100 arrT + mkList ty <$> traverse (exprToCoreFn mn ss (Just ty)) ts +exprToCoreFn _ _ Nothing astlit@(A.Literal _ (ListLiteral _)) = + internalError $ "Error while desugaring List Literal. No type provided for literal:\n" <> renderValue 100 astlit +exprToCoreFn mn ss (Just recTy) (A.Literal _ (ObjectLiteral objFields)) + | Just row <- getInnerObjectTy recTy = + objectToCoreFn mn ss recTy row objFields +exprToCoreFn _ _ (Just ty) (A.Literal _ (ObjectLiteral _)) = + internalError $ "Error while desugaring Object Literal. Unexpected type:\n" <> show ty +exprToCoreFn _ _ Nothing astlit@(A.Literal _ (ObjectLiteral _)) = + internalError $ "Error while desugaring Object Literal. No type provided for literal:\n" <> renderValue 100 astlit +-- Literals that aren't objects or arrays have deterministic types +exprToCoreFn _ _ _ (A.Literal ss (NumericLiteral (Left int))) = + pure $ Literal (ss, [], Nothing) tyInt (NumericLiteral (Left int)) +exprToCoreFn _ _ _ (A.Literal ss (NumericLiteral (Right number))) = + pure $ Literal (ss, [], Nothing) tyNumber (NumericLiteral (Right number)) +exprToCoreFn _ _ _ (A.Literal ss (CharLiteral char)) = + pure $ Literal (ss, [], Nothing) tyChar (CharLiteral char) +exprToCoreFn _ _ _ (A.Literal ss (BooleanLiteral boolean)) = + if boolean then pure true else pure false +exprToCoreFn _ _ _ (A.Literal ss (StringLiteral string)) = + pure $ Literal (ss, [], Nothing) tyString (StringLiteral string) +-- Accessor case is straightforward (these should always be typed explicitly) +exprToCoreFn mn ss (Just accT) accessor@(A.Accessor name v) = wrapTrace ("exprToCoreFn ACCESSOR " <> renderValue 100 accessor) $ do + v' <- exprToCoreFn mn ss Nothing v -- v should always have a type assigned during typechecking (i.e. it will be a TypedValue that will be unwrapped) + pure $ Accessor (ssA ss) accT name v' +exprToCoreFn mn ss Nothing accessor@(A.Accessor name v) = do + v' <- exprToCoreFn mn ss Nothing v + let vTy = exprType v' + env <- getEnv + case analyzeCtor vTy of + Nothing -> + internalError $ + "(1) Error while desugaring record accessor." + <> " No type provided for expression: \n" + <> renderValue 100 accessor + <> "\nRecord type: " + <> ppType 1000 vTy + <> "\nsynonyms: " + <> show (runProperName . disqualify <$> M.keys env.types) + Just (TypeConstructor _ tyNm, _) -> case M.lookup (tyNameToCtorName tyNm) env.dataConstructors of + Nothing -> + internalError $ + "(2) Error while desugaring record accessor." + <> " No type provided for expression: \n" + <> renderValue 100 accessor + Just (_, _, ty, _) -> case stripQuantifiers ty of + (_, RecordT inner :-> _) -> do + let tyMap = M.fromList $ (\x -> (runLabel (rowListLabel x), x)) <$> (fst $ rowToList inner) + case M.lookup name tyMap of + Just (rowListType -> resTy) -> pure $ Accessor (ssA ss) resTy name v' + Nothing -> + internalError $ + "(3) Error while desugaring record accessor." + <> " No type provided for expression: \n" + <> renderValue 100 accessor + (_, other) -> internalError $ "****DEBUG:\n" <> ppType 100 other + where + tyNameToCtorName :: Qualified (ProperName 'TypeName) -> Qualified (ProperName 'ConstructorName) + tyNameToCtorName (Qualified qb tNm) = Qualified qb (coerceProperName tNm) +exprToCoreFn mn ss (Just recT) objUpd@(A.ObjectUpdate obj vs) = wrapTrace ("exprToCoreFn OBJ UPDATE " <> renderValue 100 objUpd) $ do + obj' <- exprToCoreFn mn ss Nothing obj + vs' <- traverse (\(lbl, val) -> exprToCoreFn mn ss Nothing val >>= \val' -> pure (lbl, val')) vs + pure $ + ObjectUpdate + (ssA ss) + recT + obj' + (unchangedRecordFields (fmap fst vs) recT) + vs' + where + -- TODO: Optimize/Refactor Using Data.Set -- Return the unchanged labels of a closed record, or Nothing for other types or open records. unchangedRecordFields :: [PSString] -> Type a -> Maybe [PSString] unchangedRecordFields updated (TypeApp _ (TypeConstructor _ C.Record) row) = @@ -103,170 +400,365 @@ moduleToCoreFn env (A.Module modSS coms mn decls (Just exps)) = collect (RCons _ (Label l) _ r) = (if l `elem` updated then id else (l :)) <$> collect r collect _ = Nothing unchangedRecordFields _ _ = Nothing - exprToCoreFn ss com _ (A.Abs (A.VarBinder _ name) v) = - Abs (ss, com, Nothing) name (exprToCoreFn ss [] Nothing v) - exprToCoreFn _ _ _ (A.Abs _ _) = - internalError "Abs with Binder argument was not desugared before exprToCoreFn mn" - exprToCoreFn ss com _ (A.App v1 v2) = - App (ss, com, (isDictCtor v1 || isSynthetic v2) `orEmpty` IsSyntheticApp) v1' v2' - where - v1' = exprToCoreFn ss [] Nothing v1 - v2' = exprToCoreFn ss [] Nothing v2 +exprToCoreFn _ _ Nothing objUpd@(A.ObjectUpdate _ _) = + internalError $ "Error while desugaring object update. No type provided for expression:\n" <> renderValue 100 objUpd +-- Lambda abstraction. See the comments on `instantiatePolyType` above for an explanation of the strategy here. +exprToCoreFn mn _ (Just t) (A.Abs (A.VarBinder ssb name) v) = wrapTrace ("exprToCoreFn " <> showIdent' name) $ + withInstantiatedFunType mn t $ \a b -> do + body <- bindLocalVariables [(ssb, name, a, Defined)] $ exprToCoreFn mn ssb (Just b) v + pure $ Abs (ssA ssb) (function a b) name body +-- By the time we receive the AST, only Lambdas w/ a VarBinder should remain +-- TODO: Better failure message if we pass in 'Nothing' as the (Maybe Type) arg for an Abstraction +exprToCoreFn _ _ t lam@(A.Abs _ _) = + internalError $ + "Abs with Binder argument was not desugared before exprToCoreFn: \n" + <> renderValue 100 lam + <> "\n\n" + <> show (ppType 100 <$> t) + <> "\n" + <> show lam +{- The App case is substantially complicated by our need to correctly type + expressions that contain type class dictionary constructors, specifically expressions like: + + ``` + (C$Dict :: forall x. {method :: x -> (...)}) -> {method :: x -> (..)}) ({method: f}) + ```` + + Because the dictionary ctor and record of methods it is being applied to + are untouched by the PS typechecker, we have to instantiate the + quantified variables to conform with the supplied type. +-} +exprToCoreFn mn ss mTy app@(A.App fun arg) + | isDictCtor fun = wrapTrace "exprToCoreFn APP DICT " $ do + traceM $ "APP Dict type" <> show (ppType 100 <$> mTy) + traceM $ "APP Dict expr:\n" <> renderValue 100 app + let analyzed = mTy >>= analyzeCtor + prettyAnalyzed = bimap (ppType 100) (fmap (ppType 100)) <$> analyzed + traceM $ "APP DICT analyzed:\n" <> show prettyAnalyzed + case mTy of + Just iTy -> + case analyzed of + -- Branch for a "normal" (i.e. non-empty) typeclass dictionary application + Just (TypeConstructor _ (Qualified qb nm), args) -> do + traceM $ "APP Dict name: " <> T.unpack (runProperName nm) + env <- getEnv + case M.lookup (Qualified qb $ coerceProperName nm) (dataConstructors env) of + Just (_, _, ty, _) -> do + traceM $ "APP Dict original type:\n" <> ppType 100 ty + case instantiate ty args of + iFun@(iArg :-> iRes) -> do + traceM $ "APP Dict iArg:\n" <> ppType 100 iArg + traceM $ "APP Dict iRes:\n" <> ppType 100 iRes + fun' <- exprToCoreFn mn ss (Just iFun) fun + arg' <- exprToCoreFn mn ss (Just iArg) arg + pure $ App (ss, [], Nothing) fun' arg' + _ -> error "dict ctor has to have a function type" + _ -> throwError . errorMessage' ss . UnknownName . fmap DctorName $ Qualified qb (coerceProperName nm) + -- This should actually be impossible here, so long as we desugared all the constrained types properly + Just (other, _) -> error $ "APP Dict not a constructor type (impossible here?): \n" <> ppType 100 other + -- Case for handling empty dictionaries (with no methods) + Nothing -> wrapTrace "APP DICT 3" $ do + -- REVIEW: This might be the one place where `kindType` in instantiatePolyType is wrong, check the kinds in the output + -- REVIEW: We might want to match more specifically on both/either the expression and type level to + -- ensure that we are working only with empty dictionaries here. (Though anything else should be caught be the previous case) + let (inner, g, act) = instantiatePolyType mn iTy + act (exprToCoreFn mn ss (Just inner) app) >>= \case + App ann' e1 e2 -> pure . g $ App ann' e1 e2 + _ -> error "An application desguared to something else. This should not be possible." + Nothing -> error $ "APP Dict w/o type passed in (impossible to infer):\n" <> renderValue 100 app + | otherwise = wrapTrace "exprToCoreFn APP" $ do + traceM $ renderValue 100 app + fun' <- exprToCoreFn mn ss Nothing fun + let funTy = exprType fun' + traceM $ "app fun:\n" <> ppType 100 funTy <> "\n" <> renderExprStr fun' + arg' <- exprToCoreFn mn ss Nothing arg -- We want to keep the original "concrete" arg type + traceM $ "app arg:\n" <> ppType 100 (exprType arg') <> "\n" <> renderExprStr arg' + pure $ App (ss, [], Nothing) fun' arg' + where isDictCtor = \case A.Constructor _ (Qualified _ name) -> isDictTypeName name + A.TypedValue _ e _ -> isDictCtor e _ -> False - isSynthetic = \case - A.App v3 v4 -> isDictCtor v3 || isSynthetic v3 && isSynthetic v4 - A.Accessor _ v3 -> isSynthetic v3 - A.Var NullSourceSpan _ -> True - A.Unused{} -> True - _ -> False - exprToCoreFn ss com _ (A.Unused _) = - Var (ss, com, Nothing) C.I_undefined - exprToCoreFn _ com _ (A.Var ss ident) = - Var (ss, com, getValueMeta ident) ident - exprToCoreFn ss com _ (A.IfThenElse v1 v2 v3) = - Case (ss, com, Nothing) [exprToCoreFn ss [] Nothing v1] - [ CaseAlternative [LiteralBinder (ssAnn ss) $ BooleanLiteral True] - (Right $ exprToCoreFn ss [] Nothing v2) - , CaseAlternative [NullBinder (ssAnn ss)] - (Right $ exprToCoreFn ss [] Nothing v3) ] - exprToCoreFn _ com _ (A.Constructor ss name) = - Var (ss, com, Just $ getConstructorMeta name) $ fmap properToIdent name - exprToCoreFn ss com _ (A.Case vs alts) = - Case (ss, com, Nothing) (fmap (exprToCoreFn ss [] Nothing) vs) (fmap (altToCoreFn ss) alts) - exprToCoreFn ss com _ (A.TypedValue _ v ty) = - exprToCoreFn ss com (Just ty) v - exprToCoreFn ss com _ (A.Let w ds v) = - Let (ss, com, getLetMeta w) (concatMap declToCoreFn ds) (exprToCoreFn ss [] Nothing v) - exprToCoreFn _ com ty (A.PositionedValue ss com1 v) = - exprToCoreFn ss (com ++ com1) ty v - exprToCoreFn _ _ _ e = - error $ "Unexpected value in exprToCoreFn mn: " ++ show e - - -- Desugars case alternatives from AST to CoreFn representation. - altToCoreFn :: SourceSpan -> A.CaseAlternative -> CaseAlternative Ann - altToCoreFn ss (A.CaseAlternative bs vs) = CaseAlternative (map (binderToCoreFn ss []) bs) (go vs) - where - go :: [A.GuardedExpr] -> Either [(Guard Ann, Expr Ann)] (Expr Ann) - go [A.MkUnguarded e] - = Right (exprToCoreFn ss [] Nothing e) - go gs - = Left [ (exprToCoreFn ss [] Nothing cond, exprToCoreFn ss [] Nothing e) - | A.GuardedExpr g e <- gs - , let cond = guardToExpr g - ] - - guardToExpr [A.ConditionGuard cond] = cond - guardToExpr _ = internalError "Guard not correctly desugared" - - -- Desugars case binders from AST to CoreFn representation. - binderToCoreFn :: SourceSpan -> [Comment] -> A.Binder -> Binder Ann - binderToCoreFn _ com (A.LiteralBinder ss lit) = - LiteralBinder (ss, com, Nothing) (fmap (binderToCoreFn ss com) lit) - binderToCoreFn ss com A.NullBinder = - NullBinder (ss, com, Nothing) - binderToCoreFn _ com (A.VarBinder ss name) = - VarBinder (ss, com, Nothing) name - binderToCoreFn _ com (A.ConstructorBinder ss dctor@(Qualified mn' _) bs) = - let (_, tctor, _, _) = lookupConstructor env dctor - in ConstructorBinder (ss, com, Just $ getConstructorMeta dctor) (Qualified mn' tctor) dctor (fmap (binderToCoreFn ss []) bs) - binderToCoreFn _ com (A.NamedBinder ss name b) = - NamedBinder (ss, com, Nothing) name (binderToCoreFn ss [] b) - binderToCoreFn _ com (A.PositionedBinder ss com1 b) = - binderToCoreFn ss (com ++ com1) b - binderToCoreFn ss com (A.TypedBinder _ b) = - binderToCoreFn ss com b - binderToCoreFn _ _ A.OpBinder{} = - internalError "OpBinder should have been desugared before binderToCoreFn" - binderToCoreFn _ _ A.BinaryNoParensBinder{} = - internalError "BinaryNoParensBinder should have been desugared before binderToCoreFn" - binderToCoreFn _ _ A.ParensInBinder{} = - internalError "ParensInBinder should have been desugared before binderToCoreFn" - - -- Gets metadata for let bindings. - getLetMeta :: A.WhereProvenance -> Maybe Meta - getLetMeta A.FromWhere = Just IsWhere - getLetMeta A.FromLet = Nothing +-- Dunno what to do here. Haven't encountered an Unused so far, will need to see one to figure out how to handle them +exprToCoreFn _ _ _ (A.Unused _) = + -- ????? need to figure out what this _is_ + error "Don't know what to do w/ exprToCoreFn A.Unused" +exprToCoreFn _ _ (Just ty) (A.Var ss ident@(Qualified _ (GenIdent _ _))) = + wrapTrace ("exprToCoreFn VAR (gen) " <> show ident) $ + gets checkEnv >>= \env -> + pure $ Var (ss, [], getValueMeta env ident) (purusTy ty) ident +-- Non-generated Variables should *always* be bound & typed in the Environment before we encounter them. +-- NOTE: Not sure if we should ignore a type passed in? Generally we shouldn't *pass* types here, but bind variables +exprToCoreFn _ _ _ (A.Var ss ident) = + wrapTrace ("exprToCoreFn VAR " <> show ident) $ + gets checkEnv >>= \env -> case lookupValue env ident of + Just (ty, _, _) -> pure $ Var (ss, [], getValueMeta env ident) (purusTy ty) ident + Nothing -> + lookupDictType ident >>= \case + Just ty -> pure $ Var (ss, [], getValueMeta env ident) (purusTy ty) ident + Nothing -> internalError $ "No known type for identifier " <> show ident +exprToCoreFn _ _ mty expr@(A.Var ss ident) = + internalError $ + "Internal compiler error (exprToCoreFn var fail): Cannot synthesize type for var " + <> show expr + <> "\nSupplied type: " + <> show (ppType 100 <$> mty) +-- If-Then-Else Turns into a case expression +exprToCoreFn mn ss (Just resT) (A.IfThenElse cond th el) = wrapTrace "exprToCoreFn IFTE" $ do + condE <- exprToCoreFn mn ss (Just tyBoolean) cond + thE <- exprToCoreFn mn ss (Just resT) th + elE <- exprToCoreFn mn ss (Just resT) el + pure $ + Case + (ss, [], Nothing) + resT + [condE] + [ CaseAlternative + [truePat] + (Right thE) + , CaseAlternative + [NullBinder (ssAnn ss)] + (Right elE) + ] +exprToCoreFn _ _ Nothing ifte@(A.IfThenElse _ _ _) = + internalError $ "Error while desugaring If-then-else expression. No type provided for:\n " <> renderValue 100 ifte +-- Constructor case is straightforward, we should already have all of the type info +exprToCoreFn _ _ (Just ctorTy) (A.Constructor ss name) = wrapTrace ("exprToCoreFn CTOR " <> show name) $ do + ctorMeta <- flip getConstructorMeta name <$> getEnv + pure $ Var (ss, [], Just ctorMeta) (purusTy ctorTy) $ fmap properToIdent name +exprToCoreFn _ _ Nothing ctor@(A.Constructor _ _) = + internalError $ "Error while desugaring Constructor expression. No type provided for:\n" <> renderValue 100 ctor +{- Case Expressions - -- Gets metadata for values. - getValueMeta :: Qualified Ident -> Maybe Meta - getValueMeta name = - case lookupValue env name of - Just (_, External, _) -> Just IsForeign - _ -> Nothing + For ordinary case expressions (i.e. those not generated by the compiler during guard desugaring), + the type can be determined by the type of a top-level declaration or + explicit type annotation (which may be either supplied by the user or inferred by the + PS typechecker) and therefore should be passed explicitly. - -- Gets metadata for data constructors. - getConstructorMeta :: Qualified (ProperName 'ConstructorName) -> Meta - getConstructorMeta ctor = - case lookupConstructor env ctor of - (Newtype, _, _, _) -> IsNewtype - dc@(Data, _, _, fields) -> - let constructorType = if numConstructors (ctor, dc) == 1 then ProductType else SumType - in IsConstructor constructorType fields - where + For compiler-generated case expressions (specifically: those generated during case/guard desugaring - + some get generated during typeclass desugaring but we have special machinery to ensure that + those types can be synthesized), we cannot be sure that the whole case expression has an explicit + type annotation, so we try to deduce the type from the types of the alternative branches. - numConstructors - :: (Qualified (ProperName 'ConstructorName), (DataDeclType, ProperName 'TypeName, SourceType, [Ident])) - -> Int - numConstructors ty = length $ filter (((==) `on` typeConstructor) ty) $ M.toList $ dataConstructors env + NOTE: This is kind of a hack to let us reuse (rather than rewrite) the existing case/guard + desugaring machinery. In order to correctly type the generated `let` bindings + (see Language.PureScript.Sugar.CaseDeclarations), we must manually construct a polymorphic + type that the PS typechecker cannot infer or deduce. We cannot construct such a type without + the initial PS typechecker pass. We could write two nearly-identical versions of the + case desugaring machinery and try to run the typechecker twice, but that adds a lot of + complexity (machinery is complicated) and would not be good for performance (typechecking + and inference have bad complexity). +-} +exprToCoreFn mn ss (Just caseTy) astCase@(A.Case vs alts) = wrapTrace "exprToCoreFn CASE" $ do + traceM $ "CASE:\n" <> renderValue 100 astCase + traceM $ "CASE TY:\n" <> show (ppType 100 caseTy) + (vs', ts) <- unzip <$> traverse (exprToCoreFn mn ss Nothing >=> (\e -> pure (e, exprType e))) vs -- extract type information for the *scrutinees* + alts' <- traverse (altToCoreFn mn ss caseTy ts) alts -- see explanation in altToCoreFn. We pass in the types of the scrutinee(s) + pure $ Case (ssA ss) (purusTy caseTy) vs' alts' +exprToCoreFn mn ss Nothing astCase@(A.Case vs alts@(alt : _)) = wrapTrace "exprToCoreFn CASE (no type)" $ do + case alt of + A.CaseAlternative _ (A.GuardedExpr _ body1 : _) -> do + caseTy <- exprType <$> exprToCoreFn mn ss Nothing body1 + traceM $ "CASE:\n" <> renderValue 100 astCase + traceM $ "CASE TY:\n" <> show (ppType 100 caseTy) + (vs', ts) <- unzip <$> traverse (exprToCoreFn mn ss Nothing >=> (\e -> pure (e, exprType e))) vs -- extract type information for the *scrutinees* + alts' <- traverse (altToCoreFn mn ss caseTy ts) alts -- see explanation in altToCoreFn. We pass in the types of the scrutinee(s) + pure $ Case (ssA ss) (purusTy caseTy) vs' alts' + _ -> internalError $ "Error while desugaring Case expression. Could not synthesize type of: " <> renderValue 100 astCase +exprToCoreFn _ _ Nothing astCase@(A.Case _ _) = + internalError $ "Error while desugaring Case expression. No type provided for:\n" <> renderValue 100 astCase +-- We prioritize the supplied type over the inferred type, since a type should only ever be passed when known to be correct. +exprToCoreFn mn ss (Just ty) (A.TypedValue _ v _) = + wrapTrace "exprToCoreFn TV1" $ + exprToCoreFn mn ss (Just ty) v +-- If we encounter a TypedValue w/o a supplied type, we use the annotated type +exprToCoreFn mn ss Nothing (A.TypedValue _ v ty) = + wrapTrace "exprToCoreFn TV2" $ + exprToCoreFn mn ss (Just ty) v +-- Complicated. See `transformLetBindings` +exprToCoreFn mn ss _ (A.Let w ds v) = wrapTrace "exprToCoreFn LET" $ case NE.nonEmpty ds of + Nothing -> error "declarations in a let binding can't be empty" + Just _ -> do + (decls, expr) <- transformLetBindings mn ss [] ds v + pure $ Let (ss, [], getLetMeta w) decls expr - typeConstructor - :: (Qualified (ProperName 'ConstructorName), (DataDeclType, ProperName 'TypeName, SourceType, [Ident])) - -> (ModuleName, ProperName 'TypeName) - typeConstructor (Qualified (ByModuleName mn') _, (_, tyCtor, _, _)) = (mn', tyCtor) - typeConstructor _ = internalError "Invalid argument to typeConstructor" +-- Pretty sure we should prefer the positioned SourceSpan +exprToCoreFn mn _ ty (A.PositionedValue ss _ v) = + wrapTrace "exprToCoreFn POSVAL" $ + exprToCoreFn mn ss ty v +-- Function should never reach this case, but there are a lot of AST Expressions that shouldn't ever appear here, so +-- we use a catchall case. +exprToCoreFn _ ss _ e = + internalError $ + "Unexpected value in exprToCoreFn:\n" + <> renderValue 100 e + <> "at position:\n" + <> show ss --- | Find module names from qualified references to values. This is used to --- ensure instances are imported from any module that is referenced by the --- current module, not just from those that are imported explicitly (#667). -findQualModules :: [A.Declaration] -> [ModuleName] -findQualModules decls = - let (f, _, _, _, _) = everythingOnValues (++) fqDecls fqValues fqBinders (const []) (const []) - in f `concatMap` decls +-- Desugars case alternatives from AST to CoreFn representation. +altToCoreFn :: + forall m. + (M m) => + ModuleName -> + SourceSpan -> + SourceType -> -- The "return type", i.e., the type of the expr to the right of the -> in a case match branch (we always know this) + [SourceType] -> -- The types of the *scrutinees*, i.e. the `x` in `case x of (...)`. NOTE: Still not sure why there can be more than one + A.CaseAlternative -> + m (CaseAlternative Ann) +altToCoreFn mn ss ret boundTypes (A.CaseAlternative bs vs) = wrapTrace "altToCoreFn" $ do + env <- gets checkEnv + bTypes <- M.unions <$> zipWithM inferBinder' boundTypes bs -- Inferring the types for binders requires some special machinery & knowledge of the scrutinee type. NOTE: Not sure why multiple binders? + let toBind = (\(n', (ss', ty')) -> (ss', n', ty', Defined)) <$> M.toList bTypes + binders = binderToCoreFn (snd <$> bTypes) env mn ss <$> bs + ege <- go toBind vs + pure $ CaseAlternative binders ege where - fqDecls :: A.Declaration -> [ModuleName] - fqDecls (A.TypeInstanceDeclaration _ _ _ _ _ _ q _ _) = getQual' q - fqDecls (A.ValueFixityDeclaration _ _ q _) = getQual' q - fqDecls (A.TypeFixityDeclaration _ _ q _) = getQual' q - fqDecls _ = [] - - fqValues :: A.Expr -> [ModuleName] - fqValues (A.Var _ q) = getQual' q - fqValues (A.Constructor _ q) = getQual' q - fqValues _ = [] - - fqBinders :: A.Binder -> [ModuleName] - fqBinders (A.ConstructorBinder _ q _) = getQual' q - fqBinders _ = [] - - getQual' :: Qualified a -> [ModuleName] - getQual' = maybe [] return . getQual - --- | Desugars import declarations from AST to CoreFn representation. -importToCoreFn :: A.Declaration -> Maybe (Ann, ModuleName) -importToCoreFn (A.ImportDeclaration (ss, com) name _ _) = Just ((ss, com, Nothing), name) -importToCoreFn _ = Nothing - --- | Desugars foreign declarations from AST to CoreFn representation. -externToCoreFn :: A.Declaration -> Maybe Ident -externToCoreFn (A.ExternDeclaration _ name _) = Just name -externToCoreFn _ = Nothing + go :: [(SourceSpan, Ident, SourceType, NameVisibility)] -> [A.GuardedExpr] -> m (Either [(Guard Ann, Expr Ann)] (Expr Ann)) + go toBind [A.MkUnguarded e] = wrapTrace "altToCoreFn GO" $ do + expr <- bindLocalVariables toBind $ exprToCoreFn mn ss (Just ret) e -- need to bind all variables that occur in the binders. We know the type of the right hand side (as it was passed in) + pure $ Right expr + -- NOTE: Not sure whether this works / TODO: Make a test case that uses guards in case expressions + go toBind gs = bindLocalVariables toBind $ do + ges <- forM gs $ \case + A.GuardedExpr g e -> do + let cond = guardToExpr g + condE <- exprToCoreFn mn ss (Just tyBoolean) cond -- (Just tyBoolean)? + eE <- exprToCoreFn mn ss (Just ret) e + pure (condE, eE) + pure . Left $ ges + guardToExpr [A.ConditionGuard cond] = cond + guardToExpr _ = internalError "Guard not correctly desugared" --- | Desugars export declarations references from AST to CoreFn representation. --- CoreFn modules only export values, so all data constructors, instances and --- values are flattened into one list. -exportToCoreFn :: A.DeclarationRef -> [Ident] -exportToCoreFn (A.TypeRef _ _ (Just dctors)) = fmap properToIdent dctors -exportToCoreFn (A.TypeRef _ _ Nothing) = [] -exportToCoreFn (A.TypeOpRef _ _) = [] -exportToCoreFn (A.ValueRef _ name) = [name] -exportToCoreFn (A.ValueOpRef _ _) = [] -exportToCoreFn (A.TypeClassRef _ _) = [] -exportToCoreFn (A.TypeInstanceRef _ name _) = [name] -exportToCoreFn (A.ModuleRef _ _) = [] -exportToCoreFn (A.ReExportRef _ _ _) = [] +transformLetBindings :: forall m. (M m) => ModuleName -> SourceSpan -> [Bind Ann] -> [A.Declaration] -> A.Expr -> m ([Bind Ann], Expr Ann) +transformLetBindings mn ss seen [] ret = (seen,) <$> withBindingGroupVisible (exprToCoreFn mn ss Nothing ret) +transformLetBindings mn _ss seen ((A.ValueDecl sa@(ss, _) ident nameKind [] [A.MkUnguarded (A.TypedValue checkType val ty)]) : rest) ret = + wrapTrace ("transformLetBindings VALDEC TYPED " <> showIdent' ident <> " :: " <> ppType 100 ty) $ + bindNames (M.singleton (Qualified (BySourcePos $ spanStart ss) ident) (ty, nameKind, Defined)) $ do + thisDecl <- declToCoreFn mn (A.ValueDecl sa ident nameKind [] [A.MkUnguarded (A.TypedValue checkType val ty)]) + let seen' = seen ++ thisDecl + transformLetBindings mn _ss seen' rest ret +transformLetBindings mn _ss seen (A.ValueDecl (ss, _) ident nameKind [] [A.MkUnguarded val] : rest) ret = wrapTrace ("transformLetBindings VALDEC " <> showIdent' ident <> " = " <> renderValue 100 val) $ do + e <- exprToCoreFn mn ss Nothing val + let ty = exprType e + if not (containsUnknowns ty) -- TODO: Don't need this anymore (shouldn't ever contain unknowns) + then bindNames (M.singleton (Qualified (BySourcePos $ spanStart ss) ident) (ty, nameKind, Defined)) $ do + let thisDecl = [NonRec (ssA ss) ident e] + let seen' = seen ++ thisDecl + transformLetBindings mn _ss seen' rest ret + else + error $ + "The inferred type for let-bound identifier \n '" + <> showIdent' ident + <> "'\ncontains unification variables:\n " + <> ppType 1000 ty + <> "\nIf this let-bound identifier occurs in a user-defined `let-binding`, please add a type signature for '" + <> showIdent' ident + <> "'" + <> "\nIf the identifier occurs in a compiler-generated `let-binding` with guards (e.g. in a guarded case branch), try removing the guarded expression (e.g. use a normal if-then expression)" +-- NOTE/TODO: This is super hack-ey. Ugh. +transformLetBindings mn _ss seen (A.BindingGroupDeclaration ds : rest) ret = wrapTrace "transformLetBindings BINDINGGROUPDEC" $ do + -- All of the types in the binding group should be TypedValues (after my modifications to the typechecker) + -- NOTE: We re-implement part of TypeChecker.Types.typeDictionaryForBindingGroup here because it *could* try to do + -- type checking/inference, which we want to avoid (because it mangles our types) + let types = go <$> NEL.toList ((\(i, _, v) -> (i, v)) <$> ds) + case sequence types of + Right typed -> do + let ds' = flip map typed $ \((sann, iden), (expr, ty)) -> A.ValueDecl sann iden Private [] [A.MkUnguarded (A.TypedValue False expr ty)] + dict = M.fromList $ flip map typed $ \(((ss, _), ident), (_, ty)) -> (Qualified (BySourcePos $ spanStart ss) ident, (ty, Private, Undefined)) + bindNames dict $ do + makeBindingGroupVisible + thisDecl <- concat <$> traverse (declToCoreFn mn) ds' + let seen' = seen ++ thisDecl + transformLetBindings mn _ss seen' rest ret + -- Because this has already been through the typechecker once, every value in the binding group should have an explicit type. I hope. + Left _ -> + error $ + "untyped binding group element in mutually recursive LET binding group after initial typechecker pass: \n" + <> show (lefts types) + where + go :: ((SourceAnn, Ident), A.Expr) -> Either ((SourceAnn, Ident), A.Expr) ((SourceAnn, Ident), (A.Expr, SourceType)) + go (annName, A.TypedValue _ expr ty) = Right (annName, (expr, ty)) + go (annName, other) = Left (annName, other) +transformLetBindings _ _ _ _ _ = error "Invalid argument to TransformLetBindings" --- | Converts a ProperName to an Ident. -properToIdent :: ProperName a -> Ident -properToIdent = Ident . runProperName +{- | Infer the types of variables brought into scope by a binder *without* instantiating polytypes to unknowns. +TODO: Check whether unifyTypes needed +-} +inferBinder' :: + forall m. + (MonadState CheckState m, MonadError MultipleErrors m, MonadWriter MultipleErrors m) => + SourceType -> + A.Binder -> + m (M.Map Ident (SourceSpan, SourceType)) +inferBinder' _ A.NullBinder = return M.empty +inferBinder' _ (A.LiteralBinder _ (StringLiteral _)) = wrapTrace "inferBinder' STRLIT" $ return M.empty +inferBinder' _ (A.LiteralBinder _ (CharLiteral _)) = wrapTrace "inferBinder' CHARLIT" $ return M.empty +inferBinder' _ (A.LiteralBinder _ (NumericLiteral (Left _))) = wrapTrace "inferBinder' LITINT" $ return M.empty +inferBinder' _ (A.LiteralBinder _ (NumericLiteral (Right _))) = wrapTrace "inferBinder' NUMBERLIT" $ return M.empty +inferBinder' _ (A.LiteralBinder _ (BooleanLiteral _)) = wrapTrace "inferBinder' BOOLLIT" $ return M.empty +inferBinder' val (A.VarBinder ss name) = wrapTrace ("inferBinder' VAR " <> T.unpack (runIdent name)) $ return $ M.singleton name (ss, val) +inferBinder' val (A.ConstructorBinder ss ctor binders) = wrapTrace ("inferBinder' CTOR: " <> show ctor) $ do + traceM $ "InferBinder VAL:\n" <> ppType 100 val + env <- getEnv + let cArgs = ctorArgs val + traceM $ "InferBinder CTOR ARGS:\n" <> concatMap (\x -> ppType 100 x <> "\n") cArgs + case M.lookup ctor (dataConstructors env) of + Just (_, _, _ty, _) -> do + let ty = instantiate _ty cArgs + traceM $ "InferBinder CTOR TY:\n" <> ppType 100 ty + let (args, _) = peelArgs ty + traceM $ "InferBinder ARGS:\n" <> concatMap (\x -> ppType 100 x <> "\n") args + M.unions <$> zipWithM inferBinder' (reverse args) binders + _ -> throwError . errorMessage' ss . UnknownName . fmap DctorName $ ctor + where + peelArgs :: Type a -> ([Type a], Type a) + peelArgs = go [] + where + go args (TypeApp _ (TypeApp _ fn arg) ret) | eqType fn tyFunction = go (arg : args) ret + go args ret = (args, ret) +inferBinder' val (A.LiteralBinder _ (ObjectLiteral props)) = wrapTrace "inferBinder' OBJECTLIT" $ do + traceM $ ppType 100 val + let props' = sortOn fst props + case unwrapRecord val of + Left notARecord -> + error $ + "Internal error while desugaring binders to CoreFn: \nType " + <> ppType 100 notARecord + <> "\n is not a record type" + Right rowItems -> do + let typeKeys = S.fromList $ fst <$> rowItems + exprKeys = S.fromList $ fst <$> props' + -- The type-level labels are authoritative + diff = S.difference typeKeys exprKeys + if S.null diff + then deduceRowProperties (M.fromList rowItems) props' + else error $ "Error. Object literal in a pattern match is missing fields: " <> show diff + where + deduceRowProperties :: M.Map PSString SourceType -> [(PSString, A.Binder)] -> m (M.Map Ident (SourceSpan, SourceType)) + deduceRowProperties _ [] = pure M.empty + deduceRowProperties types ((lbl, bndr) : rest) = case M.lookup lbl types of + Nothing -> error $ "Cannot deduce type information for record with label " <> show lbl -- should be impossible after typechecking + Just ty -> do + x <- inferBinder' ty bndr + xs <- deduceRowProperties types rest + pure $ M.union x xs +-- TODO: Remove ListT pattern synonym +inferBinder' (ListT val) (A.LiteralBinder _ (ListLiteral binders)) = wrapTrace "inferBinder' ARRAYLIT" $ M.unions <$> traverse (inferBinder' val) binders +inferBinder' _ (A.LiteralBinder _ (ListLiteral _)) = internalError "bad type in array binder " +inferBinder' val (A.NamedBinder ss name binder) = wrapTrace ("inferBinder' NAMEDBINDER " <> T.unpack (runIdent name)) $ + warnAndRethrowWithPositionTC ss $ do + m <- inferBinder' val binder + return $ M.insert name (ss, val) m +inferBinder' val (A.PositionedBinder pos _ binder) = + wrapTrace "inferBinder' POSITIONEDBINDER" $ + warnAndRethrowWithPositionTC pos $ + inferBinder' val binder +inferBinder' _ (A.TypedBinder ty binder) = wrapTrace "inferBinder' TYPEDBINDER" $ do + (elabTy, _) <- kindOf ty + inferBinder' elabTy binder +inferBinder' _ A.OpBinder {} = + internalError "OpBinder should have been desugared before inferBinder'" +inferBinder' _ A.BinaryNoParensBinder {} = + internalError "BinaryNoParensBinder should have been desugared before inferBinder'" +inferBinder' _ A.ParensInBinder {} = + internalError "ParensInBinder should have been desugared before inferBinder'" diff --git a/src/Language/PureScript/CoreFn/Desugar/Utils.hs b/src/Language/PureScript/CoreFn/Desugar/Utils.hs new file mode 100644 index 000000000..3672c62a4 --- /dev/null +++ b/src/Language/PureScript/CoreFn/Desugar/Utils.hs @@ -0,0 +1,745 @@ +{- HLINT ignore "Use void" -} +{- HLINT ignore "Use <$" -} +{- HLINT ignore "Use <&>" -} +{-# OPTIONS_GHC -Wno-orphans #-} + +module Language.PureScript.CoreFn.Desugar.Utils where + +import Protolude (MonadError (..), traverse_) +import Prelude + +import Data.Function (on) +import Data.Map qualified as M +import Data.Tuple (swap) + +import Control.Lens.Plated +import Control.Monad.State.Strict (MonadState, gets, modify') +import Control.Monad.Supply.Class (MonadSupply) +import Control.Monad.Writer.Class (MonadWriter) +import Data.Bifunctor (Bifunctor (..)) +import Data.List (foldl') +import Data.List.NonEmpty qualified as NEL +import Data.Text qualified as T +import Debug.Trace (trace, traceM) +import Language.PureScript.AST qualified as A +import Language.PureScript.AST.Declarations (declSourceSpan) +import Language.PureScript.AST.Literals (Literal (..)) +import Language.PureScript.AST.SourcePos ( + SourceAnn, + SourceSpan (..), + pattern NullSourceSpan, + ) +import Language.PureScript.AST.Traversals (everythingOnValues, overTypes) +import Language.PureScript.Constants.Prim qualified as C +import Language.PureScript.CoreFn.Ann (Ann) +import Language.PureScript.CoreFn.Binders (Binder (..)) +import Language.PureScript.CoreFn.Expr (Expr (..), PurusType) +import Language.PureScript.CoreFn.Meta (ConstructorType (..), Meta (..)) +import Language.PureScript.Crash (internalError) +import Language.PureScript.Environment ( + DataDeclType (..), + Environment (..), + NameKind (..), + NameVisibility (..), + TypeClassData (typeClassArguments), + dictTypeName, + function, + isDictTypeName, + lookupConstructor, + lookupValue, + (-:>), + pattern RecordT, + pattern (:->), + ) +import Language.PureScript.Errors ( + MultipleErrors, + ) +import Language.PureScript.Label (Label (..)) +import Language.PureScript.Names (Ident (..), ModuleName, ProperName (..), ProperNameType (..), Qualified (..), QualifiedBy (..), coerceProperName, getQual, runIdent) +import Language.PureScript.PSString (PSString) +import Language.PureScript.Sugar (desugarGuardedExprs) +import Language.PureScript.TypeChecker.Monad ( + CheckState (checkCurrentModule, checkEnv), + bindLocalVariables, + debugNames, + getEnv, + withScopedTypeVars, + ) +import Language.PureScript.TypeChecker.Types ( + kindType, + ) +import Language.PureScript.TypeClassDictionaries (NamedDict, TypeClassDictionaryInScope (..)) +import Language.PureScript.Types (Constraint (..), RowListItem (..), SourceType, Type (..), everywhereOnTypes, quantify, replaceTypeVars, rowToSortedList, srcTypeApp, srcTypeConstructor, srcTypeVar) + + +{- UTILITIES -} +-- TODO: Explain purpose of every function + +-- | Type synonym for a monad that has all of the required typechecker functionality +type M m = (MonadSupply m, MonadState CheckState m, MonadError MultipleErrors m, MonadWriter MultipleErrors m) + +{- "Type Constructor analysis" machinery. (This requires some explaining) + + In the course of converting to typed CoreFn, we always proceed "top-down" + from top-level declarations which must have a type annotation attached + (their typechecker enforces this - it will add an inferred annotation if + the user fails to annotate the type). + + Because not all sub-expression (specifically, "synthetic applications" where a type class + dictionary constructor is applied to its argument in an instance declaration) are typed, + we may run into situations where the inferred or reconstructed type for a sub-expression + is universally quantified, even though we know (via our "top-down" approach) that the + quantified type variables should be instantiated (either to concrete types or to + type variables which are introduced in the outer lexical scope). + + An example (from test 4310) makes the problem clearer. Suppose we have: + + ``` + data Tuple a b = Tuple a b + + infixr 6 Tuple as /\ + infixr 6 type Tuple as /\ + + mappend :: String -> String -> String + mappend _ _ = "mappend" + + infixr 5 mappend as <> + + class Test a where + runTest :: a -> String + + instance Test Int where + runTest _ = "4" + + instance (Test a, Test b) => Test (a /\ b) where + runTest (a /\ b) = runTest a <> runTest b + + ``` + + The generated code for the typeclass declaration gives us (in part): + + ``` + Test$Dict :: forall a. { runTest :: a -> String } -> { runTest :: a -> String } + Test$Dict = \(x: { runTest :: a -> String} ) -> + (x: { runTest :: a -> String} ) + + runTest :: forall (@a :: Type). Test$Dict a -> a -> String + runTest = \(dict: Test$Dict a) -> + case (dict: Test$Dict a) of + (Test$Dict v) -> (v: { runTest :: a -> String} ).runTest + ``` + + Because the Tuple instance for Test uses `runTest` (the function), and because + `runTest` is universally quantified, if we did not instantiate those quantifiers, + a new skolem scope will be introduced at each application of `runTest`, giving us + type variables that cannot be unified with the outermost type variables. + + That is, without using this machiner (and `instantiate`), we end up with something like + this for the tuple instance: + + ``` + test/\ :: forall (a :: Type) (b :: Type). Test$Dict a -> Test$Dict b -> Test$Dict (Tuple a b) + test/\ = \(dictTest: Test$Dict a) -> + \(dictTest1: Test$Dict b) -> + (Test$Dict: { runTest :: a -> String} -> Test$Dict a ) { runTest: \(v: Tuple a0 b1) -> } + case (v: Tuple a0 b1) of + (Tuple a b) -> + ((mappend: String -> String -> String) + (((runTest: forall (@a :: Type). Test$Dict a -> a -> String) (dictTest: Test$Dict a)) (a: t1))) + (((runTest: forall (@a :: Type). Test$Dict a -> a -> String) (dictTest1: Test$Dict b)) (b: t2)) + ``` + + By using this machinery in `inferBinder'`, we can instantiate the quantifiers to the + lexically scoped type variables in the top-level signature, and get output that is properly typed: + + ``` + test/\ :: forall (a :: Type) (b :: Type). Test$Dict a -> Test$Dict b -> Test$Dict (Tuple a b) + test/\ = \(dictTest: Test$Dict a) -> + \(dictTest1: Test$Dict b) -> + (Test$Dict: { runTest :: Tuple a b -> String} -> Test$Dict (Tuple a b) ) { runTest: \(v: Tuple a b) -> } + case (v: Tuple a b) of + (Tuple a b) -> + ((mappend: String -> String -> String) + (((runTest: forall (@a :: Type). Test$Dict a -> a -> String) (dictTest: Test$Dict a)) (a: a))) + (((runTest: forall (@a :: Type). Test$Dict a -> a -> String) (dictTest1: Test$Dict b)) (b: b)) + + ``` + + We also use this in the branch of the `App` case of `exprToCoreFn` that handles dictionary applications + (in the same manner and for the same purpose). + +-} + +-- Given a type (which we expect to be a TyCon applied to type args), +-- extract (TyCon,[Args]) (returning Nothing if the input type is not a TyCon) +analyzeCtor :: SourceType -> Maybe (SourceType, [SourceType]) +analyzeCtor t = (,ctorArgs t) <$> ctorFun t + +-- Extract all of the arguments to a type constructor +ctorArgs :: SourceType -> [SourceType] +ctorArgs (TypeApp _ t1 t2) = ctorArgs t1 <> [t2] +ctorArgs _ = [] + +-- Extract the TyCon ("function") part of an applied Type Constructor +ctorFun :: SourceType -> Maybe SourceType +ctorFun (TypeApp _ t1 _) = go t1 + where + go (TypeApp _ tx _) = case ctorFun tx of + Nothing -> Just tx + Just tx' -> Just tx' + go other = Just other +ctorFun _ = Nothing + +{- Instantiation machinery. This differs from `instantiatePolyType` and + `withInstantiatedFunType` in that those functions are used to "peek under" + the quantifier in a universally quantified type (i.e. those functions + *put the quantifier back* after temporarily instantiating the quantified variables + *to type variables* for the purposes of type reconstruction). + + This instantiates a quantified type (the first arg) and *does not* replace the + quantifier. This is primarily used when we encounter an expression with a universally + quantified type (either as an annotation in a AST.TypedValue or as the result of looking up + the type in the typechecking environment) in a context where we know (from our top-down approach) + that the instantiated type must be instantiated to something "concrete" (where, again, + a "concrete" type can either be an explicit type or a tyvar from the outer scope). +-} +instantiate :: SourceType -> [SourceType] -> SourceType +instantiate ty [] = ty +instantiate (ForAll _ _ var _ inner _) (t : ts) = replaceTypeVars var t $ instantiate inner ts +instantiate other _ = other + +-- | Traverse a literal. Note that literals are usually have a type like `Literal (Expr a)`. That is: The `a` isn't typically an annotation, it's an expression type +traverseLit :: forall m a b. (Applicative m) => (a -> m b) -> Literal a -> m (Literal b) +traverseLit f = \case + NumericLiteral x -> pure $ NumericLiteral x + StringLiteral x -> pure $ StringLiteral x + CharLiteral x -> pure $ CharLiteral x + BooleanLiteral x -> pure $ BooleanLiteral x + ListLiteral xs -> ListLiteral <$> traverse f xs + ObjectLiteral xs -> ObjectLiteral <$> traverse (\(str, x) -> (str,) <$> f x) xs + +-- Wrapper around instantiatePolyType to provide a better interface +withInstantiatedFunType :: (M m) => ModuleName -> SourceType -> (SourceType -> SourceType -> m (Expr Ann)) -> m (Expr Ann) +withInstantiatedFunType mn ty act = case instantiatePolyType mn ty of + (a :-> b, replaceForalls, bindAct) -> bindAct $ replaceForalls <$> act a b + (other, _, _) -> + let !showty = show other + in error $ "Internal error. Expected a function type, but got: " <> showty + +{- This function more-or-less contains our strategy for handling polytypes (quantified or constrained types). It returns a tuple T such that: + - T[0] is the inner type, where all of the quantifiers and constraints have been removed. We just instantiate the quantified type variables to themselves (I guess?) - the previous + typchecker passes should ensure that quantifiers are all well scoped and that all essential renaming has been performed. Typically, the inner type should be a function. + Constraints are eliminated by replacing the constraint argument w/ the appropriate dictionary type. + + - T[1] is a function to transform the eventual expression such that it is properly typed. Basically: It puts the quantifiers back, (hopefully) in the right order and with + the correct visibility, skolem scope, etc. + + - T[2] is a monadic action which binds local variables or type variables so that we can use type inference machinery on the expression corresponding to this type. + NOTE: The only local vars this will bind are "dict" identifiers introduced to type desguared typeclass constraints. + That is: If you're using this on a function type, you'll still have to bind the antecedent type to the + identifier bound in the VarBinder. +-} +-- TODO: Explicitly return two sourcetypes for arg/return types +instantiatePolyType :: (M m) => ModuleName -> SourceType -> (SourceType, Expr b -> Expr b, m a -> m a) +instantiatePolyType mn = \case + ForAll ann vis var mbk t mSkol -> case instantiatePolyType mn t of + (inner, g, act) -> + let f = \case + Abs ann' ty' ident' expr' -> + Abs ann' (ForAll ann vis var (purusTy mbk) (purusTy ty') mSkol) ident' expr' + other -> other + -- FIXME: kindType? + act' ma = withScopedTypeVars mn [(var, kindType)] $ act ma -- NOTE: Might need to pattern match on mbk and use the real kind (though in practice this should always be of kind Type, I think?) + in (inner, f . g, act') + fun@(a :-> _) -> case analyzeCtor a of + Just (TypeConstructor _ (Qualified _ nm), _) -> + if isDictTypeName nm + then + let act' ma = bindLocalVariables [(NullSourceSpan, Ident "dict", a, Defined)] ma + in (fun, id, act') + else (fun, id, id) + _ -> (fun, id, id) + other -> (other, id, id) + +-- In a context where we expect a Record type (object literals, etc), unwrap the record and get at the underlying rowlist +unwrapRecord :: Type a -> Either (Type a) [(PSString, Type a)] +unwrapRecord = \case + RecordT lts -> Right $ go <$> fst (rowToSortedList lts) + other -> Left other + where + go :: RowListItem a -> (PSString, Type a) + go RowListItem {..} = (runLabel rowListLabel, rowListType) + +traceNameTypes :: (M m) => m () +traceNameTypes = do + nametypes <- getEnv >>= pure . debugNames + traverse_ traceM nametypes + +desugarCasesEverywhere :: (M m) => A.Declaration -> m A.Declaration +desugarCasesEverywhere d = traverseDeclBodies (transformM $ desugarGuardedExprs (declSourceSpan d)) d + +traverseDeclBodies :: forall m. (Applicative m) => (A.Expr -> m A.Expr) -> A.Declaration -> m A.Declaration +traverseDeclBodies f = \case + A.BindingGroupDeclaration decls -> + A.BindingGroupDeclaration + <$> traverse go {- (\(annIdent,nk,expr) -> f expr >>= \e -> pure (annIdent,nk,e)) -} decls + A.ValueDecl ann name nk bs [A.MkUnguarded e] -> + (\x -> A.ValueDecl ann name nk bs [A.MkUnguarded x]) <$> f e + other -> pure other + where + go :: ((A.SourceAnn, Ident), NameKind, A.Expr) -> m ((A.SourceAnn, Ident), NameKind, A.Expr) + go (annid, nk, e) = (annid,nk,) <$> f e + +instance Plated A.Expr where + plate f = \case + A.Literal ss litE -> A.Literal ss <$> traverseLit f litE + A.UnaryMinus ss e -> A.UnaryMinus ss <$> f e + A.BinaryNoParens a b c -> A.BinaryNoParens <$> f a <*> f b <*> f c + A.Parens e -> A.Parens <$> f e + A.Accessor str e -> A.Accessor str <$> f e + A.ObjectUpdate e fs -> A.ObjectUpdate <$> f e <*> (traverse . traverse) f fs + A.ObjectUpdateNested e pt -> A.ObjectUpdateNested <$> f e <*> traverse f pt + A.Abs b e -> A.Abs b <$> f e + A.App e1 e2 -> A.App <$> f e1 <*> f e2 + A.VisibleTypeApp e t -> (\ex -> A.VisibleTypeApp ex t) <$> f e + A.Unused e -> A.Unused <$> f e + A.Var ss i -> pure $ A.Var ss i + A.Op ss nm -> pure $ A.Op ss nm + A.IfThenElse c e1 e2 -> A.IfThenElse <$> f c <*> f e1 <*> f e2 + A.Constructor ss nm -> pure $ A.Constructor ss nm + A.Case es alts -> A.Case <$> traverse f es <*> traverse goAlt alts + A.TypedValue b e t -> (\ex -> A.TypedValue b ex t) <$> f e + A.Let wp decls e -> A.Let wp <$> traverse (traverseDeclBodies f) decls <*> f e + A.Do mn doElems -> A.Do mn <$> traverse goDoElem doElems + A.Ado mn dElems e -> A.Ado mn <$> traverse goDoElem dElems <*> f e + A.PositionedValue ss cs e -> A.PositionedValue ss cs <$> f e + other -> pure other + where + goAlt = \case + A.CaseAlternative bs ges -> A.CaseAlternative bs <$> traverse goGE ges + goGE (A.GuardedExpr gs e) = A.GuardedExpr <$> traverse goGuard gs <*> f e + goGuard = \case + A.ConditionGuard e -> A.ConditionGuard <$> f e + A.PatternGuard b e -> A.PatternGuard b <$> f e + goDoElem = \case + A.DoNotationValue e -> A.DoNotationValue <$> f e + A.DoNotationBind b e -> A.DoNotationBind b <$> f e + A.DoNotationLet decls -> A.DoNotationLet <$> traverse (traverseDeclBodies f) decls + A.PositionedDoNotationElement ss cs de -> A.PositionedDoNotationElement ss cs <$> goDoElem de + +{- Since we operate on an AST where constraints have been desugared to dictionaries at the *expr* level, + using a typechecker context which contains ConstrainedTypes, looking up the type for a class method + will always give us a "wrong" type. Let's try fixing them in the context! +-} +desugarConstraintType :: SourceType -> SourceType +desugarConstraintType = \case + ForAll a vis var mbk t mSkol -> + let t' = desugarConstraintType t + in ForAll a vis var mbk t' mSkol + ConstrainedType _ Constraint {..} t -> + let inner = desugarConstraintType t + dictTyName :: Qualified (ProperName 'TypeName) = dictTypeName . coerceProperName <$> constraintClass + dictTyCon = srcTypeConstructor dictTyName + dictTy = foldl srcTypeApp dictTyCon constraintArgs + in function dictTy inner + other -> other + +desugarConstraintTypes :: (M m) => m () +desugarConstraintTypes = do + env <- getEnv + let f = everywhereOnTypes desugarConstraintType + + oldNameTypes = names env + desugaredNameTypes = (\(st, nk, nv) -> (f st, nk, nv)) <$> oldNameTypes + + oldTypes = types env + desugaredTypes = first f <$> oldTypes + + oldCtors = dataConstructors env + desugaredCtors = (\(a, b, c, d) -> (a, b, f c, d)) <$> oldCtors + + oldSynonyms = typeSynonyms env + desugaredSynonyms = second f <$> oldSynonyms + + newEnv = + env + { names = desugaredNameTypes + , types = desugaredTypes + , dataConstructors = desugaredCtors + , typeSynonyms = desugaredSynonyms + } + + modify' $ \checkstate -> checkstate {checkEnv = newEnv} + +desugarConstraintsInBinder :: A.Binder -> A.Binder +desugarConstraintsInBinder = \case + A.NullBinder -> A.NullBinder + A.LiteralBinder ss lb -> A.LiteralBinder ss $ desugarConstraintsInBinder <$> lb + A.VarBinder ss ident -> A.VarBinder ss ident + A.ConstructorBinder ss qn bs -> A.ConstructorBinder ss qn $ desugarConstraintsInBinder <$> bs + A.OpBinder ss qn -> A.OpBinder ss qn + A.BinaryNoParensBinder a b c -> + let f = desugarConstraintsInBinder + in A.BinaryNoParensBinder (f a) (f b) (f c) + A.ParensInBinder b -> A.ParensInBinder $ desugarConstraintsInBinder b + A.NamedBinder ss ident b -> A.NamedBinder ss ident $ desugarConstraintsInBinder b + A.PositionedBinder ss cs b -> A.PositionedBinder ss cs $ desugarConstraintsInBinder b + A.TypedBinder ty b -> A.TypedBinder (desugarConstraintType ty) (desugarConstraintsInBinder b) + +desugarConstraintsInDecl :: A.Declaration -> A.Declaration +desugarConstraintsInDecl = \case + A.BindingGroupDeclaration decls -> + A.BindingGroupDeclaration $ + (\(annIdent, nk, expr) -> (annIdent, nk, overTypes desugarConstraintType expr)) <$> decls + A.ValueDecl ann name nk bs [A.MkUnguarded e] -> + let bs' = desugarConstraintsInBinder <$> bs + in A.ValueDecl ann name nk bs' [A.MkUnguarded $ overTypes desugarConstraintType e] + A.DataDeclaration ann declTy tName args ctorDecs -> + let fixCtor (A.DataConstructorDeclaration a nm fields) = + A.DataConstructorDeclaration a nm (second (everywhereOnTypes desugarConstraintType) <$> fields) + in A.DataDeclaration ann declTy tName args (fixCtor <$> ctorDecs) + A.DataBindingGroupDeclaration ds -> A.DataBindingGroupDeclaration $ desugarConstraintsInDecl <$> ds + other -> other + +-- TODO: Remove this +pTrace :: (Monad m, Show a) => a -> m () +pTrace = traceM . show + +-- | Given a string and a monadic action, produce a trace with the given message before & after the action (with pretty lines to make it more readable) +wrapTrace :: (Monad m) => String -> m a -> m a +wrapTrace msg act = do + traceM startMsg + res <- act + traceM endMsg + pure res + where + padding = replicate 10 '=' + pad str = padding <> str <> padding + startMsg = pad $ "BEGIN " <> msg + endMsg = pad $ "END " <> msg + +{- + This is used to solve a problem that arises with re-exported instances. + + We diverge from PureScript by "desugaring" constrained types to types that contain + explicit type class dictionaries. (We have to do this for PIR conversion - we have to type + all nodes of the AST.) + + During PureScript's initial desugaring phase, type class declarations, instance declarations, and + expressions that contain type class constaints are transformed into generated value declarations. For example: + + ``` + class Eq a where + eq a :: a -> a -> Bool + + f :: forall a. Eq a => a -> a -> Boolean + f x y = eq x y + ``` + + Is transformed into (something like, I'm ommitting the full generated code for brevity): + + ``` + Eq$Dict :: forall a. {eq :: a -> a -> Boolean } -> {eq :: a -> a -> Boolean} + Eq$Dict x = x + + eq :: forall a. Eq$Dict a -> a -> a -> Boolean + eq = \dict -> case dict of + (v :: {eq :: a -> a -> Boolean}) -> v.eq + + f :: forall a. Eq a => a -> a -> Boolean + f = \dict x y -> (eq dict) x y + ``` + + Three important things to note here: + - PureScript does *not* transform constrained types into types that contain explicit dictionaries, + even though the expressions are desugared to contain those dictionaries. (We do this ourselves + after the PS typechecking phase) + - Generated declarations for type classes and instances are not (and cannot be) exported, + because typeclass desugaring takes place *after* import/export resolution + in their desugaring pipeline. (This would be difficult to fix, each step of the desugaring pipeline + expects input that conforms to the output of the previous step). + - Generated code relating to typeclass dictionaries is ignored by the PureScript typechecker. + Ordinarily, we can rely on the typechecker to insert the type annotation for most + expressions, but we cannot do so here. + + These factors give rise to a problem: Our desugared constraint types (where we transform + type annotations of the form `C a => (..)` into `C$Dict a -> (...)`) no longer contain constraints, + and therefore we cannot use the constraint solving machinery directly to infer the types of + identifiers that refer to type class dictionaries. Because generated type class code cannot be exported + by the user in the source (and would not ordinarily be implicitly re-exported even if it could be exported), + we cannot rely upon normal import resolution to provide the types corresponding to dictionary identifiers. + + This solves the problem. Because we use the same state/module scope as the PS typechecker, we + have access to all of the type class dictionaries (including their identifiers) that are in scope. + When we encounter an identifier that cannot be assigned a type by the normal type lookup process, + we extract a map from identifiers to source types, and lookup the identifier in the map, allowing us to + resolve the types of dictionary expressions. + + These identifiers are always qualified by module in the AST, so cannot clash with local definitions, which + are qualified by SourcePos. + + NOTE: In theory (at least), this component of the type checker environment can change if we + make any calls to `infer` or any of the type checking functions in the + TypeChecker.X namespace. So for now, we rebuild this map every time we fail to + lookup the type for an identifier in the normal way. (Which is grossly + inefficient) + + In principle, we should be able to totally reconstruct the types w/o making + any calls to `infer` or the typechecker machinery. Once that is done, we can + construct this map only once for each module, which will greatly improve performance. +-} +lookupDictType :: (M m) => Qualified Ident -> m (Maybe SourceType) +lookupDictType nm = do + tyClassDicts <- typeClassDictionaries <$> getEnv + let dictMap = dictionaryIdentMap tyClassDicts + pure $ M.lookup nm dictMap + where + dictionaryIdentMap :: + M.Map QualifiedBy (M.Map (Qualified (ProperName 'ClassName)) (M.Map (Qualified Ident) (NEL.NonEmpty NamedDict))) -> + M.Map (Qualified Ident) SourceType + dictionaryIdentMap m = foldl' go M.empty inner + where + -- duplicates? + inner = concatMap NEL.toList . M.elems $ M.unions $ concatMap M.elems $ M.elems m + go :: M.Map (Qualified Ident) SourceType -> NamedDict -> M.Map (Qualified Ident) SourceType + go acc TypeClassDictionaryInScope {..} = M.insert tcdValue dictTy acc + where + dictTy = foldl' srcTypeApp dictTyCon tcdInstanceTypes + dictTyCon = srcTypeConstructor $ coerceProperName . dictTypeName <$> tcdClassName + +() :: String -> String -> String +x y = x <> "\n" <> y + +-- We need a string for traces and readability is super important here +showIdent' :: Ident -> String +showIdent' = T.unpack . runIdent + +{- | Turns a `Type a` into a `Type ()`. We shouldn't need source position information for types. +NOTE: Deprecated (probably) +-} +purusTy :: SourceType -> PurusType +purusTy = id -- fmap (const ()) + +-- | Given a class name, return the TypeClassData associated with the name. +getTypeClassData :: (M m) => Qualified (ProperName 'ClassName) -> m TypeClassData +getTypeClassData nm = do + env <- getEnv + case M.lookup nm (typeClasses env) of + Nothing -> error $ "No type class data for " show nm " found in" show (typeClasses env) + Just cls -> pure cls + +-- | Given a class name, return the parameters to the class and their *kinds*. (Maybe SourceType is a kind. Type classes cannot be parameterized by anything other than type variables) +getTypeClassArgs :: (M m) => Qualified (ProperName 'ClassName) -> m [(T.Text, SourceType)] +getTypeClassArgs nm = getTypeClassData nm >>= (pure . typeClassArguments) + +-- | Retrieves the current module name from the context. This should never fail (as we set the module name when we start converting a module) +getModuleName :: (M m) => m ModuleName +getModuleName = + gets checkCurrentModule >>= \case + Just mn -> pure mn + Nothing -> error "No module name found in checkState" + +-- Creates a map from a module name to the re-export references defined in +-- that module. +reExportsToCoreFn :: (ModuleName, A.DeclarationRef) -> M.Map ModuleName [Ident] +reExportsToCoreFn (mn', ref') = M.singleton mn' (exportToCoreFn ref') + +toReExportRef :: A.DeclarationRef -> Maybe (ModuleName, A.DeclarationRef) +toReExportRef (A.ReExportRef _ src ref) = + fmap + (,ref) + (A.exportSourceImportedFrom src) +toReExportRef _ = Nothing + +-- Remove duplicate imports +dedupeImports :: [(Ann, ModuleName)] -> [(Ann, ModuleName)] +dedupeImports = fmap swap . M.toList . M.fromListWith const . fmap swap + +-- | Create an Ann (with no comments or metadata) from a SourceSpan +ssA :: SourceSpan -> Ann +ssA ss = (ss, [], Nothing) + +-- Gets metadata for let bindings. +getLetMeta :: A.WhereProvenance -> Maybe Meta +getLetMeta A.FromWhere = Just IsWhere +getLetMeta A.FromLet = Nothing + +-- Gets metadata for values. +getValueMeta :: Environment -> Qualified Ident -> Maybe Meta +getValueMeta env name = + case lookupValue env name of + Just (_, External, _) -> Just IsForeign + _ -> Nothing + +-- Gets metadata for data constructors. +getConstructorMeta :: Environment -> Qualified (ProperName 'ConstructorName) -> Meta +getConstructorMeta env ctor = + case lookupConstructor env ctor of + (Newtype, _, _, _) -> IsNewtype + dc@(Data, _, _, fields) -> + let constructorType = if numConstructors (ctor, dc) == 1 then ProductType else SumType + in IsConstructor constructorType fields + where + numConstructors :: + (Qualified (ProperName 'ConstructorName), (DataDeclType, ProperName 'TypeName, SourceType, [Ident])) -> + Int + numConstructors ty = length $ filter (((==) `on` typeConstructor) ty) $ M.toList $ dataConstructors env + + typeConstructor :: + (Qualified (ProperName 'ConstructorName), (DataDeclType, ProperName 'TypeName, SourceType, [Ident])) -> + (ModuleName, ProperName 'TypeName) + typeConstructor (Qualified (ByModuleName mn') _, (_, tyCtor, _, _)) = (mn', tyCtor) + typeConstructor _ = internalError "Invalid argument to typeConstructor" + +{- | Find module names from qualified references to values. This is used to +ensure instances are imported from any module that is referenced by the +current module, not just from those that are imported explicitly (#667). +-} +findQualModules :: [A.Declaration] -> [ModuleName] +findQualModules decls = + let (f, _, _, _, _) = everythingOnValues (++) fqDecls fqValues fqBinders (const []) (const []) + in f `concatMap` decls + +fqDecls :: A.Declaration -> [ModuleName] +fqDecls (A.TypeInstanceDeclaration _ _ _ _ _ _ q _ _) = getQual' q +fqDecls (A.ValueFixityDeclaration _ _ q _) = getQual' q +fqDecls (A.TypeFixityDeclaration _ _ q _) = getQual' q +fqDecls _ = [] + +fqValues :: A.Expr -> [ModuleName] +fqValues (A.Var _ q) = getQual' q +fqValues (A.Constructor _ q) = getQual' q +fqValues _ = [] + +fqBinders :: A.Binder -> [ModuleName] +fqBinders (A.ConstructorBinder _ q _) = getQual' q +fqBinders _ = [] + +getQual' :: Qualified a -> [ModuleName] +getQual' = maybe [] return . getQual + +-- | Converts a ProperName to an Ident. +properToIdent :: ProperName a -> Ident +properToIdent = Ident . runProperName + +-- "Pure" desugaring utils + +-- Desugars case binders from AST to CoreFn representation. Doesn't need to be monadic / essentially the same as the old version. +binderToCoreFn :: M.Map Ident SourceType -> Environment -> ModuleName -> SourceSpan -> A.Binder -> Binder Ann +binderToCoreFn dict env mn _ss (A.LiteralBinder ss (ListLiteral bs)) = case bs of + [] -> nilP + (bx : bxs) -> + let bx' = binderToCoreFn dict env mn _ss bx + bxs' = binderToCoreFn dict env mn _ss $ A.LiteralBinder ss (ListLiteral bxs) + in consP [bx', bxs'] +binderToCoreFn _ _ _ _ss (A.LiteralBinder _ (BooleanLiteral b)) = + if b then truePat else falsePat +binderToCoreFn dict env mn _ss (A.LiteralBinder ss lit) = + let lit' = binderToCoreFn dict env mn ss <$> lit + in LiteralBinder (ss, [], Nothing) lit' +binderToCoreFn _ _ _ ss A.NullBinder = + NullBinder (ss, [], Nothing) +binderToCoreFn dict _ _ _ss vb@(A.VarBinder ss name) = + trace ("binderToCoreFn: " <> show vb) $ + VarBinder (ss, [], Nothing) name (dict M.! name) +binderToCoreFn dict env mn _ss (A.ConstructorBinder ss dctor@(Qualified mn' _) bs) = + let (_, tctor, _, _) = lookupConstructor env dctor + args = binderToCoreFn dict env mn _ss <$> bs + in ConstructorBinder (ss, [], Just $ getConstructorMeta env dctor) (Qualified mn' tctor) dctor args +binderToCoreFn dict env mn _ss (A.NamedBinder ss name b) = + let arg = binderToCoreFn dict env mn _ss b + in NamedBinder (ss, [], Nothing) name arg +binderToCoreFn dict env mn _ss (A.PositionedBinder ss _ b) = + binderToCoreFn dict env mn ss b +binderToCoreFn dict env mn ss (A.TypedBinder _ b) = + binderToCoreFn dict env mn ss b +binderToCoreFn _ _ _ _ A.OpBinder {} = + internalError "OpBinder should have been desugared before binderToCoreFn" +binderToCoreFn _ _ _ _ A.BinaryNoParensBinder {} = + internalError "BinaryNoParensBinder should have been desugared before binderToCoreFn" +binderToCoreFn _ _ _ _ A.ParensInBinder {} = + internalError "ParensInBinder should have been desugared before binderToCoreFn" + +-- | Desugars import declarations from AST to CoreFn representation. +importToCoreFn :: A.Declaration -> Maybe (Ann, ModuleName) +-- TODO: We probably *DO* want types here +importToCoreFn (A.ImportDeclaration (ss, com) name _ _) = Just ((ss, com, Nothing), name) +importToCoreFn _ = Nothing + +-- | Desugars foreign declarations from AST to CoreFn representation. +externToCoreFn :: A.Declaration -> Maybe Ident +externToCoreFn (A.ExternDeclaration _ name _) = Just name +externToCoreFn _ = Nothing + +{- | Desugars export declarations references from AST to CoreFn representation. +CoreFn modules only export values, so all data constructors, instances and +values are flattened into one list. +-} +exportToCoreFn :: A.DeclarationRef -> [Ident] +exportToCoreFn (A.TypeRef _ _ (Just dctors)) = fmap properToIdent dctors +exportToCoreFn (A.TypeRef _ _ Nothing) = [] +exportToCoreFn (A.TypeOpRef _ _) = [] +exportToCoreFn (A.ValueRef _ name) = [name] +exportToCoreFn (A.ValueOpRef _ _) = [] +exportToCoreFn (A.TypeClassRef _ _) = [] +exportToCoreFn (A.TypeInstanceRef _ name _) = [name] +exportToCoreFn (A.ModuleRef _ _) = [] +exportToCoreFn (A.ReExportRef _ _ _) = [] + +-- boolean constants + +pattern Boolean :: SourceType +pattern Boolean = TypeConstructor NoSourceAnn C.Boolean + +true :: Expr Ann +true = Var NoAnn Boolean (properToIdent <$> C.C_True) + +truePat :: Binder Ann +truePat = ConstructorBinder NoAnn C.Boolean C.C_True [] + +falsePat :: Binder Ann +falsePat = ConstructorBinder NoAnn C.Boolean C.C_False [] + +isTrue :: Expr Ann -> Bool +isTrue e = e == true + +false :: Expr Ann +false = Var NoAnn Boolean (properToIdent <$> C.C_False) + +isFalse :: Expr Ann -> Bool +isFalse e = e == false + +-- "List" (List) constants + +mkConsE :: Expr Ann -> Expr Ann -> Expr Ann +mkConsE x xs = (consE `appExp` x) `appExp` xs + where + appExp = App NoAnn + +consE :: Expr Ann +consE = Var NoAnn (quantify $ x -:> srcTypeApp listTyCon x -:> srcTypeApp listTyCon x) (properToIdent <$> C.C_Cons) + where + x = srcTypeVar "x" kindType + listTyCon = srcTypeConstructor C.List + +nilE :: SourceType -> Expr Ann +nilE ty = Var NoAnn (srcTypeApp listTyCon ty) (properToIdent <$> C.C_Nil) + where + listTyCon = srcTypeConstructor C.List + +mkList :: SourceType -> [Expr Ann] -> Expr Ann +mkList ty = foldr mkConsE (nilE ty) + +consP :: [Binder Ann] -> Binder Ann +consP bs = ConstructorBinder NoAnn C.List C.C_Cons bs + +nilP :: Binder Ann +nilP = ConstructorBinder NoAnn C.List C.C_Nil [] + +-- misc patterns + +pattern NoSourceAnn :: SourceAnn +pattern NoSourceAnn = (NullSourceSpan, []) + +pattern NoAnn :: Ann +pattern NoAnn = (NullSourceSpan, [], Nothing) diff --git a/src/Language/PureScript/CoreFn/Expr.hs b/src/Language/PureScript/CoreFn/Expr.hs index 20ab33301..ba4131409 100644 --- a/src/Language/PureScript/CoreFn/Expr.hs +++ b/src/Language/PureScript/CoreFn/Expr.hs @@ -1,122 +1,151 @@ --- | --- The core functional representation --- +{-# LANGUAGE TemplateHaskell #-} +{-# LANGUAGE InstanceSigs #-} + module Language.PureScript.CoreFn.Expr where import Prelude import Control.Arrow ((***)) +import Data.Aeson (FromJSON, ToJSON) +import GHC.Generics + import Language.PureScript.AST.Literals (Literal) import Language.PureScript.CoreFn.Binders (Binder) -import Language.PureScript.Names (Ident, ProperName, ProperNameType(..), Qualified) +import Language.PureScript.Names (Ident, Qualified) import Language.PureScript.PSString (PSString) +import Language.PureScript.Types (SourceType) + +import Control.Lens.TH (makePrisms) +import Control.Lens.Combinators (Plated (plate)) + +type PurusType = SourceType -- Type () --- | --- Data type for expressions and terms --- +{- | +Data type for expressions and terms +-} data Expr a - -- | - -- A literal value - -- - = Literal a (Literal (Expr a)) - -- | - -- A data constructor (type name, constructor name, field names) - -- - | Constructor a (ProperName 'TypeName) (ProperName 'ConstructorName) [Ident] - -- | - -- A record property accessor - -- - | Accessor a PSString (Expr a) - -- | - -- Partial record update (original value, fields to copy (if known), fields to update) - -- - | ObjectUpdate a (Expr a) (Maybe [PSString]) [(PSString, Expr a)] - -- | - -- Function introduction - -- - | Abs a Ident (Expr a) - -- | - -- Function application - -- - | App a (Expr a) (Expr a) - -- | - -- Variable - -- - | Var a (Qualified Ident) - -- | - -- A case expression - -- - | Case a [Expr a] [CaseAlternative a] - -- | - -- A let binding - -- - | Let a [Bind a] (Expr a) - deriving (Eq, Ord, Show, Functor) - --- | --- A let or module binding. --- + = -- | + -- A literal value + Literal a PurusType (Literal (Expr a)) + | -- A record property accessor + -- + Accessor a PurusType PSString (Expr a) + | -- | + -- Partial record update (original value, fields to copy (if known), fields to update) + ObjectUpdate a PurusType (Expr a) (Maybe [PSString]) [(PSString, Expr a)] + | -- | + -- Function introduction + Abs a PurusType Ident (Expr a) + | -- | + -- Function application + App a (Expr a) (Expr a) + | -- | + -- Variable + Var a PurusType (Qualified Ident) + | -- | + -- A case expression + Case a PurusType [Expr a] [CaseAlternative a] + | -- | + -- A let binding + Let a [Bind a] (Expr a) + deriving (Eq, Ord, Show, Functor, Generic) + +instance (FromJSON a) => FromJSON (Expr a) +instance (ToJSON a) => ToJSON (Expr a) + +instance Plated (Expr a) where + {-# INLINEABLE plate #-} + plate :: forall f . Applicative f => + (Expr a -> f (Expr a)) -> Expr a -> f (Expr a) + plate f = \case + Literal a t lit -> Literal a t <$> traverse f lit + Accessor a t s e -> Accessor a t s <$> f e + ObjectUpdate a t e cf fs -> + ObjectUpdate a t <$> f e <*> pure cf <*> traverse (traverse f) fs + Abs a t bv e -> Abs a t bv <$> f e + App a e1 e2 -> App a <$> f e1 <*> f e2 + x@(Var _ _ _) -> pure x + Case a t scruts alts -> + Case a t <$> traverse f scruts <*> traverse goAlt alts + Let a decls body -> + Let a <$> traverse goDecl decls <*> f body + where + goAlt :: CaseAlternative a -> f (CaseAlternative a) + goAlt (CaseAlternative binds res) = + CaseAlternative binds <$> traverse f res + goDecl :: Bind a -> f (Bind a) + goDecl = \case + NonRec a nm body -> NonRec a nm <$> f body + Rec xs -> Rec <$> traverse (traverse f) xs + +{- | +A let or module binding. +-} data Bind a - -- | - -- Non-recursive binding for a single value - -- - = NonRec a Ident (Expr a) - -- | - -- Mutually recursive binding group for several values - -- - | Rec [((a, Ident), Expr a)] deriving (Eq, Ord, Show, Functor) - --- | --- A guard is just a boolean-valued expression that appears alongside a set of binders --- + = -- | + -- Non-recursive binding for a single value + NonRec a Ident (Expr a) + | -- | + -- Mutually recursive binding group for several values + Rec [((a, Ident), Expr a)] + deriving (Eq, Ord, Show, Functor, Generic) + +instance (FromJSON a) => FromJSON (Bind a) +instance (ToJSON a) => ToJSON (Bind a) + +{- | +A guard is just a boolean-valued expression that appears alongside a set of binders +-} type Guard a = Expr a --- | --- An alternative in a case statement --- +{- | +An alternative in a case statement +-} data CaseAlternative a = CaseAlternative - { -- | - -- A collection of binders with which to match the inputs - -- - caseAlternativeBinders :: [Binder a] - -- | - -- The result expression or a collect of guarded expressions - -- + { caseAlternativeBinders :: [Binder a] + -- ^ + -- A collection of binders with which to match the inputs , caseAlternativeResult :: Either [(Guard a, Expr a)] (Expr a) - } deriving (Eq, Ord, Show) + -- ^ + -- The result expression or a collect of guarded expressions + } + deriving (Eq, Ord, Show, Generic) -instance Functor CaseAlternative where +instance (FromJSON a) => FromJSON (CaseAlternative a) +instance (ToJSON a) => ToJSON (CaseAlternative a) - fmap f (CaseAlternative cabs car) = CaseAlternative - (fmap (fmap f) cabs) - (either (Left . fmap (fmap f *** fmap f)) (Right . fmap f) car) +instance Functor CaseAlternative where + fmap f (CaseAlternative cabs car) = + CaseAlternative + (fmap (fmap f) cabs) + (either (Left . fmap (fmap f *** fmap f)) (Right . fmap f) car) --- | --- Extract the annotation from a term --- +{- | +Extract the annotation from a term +-} extractAnn :: Expr a -> a -extractAnn (Literal a _) = a -extractAnn (Constructor a _ _ _) = a -extractAnn (Accessor a _ _) = a -extractAnn (ObjectUpdate a _ _ _) = a -extractAnn (Abs a _ _) = a +extractAnn (Literal a _ _) = a +extractAnn (Accessor a _ _ _) = a +extractAnn (ObjectUpdate a _ _ _ _) = a +extractAnn (Abs a _ _ _) = a extractAnn (App a _ _) = a -extractAnn (Var a _) = a -extractAnn (Case a _ _) = a +extractAnn (Var a _ _) = a +extractAnn (Case a _ _ _) = a extractAnn (Let a _ _) = a - --- | --- Modify the annotation on a term --- +{- | +Modify the annotation on a term +-} modifyAnn :: (a -> a) -> Expr a -> Expr a -modifyAnn f (Literal a b) = Literal (f a) b -modifyAnn f (Constructor a b c d) = Constructor (f a) b c d -modifyAnn f (Accessor a b c) = Accessor (f a) b c -modifyAnn f (ObjectUpdate a b c d) = ObjectUpdate (f a) b c d -modifyAnn f (Abs a b c) = Abs (f a) b c -modifyAnn f (App a b c) = App (f a) b c -modifyAnn f (Var a b) = Var (f a) b -modifyAnn f (Case a b c) = Case (f a) b c -modifyAnn f (Let a b c) = Let (f a) b c +modifyAnn f (Literal a b c) = Literal (f a) b c +modifyAnn f (Accessor a b c d) = Accessor (f a) b c d +modifyAnn f (ObjectUpdate a b c d e) = ObjectUpdate (f a) b c d e +modifyAnn f (Abs a b c d) = Abs (f a) b c d +modifyAnn f (App a b c) = App (f a) b c +modifyAnn f (Var a b c) = Var (f a) b c +modifyAnn f (Case a b c d) = Case (f a) b c d +modifyAnn f (Let a b c) = Let (f a) b c + +makePrisms ''Expr +makePrisms ''Bind diff --git a/src/Language/PureScript/CoreFn/FromJSON.hs b/src/Language/PureScript/CoreFn/FromJSON.hs index d0426b6f8..7810d7094 100644 --- a/src/Language/PureScript/CoreFn/FromJSON.hs +++ b/src/Language/PureScript/CoreFn/FromJSON.hs @@ -1,17 +1,16 @@ --- | --- Read the core functional representation from JSON format --- - -module Language.PureScript.CoreFn.FromJSON - ( moduleFromJSON - , parseVersion' - ) where +{- | +Read the core functional representation from JSON format +-} +module Language.PureScript.CoreFn.FromJSON ( + moduleFromJSON, + parseVersion', +) where import Prelude import Control.Applicative ((<|>)) -import Data.Aeson (FromJSON(..), Object, Value(..), withObject, withText, (.:)) +import Data.Aeson (FromJSON (..), Object, Value (..), withObject, withText, (.:)) import Data.Aeson.Types (Parser, listParser) import Data.Map.Strict qualified as M import Data.Text (Text) @@ -19,28 +18,34 @@ import Data.Text qualified as T import Data.Vector qualified as V import Data.Version (Version, parseVersion) -import Language.PureScript.AST.SourcePos (SourceSpan(..)) -import Language.PureScript.AST.Literals (Literal(..)) +import Language.PureScript.AST.Literals (Literal (..)) +import Language.PureScript.AST.SourcePos (SourceSpan (..)) +import Language.PureScript.CoreFn (Bind (..), Binder (..), CaseAlternative (..), ConstructorType (..), Expr (..), Guard, Meta (..), Module (..)) import Language.PureScript.CoreFn.Ann (Ann) -import Language.PureScript.CoreFn (Bind(..), Binder(..), CaseAlternative(..), ConstructorType(..), Expr(..), Guard, Meta(..), Module(..)) -import Language.PureScript.Names (Ident(..), ModuleName(..), ProperName(..), Qualified(..), QualifiedBy(..), unusedIdent) +import Language.PureScript.Names (Ident (..), ModuleName (..), ProperName (..), Qualified (..), QualifiedBy (..), unusedIdent) import Language.PureScript.PSString (PSString) +import Language.PureScript.Types (SourceType) + import Text.ParserCombinators.ReadP (readP_to_S) +-- dunno how to work around the orphan +instance FromJSON (Module (Bind Ann) SourceType SourceType Ann) where + parseJSON = fmap snd . moduleFromJSON + parseVersion' :: String -> Maybe Version parseVersion' str = case filter (null . snd) $ readP_to_S parseVersion str of [(vers, "")] -> Just vers - _ -> Nothing + _ -> Nothing constructorTypeFromJSON :: Value -> Parser ConstructorType constructorTypeFromJSON v = do t <- parseJSON v case t of "ProductType" -> return ProductType - "SumType" -> return SumType - _ -> fail ("not recognized ConstructorType: " ++ T.unpack t) + "SumType" -> return SumType + _ -> fail ("not recognized ConstructorType: " ++ T.unpack t) metaFromJSON :: Value -> Parser (Maybe Meta) metaFromJSON Null = return Nothing @@ -50,14 +55,14 @@ metaFromJSON v = withObject "Meta" metaFromObj v type_ <- o .: "metaType" case type_ of "IsConstructor" -> isConstructorFromJSON o - "IsNewtype" -> return $ Just IsNewtype - "IsTypeClassConstructor" - -> return $ Just IsTypeClassConstructor - "IsForeign" -> return $ Just IsForeign - "IsWhere" -> return $ Just IsWhere - "IsSyntheticApp" - -> return $ Just IsSyntheticApp - _ -> fail ("not recognized Meta: " ++ T.unpack type_) + "IsNewtype" -> return $ Just IsNewtype + "IsTypeClassConstructor" -> + return $ Just IsTypeClassConstructor + "IsForeign" -> return $ Just IsForeign + "IsWhere" -> return $ Just IsWhere + "IsSyntheticApp" -> + return $ Just IsSyntheticApp + _ -> fail ("not recognized Meta: " ++ T.unpack type_) isConstructorFromJSON o = do ct <- o .: "constructorType" >>= constructorTypeFromJSON @@ -67,45 +72,46 @@ metaFromJSON v = withObject "Meta" metaFromObj v annFromJSON :: FilePath -> Value -> Parser Ann annFromJSON modulePath = withObject "Ann" annFromObj where - annFromObj o = do - ss <- o .: "sourceSpan" >>= sourceSpanFromJSON modulePath - mm <- o .: "meta" >>= metaFromJSON - return (ss, [], mm) + annFromObj o = do + ss <- o .: "sourceSpan" >>= sourceSpanFromJSON modulePath + mm <- o .: "meta" >>= metaFromJSON + return (ss, [], mm) sourceSpanFromJSON :: FilePath -> Value -> Parser SourceSpan sourceSpanFromJSON modulePath = withObject "SourceSpan" $ \o -> - SourceSpan modulePath <$> - o .: "start" <*> - o .: "end" + SourceSpan modulePath + <$> o .: "start" + <*> o .: "end" literalFromJSON :: (Value -> Parser a) -> Value -> Parser (Literal a) literalFromJSON t = withObject "Literal" literalFromObj where - literalFromObj o = do - type_ <- o .: "literalType" :: Parser Text - case type_ of - "IntLiteral" -> NumericLiteral . Left <$> o .: "value" - "NumberLiteral" -> NumericLiteral . Right <$> o .: "value" - "StringLiteral" -> StringLiteral <$> o .: "value" - "CharLiteral" -> CharLiteral <$> o .: "value" - "BooleanLiteral" -> BooleanLiteral <$> o .: "value" - "ArrayLiteral" -> parseArrayLiteral o - "ObjectLiteral" -> parseObjectLiteral o - _ -> fail ("error parsing Literal: " ++ show o) - - parseArrayLiteral o = do - val <- o .: "value" - as <- mapM t (V.toList val) - return $ ArrayLiteral as - - parseObjectLiteral o = do - val <- o .: "value" - ObjectLiteral <$> recordFromJSON t val + literalFromObj o = do + type_ <- o .: "literalType" :: Parser Text + case type_ of + "IntLiteral" -> NumericLiteral . Left <$> o .: "value" + "NumberLiteral" -> NumericLiteral . Right <$> o .: "value" + "StringLiteral" -> StringLiteral <$> o .: "value" + "CharLiteral" -> CharLiteral <$> o .: "value" + "BooleanLiteral" -> BooleanLiteral <$> o .: "value" + "ListLiteral" -> parseListLiteral o + "ObjectLiteral" -> parseObjectLiteral o + _ -> fail ("error parsing Literal: " ++ show o) + + parseListLiteral o = do + val <- o .: "value" + as <- mapM t (V.toList val) + return $ ListLiteral as + + parseObjectLiteral o = do + val <- o .: "value" + ObjectLiteral <$> recordFromJSON t val identFromJSON :: Value -> Parser Ident identFromJSON = withText "Ident" $ \case - ident | ident == unusedIdent -> pure UnusedIdent - | otherwise -> pure $ Ident ident + ident + | ident == unusedIdent -> pure UnusedIdent + | otherwise -> pure $ Ident ident properNameFromJSON :: Value -> Parser (ProperName a) properNameFromJSON = fmap ProperName . parseJSON @@ -113,148 +119,152 @@ properNameFromJSON = fmap ProperName . parseJSON qualifiedFromJSON :: (Text -> a) -> Value -> Parser (Qualified a) qualifiedFromJSON f = withObject "Qualified" qualifiedFromObj where - qualifiedFromObj o = - qualifiedByModuleFromObj o <|> qualifiedBySourcePosFromObj o - qualifiedByModuleFromObj o = do - mn <- o .: "moduleName" >>= moduleNameFromJSON - i <- o .: "identifier" >>= withText "Ident" (return . f) - pure $ Qualified (ByModuleName mn) i - qualifiedBySourcePosFromObj o = do - ss <- o .: "sourcePos" - i <- o .: "identifier" >>= withText "Ident" (return . f) - pure $ Qualified (BySourcePos ss) i + qualifiedFromObj o = + qualifiedByModuleFromObj o <|> qualifiedBySourcePosFromObj o + qualifiedByModuleFromObj o = do + mn <- o .: "moduleName" >>= moduleNameFromJSON + i <- o .: "identifier" >>= withText "Ident" (return . f) + pure $ Qualified (ByModuleName mn) i + qualifiedBySourcePosFromObj o = do + ss <- o .: "sourcePos" + i <- o .: "identifier" >>= withText "Ident" (return . f) + pure $ Qualified (BySourcePos ss) i moduleNameFromJSON :: Value -> Parser ModuleName moduleNameFromJSON v = ModuleName . T.intercalate "." <$> listParser parseJSON v -moduleFromJSON :: Value -> Parser (Version, Module Ann) +moduleFromJSON :: Value -> Parser (Version, Module (Bind Ann) SourceType SourceType Ann) moduleFromJSON = withObject "Module" moduleFromObj where - moduleFromObj o = do - version <- o .: "builtWith" >>= versionFromJSON - moduleName <- o .: "moduleName" >>= moduleNameFromJSON - modulePath <- o .: "modulePath" - moduleSourceSpan <- o .: "sourceSpan" >>= sourceSpanFromJSON modulePath - moduleImports <- o .: "imports" >>= listParser (importFromJSON modulePath) - moduleExports <- o .: "exports" >>= listParser identFromJSON - moduleReExports <- o .: "reExports" >>= reExportsFromJSON - moduleDecls <- o .: "decls" >>= listParser (bindFromJSON modulePath) - moduleForeign <- o .: "foreign" >>= listParser identFromJSON - moduleComments <- o .: "comments" >>= listParser parseJSON - return (version, Module {..}) - - versionFromJSON :: String -> Parser Version - versionFromJSON v = - case parseVersion' v of - Just r -> return r - Nothing -> fail "failed parsing purs version" - - importFromJSON :: FilePath -> Value -> Parser (Ann, ModuleName) - importFromJSON modulePath = withObject "Import" - (\o -> do - ann <- o .: "annotation" >>= annFromJSON modulePath - mn <- o .: "moduleName" >>= moduleNameFromJSON - return (ann, mn)) - - reExportsFromJSON :: Value -> Parser (M.Map ModuleName [Ident]) - reExportsFromJSON = fmap (M.map (map Ident)) . parseJSON + moduleFromObj o = do + version <- o .: "builtWith" >>= versionFromJSON + moduleName <- o .: "moduleName" >>= moduleNameFromJSON + modulePath <- o .: "modulePath" + moduleSourceSpan <- o .: "sourceSpan" >>= sourceSpanFromJSON modulePath + moduleImports <- o .: "imports" >>= listParser (importFromJSON modulePath) + moduleExports <- o .: "exports" >>= listParser identFromJSON + moduleReExports <- o .: "reExports" >>= reExportsFromJSON + moduleDecls <- o .: "decls" >>= listParser (bindFromJSON modulePath) + moduleForeign <- o .: "foreign" >>= listParser identFromJSON + moduleComments <- o .: "comments" >>= listParser parseJSON + moduleDataTypes <- o .: "dataTypes" >>= parseJSON + return (version, Module {..}) + + versionFromJSON :: String -> Parser Version + versionFromJSON v = + case parseVersion' v of + Just r -> return r + Nothing -> fail "failed parsing purs version" + + importFromJSON :: FilePath -> Value -> Parser (Ann, ModuleName) + importFromJSON modulePath = + withObject + "Import" + ( \o -> do + ann <- o .: "annotation" >>= annFromJSON modulePath + mn <- o .: "moduleName" >>= moduleNameFromJSON + return (ann, mn) + ) + + reExportsFromJSON :: Value -> Parser (M.Map ModuleName [Ident]) + reExportsFromJSON = fmap (M.map (map Ident)) . parseJSON bindFromJSON :: FilePath -> Value -> Parser (Bind Ann) bindFromJSON modulePath = withObject "Bind" bindFromObj where - bindFromObj :: Object -> Parser (Bind Ann) - bindFromObj o = do - type_ <- o .: "bindType" :: Parser Text - case type_ of - "NonRec" -> (uncurry . uncurry) NonRec <$> bindFromObj' o - "Rec" -> Rec <$> (o .: "binds" >>= listParser (withObject "Bind" bindFromObj')) - _ -> fail ("not recognized bind type \"" ++ T.unpack type_ ++ "\"") - - bindFromObj' :: Object -> Parser ((Ann, Ident), Expr Ann) - bindFromObj' o = do - a <- o .: "annotation" >>= annFromJSON modulePath - i <- o .: "identifier" >>= identFromJSON - e <- o .: "expression" >>= exprFromJSON modulePath - return ((a, i), e) + bindFromObj :: Object -> Parser (Bind Ann) + bindFromObj o = do + type_ <- o .: "bindType" :: Parser Text + case type_ of + "NonRec" -> (uncurry . uncurry) NonRec <$> bindFromObj' o + "Rec" -> Rec <$> (o .: "binds" >>= listParser (withObject "Bind" bindFromObj')) + _ -> fail ("not recognized bind type \"" ++ T.unpack type_ ++ "\"") + + bindFromObj' :: Object -> Parser ((Ann, Ident), Expr Ann) + bindFromObj' o = do + a <- o .: "annotation" >>= annFromJSON modulePath + i <- o .: "identifier" >>= identFromJSON + e <- o .: "expression" >>= exprFromJSON modulePath + return ((a, i), e) recordFromJSON :: (Value -> Parser a) -> Value -> Parser [(PSString, a)] recordFromJSON p = listParser parsePair where - parsePair v = do - (l, v') <- parseJSON v :: Parser (PSString, Value) - a <- p v' - return (l, a) + parsePair v = do + (l, v') <- parseJSON v :: Parser (PSString, Value) + a <- p v' + return (l, a) exprFromJSON :: FilePath -> Value -> Parser (Expr Ann) exprFromJSON modulePath = withObject "Expr" exprFromObj where - exprFromObj o = do - type_ <- o .: "type" - case type_ of - "Var" -> varFromObj o - "Literal" -> literalExprFromObj o - "Constructor" -> constructorFromObj o - "Accessor" -> accessorFromObj o - "ObjectUpdate" -> objectUpdateFromObj o - "Abs" -> absFromObj o - "App" -> appFromObj o - "Case" -> caseFromObj o - "Let" -> letFromObj o - _ -> fail ("not recognized expression type: \"" ++ T.unpack type_ ++ "\"") - - varFromObj o = do - ann <- o .: "annotation" >>= annFromJSON modulePath - qi <- o .: "value" >>= qualifiedFromJSON Ident - return $ Var ann qi - - literalExprFromObj o = do - ann <- o .: "annotation" >>= annFromJSON modulePath - lit <- o .: "value" >>= literalFromJSON (exprFromJSON modulePath) - return $ Literal ann lit - - constructorFromObj o = do - ann <- o .: "annotation" >>= annFromJSON modulePath - tyn <- o .: "typeName" >>= properNameFromJSON - con <- o .: "constructorName" >>= properNameFromJSON - is <- o .: "fieldNames" >>= listParser identFromJSON - return $ Constructor ann tyn con is - - accessorFromObj o = do - ann <- o .: "annotation" >>= annFromJSON modulePath - f <- o .: "fieldName" - e <- o .: "expression" >>= exprFromJSON modulePath - return $ Accessor ann f e - - objectUpdateFromObj o = do - ann <- o .: "annotation" >>= annFromJSON modulePath - e <- o .: "expression" >>= exprFromJSON modulePath - copy <- o .: "copy" >>= parseJSON - us <- o .: "updates" >>= recordFromJSON (exprFromJSON modulePath) - return $ ObjectUpdate ann e copy us - - absFromObj o = do - ann <- o .: "annotation" >>= annFromJSON modulePath - idn <- o .: "argument" >>= identFromJSON - e <- o .: "body" >>= exprFromJSON modulePath - return $ Abs ann idn e - - appFromObj o = do - ann <- o .: "annotation" >>= annFromJSON modulePath - e <- o .: "abstraction" >>= exprFromJSON modulePath - e' <- o .: "argument" >>= exprFromJSON modulePath - return $ App ann e e' - - caseFromObj o = do - ann <- o .: "annotation" >>= annFromJSON modulePath - cs <- o .: "caseExpressions" >>= listParser (exprFromJSON modulePath) - cas <- o .: "caseAlternatives" >>= listParser (caseAlternativeFromJSON modulePath) - return $ Case ann cs cas - - letFromObj o = do - ann <- o .: "annotation" >>= annFromJSON modulePath - bs <- o .: "binds" >>= listParser (bindFromJSON modulePath) - e <- o .: "expression" >>= exprFromJSON modulePath - return $ Let ann bs e + exprFromObj o = do + kind_ <- o .: "kind" + case kind_ of + "Var" -> varFromObj o + "Literal" -> literalExprFromObj o + "Accessor" -> accessorFromObj o + "ObjectUpdate" -> objectUpdateFromObj o + "Abs" -> absFromObj o + "App" -> appFromObj o + "Case" -> caseFromObj o + "Let" -> letFromObj o + _ -> fail ("not recognized expression kind: \"" ++ T.unpack kind_ ++ "\"") + + tyFromObj o = o .: "type" >>= parseJSON + + varFromObj o = do + ann <- o .: "annotation" >>= annFromJSON modulePath + ty <- tyFromObj o + qi <- o .: "value" >>= qualifiedFromJSON Ident + return $ Var ann ty qi + + literalExprFromObj o = do + ann <- o .: "annotation" >>= annFromJSON modulePath + ty <- tyFromObj o + lit <- o .: "value" >>= literalFromJSON (exprFromJSON modulePath) + return $ Literal ann ty lit + + accessorFromObj o = do + ann <- o .: "annotation" >>= annFromJSON modulePath + ty <- tyFromObj o + f <- o .: "fieldName" + e <- o .: "expression" >>= exprFromJSON modulePath + return $ Accessor ann ty f e + + objectUpdateFromObj o = do + ann <- o .: "annotation" >>= annFromJSON modulePath + ty <- tyFromObj o + e <- o .: "expression" >>= exprFromJSON modulePath + copy <- o .: "copy" >>= parseJSON + us <- o .: "updates" >>= recordFromJSON (exprFromJSON modulePath) + return $ ObjectUpdate ann ty e copy us + + absFromObj o = do + ann <- o .: "annotation" >>= annFromJSON modulePath + ty <- tyFromObj o + idn <- o .: "argument" >>= identFromJSON + e <- o .: "body" >>= exprFromJSON modulePath + return $ Abs ann ty idn e + + appFromObj o = do + ann <- o .: "annotation" >>= annFromJSON modulePath + e <- o .: "abstraction" >>= exprFromJSON modulePath + e' <- o .: "argument" >>= exprFromJSON modulePath + return $ App ann e e' + + caseFromObj o = do + ann <- o .: "annotation" >>= annFromJSON modulePath + ty <- tyFromObj o + cs <- o .: "caseExpressions" >>= listParser (exprFromJSON modulePath) + cas <- o .: "caseAlternatives" >>= listParser (caseAlternativeFromJSON modulePath) + return $ Case ann ty cs cas + + letFromObj o = do + ann <- o .: "annotation" >>= annFromJSON modulePath + bs <- o .: "binds" >>= listParser (bindFromJSON modulePath) + e <- o .: "expression" >>= exprFromJSON modulePath + return $ Let ann bs e caseAlternativeFromJSON :: FilePath -> Value -> Parser (CaseAlternative Ann) caseAlternativeFromJSON modulePath = withObject "CaseAlternative" caseAlternativeFromObj @@ -280,40 +290,40 @@ caseAlternativeFromJSON modulePath = withObject "CaseAlternative" caseAlternativ binderFromJSON :: FilePath -> Value -> Parser (Binder Ann) binderFromJSON modulePath = withObject "Binder" binderFromObj where - binderFromObj o = do - type_ <- o .: "binderType" - case type_ of - "NullBinder" -> nullBinderFromObj o - "VarBinder" -> varBinderFromObj o - "LiteralBinder" -> literalBinderFromObj o - "ConstructorBinder" -> constructorBinderFromObj o - "NamedBinder" -> namedBinderFromObj o - _ -> fail ("not recognized binder: \"" ++ T.unpack type_ ++ "\"") - - - nullBinderFromObj o = do - ann <- o .: "annotation" >>= annFromJSON modulePath - return $ NullBinder ann - - varBinderFromObj o = do - ann <- o .: "annotation" >>= annFromJSON modulePath - idn <- o .: "identifier" >>= identFromJSON - return $ VarBinder ann idn - - literalBinderFromObj o = do - ann <- o .: "annotation" >>= annFromJSON modulePath - lit <- o .: "literal" >>= literalFromJSON (binderFromJSON modulePath) - return $ LiteralBinder ann lit - - constructorBinderFromObj o = do - ann <- o .: "annotation" >>= annFromJSON modulePath - tyn <- o .: "typeName" >>= qualifiedFromJSON ProperName - con <- o .: "constructorName" >>= qualifiedFromJSON ProperName - bs <- o .: "binders" >>= listParser (binderFromJSON modulePath) - return $ ConstructorBinder ann tyn con bs - - namedBinderFromObj o = do - ann <- o .: "annotation" >>= annFromJSON modulePath - n <- o .: "identifier" >>= identFromJSON - b <- o .: "binder" >>= binderFromJSON modulePath - return $ NamedBinder ann n b + binderFromObj o = do + type_ <- o .: "binderType" + case type_ of + "NullBinder" -> nullBinderFromObj o + "VarBinder" -> varBinderFromObj o + "LiteralBinder" -> literalBinderFromObj o + "ConstructorBinder" -> constructorBinderFromObj o + "NamedBinder" -> namedBinderFromObj o + _ -> fail ("not recognized binder: \"" ++ T.unpack type_ ++ "\"") + + nullBinderFromObj o = do + ann <- o .: "annotation" >>= annFromJSON modulePath + return $ NullBinder ann + + varBinderFromObj o = do + ann <- o .: "annotation" >>= annFromJSON modulePath + idn <- o .: "identifier" >>= identFromJSON + ty <- o .: "type" >>= parseJSON + return $ VarBinder ann idn ty + + literalBinderFromObj o = do + ann <- o .: "annotation" >>= annFromJSON modulePath + lit <- o .: "literal" >>= literalFromJSON (binderFromJSON modulePath) + return $ LiteralBinder ann lit + + constructorBinderFromObj o = do + ann <- o .: "annotation" >>= annFromJSON modulePath + tyn <- o .: "typeName" >>= qualifiedFromJSON ProperName + con <- o .: "constructorName" >>= qualifiedFromJSON ProperName + bs <- o .: "binders" >>= listParser (binderFromJSON modulePath) + return $ ConstructorBinder ann tyn con bs + + namedBinderFromObj o = do + ann <- o .: "annotation" >>= annFromJSON modulePath + n <- o .: "identifier" >>= identFromJSON + b <- o .: "binder" >>= binderFromJSON modulePath + return $ NamedBinder ann n b diff --git a/src/Language/PureScript/CoreFn/Laziness.hs b/src/Language/PureScript/CoreFn/Laziness.hs deleted file mode 100644 index 9941fd41c..000000000 --- a/src/Language/PureScript/CoreFn/Laziness.hs +++ /dev/null @@ -1,568 +0,0 @@ -module Language.PureScript.CoreFn.Laziness - ( applyLazinessTransform - ) where - -import Protolude hiding (force) -import Protolude.Unsafe (unsafeHead) - -import Control.Arrow ((&&&)) -import Data.Array qualified as A -import Data.Coerce (coerce) -import Data.Graph (SCC(..), stronglyConnComp) -import Data.List (foldl1', (!!)) -import Data.IntMap.Monoidal qualified as IM -import Data.IntSet qualified as IS -import Data.Map.Monoidal qualified as M -import Data.Semigroup (Max(..)) -import Data.Set qualified as S - -import Language.PureScript.AST.SourcePos (SourcePos(..), SourceSpan(..), nullSourceSpan) -import Language.PureScript.Constants.Libs qualified as C -import Language.PureScript.CoreFn (Ann, Bind, Expr(..), Literal(..), Meta(..), ssAnn, traverseCoreFn) -import Language.PureScript.Crash (internalError) -import Language.PureScript.Names (pattern ByNullSourcePos, Ident(..), InternalIdentData(..), ModuleName, Qualified(..), QualifiedBy(..), runIdent, runModuleName, toMaybeModuleName) -import Language.PureScript.PSString (mkString) - --- This module is responsible for ensuring that the bindings in recursive --- binding groups are initialized in a valid order, introducing run-time --- laziness and initialization checks as necessary. --- --- PureScript is a call-by-value language with strict data constructors, this --- transformation notwithstanding. The only laziness introduced here is in the --- initialization of a binding. PureScript is uninterested in the order in --- which bindings are written by the user. The compiler has always attempted to --- emit the bindings in an order that makes sense for the backend, but without --- this transformation, recursive bindings are emitted in an arbitrary order, --- which can cause unexpected behavior at run time if a binding is dereferenced --- before it has initialized. --- --- To prevent unexpected errors, this transformation does a syntax-driven --- analysis of a single recursive binding group to attempt to statically order --- the bindings, and when that fails, falls back to lazy initializers that will --- succeed or fail deterministically with a clear error at run time. --- --- Example: --- --- x = f \_ -> --- x --- --- becomes (with some details of the $runtime_lazy function elided): --- --- -- the binding of x has been rewritten as a lazy initializer --- $lazy_x = $runtime_lazy \_ -> --- f \_ -> --- $lazy_x 2 -- the reference to x has been rewritten as a force call --- x = $lazy_x 1 --- --- Central to this analysis are the concepts of delay and force, which are --- attributes given to every subexpression in the binding group. Delay and --- force are defined by the following traversal. This traversal is used twice: --- once to collect all the references made by each binding in the group, and --- then again to rewrite some references to force calls. (The implications of --- delay and force on initialization order are specified later.) - --- | --- Visits every `Var` in an expression with the provided function, including --- the amount of delay and force applied to that `Var`, and substitutes the --- result back into the tree (propagating an `Applicative` effect). --- --- Delay is a non-negative integer that represents the number of lambdas that --- enclose an expression. Force is a non-negative integer that represents the --- number of values that are being applied to an expression. Delay is always --- statically determinable, but force can be *unknown*, so it's represented --- here with a Maybe. In a function application `f a b`, `f` has force 2, but --- `a` and `b` have unknown force--it depends on what `f` does with them. --- --- The rules of assigning delay and force are simple: --- * The expressions that are assigned to bindings in this group have --- delay 0, force 0. --- * In a function application, the function expression has force 1 higher --- than the force of the application expression, and the argument --- expression has unknown force. --- * UNLESS this argument is being directly provided to a constructor (in --- other words, the function expression is either a constructor itself or --- a constructor that has already been partially applied), in which case --- the force of both subexpressions is unchanged. We can assume that --- constructors don't apply any additional force to their arguments. --- * If the force of a lambda is zero, the delay of the body of the lambda is --- incremented; otherwise, the force of the body of the lambda is --- decremented. (Applying one argument to a lambda cancels out one unit of --- delay.) --- * In the argument of a Case and the bindings of a Let, force is unknown. --- * Everywhere else, preserve the delay and force of the enclosing --- expression. --- --- Here are some illustrative examples of the above rules. We will use a --- pseudocode syntax to annotate a subexpression with delay and force: --- `expr#d!f` means `expr` has delay d and force f. `!*` is used to denote --- unknown force. --- --- x = y#0!0 --- x = y#0!2 a#0!* b#0!* --- x = (\_ -> y#1!0)#0!0 --- x = \_ _ -> y#2!1 a#2!* --- x = (\_ -> y#0!0)#0!1 z#0!* --- x = Just { a: a#0!0, b: b#0!0 } --- x = let foo = (y#1!* a b#1!*)#1!* in foo + 1 --- --- (Note that this analysis is quite ignorant of any actual control flow --- choices made at run time. It doesn't even track what happens to a reference --- after it has been locally bound by a Let or Case. Instead, it just assumes --- the worst--once locally bound to a new name, it imagines that absolutely --- anything could happen to that new name and thus to the underlying reference. --- But the value-to-weight ratio of this approach is perhaps surprisingly --- high.) --- --- Every subexpression gets a delay and a force, but we are only interested --- in references to other bindings in the binding group, so the traversal only --- exposes `Var`s to the provided function. --- -onVarsWithDelayAndForce :: forall f. Applicative f => (Int -> Maybe Int -> Ann -> Qualified Ident -> f (Expr Ann)) -> Expr Ann -> f (Expr Ann) -onVarsWithDelayAndForce f = snd . go 0 $ Just 0 - where - go :: Int -> Maybe Int -> (Bind Ann -> f (Bind Ann), Expr Ann -> f (Expr Ann)) - go delay force = (handleBind, handleExpr') - where - (handleBind, handleExpr, handleBinder, handleCaseAlternative) = traverseCoreFn handleBind handleExpr' handleBinder handleCaseAlternative - handleExpr' = \case - Var a i -> f delay force a i - Abs a i e -> Abs a i <$> snd (if force == Just 0 then go (succ delay) force else go delay $ fmap pred force) e - -- A clumsy hack to preserve TCO in a particular idiom of unsafePartial once seen in Data.Map.Internal, possibly still used elsewhere. - App a1 e1@(Var _ C.I_unsafePartial) (Abs a2 i e2) -> App a1 e1 . Abs a2 i <$> handleExpr' e2 - App a e1 e2 -> - -- `handleApp` is just to handle the constructor application exception - -- somewhat gracefully (i.e., without requiring a deep inspection of - -- the function expression at every step). If we didn't care about - -- constructors, this could have been simply: - -- App a <$> snd (go delay (fmap succ force)) e1 <*> snd (go delay Nothing) e2 - handleApp 1 [(a, e2)] e1 - Case a vs alts -> Case a <$> traverse (snd $ go delay Nothing) vs <*> traverse handleCaseAlternative alts - Let a ds e -> Let a <$> traverse (fst $ go delay Nothing) ds <*> handleExpr' e - other -> handleExpr other - - handleApp len args = \case - App a e1 e2 -> handleApp (len + 1) ((a, e2) : args) e1 - Var a@(_, _, Just meta) i | isConstructorLike meta - -> foldl (\e1 (a2, e2) -> App a2 <$> e1 <*> handleExpr' e2) (f delay force a i) args - e -> foldl (\e1 (a2, e2) -> App a2 <$> e1 <*> snd (go delay Nothing) e2) (snd (go delay (fmap (+ len) force)) e) args - isConstructorLike = \case - IsConstructor{} -> True - IsNewtype -> True - _ -> False - --- Once we assign a delay and force value to every `Var` in the binding group, --- we can consider how to order the bindings to allow them all to successfully --- initialize. There is one principle here: each binding must be initialized --- before the identifier being bound is ready for use. If the preorder thus --- induced has cycles, those cycles need to be resolved with laziness. All of --- the details concern what "ready for use" means. --- --- The definition of delay and force suggests that "ready for use" depends on --- those attributes. If a lambda is bound to the name x, then the references in --- the lambda don't need to be initialized before x is initialized. This is --- represented by the fact that those references have non-zero delay. But if --- the expression bound to x is instead the application of a function y that is --- also bound in this binding group, then not only does y need to be --- initialized before x, so do some of the non-zero delay references in y. This --- is represented by the fact that the occurrence of y in the expression bound --- to x has non-zero force. --- --- An example, reusing the pseudocode annotations defined above: --- --- x _ = y#1!0 --- y = x#0!1 a --- --- y doesn't need to be initialized before x is, because the reference to y in --- x's initializer has delay 1. But y does need to be initialized before x is --- ready for use with force 1, because force 1 is enough to overcome the delay --- of that reference. And since y has a delay-0 reference to x with force 1, y --- will need to be ready for use before it is initialized; thus, y needs to be --- made lazy. --- --- So just as function applications "cancel out" lambdas, a known applied force --- cancels out an equal amount of delay, causing some references that may not --- have been needed earlier to enter play. (And to be safe, we must assume that --- unknown force cancels out *any* amount of delay.) There is another, subtler --- aspect of this: if there are not enough lambdas to absorb every argument --- applied to a function, those arguments will end up applied to the result of --- the function. Likewise, if there is excess force left over after some of it --- has been canceled by delay, that excess is carried to the references --- activated. (Again, an unknown amount of force must be assumed to lead to an --- unknown amount of excess force.) --- --- Another example: --- --- f = g#0!2 a b --- g x = h#1!2 c x --- h _ _ _ = f#3!0 --- --- Initializing f will lead to an infinite loop in this example. f invokes g --- with two arguments. g absorbs one argument, and the second ends up being --- applied to the result of h c x, resulting in h being invoked with three --- arguments. Invoking h with three arguments results in dereferencing f, which --- is not yet ready. To capture this loop in our analysis, we say that making --- f ready for use with force 0 requires making g ready for use with force 2, --- which requires making h ready for use with force 3 (two units of force from --- the lexical position of h, plus one unit of excess force carried forward), --- which cyclically requires f to be ready for use with force 0. --- --- These preceding observations are captured and generalized by the following --- rules: --- --- USE-INIT: Before a reference to x is ready for use with any force, x must --- be initialized. --- --- We will make x lazy iff this rule induces a cycle--i.e., initializing x --- requires x to be ready for use first. --- --- USE-USE: Before a reference to x is ready for use with force f: --- * if a reference in the initializer of x has delay d and force f', --- * and either d <= f or f is unknown, --- * then that reference must itself be ready for use with --- force f – d + f' (or with unknown force if f or f' is unknown). --- --- USE-IMMEDIATE: Initializing a binding x is equivalent to requiring a --- reference to x to be ready for use with force 0, per USE-USE. --- --- Equivalently: before x is initialized, any reference in the initializer --- of x with delay 0 and force f must be ready for use with force f. --- --- Examples: --- --- Assume x is bound in a recursive binding group with the below bindings. --- --- All of the following initializers require x to be ready for use with some --- amount of force, and therefore require x to be initialized first. --- --- a = x#0!0 --- b = (\_ -> x#0!0) 1 --- c = foo x#0!* --- d = (\_ -> foo x#0!*) 1 --- --- In the following initializers, before p can be initialized, x must be --- ready for use with force f – d + f'. (And both x and q must be --- initialized, of course; but x being ready for use with that force may --- induce additional constraints.) --- --- p = ... q#0!f ... --- q = ... x#d!f' ... (where d <= f) --- --- Excess force stacks, of course: in the following initializers, before r --- can be initialized, x must be ready for use with force --- f — d + f' — d' + f'': --- --- r = ... s#0!f ... --- s = ... t#d!f' ... (where d <= f) --- t = ... x#d'!f'' ... (where d' <= f – d + f') --- --- --- To satisfy these rules, we will construct a graph between (identifier, --- delay) pairs, with edges induced by the USE-USE rule, and effectively run a --- topsort to get the initialization preorder. For this part, it's simplest to --- think of delay as an element of the naturals extended with a positive --- infinity, corresponding to an unknown amount of force. (We'll do arithmetic --- on these extended naturals as you would naively expect; we won't do anything --- suspect like subtracting infinity from infinity.) With that in mind, we can --- construct the graph as follows: for each reference from i1 to i2 with delay --- d and force f, draw an infinite family of edges from (i1, d + n) to (i2, f + --- n) for all 0 <= n <= ∞, where n represents the excess force carried over --- from a previous edge. Unfortunately, as an infinite graph, we can't expect --- the tools in Data.Graph to help us traverse it; we will have to be a little --- bit clever. --- --- The following data types and functions are for searching this infinite graph --- and carving from it a finite amount of data to work with. Specifically, we --- want to know for each identifier i, which other identifiers are --- irreflexively reachable from (i, 0) (and thus must be initialized before i --- is), and with what maximum force (in the event of a loop, not every --- reference to i in the reachable identifier needs to be rewritten to a force --- call; only the ones with delay up to the maximum force used during i's --- initialization). We also want the option of aborting a given reachability --- search, for one of two reasons. --- --- * If we encounter a reference with unknown force, abort. --- * If we encounter a cycle where force on a single identifier is --- increasing, abort. (Because of USE-USE, as soon as an identifier is --- revisited with greater force than its first visit, the difference is --- carried forward as excess, so it is possible to retrace that path to get --- an arbitrarily high amount of force.) --- --- Both reasons mean that it is theoretically possible for the identifier in --- question to need every other identifier in the binding group to be --- initialized before it is. (Every identifier in a recursive binding group is --- necessarily reachable from every other, ignoring delay and force, which is --- what arbitrarily high force lets you do.) --- --- In order to reuse parts of this reachability computation across identifiers, --- we are going to represent it with a rose tree data structure interleaved with --- a monad capturing the abort semantics. (The monad is Maybe, but we don't --- need to know that here!) - -type MaxRoseTree m a = m (IM.MonoidalIntMap (MaxRoseNode m a)) -data MaxRoseNode m a = MaxRoseNode a (MaxRoseTree m a) - --- Dissecting this data structure: --- --- m (...) --- ^ represents whether to abort or continue the search --- --- IM.MonoidalIntMap (...) --- ^ the keys of this map are other identifiers reachable from the current --- one (we'll map the identifiers in this binding group to Ints for ease of --- computation) --- --- the values of this map are: --- --- MaxRoseNode a (...) --- ^ this will store the force applied to the next identifier --- (MaxRoseTree m a) --- ^ and this, the tree of identifiers reachable from there --- --- We're only interested in continuing down the search path that applies the --- most force to a given identifier! So when we combine two MaxRoseTrees, --- we want to resolve any key collisions in their MonoidalIntMaps with this --- semigroup: - -instance Ord a => Semigroup (MaxRoseNode m a) where - l@(MaxRoseNode l1 _) <> r@(MaxRoseNode r1 _) = if r1 > l1 then r else l - --- And that's why this is called a MaxRoseTree. --- --- Traversing this tree to get a single MonoidalIntMap with the entire closure --- plus force information is fairly straightforward: - -mrtFlatten :: (Monad m, Ord a) => MaxRoseTree m a -> m (IM.MonoidalIntMap (Max a)) -mrtFlatten = (getAp . IM.foldMapWithKey (\i (MaxRoseNode a inner) -> Ap $ (IM.singleton i (Max a) <>) <$> mrtFlatten inner) =<<) - --- The use of the `Ap` monoid ensures that if any child of this tree aborts, --- the entire tree aborts. --- --- One might ask, why interleave the abort monad with the tree at all if we're --- just going to flatten it out at the end? The point is to flatten it out at --- the end, but *not* during the generation of the tree. Attempting to flatten --- the tree as we generate it can result in an infinite loop, because a subtree --- needs to be exhaustively searched for abort conditions before it can be used --- in another tree. With this approach, we can use lazy trees as building --- blocks and, as long as they get rewritten to be finite or have aborts before --- they're flattened, the analysis still terminates. - --- | --- Given a maximum index and a function that returns a map of edges to next --- indices, returns an array for each index up to maxIndex of maps from the --- indices reachable from the current index, to the maximum force applied to --- those indices. -searchReachable - :: forall m force - . (Alternative m, Monad m, Enum force, Ord force) - => Int - -> ((Int, force) -> m (IM.MonoidalIntMap (Max force))) - -> A.Array Int (m (IM.MonoidalIntMap (Max force))) -searchReachable maxIdx lookupEdges = mrtFlatten . unsafeHead <$> mem - where - -- This is a finite array of infinite lists, used to memoize all the search - -- trees. `unsafeHead` is used above to pull the first tree out of each list - -- in the array--the one corresponding to zero force, which is what's needed - -- to initialize the corresponding identifier. (`unsafeHead` is safe here, of - -- course: infinite lists.) - mem :: A.Array Int [MaxRoseTree m force] - mem = A.listArray (0, maxIdx) - [ [cutLoops <*> fmap (IM.mapWithKey memoizedNode) . lookupEdges $ (i, f) | f <- [toEnum 0..]] - | i <- [0..maxIdx] - ] - - memoizedNode :: Int -> Max force -> MaxRoseNode m force - memoizedNode i (Max force) = MaxRoseNode force $ mem A.! i !! fromEnum force - - -- And this is the function that prevents the search from actually being - -- infinite. It applies a filter to a `MaxRoseTree` at every level, looking for - -- indices anywhere in the tree that match the current vertex. If a match is - -- found with greater force than the current force, that part of the tree is - -- rewritten to abort; otherwise, that part of the tree is rewritten to be - -- empty (there's nothing new in that part of the search). - -- - -- A new version of `cutLoops` is applied for each node in the search, so - -- each edge in a search path will add another filter on a new index. Since - -- there are a finite number of indices in our universe, this guarantees that - -- the analysis terminates, because no single search path can have length - -- greater than `maxIdx`. - cutLoops :: (Int, force) -> MaxRoseTree m force -> MaxRoseTree m force - cutLoops (i, force) = go - where - go = (=<<) . IM.traverseWithKey $ \i' (MaxRoseNode force' inner) -> - MaxRoseNode force' <$> if i == i' then guard (force >= force') $> pure IM.empty else pure $ go inner - --- One last data structure to define and then it's on to the main event. --- --- The laziness transform effectively takes a list of eager bindings (x = ...) --- and splits some of them into lazy definitions ($lazy_x = ...) and lazy --- bindings (x = $lazy_x ...). It's convenient to work with these three --- declarations as the following sum type: - -data RecursiveGroupItem e = EagerBinding Ann e | LazyDefinition e | LazyBinding Ann - deriving Functor - --- | --- Transform a recursive binding group, reordering the bindings within when a --- correct initialization order can be statically determined, and rewriting --- bindings and references to be lazy otherwise. --- -applyLazinessTransform :: ModuleName -> [((Ann, Ident), Expr Ann)] -> ([((Ann, Ident), Expr Ann)], Any) -applyLazinessTransform mn rawItems = let - - -- Establish the mapping from names to ints. - rawItemsByName :: M.MonoidalMap Ident (Ann, Expr Ann) - rawItemsByName = M.fromList $ (snd . fst &&& first fst) <$> rawItems - - maxIdx = M.size rawItemsByName - 1 - - rawItemsByIndex :: A.Array Int (Ann, Expr Ann) - rawItemsByIndex = A.listArray (0, maxIdx) $ M.elems rawItemsByName - - names :: S.Set Ident - names = M.keysSet rawItemsByName - - -- Now do the first delay/force traversal of all the bindings to find - -- references to other names in this binding group. - -- - -- The parts of this type mean: - -- D is the maximum force (or Nothing if unknown) with which the identifier C - -- is referenced in any delay-B position inside the expression A. - -- - -- where A, B, C, and D are as below: - -- A B (keys) C (keys) D - findReferences :: Expr Ann -> IM.MonoidalIntMap (IM.MonoidalIntMap (Ap Maybe (Max Int))) - findReferences = (getConst .) . onVarsWithDelayAndForce $ \delay force _ -> \case - Qualified qb ident | all (== mn) (toMaybeModuleName qb), Just i <- ident `S.lookupIndex` names - -> Const . IM.singleton delay . IM.singleton i $ coerceForce force - _ -> Const IM.empty - - -- The parts of this type mean: - -- D is the maximum force (or Nothing if unknown) with which the identifier C - -- is referenced in any delay-B position inside the binding of identifier A. - -- - -- where A, B, C, and D are as below: - -- A B (keys) C (keys) D - refsByIndex :: A.Array Int (IM.MonoidalIntMap (IM.MonoidalIntMap (Ap Maybe (Max Int)))) - refsByIndex = findReferences . snd <$> rawItemsByIndex - - -- Using the approach explained above, traverse the reference graph generated - -- by `refsByIndex` and find all reachable names. - -- - -- The parts of this type mean: - -- D is the maximum force with which the identifier C is referenced, - -- directly or indirectly, during the initialization of identifier A. B is - -- Nothing if the analysis of A was inconclusive and A might need the entire - -- binding group. - -- - -- where A, B, C, and D are as below: - -- A B C (keys) D - reachablesByIndex :: A.Array Int (Maybe (IM.MonoidalIntMap (Max Int))) - reachablesByIndex = searchReachable maxIdx $ \(i, force) -> - getAp . flip IM.foldMapWithKey (dropKeysAbove force $ refsByIndex A.! i) $ \delay -> - IM.foldMapWithKey $ \i' force' -> - Ap $ IM.singleton i' . Max . (force - delay +) <$> uncoerceForce force' - - -- If `reachablesByIndex` is a sort of labeled relation, this function - -- produces part of the reverse relation, but only for the edges from the - -- given vertex. - -- - -- The parts of this type mean: - -- The identifier A is reachable from the identifier B with maximum force C - -- (B is also the index provided to the function). - -- - -- where A, B, and C are as below: - -- (B) A B (singleton key) C - reverseReachablesFor :: Int -> IM.MonoidalIntMap (IM.MonoidalIntMap (Ap Maybe (Max Int))) - reverseReachablesFor i = case reachablesByIndex A.! i of - Nothing -> IM.fromAscList $ (, IM.singleton i $ Ap Nothing) <$> [0..maxIdx] - Just im -> IM.singleton i . Ap . Just <$> im - - -- We can use `reachablesByIndex` to build a finite graph and topsort it; - -- in the process, we'll pack the nodes of the graph with data we'll want - -- next. Remember that if our reachability computation aborted, we have to - -- assume that every other identifier is reachable from that one--hence the - -- `maybe [0..maxIdx]`. - sccs = stronglyConnComp $ do - (i, mbReachable) <- A.assocs reachablesByIndex - pure ((reverseReachablesFor i, (S.elemAt i names, rawItemsByIndex A.! i)), i, maybe [0..maxIdx] (IS.toList . IM.keysSet) mbReachable) - - (replacements, items) = flip foldMap sccs $ \case - -- The easy case: this binding doesn't need to be made lazy after all! - AcyclicSCC (_, (ident, (a, e))) -> pure [(ident, EagerBinding a e)] - -- The tough case: we have a loop. - -- We need to do two things here: - -- * Collect the reversed reachables relation for each vertex in this - -- loop; we'll use this to replace references with force calls - -- * Copy the vertex list into two lists: a list of lazy definitions and - -- a list of lazy bindings - -- Both of these results are monoidal, so the outer `foldMap` will - -- concatenate them pairwise. - CyclicSCC vertices -> (foldMap fst vertices, map (fmap (LazyDefinition . snd) . snd) vertices ++ map (fmap (LazyBinding . fst) . snd) vertices) - - -- We have `replacements` expressed in terms of indices; we want to map it - -- back to names before traversing the bindings again. - replacementsByName :: M.MonoidalMap Ident (M.MonoidalMap Ident (Ap Maybe (Max Int))) - replacementsByName = M.fromAscList . map (bimap (flip S.elemAt names) (M.fromAscList . map (first (flip S.elemAt names)) . IM.toAscList)) . IM.toAscList $ replacements - - -- And finally, this is the second delay/force traversal where we take - -- `replacementsByName` and use it to rewrite references with force calls, - -- but only if the delay of those references is at most the maximum amount - -- of force used by the initialization of the referenced binding to - -- reference the outer binding. A reference made with a higher delay than - -- that can safely continue to use the original reference, since it won't be - -- needed until after the referenced binding is done initializing. - replaceReferencesWithForceCall :: (Ident, RecursiveGroupItem (Expr Ann)) -> (Ident, RecursiveGroupItem (Expr Ann)) - replaceReferencesWithForceCall pair@(ident, item) = case ident `M.lookup` replacementsByName of - Nothing -> pair - Just m -> let - rewriteExpr = (runIdentity .) . onVarsWithDelayAndForce $ \delay _ ann -> pure . \case - Qualified qb ident' | all (== mn) (toMaybeModuleName qb), any (all (>= Max delay) . getAp) $ ident' `M.lookup` m - -> makeForceCall ann ident' - q -> Var ann q - in (ident, rewriteExpr <$> item) - - -- All that's left to do is run the above replacement on every item, - -- translate items from our `RecursiveGroupItem` representation back into the - -- form CoreFn expects, and inform the caller whether we made any laziness - -- transformations after all. (That last bit of information is used to - -- determine if the runtime factory function needs to be injected.) - in (uncurry fromRGI . replaceReferencesWithForceCall <$> items, Any . not $ IM.null replacements) - - where - - nullAnn = ssAnn nullSourceSpan - runtimeLazy = Var nullAnn . Qualified ByNullSourcePos $ InternalIdent RuntimeLazyFactory - runFn3 = Var nullAnn . Qualified (ByModuleName C.M_Data_Function_Uncurried) . Ident $ C.S_runFn <> "3" - strLit = Literal nullAnn . StringLiteral . mkString - - lazifyIdent = \case - Ident txt -> InternalIdent $ Lazy txt - _ -> internalError "Unexpected argument to lazifyIdent" - - makeForceCall :: Ann -> Ident -> Expr Ann - makeForceCall (ss, _, _) ident - -- We expect the functions produced by `runtimeLazy` to accept one - -- argument: the line number on which this reference is made. The runtime - -- code uses this number to generate a message that identifies where the - -- evaluation looped. - = App nullAnn (Var nullAnn . Qualified ByNullSourcePos $ lazifyIdent ident) - . Literal nullAnn . NumericLiteral . Left . toInteger . sourcePosLine - $ spanStart ss - - fromRGI :: Ident -> RecursiveGroupItem (Expr Ann) -> ((Ann, Ident), Expr Ann) - fromRGI i = \case - EagerBinding a e -> ((a, i), e) - -- We expect the `runtimeLazy` factory to accept three arguments: the - -- identifier being initialized, the name of the module, and of course a - -- thunk that actually contains the initialization code. - LazyDefinition e -> ((nullAnn, lazifyIdent i), foldl1' (App nullAnn) [runFn3, runtimeLazy, strLit $ runIdent i, strLit $ runModuleName mn, Abs nullAnn UnusedIdent e]) - LazyBinding a -> ((a, i), makeForceCall a i) - - dropKeysAbove :: Int -> IM.MonoidalIntMap a -> IM.MonoidalIntMap a - dropKeysAbove n = fst . IM.split (n + 1) - - coerceForce :: Maybe Int -> Ap Maybe (Max Int) - coerceForce = coerce - - uncoerceForce :: Ap Maybe (Max Int) -> Maybe Int - uncoerceForce = coerce diff --git a/src/Language/PureScript/CoreFn/Meta.hs b/src/Language/PureScript/CoreFn/Meta.hs index 0baddca29..54f7d7c0c 100644 --- a/src/Language/PureScript/CoreFn/Meta.hs +++ b/src/Language/PureScript/CoreFn/Meta.hs @@ -1,51 +1,44 @@ --- | --- Metadata annotations for core functional representation --- +{- | +Metadata annotations for core functional representation +-} module Language.PureScript.CoreFn.Meta where import Prelude import Language.PureScript.Names (Ident) --- | --- Metadata annotations --- +{- | +Metadata annotations +-} data Meta - -- | - -- The contained value is a data constructor - -- - = IsConstructor ConstructorType [Ident] - -- | - -- The contained value is a newtype - -- - | IsNewtype - -- | - -- The contained value is a typeclass dictionary constructor - -- - | IsTypeClassConstructor - -- | - -- The contained reference is for a foreign member - -- - | IsForeign - -- | - -- The contained value is a where clause - -- - | IsWhere - -- | - -- The contained function application was synthesized by the compiler - -- - | IsSyntheticApp + = -- | + -- The contained value is a data constructor + IsConstructor ConstructorType [Ident] + | -- | + -- The contained value is a newtype + IsNewtype + | -- | + -- The contained value is a typeclass dictionary constructor + IsTypeClassConstructor + | -- | + -- The contained reference is for a foreign member + IsForeign + | -- | + -- The contained value is a where clause + IsWhere + | -- | + -- The contained function application was synthesized by the compiler + IsSyntheticApp deriving (Show, Eq, Ord) --- | --- Data constructor metadata --- +{- | +Data constructor metadata +-} data ConstructorType - -- | - -- The constructor is for a type with a single constructor - -- - = ProductType - -- | - -- The constructor is for a type with multiple constructors - -- - | SumType deriving (Show, Eq, Ord) + = -- | + -- The constructor is for a type with a single constructor + ProductType + | -- | + -- The constructor is for a type with multiple constructors + SumType + deriving (Show, Eq, Ord) diff --git a/src/Language/PureScript/CoreFn/Module.hs b/src/Language/PureScript/CoreFn/Module.hs index 09f5189c4..ea2e81ca4 100644 --- a/src/Language/PureScript/CoreFn/Module.hs +++ b/src/Language/PureScript/CoreFn/Module.hs @@ -1,25 +1,166 @@ +{-# LANGUAGE ScopedTypeVariables #-} +{-# LANGUAGE StandaloneDeriving #-} +{-# LANGUAGE StandaloneKindSignatures #-} +{-# LANGUAGE StrictData #-} +{-# LANGUAGE TemplateHaskell #-} + module Language.PureScript.CoreFn.Module where import Prelude import Data.Map.Strict (Map) +import Data.Maybe (fromMaybe) +import Data.Text (Text) import Language.PureScript.AST.SourcePos (SourceSpan) import Language.PureScript.Comments (Comment) -import Language.PureScript.CoreFn.Expr (Bind) -import Language.PureScript.Names (Ident, ModuleName) +import Language.PureScript.CoreFn.Expr (Bind (..)) +import Language.PureScript.Environment (DataDeclType) +import Language.PureScript.Names (Ident (..), ModuleName, ProperName (..), ProperNameType (..), Qualified) + +import Control.Lens ( + At (at), + filtered, + folded, + makeLenses, + view, + (^.), + (^?), + ) + +import Data.Aeson (FromJSON, ToJSON) +import GHC.Generics (Generic) + +import Data.Kind qualified as GHC +import Data.List (find, findIndex) +import Data.Map qualified as M + +-- | Converts a ProperName to an Ident. Duplicated here to break a module cycle. +properToIdent :: ProperName a -> Ident +properToIdent = Ident . runProperName + +data DataDecl k t = DataDecl + { _dDeclType :: !DataDeclType + , _dDataTyName :: !(Qualified (ProperName 'TypeName)) + , _dDataArgs :: ![(Text, k)] + , _dDataCtors :: ![CtorDecl t] + } + deriving (Show, Eq, Ord, Generic) +instance (ToJSON k, ToJSON t) => ToJSON (DataDecl k t) +instance (FromJSON k, FromJSON t) => FromJSON (DataDecl k t) + +-- not worth writing all the necessary instances for a real Bitraversable instance. +-- monad instead of applicative solely for do notation and b/c it'll always be a monad anyway +bitraverseDataDecl :: + forall f k k' t t'. + (Monad f) => + (k -> f k') -> + (t -> f t') -> + DataDecl k t -> + f (DataDecl k' t') +bitraverseDataDecl fk ft DataDecl {..} = do + dataArgs' <- traverse (traverse fk) _dDataArgs + dataCtors' <- traverse (traverseCtorDecl ft) _dDataCtors + pure $ DataDecl _dDeclType _dDataTyName dataArgs' dataCtors' + +data CtorDecl t = CtorDecl + { _cdCtorName :: !(Qualified Ident) + , _cdCtorFields :: ![(Ident, t)] + } + deriving (Show, Eq, Ord, Generic) +instance (ToJSON t) => ToJSON (CtorDecl t) +instance (FromJSON t) => FromJSON (CtorDecl t) + +traverseCtorDecl :: forall f t t'. (Monad f) => (t -> f t') -> CtorDecl t -> f (CtorDecl t') +traverseCtorDecl f (CtorDecl nms fs) = CtorDecl nms <$> traverse (traverse f) fs + +data Datatypes k t = Datatypes + { _tyDict :: M.Map (Qualified (ProperName 'TypeName)) (DataDecl k t) + , -- primarily for Olog(n) "is this a constructor?" which we'll need in the monomorphizer + _ctorDict :: M.Map (Qualified Ident) (Qualified (ProperName 'TypeName)) + } + deriving (Show, Eq, Ord, Generic) +instance (ToJSON k, ToJSON t) => ToJSON (Datatypes k t) +instance (FromJSON k, FromJSON t) => FromJSON (Datatypes k t) + +makeLenses ''DataDecl +makeLenses ''CtorDecl +makeLenses ''Datatypes --- | --- The CoreFn module representation --- -data Module a = Module +lookupCtorType :: Qualified Ident -> Datatypes k t -> Maybe (Qualified (ProperName 'TypeName)) +lookupCtorType qi (Datatypes _ ctors) = M.lookup qi ctors + +-- | Unsafe (we only use this in contexts where failure is fatal) TODO: Throw a useful error +getConstructorIndexAndDecl :: + Qualified (ProperName 'ConstructorName) -> + Datatypes k t -> + Either String (Int, CtorDecl t) +getConstructorIndexAndDecl qn dts = do + let ctorIdent = properToIdent <$> qn + ctorTyNm <- note ("No type found for constructor: " <> show ctorIdent) $ lookupCtorType ctorIdent dts + dDecl <- note ("No data declaration found for type: " <> show ctorTyNm) $ lookupDataDecl ctorTyNm dts + let allTheCtors = dDecl ^. dDataCtors + decl <- note ("No constructor declaration found for: " <> show ctorIdent) $ find ((== ctorIdent) . view cdCtorName) allTheCtors + indX <- note ("No constructor index found for: " <> show ctorIdent) $ findIndex ((== ctorIdent) . view cdCtorName) allTheCtors + pure (indX, decl) + where + note :: forall x. String -> Maybe x -> Either String x + note msg = \case + Nothing -> Left msg + Just res -> pure res + +-- | Unsafe (we only use this in contexts where failure is fatal) TODO: Throw a useful error +getAllConstructorDecls :: + Qualified (ProperName 'TypeName) -> + Datatypes k t -> + [CtorDecl t] +getAllConstructorDecls qn dts = fromMaybe [] $ dts ^? tyDict . at qn . folded . dDataCtors + +lookupDataDecl :: Qualified (ProperName 'TypeName) -> Datatypes k t -> Maybe (DataDecl k t) +lookupDataDecl qtn (Datatypes tys _) = M.lookup qtn tys + +lookupCtorDecl :: Qualified Ident -> Datatypes k t -> Maybe (CtorDecl t) +lookupCtorDecl qi datatypes = do + tyname <- datatypes ^? ctorDict . at qi . folded + datatypes ^? tyDict . at tyname . folded . dDataCtors . folded . filtered ((== qi) . view cdCtorName) + +instance Semigroup (Datatypes k t) where + (Datatypes tyDict1 ctorDict1) <> (Datatypes tyDict2 ctorDict2) = + Datatypes (tyDict1 <> tyDict2) (ctorDict1 <> ctorDict2) + +instance Monoid (Datatypes k t) where + mempty = Datatypes M.empty M.empty + +bitraverseDatatypes :: + forall f k k' t t'. + (Monad f) => + (k -> f k') -> + (t -> f t') -> + Datatypes k t -> + f (Datatypes k' t') +bitraverseDatatypes fk ft (Datatypes ddecls ctormap) = do + ddecls' <- traverse (bitraverseDataDecl fk ft) ddecls + pure $ Datatypes ddecls' ctormap + +{- | +The CoreFn module representation. + +`Module decl kind ty` contains a [decl] representing the module declarations +and a `DataTypes kind ty` representing the algebraic datatype declarations +-} +type Module :: GHC.Type -> GHC.Type -> GHC.Type -> GHC.Type -> GHC.Type +data Module decl kind ty ann = Module { moduleSourceSpan :: SourceSpan , moduleComments :: [Comment] , moduleName :: ModuleName , modulePath :: FilePath - , moduleImports :: [(a, ModuleName)] + , moduleImports :: [(ann, ModuleName)] , moduleExports :: [Ident] , moduleReExports :: Map ModuleName [Ident] , moduleForeign :: [Ident] - , moduleDecls :: [Bind a] - } deriving (Functor, Show) + , moduleDecls :: [decl] + , moduleDataTypes :: Datatypes kind ty + } + deriving (Functor, Show) + +deriving instance (Eq a, Eq k, Eq t) => Eq (Module (Bind a) k t a) diff --git a/src/Language/PureScript/CoreFn/Optimizer.hs b/src/Language/PureScript/CoreFn/Optimizer.hs index 722893c43..c70d2945d 100644 --- a/src/Language/PureScript/CoreFn/Optimizer.hs +++ b/src/Language/PureScript/CoreFn/Optimizer.hs @@ -3,29 +3,29 @@ module Language.PureScript.CoreFn.Optimizer (optimizeCoreFn) where import Protolude hiding (Type, moduleName) import Control.Monad.Supply (Supply) +import Language.PureScript.Constants.Libs qualified as C import Language.PureScript.CoreFn.Ann (Ann) import Language.PureScript.CoreFn.CSE (optimizeCommonSubexpressions) -import Language.PureScript.CoreFn.Expr (Bind, Expr(..)) -import Language.PureScript.CoreFn.Module (Module(..)) +import Language.PureScript.CoreFn.Expr (Bind, Expr (..)) +import Language.PureScript.CoreFn.Module (Module (..)) import Language.PureScript.CoreFn.Traversals (everywhereOnValues) -import Language.PureScript.Constants.Libs qualified as C --- | --- CoreFn optimization pass. --- -optimizeCoreFn :: Module Ann -> Supply (Module Ann) +{- | +CoreFn optimization pass. +-} +optimizeCoreFn :: Module (Bind Ann) k t Ann -> Supply (Module (Bind Ann) k t Ann) optimizeCoreFn m = fmap (\md -> m {moduleDecls = md}) . optimizeCommonSubexpressions (moduleName m) . optimizeModuleDecls $ moduleDecls m optimizeModuleDecls :: [Bind Ann] -> [Bind Ann] optimizeModuleDecls = map transformBinds where - (transformBinds, _, _) = everywhereOnValues identity transformExprs identity - transformExprs - = optimizeDataFunctionApply + (transformBinds, _, _) = everywhereOnValues identity transformExprs identity + transformExprs = + optimizeDataFunctionApply optimizeDataFunctionApply :: Expr a -> Expr a optimizeDataFunctionApply e = case e of - (App a (App _ (Var _ fn) x) y) + (App a (App _ (Var _ t3 fn) x) y) | C.I_functionApply <- fn -> App a x y | C.I_functionApplyFlipped <- fn -> App a y x _ -> e diff --git a/src/Language/PureScript/CoreFn/ToJSON.hs b/src/Language/PureScript/CoreFn/ToJSON.hs index 1b20ac4e6..d93b1131c 100644 --- a/src/Language/PureScript/CoreFn/ToJSON.hs +++ b/src/Language/PureScript/CoreFn/ToJSON.hs @@ -1,98 +1,104 @@ {-# LANGUAGE NoOverloadedStrings #-} --- | --- Dump the core functional representation in JSON format for consumption --- by third-party code generators --- -module Language.PureScript.CoreFn.ToJSON - ( moduleToJSON - ) where + +{- | +Dump the core functional representation in JSON format for consumption +by third-party code generators +-} +module Language.PureScript.CoreFn.ToJSON ( + moduleToJSON, + moduleToJSON', +) where import Prelude import Control.Arrow ((***)) -import Data.Either (isLeft) -import Data.Map.Strict qualified as M -import Data.Aeson (ToJSON(..), Value(..), object) +import Data.Aeson (ToJSON (..), Value (..), object) import Data.Aeson qualified import Data.Aeson.Key qualified import Data.Aeson.Types (Pair) -import Data.Version (Version, showVersion) +import Data.Either (isLeft) +import Data.Map.Strict qualified as M import Data.Text (Text) import Data.Text qualified as T +import Data.Version (Version, showVersion) -import Language.PureScript.AST.Literals (Literal(..)) -import Language.PureScript.AST.SourcePos (SourceSpan(..)) -import Language.PureScript.CoreFn (Ann, Bind(..), Binder(..), CaseAlternative(..), ConstructorType(..), Expr(..), Meta(..), Module(..)) -import Language.PureScript.Names (Ident, ModuleName(..), ProperName(..), Qualified(..), QualifiedBy(..), runIdent) +import Language.PureScript.AST.Literals (Literal (..)) +import Language.PureScript.AST.SourcePos (SourceSpan (..)) +import Language.PureScript.CoreFn (Ann, Bind (..), Binder (..), CaseAlternative (..), ConstructorType (..), Expr (..), Meta (..), Module (..)) +import Language.PureScript.Names (Ident, ModuleName (..), ProperName (..), Qualified (..), QualifiedBy (..), runIdent) import Language.PureScript.PSString (PSString) +import Language.PureScript.Types (SourceType) constructorTypeToJSON :: ConstructorType -> Value constructorTypeToJSON ProductType = toJSON "ProductType" constructorTypeToJSON SumType = toJSON "SumType" infixr 8 .= -(.=) :: ToJSON a => String -> a -> Pair +(.=) :: (ToJSON a) => String -> a -> Pair key .= value = Data.Aeson.Key.fromString key Data.Aeson..= value metaToJSON :: Meta -> Value -metaToJSON (IsConstructor t is) - = object - [ "metaType" .= "IsConstructor" - , "constructorType" .= constructorTypeToJSON t - , "identifiers" .= identToJSON `map` is - ] -metaToJSON IsNewtype = object [ "metaType" .= "IsNewtype" ] -metaToJSON IsTypeClassConstructor = object [ "metaType" .= "IsTypeClassConstructor" ] -metaToJSON IsForeign = object [ "metaType" .= "IsForeign" ] -metaToJSON IsWhere = object [ "metaType" .= "IsWhere" ] -metaToJSON IsSyntheticApp = object [ "metaType" .= "IsSyntheticApp" ] +metaToJSON (IsConstructor t is) = + object + [ "metaType" .= "IsConstructor" + , "constructorType" .= constructorTypeToJSON t + , "identifiers" .= identToJSON `map` is + ] +metaToJSON IsNewtype = object ["metaType" .= "IsNewtype"] +metaToJSON IsTypeClassConstructor = object ["metaType" .= "IsTypeClassConstructor"] +metaToJSON IsForeign = object ["metaType" .= "IsForeign"] +metaToJSON IsWhere = object ["metaType" .= "IsWhere"] +metaToJSON IsSyntheticApp = object ["metaType" .= "IsSyntheticApp"] sourceSpanToJSON :: SourceSpan -> Value sourceSpanToJSON (SourceSpan _ spanStart spanEnd) = - object [ "start" .= spanStart - , "end" .= spanEnd - ] + object + [ "start" .= spanStart + , "end" .= spanEnd + ] annToJSON :: Ann -> Value -annToJSON (ss, _, m) = object [ "sourceSpan" .= sourceSpanToJSON ss - , "meta" .= maybe Null metaToJSON m - ] +annToJSON (ss, _, m) = + object + [ "sourceSpan" .= sourceSpanToJSON ss + , "meta" .= maybe Null metaToJSON m + ] literalToJSON :: (a -> Value) -> Literal a -> Value -literalToJSON _ (NumericLiteral (Left n)) - = object +literalToJSON _ (NumericLiteral (Left n)) = + object [ "literalType" .= "IntLiteral" - , "value" .= n - ] -literalToJSON _ (NumericLiteral (Right n)) - = object - [ "literalType" .= "NumberLiteral" - , "value" .= n - ] -literalToJSON _ (StringLiteral s) - = object - [ "literalType" .= "StringLiteral" - , "value" .= s - ] -literalToJSON _ (CharLiteral c) - = object - [ "literalType" .= "CharLiteral" - , "value" .= c - ] -literalToJSON _ (BooleanLiteral b) - = object - [ "literalType" .= "BooleanLiteral" - , "value" .= b - ] -literalToJSON t (ArrayLiteral xs) - = object - [ "literalType" .= "ArrayLiteral" - , "value" .= map t xs - ] -literalToJSON t (ObjectLiteral xs) - = object - [ "literalType" .= "ObjectLiteral" - , "value" .= recordToJSON t xs + , "value" .= n + ] +literalToJSON _ (NumericLiteral (Right n)) = + object + [ "literalType" .= "NumberLiteral" + , "value" .= n + ] +literalToJSON _ (StringLiteral s) = + object + [ "literalType" .= "StringLiteral" + , "value" .= s + ] +literalToJSON _ (CharLiteral c) = + object + [ "literalType" .= "CharLiteral" + , "value" .= c + ] +literalToJSON _ (BooleanLiteral b) = + object + [ "literalType" .= "BooleanLiteral" + , "value" .= b + ] +literalToJSON t (ListLiteral xs) = + object + [ "literalType" .= "ListLiteral" + , "value" .= map t xs + ] +literalToJSON t (ObjectLiteral xs) = + object + [ "literalType" .= "ObjectLiteral" + , "value" .= recordToJSON t xs ] identToJSON :: Ident -> Value @@ -104,146 +110,204 @@ properNameToJSON = toJSON . runProperName qualifiedToJSON :: (a -> Text) -> Qualified a -> Value qualifiedToJSON f (Qualified qb a) = case qb of - ByModuleName mn -> object - [ "moduleName" .= moduleNameToJSON mn - , "identifier" .= toJSON (f a) - ] - BySourcePos ss -> object - [ "sourcePos" .= toJSON ss - , "identifier" .= toJSON (f a) - ] + ByModuleName mn -> + object + [ "moduleName" .= moduleNameToJSON mn + , "identifier" .= toJSON (f a) + ] + BySourcePos ss -> + object + [ "sourcePos" .= toJSON ss + , "identifier" .= toJSON (f a) + ] moduleNameToJSON :: ModuleName -> Value moduleNameToJSON (ModuleName name) = toJSON (T.splitOn (T.pack ".") name) -moduleToJSON :: Version -> Module Ann -> Value -moduleToJSON v m = object - [ "sourceSpan" .= sourceSpanToJSON (moduleSourceSpan m) - , "moduleName" .= moduleNameToJSON (moduleName m) - , "modulePath" .= toJSON (modulePath m) - , "imports" .= map importToJSON (moduleImports m) - , "exports" .= map identToJSON (moduleExports m) - , "reExports" .= reExportsToJSON (moduleReExports m) - , "foreign" .= map identToJSON (moduleForeign m) - , "decls" .= map bindToJSON (moduleDecls m) - , "builtWith" .= toJSON (showVersion v) - , "comments" .= map toJSON (moduleComments m) - ] - +moduleToJSON :: Version -> Module (Bind Ann) SourceType SourceType Ann -> Value +moduleToJSON v m = + object + [ "sourceSpan" .= sourceSpanToJSON (moduleSourceSpan m) + , "moduleName" .= moduleNameToJSON (moduleName m) + , "modulePath" .= toJSON (modulePath m) + , "imports" .= map importToJSON (moduleImports m) + , "exports" .= map identToJSON (moduleExports m) + , "reExports" .= reExportsToJSON (moduleReExports m) + , "foreign" .= map identToJSON (moduleForeign m) + , "decls" .= map bindToJSON (moduleDecls m) + , "builtWith" .= toJSON (showVersion v) + , "comments" .= map toJSON (moduleComments m) + , "dataTypes" .= toJSON (moduleDataTypes m) + ] where - importToJSON (ann,mn) = object - [ "annotation" .= annToJSON ann - , "moduleName" .= moduleNameToJSON mn + importToJSON (ann, mn) = + object + [ "annotation" .= annToJSON ann + , "moduleName" .= moduleNameToJSON mn + ] + + reExportsToJSON :: M.Map ModuleName [Ident] -> Value + reExportsToJSON = toJSON . M.map (map runIdent) + +moduleToJSON' :: Module (Bind Ann) SourceType SourceType Ann -> Value +moduleToJSON' m = + object + [ "sourceSpan" .= sourceSpanToJSON (moduleSourceSpan m) + , "moduleName" .= moduleNameToJSON (moduleName m) + , "modulePath" .= toJSON (modulePath m) + , "imports" .= map importToJSON (moduleImports m) + , "exports" .= map identToJSON (moduleExports m) + , "reExports" .= reExportsToJSON (moduleReExports m) + , "foreign" .= map identToJSON (moduleForeign m) + , "decls" .= map bindToJSON (moduleDecls m) + , "comments" .= map toJSON (moduleComments m) + , "dataTypes" .= toJSON (moduleDataTypes m) ] + where + importToJSON (ann, mn) = + object + [ "annotation" .= annToJSON ann + , "moduleName" .= moduleNameToJSON mn + ] - reExportsToJSON :: M.Map ModuleName [Ident] -> Value - reExportsToJSON = toJSON . M.map (map runIdent) + reExportsToJSON :: M.Map ModuleName [Ident] -> Value + reExportsToJSON = toJSON . M.map (map runIdent) bindToJSON :: Bind Ann -> Value -bindToJSON (NonRec ann n e) - = object - [ "bindType" .= "NonRec" +bindToJSON (NonRec ann n e) = + object + [ "bindType" .= "NonRec" , "annotation" .= annToJSON ann , "identifier" .= identToJSON n , "expression" .= exprToJSON e ] -bindToJSON (Rec bs) - = object - [ "bindType" .= "Rec" - , "binds" .= map (\((ann, n), e) - -> object - [ "identifier" .= identToJSON n - , "annotation" .= annToJSON ann - , "expression" .= exprToJSON e - ]) bs +bindToJSON (Rec bs) = + object + [ "bindType" .= "Rec" + , "binds" + .= map + ( \((ann, n), e) -> + object + [ "identifier" .= identToJSON n + , "annotation" .= annToJSON ann + , "expression" .= exprToJSON e + ] + ) + bs ] recordToJSON :: (a -> Value) -> [(PSString, a)] -> Value recordToJSON f = toJSON . map (toJSON *** f) exprToJSON :: Expr Ann -> Value -exprToJSON (Var ann i) = object [ "type" .= toJSON "Var" - , "annotation" .= annToJSON ann - , "value" .= qualifiedToJSON runIdent i - ] -exprToJSON (Literal ann l) = object [ "type" .= "Literal" - , "annotation" .= annToJSON ann - , "value" .= literalToJSON exprToJSON l - ] -exprToJSON (Constructor ann d c is) = object [ "type" .= "Constructor" - , "annotation" .= annToJSON ann - , "typeName" .= properNameToJSON d - , "constructorName" .= properNameToJSON c - , "fieldNames" .= map identToJSON is - ] -exprToJSON (Accessor ann f r) = object [ "type" .= "Accessor" - , "annotation" .= annToJSON ann - , "fieldName" .= f - , "expression" .= exprToJSON r - ] -exprToJSON (ObjectUpdate ann r copy fs) - = object [ "type" .= "ObjectUpdate" - , "annotation" .= annToJSON ann - , "expression" .= exprToJSON r - , "copy" .= toJSON copy - , "updates" .= recordToJSON exprToJSON fs - ] -exprToJSON (Abs ann p b) = object [ "type" .= "Abs" - , "annotation" .= annToJSON ann - , "argument" .= identToJSON p - , "body" .= exprToJSON b - ] -exprToJSON (App ann f x) = object [ "type" .= "App" - , "annotation" .= annToJSON ann - , "abstraction" .= exprToJSON f - , "argument" .= exprToJSON x - ] -exprToJSON (Case ann ss cs) = object [ "type" .= "Case" - , "annotation" .= annToJSON ann - , "caseExpressions" - .= map exprToJSON ss - , "caseAlternatives" - .= map caseAlternativeToJSON cs - ] -exprToJSON (Let ann bs e) = object [ "type" .= "Let" - , "annotation" .= annToJSON ann - , "binds" .= map bindToJSON bs - , "expression" .= exprToJSON e - ] +exprToJSON (Var ann ty i) = + object + [ "kind" .= toJSON "Var" + , "type" .= toJSON ty + , "annotation" .= annToJSON ann + , "value" .= qualifiedToJSON runIdent i + ] +exprToJSON (Literal ann ty l) = + object + [ "kind" .= "Literal" + , "type" .= toJSON ty + , "annotation" .= annToJSON ann + , "value" .= literalToJSON exprToJSON l + ] +exprToJSON (Accessor ann ty f r) = + object + [ "kind" .= "Accessor" + , "type" .= toJSON ty + , "annotation" .= annToJSON ann + , "fieldName" .= f + , "expression" .= exprToJSON r + ] +exprToJSON (ObjectUpdate ann ty r copy fs) = + object + [ "kind" .= "ObjectUpdate" + , "type" .= toJSON ty + , "annotation" .= annToJSON ann + , "expression" .= exprToJSON r + , "copy" .= toJSON copy + , "updates" .= recordToJSON exprToJSON fs + ] +exprToJSON (Abs ann ty p b) = + object + [ "kind" .= "Abs" + , "type" .= toJSON ty + , "annotation" .= annToJSON ann + , "argument" .= identToJSON p + , "body" .= exprToJSON b + ] +exprToJSON (App ann f x) = + object + [ "kind" .= "App" + , "annotation" .= annToJSON ann + , "abstraction" .= exprToJSON f + , "argument" .= exprToJSON x + ] +exprToJSON (Case ann ty ss cs) = + object + [ "kind" .= "Case" + , "type" .= toJSON ty + , "annotation" .= annToJSON ann + , "caseExpressions" + .= map exprToJSON ss + , "caseAlternatives" + .= map caseAlternativeToJSON cs + ] +exprToJSON (Let ann bs e) = + object + [ "kind" .= "Let" + , "annotation" .= annToJSON ann + , "binds" .= map bindToJSON bs + , "expression" .= exprToJSON e + ] caseAlternativeToJSON :: CaseAlternative Ann -> Value caseAlternativeToJSON (CaseAlternative bs r') = let isGuarded = isLeft r' - in object - [ "binders" .= toJSON (map binderToJSON bs) - , "isGuarded" .= toJSON isGuarded - , (if isGuarded then "expressions" else "expression") - .= case r' of - Left rs -> toJSON $ map (\(g, e) -> object [ "guard" .= exprToJSON g, "expression" .= exprToJSON e]) rs - Right r -> exprToJSON r - ] + in object + [ "binders" .= toJSON (map binderToJSON bs) + , "isGuarded" .= toJSON isGuarded + , (if isGuarded then "expressions" else "expression") + .= case r' of + Left rs -> toJSON $ map (\(g, e) -> object ["guard" .= exprToJSON g, "expression" .= exprToJSON e]) rs + Right r -> exprToJSON r + ] binderToJSON :: Binder Ann -> Value -binderToJSON (VarBinder ann v) = object [ "binderType" .= "VarBinder" - , "annotation" .= annToJSON ann - , "identifier" .= identToJSON v - ] -binderToJSON (NullBinder ann) = object [ "binderType" .= "NullBinder" - , "annotation" .= annToJSON ann - ] -binderToJSON (LiteralBinder ann l) = object [ "binderType" .= "LiteralBinder" - , "annotation" .= annToJSON ann - , "literal" .= literalToJSON binderToJSON l - ] -binderToJSON (ConstructorBinder ann d c bs) = object [ "binderType" .= "ConstructorBinder" - , "annotation" .= annToJSON ann - , "typeName" .= qualifiedToJSON runProperName d - , "constructorName" - .= qualifiedToJSON runProperName c - , "binders" .= map binderToJSON bs - ] -binderToJSON (NamedBinder ann n b) = object [ "binderType" .= "NamedBinder" - , "annotation" .= annToJSON ann - , "identifier" .= identToJSON n - , "binder" .= binderToJSON b - ] +binderToJSON (VarBinder ann v t) = + object + [ "binderType" .= "VarBinder" + , "annotation" .= annToJSON ann + , "identifier" .= identToJSON v + , "type" .= toJSON t + ] +binderToJSON (NullBinder ann) = + object + [ "binderType" .= "NullBinder" + , "annotation" .= annToJSON ann + ] +binderToJSON (LiteralBinder ann l) = + object + [ "binderType" .= "LiteralBinder" + , "annotation" .= annToJSON ann + , "literal" .= literalToJSON binderToJSON l + ] +binderToJSON (ConstructorBinder ann d c bs) = + object + [ "binderType" .= "ConstructorBinder" + , "annotation" .= annToJSON ann + , "typeName" .= qualifiedToJSON runProperName d + , "constructorName" + .= qualifiedToJSON runProperName c + , "binders" .= map binderToJSON bs + ] +binderToJSON (NamedBinder ann n b) = + object + [ "binderType" .= "NamedBinder" + , "annotation" .= annToJSON ann + , "identifier" .= identToJSON n + , "binder" .= binderToJSON b + ] diff --git a/src/Language/PureScript/CoreFn/Traversals.hs b/src/Language/PureScript/CoreFn/Traversals.hs index f0684d34d..1c4c39720 100644 --- a/src/Language/PureScript/CoreFn/Traversals.hs +++ b/src/Language/PureScript/CoreFn/Traversals.hs @@ -1,6 +1,6 @@ --- | --- CoreFn traversal helpers --- +{- | +CoreFn traversal helpers +-} module Language.PureScript.CoreFn.Traversals where import Prelude @@ -8,79 +8,81 @@ import Prelude import Control.Arrow (second, (***), (+++)) import Data.Bitraversable (bitraverse) -import Language.PureScript.AST.Literals (Literal(..)) -import Language.PureScript.CoreFn.Binders (Binder(..)) -import Language.PureScript.CoreFn.Expr (Bind(..), CaseAlternative(..), Expr(..)) +import Language.PureScript.AST.Literals (Literal (..)) +import Language.PureScript.CoreFn.Binders (Binder (..)) +import Language.PureScript.CoreFn.Expr (Bind (..), CaseAlternative (..), Expr (..)) -everywhereOnValues :: (Bind a -> Bind a) -> - (Expr a -> Expr a) -> - (Binder a -> Binder a) -> - (Bind a -> Bind a, Expr a -> Expr a, Binder a -> Binder a) +everywhereOnValues :: + (Bind a -> Bind a) -> + (Expr a -> Expr a) -> + (Binder a -> Binder a) -> + (Bind a -> Bind a, Expr a -> Expr a, Binder a -> Binder a) everywhereOnValues f g h = (f', g', h') where - f' (NonRec a name e) = f (NonRec a name (g' e)) - f' (Rec es) = f (Rec (map (second g') es)) + f' (NonRec a name e) = f (NonRec a name (g' e)) + f' (Rec es) = f (Rec (map (second g') es)) - g' (Literal ann e) = g (Literal ann (handleLiteral g' e)) - g' (Accessor ann prop e) = g (Accessor ann prop (g' e)) - g' (ObjectUpdate ann obj copy vs) = g (ObjectUpdate ann (g' obj) copy (map (fmap g') vs)) - g' (Abs ann name e) = g (Abs ann name (g' e)) - g' (App ann v1 v2) = g (App ann (g' v1) (g' v2)) - g' (Case ann vs alts) = g (Case ann (map g' vs) (map handleCaseAlternative alts)) - g' (Let ann ds e) = g (Let ann (map f' ds) (g' e)) - g' e = g e + g' (Literal ann t e) = g (Literal ann t (handleLiteral g' e)) + g' (Accessor ann t prop e) = g (Accessor ann t prop (g' e)) + g' (ObjectUpdate ann t obj copy vs) = g (ObjectUpdate ann t (g' obj) copy (map (fmap g') vs)) + g' (Abs ann t name e) = g (Abs ann t name (g' e)) + g' (App ann v1 v2) = g (App ann (g' v1) (g' v2)) + g' (Case ann t vs alts) = g (Case ann t (map g' vs) (map handleCaseAlternative alts)) + g' (Let ann ds e) = g (Let ann (map f' ds) (g' e)) + g' e = g e - h' (LiteralBinder a b) = h (LiteralBinder a (handleLiteral h' b)) - h' (NamedBinder a name b) = h (NamedBinder a name (h' b)) - h' (ConstructorBinder a q1 q2 bs) = h (ConstructorBinder a q1 q2 (map h' bs)) - h' b = h b + h' (LiteralBinder a b) = h (LiteralBinder a (handleLiteral h' b)) + h' (NamedBinder a name b) = h (NamedBinder a name (h' b)) + h' (ConstructorBinder a q1 q2 bs) = h (ConstructorBinder a q1 q2 (map h' bs)) + h' b = h b - handleCaseAlternative ca = - ca { caseAlternativeBinders = map h' (caseAlternativeBinders ca) - , caseAlternativeResult = (map (g' *** g') +++ g') (caseAlternativeResult ca) - } + handleCaseAlternative ca = + ca + { caseAlternativeBinders = map h' (caseAlternativeBinders ca) + , caseAlternativeResult = (map (g' *** g') +++ g') (caseAlternativeResult ca) + } - handleLiteral :: (a -> a) -> Literal a -> Literal a - handleLiteral i (ArrayLiteral ls) = ArrayLiteral (map i ls) - handleLiteral i (ObjectLiteral ls) = ObjectLiteral (map (fmap i) ls) - handleLiteral _ other = other + handleLiteral :: (a -> a) -> Literal a -> Literal a + handleLiteral i (ListLiteral ls) = ListLiteral (map i ls) + handleLiteral i (ObjectLiteral ls) = ObjectLiteral (map (fmap i) ls) + handleLiteral _ other = other --- | --- Apply the provided functions to the top level of AST nodes. --- --- This function is useful as a building block for recursive functions, but --- doesn't actually recurse itself. --- -traverseCoreFn - :: forall f a - . Applicative f - => (Bind a -> f (Bind a)) - -> (Expr a -> f (Expr a)) - -> (Binder a -> f (Binder a)) - -> (CaseAlternative a -> f (CaseAlternative a)) - -> (Bind a -> f (Bind a), Expr a -> f (Expr a), Binder a -> f (Binder a), CaseAlternative a -> f (CaseAlternative a)) +{- | +Apply the provided functions to the top level of AST nodes. + +This function is useful as a building block for recursive functions, but +doesn't actually recurse itself. +-} +traverseCoreFn :: + forall f a. + (Applicative f) => + (Bind a -> f (Bind a)) -> + (Expr a -> f (Expr a)) -> + (Binder a -> f (Binder a)) -> + (CaseAlternative a -> f (CaseAlternative a)) -> + (Bind a -> f (Bind a), Expr a -> f (Expr a), Binder a -> f (Binder a), CaseAlternative a -> f (CaseAlternative a)) traverseCoreFn f g h i = (f', g', h', i') where - f' (NonRec a name e) = NonRec a name <$> g e - f' (Rec es) = Rec <$> traverse (traverse g) es + f' (NonRec a name e) = NonRec a name <$> g e + f' (Rec es) = Rec <$> traverse (traverse g) es - g' (Literal ann e) = Literal ann <$> handleLiteral g e - g' (Accessor ann prop e) = Accessor ann prop <$> g e - g' (ObjectUpdate ann obj copy vs) = (\obj' -> ObjectUpdate ann obj' copy) <$> g obj <*> traverse (traverse g) vs - g' (Abs ann name e) = Abs ann name <$> g e - g' (App ann v1 v2) = App ann <$> g v1 <*> g v2 - g' (Case ann vs alts) = Case ann <$> traverse g vs <*> traverse i alts - g' (Let ann ds e) = Let ann <$> traverse f ds <*> g' e - g' e = pure e + g' (Literal ann t e) = Literal ann t <$> handleLiteral g e + g' (Accessor ann t prop e) = Accessor ann t prop <$> g e + g' (ObjectUpdate ann t obj copy vs) = (\obj' -> ObjectUpdate ann t obj' copy) <$> g obj <*> traverse (traverse g) vs + g' (Abs ann t name e) = Abs ann t name <$> g e + g' (App ann v1 v2) = App ann <$> g v1 <*> g v2 + g' (Case ann t vs alts) = Case ann t <$> traverse g vs <*> traverse i alts + g' (Let ann ds e) = Let ann <$> traverse f ds <*> g' e + g' e = pure e - h' (LiteralBinder a b) = LiteralBinder a <$> handleLiteral h b - h' (NamedBinder a name b) = NamedBinder a name <$> h b - h' (ConstructorBinder a q1 q2 bs) = ConstructorBinder a q1 q2 <$> traverse h bs - h' b = pure b + h' (LiteralBinder a b) = LiteralBinder a <$> handleLiteral h b + h' (NamedBinder a name b) = NamedBinder a name <$> h b + h' (ConstructorBinder a q1 q2 bs) = ConstructorBinder a q1 q2 <$> traverse h bs + h' b = pure b - i' ca = CaseAlternative <$> traverse h (caseAlternativeBinders ca) <*> bitraverse (traverse $ bitraverse g g) g (caseAlternativeResult ca) + i' ca = CaseAlternative <$> traverse h (caseAlternativeBinders ca) <*> bitraverse (traverse $ bitraverse g g) g (caseAlternativeResult ca) - handleLiteral withItem = \case - ArrayLiteral ls -> ArrayLiteral <$> traverse withItem ls - ObjectLiteral ls -> ObjectLiteral <$> traverse (traverse withItem) ls - other -> pure other + handleLiteral withItem = \case + ListLiteral ls -> ListLiteral <$> traverse withItem ls + ObjectLiteral ls -> ObjectLiteral <$> traverse (traverse withItem) ls + other -> pure other diff --git a/src/Language/PureScript/CoreFn/TypeLike.hs b/src/Language/PureScript/CoreFn/TypeLike.hs new file mode 100644 index 000000000..30c32c405 --- /dev/null +++ b/src/Language/PureScript/CoreFn/TypeLike.hs @@ -0,0 +1,186 @@ +module Language.PureScript.CoreFn.TypeLike where + +import Data.Text (Text) +import Language.PureScript.Types (TypeVarVisibility (..), rowFromList, rowToSortedList) +import Prelude + +import Data.Bifunctor (Bifunctor (..)) +import Language.PureScript.Environment qualified as E +import Language.PureScript.Types qualified as T + +import Control.Applicative +import Control.Lens.Operators ((<&>)) +import Data.Kind qualified as GHC +import Data.Maybe (catMaybes) +import Debug.Trace (trace) +import Language.PureScript.AST.SourcePos (pattern NullSourceAnn) +import Language.PureScript.Environment (pattern RecordT, pattern (:->)) +import Language.Purus.Debug (doTrace) +import Language.Purus.Pretty.Common +import Prettyprinter (Pretty) + +class TypeLike t where + type KindOf t :: GHC.Type + + -- | Usually this will be the Type Application constructor + applyType :: t -> t -> t + + -- | Given a typelike, remove all of the leading quantifiers while + -- keeping track of the quantifier metadata (visibility, name, kind) + -- for each removed quantifier. + stripQuantifiers :: t -> ([(TypeVarVisibility, Text, KindOf t)], t) + + {- Given TypeLikes `a` and `b`, construct a function type `a -> b` + -} + funTy :: t -> t -> t + + -- | (a -> b -> c) -> [a,b] + -- + -- NOTE: Unsafe/partial. Check that you don't want `splitFunTyParts` instead + funArgTypes :: t -> [t] + funArgTypes = init . splitFunTyParts + + -- | Replaces all the type variables with the corresponding types + replaceAllTypeVars :: [(Text, t)] -> t -> t + + -- | (a -> b -> c) -> [a,b,c] + -- + -- NOTE: Check that you don't want `funArgTypes` instead + splitFunTyParts :: t -> [t] + + -- | Quantify over all free type variables in the argument type. + quantify :: t -> t + + -- | `instantiates var mono poly` tries to find + -- the type in `mono` that instantiates the TyVar in + -- `poly`. + -- + -- E.g. `instantiates "x" (Maybe Int) (Maybe x) == Just Int` + instantiates :: + Text -> -- name of TyVar we're checking + t -> -- Monomorphic/"more monomorphic" type + t -> -- Polymorphic/"more polymorphic" type + Maybe t + + -- | Collect the used type variables in a type + usedTypeVariables :: t -> [(Text, KindOf t)] + + -- | Collect the free type variables in a type + freeTypeVariables :: t -> [(Text, KindOf t)] + + -- | Get the (final) return type of a function. Returns the argument + -- type if the argument is not a function. + resultTy :: t -> t + + -- | Given a typelike t, return Just (Text, KindOf t) if it is a type variable. + -- (Needed to implement some functions generically over the typelike) + unTyVar :: t -> Maybe (Text, KindOf t) + + -- | Instantiate the first quantified variable in the second argument with the type in the first argument + instTy :: t -> t -> t + + unFunction :: t -> Maybe (t, t) + + {- We need this to correctly reconstruct the type of expressions in the presence of TyAbs + -} + quantify1 :: Text -> KindOf t -> t -> t + +-- TODO: Just define it this way in the instances -_- +safeFunArgTypes :: forall t. (TypeLike t) => t -> [t] +safeFunArgTypes t = case splitFunTyParts t of + [] -> [] + _ -> funArgTypes t + +getInstantiations :: forall t. (TypeLike t) => t -> t -> [(Text, t)] +getInstantiations mono poly = catMaybes mInstantiations + where + freeInPoly = fst <$> usedTypeVariables poly + mInstantiations = freeInPoly <&> \nm -> (nm,) <$> instantiates nm mono poly + +instantiateWithArgs :: forall t. (TypeLike t, Pretty t) => t -> [t] -> t +instantiateWithArgs f args = doTrace "instantiateWithArgs" msg result + where + msg = + "instantiateWithArgs:\n fun: " + <> prettyStr f + <> "\n args: " + <> prettyStr args + <> "\n instantiations: " + <> prettyStr instantiations + <> "\n result: " + <> prettyStr result + result = quantify $ replaceAllTypeVars instantiations (unQuantify f) + instantiations = getAllInstantiations f args + +getAllInstantiations :: + forall t. + (TypeLike t, Pretty t) => + t -> + [t] -> + [(Text, t)] +getAllInstantiations fun args@(_ : _) = doTrace "getAllInstantiations" (prettyStr result) result + where + result = catMaybes $ zipWith go funArgs args + + funArgs = funArgTypes . unQuantify $ fun + + go t x = case unTyVar t of + Just (v, _) -> Just (v, x) + Nothing -> Nothing +getAllInstantiations _ _ = [] + +unQuantify :: forall t. (TypeLike t) => t -> t +unQuantify = snd . stripQuantifiers + +toSortedRow = rowFromList . rowToSortedList + +instance TypeLike T.SourceType where + type KindOf T.SourceType = T.SourceType + + applyType = T.srcTypeApp + + stripQuantifiers = \case + T.ForAll _ vis var mk inner _ -> first ((vis, var, mk) :) $ stripQuantifiers inner + other -> ([], other) + + funTy = E.function + + funArgTypes = init . splitFunTyParts + + replaceAllTypeVars = T.replaceAllTypeVars + + splitFunTyParts = \case + (a E.:-> b) -> a : splitFunTyParts b + t -> [t] + + quantify = T.quantify + + instantiates var x (T.TypeVar _ y _) | y == var = Just x + instantiates var (T.TypeApp _ t1 t2) (T.TypeApp _ t1' t2') = instantiates var t1 t1' <|> instantiates var t2 t2' + instantiates var (RecordT xs) (RecordT ys) = instantiates var (toSortedRow xs) (toSortedRow ys) + instantiates var (T.RCons _ l x xs) (T.RCons _ l' x' xs') + | l == l' = instantiates var x x' <|> instantiates var xs xs' + | otherwise = instantiates var xs xs' + instantiates _ _ _ = Nothing + + freeTypeVariables = T.freeTypeVariables + + usedTypeVariables = T.usedTypeVariables + + resultTy t = case snd $ stripQuantifiers t of + (_ E.:-> b) -> resultTy b + other -> other + + instTy t = \case + T.ForAll _ _ var _ inner _ -> replaceAllTypeVars [(var, t)] inner + other -> other + + unTyVar = \case + T.TypeVar _ v k -> Just (v, k) + _ -> Nothing + + unFunction = \case + a :-> b -> Just (a, b) + _ -> Nothing + + quantify1 nm k inner = T.ForAll NullSourceAnn TypeVarVisible nm k inner Nothing diff --git a/src/Language/PureScript/CoreFn/Utils.hs b/src/Language/PureScript/CoreFn/Utils.hs new file mode 100644 index 000000000..28cdda0cc --- /dev/null +++ b/src/Language/PureScript/CoreFn/Utils.hs @@ -0,0 +1,127 @@ +{-# OPTIONS_GHC -Wno-orphans #-} + +module Language.PureScript.CoreFn.Utils where + +import Data.Bifunctor (Bifunctor (first)) +import Data.Bitraversable (Bitraversable (bitraverse)) +import Data.Map (Map) +import Data.Map qualified as M +import Data.Text (Text) +import Language.PureScript.CoreFn.Desugar.Utils (traverseLit) +import Language.PureScript.CoreFn.Expr ( + Bind (..), + CaseAlternative (CaseAlternative), + Expr (..), + PurusType, + ) +import Language.PureScript.Types +import Prelude hiding (error) +import Prelude qualified + +import Control.Lens.Plated +import Language.PureScript.Environment (function, pattern (:->)) +import Language.PureScript.Pretty.Types (prettyPrintType) + +foldl1x :: (Foldable t) => String -> (a -> a -> a) -> t a -> a +foldl1x msg f xs + | null xs = Prelude.error msg + | otherwise = foldl1 f xs + + +{- TODO: REMOVE EVERYTHING BELOW (it should all be subsumed by the TypeLike class) + +-} + +-- TODO: Explain what this is / how it works +-- TODO: Type Constructors +instantiates :: + Text -> -- Name of the TyVar we're checking + SourceType -> -- Monomorphic type (or "more monomorphic" type) + SourceType -> -- Polymorphic type (or "more polymoprhic" type) + Maybe SourceType +instantiates var x (TypeVar _ y _) | y == var = Just x +instantiates var (TypeApp _ t1 t2) (TypeApp _ t1' t2') = case instantiates var t1 t1' of + Just x -> Just x + Nothing -> instantiates var t2 t2' +instantiates _ _ _ = Nothing + +appFunArgs :: Expr a -> Expr a -> (Expr a, [Expr a]) +appFunArgs f args = (appFun f, appArgs f args) + where + appArgs :: Expr a -> Expr a -> [Expr a] + appArgs (App _ t1 t2) t3 = appArgs t1 t2 <> [t3] + appArgs _ t3 = [t3] + + appFun :: Expr a -> Expr a + appFun (App _ t1 _) = appFun t1 + appFun res = res + +appType :: (Show a) => Expr a -> Expr a -> SourceType +appType fe ae = case stripQuantifiers funTy of + ([], ft) -> + let numArgs = length argTypes + in foldl1x "appType first branch (CoreFn.Utils)" function . drop numArgs . splitFunTyParts $ ft + (xs, ft) -> + let funArgs = splitFunTyParts ft -- funArgTypes ft + dict = mkInstanceMap M.empty xs argTypes funArgs + numArgs = length argTypes + msg = + "FUNTY: " + <> prettyPrintType 100 funTy + <> "\nARGTY: " + <> prettyPrintType 100 (exprType ae) + <> "\nNUM ARGS:" + <> show numArgs + in quantify + . foldl1x msg function + . drop numArgs + . splitFunTyParts + . replaceAllTypeVars (M.toList dict) + $ ft + where + (f, args) = appFunArgs fe ae + funTy = exprType f + argTypes = exprType <$> args + + mkInstanceMap :: Map Text SourceType -> [Text] -> [SourceType] -> [SourceType] -> Map Text SourceType + mkInstanceMap acc [] _ _ = acc + mkInstanceMap acc _ [] _ = acc + mkInstanceMap acc _ _ [] = acc + mkInstanceMap acc (var : vars) (mt : mts) (pt : pts) = case instantiates var mt pt of + Nothing -> + mkInstanceMap acc [var] mts pts + <> mkInstanceMap M.empty vars (mt : mts) (pt : pts) + Just t -> mkInstanceMap (M.insert var t acc) vars (mt : mts) (pt : pts) + +stripQuantifiers :: SourceType -> ([Text], SourceType) +stripQuantifiers = first reverse . go [] + where + go :: [Text] -> SourceType -> ([Text], SourceType) + go acc (ForAll _ _ var _ inner _) = go (var : acc) inner + go acc other = (acc, other) + +-- | (a -> b -> c) -> [a,b,c] +splitFunTyParts :: Type a -> [Type a] +splitFunTyParts = \case + (a :-> b) -> a : splitFunTyParts b + t -> [t] + +{- | (a -> b -> c) -> [a,b] + + NOTE: Unsafe/partial +-} +funArgTypes :: Type a -> [Type a] +funArgTypes = init . splitFunTyParts + +exprType :: (Show a) => Expr a -> PurusType +exprType = \case + Literal _ ty _ -> ty + Accessor _ ty _ _ -> ty + ObjectUpdate _ ty _ _ _ -> ty + Abs _ ty _ _ -> ty + App _ t1 t2 -> appType t1 t2 + Var _ ty __ -> ty + Case _ ty _ _ -> ty + Let _ _ e -> exprType e + + diff --git a/src/Language/PureScript/CoreImp.hs b/src/Language/PureScript/CoreImp.hs index 5029aff96..409dfdc71 100644 --- a/src/Language/PureScript/CoreImp.hs +++ b/src/Language/PureScript/CoreImp.hs @@ -1,6 +1,6 @@ -- | The imperative core language module Language.PureScript.CoreImp ( - module C + module C, ) where import Language.PureScript.CoreImp.AST as C diff --git a/src/Language/PureScript/CoreImp/AST.hs b/src/Language/PureScript/CoreImp/AST.hs index 9711890a3..3d9c70a77 100644 --- a/src/Language/PureScript/CoreImp/AST.hs +++ b/src/Language/PureScript/CoreImp/AST.hs @@ -4,10 +4,10 @@ module Language.PureScript.CoreImp.AST where import Prelude import Control.Monad ((>=>)) -import Control.Monad.Identity (Identity(..), runIdentity) +import Control.Monad.Identity (Identity (..), runIdentity) import Data.Text (Text) -import Language.PureScript.AST (SourceSpan(..)) +import Language.PureScript.AST (SourceSpan (..)) import Language.PureScript.Comments (Comment) import Language.PureScript.Names (ModuleName) import Language.PureScript.PSString (PSString) @@ -45,198 +45,204 @@ data BinaryOperator | ZeroFillShiftRight deriving (Show, Eq) --- | Data type for CoreImp comments, which can come from either the PureScript --- source or internal transformations. +{- | Data type for CoreImp comments, which can come from either the PureScript +source or internal transformations. +-} data CIComments = SourceComments [Comment] | PureAnnotation deriving (Show, Eq) --- | --- Indicates whether the initializer of a variable is known not to have side --- effects, and thus can be inlined if needed or removed if unneeded. --- +{- | +Indicates whether the initializer of a variable is known not to have side +effects, and thus can be inlined if needed or removed if unneeded. +-} data InitializerEffects = NoEffects | UnknownEffects deriving (Show, Eq) -- | Data type for simplified JavaScript expressions data AST - = NumericLiteral (Maybe SourceSpan) (Either Integer Double) - -- ^ A numeric literal - | StringLiteral (Maybe SourceSpan) PSString - -- ^ A string literal - | BooleanLiteral (Maybe SourceSpan) Bool - -- ^ A boolean literal - | Unary (Maybe SourceSpan) UnaryOperator AST - -- ^ A unary operator application - | Binary (Maybe SourceSpan) BinaryOperator AST AST - -- ^ A binary operator application - | ArrayLiteral (Maybe SourceSpan) [AST] - -- ^ An array literal - | Indexer (Maybe SourceSpan) AST AST - -- ^ An array indexer expression - | ObjectLiteral (Maybe SourceSpan) [(PSString, AST)] - -- ^ An object literal - | Function (Maybe SourceSpan) (Maybe Text) [Text] AST - -- ^ A function introduction (optional name, arguments, body) - | App (Maybe SourceSpan) AST [AST] - -- ^ Function application - | Var (Maybe SourceSpan) Text - -- ^ Variable - | ModuleAccessor (Maybe SourceSpan) ModuleName PSString - -- ^ Value from another module - | Block (Maybe SourceSpan) [AST] - -- ^ A block of expressions in braces - | VariableIntroduction (Maybe SourceSpan) Text (Maybe (InitializerEffects, AST)) - -- ^ A variable introduction and optional initialization - | Assignment (Maybe SourceSpan) AST AST - -- ^ A variable assignment - | While (Maybe SourceSpan) AST AST - -- ^ While loop - | For (Maybe SourceSpan) Text AST AST AST - -- ^ For loop - | ForIn (Maybe SourceSpan) Text AST AST - -- ^ ForIn loop - | IfElse (Maybe SourceSpan) AST AST (Maybe AST) - -- ^ If-then-else statement - | Return (Maybe SourceSpan) AST - -- ^ Return statement - | ReturnNoResult (Maybe SourceSpan) - -- ^ Return statement with no return value - | Throw (Maybe SourceSpan) AST - -- ^ Throw statement - | InstanceOf (Maybe SourceSpan) AST AST - -- ^ instanceof check - | Comment CIComments AST - -- ^ Commented JavaScript + = -- | A numeric literal + NumericLiteral (Maybe SourceSpan) (Either Integer Double) + | -- | A string literal + StringLiteral (Maybe SourceSpan) PSString + | -- | A boolean literal + BooleanLiteral (Maybe SourceSpan) Bool + | -- | A unary operator application + Unary (Maybe SourceSpan) UnaryOperator AST + | -- | A binary operator application + Binary (Maybe SourceSpan) BinaryOperator AST AST + | -- | An array literal + ArrayLiteral (Maybe SourceSpan) [AST] + | -- | An array indexer expression + Indexer (Maybe SourceSpan) AST AST + | -- | An object literal + ObjectLiteral (Maybe SourceSpan) [(PSString, AST)] + | -- | A function introduction (optional name, arguments, body) + Function (Maybe SourceSpan) (Maybe Text) [Text] AST + | -- | Function application + App (Maybe SourceSpan) AST [AST] + | -- | Variable + Var (Maybe SourceSpan) Text + | -- | Value from another module + ModuleAccessor (Maybe SourceSpan) ModuleName PSString + | -- | A block of expressions in braces + Block (Maybe SourceSpan) [AST] + | -- | A variable introduction and optional initialization + VariableIntroduction (Maybe SourceSpan) Text (Maybe (InitializerEffects, AST)) + | -- | A variable assignment + Assignment (Maybe SourceSpan) AST AST + | -- | While loop + While (Maybe SourceSpan) AST AST + | -- | For loop + For (Maybe SourceSpan) Text AST AST AST + | -- | ForIn loop + ForIn (Maybe SourceSpan) Text AST AST + | -- | If-then-else statement + IfElse (Maybe SourceSpan) AST AST (Maybe AST) + | -- | Return statement + Return (Maybe SourceSpan) AST + | -- | Return statement with no return value + ReturnNoResult (Maybe SourceSpan) + | -- | Throw statement + Throw (Maybe SourceSpan) AST + | -- | instanceof check + InstanceOf (Maybe SourceSpan) AST AST + | -- | Commented JavaScript + Comment CIComments AST deriving (Show, Eq) withSourceSpan :: SourceSpan -> AST -> AST -withSourceSpan withSpan = go where - ss :: Maybe SourceSpan - ss = Just withSpan +withSourceSpan withSpan = go + where + ss :: Maybe SourceSpan + ss = Just withSpan - go :: AST -> AST - go (NumericLiteral _ n) = NumericLiteral ss n - go (StringLiteral _ s) = StringLiteral ss s - go (BooleanLiteral _ b) = BooleanLiteral ss b - go (Unary _ op j) = Unary ss op j - go (Binary _ op j1 j2) = Binary ss op j1 j2 - go (ArrayLiteral _ js) = ArrayLiteral ss js - go (Indexer _ j1 j2) = Indexer ss j1 j2 - go (ObjectLiteral _ js) = ObjectLiteral ss js - go (Function _ name args j) = Function ss name args j - go (App _ j js) = App ss j js - go (Var _ s) = Var ss s - go (ModuleAccessor _ s1 s2) = ModuleAccessor ss s1 s2 - go (Block _ js) = Block ss js - go (VariableIntroduction _ name j) = VariableIntroduction ss name j - go (Assignment _ j1 j2) = Assignment ss j1 j2 - go (While _ j1 j2) = While ss j1 j2 - go (For _ name j1 j2 j3) = For ss name j1 j2 j3 - go (ForIn _ name j1 j2) = ForIn ss name j1 j2 - go (IfElse _ j1 j2 j3) = IfElse ss j1 j2 j3 - go (Return _ js) = Return ss js - go (ReturnNoResult _) = ReturnNoResult ss - go (Throw _ js) = Throw ss js - go (InstanceOf _ j1 j2) = InstanceOf ss j1 j2 - go c@Comment{} = c + go :: AST -> AST + go (NumericLiteral _ n) = NumericLiteral ss n + go (StringLiteral _ s) = StringLiteral ss s + go (BooleanLiteral _ b) = BooleanLiteral ss b + go (Unary _ op j) = Unary ss op j + go (Binary _ op j1 j2) = Binary ss op j1 j2 + go (ArrayLiteral _ js) = ArrayLiteral ss js + go (Indexer _ j1 j2) = Indexer ss j1 j2 + go (ObjectLiteral _ js) = ObjectLiteral ss js + go (Function _ name args j) = Function ss name args j + go (App _ j js) = App ss j js + go (Var _ s) = Var ss s + go (ModuleAccessor _ s1 s2) = ModuleAccessor ss s1 s2 + go (Block _ js) = Block ss js + go (VariableIntroduction _ name j) = VariableIntroduction ss name j + go (Assignment _ j1 j2) = Assignment ss j1 j2 + go (While _ j1 j2) = While ss j1 j2 + go (For _ name j1 j2 j3) = For ss name j1 j2 j3 + go (ForIn _ name j1 j2) = ForIn ss name j1 j2 + go (IfElse _ j1 j2 j3) = IfElse ss j1 j2 j3 + go (Return _ js) = Return ss js + go (ReturnNoResult _) = ReturnNoResult ss + go (Throw _ js) = Throw ss js + go (InstanceOf _ j1 j2) = InstanceOf ss j1 j2 + go c@Comment {} = c getSourceSpan :: AST -> Maybe SourceSpan -getSourceSpan = go where - go :: AST -> Maybe SourceSpan - go (NumericLiteral ss _) = ss - go (StringLiteral ss _) = ss - go (BooleanLiteral ss _) = ss - go (Unary ss _ _) = ss - go (Binary ss _ _ _) = ss - go (ArrayLiteral ss _) = ss - go (Indexer ss _ _) = ss - go (ObjectLiteral ss _) = ss - go (Function ss _ _ _) = ss - go (App ss _ _) = ss - go (Var ss _) = ss - go (ModuleAccessor ss _ _) = ss - go (Block ss _) = ss - go (VariableIntroduction ss _ _) = ss - go (Assignment ss _ _) = ss - go (While ss _ _) = ss - go (For ss _ _ _ _) = ss - go (ForIn ss _ _ _) = ss - go (IfElse ss _ _ _) = ss - go (Return ss _) = ss - go (ReturnNoResult ss) = ss - go (Throw ss _) = ss - go (InstanceOf ss _ _) = ss - go (Comment _ _) = Nothing +getSourceSpan = go + where + go :: AST -> Maybe SourceSpan + go (NumericLiteral ss _) = ss + go (StringLiteral ss _) = ss + go (BooleanLiteral ss _) = ss + go (Unary ss _ _) = ss + go (Binary ss _ _ _) = ss + go (ArrayLiteral ss _) = ss + go (Indexer ss _ _) = ss + go (ObjectLiteral ss _) = ss + go (Function ss _ _ _) = ss + go (App ss _ _) = ss + go (Var ss _) = ss + go (ModuleAccessor ss _ _) = ss + go (Block ss _) = ss + go (VariableIntroduction ss _ _) = ss + go (Assignment ss _ _) = ss + go (While ss _ _) = ss + go (For ss _ _ _ _) = ss + go (ForIn ss _ _ _) = ss + go (IfElse ss _ _ _) = ss + go (Return ss _) = ss + go (ReturnNoResult ss) = ss + go (Throw ss _) = ss + go (InstanceOf ss _ _) = ss + go (Comment _ _) = Nothing everywhere :: (AST -> AST) -> AST -> AST -everywhere f = go where - go :: AST -> AST - go (Unary ss op j) = f (Unary ss op (go j)) - go (Binary ss op j1 j2) = f (Binary ss op (go j1) (go j2)) - go (ArrayLiteral ss js) = f (ArrayLiteral ss (map go js)) - go (Indexer ss j1 j2) = f (Indexer ss (go j1) (go j2)) - go (ObjectLiteral ss js) = f (ObjectLiteral ss (map (fmap go) js)) - go (Function ss name args j) = f (Function ss name args (go j)) - go (App ss j js) = f (App ss (go j) (map go js)) - go (Block ss js) = f (Block ss (map go js)) - go (VariableIntroduction ss name j) = f (VariableIntroduction ss name (fmap (fmap go) j)) - go (Assignment ss j1 j2) = f (Assignment ss (go j1) (go j2)) - go (While ss j1 j2) = f (While ss (go j1) (go j2)) - go (For ss name j1 j2 j3) = f (For ss name (go j1) (go j2) (go j3)) - go (ForIn ss name j1 j2) = f (ForIn ss name (go j1) (go j2)) - go (IfElse ss j1 j2 j3) = f (IfElse ss (go j1) (go j2) (fmap go j3)) - go (Return ss js) = f (Return ss (go js)) - go (Throw ss js) = f (Throw ss (go js)) - go (InstanceOf ss j1 j2) = f (InstanceOf ss (go j1) (go j2)) - go (Comment com j) = f (Comment com (go j)) - go other = f other +everywhere f = go + where + go :: AST -> AST + go (Unary ss op j) = f (Unary ss op (go j)) + go (Binary ss op j1 j2) = f (Binary ss op (go j1) (go j2)) + go (ArrayLiteral ss js) = f (ArrayLiteral ss (map go js)) + go (Indexer ss j1 j2) = f (Indexer ss (go j1) (go j2)) + go (ObjectLiteral ss js) = f (ObjectLiteral ss (map (fmap go) js)) + go (Function ss name args j) = f (Function ss name args (go j)) + go (App ss j js) = f (App ss (go j) (map go js)) + go (Block ss js) = f (Block ss (map go js)) + go (VariableIntroduction ss name j) = f (VariableIntroduction ss name (fmap (fmap go) j)) + go (Assignment ss j1 j2) = f (Assignment ss (go j1) (go j2)) + go (While ss j1 j2) = f (While ss (go j1) (go j2)) + go (For ss name j1 j2 j3) = f (For ss name (go j1) (go j2) (go j3)) + go (ForIn ss name j1 j2) = f (ForIn ss name (go j1) (go j2)) + go (IfElse ss j1 j2 j3) = f (IfElse ss (go j1) (go j2) (fmap go j3)) + go (Return ss js) = f (Return ss (go js)) + go (Throw ss js) = f (Throw ss (go js)) + go (InstanceOf ss j1 j2) = f (InstanceOf ss (go j1) (go j2)) + go (Comment com j) = f (Comment com (go j)) + go other = f other everywhereTopDown :: (AST -> AST) -> AST -> AST everywhereTopDown f = runIdentity . everywhereTopDownM (Identity . f) everywhereTopDownM :: (Monad m) => (AST -> m AST) -> AST -> m AST -everywhereTopDownM f = f >=> go where - f' = f >=> go - go (Unary ss op j) = Unary ss op <$> f' j - go (Binary ss op j1 j2) = Binary ss op <$> f' j1 <*> f' j2 - go (ArrayLiteral ss js) = ArrayLiteral ss <$> traverse f' js - go (Indexer ss j1 j2) = Indexer ss <$> f' j1 <*> f' j2 - go (ObjectLiteral ss js) = ObjectLiteral ss <$> traverse (sndM f') js - go (Function ss name args j) = Function ss name args <$> f' j - go (App ss j js) = App ss <$> f' j <*> traverse f' js - go (Block ss js) = Block ss <$> traverse f' js - go (VariableIntroduction ss name j) = VariableIntroduction ss name <$> traverse (traverse f') j - go (Assignment ss j1 j2) = Assignment ss <$> f' j1 <*> f' j2 - go (While ss j1 j2) = While ss <$> f' j1 <*> f' j2 - go (For ss name j1 j2 j3) = For ss name <$> f' j1 <*> f' j2 <*> f' j3 - go (ForIn ss name j1 j2) = ForIn ss name <$> f' j1 <*> f' j2 - go (IfElse ss j1 j2 j3) = IfElse ss <$> f' j1 <*> f' j2 <*> traverse f' j3 - go (Return ss j) = Return ss <$> f' j - go (Throw ss j) = Throw ss <$> f' j - go (InstanceOf ss j1 j2) = InstanceOf ss <$> f' j1 <*> f' j2 - go (Comment com j) = Comment com <$> f' j - go other = f other +everywhereTopDownM f = f >=> go + where + f' = f >=> go + go (Unary ss op j) = Unary ss op <$> f' j + go (Binary ss op j1 j2) = Binary ss op <$> f' j1 <*> f' j2 + go (ArrayLiteral ss js) = ArrayLiteral ss <$> traverse f' js + go (Indexer ss j1 j2) = Indexer ss <$> f' j1 <*> f' j2 + go (ObjectLiteral ss js) = ObjectLiteral ss <$> traverse (sndM f') js + go (Function ss name args j) = Function ss name args <$> f' j + go (App ss j js) = App ss <$> f' j <*> traverse f' js + go (Block ss js) = Block ss <$> traverse f' js + go (VariableIntroduction ss name j) = VariableIntroduction ss name <$> traverse (traverse f') j + go (Assignment ss j1 j2) = Assignment ss <$> f' j1 <*> f' j2 + go (While ss j1 j2) = While ss <$> f' j1 <*> f' j2 + go (For ss name j1 j2 j3) = For ss name <$> f' j1 <*> f' j2 <*> f' j3 + go (ForIn ss name j1 j2) = ForIn ss name <$> f' j1 <*> f' j2 + go (IfElse ss j1 j2 j3) = IfElse ss <$> f' j1 <*> f' j2 <*> traverse f' j3 + go (Return ss j) = Return ss <$> f' j + go (Throw ss j) = Throw ss <$> f' j + go (InstanceOf ss j1 j2) = InstanceOf ss <$> f' j1 <*> f' j2 + go (Comment com j) = Comment com <$> f' j + go other = f other everything :: (r -> r -> r) -> (AST -> r) -> AST -> r -everything (<>.) f = go where - go j@(Unary _ _ j1) = f j <>. go j1 - go j@(Binary _ _ j1 j2) = f j <>. go j1 <>. go j2 - go j@(ArrayLiteral _ js) = foldl (<>.) (f j) (map go js) - go j@(Indexer _ j1 j2) = f j <>. go j1 <>. go j2 - go j@(ObjectLiteral _ js) = foldl (<>.) (f j) (map (go . snd) js) - go j@(Function _ _ _ j1) = f j <>. go j1 - go j@(App _ j1 js) = foldl (<>.) (f j <>. go j1) (map go js) - go j@(Block _ js) = foldl (<>.) (f j) (map go js) - go j@(VariableIntroduction _ _ (Just (_, j1))) = f j <>. go j1 - go j@(Assignment _ j1 j2) = f j <>. go j1 <>. go j2 - go j@(While _ j1 j2) = f j <>. go j1 <>. go j2 - go j@(For _ _ j1 j2 j3) = f j <>. go j1 <>. go j2 <>. go j3 - go j@(ForIn _ _ j1 j2) = f j <>. go j1 <>. go j2 - go j@(IfElse _ j1 j2 Nothing) = f j <>. go j1 <>. go j2 - go j@(IfElse _ j1 j2 (Just j3)) = f j <>. go j1 <>. go j2 <>. go j3 - go j@(Return _ j1) = f j <>. go j1 - go j@(Throw _ j1) = f j <>. go j1 - go j@(InstanceOf _ j1 j2) = f j <>. go j1 <>. go j2 - go j@(Comment _ j1) = f j <>. go j1 - go other = f other +everything (<>.) f = go + where + go j@(Unary _ _ j1) = f j <>. go j1 + go j@(Binary _ _ j1 j2) = f j <>. go j1 <>. go j2 + go j@(ArrayLiteral _ js) = foldl (<>.) (f j) (map go js) + go j@(Indexer _ j1 j2) = f j <>. go j1 <>. go j2 + go j@(ObjectLiteral _ js) = foldl (<>.) (f j) (map (go . snd) js) + go j@(Function _ _ _ j1) = f j <>. go j1 + go j@(App _ j1 js) = foldl (<>.) (f j <>. go j1) (map go js) + go j@(Block _ js) = foldl (<>.) (f j) (map go js) + go j@(VariableIntroduction _ _ (Just (_, j1))) = f j <>. go j1 + go j@(Assignment _ j1 j2) = f j <>. go j1 <>. go j2 + go j@(While _ j1 j2) = f j <>. go j1 <>. go j2 + go j@(For _ _ j1 j2 j3) = f j <>. go j1 <>. go j2 <>. go j3 + go j@(ForIn _ _ j1 j2) = f j <>. go j1 <>. go j2 + go j@(IfElse _ j1 j2 Nothing) = f j <>. go j1 <>. go j2 + go j@(IfElse _ j1 j2 (Just j3)) = f j <>. go j1 <>. go j2 <>. go j3 + go j@(Return _ j1) = f j <>. go j1 + go j@(Throw _ j1) = f j <>. go j1 + go j@(InstanceOf _ j1 j2) = f j <>. go j1 <>. go j2 + go j@(Comment _ j1) = f j <>. go j1 + go other = f other diff --git a/src/Language/PureScript/CoreImp/Module.hs b/src/Language/PureScript/CoreImp/Module.hs index bdf4b8185..5e74c6c02 100644 --- a/src/Language/PureScript/CoreImp/Module.hs +++ b/src/Language/PureScript/CoreImp/Module.hs @@ -1,7 +1,7 @@ module Language.PureScript.CoreImp.Module where -import Protolude import Data.List.NonEmpty qualified as NEL (NonEmpty) +import Protolude import Language.PureScript.Comments (Comment) import Language.PureScript.CoreImp.AST (AST) diff --git a/src/Language/PureScript/CoreImp/Optimizer.hs b/src/Language/PureScript/CoreImp/Optimizer.hs index e59738df7..055d89294 100644 --- a/src/Language/PureScript/CoreImp/Optimizer.hs +++ b/src/Language/PureScript/CoreImp/Optimizer.hs @@ -1,22 +1,23 @@ --- | This module optimizes code in the simplified-JavaScript intermediate representation. --- --- The following optimizations are supported: --- --- * Collapsing nested blocks --- --- * Tail call elimination --- --- * Inlining of (>>=) and ret for the Eff monad --- --- * Removal of unnecessary thunks --- --- * Eta conversion --- --- * Inlining variables --- --- * Inline Prelude.($), Prelude.(#), Prelude.(++), Prelude.(!!) --- --- * Inlining primitive JavaScript operators +{- | This module optimizes code in the simplified-JavaScript intermediate representation. + +The following optimizations are supported: + + * Collapsing nested blocks + + * Tail call elimination + + * Inlining of (>>=) and ret for the Eff monad + + * Removal of unnecessary thunks + + * Eta conversion + + * Inlining variables + + * Inline Prelude.($), Prelude.(#), Prelude.(++), Prelude.(!!) + + * Inlining primitive JavaScript operators +-} module Language.PureScript.CoreImp.Optimizer (optimize) where import Prelude @@ -24,7 +25,7 @@ import Prelude import Data.Text (Text) import Control.Monad.Supply.Class (MonadSupply) -import Language.PureScript.CoreImp.AST (AST(..), InitializerEffects(..)) +import Language.PureScript.CoreImp.AST (AST (..), InitializerEffects (..)) import Language.PureScript.CoreImp.Optimizer.Blocks (collapseNestedBlocks, collapseNestedIfs) import Language.PureScript.CoreImp.Optimizer.Common (applyAll, replaceIdents) import Language.PureScript.CoreImp.Optimizer.Inliner (etaConvert, evaluateIifes, inlineCommonOperators, inlineCommonValues, inlineFnComposition, inlineFnIdentity, inlineUnsafeCoerce, inlineUnsafePartial, inlineVariables, unThunk) @@ -33,53 +34,63 @@ import Language.PureScript.CoreImp.Optimizer.TCO (tco) import Language.PureScript.CoreImp.Optimizer.Unused (removeCodeAfterReturnStatements, removeUndefinedApp, removeUnusedEffectFreeVars) -- | Apply a series of optimizer passes to simplified JavaScript code -optimize :: forall m. MonadSupply m => [Text] -> [[AST]] -> m [[AST]] +optimize :: forall m. (MonadSupply m) => [Text] -> [[AST]] -> m [[AST]] optimize exps jsDecls = removeUnusedEffectFreeVars exps <$> traverse (traverse go) jsDecls where go :: AST -> m AST go js = do - js' <- untilFixedPoint (inlineFnComposition expander . inlineFnIdentity expander . inlineUnsafeCoerce . inlineUnsafePartial . tidyUp . applyAll - [ inlineCommonValues expander - , inlineCommonOperators expander - ]) js + js' <- + untilFixedPoint + ( inlineFnComposition expander + . inlineFnIdentity expander + . inlineUnsafeCoerce + . inlineUnsafePartial + . tidyUp + . applyAll + [ inlineCommonValues expander + , inlineCommonOperators expander + ] + ) + js untilFixedPoint (return . tidyUp) . tco . inlineST =<< untilFixedPoint (return . magicDoST expander) =<< untilFixedPoint (return . magicDoEff expander) =<< untilFixedPoint (return . magicDoEffect expander) js' tidyUp :: AST -> AST - tidyUp = applyAll - [ collapseNestedBlocks - , collapseNestedIfs - , removeCodeAfterReturnStatements - , removeUndefinedApp - , unThunk - , etaConvert - , evaluateIifes - , inlineVariables - ] + tidyUp = + applyAll + [ collapseNestedBlocks + , collapseNestedIfs + , removeCodeAfterReturnStatements + , removeUndefinedApp + , unThunk + , etaConvert + , evaluateIifes + , inlineVariables + ] expander = buildExpander (concat jsDecls) untilFixedPoint :: (Monad m, Eq a) => (a -> m a) -> a -> m a untilFixedPoint f = go where - go a = do - a' <- f a - if a' == a then return a' else go a' - --- | --- Take all top-level ASTs and return a function for expanding top-level --- variables during the various inlining steps in `optimize`. --- --- Everything that gets inlined as an optimization is of a form that would --- have been lifted to a top-level binding during CSE, so for purposes of --- inlining we can save some time by only expanding variables bound at that --- level and not worrying about any inner scopes. --- + go a = do + a' <- f a + if a' == a then return a' else go a' + +{- | +Take all top-level ASTs and return a function for expanding top-level +variables during the various inlining steps in `optimize`. + +Everything that gets inlined as an optimization is of a form that would +have been lifted to a top-level binding during CSE, so for purposes of +inlining we can save some time by only expanding variables bound at that +level and not worrying about any inner scopes. +-} buildExpander :: [AST] -> AST -> AST buildExpander = replaceIdents . foldr go [] where - go = \case - VariableIntroduction _ name (Just (NoEffects, e)) -> ((name, e) :) - _ -> id + go = \case + VariableIntroduction _ name (Just (NoEffects, e)) -> ((name, e) :) + _ -> id diff --git a/src/Language/PureScript/CoreImp/Optimizer/Blocks.hs b/src/Language/PureScript/CoreImp/Optimizer/Blocks.hs index add5d7c95..0e9ddd240 100644 --- a/src/Language/PureScript/CoreImp/Optimizer/Blocks.hs +++ b/src/Language/PureScript/CoreImp/Optimizer/Blocks.hs @@ -1,28 +1,30 @@ -- | Optimizer steps for simplifying JavaScript blocks -module Language.PureScript.CoreImp.Optimizer.Blocks - ( collapseNestedBlocks - , collapseNestedIfs - ) where +module Language.PureScript.CoreImp.Optimizer.Blocks ( + collapseNestedBlocks, + collapseNestedIfs, +) where import Prelude -import Language.PureScript.CoreImp.AST (AST(..), BinaryOperator(..), everywhere) +import Language.PureScript.CoreImp.AST (AST (..), BinaryOperator (..), everywhere) -- | Collapse blocks which appear nested directly below another block collapseNestedBlocks :: AST -> AST -collapseNestedBlocks = everywhere collapse where - collapse :: AST -> AST - collapse (Block ss sts) = Block ss (concatMap go sts) - collapse js = js - - go :: AST -> [AST] - go (Block _ sts) = sts - go s = [s] +collapseNestedBlocks = everywhere collapse + where + collapse :: AST -> AST + collapse (Block ss sts) = Block ss (concatMap go sts) + collapse js = js + + go :: AST -> [AST] + go (Block _ sts) = sts + go s = [s] collapseNestedIfs :: AST -> AST -collapseNestedIfs = everywhere collapse where - collapse :: AST -> AST - collapse (IfElse _ (BooleanLiteral _ True) (Block _ [js]) _) = js - collapse (IfElse s1 cond1 (Block _ [IfElse s2 cond2 body Nothing]) Nothing) = +collapseNestedIfs = everywhere collapse + where + collapse :: AST -> AST + collapse (IfElse _ (BooleanLiteral _ True) (Block _ [js]) _) = js + collapse (IfElse s1 cond1 (Block _ [IfElse s2 cond2 body Nothing]) Nothing) = IfElse s1 (Binary s2 And cond1 cond2) body Nothing - collapse js = js + collapse js = js diff --git a/src/Language/PureScript/CoreImp/Optimizer/Common.hs b/src/Language/PureScript/CoreImp/Optimizer/Common.hs index ac63f6a2b..04f27de67 100644 --- a/src/Language/PureScript/CoreImp/Optimizer/Common.hs +++ b/src/Language/PureScript/CoreImp/Optimizer/Common.hs @@ -3,12 +3,12 @@ module Language.PureScript.CoreImp.Optimizer.Common where import Prelude -import Data.Text (Text) import Data.List (foldl') import Data.Maybe (fromMaybe) +import Data.Text (Text) +import Language.PureScript.CoreImp.AST (AST (..), everything, everywhere) import Language.PureScript.Crash (internalError) -import Language.PureScript.CoreImp.AST (AST(..), everything, everywhere) import Language.PureScript.Names (ModuleName) import Language.PureScript.PSString (PSString) @@ -18,31 +18,31 @@ applyAll = foldl' (.) id replaceIdent :: Text -> AST -> AST -> AST replaceIdent var1 js = everywhere replace where - replace (Var _ var2) | var1 == var2 = js - replace other = other + replace (Var _ var2) | var1 == var2 = js + replace other = other replaceIdents :: [(Text, AST)] -> AST -> AST replaceIdents vars = everywhere replace where - replace v@(Var _ var) = fromMaybe v $ lookup var vars - replace other = other + replace v@(Var _ var) = fromMaybe v $ lookup var vars + replace other = other isReassigned :: Text -> AST -> Bool isReassigned var1 = everything (||) check where - check :: AST -> Bool - check (Function _ _ args _) | var1 `elem` args = True - check (VariableIntroduction _ arg _) | var1 == arg = True - check (Assignment _ (Var _ arg) _) | var1 == arg = True - check (For _ arg _ _ _) | var1 == arg = True - check (ForIn _ arg _ _) | var1 == arg = True - check _ = False + check :: AST -> Bool + check (Function _ _ args _) | var1 `elem` args = True + check (VariableIntroduction _ arg _) | var1 == arg = True + check (Assignment _ (Var _ arg) _) | var1 == arg = True + check (For _ arg _ _ _) | var1 == arg = True + check (ForIn _ arg _ _) | var1 == arg = True + check _ = False isRebound :: AST -> AST -> Bool isRebound js d = any (\v -> isReassigned v d || isUpdated v d) (everything (++) variablesOf js) where - variablesOf (Var _ var) = [var] - variablesOf _ = [] + variablesOf (Var _ var) = [var] + variablesOf _ = [] targetVariable :: AST -> Text targetVariable (Var _ var) = var @@ -52,16 +52,17 @@ targetVariable _ = internalError "Invalid argument to targetVariable" isUpdated :: Text -> AST -> Bool isUpdated var1 = everything (||) check where - check :: AST -> Bool - check (Assignment _ target _) | var1 == targetVariable target = True - check _ = False + check :: AST -> Bool + check (Assignment _ target _) | var1 == targetVariable target = True + check _ = False removeFromBlock :: ([AST] -> [AST]) -> AST -> AST removeFromBlock go (Block ss sts) = Block ss (go sts) -removeFromBlock _ js = js +removeFromBlock _ js = js pattern Ref :: (ModuleName, PSString) -> AST pattern Ref pair <- (refPatternHelper -> Just pair) + -- ideally: pattern Ref (moduleName, refName) <- ModuleAccessor _ moduleName refName -- but: https://gitlab.haskell.org/ghc/ghc/-/issues/12203 -- https://github.com/ghc-proposals/ghc-proposals/pull/138 diff --git a/src/Language/PureScript/CoreImp/Optimizer/Inliner.hs b/src/Language/PureScript/CoreImp/Optimizer/Inliner.hs index e7314df97..e186f183b 100644 --- a/src/Language/PureScript/CoreImp/Optimizer/Inliner.hs +++ b/src/Language/PureScript/CoreImp/Optimizer/Inliner.hs @@ -1,16 +1,16 @@ -- | This module performs basic inlining of known functions -module Language.PureScript.CoreImp.Optimizer.Inliner - ( inlineVariables - , inlineCommonValues - , inlineCommonOperators - , inlineFnComposition - , inlineFnIdentity - , inlineUnsafeCoerce - , inlineUnsafePartial - , etaConvert - , unThunk - , evaluateIifes - ) where +module Language.PureScript.CoreImp.Optimizer.Inliner ( + inlineVariables, + inlineCommonValues, + inlineCommonOperators, + inlineFnComposition, + inlineFnIdentity, + inlineUnsafeCoerce, + inlineUnsafePartial, + etaConvert, + unThunk, + evaluateIifes, +) where import Prelude @@ -21,13 +21,13 @@ import Data.Maybe (fromMaybe) import Data.Text (Text) import Data.Text qualified as T -import Language.PureScript.Names (ModuleName) -import Language.PureScript.PSString (PSString, mkString) -import Language.PureScript.CoreImp.AST (AST(..), BinaryOperator(..), InitializerEffects(..), UnaryOperator(..), everywhere, everywhereTopDown, everywhereTopDownM, getSourceSpan) -import Language.PureScript.CoreImp.Optimizer.Common (pattern Ref, applyAll, isReassigned, isRebound, isUpdated, removeFromBlock, replaceIdent, replaceIdents) -import Language.PureScript.AST (SourceSpan(..)) +import Language.PureScript.AST (SourceSpan (..)) import Language.PureScript.Constants.Libs qualified as C import Language.PureScript.Constants.Prim qualified as C +import Language.PureScript.CoreImp.AST (AST (..), BinaryOperator (..), InitializerEffects (..), UnaryOperator (..), everywhere, everywhereTopDown, everywhereTopDownM, getSourceSpan) +import Language.PureScript.CoreImp.Optimizer.Common (applyAll, isReassigned, isRebound, isUpdated, removeFromBlock, replaceIdent, replaceIdents, pattern Ref) +import Language.PureScript.Names (ModuleName) +import Language.PureScript.PSString (PSString, mkString) -- TODO: Potential bug: -- Shouldn't just inline this case: { var x = 0; x.toFixed(10); } @@ -45,250 +45,256 @@ shouldInline _ = False etaConvert :: AST -> AST etaConvert = everywhere convert where - convert :: AST -> AST - convert (Block ss [Return _ (App _ (Function _ Nothing idents block@(Block _ body)) args)]) - | all shouldInline args && - not (any ((`isRebound` block) . Var Nothing) idents) && - not (any (`isRebound` block) args) - = Block ss (map (replaceIdents (zip idents args)) body) - convert (Function _ Nothing [] (Block _ [Return _ (App _ fn [])])) = fn - convert js = js + convert :: AST -> AST + convert (Block ss [Return _ (App _ (Function _ Nothing idents block@(Block _ body)) args)]) + | all shouldInline args + && not (any ((`isRebound` block) . Var Nothing) idents) + && not (any (`isRebound` block) args) = + Block ss (map (replaceIdents (zip idents args)) body) + convert (Function _ Nothing [] (Block _ [Return _ (App _ fn [])])) = fn + convert js = js unThunk :: AST -> AST unThunk = everywhere convert where - convert :: AST -> AST - convert (Block ss []) = Block ss [] - convert (Block ss jss) = - case last jss of - Return _ (App _ (Function _ Nothing [] (Block _ body)) []) -> Block ss $ init jss ++ body - _ -> Block ss jss - convert js = js + convert :: AST -> AST + convert (Block ss []) = Block ss [] + convert (Block ss jss) = + case last jss of + Return _ (App _ (Function _ Nothing [] (Block _ body)) []) -> Block ss $ init jss ++ body + _ -> Block ss jss + convert js = js evaluateIifes :: AST -> AST evaluateIifes = everywhere convert where - convert :: AST -> AST - convert (App _ (Function _ Nothing [] (Block _ [Return _ ret])) []) = ret - convert (App _ (Function _ Nothing idents (Block _ [Return ss ret])) []) - | not (any (`isReassigned` ret) idents) = replaceIdents (map (, Var ss C.S_undefined) idents) ret - convert js = js + convert :: AST -> AST + convert (App _ (Function _ Nothing [] (Block _ [Return _ ret])) []) = ret + convert (App _ (Function _ Nothing idents (Block _ [Return ss ret])) []) + | not (any (`isReassigned` ret) idents) = replaceIdents (map (,Var ss C.S_undefined) idents) ret + convert js = js inlineVariables :: AST -> AST inlineVariables = everywhere $ removeFromBlock go where - go :: [AST] -> [AST] - go [] = [] - go (VariableIntroduction _ var (Just (_, js)) : sts) - | shouldInline js && not (any (isReassigned var) sts) && not (any (isRebound js) sts) && not (any (isUpdated var) sts) = - go (map (replaceIdent var js) sts) - go (s:sts) = s : go sts + go :: [AST] -> [AST] + go [] = [] + go (VariableIntroduction _ var (Just (_, js)) : sts) + | shouldInline js && not (any (isReassigned var) sts) && not (any (isRebound js) sts) && not (any (isUpdated var) sts) = + go (map (replaceIdent var js) sts) + go (s : sts) = s : go sts inlineCommonValues :: (AST -> AST) -> AST -> AST inlineCommonValues expander = everywhere convert where - convert :: AST -> AST - convert (expander -> App ss (Ref fn) [Ref dict]) - | dict `elem` [C.P_semiringNumber, C.P_semiringInt], C.P_zero <- fn = NumericLiteral ss (Left 0) - | dict `elem` [C.P_semiringNumber, C.P_semiringInt], C.P_one <- fn = NumericLiteral ss (Left 1) - | C.P_boundedBoolean <- dict, C.P_bottom <- fn = BooleanLiteral ss False - | C.P_boundedBoolean <- dict, C.P_top <- fn = BooleanLiteral ss True - convert (App ss (expander -> App _ (Ref C.P_negate) [Ref C.P_ringInt]) [x]) - = Binary ss BitwiseOr (Unary ss Negate x) (NumericLiteral ss (Left 0)) - convert (App ss (App _ (expander -> App _ (Ref fn) [Ref dict]) [x]) [y]) - | C.P_semiringInt <- dict, C.P_add <- fn = intOp ss Add x y - | C.P_semiringInt <- dict, C.P_mul <- fn = intOp ss Multiply x y - | C.P_ringInt <- dict, C.P_sub <- fn = intOp ss Subtract x y - convert other = other - intOp ss op x y = Binary ss BitwiseOr (Binary ss op x y) (NumericLiteral ss (Left 0)) - -inlineCommonOperators :: (AST -> AST) -> AST -> AST -inlineCommonOperators expander = everywhereTopDown $ applyAll $ - [ binary C.P_semiringNumber C.P_add Add - , binary C.P_semiringNumber C.P_mul Multiply - - , binary C.P_ringNumber C.P_sub Subtract - , unary C.P_ringNumber C.P_negate Negate - - , binary C.P_euclideanRingNumber C.P_div Divide - - , binary C.P_eqNumber C.P_eq EqualTo - , binary C.P_eqNumber C.P_notEq NotEqualTo - , binary C.P_eqInt C.P_eq EqualTo - , binary C.P_eqInt C.P_notEq NotEqualTo - , binary C.P_eqString C.P_eq EqualTo - , binary C.P_eqString C.P_notEq NotEqualTo - , binary C.P_eqChar C.P_eq EqualTo - , binary C.P_eqChar C.P_notEq NotEqualTo - , binary C.P_eqBoolean C.P_eq EqualTo - , binary C.P_eqBoolean C.P_notEq NotEqualTo - - , binary C.P_ordBoolean C.P_lessThan LessThan - , binary C.P_ordBoolean C.P_lessThanOrEq LessThanOrEqualTo - , binary C.P_ordBoolean C.P_greaterThan GreaterThan - , binary C.P_ordBoolean C.P_greaterThanOrEq GreaterThanOrEqualTo - , binary C.P_ordChar C.P_lessThan LessThan - , binary C.P_ordChar C.P_lessThanOrEq LessThanOrEqualTo - , binary C.P_ordChar C.P_greaterThan GreaterThan - , binary C.P_ordChar C.P_greaterThanOrEq GreaterThanOrEqualTo - , binary C.P_ordInt C.P_lessThan LessThan - , binary C.P_ordInt C.P_lessThanOrEq LessThanOrEqualTo - , binary C.P_ordInt C.P_greaterThan GreaterThan - , binary C.P_ordInt C.P_greaterThanOrEq GreaterThanOrEqualTo - , binary C.P_ordNumber C.P_lessThan LessThan - , binary C.P_ordNumber C.P_lessThanOrEq LessThanOrEqualTo - , binary C.P_ordNumber C.P_greaterThan GreaterThan - , binary C.P_ordNumber C.P_greaterThanOrEq GreaterThanOrEqualTo - , binary C.P_ordString C.P_lessThan LessThan - , binary C.P_ordString C.P_lessThanOrEq LessThanOrEqualTo - , binary C.P_ordString C.P_greaterThan GreaterThan - , binary C.P_ordString C.P_greaterThanOrEq GreaterThanOrEqualTo - - , binary C.P_semigroupString C.P_append Add - - , binary C.P_heytingAlgebraBoolean C.P_conj And - , binary C.P_heytingAlgebraBoolean C.P_disj Or - , unary C.P_heytingAlgebraBoolean C.P_not Not - - , binary' C.P_or BitwiseOr - , binary' C.P_and BitwiseAnd - , binary' C.P_xor BitwiseXor - , binary' C.P_shl ShiftLeft - , binary' C.P_shr ShiftRight - , binary' C.P_zshr ZeroFillShiftRight - , unary' C.P_complement BitwiseNot - - , inlineNonClassFunction (isModFnWithDict C.P_unsafeIndex) $ flip (Indexer Nothing) - ] ++ - [ fn | i <- [0..10], fn <- [ mkFn i, runFn i ] ] ++ - [ fn | i <- [0..10], fn <- [ mkEffFn C.P_mkEffFn i, runEffFn C.P_runEffFn i ] ] ++ - [ fn | i <- [0..10], fn <- [ mkEffFn C.P_mkEffectFn i, runEffFn C.P_runEffectFn i ] ] ++ - [ fn | i <- [0..10], fn <- [ mkEffFn C.P_mkSTFn i, runEffFn C.P_runSTFn i ] ] - where - binary :: (ModuleName, PSString) -> (ModuleName, PSString) -> BinaryOperator -> AST -> AST - binary dict fn op = convert where - convert :: AST -> AST - convert (App ss (App _ (expander -> App _ (Ref fn') [Ref dict']) [x]) [y]) | dict == dict', fn == fn' = Binary ss op x y - convert other = other - binary' :: (ModuleName, PSString) -> BinaryOperator -> AST -> AST - binary' fn op = convert where convert :: AST -> AST - convert (App ss (App _ (Ref fn') [x]) [y]) | fn == fn' = Binary ss op x y + convert (expander -> App ss (Ref fn) [Ref dict]) + | dict `elem` [C.P_semiringNumber, C.P_semiringInt], C.P_zero <- fn = NumericLiteral ss (Left 0) + | dict `elem` [C.P_semiringNumber, C.P_semiringInt], C.P_one <- fn = NumericLiteral ss (Left 1) + | C.P_boundedBoolean <- dict, C.P_bottom <- fn = BooleanLiteral ss False + | C.P_boundedBoolean <- dict, C.P_top <- fn = BooleanLiteral ss True + convert (App ss (expander -> App _ (Ref C.P_negate) [Ref C.P_ringInt]) [x]) = + Binary ss BitwiseOr (Unary ss Negate x) (NumericLiteral ss (Left 0)) + convert (App ss (App _ (expander -> App _ (Ref fn) [Ref dict]) [x]) [y]) + | C.P_semiringInt <- dict, C.P_add <- fn = intOp ss Add x y + | C.P_semiringInt <- dict, C.P_mul <- fn = intOp ss Multiply x y + | C.P_ringInt <- dict, C.P_sub <- fn = intOp ss Subtract x y convert other = other - unary :: (ModuleName, PSString) -> (ModuleName, PSString) -> UnaryOperator -> AST -> AST - unary dict fn op = convert where - convert :: AST -> AST - convert (App ss (expander -> App _ (Ref fn') [Ref dict']) [x]) | dict == dict', fn == fn' = Unary ss op x - convert other = other - unary' :: (ModuleName, PSString) -> UnaryOperator -> AST -> AST - unary' fn op = convert where - convert :: AST -> AST - convert (App ss (Ref fn') [x]) | fn == fn' = Unary ss op x - convert other = other - - mkFn :: Int -> AST -> AST - mkFn = mkFn' C.P_mkFn $ \ss1 ss2 ss3 args js -> - Function ss1 Nothing args (Block ss2 [Return ss3 js]) - - mkEffFn :: (ModuleName, PSString) -> Int -> AST -> AST - mkEffFn mkFn_ = mkFn' mkFn_ $ \ss1 ss2 ss3 args js -> - Function ss1 Nothing args (Block ss2 [Return ss3 (App ss3 js [])]) + intOp ss op x y = Binary ss BitwiseOr (Binary ss op x y) (NumericLiteral ss (Left 0)) - mkFn' :: (ModuleName, PSString) -> (Maybe SourceSpan -> Maybe SourceSpan -> Maybe SourceSpan -> [Text] -> AST -> AST) -> Int -> AST -> AST - mkFn' mkFn_ res 0 = convert where - convert :: AST -> AST - convert (App _ (Ref mkFnN) [Function s1 Nothing [_] (Block s2 [Return s3 js])]) | isNFn mkFn_ 0 mkFnN = - res s1 s2 s3 [] js - convert other = other - mkFn' mkFn_ res n = convert where - convert :: AST -> AST - convert orig@(App ss (Ref mkFnN) [fn]) | isNFn mkFn_ n mkFnN = - case collectArgs n [] fn of - Just (args, [Return ss' ret]) -> res ss ss ss' args ret - _ -> orig - convert other = other - collectArgs :: Int -> [Text] -> AST -> Maybe ([Text], [AST]) - collectArgs 1 acc (Function _ Nothing [oneArg] (Block _ js)) | length acc == n - 1 = Just (reverse (oneArg : acc), js) - collectArgs m acc (Function _ Nothing [oneArg] (Block _ [Return _ ret])) = collectArgs (m - 1) (oneArg : acc) ret - collectArgs _ _ _ = Nothing - - isNFn :: (ModuleName, PSString) -> Int -> (ModuleName, PSString) -> Bool - isNFn prefix n fn = fmap (<> mkString (T.pack $ show n)) prefix == fn - - runFn :: Int -> AST -> AST - runFn = runFn' C.P_runFn App - - runEffFn :: (ModuleName, PSString) -> Int -> AST -> AST - runEffFn runFn_ = runFn' runFn_ $ \ss fn acc -> - Function ss Nothing [] (Block ss [Return ss (App ss fn acc)]) - - runFn' :: (ModuleName, PSString) -> (Maybe SourceSpan -> AST -> [AST] -> AST) -> Int -> AST -> AST - runFn' runFn_ res n = convert where - convert :: AST -> AST - convert js = fromMaybe js $ go n [] js - - go :: Int -> [AST] -> AST -> Maybe AST - go 0 acc (App ss (Ref runFnN) [fn]) | isNFn runFn_ n runFnN && length acc == n = - Just $ res ss fn acc - go m acc (App _ lhs [arg]) = go (m - 1) (arg : acc) lhs - go _ _ _ = Nothing - - inlineNonClassFunction :: (AST -> Bool) -> (AST -> AST -> AST) -> AST -> AST - inlineNonClassFunction p f = convert where - convert :: AST -> AST - convert (App _ (App _ op' [x]) [y]) | p op' = f x y - convert other = other - - isModFnWithDict :: (ModuleName, PSString) -> AST -> Bool - isModFnWithDict fn (App _ (Ref fn') [Var _ _]) = fn == fn' - isModFnWithDict _ _ = False +inlineCommonOperators :: (AST -> AST) -> AST -> AST +inlineCommonOperators expander = + everywhereTopDown $ + applyAll $ + [ binary C.P_semiringNumber C.P_add Add + , binary C.P_semiringNumber C.P_mul Multiply + , binary C.P_ringNumber C.P_sub Subtract + , unary C.P_ringNumber C.P_negate Negate + , binary C.P_euclideanRingNumber C.P_div Divide + , binary C.P_eqNumber C.P_eq EqualTo + , binary C.P_eqNumber C.P_notEq NotEqualTo + , binary C.P_eqInt C.P_eq EqualTo + , binary C.P_eqInt C.P_notEq NotEqualTo + , binary C.P_eqString C.P_eq EqualTo + , binary C.P_eqString C.P_notEq NotEqualTo + , binary C.P_eqChar C.P_eq EqualTo + , binary C.P_eqChar C.P_notEq NotEqualTo + , binary C.P_eqBoolean C.P_eq EqualTo + , binary C.P_eqBoolean C.P_notEq NotEqualTo + , binary C.P_ordBoolean C.P_lessThan LessThan + , binary C.P_ordBoolean C.P_lessThanOrEq LessThanOrEqualTo + , binary C.P_ordBoolean C.P_greaterThan GreaterThan + , binary C.P_ordBoolean C.P_greaterThanOrEq GreaterThanOrEqualTo + , binary C.P_ordChar C.P_lessThan LessThan + , binary C.P_ordChar C.P_lessThanOrEq LessThanOrEqualTo + , binary C.P_ordChar C.P_greaterThan GreaterThan + , binary C.P_ordChar C.P_greaterThanOrEq GreaterThanOrEqualTo + , binary C.P_ordInt C.P_lessThan LessThan + , binary C.P_ordInt C.P_lessThanOrEq LessThanOrEqualTo + , binary C.P_ordInt C.P_greaterThan GreaterThan + , binary C.P_ordInt C.P_greaterThanOrEq GreaterThanOrEqualTo + , binary C.P_ordNumber C.P_lessThan LessThan + , binary C.P_ordNumber C.P_lessThanOrEq LessThanOrEqualTo + , binary C.P_ordNumber C.P_greaterThan GreaterThan + , binary C.P_ordNumber C.P_greaterThanOrEq GreaterThanOrEqualTo + , binary C.P_ordString C.P_lessThan LessThan + , binary C.P_ordString C.P_lessThanOrEq LessThanOrEqualTo + , binary C.P_ordString C.P_greaterThan GreaterThan + , binary C.P_ordString C.P_greaterThanOrEq GreaterThanOrEqualTo + , binary C.P_semigroupString C.P_append Add + , binary C.P_heytingAlgebraBoolean C.P_conj And + , binary C.P_heytingAlgebraBoolean C.P_disj Or + , unary C.P_heytingAlgebraBoolean C.P_not Not + , binary' C.P_or BitwiseOr + , binary' C.P_and BitwiseAnd + , binary' C.P_xor BitwiseXor + , binary' C.P_shl ShiftLeft + , binary' C.P_shr ShiftRight + , binary' C.P_zshr ZeroFillShiftRight + , unary' C.P_complement BitwiseNot + , inlineNonClassFunction (isModFnWithDict C.P_unsafeIndex) $ flip (Indexer Nothing) + ] + ++ [fn | i <- [0 .. 10], fn <- [mkFn i, runFn i]] + ++ [fn | i <- [0 .. 10], fn <- [mkEffFn C.P_mkEffFn i, runEffFn C.P_runEffFn i]] + ++ [fn | i <- [0 .. 10], fn <- [mkEffFn C.P_mkEffectFn i, runEffFn C.P_runEffectFn i]] + ++ [fn | i <- [0 .. 10], fn <- [mkEffFn C.P_mkSTFn i, runEffFn C.P_runSTFn i]] + where + binary :: (ModuleName, PSString) -> (ModuleName, PSString) -> BinaryOperator -> AST -> AST + binary dict fn op = convert + where + convert :: AST -> AST + convert (App ss (App _ (expander -> App _ (Ref fn') [Ref dict']) [x]) [y]) | dict == dict', fn == fn' = Binary ss op x y + convert other = other + binary' :: (ModuleName, PSString) -> BinaryOperator -> AST -> AST + binary' fn op = convert + where + convert :: AST -> AST + convert (App ss (App _ (Ref fn') [x]) [y]) | fn == fn' = Binary ss op x y + convert other = other + unary :: (ModuleName, PSString) -> (ModuleName, PSString) -> UnaryOperator -> AST -> AST + unary dict fn op = convert + where + convert :: AST -> AST + convert (App ss (expander -> App _ (Ref fn') [Ref dict']) [x]) | dict == dict', fn == fn' = Unary ss op x + convert other = other + unary' :: (ModuleName, PSString) -> UnaryOperator -> AST -> AST + unary' fn op = convert + where + convert :: AST -> AST + convert (App ss (Ref fn') [x]) | fn == fn' = Unary ss op x + convert other = other + + mkFn :: Int -> AST -> AST + mkFn = mkFn' C.P_mkFn $ \ss1 ss2 ss3 args js -> + Function ss1 Nothing args (Block ss2 [Return ss3 js]) + + mkEffFn :: (ModuleName, PSString) -> Int -> AST -> AST + mkEffFn mkFn_ = mkFn' mkFn_ $ \ss1 ss2 ss3 args js -> + Function ss1 Nothing args (Block ss2 [Return ss3 (App ss3 js [])]) + + mkFn' :: (ModuleName, PSString) -> (Maybe SourceSpan -> Maybe SourceSpan -> Maybe SourceSpan -> [Text] -> AST -> AST) -> Int -> AST -> AST + mkFn' mkFn_ res 0 = convert + where + convert :: AST -> AST + convert (App _ (Ref mkFnN) [Function s1 Nothing [_] (Block s2 [Return s3 js])]) + | isNFn mkFn_ 0 mkFnN = + res s1 s2 s3 [] js + convert other = other + mkFn' mkFn_ res n = convert + where + convert :: AST -> AST + convert orig@(App ss (Ref mkFnN) [fn]) | isNFn mkFn_ n mkFnN = + case collectArgs n [] fn of + Just (args, [Return ss' ret]) -> res ss ss ss' args ret + _ -> orig + convert other = other + collectArgs :: Int -> [Text] -> AST -> Maybe ([Text], [AST]) + collectArgs 1 acc (Function _ Nothing [oneArg] (Block _ js)) | length acc == n - 1 = Just (reverse (oneArg : acc), js) + collectArgs m acc (Function _ Nothing [oneArg] (Block _ [Return _ ret])) = collectArgs (m - 1) (oneArg : acc) ret + collectArgs _ _ _ = Nothing + + isNFn :: (ModuleName, PSString) -> Int -> (ModuleName, PSString) -> Bool + isNFn prefix n fn = fmap (<> mkString (T.pack $ show n)) prefix == fn + + runFn :: Int -> AST -> AST + runFn = runFn' C.P_runFn App + + runEffFn :: (ModuleName, PSString) -> Int -> AST -> AST + runEffFn runFn_ = runFn' runFn_ $ \ss fn acc -> + Function ss Nothing [] (Block ss [Return ss (App ss fn acc)]) + + runFn' :: (ModuleName, PSString) -> (Maybe SourceSpan -> AST -> [AST] -> AST) -> Int -> AST -> AST + runFn' runFn_ res n = convert + where + convert :: AST -> AST + convert js = fromMaybe js $ go n [] js + + go :: Int -> [AST] -> AST -> Maybe AST + go 0 acc (App ss (Ref runFnN) [fn]) + | isNFn runFn_ n runFnN && length acc == n = + Just $ res ss fn acc + go m acc (App _ lhs [arg]) = go (m - 1) (arg : acc) lhs + go _ _ _ = Nothing + + inlineNonClassFunction :: (AST -> Bool) -> (AST -> AST -> AST) -> AST -> AST + inlineNonClassFunction p f = convert + where + convert :: AST -> AST + convert (App _ (App _ op' [x]) [y]) | p op' = f x y + convert other = other + + isModFnWithDict :: (ModuleName, PSString) -> AST -> Bool + isModFnWithDict fn (App _ (Ref fn') [Var _ _]) = fn == fn' + isModFnWithDict _ _ = False -- (f <<< g $ x) = f (g x) -- (f <<< g) = \x -> f (g x) -inlineFnComposition :: forall m. MonadSupply m => (AST -> AST) -> AST -> m AST +inlineFnComposition :: forall m. (MonadSupply m) => (AST -> AST) -> AST -> m AST inlineFnComposition expander = everywhereTopDownM convert where - convert :: AST -> m AST - convert (App s1 (App s2 (App _ (expander -> App _ (Ref fn) [Ref C.P_semigroupoidFn]) [x]) [y]) [z]) - | C.P_compose <- fn = return $ App s1 x [App s2 y [z]] - | C.P_composeFlipped <- fn = return $ App s2 y [App s1 x [z]] - convert app@(App ss (App _ (expander -> App _ (Ref fn) [Ref C.P_semigroupoidFn]) _) _) - | fn `elem` [C.P_compose, C.P_composeFlipped] = mkApps ss <$> goApps app <*> freshName - convert other = return other - - mkApps :: Maybe SourceSpan -> [Either AST (Text, AST)] -> Text -> AST - mkApps ss fns a = App ss (Function ss Nothing [] (Block ss $ vars <> [Return Nothing comp])) [] - where - vars = uncurry (VariableIntroduction ss) . fmap (Just . (UnknownEffects, )) <$> rights fns - comp = Function ss Nothing [a] (Block ss [Return Nothing apps]) - apps = foldr (\fn acc -> App ss (mkApp fn) [acc]) (Var ss a) fns - - mkApp :: Either AST (Text, AST) -> AST - mkApp = either id $ \(name, arg) -> Var (getSourceSpan arg) name - - goApps :: AST -> m [Either AST (Text, AST)] - goApps (App _ (App _ (expander -> App _ (Ref fn) [Ref C.P_semigroupoidFn]) [x]) [y]) - | C.P_compose <- fn = mappend <$> goApps x <*> goApps y - | C.P_composeFlipped <- fn = mappend <$> goApps y <*> goApps x - goApps app@App {} = pure . Right . (,app) <$> freshName - goApps other = pure [Left other] + convert :: AST -> m AST + convert (App s1 (App s2 (App _ (expander -> App _ (Ref fn) [Ref C.P_semigroupoidFn]) [x]) [y]) [z]) + | C.P_compose <- fn = return $ App s1 x [App s2 y [z]] + | C.P_composeFlipped <- fn = return $ App s2 y [App s1 x [z]] + convert app@(App ss (App _ (expander -> App _ (Ref fn) [Ref C.P_semigroupoidFn]) _) _) + | fn `elem` [C.P_compose, C.P_composeFlipped] = mkApps ss <$> goApps app <*> freshName + convert other = return other + + mkApps :: Maybe SourceSpan -> [Either AST (Text, AST)] -> Text -> AST + mkApps ss fns a = App ss (Function ss Nothing [] (Block ss $ vars <> [Return Nothing comp])) [] + where + vars = uncurry (VariableIntroduction ss) . fmap (Just . (UnknownEffects,)) <$> rights fns + comp = Function ss Nothing [a] (Block ss [Return Nothing apps]) + apps = foldr (\fn acc -> App ss (mkApp fn) [acc]) (Var ss a) fns + + mkApp :: Either AST (Text, AST) -> AST + mkApp = either id $ \(name, arg) -> Var (getSourceSpan arg) name + + goApps :: AST -> m [Either AST (Text, AST)] + goApps (App _ (App _ (expander -> App _ (Ref fn) [Ref C.P_semigroupoidFn]) [x]) [y]) + | C.P_compose <- fn = mappend <$> goApps x <*> goApps y + | C.P_composeFlipped <- fn = mappend <$> goApps y <*> goApps x + goApps app@App {} = pure . Right . (,app) <$> freshName + goApps other = pure [Left other] inlineFnIdentity :: (AST -> AST) -> AST -> AST inlineFnIdentity expander = everywhereTopDown convert where - convert :: AST -> AST - convert (App _ (expander -> App _ (Ref C.P_identity) [Ref C.P_categoryFn]) [x]) = x - convert other = other + convert :: AST -> AST + convert (App _ (expander -> App _ (Ref C.P_identity) [Ref C.P_categoryFn]) [x]) = x + convert other = other inlineUnsafeCoerce :: AST -> AST -inlineUnsafeCoerce = everywhereTopDown convert where - convert (App _ (Ref C.P_unsafeCoerce) [ comp ]) = comp - convert other = other +inlineUnsafeCoerce = everywhereTopDown convert + where + convert (App _ (Ref C.P_unsafeCoerce) [comp]) = comp + convert other = other inlineUnsafePartial :: AST -> AST -inlineUnsafePartial = everywhereTopDown convert where - convert (App ss (Ref C.P_unsafePartial) [ comp ]) - -- Apply to undefined here, the application should be optimized away - -- if it is safe to do so - = App ss comp [ Var ss C.S_undefined ] - convert other = other +inlineUnsafePartial = everywhereTopDown convert + where + convert (App ss (Ref C.P_unsafePartial) [comp]) = + -- Apply to undefined here, the application should be optimized away + -- if it is safe to do so + App ss comp [Var ss C.S_undefined] + convert other = other diff --git a/src/Language/PureScript/CoreImp/Optimizer/MagicDo.hs b/src/Language/PureScript/CoreImp/Optimizer/MagicDo.hs index b59167579..23342e1f9 100644 --- a/src/Language/PureScript/CoreImp/Optimizer/MagicDo.hs +++ b/src/Language/PureScript/CoreImp/Optimizer/MagicDo.hs @@ -1,32 +1,34 @@ --- | This module implements the "Magic Do" optimization, which inlines calls to return --- and bind for the Eff monad, as well as some of its actions. +{- | This module implements the "Magic Do" optimization, which inlines calls to return +and bind for the Eff monad, as well as some of its actions. +-} module Language.PureScript.CoreImp.Optimizer.MagicDo (magicDoEffect, magicDoEff, magicDoST, inlineST) where -import Prelude import Protolude (ordNub) +import Prelude import Data.Maybe (fromJust, isJust) -import Language.PureScript.CoreImp.AST (AST(..), InitializerEffects(..), UnaryOperator(..), everything, everywhere, everywhereTopDown) +import Language.PureScript.Constants.Libs qualified as C +import Language.PureScript.CoreImp.AST (AST (..), InitializerEffects (..), UnaryOperator (..), everything, everywhere, everywhereTopDown) import Language.PureScript.CoreImp.Optimizer.Common (pattern Ref) import Language.PureScript.Names (ModuleName) import Language.PureScript.PSString (mkString) -import Language.PureScript.Constants.Libs qualified as C --- | Inline type class dictionaries for >>= and return for the Eff monad --- --- E.g. --- --- Prelude[">>="](dict)(m1)(function(x) { --- return ...; --- }) --- --- becomes --- --- function __do { --- var x = m1(); --- ... --- } +{- | Inline type class dictionaries for >>= and return for the Eff monad + +E.g. + + Prelude[">>="](dict)(m1)(function(x) { + return ...; + }) + +becomes + + function __do { + var x = m1(); + ... + } +-} magicDoEff :: (AST -> AST) -> AST -> AST magicDoEff = magicDo C.M_Control_Monad_Eff C.effDictionaries @@ -37,100 +39,104 @@ magicDoST :: (AST -> AST) -> AST -> AST magicDoST = magicDo C.M_Control_Monad_ST_Internal C.stDictionaries magicDo :: ModuleName -> C.EffectDictionaries -> (AST -> AST) -> AST -> AST -magicDo effectModule C.EffectDictionaries{..} expander = everywhereTopDown convert +magicDo effectModule C.EffectDictionaries {..} expander = everywhereTopDown convert where - -- The name of the function block which is added to denote a do block - fnName = "__do" - -- Desugar monomorphic calls to >>= and return for the Eff monad - convert :: AST -> AST - -- Desugar pure - convert (App _ (App _ pure' [val]) []) | isPure pure' = val - -- Desugar discard - convert (App _ (App _ bind [m]) [Function s1 Nothing [] (Block s2 js)]) | isDiscard bind = - Function s1 (Just fnName) [] $ Block s2 (App s2 m [] : map applyReturns js ) - -- Desugar bind to wildcard - convert (App _ (App _ bind [m]) [Function s1 Nothing [] (Block s2 js)]) - | isBind bind = - Function s1 (Just fnName) [] $ Block s2 (App s2 m [] : map applyReturns js ) - -- Desugar bind - convert (App _ (App _ bind [m]) [Function s1 Nothing [arg] (Block s2 js)]) | isBind bind = - Function s1 (Just fnName) [] $ Block s2 (VariableIntroduction s2 arg (Just (UnknownEffects, App s2 m [])) : map applyReturns js) - -- Desugar untilE - convert (App s1 (App _ f [arg]) []) | isEffFunc edUntil f = - App s1 (Function s1 Nothing [] (Block s1 [ While s1 (Unary s1 Not (App s1 arg [])) (Block s1 []), Return s1 $ ObjectLiteral s1 []])) [] - -- Desugar whileE - convert (App _ (App _ (App s1 f [arg1]) [arg2]) []) | isEffFunc edWhile f = - App s1 (Function s1 Nothing [] (Block s1 [ While s1 (App s1 arg1 []) (Block s1 [ App s1 arg2 [] ]), Return s1 $ ObjectLiteral s1 []])) [] - -- Inline __do returns - convert (Return _ (App _ (Function _ (Just ident) [] body) [])) | ident == fnName = body - -- Inline double applications - convert (App _ (App s1 (Function s2 Nothing [] (Block ss body)) []) []) = - App s1 (Function s2 Nothing [] (Block ss (applyReturns `fmap` body))) [] - convert other = other - -- Check if an expression represents a monomorphic call to >>= for the Eff monad - isBind (expander -> App _ (Ref C.P_bind) [Ref dict]) = (effectModule, edBindDict) == dict - isBind _ = False - -- Check if an expression represents a call to @discard@ - isDiscard (expander -> App _ (expander -> App _ (Ref C.P_discard) [Ref C.P_discardUnit]) [Ref dict]) = (effectModule, edBindDict) == dict - isDiscard _ = False - -- Check if an expression represents a monomorphic call to pure or return for the Eff applicative - isPure (expander -> App _ (Ref C.P_pure) [Ref dict]) = (effectModule, edApplicativeDict) == dict - isPure _ = False - -- Check if an expression represents a function in the Effect module - isEffFunc name (Ref fn) = (effectModule, name) == fn - isEffFunc _ _ = False + -- The name of the function block which is added to denote a do block + fnName = "__do" + -- Desugar monomorphic calls to >>= and return for the Eff monad + convert :: AST -> AST + -- Desugar pure + convert (App _ (App _ pure' [val]) []) | isPure pure' = val + -- Desugar discard + convert (App _ (App _ bind [m]) [Function s1 Nothing [] (Block s2 js)]) + | isDiscard bind = + Function s1 (Just fnName) [] $ Block s2 (App s2 m [] : map applyReturns js) + -- Desugar bind to wildcard + convert (App _ (App _ bind [m]) [Function s1 Nothing [] (Block s2 js)]) + | isBind bind = + Function s1 (Just fnName) [] $ Block s2 (App s2 m [] : map applyReturns js) + -- Desugar bind + convert (App _ (App _ bind [m]) [Function s1 Nothing [arg] (Block s2 js)]) + | isBind bind = + Function s1 (Just fnName) [] $ Block s2 (VariableIntroduction s2 arg (Just (UnknownEffects, App s2 m [])) : map applyReturns js) + -- Desugar untilE + convert (App s1 (App _ f [arg]) []) + | isEffFunc edUntil f = + App s1 (Function s1 Nothing [] (Block s1 [While s1 (Unary s1 Not (App s1 arg [])) (Block s1 []), Return s1 $ ObjectLiteral s1 []])) [] + -- Desugar whileE + convert (App _ (App _ (App s1 f [arg1]) [arg2]) []) + | isEffFunc edWhile f = + App s1 (Function s1 Nothing [] (Block s1 [While s1 (App s1 arg1 []) (Block s1 [App s1 arg2 []]), Return s1 $ ObjectLiteral s1 []])) [] + -- Inline __do returns + convert (Return _ (App _ (Function _ (Just ident) [] body) [])) | ident == fnName = body + -- Inline double applications + convert (App _ (App s1 (Function s2 Nothing [] (Block ss body)) []) []) = + App s1 (Function s2 Nothing [] (Block ss (applyReturns `fmap` body))) [] + convert other = other + -- Check if an expression represents a monomorphic call to >>= for the Eff monad + isBind (expander -> App _ (Ref C.P_bind) [Ref dict]) = (effectModule, edBindDict) == dict + isBind _ = False + -- Check if an expression represents a call to @discard@ + isDiscard (expander -> App _ (expander -> App _ (Ref C.P_discard) [Ref C.P_discardUnit]) [Ref dict]) = (effectModule, edBindDict) == dict + isDiscard _ = False + -- Check if an expression represents a monomorphic call to pure or return for the Eff applicative + isPure (expander -> App _ (Ref C.P_pure) [Ref dict]) = (effectModule, edApplicativeDict) == dict + isPure _ = False + -- Check if an expression represents a function in the Effect module + isEffFunc name (Ref fn) = (effectModule, name) == fn + isEffFunc _ _ = False - applyReturns :: AST -> AST - applyReturns (Return ss ret) = Return ss (App ss ret []) - applyReturns (Block ss jss) = Block ss (map applyReturns jss) - applyReturns (While ss cond js) = While ss cond (applyReturns js) - applyReturns (For ss v lo hi js) = For ss v lo hi (applyReturns js) - applyReturns (ForIn ss v xs js) = ForIn ss v xs (applyReturns js) - applyReturns (IfElse ss cond t f) = IfElse ss cond (applyReturns t) (applyReturns `fmap` f) - applyReturns other = other + applyReturns :: AST -> AST + applyReturns (Return ss ret) = Return ss (App ss ret []) + applyReturns (Block ss jss) = Block ss (map applyReturns jss) + applyReturns (While ss cond js) = While ss cond (applyReturns js) + applyReturns (For ss v lo hi js) = For ss v lo hi (applyReturns js) + applyReturns (ForIn ss v xs js) = ForIn ss v xs (applyReturns js) + applyReturns (IfElse ss cond t f) = IfElse ss cond (applyReturns t) (applyReturns `fmap` f) + applyReturns other = other -- | Inline functions in the ST module inlineST :: AST -> AST inlineST = everywhere convertBlock where - -- Look for run blocks and inline the STRefs there. - -- If all STRefs are used in the scope of the same run, only using { read, write, modify } then - -- we can be more aggressive about inlining, and actually turn STRefs into local variables. - convertBlock (App s1 (Ref C.P_run) [arg]) = - let refs = ordNub . findSTRefsIn $ arg - usages = findAllSTUsagesIn arg - allUsagesAreLocalVars = all (\u -> let v = toVar u in isJust v && fromJust v `elem` refs) usages - localVarsDoNotEscape = all (\r -> length (r `appearingIn` arg) == length (filter (\u -> let v = toVar u in v == Just r) usages)) refs - in App s1 (everywhere (convert (allUsagesAreLocalVars && localVarsDoNotEscape)) arg) [] - convertBlock other = other - -- Convert a block in a safe way, preserving object wrappers of references, - -- or in a more aggressive way, turning wrappers into local variables depending on the - -- agg(ressive) parameter. - convert agg (App s1 (Ref C.P_new) [arg]) = - Function s1 Nothing [] (Block s1 [Return s1 $ if agg then arg else ObjectLiteral s1 [(mkString C.stRefValue, arg)]]) - convert agg (App _ (App s1 (Ref C.P_read) [ref]) []) = - if agg then ref else Indexer s1 (StringLiteral s1 C.stRefValue) ref - convert agg (App _ (App _ (App s1 (Ref C.P_write) [arg]) [ref]) []) = - if agg then Assignment s1 ref arg else Assignment s1 (Indexer s1 (StringLiteral s1 C.stRefValue) ref) arg - convert agg (App _ (App _ (App s1 (Ref C.P_modify) [func]) [ref]) []) = - if agg then Assignment s1 ref (App s1 func [ref]) else Assignment s1 (Indexer s1 (StringLiteral s1 C.stRefValue) ref) (App s1 func [Indexer s1 (StringLiteral s1 C.stRefValue) ref]) - convert _ other = other - -- Find all ST Refs initialized in this block - findSTRefsIn = everything (++) isSTRef - where - isSTRef (VariableIntroduction _ ident (Just (_, App _ (App _ (Ref C.P_new) [_]) []))) = [ident] - isSTRef _ = [] - -- Find all STRefs used as arguments to read, write, modify - findAllSTUsagesIn = everything (++) isSTUsage - where - isSTUsage (App _ (App _ (Ref C.P_read) [ref]) []) = [ref] - isSTUsage (App _ (App _ (App _ (Ref f) [_]) [ref]) []) | f `elem` [C.P_write, C.P_modify] = [ref] - isSTUsage _ = [] - -- Find all uses of a variable - appearingIn ref = everything (++) isVar - where - isVar e@(Var _ v) | v == ref = [e] - isVar _ = [] - -- Convert a AST value to a String if it is a Var - toVar (Var _ v) = Just v - toVar _ = Nothing + -- Look for run blocks and inline the STRefs there. + -- If all STRefs are used in the scope of the same run, only using { read, write, modify } then + -- we can be more aggressive about inlining, and actually turn STRefs into local variables. + convertBlock (App s1 (Ref C.P_run) [arg]) = + let refs = ordNub . findSTRefsIn $ arg + usages = findAllSTUsagesIn arg + allUsagesAreLocalVars = all (\u -> let v = toVar u in isJust v && fromJust v `elem` refs) usages + localVarsDoNotEscape = all (\r -> length (r `appearingIn` arg) == length (filter (\u -> let v = toVar u in v == Just r) usages)) refs + in App s1 (everywhere (convert (allUsagesAreLocalVars && localVarsDoNotEscape)) arg) [] + convertBlock other = other + -- Convert a block in a safe way, preserving object wrappers of references, + -- or in a more aggressive way, turning wrappers into local variables depending on the + -- agg(ressive) parameter. + convert agg (App s1 (Ref C.P_new) [arg]) = + Function s1 Nothing [] (Block s1 [Return s1 $ if agg then arg else ObjectLiteral s1 [(mkString C.stRefValue, arg)]]) + convert agg (App _ (App s1 (Ref C.P_read) [ref]) []) = + if agg then ref else Indexer s1 (StringLiteral s1 C.stRefValue) ref + convert agg (App _ (App _ (App s1 (Ref C.P_write) [arg]) [ref]) []) = + if agg then Assignment s1 ref arg else Assignment s1 (Indexer s1 (StringLiteral s1 C.stRefValue) ref) arg + convert agg (App _ (App _ (App s1 (Ref C.P_modify) [func]) [ref]) []) = + if agg then Assignment s1 ref (App s1 func [ref]) else Assignment s1 (Indexer s1 (StringLiteral s1 C.stRefValue) ref) (App s1 func [Indexer s1 (StringLiteral s1 C.stRefValue) ref]) + convert _ other = other + -- Find all ST Refs initialized in this block + findSTRefsIn = everything (++) isSTRef + where + isSTRef (VariableIntroduction _ ident (Just (_, App _ (App _ (Ref C.P_new) [_]) []))) = [ident] + isSTRef _ = [] + -- Find all STRefs used as arguments to read, write, modify + findAllSTUsagesIn = everything (++) isSTUsage + where + isSTUsage (App _ (App _ (Ref C.P_read) [ref]) []) = [ref] + isSTUsage (App _ (App _ (App _ (Ref f) [_]) [ref]) []) | f `elem` [C.P_write, C.P_modify] = [ref] + isSTUsage _ = [] + -- Find all uses of a variable + appearingIn ref = everything (++) isVar + where + isVar e@(Var _ v) | v == ref = [e] + isVar _ = [] + -- Convert a AST value to a String if it is a Var + toVar (Var _ v) = Just v + toVar _ = Nothing diff --git a/src/Language/PureScript/CoreImp/Optimizer/TCO.hs b/src/Language/PureScript/CoreImp/Optimizer/TCO.hs index 34746ae3d..0fa204bcd 100644 --- a/src/Language/PureScript/CoreImp/Optimizer/TCO.hs +++ b/src/Language/PureScript/CoreImp/Optimizer/TCO.hs @@ -9,183 +9,201 @@ import Control.Monad.State (State, evalState, get, modify) import Data.Functor (($>), (<&>)) import Data.Set qualified as S import Data.Text (Text, pack) -import Language.PureScript.CoreImp.AST (AST(..), InitializerEffects(..), UnaryOperator(..), everything, everywhereTopDownM) import Language.PureScript.AST.SourcePos (SourceSpan) +import Language.PureScript.CoreImp.AST (AST (..), InitializerEffects (..), UnaryOperator (..), everything, everywhereTopDownM) import Safe (headDef, tailSafe) -- | Eliminate tail calls tco :: AST -> AST -tco = flip evalState 0 . everywhereTopDownM convert where - tcoVar :: Text -> Text - tcoVar arg = "$tco_var_" <> arg - - copyVar :: Text -> Text - copyVar arg = "$copy_" <> arg - - tcoDoneM :: State Int Text - tcoDoneM = get <&> \count -> "$tco_done" <> - if count == 0 then "" else pack . show $ count - - tcoLoop :: Text - tcoLoop = "$tco_loop" - - tcoResult :: Text - tcoResult = "$tco_result" - - convert :: AST -> State Int AST - convert (VariableIntroduction ss name (Just (p, fn@Function {}))) - | Just trFns <- findTailRecursiveFns name arity body' - = VariableIntroduction ss name . Just . (p,) . replace <$> toLoop trFns name arity outerArgs innerArgs body' - where - innerArgs = headDef [] argss - outerArgs = concat . reverse $ tailSafe argss - arity = length argss +tco = flip evalState 0 . everywhereTopDownM convert + where + tcoVar :: Text -> Text + tcoVar arg = "$tco_var_" <> arg + + copyVar :: Text -> Text + copyVar arg = "$copy_" <> arg + + tcoDoneM :: State Int Text + tcoDoneM = + get <&> \count -> + "$tco_done" + <> if count == 0 then "" else pack . show $ count + + tcoLoop :: Text + tcoLoop = "$tco_loop" + + tcoResult :: Text + tcoResult = "$tco_result" + + convert :: AST -> State Int AST + convert (VariableIntroduction ss name (Just (p, fn@Function {}))) + | Just trFns <- findTailRecursiveFns name arity body' = + VariableIntroduction ss name . Just . (p,) . replace <$> toLoop trFns name arity outerArgs innerArgs body' + where + innerArgs = headDef [] argss + outerArgs = concat . reverse $ tailSafe argss + arity = length argss -- this is the number of calls, not the number of arguments, if there's -- ever a practical difference. - (argss, body', replace) = topCollectAllFunctionArgs [] id fn - convert js = pure js - - rewriteFunctionsWith :: ([Text] -> [Text]) -> [[Text]] -> (AST -> AST) -> AST -> ([[Text]], AST, AST -> AST) - rewriteFunctionsWith argMapper = collectAllFunctionArgs - where - collectAllFunctionArgs allArgs f (Function s1 ident args (Block s2 (body@(Return _ _):_))) = - collectAllFunctionArgs (args : allArgs) (\b -> f (Function s1 ident (argMapper args) (Block s2 [b]))) body - collectAllFunctionArgs allArgs f (Function ss ident args body@(Block _ _)) = - (args : allArgs, body, f . Function ss ident (argMapper args)) - collectAllFunctionArgs allArgs f (Return s1 (Function s2 ident args (Block s3 [body]))) = - collectAllFunctionArgs (args : allArgs) (\b -> f (Return s1 (Function s2 ident (argMapper args) (Block s3 [b])))) body - collectAllFunctionArgs allArgs f (Return s1 (Function s2 ident args body@(Block _ _))) = - (args : allArgs, body, f . Return s1 . Function s2 ident (argMapper args)) - collectAllFunctionArgs allArgs f body = (allArgs, body, f) - - topCollectAllFunctionArgs :: [[Text]] -> (AST -> AST) -> AST -> ([[Text]], AST, AST -> AST) - topCollectAllFunctionArgs = rewriteFunctionsWith (map copyVar) - - innerCollectAllFunctionArgs :: [[Text]] -> (AST -> AST) -> AST -> ([[Text]], AST, AST -> AST) - innerCollectAllFunctionArgs = rewriteFunctionsWith id - - countReferences :: Text -> AST -> Int - countReferences ident = everything (+) match where - match :: AST -> Int - match (Var _ ident') | ident == ident' = 1 - match _ = 0 - - -- If `ident` is a tail-recursive function, returns a set of identifiers - -- that are locally bound to functions participating in the tail recursion. - -- Otherwise, returns Nothing. - findTailRecursiveFns :: Text -> Int -> AST -> Maybe (S.Set Text) - findTailRecursiveFns ident arity js = guard (countReferences ident js > 0) *> go (S.empty, S.singleton (ident, arity)) - where - - go :: (S.Set Text, S.Set (Text, Int)) -> Maybe (S.Set Text) - go (known, required) = - case S.minView required of - Just (r, required') -> do - required'' <- findTailPositionDeps r js - go (S.insert (fst r) known, required' <> S.filter (not . (`S.member` known) . fst) required'') - Nothing -> - pure known - - -- Returns set of identifiers (with their arities) that need to be used - -- exclusively in tail calls using their full arity in order for this - -- identifier to be considered in tail position (or Nothing if this - -- identifier is used somewhere not as a tail call with full arity). - findTailPositionDeps :: (Text, Int) -> AST -> Maybe (S.Set (Text, Int)) - findTailPositionDeps (ident, arity) = allInTailPosition where - countSelfReferences = countReferences ident - - allInTailPosition (Return _ expr) - | isSelfCall ident arity expr = guard (countSelfReferences expr == 1) $> S.empty - | otherwise = guard (countSelfReferences expr == 0) $> S.empty - allInTailPosition (While _ js1 body) - = guard (countSelfReferences js1 == 0) *> allInTailPosition body - allInTailPosition (For _ _ js1 js2 body) - = guard (countSelfReferences js1 == 0 && countSelfReferences js2 == 0) *> allInTailPosition body - allInTailPosition (ForIn _ _ js1 body) - = guard (countSelfReferences js1 == 0) *> allInTailPosition body - allInTailPosition (IfElse _ js1 body el) - = guard (countSelfReferences js1 == 0) *> liftA2 mappend (allInTailPosition body) (foldMapA allInTailPosition el) - allInTailPosition (Block _ body) - = foldMapA allInTailPosition body - allInTailPosition (Throw _ js1) - = guard (countSelfReferences js1 == 0) $> S.empty - allInTailPosition (ReturnNoResult _) - = pure S.empty - allInTailPosition (VariableIntroduction _ _ Nothing) - = pure S.empty - allInTailPosition (VariableIntroduction _ ident' (Just (_, js1))) - | countSelfReferences js1 == 0 = pure S.empty - | Function _ Nothing _ _ <- js1 - , (argss, body, _) <- innerCollectAllFunctionArgs [] id js1 - = S.insert (ident', length argss) <$> allInTailPosition body - | otherwise = empty - allInTailPosition (Assignment _ _ js1) - = guard (countSelfReferences js1 == 0) $> S.empty - allInTailPosition (Comment _ js1) - = allInTailPosition js1 - allInTailPosition _ - = empty - - toLoop :: S.Set Text -> Text -> Int -> [Text] -> [Text] -> AST -> State Int AST - toLoop trFns ident arity outerArgs innerArgs js = do - tcoDone <- tcoDoneM - modify (+ 1) - - let - markDone :: Maybe SourceSpan -> AST - markDone ss = Assignment ss (Var ss tcoDone) (BooleanLiteral ss True) - - loopify :: AST -> AST - loopify (Return ss ret) - | isSelfCall ident arity ret = - let - allArgumentValues = concat $ collectArgs [] ret - in - Block ss $ - zipWith (\val arg -> - Assignment ss (Var ss (tcoVar arg)) val) allArgumentValues outerArgs - ++ zipWith (\val arg -> - Assignment ss (Var ss (copyVar arg)) val) (drop (length outerArgs) allArgumentValues) innerArgs - ++ [ ReturnNoResult ss ] - | isIndirectSelfCall ret = Return ss ret - | otherwise = Block ss [ markDone ss, Return ss ret ] - loopify (ReturnNoResult ss) = Block ss [ markDone ss, ReturnNoResult ss ] - loopify (While ss cond body) = While ss cond (loopify body) - loopify (For ss i js1 js2 body) = For ss i js1 js2 (loopify body) - loopify (ForIn ss i js1 body) = ForIn ss i js1 (loopify body) - loopify (IfElse ss cond body el) = IfElse ss cond (loopify body) (fmap loopify el) - loopify (Block ss body) = Block ss (map loopify body) - loopify (VariableIntroduction ss f (Just (p, fn@(Function _ Nothing _ _)))) - | (_, body, replace) <- innerCollectAllFunctionArgs [] id fn - , f `S.member` trFns = VariableIntroduction ss f (Just (p, replace (loopify body))) - loopify other = other - - pure $ Block rootSS $ - map (\arg -> VariableIntroduction rootSS (tcoVar arg) (Just (UnknownEffects, Var rootSS (copyVar arg)))) outerArgs ++ - [ VariableIntroduction rootSS tcoDone (Just (UnknownEffects, BooleanLiteral rootSS False)) - , VariableIntroduction rootSS tcoResult Nothing - , Function rootSS (Just tcoLoop) (outerArgs ++ innerArgs) (Block rootSS [loopify js]) - , While rootSS (Unary rootSS Not (Var rootSS tcoDone)) - (Block rootSS - [Assignment rootSS (Var rootSS tcoResult) (App rootSS (Var rootSS tcoLoop) (map (Var rootSS . tcoVar) outerArgs ++ map (Var rootSS . copyVar) innerArgs))]) - , Return rootSS (Var rootSS tcoResult) - ] - where - rootSS = Nothing - - collectArgs :: [[AST]] -> AST -> [[AST]] - collectArgs acc (App _ fn args') = collectArgs (args' : acc) fn - collectArgs acc _ = acc - - isIndirectSelfCall :: AST -> Bool - isIndirectSelfCall (App _ (Var _ ident') _) = ident' `S.member` trFns - isIndirectSelfCall (App _ fn _) = isIndirectSelfCall fn - isIndirectSelfCall _ = False - - isSelfCall :: Text -> Int -> AST -> Bool - isSelfCall ident 1 (App _ (Var _ ident') _) = ident == ident' - isSelfCall ident arity (App _ fn _) = isSelfCall ident (arity - 1) fn - isSelfCall _ _ _ = False + (argss, body', replace) = topCollectAllFunctionArgs [] id fn + convert js = pure js + + rewriteFunctionsWith :: ([Text] -> [Text]) -> [[Text]] -> (AST -> AST) -> AST -> ([[Text]], AST, AST -> AST) + rewriteFunctionsWith argMapper = collectAllFunctionArgs + where + collectAllFunctionArgs allArgs f (Function s1 ident args (Block s2 (body@(Return _ _) : _))) = + collectAllFunctionArgs (args : allArgs) (\b -> f (Function s1 ident (argMapper args) (Block s2 [b]))) body + collectAllFunctionArgs allArgs f (Function ss ident args body@(Block _ _)) = + (args : allArgs, body, f . Function ss ident (argMapper args)) + collectAllFunctionArgs allArgs f (Return s1 (Function s2 ident args (Block s3 [body]))) = + collectAllFunctionArgs (args : allArgs) (\b -> f (Return s1 (Function s2 ident (argMapper args) (Block s3 [b])))) body + collectAllFunctionArgs allArgs f (Return s1 (Function s2 ident args body@(Block _ _))) = + (args : allArgs, body, f . Return s1 . Function s2 ident (argMapper args)) + collectAllFunctionArgs allArgs f body = (allArgs, body, f) + + topCollectAllFunctionArgs :: [[Text]] -> (AST -> AST) -> AST -> ([[Text]], AST, AST -> AST) + topCollectAllFunctionArgs = rewriteFunctionsWith (map copyVar) + + innerCollectAllFunctionArgs :: [[Text]] -> (AST -> AST) -> AST -> ([[Text]], AST, AST -> AST) + innerCollectAllFunctionArgs = rewriteFunctionsWith id + + countReferences :: Text -> AST -> Int + countReferences ident = everything (+) match + where + match :: AST -> Int + match (Var _ ident') | ident == ident' = 1 + match _ = 0 + + -- If `ident` is a tail-recursive function, returns a set of identifiers + -- that are locally bound to functions participating in the tail recursion. + -- Otherwise, returns Nothing. + findTailRecursiveFns :: Text -> Int -> AST -> Maybe (S.Set Text) + findTailRecursiveFns ident arity js = guard (countReferences ident js > 0) *> go (S.empty, S.singleton (ident, arity)) + where + go :: (S.Set Text, S.Set (Text, Int)) -> Maybe (S.Set Text) + go (known, required) = + case S.minView required of + Just (r, required') -> do + required'' <- findTailPositionDeps r js + go (S.insert (fst r) known, required' <> S.filter (not . (`S.member` known) . fst) required'') + Nothing -> + pure known + + -- Returns set of identifiers (with their arities) that need to be used + -- exclusively in tail calls using their full arity in order for this + -- identifier to be considered in tail position (or Nothing if this + -- identifier is used somewhere not as a tail call with full arity). + findTailPositionDeps :: (Text, Int) -> AST -> Maybe (S.Set (Text, Int)) + findTailPositionDeps (ident, arity) = allInTailPosition + where + countSelfReferences = countReferences ident + + allInTailPosition (Return _ expr) + | isSelfCall ident arity expr = guard (countSelfReferences expr == 1) $> S.empty + | otherwise = guard (countSelfReferences expr == 0) $> S.empty + allInTailPosition (While _ js1 body) = + guard (countSelfReferences js1 == 0) *> allInTailPosition body + allInTailPosition (For _ _ js1 js2 body) = + guard (countSelfReferences js1 == 0 && countSelfReferences js2 == 0) *> allInTailPosition body + allInTailPosition (ForIn _ _ js1 body) = + guard (countSelfReferences js1 == 0) *> allInTailPosition body + allInTailPosition (IfElse _ js1 body el) = + guard (countSelfReferences js1 == 0) *> liftA2 mappend (allInTailPosition body) (foldMapA allInTailPosition el) + allInTailPosition (Block _ body) = + foldMapA allInTailPosition body + allInTailPosition (Throw _ js1) = + guard (countSelfReferences js1 == 0) $> S.empty + allInTailPosition (ReturnNoResult _) = + pure S.empty + allInTailPosition (VariableIntroduction _ _ Nothing) = + pure S.empty + allInTailPosition (VariableIntroduction _ ident' (Just (_, js1))) + | countSelfReferences js1 == 0 = pure S.empty + | Function _ Nothing _ _ <- js1 + , (argss, body, _) <- innerCollectAllFunctionArgs [] id js1 = + S.insert (ident', length argss) <$> allInTailPosition body + | otherwise = empty + allInTailPosition (Assignment _ _ js1) = + guard (countSelfReferences js1 == 0) $> S.empty + allInTailPosition (Comment _ js1) = + allInTailPosition js1 + allInTailPosition _ = + empty + + toLoop :: S.Set Text -> Text -> Int -> [Text] -> [Text] -> AST -> State Int AST + toLoop trFns ident arity outerArgs innerArgs js = do + tcoDone <- tcoDoneM + modify (+ 1) + + let + markDone :: Maybe SourceSpan -> AST + markDone ss = Assignment ss (Var ss tcoDone) (BooleanLiteral ss True) + + loopify :: AST -> AST + loopify (Return ss ret) + | isSelfCall ident arity ret = + let + allArgumentValues = concat $ collectArgs [] ret + in + Block ss $ + zipWith + ( \val arg -> + Assignment ss (Var ss (tcoVar arg)) val + ) + allArgumentValues + outerArgs + ++ zipWith + ( \val arg -> + Assignment ss (Var ss (copyVar arg)) val + ) + (drop (length outerArgs) allArgumentValues) + innerArgs + ++ [ReturnNoResult ss] + | isIndirectSelfCall ret = Return ss ret + | otherwise = Block ss [markDone ss, Return ss ret] + loopify (ReturnNoResult ss) = Block ss [markDone ss, ReturnNoResult ss] + loopify (While ss cond body) = While ss cond (loopify body) + loopify (For ss i js1 js2 body) = For ss i js1 js2 (loopify body) + loopify (ForIn ss i js1 body) = ForIn ss i js1 (loopify body) + loopify (IfElse ss cond body el) = IfElse ss cond (loopify body) (fmap loopify el) + loopify (Block ss body) = Block ss (map loopify body) + loopify (VariableIntroduction ss f (Just (p, fn@(Function _ Nothing _ _)))) + | (_, body, replace) <- innerCollectAllFunctionArgs [] id fn + , f `S.member` trFns = + VariableIntroduction ss f (Just (p, replace (loopify body))) + loopify other = other + + pure $ + Block rootSS $ + map (\arg -> VariableIntroduction rootSS (tcoVar arg) (Just (UnknownEffects, Var rootSS (copyVar arg)))) outerArgs + ++ [ VariableIntroduction rootSS tcoDone (Just (UnknownEffects, BooleanLiteral rootSS False)) + , VariableIntroduction rootSS tcoResult Nothing + , Function rootSS (Just tcoLoop) (outerArgs ++ innerArgs) (Block rootSS [loopify js]) + , While + rootSS + (Unary rootSS Not (Var rootSS tcoDone)) + ( Block + rootSS + [Assignment rootSS (Var rootSS tcoResult) (App rootSS (Var rootSS tcoLoop) (map (Var rootSS . tcoVar) outerArgs ++ map (Var rootSS . copyVar) innerArgs))] + ) + , Return rootSS (Var rootSS tcoResult) + ] + where + rootSS = Nothing + + collectArgs :: [[AST]] -> AST -> [[AST]] + collectArgs acc (App _ fn args') = collectArgs (args' : acc) fn + collectArgs acc _ = acc + + isIndirectSelfCall :: AST -> Bool + isIndirectSelfCall (App _ (Var _ ident') _) = ident' `S.member` trFns + isIndirectSelfCall (App _ fn _) = isIndirectSelfCall fn + isIndirectSelfCall _ = False + + isSelfCall :: Text -> Int -> AST -> Bool + isSelfCall ident 1 (App _ (Var _ ident') _) = ident == ident' + isSelfCall ident arity (App _ fn _) = isSelfCall ident (arity - 1) fn + isSelfCall _ _ _ = False foldMapA :: (Applicative f, Monoid w, Foldable t) => (a -> f w) -> t a -> f w foldMapA f = foldr (liftA2 mappend . f) (pure mempty) diff --git a/src/Language/PureScript/CoreImp/Optimizer/Unused.hs b/src/Language/PureScript/CoreImp/Optimizer/Unused.hs index 7b7acd127..2f314f6d9 100644 --- a/src/Language/PureScript/CoreImp/Optimizer/Unused.hs +++ b/src/Language/PureScript/CoreImp/Optimizer/Unused.hs @@ -1,55 +1,55 @@ -- | Removes unused variables -module Language.PureScript.CoreImp.Optimizer.Unused - ( removeCodeAfterReturnStatements - , removeUndefinedApp - , removeUnusedEffectFreeVars - ) where +module Language.PureScript.CoreImp.Optimizer.Unused ( + removeCodeAfterReturnStatements, + removeUndefinedApp, + removeUnusedEffectFreeVars, +) where import Prelude import Control.Monad (filterM) -import Data.Monoid (Any(..)) +import Data.Monoid (Any (..)) import Data.Set qualified as S import Data.Text (Text) -import Language.PureScript.CoreImp.AST (AST(..), InitializerEffects(..), everything, everywhere) -import Language.PureScript.CoreImp.Optimizer.Common (removeFromBlock) import Language.PureScript.Constants.Prim qualified as C +import Language.PureScript.CoreImp.AST (AST (..), InitializerEffects (..), everything, everywhere) +import Language.PureScript.CoreImp.Optimizer.Common (removeFromBlock) removeCodeAfterReturnStatements :: AST -> AST removeCodeAfterReturnStatements = everywhere (removeFromBlock go) where - go :: [AST] -> [AST] - go jss = - case break isReturn jss of - (_, []) -> jss - (body, ret : _ ) -> body ++ [ret] + go :: [AST] -> [AST] + go jss = + case break isReturn jss of + (_, []) -> jss + (body, ret : _) -> body ++ [ret] - isReturn (Return _ _) = True - isReturn (ReturnNoResult _) = True - isReturn _ = False + isReturn (Return _ _) = True + isReturn (ReturnNoResult _) = True + isReturn _ = False removeUndefinedApp :: AST -> AST removeUndefinedApp = everywhere convert where - convert (App ss fn [Var _ C.S_undefined]) = App ss fn [] - convert js = js + convert (App ss fn [Var _ C.S_undefined]) = App ss fn [] + convert js = js removeUnusedEffectFreeVars :: [Text] -> [[AST]] -> [[AST]] removeUnusedEffectFreeVars exps = loop where - expsSet = S.fromList exps + expsSet = S.fromList exps - loop :: [[AST]] -> [[AST]] - loop asts = if changed then loop (filter (not . null) asts') else asts - where - used = expsSet <> foldMap (foldMap (everything (<>) (\case Var _ x -> S.singleton x; _ -> S.empty))) asts - (Any changed, asts') = traverse (filterM (anyFalses . isInUsedSet used)) asts + loop :: [[AST]] -> [[AST]] + loop asts = if changed then loop (filter (not . null) asts') else asts + where + used = expsSet <> foldMap (foldMap (everything (<>) (\case Var _ x -> S.singleton x; _ -> S.empty))) asts + (Any changed, asts') = traverse (filterM (anyFalses . isInUsedSet used)) asts - isInUsedSet :: S.Set Text -> AST -> Bool - isInUsedSet used = \case - VariableIntroduction _ var (Just (NoEffects, _)) -> var `S.member` used - _ -> True + isInUsedSet :: S.Set Text -> AST -> Bool + isInUsedSet used = \case + VariableIntroduction _ var (Just (NoEffects, _)) -> var `S.member` used + _ -> True - anyFalses :: Bool -> (Any, Bool) - anyFalses x = (Any (not x), x) + anyFalses :: Bool -> (Any, Bool) + anyFalses x = (Any (not x), x) diff --git a/src/Language/PureScript/Crash.hs b/src/Language/PureScript/Crash.hs index 9b0412620..7fa77b2b9 100644 --- a/src/Language/PureScript/Crash.hs +++ b/src/Language/PureScript/Crash.hs @@ -5,8 +5,8 @@ import Prelude import GHC.Stack (HasCallStack) -- | Exit with an error message and a crash report link. -internalError :: HasCallStack => String -> a +internalError :: (HasCallStack) => String -> a internalError = error - . ("An internal error occurred during compilation: " ++) - . (++ "\nPlease report this at https://github.com/purescript/purescript/issues") + . ("An internal error occurred during compilation: " ++) + . (++ "\nPlease report this at https://github.com/purescript/purescript/issues") diff --git a/src/Language/PureScript/Docs.hs b/src/Language/PureScript/Docs.hs index 417c98f3d..cfd05d978 100644 --- a/src/Language/PureScript/Docs.hs +++ b/src/Language/PureScript/Docs.hs @@ -1,16 +1,15 @@ - --- | Data types and functions for rendering generated documentation from --- PureScript code, in a variety of formats. - -module Language.PureScript.Docs - ( module Docs - ) where +{- | Data types and functions for rendering generated documentation from +PureScript code, in a variety of formats. +-} +module Language.PureScript.Docs ( + module Docs, +) where import Language.PureScript.Docs.Collect as Docs import Language.PureScript.Docs.Convert as Docs +import Language.PureScript.Docs.Css as Docs import Language.PureScript.Docs.Prim as Docs import Language.PureScript.Docs.Render as Docs import Language.PureScript.Docs.RenderedCode as Docs import Language.PureScript.Docs.Tags as Docs import Language.PureScript.Docs.Types as Docs -import Language.PureScript.Docs.Css as Docs diff --git a/src/Language/PureScript/Docs/AsHtml.hs b/src/Language/PureScript/Docs/AsHtml.hs index e4460183a..3a8991efb 100644 --- a/src/Language/PureScript/Docs/AsHtml.hs +++ b/src/Language/PureScript/Docs/AsHtml.hs @@ -1,51 +1,50 @@ - --- | Functions for rendering generated documentation from PureScript code as --- HTML. - +{- | Functions for rendering generated documentation from PureScript code as +HTML. +-} module Language.PureScript.Docs.AsHtml ( - HtmlOutput(..), - HtmlOutputModule(..), - HtmlRenderContext(..), + HtmlOutput (..), + HtmlOutputModule (..), + HtmlRenderContext (..), nullRenderContext, packageAsHtml, moduleAsHtml, makeFragment, - renderMarkdown + renderMarkdown, ) where -import Prelude import Control.Category ((>>>)) import Control.Monad (unless) import Data.Bifunctor (bimap) import Data.Char (isUpper) import Data.Either (isRight) +import Data.Foldable (for_) import Data.List.NonEmpty qualified as NE import Data.Maybe (fromMaybe) -import Data.Foldable (for_) import Data.String (fromString) +import Prelude import Data.Text (Text) import Data.Text qualified as T +import Cheapskate qualified import Text.Blaze.Html5 as H hiding (map) import Text.Blaze.Html5.Attributes qualified as A -import Cheapskate qualified import Language.PureScript qualified as P -import Language.PureScript.Docs.Types -import Language.PureScript.Docs.RenderedCode (Link(..), outputWith) -import Language.PureScript.Docs.Render qualified as Render import Language.PureScript.CST qualified as CST +import Language.PureScript.Docs.Render qualified as Render +import Language.PureScript.Docs.RenderedCode (Link (..), outputWith) +import Language.PureScript.Docs.Types data HtmlOutput a = HtmlOutput - { htmlIndex :: [(Maybe Char, a)] - , htmlModules :: [(P.ModuleName, HtmlOutputModule a)] + { htmlIndex :: [(Maybe Char, a)] + , htmlModules :: [(P.ModuleName, HtmlOutputModule a)] } deriving (Show, Functor) data HtmlOutputModule a = HtmlOutputModule - { htmlOutputModuleLocals :: a + { htmlOutputModuleLocals :: a , htmlOutputModuleReExports :: [(InPackage P.ModuleName, a)] } deriving (Show, Functor) @@ -56,38 +55,40 @@ data HtmlRenderContext = HtmlRenderContext , renderSourceLink :: P.SourceSpan -> Maybe Text } --- | --- An HtmlRenderContext for when you don't want to render any links. +{- | +An HtmlRenderContext for when you don't want to render any links. +-} nullRenderContext :: HtmlRenderContext -nullRenderContext = HtmlRenderContext - { buildDocLink = const (const (const Nothing)) - , renderDocLink = const "" - , renderSourceLink = const Nothing - } - -packageAsHtml - :: (InPackage P.ModuleName -> Maybe HtmlRenderContext) - -> Package a - -> HtmlOutput Html -packageAsHtml getHtmlCtx Package{..} = +nullRenderContext = + HtmlRenderContext + { buildDocLink = const (const (const Nothing)) + , renderDocLink = const "" + , renderSourceLink = const Nothing + } + +packageAsHtml :: + (InPackage P.ModuleName -> Maybe HtmlRenderContext) -> + Package a -> + HtmlOutput Html +packageAsHtml getHtmlCtx Package {..} = HtmlOutput indexFile modules where - indexFile = [] - modules = moduleAsHtml getHtmlCtx <$> pkgModules - -moduleAsHtml - :: (InPackage P.ModuleName -> Maybe HtmlRenderContext) - -> Module - -> (P.ModuleName, HtmlOutputModule Html) -moduleAsHtml getHtmlCtx Module{..} = (modName, HtmlOutputModule modHtml reexports) + indexFile = [] + modules = moduleAsHtml getHtmlCtx <$> pkgModules + +moduleAsHtml :: + (InPackage P.ModuleName -> Maybe HtmlRenderContext) -> + Module -> + (P.ModuleName, HtmlOutputModule Html) +moduleAsHtml getHtmlCtx Module {..} = (modName, HtmlOutputModule modHtml reexports) where - modHtml = do - let r = fromMaybe nullRenderContext $ getHtmlCtx (Local modName) - in do - for_ modComments renderMarkdown - for_ modDeclarations (declAsHtml r) - reexports = - flip map modReExports $ \(pkg, decls) -> + modHtml = do + let r = fromMaybe nullRenderContext $ getHtmlCtx (Local modName) + in do + for_ modComments renderMarkdown + for_ modDeclarations (declAsHtml r) + reexports = + flip map modReExports $ \(pkg, decls) -> let r = fromMaybe nullRenderContext $ getHtmlCtx pkg in (pkg, foldMap (declAsHtml r) decls) @@ -127,14 +128,14 @@ moduleAsHtml getHtmlCtx Module{..} = (modName, HtmlOutputModule modHtml reexport -- in M.insert idx new m declAsHtml :: HtmlRenderContext -> Declaration -> Html -declAsHtml r d@Declaration{..} = do +declAsHtml r d@Declaration {..} = do let declFragment = makeFragment (declInfoNamespace declInfo) declTitle H.div ! A.class_ "decl" ! A.id (v (T.drop 1 declFragment)) $ do h3 ! A.class_ "decl__title clearfix" $ do a ! A.class_ "decl__anchor" ! A.href (v declFragment) $ "#" H.span $ text declTitle text " " -- prevent browser from treating - -- declTitle + linkToSource as one word + -- declTitle + linkToSource as one word for_ declSourceSpan (linkToSource r) H.div ! A.class_ "decl__body" $ do @@ -168,108 +169,108 @@ declAsHtml r d@Declaration{..} = do linkToSource ctx srcspan = maybe (return ()) go (renderSourceLink ctx srcspan) where - go href = - H.span ! A.class_ "decl__source" $ - a ! A.href (v href) $ text "Source" + go href = + H.span ! A.class_ "decl__source" $ + a ! A.href (v href) $ + text "Source" renderChildren :: HtmlRenderContext -> [ChildDeclaration] -> Html renderChildren _ [] = return () renderChildren r xs = ul $ mapM_ item xs where - item decl = - li ! A.id (v (T.drop 1 (fragment decl))) $ do - renderCode decl - for_ (cdeclComments decl) $ \coms -> - H.div ! A.class_ "decl__child_comments" $ renderMarkdown coms + item decl = + li ! A.id (v (T.drop 1 (fragment decl))) $ do + renderCode decl + for_ (cdeclComments decl) $ \coms -> + H.div ! A.class_ "decl__child_comments" $ renderMarkdown coms - fragment decl = makeFragment (childDeclInfoNamespace (cdeclInfo decl)) (cdeclTitle decl) - renderCode = code . codeAsHtml r . Render.renderChildDeclaration + fragment decl = makeFragment (childDeclInfoNamespace (cdeclInfo decl)) (cdeclTitle decl) + renderCode = code . codeAsHtml r . Render.renderChildDeclaration codeAsHtml :: HtmlRenderContext -> RenderedCode -> Html codeAsHtml r = outputWith elemAsHtml where - elemAsHtml e = case e of - Syntax x -> - withClass "syntax" (text x) - Keyword x -> - withClass "keyword" (text x) - Space -> - text " " - Symbol ns name link_ -> - case link_ of - Link mn -> - let - class_ = - if startsWithUpper name then "ctor" else "ident" - target - | isOp name = - if ns == TypeLevel - then "type (" <> name <> ")" - else "(" <> name <> ")" - | otherwise = name - in - linkToDecl ns target mn (withClass class_ (text name)) - NoLink -> - text name - Role role -> - case role of - "nominal" -> renderRole describeNominal "decl__role_nominal" - "phantom" -> renderRole describePhantom "decl__role_phantom" - - -- representational is intentionally not rendered - "representational" -> toHtml ("" :: Text) - - x -> P.internalError $ "codeAsHtml: unknown value for role annotation: '" <> T.unpack x <> "'" - where - renderRole hoverTextContent className = - H.a ! A.href (v docRepoRolePage) ! A.target (v "_blank") ! A.class_ "decl__role" $ do - H.abbr ! A.class_ "decl__role_hover" ! A.title (v hoverTextContent) $ do - H.sub ! A.class_ className $ do - toHtml ("" :: Text) - - docRepoRolePage = - "https://github.com/purescript/documentation/blob/master/language/Roles.md" - - describeNominal = - "The 'nominal' role means this argument may not change when coercing the type." - describePhantom = - "The 'phantom' role means this argument can change freely when coercing the type." - - linkToDecl = linkToDeclaration r - - startsWithUpper :: Text -> Bool - startsWithUpper str = not (T.null str) && isUpper (T.index str 0) - - isOp = isRight . runParser CST.parseOperator - - runParser :: CST.Parser a -> Text -> Either String a - runParser p' = - bimap (CST.prettyPrintError . NE.head) snd - . CST.runTokenParser p' - . CST.lex + elemAsHtml e = case e of + Syntax x -> + withClass "syntax" (text x) + Keyword x -> + withClass "keyword" (text x) + Space -> + text " " + Symbol ns name link_ -> + case link_ of + Link mn -> + let + class_ = + if startsWithUpper name then "ctor" else "ident" + target + | isOp name = + if ns == TypeLevel + then "type (" <> name <> ")" + else "(" <> name <> ")" + | otherwise = name + in + linkToDecl ns target mn (withClass class_ (text name)) + NoLink -> + text name + Role role -> + case role of + "nominal" -> renderRole describeNominal "decl__role_nominal" + "phantom" -> renderRole describePhantom "decl__role_phantom" + -- representational is intentionally not rendered + "representational" -> toHtml ("" :: Text) + x -> P.internalError $ "codeAsHtml: unknown value for role annotation: '" <> T.unpack x <> "'" + where + renderRole hoverTextContent className = + H.a ! A.href (v docRepoRolePage) ! A.target (v "_blank") ! A.class_ "decl__role" $ do + H.abbr ! A.class_ "decl__role_hover" ! A.title (v hoverTextContent) $ do + H.sub ! A.class_ className $ do + toHtml ("" :: Text) + + docRepoRolePage = + "https://github.com/purescript/documentation/blob/master/language/Roles.md" + + describeNominal = + "The 'nominal' role means this argument may not change when coercing the type." + describePhantom = + "The 'phantom' role means this argument can change freely when coercing the type." + + linkToDecl = linkToDeclaration r + + startsWithUpper :: Text -> Bool + startsWithUpper str = not (T.null str) && isUpper (T.index str 0) + + isOp = isRight . runParser CST.parseOperator + + runParser :: CST.Parser a -> Text -> Either String a + runParser p' = + bimap (CST.prettyPrintError . NE.head) snd + . CST.runTokenParser p' + . CST.lex renderLink :: HtmlRenderContext -> DocLink -> Html -> Html -renderLink r link_@DocLink{..} = - a ! A.href (v (renderDocLink r link_ <> fragmentFor link_)) +renderLink r link_@DocLink {..} = + a + ! A.href (v (renderDocLink r link_ <> fragmentFor link_)) ! A.title (v fullyQualifiedName) where - fullyQualifiedName = - P.runModuleName modName <> "." <> linkTitle + fullyQualifiedName = + P.runModuleName modName <> "." <> linkTitle - modName = case linkLocation of - LocalModule m -> m - DepsModule _ _ m -> m - BuiltinModule m -> m + modName = case linkLocation of + LocalModule m -> m + DepsModule _ _ m -> m + BuiltinModule m -> m makeFragment :: Namespace -> Text -> Text makeFragment ns = (prefix <>) . escape where - prefix = case ns of - TypeLevel -> "#t:" - ValueLevel -> "#v:" + prefix = case ns of + TypeLevel -> "#t:" + ValueLevel -> "#v:" - -- TODO - escape = id + -- TODO + escape = id fragmentFor :: DocLink -> Text fragmentFor l = makeFragment (linkNamespace l) (linkTitle l) @@ -292,47 +293,48 @@ renderAlias (P.Fixity associativity precedence) alias_ = em $ text ("(" <> associativityStr <> " / precedence " <> T.pack (show precedence) <> ")") where - showAliasName (Left valueAlias) = P.runProperName valueAlias - showAliasName (Right typeAlias) = case typeAlias of - (Left identifier) -> P.runIdent identifier - (Right properName) -> P.runProperName properName - associativityStr = case associativity of - P.Infixl -> "left-associative" - P.Infixr -> "right-associative" - P.Infix -> "non-associative" - --- | Render Markdown to HTML. Safe for untrusted input. Relative links are --- | removed. + showAliasName (Left valueAlias) = P.runProperName valueAlias + showAliasName (Right typeAlias) = case typeAlias of + (Left identifier) -> P.runIdent identifier + (Right properName) -> P.runProperName properName + associativityStr = case associativity of + P.Infixl -> "left-associative" + P.Infixr -> "right-associative" + P.Infix -> "non-associative" + +{- | Render Markdown to HTML. Safe for untrusted input. Relative links are +| removed. +-} renderMarkdown :: Text -> H.Html renderMarkdown = H.toMarkup . removeRelativeLinks . Cheapskate.markdown opts where - opts = Cheapskate.def { Cheapskate.allowRawHtml = False } + opts = Cheapskate.def {Cheapskate.allowRawHtml = False} removeRelativeLinks :: Cheapskate.Doc -> Cheapskate.Doc removeRelativeLinks = Cheapskate.walk go where - go :: Cheapskate.Inlines -> Cheapskate.Inlines - go = (>>= stripRelatives) - - stripRelatives :: Cheapskate.Inline -> Cheapskate.Inlines - stripRelatives (Cheapskate.Link contents_ href _) - | isRelativeURI href = contents_ - stripRelatives other = pure other - - -- Tests for a ':' character in the first segment of a URI. - -- - -- See Section 4.2 of RFC 3986: - -- https://tools.ietf.org/html/rfc3986#section-4.2 - -- - -- >>> isRelativeURI "http://example.com/" == False - -- >>> isRelativeURI "mailto:me@example.com" == False - -- >>> isRelativeURI "foo/bar" == True - -- >>> isRelativeURI "/bar" == True - -- >>> isRelativeURI "./bar" == True - isRelativeURI :: Text -> Bool - isRelativeURI = - T.takeWhile (/= '/') >>> T.all (/= ':') + go :: Cheapskate.Inlines -> Cheapskate.Inlines + go = (>>= stripRelatives) + + stripRelatives :: Cheapskate.Inline -> Cheapskate.Inlines + stripRelatives (Cheapskate.Link contents_ href _) + | isRelativeURI href = contents_ + stripRelatives other = pure other + + -- Tests for a ':' character in the first segment of a URI. + -- + -- See Section 4.2 of RFC 3986: + -- https://tools.ietf.org/html/rfc3986#section-4.2 + -- + -- >>> isRelativeURI "http://example.com/" == False + -- >>> isRelativeURI "mailto:me@example.com" == False + -- >>> isRelativeURI "foo/bar" == True + -- >>> isRelativeURI "/bar" == True + -- >>> isRelativeURI "./bar" == True + isRelativeURI :: Text -> Bool + isRelativeURI = + T.takeWhile (/= '/') >>> T.all (/= ':') v :: Text -> AttributeValue v = toValue @@ -346,10 +348,10 @@ partitionChildren :: partitionChildren = reverseAll . foldl go ([], [], []) where - go (instances, dctors, members) rcd = - case cdeclInfo rcd of - ChildInstance _ _ -> (rcd : instances, dctors, members) - ChildDataConstructor _ -> (instances, rcd : dctors, members) - ChildTypeClassMember _ -> (instances, dctors, rcd : members) + go (instances, dctors, members) rcd = + case cdeclInfo rcd of + ChildInstance _ _ -> (rcd : instances, dctors, members) + ChildDataConstructor _ -> (instances, rcd : dctors, members) + ChildTypeClassMember _ -> (instances, dctors, rcd : members) - reverseAll (xs, ys, zs) = (reverse xs, reverse ys, reverse zs) + reverseAll (xs, ys, zs) = (reverse xs, reverse ys, reverse zs) diff --git a/src/Language/PureScript/Docs/AsMarkdown.hs b/src/Language/PureScript/Docs/AsMarkdown.hs index 82139ccbe..1a2381f57 100644 --- a/src/Language/PureScript/Docs/AsMarkdown.hs +++ b/src/Language/PureScript/Docs/AsMarkdown.hs @@ -1,27 +1,27 @@ -module Language.PureScript.Docs.AsMarkdown - ( Docs - , runDocs - , moduleAsMarkdown - , codeToString - ) where +module Language.PureScript.Docs.AsMarkdown ( + Docs, + runDocs, + moduleAsMarkdown, + codeToString, +) where import Prelude import Control.Monad (unless, zipWithM_) -import Control.Monad.Writer (Writer, tell, execWriter) +import Control.Monad.Writer (Writer, execWriter, tell) import Data.Foldable (for_) import Data.List (partition) import Data.Text (Text) import Data.Text qualified as T -import Language.PureScript.Docs.RenderedCode (RenderedCode, RenderedCodeElement(..), outputWith) -import Language.PureScript.Docs.Types (ChildDeclaration(..), ChildDeclarationInfo(..), Declaration(..), Module(..), ignorePackage) import Language.PureScript qualified as P import Language.PureScript.Docs.Render qualified as Render +import Language.PureScript.Docs.RenderedCode (RenderedCode, RenderedCodeElement (..), outputWith) +import Language.PureScript.Docs.Types (ChildDeclaration (..), ChildDeclarationInfo (..), Declaration (..), Module (..), ignorePackage) moduleAsMarkdown :: Module -> Docs -moduleAsMarkdown Module{..} = do +moduleAsMarkdown Module {..} = do headerLevel 2 $ "Module " <> P.runModuleName modName spacer for_ modComments tell' @@ -34,7 +34,7 @@ moduleAsMarkdown Module{..} = do mapM_ declAsMarkdown decls declAsMarkdown :: Declaration -> Docs -declAsMarkdown decl@Declaration{..} = do +declAsMarkdown decl@Declaration {..} = do headerLevel 4 (ticks declTitle) spacer @@ -50,21 +50,19 @@ declAsMarkdown decl@Declaration{..} = do headerLevel 5 "Instances" fencedBlock $ mapM_ (tell' . childToString NotFirst) instances spacer - where - isChildInstance (ChildInstance _ _) = True - isChildInstance _ = False + isChildInstance (ChildInstance _ _) = True + isChildInstance _ = False codeToString :: RenderedCode -> Text codeToString = outputWith elemAsMarkdown where - elemAsMarkdown (Syntax x) = x - elemAsMarkdown (Keyword x) = x - elemAsMarkdown Space = " " - elemAsMarkdown (Symbol _ x _) = x - - -- roles aren't rendered in markdown - elemAsMarkdown (Role _) = "" + elemAsMarkdown (Syntax x) = x + elemAsMarkdown (Keyword x) = x + elemAsMarkdown Space = " " + elemAsMarkdown (Symbol _ x _) = x + -- roles aren't rendered in markdown + elemAsMarkdown (Role _) = "" -- fixityAsMarkdown :: P.Fixity -> Docs -- fixityAsMarkdown (P.Fixity associativity precedence) = @@ -81,17 +79,17 @@ codeToString = outputWith elemAsMarkdown -- P.Infix -> "non-associative" childToString :: First -> ChildDeclaration -> Text -childToString f decl@ChildDeclaration{..} = +childToString f decl@ChildDeclaration {..} = case cdeclInfo of ChildDataConstructor _ -> let c = if f == First then "=" else "|" - in " " <> c <> " " <> str + in " " <> c <> " " <> str ChildTypeClassMember _ -> " " <> str ChildInstance _ _ -> str where - str = codeToString $ Render.renderChildDeclaration decl + str = codeToString $ Render.renderChildDeclaration decl data First = First @@ -104,7 +102,7 @@ runDocs :: Docs -> Text runDocs = T.unlines . execWriter tell' :: Text -> Docs -tell' = tell . (:[]) +tell' = tell . (: []) spacer :: Docs spacer = tell' "" diff --git a/src/Language/PureScript/Docs/Collect.hs b/src/Language/PureScript/Docs/Collect.hs index 0da65d225..59e8950f3 100644 --- a/src/Language/PureScript/Docs/Collect.hs +++ b/src/Language/PureScript/Docs/Collect.hs @@ -1,7 +1,6 @@ - -module Language.PureScript.Docs.Collect - ( collectDocs - ) where +module Language.PureScript.Docs.Collect ( + collectDocs, +) where import Protolude hiding (check) @@ -17,7 +16,7 @@ import System.IO.UTF8 (readUTF8FileT, readUTF8FilesT) import Language.PureScript.Docs.Convert.ReExports (updateReExports) import Language.PureScript.Docs.Prim (primModules) -import Language.PureScript.Docs.Types (InPackage(..), Module(..), asModule, displayPackageError, ignorePackage) +import Language.PureScript.Docs.Types (InPackage (..), Module (..), asModule, displayPackageError, ignorePackage) import Language.PureScript.AST qualified as P import Language.PureScript.CST qualified as P @@ -30,16 +29,16 @@ import Language.PureScript.Options qualified as P import Web.Bower.PackageMeta (PackageName) --- | --- Given a compiler output directory, a list of input PureScript source files, --- and a list of dependency PureScript source files, produce documentation for --- the input files in the intermediate documentation format. Note that --- dependency files are not included in the result. --- --- If the output directory is not up to date with respect to the provided input --- and dependency files, the files will be built as if with just the "docs" --- codegen target, i.e. "purs compile --codegen docs". --- +{- | +Given a compiler output directory, a list of input PureScript source files, +and a list of dependency PureScript source files, produce documentation for +the input files in the intermediate documentation format. Note that +dependency files are not included in the result. + +If the output directory is not up to date with respect to the provided input +and dependency files, the files will be built as if with just the "docs" +codegen target, i.e. "purs compile --codegen docs". +-} collectDocs :: forall m. (MonadError P.MultipleErrors m, MonadIO m) => @@ -60,27 +59,26 @@ collectDocs outputDir inputFiles depsFiles = do docsModules <- go modulePaths pure (filter (shouldKeep . modName . snd) docsModules, modulesDeps) - where - packageDiscriminators modulesDeps = - let - shouldKeep mn = isLocal mn && not (P.isBuiltinModuleName mn) - - withPackage :: P.ModuleName -> InPackage P.ModuleName - withPackage mn = - case Map.lookup mn modulesDeps of - Just pkgName -> FromDep pkgName mn - Nothing -> Local mn - - isLocal :: P.ModuleName -> Bool - isLocal = not . flip Map.member modulesDeps - in - (withPackage, shouldKeep) - --- | --- Compile with just the 'docs' codegen target, writing results into the given --- output directory. --- + packageDiscriminators modulesDeps = + let + shouldKeep mn = isLocal mn && not (P.isBuiltinModuleName mn) + + withPackage :: P.ModuleName -> InPackage P.ModuleName + withPackage mn = + case Map.lookup mn modulesDeps of + Just pkgName -> FromDep pkgName mn + Nothing -> Local mn + + isLocal :: P.ModuleName -> Bool + isLocal = not . flip Map.member modulesDeps + in + (withPackage, shouldKeep) + +{- | +Compile with just the 'docs' codegen target, writing results into the given +output directory. +-} compileForDocs :: forall m. (MonadError P.MultipleErrors m, MonadIO m) => @@ -100,22 +98,24 @@ compileForDocs outputDir inputFiles = do } P.make makeActions (map snd ms) either throwError return result - where - testOptions :: P.Options - testOptions = P.defaultOptions { P.optionsCodegenTargets = Set.singleton P.Docs } + testOptions :: P.Options + testOptions = P.defaultOptions {P.optionsCodegenTargets = Set.singleton P.Docs} parseDocsJsonFile :: FilePath -> P.ModuleName -> IO Module parseDocsJsonFile outputDir mn = let filePath = outputDir T.unpack (P.runModuleName mn) "docs.json" - in do - str <- BS.readFile filePath - case ABE.parseStrict asModule str of - Right m -> pure m - Left err -> P.internalError $ - "Failed to decode: " ++ filePath ++ - intercalate "\n" (map T.unpack (ABE.displayError displayPackageError err)) + in + do + str <- BS.readFile filePath + case ABE.parseStrict asModule str of + Right m -> pure m + Left err -> + P.internalError $ + "Failed to decode: " + ++ filePath + ++ intercalate "\n" (map T.unpack (ABE.displayError displayPackageError err)) addReExports :: (MonadError P.MultipleErrors m) => @@ -133,21 +133,23 @@ addReExports withPackage docsModules externs = do -- here. let moduleMap = Map.fromList - (map (modName &&& identity) - (docsModules ++ primModules)) + ( map + (modName &&& identity) + (docsModules ++ primModules) + ) let withReExports = updateReExports externs withPackage moduleMap pure (Map.elems withReExports) --- | --- Perform an operation on a list of things which are tagged, and reassociate --- the things with their tags afterwards. --- +{- | +Perform an operation on a list of things which are tagged, and reassociate +the things with their tags afterwards. +-} operateAndRetag :: forall m a b key tag. - Monad m => - Ord key => - Show key => + (Monad m) => + (Ord key) => + (Show key) => (a -> key) -> (b -> key) -> ([a] -> m [b]) -> @@ -156,44 +158,45 @@ operateAndRetag :: operateAndRetag keyA keyB operation input = map retag <$> operation (map snd input) where - tags :: Map key tag - tags = Map.fromList $ map (\(tag, a) -> (keyA a, tag)) input - - findTag :: key -> tag - findTag key = - case Map.lookup key tags of - Just tag -> tag - Nothing -> P.internalError ("Missing tag for: " ++ show key) - - retag :: b -> (tag, b) - retag b = (findTag (keyB b), b) - --- | --- Given: --- --- * A list of local source files --- * A list of source files from external dependencies, together with their --- package names --- --- This function does the following: --- --- * Partially parse all of the input and dependency source files to get --- the module name of each module --- * Associate each dependency module with its package name, thereby --- distinguishing these from local modules --- * Return the file paths paired with the names of the modules they --- contain, and a Map of module names to package names for modules which --- come from dependencies. If a module does not exist in the map, it can --- safely be --- assumed to be local. + tags :: Map key tag + tags = Map.fromList $ map (\(tag, a) -> (keyA a, tag)) input + + findTag :: key -> tag + findTag key = + case Map.lookup key tags of + Just tag -> tag + Nothing -> P.internalError ("Missing tag for: " ++ show key) + + retag :: b -> (tag, b) + retag b = (findTag (keyB b), b) + +{- | +Given: + + * A list of local source files + * A list of source files from external dependencies, together with their + package names + +This function does the following: + + * Partially parse all of the input and dependency source files to get + the module name of each module + * Associate each dependency module with its package name, thereby + distinguishing these from local modules + * Return the file paths paired with the names of the modules they + contain, and a Map of module names to package names for modules which + come from dependencies. If a module does not exist in the map, it can + safely be + assumed to be local. +-} getModulePackageInfo :: (MonadError P.MultipleErrors m, MonadIO m) => - [FilePath] - -> [(PackageName, FilePath)] - -> m ([(FilePath, P.ModuleName)], Map P.ModuleName PackageName) + [FilePath] -> + [(PackageName, FilePath)] -> + m ([(FilePath, P.ModuleName)], Map P.ModuleName PackageName) getModulePackageInfo inputFiles depsFiles = do inputFiles' <- traverse (readFileAs . Local) inputFiles - depsFiles' <- traverse (readFileAs . uncurry FromDep) depsFiles + depsFiles' <- traverse (readFileAs . uncurry FromDep) depsFiles moduleNames <- getModuleNames (inputFiles' ++ depsFiles') @@ -202,24 +205,23 @@ getModulePackageInfo inputFiles depsFiles = do mapMaybe (\(pkgPath, mn) -> (mn,) <$> getPkgName pkgPath) moduleNames pure (map (first ignorePackage) moduleNames, mnMap) - where - getModuleNames :: - (MonadError P.MultipleErrors m) => - [(InPackage FilePath, Text)] - -> m [(InPackage FilePath, P.ModuleName)] - getModuleNames = - fmap (map (second (P.getModuleName . P.resPartial))) - . either throwError return - . P.parseModulesFromFiles ignorePackage - - getPkgName = \case - Local _ -> Nothing - FromDep pkgName _ -> Just pkgName - - readFileAs :: - (MonadIO m) => - InPackage FilePath -> - m (InPackage FilePath, Text) - readFileAs fi = - liftIO . fmap (fi,) $ readUTF8FileT (ignorePackage fi) + getModuleNames :: + (MonadError P.MultipleErrors m) => + [(InPackage FilePath, Text)] -> + m [(InPackage FilePath, P.ModuleName)] + getModuleNames = + fmap (map (second (P.getModuleName . P.resPartial))) + . either throwError return + . P.parseModulesFromFiles ignorePackage + + getPkgName = \case + Local _ -> Nothing + FromDep pkgName _ -> Just pkgName + + readFileAs :: + (MonadIO m) => + InPackage FilePath -> + m (InPackage FilePath, Text) + readFileAs fi = + liftIO . fmap (fi,) $ readUTF8FileT (ignorePackage fi) diff --git a/src/Language/PureScript/Docs/Convert.hs b/src/Language/PureScript/Docs/Convert.hs index a7dc1758c..c4bab8e36 100644 --- a/src/Language/PureScript/Docs/Convert.hs +++ b/src/Language/PureScript/Docs/Convert.hs @@ -1,42 +1,43 @@ --- | Functions for converting PureScript ASTs into values of the data types --- from Language.PureScript.Docs. - -module Language.PureScript.Docs.Convert - ( convertModule - ) where +{- | Functions for converting PureScript ASTs into values of the data types +from Language.PureScript.Docs. +-} +module Language.PureScript.Docs.Convert ( + convertModule, +) where import Protolude hiding (check) import Control.Category ((>>>)) -import Control.Monad.Writer.Strict (runWriterT) import Control.Monad.Supply (evalSupplyT) +import Control.Monad.Writer.Strict (runWriterT) import Data.List.NonEmpty qualified as NE import Data.Map qualified as Map import Data.String (String) import Data.Text qualified as T -import Language.PureScript.Docs.Convert.Single (convertSingleModule) -import Language.PureScript.Docs.Types (Declaration(..), DeclarationInfo(..), KindInfo(..), Module(..), Type') -import Language.PureScript.CST qualified as CST import Language.PureScript.AST qualified as P +import Language.PureScript.CST qualified as CST +import Language.PureScript.Constants.Prim qualified as Prim import Language.PureScript.Crash qualified as P +import Language.PureScript.Docs.Convert.Single (convertSingleModule) +import Language.PureScript.Docs.Types (Declaration (..), DeclarationInfo (..), KindInfo (..), Module (..), Type') +import Language.PureScript.Environment qualified as P import Language.PureScript.Errors qualified as P import Language.PureScript.Externs qualified as P -import Language.PureScript.Environment qualified as P import Language.PureScript.Names qualified as P import Language.PureScript.Roles qualified as P +import Language.PureScript.Sugar (RebracketCaller (CalledByDocs)) import Language.PureScript.Sugar qualified as P +import Language.PureScript.Types (Type (TUnknown)) import Language.PureScript.Types qualified as P -import Language.PureScript.Constants.Prim qualified as Prim -import Language.PureScript.Sugar (RebracketCaller(CalledByDocs)) --- | --- Convert a single module to a Docs.Module, making use of a pre-existing --- type-checking environment in order to fill in any missing types. Note that --- re-exports will not be included. --- +{- | +Convert a single module to a Docs.Module, making use of a pre-existing +type-checking environment in order to fill in any missing types. Note that +re-exports will not be included. +-} convertModule :: - MonadError P.MultipleErrors m => + (MonadError P.MultipleErrors m) => [P.ExternsFile] -> P.Env -> P.Environment -> @@ -45,202 +46,200 @@ convertModule :: convertModule externs env checkEnv = fmap (insertValueTypesAndAdjustKinds checkEnv . convertSingleModule) . partiallyDesugar externs env --- | --- Convert FFI declarations into `DataDeclaration` so that the declaration's --- roles (if any) can annotate the generated type parameter names. --- --- Inserts all data declarations inferred roles if none were specified --- explicitly. --- --- Updates all the types of the ValueDeclarations inside the module based on --- their types inside the given Environment. --- --- Removes explicit kind signatures if they are "uninteresting." --- --- Inserts inferred kind signatures into the corresponding declarations --- if no kind signature was declared explicitly and the kind --- signature is "interesting." --- +{- | +Convert FFI declarations into `DataDeclaration` so that the declaration's +roles (if any) can annotate the generated type parameter names. + +Inserts all data declarations inferred roles if none were specified +explicitly. + +Updates all the types of the ValueDeclarations inside the module based on +their types inside the given Environment. + +Removes explicit kind signatures if they are "uninteresting." + +Inserts inferred kind signatures into the corresponding declarations +if no kind signature was declared explicitly and the kind +signature is "interesting." +-} insertValueTypesAndAdjustKinds :: P.Environment -> Module -> Module insertValueTypesAndAdjustKinds env m = - m { modDeclarations = map (go . insertInferredRoles . convertFFIDecl) (modDeclarations m) } + m {modDeclarations = map (go . insertInferredRoles . convertFFIDecl) (modDeclarations m)} where - -- Convert FFI declarations into data declaration - -- by generating the type parameters' names based on its kind signature. - -- Note: `Prim` modules' docs don't go through this conversion process - -- so `ExternDataDeclaration` values will still exist beyond this point. - convertFFIDecl d@Declaration { declInfo = ExternDataDeclaration kind roles } = - d { declInfo = DataDeclaration P.Data (genTypeParams kind) roles - , declKind = Just (KindInfo P.DataSig kind) - } - - convertFFIDecl other = other - - insertInferredRoles d@Declaration { declInfo = DataDeclaration dataDeclType args [] } = - d { declInfo = DataDeclaration dataDeclType args inferredRoles } - - where - inferredRoles :: [P.Role] - inferredRoles = do - let key = P.Qualified (P.ByModuleName (modName m)) (P.ProperName (declTitle d)) - case Map.lookup key (P.types env) of - Just (_, tyKind) -> case tyKind of - P.DataType _ tySourceTyRole _ -> - map (\(_,_,r) -> r) tySourceTyRole - P.ExternData rs -> - rs + -- Convert FFI declarations into data declaration + -- by generating the type parameters' names based on its kind signature. + -- Note: `Prim` modules' docs don't go through this conversion process + -- so `ExternDataDeclaration` values will still exist beyond this point. + convertFFIDecl d@Declaration {declInfo = ExternDataDeclaration kind roles} = + d + { declInfo = DataDeclaration P.Data (genTypeParams kind) roles + , declKind = Just (KindInfo P.DataSig kind) + } + convertFFIDecl other = other + + insertInferredRoles d@Declaration {declInfo = DataDeclaration dataDeclType args []} = + d {declInfo = DataDeclaration dataDeclType args inferredRoles} + where + inferredRoles :: [P.Role] + inferredRoles = do + let key = P.Qualified (P.ByModuleName (modName m)) (P.ProperName (declTitle d)) + case Map.lookup key (P.types env) of + Just (_, tyKind) -> case tyKind of + P.DataType _ tySourceTyRole _ -> + map (\(_, _, r) -> r) tySourceTyRole + P.ExternData rs -> + rs + _ -> + [] + Nothing -> + err $ "type not found: " <> show key + insertInferredRoles other = + other + + -- Given an FFI declaration like this + -- ``` + -- foreign import data Foo + -- :: forall a b c d + -- . MyKind a b + -- -> OtherKind c d + -- -> Symbol + -- -> (Type -> Type) + -- -> (Type) -- unneeded parens a developer typo + -- -> Type + -- ``` + -- Return a list of values, one for each implicit type parameter + -- of `(tX, Nothing)` where `X` refers to the index of he parameter + -- in that list, matching the values expected by `Render.toTypeVar` + genTypeParams :: Type' -> [(Text, Type')] + genTypeParams kind = do + let n = countParams 0 kind + map (\(i :: Int) -> ("t" <> T.pack (show i), TUnknown () i)) $ take n [0 ..] -- REVIEW: Is TUnknown ok? + where + countParams :: Int -> Type' -> Int + countParams acc = \case + P.ForAll _ _ _ _ rest _ -> + countParams acc rest + P.TypeApp _ f a + | isFunctionApplication f -> + countParams (acc + 1) a + P.ParensInType _ ty -> + countParams acc ty _ -> - [] + acc + + isFunctionApplication = \case + P.TypeApp _ (P.TypeConstructor () Prim.Function) _ -> True + P.ParensInType _ ty -> isFunctionApplication ty + _ -> False + + -- insert value types + go d@Declaration {declInfo = ValueDeclaration P.TypeWildcard {}} = + let + ident = P.Ident . CST.getIdent . CST.nameValue . parseIdent $ declTitle d + ty = lookupName ident + in + d {declInfo = ValueDeclaration (ty $> ())} + go d@Declaration {..} | Just keyword <- extractKeyword declInfo = + case declKind of + Just ks -> + -- hide explicit kind signatures that are "uninteresting" + if isUninteresting keyword $ kiKind ks + then d {declKind = Nothing} + else d Nothing -> - err $ "type not found: " <> show key - - insertInferredRoles other = - other - - -- Given an FFI declaration like this - -- ``` - -- foreign import data Foo - -- :: forall a b c d - -- . MyKind a b - -- -> OtherKind c d - -- -> Symbol - -- -> (Type -> Type) - -- -> (Type) -- unneeded parens a developer typo - -- -> Type - -- ``` - -- Return a list of values, one for each implicit type parameter - -- of `(tX, Nothing)` where `X` refers to the index of he parameter - -- in that list, matching the values expected by `Render.toTypeVar` - genTypeParams :: Type' -> [(Text, Maybe Type')] - genTypeParams kind = do - let n = countParams 0 kind - map (\(i :: Int) -> ("t" <> T.pack (show i), Nothing)) $ take n [0..] - where - countParams :: Int -> Type' -> Int - countParams acc = \case - P.ForAll _ _ _ _ rest _ -> - countParams acc rest - - P.TypeApp _ f a | isFunctionApplication f -> - countParams (acc + 1) a - - P.ParensInType _ ty -> - countParams acc ty - - _ -> - acc - - isFunctionApplication = \case - P.TypeApp _ (P.TypeConstructor () Prim.Function) _ -> True - P.ParensInType _ ty -> isFunctionApplication ty - _ -> False - - -- insert value types - go d@Declaration { declInfo = ValueDeclaration P.TypeWildcard{} } = - let - ident = P.Ident . CST.getIdent . CST.nameValue . parseIdent $ declTitle d - ty = lookupName ident - in - d { declInfo = ValueDeclaration (ty $> ()) } - - go d@Declaration{..} | Just keyword <- extractKeyword declInfo = - case declKind of - Just ks -> - -- hide explicit kind signatures that are "uninteresting" - if isUninteresting keyword $ kiKind ks - then d { declKind = Nothing } - else d - Nothing -> - -- insert inferred kinds so long as they are "interesting" - insertInferredKind d declTitle keyword - - go other = - other - - parseIdent = - either (err . ("failed to parse Ident: " ++)) identity . runParser CST.parseIdent - - lookupName name = - let key = P.Qualified (P.ByModuleName (modName m)) name - in case Map.lookup key (P.names env) of - Just (ty, _, _) -> - ty - Nothing -> - err ("name not found: " ++ show key) - - -- Extracts the keyword for a declaration (if there is one) - extractKeyword :: DeclarationInfo -> Maybe P.KindSignatureFor - extractKeyword = \case - DataDeclaration dataDeclType _ _ -> Just $ case dataDeclType of - P.Data -> P.DataSig - P.Newtype -> P.NewtypeSig - TypeSynonymDeclaration _ _ -> Just P.TypeSynonymSig - TypeClassDeclaration _ _ _ -> Just P.ClassSig - _ -> Nothing - - -- Returns True if the kind signature is "uninteresting", which - -- is a kind that follows this form: - -- - `Type` - -- - `Constraint` (class declaration only) - -- - `Type -> K` where `K` is an "uninteresting" kind - isUninteresting - :: P.KindSignatureFor -> Type' -> Bool - isUninteresting keyword = \case - -- `Type -> ...` - P.TypeApp _ f a | isTypeAppFunctionType f -> isUninteresting keyword a - P.ParensInType _ ty -> isUninteresting keyword ty - x -> isKindPrimType x || (isClassKeyword && isKindPrimConstraint x) - where - isClassKeyword = case keyword of - P.ClassSig -> True - _ -> False - - isTypeAppFunctionType = \case - P.TypeApp _ f a -> isKindFunction f && isKindPrimType a - P.ParensInType _ ty -> isTypeAppFunctionType ty - _ -> False - - isKindFunction = isTypeConstructor Prim.Function - isKindPrimType = isTypeConstructor Prim.Type - isKindPrimConstraint = isTypeConstructor Prim.Constraint - - isTypeConstructor k = \case - P.TypeConstructor _ k' -> k' == k - P.ParensInType _ ty -> isTypeConstructor k ty - _ -> False - - insertInferredKind :: Declaration -> Text -> P.KindSignatureFor -> Declaration - insertInferredKind d name keyword = - let - key = P.Qualified (P.ByModuleName (modName m)) (P.ProperName name) - in case Map.lookup key (P.types env) of - Just (inferredKind, _) -> - if isUninteresting keyword inferredKind' - then d - else d { declKind = Just $ KindInfo - { kiKeyword = keyword - , kiKind = dropTypeSortAnnotation inferredKind' - } + -- insert inferred kinds so long as they are "interesting" + insertInferredKind d declTitle keyword + go other = + other + + parseIdent = + either (err . ("failed to parse Ident: " ++)) identity . runParser CST.parseIdent + + lookupName name = + let key = P.Qualified (P.ByModuleName (modName m)) name + in case Map.lookup key (P.names env) of + Just (ty, _, _) -> + ty + Nothing -> + err ("name not found: " ++ show key) + + -- Extracts the keyword for a declaration (if there is one) + extractKeyword :: DeclarationInfo -> Maybe P.KindSignatureFor + extractKeyword = \case + DataDeclaration dataDeclType _ _ -> Just $ case dataDeclType of + P.Data -> P.DataSig + P.Newtype -> P.NewtypeSig + TypeSynonymDeclaration _ _ -> Just P.TypeSynonymSig + TypeClassDeclaration _ _ _ -> Just P.ClassSig + _ -> Nothing + + -- Returns True if the kind signature is "uninteresting", which + -- is a kind that follows this form: + -- - `Type` + -- - `Constraint` (class declaration only) + -- - `Type -> K` where `K` is an "uninteresting" kind + isUninteresting :: + P.KindSignatureFor -> Type' -> Bool + isUninteresting keyword = \case + -- `Type -> ...` + P.TypeApp _ f a | isTypeAppFunctionType f -> isUninteresting keyword a + P.ParensInType _ ty -> isUninteresting keyword ty + x -> isKindPrimType x || (isClassKeyword && isKindPrimConstraint x) + where + isClassKeyword = case keyword of + P.ClassSig -> True + _ -> False + + isTypeAppFunctionType = \case + P.TypeApp _ f a -> isKindFunction f && isKindPrimType a + P.ParensInType _ ty -> isTypeAppFunctionType ty + _ -> False + + isKindFunction = isTypeConstructor Prim.Function + isKindPrimType = isTypeConstructor Prim.Type + isKindPrimConstraint = isTypeConstructor Prim.Constraint + + isTypeConstructor k = \case + P.TypeConstructor _ k' -> k' == k + P.ParensInType _ ty -> isTypeConstructor k ty + _ -> False + + insertInferredKind :: Declaration -> Text -> P.KindSignatureFor -> Declaration + insertInferredKind d name keyword = + let + key = P.Qualified (P.ByModuleName (modName m)) (P.ProperName name) + in + case Map.lookup key (P.types env) of + Just (inferredKind, _) -> + if isUninteresting keyword inferredKind' + then d + else + d + { declKind = + Just $ + KindInfo + { kiKeyword = keyword + , kiKind = dropTypeSortAnnotation inferredKind' + } } - where - inferredKind' = inferredKind $> () - - -- Note: the below change to the final kind used is intentionally - -- NOT being done for explicit kind signatures: - -- - -- changes `forall (k :: Type). k -> ...` - -- to `forall k . k -> ...` - dropTypeSortAnnotation = \case - P.ForAll sa vis txt (Just (P.TypeConstructor _ Prim.Type)) rest skol -> - P.ForAll sa vis txt Nothing (dropTypeSortAnnotation rest) skol - rest -> rest - - Nothing -> - err ("type not found: " ++ show key) - - err msg = - P.internalError ("Docs.Convert.insertValueTypes: " ++ msg) + where + inferredKind' = inferredKind $> () + + -- Note: the below change to the final kind used is intentionally + -- NOT being done for explicit kind signatures: + -- + -- changes `forall (k :: Type). k -> ...` + -- to `forall k . k -> ...` + dropTypeSortAnnotation = \case + P.ForAll sa vis txt (P.TypeConstructor a Prim.Type) rest skol -> + P.ForAll sa vis txt (P.TypeConstructor a Prim.Type) (dropTypeSortAnnotation rest) skol + rest -> rest + Nothing -> + err ("type not found: " ++ show key) + + err msg = + P.internalError ("Docs.Convert.insertValueTypes: " ++ msg) runParser :: CST.Parser a -> Text -> Either String a runParser p = @@ -248,10 +247,10 @@ runParser p = . CST.runTokenParser p . CST.lex --- | --- Partially desugar modules so that they are suitable for extracting --- documentation information from. --- +{- | +Partially desugar modules so that they are suitable for extracting +documentation information from. +-} partiallyDesugar :: (MonadError P.MultipleErrors m) => [P.ExternsFile] -> @@ -260,14 +259,17 @@ partiallyDesugar :: m P.Module partiallyDesugar externs env = evalSupplyT 0 . desugar' where - desugar' = - P.desugarDoModule - >=> P.desugarAdoModule - >=> P.desugarLetPatternModule - >>> P.desugarCasesModule - >=> P.desugarTypeDeclarationsModule - >=> fmap fst . runWriterT . flip evalStateT (env, mempty) . P.desugarImports - >=> P.rebracketFiltered CalledByDocs isInstanceDecl externs - - isInstanceDecl P.TypeInstanceDeclaration {} = True - isInstanceDecl _ = False + desugar' = + P.desugarDoModule + >=> P.desugarAdoModule + >=> P.desugarLetPatternModule + >>> P.desugarCasesModule + >=> P.desugarTypeDeclarationsModule + >=> fmap fst + . runWriterT + . flip evalStateT (env, mempty) + . P.desugarImports + >=> P.rebracketFiltered CalledByDocs isInstanceDecl externs + + isInstanceDecl P.TypeInstanceDeclaration {} = True + isInstanceDecl _ = False diff --git a/src/Language/PureScript/Docs/Convert/ReExports.hs b/src/Language/PureScript/Docs/Convert/ReExports.hs index 600b343a5..6fd5a16df 100644 --- a/src/Language/PureScript/Docs/Convert/ReExports.hs +++ b/src/Language/PureScript/Docs/Convert/ReExports.hs @@ -1,10 +1,10 @@ -module Language.PureScript.Docs.Convert.ReExports - ( updateReExports - ) where +module Language.PureScript.Docs.Convert.ReExports ( + updateReExports, +) where import Prelude -import Control.Arrow ((&&&), first, second) +import Control.Arrow (first, second, (&&&)) import Control.Monad (foldM, (<=<)) import Control.Monad.Reader.Class (MonadReader, ask) import Control.Monad.State.Class (MonadState, gets, modify) @@ -14,8 +14,8 @@ import Control.Monad.Trans.State.Strict (execState) import Data.Either (partitionEithers) import Data.Foldable (fold, traverse_) import Data.Map (Map) -import Data.Maybe (mapMaybe) import Data.Map qualified as Map +import Data.Maybe (mapMaybe) import Data.Text (Text) import Data.Text qualified as T @@ -29,17 +29,16 @@ import Language.PureScript.ModuleDependencies qualified as P import Language.PureScript.Names qualified as P import Language.PureScript.Types qualified as P +{- | +Given: --- | --- Given: --- --- * A list of externs files --- * A function for tagging a module with the package it comes from --- * A map of modules, indexed by their names, which are assumed to not --- have their re-exports listed yet --- --- This function adds all the missing re-exports. --- + * A list of externs files + * A function for tagging a module with the package it comes from + * A map of modules, indexed by their names, which are assumed to not + have their re-exports listed yet + +This function adds all the missing re-exports. +-} updateReExports :: [P.ExternsFile] -> (P.ModuleName -> InPackage P.ModuleName) -> @@ -47,49 +46,50 @@ updateReExports :: Map P.ModuleName Module updateReExports externs withPackage = execState action where - action = - traverse_ go traversalOrder - - go mn = do - mdl <- lookup' mn - reExports <- getReExports externsEnv mn - let mdl' = mdl { modReExports = map (first withPackage) reExports } - modify (Map.insert mn mdl') - - lookup' mn = do - v <- gets (Map.lookup mn) - case v of - Just v' -> - pure v' - Nothing -> - internalError ("Module missing: " ++ T.unpack (P.runModuleName mn)) - - externsEnv :: Map P.ModuleName P.ExternsFile - externsEnv = Map.fromList $ map (P.efModuleName &&& id) externs - - traversalOrder :: [P.ModuleName] - traversalOrder = - case P.sortModules P.Transitive externsSignature externs of - Right (es, _) -> map P.efModuleName es - Left errs -> internalError $ - "failed to sortModules: " ++ - P.prettyPrintMultipleErrors P.defaultPPEOptions errs - - externsSignature :: P.ExternsFile -> P.ModuleSignature - externsSignature ef = - P.ModuleSignature - { P.sigSourceSpan = P.efSourceSpan ef - , P.sigModuleName = P.efModuleName ef - , P.sigImports = map (\ei -> (P.eiModule ei, P.nullSourceSpan)) (P.efImports ef) - } - --- | --- Collect all of the re-exported declarations for a single module. --- --- We require that modules have already been sorted (P.sortModules) in order to --- ensure that by the time we convert a particular module, all its dependencies --- have already been converted. --- + action = + traverse_ go traversalOrder + + go mn = do + mdl <- lookup' mn + reExports <- getReExports externsEnv mn + let mdl' = mdl {modReExports = map (first withPackage) reExports} + modify (Map.insert mn mdl') + + lookup' mn = do + v <- gets (Map.lookup mn) + case v of + Just v' -> + pure v' + Nothing -> + internalError ("Module missing: " ++ T.unpack (P.runModuleName mn)) + + externsEnv :: Map P.ModuleName P.ExternsFile + externsEnv = Map.fromList $ map (P.efModuleName &&& id) externs + + traversalOrder :: [P.ModuleName] + traversalOrder = + case P.sortModules P.Transitive externsSignature externs of + Right (es, _) -> map P.efModuleName es + Left errs -> + internalError $ + "failed to sortModules: " + ++ P.prettyPrintMultipleErrors P.defaultPPEOptions errs + + externsSignature :: P.ExternsFile -> P.ModuleSignature + externsSignature ef = + P.ModuleSignature + { P.sigSourceSpan = P.efSourceSpan ef + , P.sigModuleName = P.efModuleName ef + , P.sigImports = map (\ei -> (P.eiModule ei, P.nullSourceSpan)) (P.efImports ef) + } + +{- | +Collect all of the re-exported declarations for a single module. + +We require that modules have already been sorted (P.sortModules) in order to +ensure that by the time we convert a particular module, all its dependencies +have already been converted. +-} getReExports :: (MonadState (Map P.ModuleName Module) m) => Map P.ModuleName P.ExternsFile -> @@ -99,7 +99,7 @@ getReExports externsEnv mn = case Map.lookup mn externsEnv of Nothing -> internalError ("Module missing: " ++ T.unpack (P.runModuleName mn)) - Just P.ExternsFile { P.efExports = refs } -> do + Just P.ExternsFile {P.efExports = refs} -> do let reExpRefs = mapMaybe toReExportRef refs runReaderT (collectDeclarations reExpRefs) mn @@ -107,26 +107,27 @@ toReExportRef :: P.DeclarationRef -> Maybe (P.ExportSource, P.DeclarationRef) toReExportRef (P.ReExportRef _ source ref) = Just (source, ref) toReExportRef _ = Nothing --- | --- Assemble a list of declarations re-exported from a particular module, based --- on the Imports and Exports value for that module, and by extracting the --- declarations from the current state. --- --- This function works by searching through the lists of exported declarations --- in the Exports, and looking them up in the associated Imports value to find --- the module they were imported from. --- --- Additionally: --- --- * Attempts to move re-exported type class members under their parent --- type classes, if possible, or otherwise, "promote" them from --- ChildDeclarations to proper Declarations. --- * Filters data declarations to ensure that only re-exported data --- constructors are listed. --- * Filters type class declarations to ensure that only re-exported type --- class members are listed. --- -collectDeclarations :: forall m. +{- | +Assemble a list of declarations re-exported from a particular module, based +on the Imports and Exports value for that module, and by extracting the +declarations from the current state. + +This function works by searching through the lists of exported declarations +in the Exports, and looking them up in the associated Imports value to find +the module they were imported from. + +Additionally: + + * Attempts to move re-exported type class members under their parent + type classes, if possible, or otherwise, "promote" them from + ChildDeclarations to proper Declarations. + * Filters data declarations to ensure that only re-exported data + constructors are listed. + * Filters type class declarations to ensure that only re-exported type + class members are listed. +-} +collectDeclarations :: + forall m. (MonadState (Map P.ModuleName Module) m, MonadReader P.ModuleName m) => [(P.ExportSource, P.DeclarationRef)] -> m [(P.ModuleName, [Declaration])] @@ -143,45 +144,44 @@ collectDeclarations reExports = do let filteredClasses = filterTypeClassMembers (Map.keys expVals) classes pure (Map.toList (Map.unionsWith (<>) [filteredTypes, filteredClasses, vals, valOps, typeOps])) - where + collect :: + (P.ModuleName -> a -> m (P.ModuleName, [b])) -> + Map a P.ExportSource -> + m (Map P.ModuleName [b]) + collect lookup' exps = do + let reExps = Map.toList $ Map.mapMaybe P.exportSourceImportedFrom exps + decls <- traverse (uncurry (flip lookup')) reExps + return $ Map.fromListWith (<>) decls - collect - :: (P.ModuleName -> a -> m (P.ModuleName, [b])) - -> Map a P.ExportSource - -> m (Map P.ModuleName [b]) - collect lookup' exps = do - let reExps = Map.toList $ Map.mapMaybe P.exportSourceImportedFrom exps - decls <- traverse (uncurry (flip lookup')) reExps - return $ Map.fromListWith (<>) decls - - expVals :: Map P.Ident P.ExportSource - expVals = mkExportMap P.getValueRef + expVals :: Map P.Ident P.ExportSource + expVals = mkExportMap P.getValueRef - expValOps :: Map (P.OpName 'P.ValueOpName) P.ExportSource - expValOps = mkExportMap P.getValueOpRef + expValOps :: Map (P.OpName 'P.ValueOpName) P.ExportSource + expValOps = mkExportMap P.getValueOpRef - expTCs :: Map (P.ProperName 'P.ClassName) P.ExportSource - expTCs = mkExportMap P.getTypeClassRef + expTCs :: Map (P.ProperName 'P.ClassName) P.ExportSource + expTCs = mkExportMap P.getTypeClassRef - expTypes :: Map (P.ProperName 'P.TypeName) P.ExportSource - expTypes = mkExportMap (fmap fst . P.getTypeRef) + expTypes :: Map (P.ProperName 'P.TypeName) P.ExportSource + expTypes = mkExportMap (fmap fst . P.getTypeRef) - expTypeOps :: Map (P.OpName 'P.TypeOpName) P.ExportSource - expTypeOps = mkExportMap P.getTypeOpRef + expTypeOps :: Map (P.OpName 'P.TypeOpName) P.ExportSource + expTypeOps = mkExportMap P.getTypeOpRef - mkExportMap :: Ord name => (P.DeclarationRef -> Maybe name) -> Map name P.ExportSource - mkExportMap f = - Map.fromList $ - mapMaybe (\(exportSrc, ref) -> (,exportSrc) <$> f ref) reExports + mkExportMap :: (Ord name) => (P.DeclarationRef -> Maybe name) -> Map name P.ExportSource + mkExportMap f = + Map.fromList $ + mapMaybe (\(exportSrc, ref) -> (,exportSrc) <$> f ref) reExports - expCtors :: [P.ProperName 'P.ConstructorName] - expCtors = concatMap (fold . (snd <=< P.getTypeRef . snd)) reExports + expCtors :: [P.ProperName 'P.ConstructorName] + expCtors = concatMap (fold . (snd <=< P.getTypeRef . snd)) reExports lookupValueDeclaration :: forall m. - (MonadState (Map P.ModuleName Module) m, - MonadReader P.ModuleName m) => + ( MonadState (Map P.ModuleName Module) m + , MonadReader P.ModuleName m + ) => P.ModuleName -> P.Ident -> m (P.ModuleName, [Either (Text, Constraint', ChildDeclaration) Declaration]) @@ -189,15 +189,25 @@ lookupValueDeclaration importedFrom ident = do decls <- lookupModuleDeclarations "lookupValueDeclaration" importedFrom let rs = - filter (\d -> declTitle d == P.showIdent ident - && (isValue d || isValueAlias d)) decls - errOther :: Show a => a -> m b + filter + ( \d -> + declTitle d == P.showIdent ident + && (isValue d || isValueAlias d) + ) + decls + errOther :: (Show a) => a -> m b errOther other = internalErrorInModule - ("lookupValueDeclaration: unexpected result:\n" ++ - "other: " ++ show other ++ "\n" ++ - "ident: " ++ show ident ++ "\n" ++ - "decls: " ++ show decls) + ( "lookupValueDeclaration: unexpected result:\n" + ++ "other: " + ++ show other + ++ "\n" + ++ "ident: " + ++ show ident + ++ "\n" + ++ "decls: " + ++ show decls + ) case rs of [r] -> @@ -210,34 +220,35 @@ lookupValueDeclaration importedFrom ident = do let allTypeClassChildDecls = decls - |> mapMaybe (\d -> (d,) <$> typeClassConstraintFor d) - |> concatMap (\(d, constr) -> - map (declTitle d, constr,) - (declChildren d)) + |> mapMaybe (\d -> (d,) <$> typeClassConstraintFor d) + |> concatMap + ( \(d, constr) -> + map + (declTitle d,constr,) + (declChildren d) + ) matchesIdent cdecl = cdeclTitle cdecl == P.showIdent ident matchesAndIsTypeClassMember = uncurry (&&) . (matchesIdent &&& isTypeClassMember) - - in + in case filter (matchesAndIsTypeClassMember . thd) allTypeClassChildDecls of [r'] -> pure (importedFrom, [Left r']) other -> errOther other other -> errOther other - where - thd :: (a, b, c) -> c - thd (_, _, x) = x - -lookupValueOpDeclaration - :: (MonadState (Map P.ModuleName Module) m, MonadReader P.ModuleName m) - => P.ModuleName - -> P.OpName 'P.ValueOpName - -> m (P.ModuleName, [Declaration]) + thd :: (a, b, c) -> c + thd (_, _, x) = x + +lookupValueOpDeclaration :: + (MonadState (Map P.ModuleName Module) m, MonadReader P.ModuleName m) => + P.ModuleName -> + P.OpName 'P.ValueOpName -> + m (P.ModuleName, [Declaration]) lookupValueOpDeclaration importedFrom op = do decls <- lookupModuleDeclarations "lookupValueOpDeclaration" importedFrom case filter (\d -> declTitle d == P.showOp op && isValueAlias d) decls of @@ -247,13 +258,14 @@ lookupValueOpDeclaration importedFrom op = do internalErrorInModule ("lookupValueOpDeclaration: unexpected result for: " ++ show other) --- | --- Extract a particular type declaration. For data declarations, constructors --- are only included in the output if they are listed in the arguments. --- +{- | +Extract a particular type declaration. For data declarations, constructors +are only included in the output if they are listed in the arguments. +-} lookupTypeDeclaration :: - (MonadState (Map P.ModuleName Module) m, - MonadReader P.ModuleName m) => + ( MonadState (Map P.ModuleName Module) m + , MonadReader P.ModuleName m + ) => P.ModuleName -> P.ProperName 'P.TypeName -> m (P.ModuleName, [Declaration]) @@ -264,21 +276,22 @@ lookupTypeDeclaration importedFrom ty = do case ds of [d] -> pure (importedFrom, [d]) - [] | P.isBuiltinModuleName importedFrom -> - -- Type classes in builtin modules (i.e. submodules of Prim) also have - -- corresponding pseudo-types in the primEnv, but since these are an - -- implementation detail they do not exist in the Modules, and hence in - -- this case, `ds` will be empty. - pure (importedFrom, []) + [] + | P.isBuiltinModuleName importedFrom -> + -- Type classes in builtin modules (i.e. submodules of Prim) also have + -- corresponding pseudo-types in the primEnv, but since these are an + -- implementation detail they do not exist in the Modules, and hence in + -- this case, `ds` will be empty. + pure (importedFrom, []) other -> internalErrorInModule ("lookupTypeDeclaration: unexpected result for " ++ show ty ++ ": " ++ show other) -lookupTypeOpDeclaration - :: (MonadState (Map P.ModuleName Module) m,MonadReader P.ModuleName m) - => P.ModuleName - -> P.OpName 'P.TypeOpName - -> m (P.ModuleName, [Declaration]) +lookupTypeOpDeclaration :: + (MonadState (Map P.ModuleName Module) m, MonadReader P.ModuleName m) => + P.ModuleName -> + P.OpName 'P.TypeOpName -> + m (P.ModuleName, [Declaration]) lookupTypeOpDeclaration importedFrom tyOp = do decls <- lookupModuleDeclarations "lookupTypeOpDeclaration" importedFrom let @@ -290,33 +303,40 @@ lookupTypeOpDeclaration importedFrom tyOp = do internalErrorInModule ("lookupTypeOpDeclaration: unexpected result: " ++ show other) -lookupTypeClassDeclaration - :: (MonadState (Map P.ModuleName Module) m, MonadReader P.ModuleName m) - => P.ModuleName - -> P.ProperName 'P.ClassName - -> m (P.ModuleName, [Declaration]) +lookupTypeClassDeclaration :: + (MonadState (Map P.ModuleName Module) m, MonadReader P.ModuleName m) => + P.ModuleName -> + P.ProperName 'P.ClassName -> + m (P.ModuleName, [Declaration]) lookupTypeClassDeclaration importedFrom tyClass = do decls <- lookupModuleDeclarations "lookupTypeClassDeclaration" importedFrom let - ds = filter (\d -> declTitle d == P.runProperName tyClass - && isTypeClass d) - decls + ds = + filter + ( \d -> + declTitle d == P.runProperName tyClass + && isTypeClass d + ) + decls case ds of [d] -> pure (importedFrom, [d]) other -> internalErrorInModule - ("lookupTypeClassDeclaration: unexpected result for " - ++ show tyClass ++ ": " - ++ (unlines . map show) other) - --- | --- Get the full list of declarations for a particular module out of the --- state, or raise an internal error if it is not there. --- + ( "lookupTypeClassDeclaration: unexpected result for " + ++ show tyClass + ++ ": " + ++ (unlines . map show) other + ) + +{- | +Get the full list of declarations for a particular module out of the +state, or raise an internal error if it is not there. +-} lookupModuleDeclarations :: - (MonadState (Map P.ModuleName Module) m, - MonadReader P.ModuleName m) => + ( MonadState (Map P.ModuleName Module) m + , MonadReader P.ModuleName m + ) => String -> P.ModuleName -> m [Declaration] @@ -325,8 +345,10 @@ lookupModuleDeclarations definedIn moduleName = do case mmdl of Nothing -> internalErrorInModule - (definedIn ++ ": module missing: " - ++ T.unpack (P.runModuleName moduleName)) + ( definedIn + ++ ": module missing: " + ++ T.unpack (P.runModuleName moduleName) + ) Just mdl -> pure (allDeclarations mdl) @@ -338,10 +360,11 @@ handleTypeClassMembers :: handleTypeClassMembers valsAndMembers typeClasses = let moduleEnvs = - Map.unionWith (<>) + Map.unionWith + (<>) (fmap valsAndMembersToEnv valsAndMembers) (fmap typeClassesToEnv typeClasses) - in + in moduleEnvs |> traverse handleEnv |> fmap splitMap @@ -351,7 +374,7 @@ valsAndMembersToEnv :: valsAndMembersToEnv xs = let (envUnhandledMembers, envValues) = partitionEithers xs envTypeClasses = [] - in TypeClassEnv{..} + in TypeClassEnv {..} typeClassesToEnv :: [Declaration] -> TypeClassEnv typeClassesToEnv classes = @@ -361,28 +384,25 @@ typeClassesToEnv classes = , envTypeClasses = classes } --- | --- An intermediate data type, used for either moving type class members under --- their parent type classes, or promoting them to normal Declaration values --- if their parent type class has not been re-exported. --- +{- | +An intermediate data type, used for either moving type class members under +their parent type classes, or promoting them to normal Declaration values +if their parent type class has not been re-exported. +-} data TypeClassEnv = TypeClassEnv - { -- | - -- Type class members which have not yet been dealt with. The Text is the - -- name of the type class they belong to, and the constraint is used to - -- make sure that they have the correct type if they get promoted. - -- - envUnhandledMembers :: [(Text, Constraint', ChildDeclaration)] - -- | - -- A list of normal value declarations. Type class members will be added to - -- this list if their parent type class is not available. - -- + { envUnhandledMembers :: [(Text, Constraint', ChildDeclaration)] + -- ^ + -- Type class members which have not yet been dealt with. The Text is the + -- name of the type class they belong to, and the constraint is used to + -- make sure that they have the correct type if they get promoted. , envValues :: [Declaration] - -- | - -- A list of type class declarations. Type class members will be added to - -- their parents in this list, if they exist. - -- + -- ^ + -- A list of normal value declarations. Type class members will be added to + -- this list if their parent type class is not available. , envTypeClasses :: [Declaration] + -- ^ + -- A list of type class declarations. Type class members will be added to + -- their parents in this list, if they exist. } deriving (Show) @@ -394,97 +414,98 @@ instance Monoid TypeClassEnv where mempty = TypeClassEnv mempty mempty mempty --- | --- Take a TypeClassEnv and handle all of the type class members in it, either --- adding them to their parent classes, or promoting them to normal Declaration --- values. --- --- Returns a tuple of (values, type classes). --- -handleEnv - :: (MonadReader P.ModuleName m) - => TypeClassEnv - -> m ([Declaration], [Declaration]) -handleEnv TypeClassEnv{..} = +{- | +Take a TypeClassEnv and handle all of the type class members in it, either +adding them to their parent classes, or promoting them to normal Declaration +values. + +Returns a tuple of (values, type classes). +-} +handleEnv :: + (MonadReader P.ModuleName m) => + TypeClassEnv -> + m ([Declaration], [Declaration]) +handleEnv TypeClassEnv {..} = envUnhandledMembers |> foldM go (envValues, mkMap envTypeClasses) |> fmap (second Map.elems) - where - mkMap = - Map.fromList . map (declTitle &&& id) - - go (values, tcs) (title, constraint, childDecl) = - case Map.lookup title tcs of - Just _ -> - -- Leave the state unchanged; if the type class is there, the child - -- will be too. - pure (values, tcs) - Nothing -> do - c <- promoteChild constraint childDecl - pure (c : values, tcs) - - promoteChild constraint ChildDeclaration{..} = - case cdeclInfo of - ChildTypeClassMember typ -> - pure Declaration - { declTitle = cdeclTitle - , declComments = cdeclComments - , declSourceSpan = cdeclSourceSpan - , declChildren = [] - , declInfo = ValueDeclaration (addConstraint constraint typ) - , declKind = Nothing - } - _ -> - internalErrorInModule - ("handleEnv: Bad child declaration passed to promoteChild: " - ++ T.unpack cdeclTitle) - - addConstraint constraint = - P.quantify . P.moveQuantifiersToFront () . P.ConstrainedType () constraint + mkMap = + Map.fromList . map (declTitle &&& id) + + go (values, tcs) (title, constraint, childDecl) = + case Map.lookup title tcs of + Just _ -> + -- Leave the state unchanged; if the type class is there, the child + -- will be too. + pure (values, tcs) + Nothing -> do + c <- promoteChild constraint childDecl + pure (c : values, tcs) + + promoteChild constraint ChildDeclaration {..} = + case cdeclInfo of + ChildTypeClassMember typ -> + pure + Declaration + { declTitle = cdeclTitle + , declComments = cdeclComments + , declSourceSpan = cdeclSourceSpan + , declChildren = [] + , declInfo = ValueDeclaration (addConstraint constraint typ) + , declKind = Nothing + } + _ -> + internalErrorInModule + ( "handleEnv: Bad child declaration passed to promoteChild: " + ++ T.unpack cdeclTitle + ) + + addConstraint constraint = + P.quantify . P.moveQuantifiersToFront () . P.ConstrainedType () constraint splitMap :: Map k (v1, v2) -> (Map k v1, Map k v2) splitMap = fmap fst &&& fmap snd --- | --- Given a list of exported constructor names, remove any data constructor --- names in the provided Map of declarations which are not in the list. --- -filterDataConstructors - :: [P.ProperName 'P.ConstructorName] - -> Map P.ModuleName [Declaration] - -> Map P.ModuleName [Declaration] +{- | +Given a list of exported constructor names, remove any data constructor +names in the provided Map of declarations which are not in the list. +-} +filterDataConstructors :: + [P.ProperName 'P.ConstructorName] -> + Map P.ModuleName [Declaration] -> + Map P.ModuleName [Declaration] filterDataConstructors = filterExportedChildren isDataConstructor P.runProperName --- | --- Given a list of exported type class member names, remove any data --- type class member names in the provided Map of declarations which are not in --- the list. --- -filterTypeClassMembers - :: [P.Ident] - -> Map P.ModuleName [Declaration] - -> Map P.ModuleName [Declaration] +{- | +Given a list of exported type class member names, remove any data +type class member names in the provided Map of declarations which are not in +the list. +-} +filterTypeClassMembers :: + [P.Ident] -> + Map P.ModuleName [Declaration] -> + Map P.ModuleName [Declaration] filterTypeClassMembers = filterExportedChildren isTypeClassMember P.showIdent -filterExportedChildren - :: (Functor f) - => (ChildDeclaration -> Bool) - -> (name -> Text) - -> [name] - -> f [Declaration] - -> f [Declaration] +filterExportedChildren :: + (Functor f) => + (ChildDeclaration -> Bool) -> + (name -> Text) -> + [name] -> + f [Declaration] -> + f [Declaration] filterExportedChildren isTargetedKind runName expNames = fmap filterDecls where - filterDecls = - map $ filterChildren $ \c -> - not (isTargetedKind c) || cdeclTitle c `elem` expNames' - expNames' = map runName expNames + filterDecls = + map $ filterChildren $ \c -> + not (isTargetedKind c) || cdeclTitle c `elem` expNames' + expNames' = map runName expNames allDeclarations :: Module -> [Declaration] -allDeclarations Module{..} = +allDeclarations Module {..} = modDeclarations ++ concatMap snd modReExports (|>) :: a -> (a -> b) -> b @@ -493,26 +514,29 @@ x |> f = f x internalError :: String -> a internalError = P.internalError . ("Docs.Convert.ReExports: " ++) -internalErrorInModule - :: (MonadReader P.ModuleName m) - => String - -> m a +internalErrorInModule :: + (MonadReader P.ModuleName m) => + String -> + m a internalErrorInModule msg = do mn <- ask internalError - ("while collecting re-exports for module: " ++ T.unpack (P.runModuleName mn) ++ - ", " ++ msg) - --- | --- If the provided Declaration is a TypeClassDeclaration, construct an --- appropriate Constraint for use with the types of its members. --- + ( "while collecting re-exports for module: " + ++ T.unpack (P.runModuleName mn) + ++ ", " + ++ msg + ) + +{- | +If the provided Declaration is a TypeClassDeclaration, construct an +appropriate Constraint for use with the types of its members. +-} typeClassConstraintFor :: Declaration -> Maybe Constraint' -typeClassConstraintFor Declaration{..} = +typeClassConstraintFor Declaration {..} = case declInfo of TypeClassDeclaration tyArgs _ _ -> Just (P.Constraint () (P.Qualified P.ByNullSourcePos (P.ProperName declTitle)) [] (mkConstraint tyArgs) Nothing) _ -> Nothing where - mkConstraint = map (P.TypeVar () . fst) + mkConstraint = map (uncurry (P.TypeVar ())) diff --git a/src/Language/PureScript/Docs/Convert/Single.hs b/src/Language/PureScript/Docs/Convert/Single.hs index b3b15e7b4..db8c62898 100644 --- a/src/Language/PureScript/Docs/Convert/Single.hs +++ b/src/Language/PureScript/Docs/Convert/Single.hs @@ -1,7 +1,7 @@ -module Language.PureScript.Docs.Convert.Single - ( convertSingleModule - , convertComments - ) where +module Language.PureScript.Docs.Convert.Single ( + convertSingleModule, + convertComments, +) where import Protolude hiding (moduleName) @@ -9,7 +9,7 @@ import Control.Category ((>>>)) import Data.Text qualified as T -import Language.PureScript.Docs.Types (ChildDeclaration(..), ChildDeclarationInfo(..), Declaration(..), DeclarationInfo(..), KindInfo(..), Module(..), Type', convertFundepsToStrings, isType, isTypeClass) +import Language.PureScript.Docs.Types (ChildDeclaration (..), ChildDeclarationInfo (..), Declaration (..), DeclarationInfo (..), KindInfo (..), Module (..), Type', convertFundepsToStrings, isType, isTypeClass) import Language.PureScript.AST qualified as P import Language.PureScript.Comments qualified as P @@ -18,59 +18,61 @@ import Language.PureScript.Names qualified as P import Language.PureScript.Roles qualified as P import Language.PureScript.Types qualified as P --- | --- Convert a single Module, but ignore re-exports; any re-exported types or --- values will not appear in the result. --- +{- | +Convert a single Module, but ignore re-exports; any re-exported types or +values will not appear in the result. +-} convertSingleModule :: P.Module -> Module -convertSingleModule m@(P.Module _ coms moduleName _ _) = +convertSingleModule m@(P.Module _ coms moduleName _ _) = Module moduleName comments (declarations m) [] where - comments = convertComments coms - declarations = - P.exportedDeclarations - >>> mapMaybe (\d -> getDeclarationTitle d >>= convertDeclaration d) - >>> augmentDeclarations + comments = convertComments coms + declarations = + P.exportedDeclarations + >>> mapMaybe (\d -> getDeclarationTitle d >>= convertDeclaration d) + >>> augmentDeclarations -- | Different declarations we can augment data AugmentType - = AugmentClass - -- ^ Augment documentation for a type class - | AugmentType - -- ^ Augment documentation for a type constructor - --- | The data type for an intermediate stage which we go through during --- converting. --- --- In the first pass, we take all top level declarations in the module, and --- collect other information which will later be used to augment the top level --- declarations. These two situation correspond to the Right and Left --- constructors, respectively. --- --- In the second pass, we go over all of the Left values and augment the --- relevant declarations, leaving only the augmented Right values. --- --- Note that in the Left case, we provide a [Text] as well as augment --- information. The [Text] value should be a list of titles of declarations --- that the augmentation should apply to. For example, for a type instance --- declaration, that would be any types or type classes mentioned in the --- instance. For a fixity declaration, it would be just the relevant operator's --- name. -type IntermediateDeclaration - = Either ([(Text, AugmentType)], DeclarationAugment) Declaration - --- | Some data which will be used to augment a Declaration in the --- output. --- --- The AugmentChild constructor allows us to move all children under their --- respective parents. It is only necessary for type instance declarations, --- since they appear at the top level in the AST, and since they might need to --- appear as children in two places (for example, if a data type defined in a --- module is an instance of a type class also defined in that module). --- --- The AugmentKindSig constructor allows us to add a kind signature --- to its corresponding declaration. Comments for both declarations --- are also merged together. + = -- | Augment documentation for a type class + AugmentClass + | -- | Augment documentation for a type constructor + AugmentType + +{- | The data type for an intermediate stage which we go through during +converting. + +In the first pass, we take all top level declarations in the module, and +collect other information which will later be used to augment the top level +declarations. These two situation correspond to the Right and Left +constructors, respectively. + +In the second pass, we go over all of the Left values and augment the +relevant declarations, leaving only the augmented Right values. + +Note that in the Left case, we provide a [Text] as well as augment +information. The [Text] value should be a list of titles of declarations +that the augmentation should apply to. For example, for a type instance +declaration, that would be any types or type classes mentioned in the +instance. For a fixity declaration, it would be just the relevant operator's +name. +-} +type IntermediateDeclaration = + Either ([(Text, AugmentType)], DeclarationAugment) Declaration + +{- | Some data which will be used to augment a Declaration in the +output. + +The AugmentChild constructor allows us to move all children under their +respective parents. It is only necessary for type instance declarations, +since they appear at the top level in the AST, and since they might need to +appear as children in two places (for example, if a data type defined in a +module is an instance of a type class also defined in that module). + +The AugmentKindSig constructor allows us to add a kind signature +to its corresponding declaration. Comments for both declarations +are also merged together. +-} data DeclarationAugment = AugmentChild ChildDeclaration | AugmentKindSig KindSignatureInfo @@ -82,50 +84,54 @@ data KindSignatureInfo = KindSignatureInfo , ksiKind :: Type' } --- | Augment top-level declarations; the second pass. See the comments under --- the type synonym IntermediateDeclaration for more information. +{- | Augment top-level declarations; the second pass. See the comments under +the type synonym IntermediateDeclaration for more information. +-} augmentDeclarations :: [IntermediateDeclaration] -> [Declaration] augmentDeclarations (partitionEithers -> (augments, toplevels)) = foldl' go toplevels augments where - go ds (parentTitles, a) = - map (\d -> - if any (matches d) parentTitles - then augmentWith a d - else d) ds - - matches d (name, AugmentType) = isType d && declTitle d == name - matches d (name, AugmentClass) = isTypeClass d && declTitle d == name - - augmentWith (AugmentChild child) d = - d { declChildren = declChildren d ++ [child] } - augmentWith (AugmentKindSig KindSignatureInfo{..}) d = - d { declComments = mergeComments ksiComments $ declComments d - , declKind = Just $ KindInfo { kiKeyword = ksiKeyword, kiKind = ksiKind } - } - augmentWith (AugmentRole comms roles) d = - d { declComments = mergeComments (declComments d) comms - , declInfo = insertRoles - } - where - insertRoles = case declInfo d of - DataDeclaration dataDeclType args [] -> - DataDeclaration dataDeclType args roles - DataDeclaration _ _ _ -> - P.internalError "augmentWith: could not add a second role declaration to a data declaration" - - ExternDataDeclaration kind [] -> - ExternDataDeclaration kind roles - ExternDataDeclaration _ _ -> - P.internalError "augmentWith: could not add a second role declaration to an FFI declaration" - - _ -> P.internalError "augmentWith: could not add role to declaration" - - mergeComments :: Maybe Text -> Maybe Text -> Maybe Text - mergeComments Nothing bot = bot - mergeComments top Nothing = top - mergeComments (Just topComs) (Just bottomComs) = - Just $ topComs <> "\n" <> bottomComs + go ds (parentTitles, a) = + map + ( \d -> + if any (matches d) parentTitles + then augmentWith a d + else d + ) + ds + + matches d (name, AugmentType) = isType d && declTitle d == name + matches d (name, AugmentClass) = isTypeClass d && declTitle d == name + + augmentWith (AugmentChild child) d = + d {declChildren = declChildren d ++ [child]} + augmentWith (AugmentKindSig KindSignatureInfo {..}) d = + d + { declComments = mergeComments ksiComments $ declComments d + , declKind = Just $ KindInfo {kiKeyword = ksiKeyword, kiKind = ksiKind} + } + augmentWith (AugmentRole comms roles) d = + d + { declComments = mergeComments (declComments d) comms + , declInfo = insertRoles + } + where + insertRoles = case declInfo d of + DataDeclaration dataDeclType args [] -> + DataDeclaration dataDeclType args roles + DataDeclaration _ _ _ -> + P.internalError "augmentWith: could not add a second role declaration to a data declaration" + ExternDataDeclaration kind [] -> + ExternDataDeclaration kind roles + ExternDataDeclaration _ _ -> + P.internalError "augmentWith: could not add a second role declaration to an FFI declaration" + _ -> P.internalError "augmentWith: could not add role to declaration" + + mergeComments :: Maybe Text -> Maybe Text -> Maybe Text + mergeComments Nothing bot = bot + mergeComments top Nothing = top + mergeComments (Just topComs) (Just bottomComs) = + Just $ topComs <> "\n" <> bottomComs getDeclarationTitle :: P.Declaration -> Maybe Text getDeclarationTitle (P.ValueDeclaration vd) = Just (P.showIdent (P.valdeclIdent vd)) @@ -138,19 +144,20 @@ getDeclarationTitle (P.TypeInstanceDeclaration _ _ _ _ name _ _ _ _) = Just $ ei getDeclarationTitle (P.TypeFixityDeclaration _ _ _ op) = Just ("type " <> P.showOp op) getDeclarationTitle (P.ValueFixityDeclaration _ _ _ op) = Just (P.showOp op) getDeclarationTitle (P.KindDeclaration _ _ n _) = Just (P.runProperName n) -getDeclarationTitle (P.RoleDeclaration P.RoleDeclarationData{..}) = Just (P.runProperName rdeclIdent) +getDeclarationTitle (P.RoleDeclaration P.RoleDeclarationData {..}) = Just (P.runProperName rdeclIdent) getDeclarationTitle _ = Nothing -- | Create a basic Declaration value. mkDeclaration :: P.SourceAnn -> Text -> DeclarationInfo -> Declaration mkDeclaration (ss, com) title info = - Declaration { declTitle = title - , declComments = convertComments com - , declSourceSpan = Just ss -- TODO: make this non-optional when we next break the format - , declChildren = [] - , declInfo = info - , declKind = Nothing -- kind sigs are added in augment pass - } + Declaration + { declTitle = title + , declComments = convertComments com + , declSourceSpan = Just ss -- TODO: make this non-optional when we next break the format + , declChildren = [] + , declInfo = info + , declKind = Nothing -- kind sigs are added in augment pass + } basicDeclaration :: P.SourceAnn -> Text -> DeclarationInfo -> Maybe IntermediateDeclaration basicDeclaration sa title = Just . Right . mkDeclaration sa title @@ -165,40 +172,40 @@ convertDeclaration (P.ValueDecl sa _ _ _ _) title = convertDeclaration (P.ExternDeclaration sa _ ty) title = basicDeclaration sa title (ValueDeclaration (ty $> ())) convertDeclaration (P.DataDeclaration sa dtype _ args ctors) title = - Just (Right (mkDeclaration sa title info) { declChildren = children }) + Just (Right (mkDeclaration sa title info) {declChildren = children}) where - info = DataDeclaration dtype (fmap (fmap (fmap ($> ()))) args) [] - children = map convertCtor ctors - convertCtor :: P.DataConstructorDeclaration -> ChildDeclaration - convertCtor P.DataConstructorDeclaration{..} = - let (sourceSpan, comments) = dataCtorAnn - in ChildDeclaration (P.runProperName dataCtorName) (convertComments comments) (Just sourceSpan) (ChildDataConstructor (fmap (($> ()) . snd) dataCtorFields)) + info = DataDeclaration dtype (fmap (fmap ($> ())) args) [] + children = map convertCtor ctors + convertCtor :: P.DataConstructorDeclaration -> ChildDeclaration + convertCtor P.DataConstructorDeclaration {..} = + let (sourceSpan, comments) = dataCtorAnn + in ChildDeclaration (P.runProperName dataCtorName) (convertComments comments) (Just sourceSpan) (ChildDataConstructor (fmap (($> ()) . snd) dataCtorFields)) convertDeclaration (P.ExternDataDeclaration sa _ kind') title = basicDeclaration sa title (ExternDataDeclaration (kind' $> ()) []) convertDeclaration (P.TypeSynonymDeclaration sa _ args ty) title = - basicDeclaration sa title (TypeSynonymDeclaration (fmap (fmap (fmap ($> ()))) args) (ty $> ())) + basicDeclaration sa title (TypeSynonymDeclaration (fmap (fmap ($> ())) args) (ty $> ())) convertDeclaration (P.TypeClassDeclaration sa _ args implies fundeps ds) title = - Just (Right (mkDeclaration sa title info) { declChildren = children }) + Just (Right (mkDeclaration sa title info) {declChildren = children}) where - args' = fmap (fmap (fmap ($> ()))) args - info = TypeClassDeclaration args' (fmap ($> ()) implies) (convertFundepsToStrings args' fundeps) - children = map convertClassMember ds - convertClassMember (P.TypeDeclaration (P.TypeDeclarationData (ss, com) ident' ty)) = - ChildDeclaration (P.showIdent ident') (convertComments com) (Just ss) (ChildTypeClassMember (ty $> ())) - convertClassMember _ = - P.internalError "convertDeclaration: Invalid argument to convertClassMember." + args' = fmap (fmap ($> ())) args + info = TypeClassDeclaration args' (fmap ($> ()) implies) (convertFundepsToStrings args' fundeps) + children = map convertClassMember ds + convertClassMember (P.TypeDeclaration (P.TypeDeclarationData (ss, com) ident' ty)) = + ChildDeclaration (P.showIdent ident') (convertComments com) (Just ss) (ChildTypeClassMember (ty $> ())) + convertClassMember _ = + P.internalError "convertDeclaration: Invalid argument to convertClassMember." convertDeclaration (P.TypeInstanceDeclaration (ss, com) _ _ _ _ constraints className tys _) title = - Just (Left ((classNameString, AugmentClass) : map (, AugmentType) typeNameStrings, AugmentChild childDecl)) + Just (Left ((classNameString, AugmentClass) : map (,AugmentType) typeNameStrings, AugmentChild childDecl)) where - classNameString = unQual className - typeNameStrings = ordNub (concatMap (P.everythingOnTypes (++) extractProperNames) tys) - unQual x = let (P.Qualified _ y) = x in P.runProperName y + classNameString = unQual className + typeNameStrings = ordNub (concatMap (P.everythingOnTypes (++) extractProperNames) tys) + unQual x = let (P.Qualified _ y) = x in P.runProperName y - extractProperNames (P.TypeConstructor _ n) = [unQual n] - extractProperNames _ = [] + extractProperNames (P.TypeConstructor _ n) = [unQual n] + extractProperNames _ = [] - childDecl = ChildDeclaration title (convertComments com) (Just ss) (ChildInstance (fmap ($> ()) constraints) (classApp $> ())) - classApp = foldl' P.srcTypeApp (P.srcTypeConstructor (fmap P.coerceProperName className)) tys + childDecl = ChildDeclaration title (convertComments com) (Just ss) (ChildInstance (fmap ($> ()) constraints) (classApp $> ())) + classApp = foldl' P.srcTypeApp (P.srcTypeConstructor (fmap P.coerceProperName className)) tys convertDeclaration (P.ValueFixityDeclaration sa fixity (P.Qualified mn alias) _) title = Just . Right $ mkDeclaration sa title (AliasDeclaration fixity (P.Qualified mn (Right alias))) convertDeclaration (P.TypeFixityDeclaration sa fixity (P.Qualified mn alias) _) title = @@ -207,12 +214,11 @@ convertDeclaration (P.KindDeclaration sa keyword _ kind) title = Just $ Left ([(title, AugmentType), (title, AugmentClass)], AugmentKindSig ksi) where comms = convertComments $ snd sa - ksi = KindSignatureInfo { ksiComments = comms, ksiKeyword = keyword, ksiKind = kind $> () } -convertDeclaration (P.RoleDeclaration P.RoleDeclarationData{..}) title = + ksi = KindSignatureInfo {ksiComments = comms, ksiKeyword = keyword, ksiKind = kind $> ()} +convertDeclaration (P.RoleDeclaration P.RoleDeclarationData {..}) title = Just $ Left ([(title, AugmentType)], AugmentRole comms rdeclRoles) where comms = convertComments $ snd rdeclSourceAnn - convertDeclaration _ _ = Nothing convertComments :: [P.Comment] -> Maybe Text @@ -221,15 +227,14 @@ convertComments cs = do let docs = mapMaybe stripPipe raw guard (not (null docs)) pure (T.unlines docs) - where - toLines (P.LineComment s) = [s] - toLines (P.BlockComment s) = T.lines s + toLines (P.LineComment s) = [s] + toLines (P.BlockComment s) = T.lines s - stripPipe = - T.dropWhile (== ' ') - >>> T.stripPrefix "|" - >>> fmap (dropPrefix " ") + stripPipe = + T.dropWhile (== ' ') + >>> T.stripPrefix "|" + >>> fmap (dropPrefix " ") - dropPrefix prefix str = - fromMaybe str (T.stripPrefix prefix str) + dropPrefix prefix str = + fromMaybe str (T.stripPrefix prefix str) diff --git a/src/Language/PureScript/Docs/Css.hs b/src/Language/PureScript/Docs/Css.hs index 9567db96e..4a7a1a96e 100644 --- a/src/Language/PureScript/Docs/Css.hs +++ b/src/Language/PureScript/Docs/Css.hs @@ -1,31 +1,33 @@ {-# LANGUAGE TemplateHaskell #-} + module Language.PureScript.Docs.Css where import Data.ByteString (ByteString) +import Data.FileEmbed (embedFile) import Data.Text (Text) import Data.Text.Encoding (decodeUtf8) -import Data.FileEmbed (embedFile) --- | --- An embedded copy of normalize.css as a UTF-8 encoded ByteString; this should --- be included before pursuit.css in any HTML page using pursuit.css. --- +{- | +An embedded copy of normalize.css as a UTF-8 encoded ByteString; this should +be included before pursuit.css in any HTML page using pursuit.css. +-} normalizeCss :: ByteString normalizeCss = $(embedFile "app/static/normalize.css") --- | --- Like 'normalizeCss', but as a 'Text'. +{- | +Like 'normalizeCss', but as a 'Text'. +-} normalizeCssT :: Text normalizeCssT = decodeUtf8 normalizeCss --- | --- CSS for use with generated HTML docs, as a UTF-8 encoded ByteString. --- +{- | +CSS for use with generated HTML docs, as a UTF-8 encoded ByteString. +-} pursuitCss :: ByteString pursuitCss = $(embedFile "app/static/pursuit.css") --- | --- Like 'pursuitCss', but as a 'Text'. --- +{- | +Like 'pursuitCss', but as a 'Text'. +-} pursuitCssT :: Text pursuitCssT = decodeUtf8 pursuitCss diff --git a/src/Language/PureScript/Docs/Prim.hs b/src/Language/PureScript/Docs/Prim.hs index 801a64bc6..f7b186db5 100644 --- a/src/Language/PureScript/Docs/Prim.hs +++ b/src/Language/PureScript/Docs/Prim.hs @@ -1,17 +1,17 @@ -- | This module provides documentation for the builtin Prim modules. -module Language.PureScript.Docs.Prim - ( primDocsModule - , primRowDocsModule - , primTypeErrorDocsModule - , primModules - ) where +module Language.PureScript.Docs.Prim ( + primDocsModule, + primRowDocsModule, + primTypeErrorDocsModule, + primModules, +) where -import Prelude hiding (fail) import Data.Functor (($>)) +import Data.Map qualified as Map import Data.Text (Text) import Data.Text qualified as T -import Data.Map qualified as Map -import Language.PureScript.Docs.Types (Declaration(..), DeclarationInfo(..), Module(..), Type', convertFundepsToStrings) +import Language.PureScript.Docs.Types (Declaration (..), DeclarationInfo (..), Module (..), Type', convertFundepsToStrings) +import Prelude hiding (fail) import Language.PureScript.Constants.Prim qualified as P import Language.PureScript.Crash qualified as P @@ -32,635 +32,741 @@ primModules = ] primDocsModule :: Module -primDocsModule = Module - { modName = P.moduleNameFromString "Prim" - , modComments = Just $ T.unlines - [ "The `Prim` module is embedded in the PureScript compiler in order to provide compiler support for certain types — for example, value literals, or syntax sugar. It is implicitly imported unqualified in every module except those that list it as a qualified import." - , "" - , "`Prim` does not include additional built-in types and kinds that are defined deeper in the compiler such as Type wildcards (e.g. `f :: _ -> Int`) and Quantified Types. Rather, these are documented in [the PureScript language reference](https://github.com/purescript/documentation/blob/master/language/Types.md)." - ] - , modDeclarations = - [ function - , array - , record - , number - , int - , string - , char - , boolean - , partial - , kindType - , kindConstraint - , kindSymbol - , kindRow - ] - , modReExports = [] - } +primDocsModule = + Module + { modName = P.moduleNameFromString "Prim" + , modComments = + Just $ + T.unlines + [ "The `Prim` module is embedded in the PureScript compiler in order to provide compiler support for certain types — for example, value literals, or syntax sugar. It is implicitly imported unqualified in every module except those that list it as a qualified import." + , "" + , "`Prim` does not include additional built-in types and kinds that are defined deeper in the compiler such as Type wildcards (e.g. `f :: _ -> Int`) and Quantified Types. Rather, these are documented in [the PureScript language reference](https://github.com/purescript/documentation/blob/master/language/Types.md)." + ] + , modDeclarations = + [ function + , list + , record + , number + , int + , string + , char + , boolean + , partial + , kindType + , kindConstraint + , kindSymbol + , kindRow + ] + , modReExports = [] + } primBooleanDocsModule :: Module -primBooleanDocsModule = Module - { modName = P.moduleNameFromString "Prim.Boolean" - , modComments = Just "The Prim.Boolean module is embedded in the PureScript compiler. Unlike `Prim`, it is not imported implicitly. It contains a type level `Boolean` data structure." - , modDeclarations = - [ booleanTrue - , booleanFalse - ] - , modReExports = [] - } +primBooleanDocsModule = + Module + { modName = P.moduleNameFromString "Prim.Boolean" + , modComments = Just "The Prim.Boolean module is embedded in the PureScript compiler. Unlike `Prim`, it is not imported implicitly. It contains a type level `Boolean` data structure." + , modDeclarations = + [ booleanTrue + , booleanFalse + ] + , modReExports = [] + } primCoerceDocsModule :: Module -primCoerceDocsModule = Module - { modName = P.moduleNameFromString "Prim.Coerce" - , modComments = Just "The Prim.Coerce module is embedded in the PureScript compiler. Unlike `Prim`, it is not imported implicitly. It contains an automatically solved type class for coercing types that have provably-identical runtime representations with [purescript-safe-coerce](https://pursuit.purescript.org/packages/purescript-safe-coerce)." - , modDeclarations = - [ coercible - ] - , modReExports = [] - } +primCoerceDocsModule = + Module + { modName = P.moduleNameFromString "Prim.Coerce" + , modComments = Just "The Prim.Coerce module is embedded in the PureScript compiler. Unlike `Prim`, it is not imported implicitly. It contains an automatically solved type class for coercing types that have provably-identical runtime representations with [purescript-safe-coerce](https://pursuit.purescript.org/packages/purescript-safe-coerce)." + , modDeclarations = + [ coercible + ] + , modReExports = [] + } primOrderingDocsModule :: Module -primOrderingDocsModule = Module - { modName = P.moduleNameFromString "Prim.Ordering" - , modComments = Just "The Prim.Ordering module is embedded in the PureScript compiler. Unlike `Prim`, it is not imported implicitly. It contains a type level `Ordering` data structure." - , modDeclarations = - [ kindOrdering - , orderingLT - , orderingEQ - , orderingGT - ] - , modReExports = [] - } +primOrderingDocsModule = + Module + { modName = P.moduleNameFromString "Prim.Ordering" + , modComments = Just "The Prim.Ordering module is embedded in the PureScript compiler. Unlike `Prim`, it is not imported implicitly. It contains a type level `Ordering` data structure." + , modDeclarations = + [ kindOrdering + , orderingLT + , orderingEQ + , orderingGT + ] + , modReExports = [] + } primRowDocsModule :: Module -primRowDocsModule = Module - { modName = P.moduleNameFromString "Prim.Row" - , modComments = Just "The Prim.Row module is embedded in the PureScript compiler. Unlike `Prim`, it is not imported implicitly. It contains automatically solved type classes for working with row types." - , modDeclarations = - [ union - , nub - , lacks - , rowCons - ] - , modReExports = [] - } +primRowDocsModule = + Module + { modName = P.moduleNameFromString "Prim.Row" + , modComments = Just "The Prim.Row module is embedded in the PureScript compiler. Unlike `Prim`, it is not imported implicitly. It contains automatically solved type classes for working with row types." + , modDeclarations = + [ union + , nub + , lacks + , rowCons + ] + , modReExports = [] + } primRowListDocsModule :: Module -primRowListDocsModule = Module - { modName = P.moduleNameFromString "Prim.RowList" - , modComments = Just "The Prim.RowList module is embedded in the PureScript compiler. Unlike `Prim`, it is not imported implicitly. It contains a type level list (`RowList`) that represents an ordered view of a row of types." - , modDeclarations = - [ kindRowList - , rowListCons - , rowListNil - , rowToList - ] - , modReExports = [] - } +primRowListDocsModule = + Module + { modName = P.moduleNameFromString "Prim.RowList" + , modComments = Just "The Prim.RowList module is embedded in the PureScript compiler. Unlike `Prim`, it is not imported implicitly. It contains a type level list (`RowList`) that represents an ordered view of a row of types." + , modDeclarations = + [ kindRowList + , rowListCons + , rowListNil + , rowToList + ] + , modReExports = [] + } primSymbolDocsModule :: Module -primSymbolDocsModule = Module - { modName = P.moduleNameFromString "Prim.Symbol" - , modComments = Just "The Prim.Symbol module is embedded in the PureScript compiler. Unlike `Prim`, it is not imported implicitly. It contains automatically solved type classes for working with `Symbols`." - , modDeclarations = - [ symbolAppend - , symbolCompare - , symbolCons - ] - , modReExports = [] - } +primSymbolDocsModule = + Module + { modName = P.moduleNameFromString "Prim.Symbol" + , modComments = Just "The Prim.Symbol module is embedded in the PureScript compiler. Unlike `Prim`, it is not imported implicitly. It contains automatically solved type classes for working with `Symbols`." + , modDeclarations = + [ symbolAppend + , symbolCompare + , symbolCons + ] + , modReExports = [] + } primIntDocsModule :: Module -primIntDocsModule = Module - { modName = P.moduleNameFromString "Prim.Int" - , modComments = Just "The Prim.Int module is embedded in the PureScript compiler. Unlike `Prim`, it is not imported implicitly. It contains automatically solved type classes for working with type-level intural numbers." - , modDeclarations = - [ intAdd - , intCompare - , intMul - , intToString - ] - , modReExports = [] - } +primIntDocsModule = + Module + { modName = P.moduleNameFromString "Prim.Int" + , modComments = Just "The Prim.Int module is embedded in the PureScript compiler. Unlike `Prim`, it is not imported implicitly. It contains automatically solved type classes for working with type-level intural numbers." + , modDeclarations = + [ intAdd + , intCompare + , intMul + , intToString + ] + , modReExports = [] + } primTypeErrorDocsModule :: Module -primTypeErrorDocsModule = Module - { modName = P.moduleNameFromString "Prim.TypeError" - , modComments = Just "The Prim.TypeError module is embedded in the PureScript compiler. Unlike `Prim`, it is not imported implicitly. It contains type classes that provide custom type error and warning functionality." - , modDeclarations = - [ warn - , fail - , kindDoc - , textDoc - , quoteDoc - , quoteLabelDoc - , besideDoc - , aboveDoc - ] - , modReExports = [] - } - -unsafeLookup - :: forall v (a :: P.ProperNameType) - . Map.Map (P.Qualified (P.ProperName a)) v - -> String - -> P.Qualified (P.ProperName a) - -> v +primTypeErrorDocsModule = + Module + { modName = P.moduleNameFromString "Prim.TypeError" + , modComments = Just "The Prim.TypeError module is embedded in the PureScript compiler. Unlike `Prim`, it is not imported implicitly. It contains type classes that provide custom type error and warning functionality." + , modDeclarations = + [ warn + , fail + , kindDoc + , textDoc + , quoteDoc + , quoteLabelDoc + , besideDoc + , aboveDoc + ] + , modReExports = [] + } + +unsafeLookup :: + forall v (a :: P.ProperNameType). + Map.Map (P.Qualified (P.ProperName a)) v -> + String -> + P.Qualified (P.ProperName a) -> + v unsafeLookup m errorMsg name = go name where - go = fromJust' . flip Map.lookup m - - fromJust' (Just x) = x - fromJust' _ = P.internalError $ errorMsg ++ show (P.runProperName $ P.disqualify name) - -lookupPrimTypeKind - :: P.Qualified (P.ProperName 'P.TypeName) - -> Type' -lookupPrimTypeKind = ($> ()) . fst . unsafeLookup - ( P.primTypes <> - P.primBooleanTypes <> - P.primOrderingTypes <> - P.primRowTypes <> - P.primRowListTypes <> - P.primTypeErrorTypes - ) "Docs.Prim: No such Prim type: " + go = fromJust' . flip Map.lookup m + + fromJust' (Just x) = x + fromJust' _ = P.internalError $ errorMsg ++ show (P.runProperName $ P.disqualify name) + +lookupPrimTypeKind :: + P.Qualified (P.ProperName 'P.TypeName) -> + Type' +lookupPrimTypeKind = + ($> ()) + . fst + . unsafeLookup + ( P.primTypes + <> P.primBooleanTypes + <> P.primOrderingTypes + <> P.primRowTypes + <> P.primRowListTypes + <> P.primTypeErrorTypes + ) + "Docs.Prim: No such Prim type: " primType :: P.Qualified (P.ProperName 'P.TypeName) -> Text -> Declaration -primType tn comments = Declaration - { declTitle = P.runProperName $ P.disqualify tn - , declComments = Just comments - , declSourceSpan = Nothing - , declChildren = [] - , declInfo = ExternDataDeclaration (lookupPrimTypeKind tn) [] - , declKind = Nothing - } - --- | Lookup the TypeClassData of a Prim class. This function is specifically --- not exported because it is partial. +primType tn comments = + Declaration + { declTitle = P.runProperName $ P.disqualify tn + , declComments = Just comments + , declSourceSpan = Nothing + , declChildren = [] + , declInfo = ExternDataDeclaration (lookupPrimTypeKind tn) [] + , declKind = Nothing + } + +{- | Lookup the TypeClassData of a Prim class. This function is specifically +not exported because it is partial. +-} lookupPrimClass :: P.Qualified (P.ProperName 'P.ClassName) -> P.TypeClassData -lookupPrimClass = unsafeLookup - ( P.primClasses <> - P.primCoerceClasses <> - P.primRowClasses <> - P.primRowListClasses <> - P.primSymbolClasses <> - P.primIntClasses <> - P.primTypeErrorClasses - ) "Docs.Prim: No such Prim class: " +lookupPrimClass = + unsafeLookup + ( P.primClasses + <> P.primCoerceClasses + <> P.primRowClasses + <> P.primRowListClasses + <> P.primSymbolClasses + <> P.primIntClasses + <> P.primTypeErrorClasses + ) + "Docs.Prim: No such Prim class: " primClass :: P.Qualified (P.ProperName 'P.ClassName) -> Text -> Declaration -primClass cn comments = Declaration - { declTitle = P.runProperName $ P.disqualify cn - , declComments = Just comments - , declSourceSpan = Nothing - , declChildren = [] - , declInfo = - let - tcd = lookupPrimClass cn - args = fmap (fmap ($> ())) <$> P.typeClassArguments tcd - superclasses = ($> ()) <$> P.typeClassSuperclasses tcd - fundeps = convertFundepsToStrings args (P.typeClassDependencies tcd) - in - TypeClassDeclaration args superclasses fundeps - , declKind = Nothing - } +primClass cn comments = + Declaration + { declTitle = P.runProperName $ P.disqualify cn + , declComments = Just comments + , declSourceSpan = Nothing + , declChildren = [] + , declInfo = + let + tcd = lookupPrimClass cn + args = (fmap ($> ())) <$> P.typeClassArguments tcd + superclasses = ($> ()) <$> P.typeClassSuperclasses tcd + fundeps = convertFundepsToStrings args (P.typeClassDependencies tcd) + in + TypeClassDeclaration args superclasses fundeps + , declKind = Nothing + } kindType :: Declaration -kindType = primType P.Type $ T.unlines - [ "`Type` is the kind of all proper types: those that classify value-level terms." - , "For example the type `Boolean` has kind `Type`; denoted by `Boolean :: Type`." - ] +kindType = + primType P.Type $ + T.unlines + [ "`Type` is the kind of all proper types: those that classify value-level terms." + , "For example the type `Boolean` has kind `Type`; denoted by `Boolean :: Type`." + ] kindConstraint :: Declaration -kindConstraint = primType P.Constraint $ T.unlines - [ "`Constraint` is the kind of type class constraints." - , "For example, a type class declaration like this:" - , "" - , " class Semigroup a where" - , " append :: a -> a -> a" - , "" - , "has the kind signature:" - , "" - , " class Semigroup :: Type -> Constraint" - ] +kindConstraint = + primType P.Constraint $ + T.unlines + [ "`Constraint` is the kind of type class constraints." + , "For example, a type class declaration like this:" + , "" + , " class Semigroup a where" + , " append :: a -> a -> a" + , "" + , "has the kind signature:" + , "" + , " class Semigroup :: Type -> Constraint" + ] kindSymbol :: Declaration -kindSymbol = primType P.Symbol $ T.unlines - [ "`Symbol` is the kind of type-level strings." - , "" - , "Construct types of this kind using the same literal syntax as documented" - , "for strings." - , "" - , " type Hello :: Symbol" - , " type Hello = \"Hello, world\"" - , "" - ] +kindSymbol = + primType P.Symbol $ + T.unlines + [ "`Symbol` is the kind of type-level strings." + , "" + , "Construct types of this kind using the same literal syntax as documented" + , "for strings." + , "" + , " type Hello :: Symbol" + , " type Hello = \"Hello, world\"" + , "" + ] kindRow :: Declaration -kindRow = primType P.Row $ T.unlines - [ "`Row` is the kind constructor of label-indexed types which map type-level strings to other types." - , "The most common use of `Row` is `Row Type`, a row mapping labels to basic (of kind `Type`) types:" - , "" - , " type ExampleRow :: Row Type" - , " type ExampleRow = ( name :: String, values :: Array Int )" - , "" - , "This is the kind of `Row` expected by the `Record` type constructor." - , "More advanced row kinds like `Row (Type -> Type)` are used much less frequently." - ] +kindRow = + primType P.Row $ + T.unlines + [ "`Row` is the kind constructor of label-indexed types which map type-level strings to other types." + , "The most common use of `Row` is `Row Type`, a row mapping labels to basic (of kind `Type`) types:" + , "" + , " type ExampleRow :: Row Type" + , " type ExampleRow = ( name :: String, values :: List Int )" + , "" + , "This is the kind of `Row` expected by the `Record` type constructor." + , "More advanced row kinds like `Row (Type -> Type)` are used much less frequently." + ] function :: Declaration -function = primType P.Function $ T.unlines - [ "A function, which takes values of the type specified by the first type" - , "parameter, and returns values of the type specified by the second." - , "In the JavaScript backend, this is a standard JavaScript Function." - , "" - , "The type constructor `(->)` is syntactic sugar for this type constructor." - , "It is recommended to use `(->)` rather than `Function`, where possible." - , "" - , "That is, prefer this:" - , "" - , " f :: Number -> Number" - , "" - , "to either of these:" - , "" - , " f :: Function Number Number" - , " f :: (->) Number Number" - ] +function = + primType P.Function $ + T.unlines + [ "A function, which takes values of the type specified by the first type" + , "parameter, and returns values of the type specified by the second." + , "In the JavaScript backend, this is a standard JavaScript Function." + , "" + , "The type constructor `(->)` is syntactic sugar for this type constructor." + , "It is recommended to use `(->)` rather than `Function`, where possible." + , "" + , "That is, prefer this:" + , "" + , " f :: Number -> Number" + , "" + , "to either of these:" + , "" + , " f :: Function Number Number" + , " f :: (->) Number Number" + ] -array :: Declaration -array = primType P.Array $ T.unlines - [ "An Array: a data structure supporting efficient random access. In" - , "the JavaScript backend, values of this type are represented as JavaScript" - , "Arrays at runtime." - , "" - , "Construct values using literals:" - , "" - , " x = [1,2,3,4,5] :: Array Int" - ] +list :: Declaration +list = + primType P.List $ + T.unlines + [ "An List: a data structure supporting efficient random access. In" + , "the JavaScript backend, values of this type are represented as JavaScript" + , "Lists at runtime." + , "" + , "Construct values using literals:" + , "" + , " x = [1,2,3,4,5] :: List Int" + ] record :: Declaration -record = primType P.Record $ T.unlines - [ "The type of records whose fields are known at compile time. In the" - , "JavaScript backend, values of this type are represented as JavaScript" - , "Objects at runtime." - , "" - , "The type signature here means that the `Record` type constructor takes" - , "a row of concrete types. For example:" - , "" - , " type Person = Record (name :: String, age :: Number)" - , "" - , "The syntactic sugar with curly braces `{ }` is generally preferred, though:" - , "" - , " type Person = { name :: String, age :: Number }" - , "" - , "The row associates a type to each label which appears in the record." - , "" - , "_Technical note_: PureScript allows duplicate labels in rows, and the" - , "meaning of `Record r` is based on the _first_ occurrence of each label in" - , "the row `r`." - ] +record = + primType P.Record $ + T.unlines + [ "The type of records whose fields are known at compile time. In the" + , "JavaScript backend, values of this type are represented as JavaScript" + , "Objects at runtime." + , "" + , "The type signature here means that the `Record` type constructor takes" + , "a row of concrete types. For example:" + , "" + , " type Person = Record (name :: String, age :: Number)" + , "" + , "The syntactic sugar with curly braces `{ }` is generally preferred, though:" + , "" + , " type Person = { name :: String, age :: Number }" + , "" + , "The row associates a type to each label which appears in the record." + , "" + , "_Technical note_: PureScript allows duplicate labels in rows, and the" + , "meaning of `Record r` is based on the _first_ occurrence of each label in" + , "the row `r`." + ] number :: Declaration -number = primType P.Number $ T.unlines - [ "A double precision floating point number (IEEE 754)." - , "" - , "Construct values of this type with literals." - , "Negative literals must be wrapped in parentheses if the negation sign could be mistaken" - , "for an infix operator:" - , "" - , " x = 35.23 :: Number" - , " y = -1.224e6 :: Number" - , " z = exp (-1.0) :: Number" - ] +number = + primType P.Number $ + T.unlines + [ "A double precision floating point number (IEEE 754)." + , "" + , "Construct values of this type with literals." + , "Negative literals must be wrapped in parentheses if the negation sign could be mistaken" + , "for an infix operator:" + , "" + , " x = 35.23 :: Number" + , " y = -1.224e6 :: Number" + , " z = exp (-1.0) :: Number" + ] int :: Declaration -int = primType P.Int $ T.unlines - [ "A 32-bit signed integer. See the `purescript-integers` package for details" - , "of how this is accomplished when compiling to JavaScript." - , "" - , "Construct values of this type with literals. Hexadecimal syntax is supported." - , "Negative literals must be wrapped in parentheses if the negation sign could be mistaken" - , "for an infix operator:" - , "" - , " x = -23 :: Int" - , " y = 0x17 :: Int" - , " z = complement (-24) :: Int" - , "" - , "Integers used as types are considered to have kind `Int`." - , "Unlike value-level `Int`s, which must be representable as a 32-bit signed integer," - , "type-level `Int`s are unbounded. Hexadecimal support is also supported at the type level." - , "" - , " type One :: Int" - , " type One = 1" - , " " - , " type Beyond32BitSignedInt :: Int" - , " type Beyond32BitSignedInt = 2147483648" - , " " - , " type HexInt :: Int" - , " type HexInt = 0x17" - , "" - , "Negative integer literals at the type level must be" - , "wrapped in parentheses if the negation sign could be mistaken for an infix operator." - , "" - , " type NegativeOne = -1" - , " foo :: Proxy (-1) -> ..." - ] +int = + primType P.Int $ + T.unlines + [ "A 32-bit signed integer. See the `purescript-integers` package for details" + , "of how this is accomplished when compiling to JavaScript." + , "" + , "Construct values of this type with literals. Hexadecimal syntax is supported." + , "Negative literals must be wrapped in parentheses if the negation sign could be mistaken" + , "for an infix operator:" + , "" + , " x = -23 :: Int" + , " y = 0x17 :: Int" + , " z = complement (-24) :: Int" + , "" + , "Integers used as types are considered to have kind `Int`." + , "Unlike value-level `Int`s, which must be representable as a 32-bit signed integer," + , "type-level `Int`s are unbounded. Hexadecimal support is also supported at the type level." + , "" + , " type One :: Int" + , " type One = 1" + , " " + , " type Beyond32BitSignedInt :: Int" + , " type Beyond32BitSignedInt = 2147483648" + , " " + , " type HexInt :: Int" + , " type HexInt = 0x17" + , "" + , "Negative integer literals at the type level must be" + , "wrapped in parentheses if the negation sign could be mistaken for an infix operator." + , "" + , " type NegativeOne = -1" + , " foo :: Proxy (-1) -> ..." + ] string :: Declaration -string = primType P.String $ T.unlines - [ "A String. As in JavaScript, String values represent sequences of UTF-16" - , "code units, which are not required to form a valid encoding of Unicode" - , "text (for example, lone surrogates are permitted)." - , "" - , "Construct values of this type with literals, using double quotes `\"`:" - , "" - , " x = \"hello, world\" :: String" - , "" - , "Multi-line string literals are also supported with triple quotes (`\"\"\"`):" - , "" - , " x = \"\"\"multi" - , " line\"\"\"" - , "" - , "At the type level, string literals represent types with kind `Symbol`." - , "These types will have kind `String` in a future release:" - , "" - , " type Hello :: Symbol" - , " type Hello = \"Hello, world\"" - ] +string = + primType P.String $ + T.unlines + [ "A String. As in JavaScript, String values represent sequences of UTF-16" + , "code units, which are not required to form a valid encoding of Unicode" + , "text (for example, lone surrogates are permitted)." + , "" + , "Construct values of this type with literals, using double quotes `\"`:" + , "" + , " x = \"hello, world\" :: String" + , "" + , "Multi-line string literals are also supported with triple quotes (`\"\"\"`):" + , "" + , " x = \"\"\"multi" + , " line\"\"\"" + , "" + , "At the type level, string literals represent types with kind `Symbol`." + , "These types will have kind `String` in a future release:" + , "" + , " type Hello :: Symbol" + , " type Hello = \"Hello, world\"" + ] char :: Declaration -char = primType P.Char $ T.unlines - [ "A single character (UTF-16 code unit). The JavaScript representation is a" - , "normal `String`, which is guaranteed to contain one code unit. This means" - , "that astral plane characters (i.e. those with code point values greater" - , "than `0xFFFF`) cannot be represented as `Char` values." - , "" - , "Construct values of this type with literals, using single quotes `'`:" - , "" - , " x = 'a' :: Char" - ] +char = + primType P.Char $ + T.unlines + [ "A single character (UTF-16 code unit). The JavaScript representation is a" + , "normal `String`, which is guaranteed to contain one code unit. This means" + , "that astral plane characters (i.e. those with code point values greater" + , "than `0xFFFF`) cannot be represented as `Char` values." + , "" + , "Construct values of this type with literals, using single quotes `'`:" + , "" + , " x = 'a' :: Char" + ] boolean :: Declaration -boolean = primType P.Boolean $ T.unlines - [ "A JavaScript Boolean value." - , "" - , "Construct values of this type with the literals `true` and `false`." - , "" - , "The `True` and `False` types defined in `Prim.Boolean` have this type as their kind." - ] +boolean = + primType P.Boolean $ + T.unlines + [ "A JavaScript Boolean value." + , "" + , "Construct values of this type with the literals `true` and `false`." + , "" + , "The `True` and `False` types defined in `Prim.Boolean` have this type as their kind." + ] partial :: Declaration -partial = primClass P.Partial $ T.unlines - [ "The Partial type class is used to indicate that a function is *partial,*" - , "that is, it is not defined for all inputs. In practice, attempting to use" - , "a partial function with a bad input will usually cause an error to be" - , "thrown, although it is not safe to assume that this will happen in all" - , "cases. For more information, see" - , "[purescript-partial](https://pursuit.purescript.org/packages/purescript-partial/)." - ] +partial = + primClass P.Partial $ + T.unlines + [ "The Partial type class is used to indicate that a function is *partial,*" + , "that is, it is not defined for all inputs. In practice, attempting to use" + , "a partial function with a bad input will usually cause an error to be" + , "thrown, although it is not safe to assume that this will happen in all" + , "cases. For more information, see" + , "[purescript-partial](https://pursuit.purescript.org/packages/purescript-partial/)." + ] booleanTrue :: Declaration -booleanTrue = primType P.True $ T.unlines - [ "The 'True' boolean type." - ] +booleanTrue = + primType P.True $ + T.unlines + [ "The 'True' boolean type." + ] booleanFalse :: Declaration -booleanFalse = primType P.False $ T.unlines - [ "The 'False' boolean type." - ] +booleanFalse = + primType P.False $ + T.unlines + [ "The 'False' boolean type." + ] coercible :: Declaration -coercible = primClass P.Coercible $ T.unlines - [ "Coercible is a two-parameter type class that has instances for types `a`" - , "and `b` if the compiler can infer that they have the same representation." - , "Coercible constraints are solved according to the following rules:" - , "" - , "* _reflexivity_, any type has the same representation as itself:" - , "`Coercible a a` holds." - , "" - , "* _symmetry_, if a type `a` can be coerced to some other type `b`, then `b`" - , "can also be coerced back to `a`: `Coercible a b` implies `Coercible b a`." - , "" - , "* _transitivity_, if a type `a` can be coerced to some other type `b` which" - , "can be coerced to some other type `c`, then `a` can also be coerced to `c`:" - , "`Coercible a b` and `Coercible b c` imply `Coercible a c`." - , "" - , "* Newtypes can be freely wrapped and unwrapped when their constructor is" - , "in scope:" - , "" - , " newtype Age = Age Int" - , "" - , "`Coercible Int Age` and `Coercible Age Int` hold since `Age` has the same" - , "runtime representation than `Int`." - , "" - , "Newtype constructors have to be in scope to preserve abstraction. It's" - , "common to declare a newtype to encode some invariants (non emptiness of" - , "arrays with `Data.Array.NonEmpty.NonEmptyArray` for example), hide its" - , "constructor and export smart constructors instead. Without this restriction," - , "the guarantees provided by such newtypes would be void." - , "" - , "* If none of the above are applicable, two types of kind `Type` may be" - , "coercible, but only if their heads are the same. For example," - , "`Coercible (Maybe a) (Either a b)` does not hold because `Maybe` and" - , "`Either` are different. Those types don't share a common runtime" - , "representation so coercing between them would be unsafe. In addition their" - , "arguments may need to be identical or coercible, depending on the _roles_" - , "of the head's type parameters. Roles are documented in [the PureScript" - , "language reference](https://github.com/purescript/documentation/blob/master/language/Roles.md)." - , "" - , "Coercible being polykinded, we can also coerce more than types of kind `Type`:" - , "" - , "* Rows are coercible when they have the same labels, when the corresponding" - , "pairs of types are coercible and when their tails are coercible:" - , "`Coercible ( label :: a | r ) ( label :: b | s )` holds when" - , "`Coercible a b` and `Coercible r s` do. Closed rows cannot be coerced to" - , "open rows." - , "" - , "* Higher kinded types are coercible if they are coercible when fully" - , "saturated: `Coercible (f :: _ -> Type) (g :: _ -> Type)` holds when" - , "`Coercible (f a) (g a)` does." - , "" - , "This rule may seem puzzling since there is no term of type `_ -> Type` to" - , "apply `coerce` to, but it is necessary when coercing types with higher" - , "kinded parameters." - ] +coercible = + primClass P.Coercible $ + T.unlines + [ "Coercible is a two-parameter type class that has instances for types `a`" + , "and `b` if the compiler can infer that they have the same representation." + , "Coercible constraints are solved according to the following rules:" + , "" + , "* _reflexivity_, any type has the same representation as itself:" + , "`Coercible a a` holds." + , "" + , "* _symmetry_, if a type `a` can be coerced to some other type `b`, then `b`" + , "can also be coerced back to `a`: `Coercible a b` implies `Coercible b a`." + , "" + , "* _transitivity_, if a type `a` can be coerced to some other type `b` which" + , "can be coerced to some other type `c`, then `a` can also be coerced to `c`:" + , "`Coercible a b` and `Coercible b c` imply `Coercible a c`." + , "" + , "* Newtypes can be freely wrapped and unwrapped when their constructor is" + , "in scope:" + , "" + , " newtype Age = Age Int" + , "" + , "`Coercible Int Age` and `Coercible Age Int` hold since `Age` has the same" + , "runtime representation than `Int`." + , "" + , "Newtype constructors have to be in scope to preserve abstraction. It's" + , "common to declare a newtype to encode some invariants (non emptiness of" + , "lists with `Data.List.NonEmpty.NonEmptyList` for example), hide its" + , "constructor and export smart constructors instead. Without this restriction," + , "the guarantees provided by such newtypes would be void." + , "" + , "* If none of the above are applicable, two types of kind `Type` may be" + , "coercible, but only if their heads are the same. For example," + , "`Coercible (Maybe a) (Either a b)` does not hold because `Maybe` and" + , "`Either` are different. Those types don't share a common runtime" + , "representation so coercing between them would be unsafe. In addition their" + , "arguments may need to be identical or coercible, depending on the _roles_" + , "of the head's type parameters. Roles are documented in [the PureScript" + , "language reference](https://github.com/purescript/documentation/blob/master/language/Roles.md)." + , "" + , "Coercible being polykinded, we can also coerce more than types of kind `Type`:" + , "" + , "* Rows are coercible when they have the same labels, when the corresponding" + , "pairs of types are coercible and when their tails are coercible:" + , "`Coercible ( label :: a | r ) ( label :: b | s )` holds when" + , "`Coercible a b` and `Coercible r s` do. Closed rows cannot be coerced to" + , "open rows." + , "" + , "* Higher kinded types are coercible if they are coercible when fully" + , "saturated: `Coercible (f :: _ -> Type) (g :: _ -> Type)` holds when" + , "`Coercible (f a) (g a)` does." + , "" + , "This rule may seem puzzling since there is no term of type `_ -> Type` to" + , "apply `coerce` to, but it is necessary when coercing types with higher" + , "kinded parameters." + ] kindOrdering :: Declaration -kindOrdering = primType P.TypeOrdering $ T.unlines - [ "The `Ordering` kind represents the three possibilities of comparing two" - , "types of the same kind: `LT` (less than), `EQ` (equal to), and" - , "`GT` (greater than)." - ] +kindOrdering = + primType P.TypeOrdering $ + T.unlines + [ "The `Ordering` kind represents the three possibilities of comparing two" + , "types of the same kind: `LT` (less than), `EQ` (equal to), and" + , "`GT` (greater than)." + ] orderingLT :: Declaration -orderingLT = primType P.LT $ T.unlines - [ "The 'less than' ordering type." - ] +orderingLT = + primType P.LT $ + T.unlines + [ "The 'less than' ordering type." + ] orderingEQ :: Declaration -orderingEQ = primType P.EQ $ T.unlines - [ "The 'equal to' ordering type." - ] +orderingEQ = + primType P.EQ $ + T.unlines + [ "The 'equal to' ordering type." + ] orderingGT :: Declaration -orderingGT = primType P.GT $ T.unlines - [ "The 'greater than' ordering type." - ] +orderingGT = + primType P.GT $ + T.unlines + [ "The 'greater than' ordering type." + ] union :: Declaration -union = primClass P.RowUnion $ T.unlines - [ "The Union type class is used to compute the union of two rows of types" - , "(left-biased, including duplicates)." - , "" - , "The third type argument represents the union of the first two." - ] +union = + primClass P.RowUnion $ + T.unlines + [ "The Union type class is used to compute the union of two rows of types" + , "(left-biased, including duplicates)." + , "" + , "The third type argument represents the union of the first two." + ] nub :: Declaration -nub = primClass P.RowNub $ T.unlines - [ "The Nub type class is used to remove duplicate labels from rows." - ] +nub = + primClass P.RowNub $ + T.unlines + [ "The Nub type class is used to remove duplicate labels from rows." + ] lacks :: Declaration -lacks = primClass P.RowLacks $ T.unlines - [ "The Lacks type class asserts that a label does not occur in a given row." - ] +lacks = + primClass P.RowLacks $ + T.unlines + [ "The Lacks type class asserts that a label does not occur in a given row." + ] rowCons :: Declaration -rowCons = primClass P.RowCons $ T.unlines - [ "The Cons type class is a 4-way relation which asserts that one row of" - , "types can be obtained from another by inserting a new label/type pair on" - , "the left." - ] +rowCons = + primClass P.RowCons $ + T.unlines + [ "The Cons type class is a 4-way relation which asserts that one row of" + , "types can be obtained from another by inserting a new label/type pair on" + , "the left." + ] kindRowList :: Declaration -kindRowList = primType P.RowList $ T.unlines - [ "A type level list representation of a row of types." - ] +kindRowList = + primType P.RowList $ + T.unlines + [ "A type level list representation of a row of types." + ] rowListCons :: Declaration -rowListCons = primType P.RowListCons $ T.unlines - [ "Constructs a new `RowList` from a label, a type, and an existing tail" - , "`RowList`. E.g: `Cons \"x\" Int (Cons \"y\" Int Nil)`." - ] +rowListCons = + primType P.RowListCons $ + T.unlines + [ "Constructs a new `RowList` from a label, a type, and an existing tail" + , "`RowList`. E.g: `Cons \"x\" Int (Cons \"y\" Int Nil)`." + ] rowListNil :: Declaration -rowListNil = primType P.RowListNil $ T.unlines - [ "The empty `RowList`." - ] +rowListNil = + primType P.RowListNil $ + T.unlines + [ "The empty `RowList`." + ] rowToList :: Declaration -rowToList = primClass P.RowToList $ T.unlines - [ "Compiler solved type class for generating a `RowList` from a closed row" - , "of types. Entries are sorted by label and duplicates are preserved in" - , "the order they appeared in the row." - ] +rowToList = + primClass P.RowToList $ + T.unlines + [ "Compiler solved type class for generating a `RowList` from a closed row" + , "of types. Entries are sorted by label and duplicates are preserved in" + , "the order they appeared in the row." + ] symbolAppend :: Declaration -symbolAppend = primClass P.SymbolAppend $ T.unlines - [ "Compiler solved type class for appending `Symbol`s together." - ] +symbolAppend = + primClass P.SymbolAppend $ + T.unlines + [ "Compiler solved type class for appending `Symbol`s together." + ] symbolCompare :: Declaration -symbolCompare = primClass P.SymbolCompare $ T.unlines - [ "Compiler solved type class for comparing two `Symbol`s." - , "Produces an `Ordering`." - ] +symbolCompare = + primClass P.SymbolCompare $ + T.unlines + [ "Compiler solved type class for comparing two `Symbol`s." + , "Produces an `Ordering`." + ] symbolCons :: Declaration -symbolCons = primClass P.SymbolCons $ T.unlines - [ "Compiler solved type class for either splitting up a symbol into its" - , "head and tail or for combining a head and tail into a new symbol." - , "Requires the head to be a single character and the combined string" - , "cannot be empty." - ] +symbolCons = + primClass P.SymbolCons $ + T.unlines + [ "Compiler solved type class for either splitting up a symbol into its" + , "head and tail or for combining a head and tail into a new symbol." + , "Requires the head to be a single character and the combined string" + , "cannot be empty." + ] intAdd :: Declaration -intAdd = primClass P.IntAdd $ T.unlines - [ "Compiler solved type class for adding type-level `Int`s." - ] +intAdd = + primClass P.IntAdd $ + T.unlines + [ "Compiler solved type class for adding type-level `Int`s." + ] intCompare :: Declaration -intCompare = primClass P.IntCompare $ T.unlines - [ "Compiler solved type class for comparing two type-level `Int`s." - , "Produces an `Ordering`." - ] +intCompare = + primClass P.IntCompare $ + T.unlines + [ "Compiler solved type class for comparing two type-level `Int`s." + , "Produces an `Ordering`." + ] intMul :: Declaration -intMul = primClass P.IntMul $ T.unlines - [ "Compiler solved type class for multiplying type-level `Int`s." - ] +intMul = + primClass P.IntMul $ + T.unlines + [ "Compiler solved type class for multiplying type-level `Int`s." + ] intToString :: Declaration -intToString = primClass P.IntToString $ T.unlines - [ "Compiler solved type class for converting a type-level `Int` into a type-level `String` (i.e. `Symbol`)." - ] +intToString = + primClass P.IntToString $ + T.unlines + [ "Compiler solved type class for converting a type-level `Int` into a type-level `String` (i.e. `Symbol`)." + ] fail :: Declaration -fail = primClass P.Fail $ T.unlines - [ "The Fail type class is part of the custom type errors feature. To provide" - , "a custom type error when someone tries to use a particular instance," - , "write that instance out with a Fail constraint." - , "" - , "For more information, see" - , "[the Custom Type Errors guide](https://github.com/purescript/documentation/blob/master/guides/Custom-Type-Errors.md)." - ] +fail = + primClass P.Fail $ + T.unlines + [ "The Fail type class is part of the custom type errors feature. To provide" + , "a custom type error when someone tries to use a particular instance," + , "write that instance out with a Fail constraint." + , "" + , "For more information, see" + , "[the Custom Type Errors guide](https://github.com/purescript/documentation/blob/master/guides/Custom-Type-Errors.md)." + ] warn :: Declaration -warn = primClass P.Warn $ T.unlines - [ "The Warn type class allows a custom compiler warning to be displayed." - , "" - , "For more information, see" - , "[the Custom Type Errors guide](https://github.com/purescript/documentation/blob/master/guides/Custom-Type-Errors.md)." - ] +warn = + primClass P.Warn $ + T.unlines + [ "The Warn type class allows a custom compiler warning to be displayed." + , "" + , "For more information, see" + , "[the Custom Type Errors guide](https://github.com/purescript/documentation/blob/master/guides/Custom-Type-Errors.md)." + ] kindDoc :: Declaration -kindDoc = primType P.Doc $ T.unlines - [ "`Doc` is the kind of type-level documents." - , "" - , "This kind is used with the `Fail` and `Warn` type classes." - , "Build up a `Doc` with `Text`, `Quote`, `QuoteLabel`, `Beside`, and `Above`." - ] +kindDoc = + primType P.Doc $ + T.unlines + [ "`Doc` is the kind of type-level documents." + , "" + , "This kind is used with the `Fail` and `Warn` type classes." + , "Build up a `Doc` with `Text`, `Quote`, `QuoteLabel`, `Beside`, and `Above`." + ] textDoc :: Declaration -textDoc = primType P.Text $ T.unlines - [ "The Text type constructor makes a Doc from a Symbol" - , "to be used in a custom type error." - , "" - , "For more information, see" - , "[the Custom Type Errors guide](https://github.com/purescript/documentation/blob/master/guides/Custom-Type-Errors.md)." - ] +textDoc = + primType P.Text $ + T.unlines + [ "The Text type constructor makes a Doc from a Symbol" + , "to be used in a custom type error." + , "" + , "For more information, see" + , "[the Custom Type Errors guide](https://github.com/purescript/documentation/blob/master/guides/Custom-Type-Errors.md)." + ] quoteDoc :: Declaration -quoteDoc = primType P.Quote $ T.unlines - [ "The Quote type constructor renders any concrete type as a Doc" - , "to be used in a custom type error." - , "" - , "For more information, see" - , "[the Custom Type Errors guide](https://github.com/purescript/documentation/blob/master/guides/Custom-Type-Errors.md)." - ] +quoteDoc = + primType P.Quote $ + T.unlines + [ "The Quote type constructor renders any concrete type as a Doc" + , "to be used in a custom type error." + , "" + , "For more information, see" + , "[the Custom Type Errors guide](https://github.com/purescript/documentation/blob/master/guides/Custom-Type-Errors.md)." + ] quoteLabelDoc :: Declaration -quoteLabelDoc = primType P.QuoteLabel $ T.unlines - [ "The `QuoteLabel` type constructor will produce a `Doc` when given a `Symbol`. When the resulting `Doc` is rendered" - , "for a `Warn` or `Fail` constraint, a syntactically valid label will be produced, escaping with quotes as needed." - , "" - , "For more information, see" - , "[the Custom Type Errors guide](https://github.com/purescript/documentation/blob/master/guides/Custom-Type-Errors.md)." - ] +quoteLabelDoc = + primType P.QuoteLabel $ + T.unlines + [ "The `QuoteLabel` type constructor will produce a `Doc` when given a `Symbol`. When the resulting `Doc` is rendered" + , "for a `Warn` or `Fail` constraint, a syntactically valid label will be produced, escaping with quotes as needed." + , "" + , "For more information, see" + , "[the Custom Type Errors guide](https://github.com/purescript/documentation/blob/master/guides/Custom-Type-Errors.md)." + ] besideDoc :: Declaration -besideDoc = primType P.Beside $ T.unlines - [ "The Beside type constructor combines two Docs horizontally" - , "to be used in a custom type error." - , "" - , "For more information, see" - , "[the Custom Type Errors guide](https://github.com/purescript/documentation/blob/master/guides/Custom-Type-Errors.md)." - ] +besideDoc = + primType P.Beside $ + T.unlines + [ "The Beside type constructor combines two Docs horizontally" + , "to be used in a custom type error." + , "" + , "For more information, see" + , "[the Custom Type Errors guide](https://github.com/purescript/documentation/blob/master/guides/Custom-Type-Errors.md)." + ] aboveDoc :: Declaration -aboveDoc = primType P.Above $ T.unlines - [ "The Above type constructor combines two Docs vertically" - , "in a custom type error." - , "" - , "For more information, see" - , "[the Custom Type Errors guide](https://github.com/purescript/documentation/blob/master/guides/Custom-Type-Errors.md)." - ] +aboveDoc = + primType P.Above $ + T.unlines + [ "The Above type constructor combines two Docs vertically" + , "in a custom type error." + , "" + , "For more information, see" + , "[the Custom Type Errors guide](https://github.com/purescript/documentation/blob/master/guides/Custom-Type-Errors.md)." + ] diff --git a/src/Language/PureScript/Docs/Render.hs b/src/Language/PureScript/Docs/Render.hs index 3a0038d98..bdc994660 100644 --- a/src/Language/PureScript/Docs/Render.hs +++ b/src/Language/PureScript/Docs/Render.hs @@ -1,12 +1,12 @@ --- | --- Functions for creating `RenderedCode` values from data types in --- Language.PureScript.Docs.Types. --- --- These functions are the ones that are used in markdown/html documentation --- generation, but the intention is that you are able to supply your own --- instead if necessary. For example, the Hoogle input file generator --- substitutes some of these - +{- | +Functions for creating `RenderedCode` values from data types in +Language.PureScript.Docs.Types. + +These functions are the ones that are used in markdown/html documentation +generation, but the intention is that you are able to supply your own +instead if necessary. For example, the Hoogle input file generator +substitutes some of these +-} module Language.PureScript.Docs.Render where import Prelude @@ -16,7 +16,7 @@ import Data.Text (Text) import Data.Text qualified as T import Language.PureScript.Docs.RenderedCode -import Language.PureScript.Docs.Types (ChildDeclaration(..), ChildDeclarationInfo(..), Constraint', Declaration(..), DeclarationInfo(..), KindInfo(..), Type', isTypeClassMember, kindSignatureForKeyword) +import Language.PureScript.Docs.Types (ChildDeclaration (..), ChildDeclarationInfo (..), Constraint', Declaration (..), DeclarationInfo (..), KindInfo (..), Type', isTypeClassMember, kindSignatureForKeyword) import Language.PureScript.Docs.Utils.MonoidExtras (mintersperse) import Language.PureScript.AST qualified as P @@ -25,16 +25,17 @@ import Language.PureScript.Names qualified as P import Language.PureScript.Types qualified as P renderKindSig :: Text -> KindInfo -> RenderedCode -renderKindSig declTitle KindInfo{..} = - mintersperse sp - [ keyword $ kindSignatureForKeyword kiKeyword - , renderType (P.TypeConstructor () (notQualified declTitle)) - , syntax "::" - , renderType kiKind - ] +renderKindSig declTitle KindInfo {..} = + mintersperse + sp + [ keyword $ kindSignatureForKeyword kiKeyword + , renderType (P.TypeConstructor () (notQualified declTitle)) + , syntax "::" + , renderType kiKind + ] renderDeclaration :: Declaration -> RenderedCode -renderDeclaration Declaration{..} = +renderDeclaration Declaration {..} = mintersperse sp $ case declInfo of ValueDeclaration ty -> [ ident' declTitle @@ -45,7 +46,6 @@ renderDeclaration Declaration{..} = [ keyword (P.showDataDeclType dtype) , renderTypeWithRole roles (typeApp declTitle args) ] - -- All FFI declarations, except for `Prim` modules' doc declarations, -- will have been converted to `DataDeclaration`s by this point. ExternDataDeclaration kind' _ -> @@ -61,29 +61,30 @@ renderDeclaration Declaration{..} = , renderType ty ] TypeClassDeclaration args implies fundeps -> - [ keywordClass ] - ++ maybeToList superclasses - ++ [renderType (typeApp declTitle args)] - ++ fundepsList - ++ [keywordWhere | any isTypeClassMember declChildren] - + [keywordClass] + ++ maybeToList superclasses + ++ [renderType (typeApp declTitle args)] + ++ fundepsList + ++ [keywordWhere | any isTypeClassMember declChildren] where - superclasses - | null implies = Nothing - | otherwise = Just $ - syntax "(" - <> mintersperse (syntax "," <> sp) (map renderConstraint implies) - <> syntax ")" <> sp <> syntax "<=" - - fundepsList = - [syntax "|" | not (null fundeps)] - ++ [mintersperse - (syntax "," <> sp) - [typeVars from <> sp <> syntax "->" <> sp <> typeVars to | (from, to) <- fundeps ] - ] - where - typeVars = mintersperse sp . map typeVar - + superclasses + | null implies = Nothing + | otherwise = + Just $ + syntax "(" + <> mintersperse (syntax "," <> sp) (map renderConstraint implies) + <> syntax ")" + <> sp + <> syntax "<=" + + fundepsList = + [syntax "|" | not (null fundeps)] + ++ [ mintersperse + (syntax "," <> sp) + [typeVars from <> sp <> syntax "->" <> sp <> typeVars to | (from, to) <- fundeps] + ] + where + typeVars = mintersperse sp . map typeVar AliasDeclaration (P.Fixity associativity precedence) for -> [ keywordFixity associativity , syntax $ T.pack $ show precedence @@ -93,13 +94,12 @@ renderDeclaration Declaration{..} = ] renderChildDeclaration :: ChildDeclaration -> RenderedCode -renderChildDeclaration ChildDeclaration{..} = +renderChildDeclaration ChildDeclaration {..} = mintersperse sp $ case cdeclInfo of ChildInstance constraints ty -> - maybeToList (renderConstraints constraints) ++ [ renderType ty ] + maybeToList (renderConstraints constraints) ++ [renderType ty] ChildDataConstructor args -> dataCtor' cdeclTitle : map renderTypeAtom args - ChildTypeClassMember ty -> [ ident' cdeclTitle , syntax "::" @@ -113,14 +113,18 @@ renderConstraint (P.Constraint ann pn kinds tys _) = renderConstraints :: [Constraint'] -> Maybe RenderedCode renderConstraints constraints | null constraints = Nothing - | otherwise = Just $ + | otherwise = + Just $ syntax "(" - <> renderedConstraints - <> syntax ")" <> sp <> syntax "=>" + <> renderedConstraints + <> syntax ")" + <> sp + <> syntax "=>" where - renderedConstraints = - mintersperse (syntax "," <> sp) - (map renderConstraint constraints) + renderedConstraints = + mintersperse + (syntax "," <> sp) + (map renderConstraint constraints) notQualified :: Text -> P.Qualified (P.ProperName a) notQualified = P.Qualified P.ByNullSourcePos . P.ProperName @@ -131,12 +135,12 @@ ident' = ident . P.Qualified P.ByNullSourcePos . P.Ident dataCtor' :: Text -> RenderedCode dataCtor' = dataCtor . notQualified -typeApp :: Text -> [(Text, Maybe Type')] -> Type' +typeApp :: Text -> [(Text, Type')] -> Type' typeApp title typeArgs = - foldl (P.TypeApp ()) - (P.TypeConstructor () (notQualified title)) - (map toTypeVar typeArgs) + foldl + (P.TypeApp ()) + (P.TypeConstructor () (notQualified title)) + (map toTypeVar typeArgs) -toTypeVar :: (Text, Maybe Type') -> Type' -toTypeVar (s, Nothing) = P.TypeVar () s -toTypeVar (s, Just k) = P.KindedType () (P.TypeVar () s) k +toTypeVar :: (Text, Type') -> Type' +toTypeVar (s, k) = P.TypeVar () s k diff --git a/src/Language/PureScript/Docs/RenderedCode.hs b/src/Language/PureScript/Docs/RenderedCode.hs index 2d8d0253e..2162e76b5 100644 --- a/src/Language/PureScript/Docs/RenderedCode.hs +++ b/src/Language/PureScript/Docs/RenderedCode.hs @@ -1,8 +1,7 @@ - --- | Data types and functions for representing a simplified form of PureScript --- code, intended for use in e.g. HTML documentation. - +{- | Data types and functions for representing a simplified form of PureScript +code, intended for use in e.g. HTML documentation. +-} module Language.PureScript.Docs.RenderedCode (module RenderedCode) where -import Language.PureScript.Docs.RenderedCode.Types as RenderedCode import Language.PureScript.Docs.RenderedCode.RenderType as RenderedCode +import Language.PureScript.Docs.RenderedCode.Types as RenderedCode diff --git a/src/Language/PureScript/Docs/RenderedCode/RenderType.hs b/src/Language/PureScript/Docs/RenderedCode/RenderType.hs index a082b4b83..b30a08a34 100644 --- a/src/Language/PureScript/Docs/RenderedCode/RenderType.hs +++ b/src/Language/PureScript/Docs/RenderedCode/RenderType.hs @@ -2,21 +2,20 @@ {-# LANGUAGE NoPatternSynonyms #-} -- | Functions for producing RenderedCode values from PureScript Type values. - -module Language.PureScript.Docs.RenderedCode.RenderType - ( renderType - , renderTypeWithRole - , renderType' - , renderTypeAtom - , renderTypeAtom' - , renderRow - ) where +module Language.PureScript.Docs.RenderedCode.RenderType ( + renderType, + renderTypeWithRole, + renderType', + renderTypeAtom, + renderTypeAtom', + renderRow, +) where import Prelude +import Data.List (uncons) import Data.Maybe (fromMaybe) import Data.Text (Text, pack) -import Data.List (uncons) import Control.Arrow ((<+>)) import Control.PatternArrows as PA @@ -24,10 +23,10 @@ import Control.PatternArrows as PA import Language.PureScript.Crash (internalError) import Language.PureScript.Label (Label) import Language.PureScript.Names (coerceProperName) -import Language.PureScript.Pretty.Types (PrettyPrintConstraint, PrettyPrintType(..), convertPrettyPrintType, prettyPrintLabel) +import Language.PureScript.PSString (prettyPrintString) +import Language.PureScript.Pretty.Types (PrettyPrintConstraint, PrettyPrintType (..), convertPrettyPrintType, prettyPrintLabel) import Language.PureScript.Roles (Role, displayRole) import Language.PureScript.Types (Type, TypeVarVisibility, typeVarVisibilityPrefix) -import Language.PureScript.PSString (prettyPrintString) import Language.PureScript.Docs.RenderedCode.Types (RenderedCode, keywordForall, roleAnn, sp, syntax, typeCtor, typeOp, typeVar) import Language.PureScript.Docs.Utils.MonoidExtras (mintersperse) @@ -35,47 +34,50 @@ import Language.PureScript.Docs.Utils.MonoidExtras (mintersperse) typeLiterals :: Pattern () PrettyPrintType RenderedCode typeLiterals = mkPattern match where - match (PPTypeWildcard name) = - Just $ syntax $ maybe "_" ("?" <>) name - match (PPTypeVar var role) = - Just $ typeVar var <> roleAnn role - match (PPRecord labels tail_) = - Just $ mintersperse sp - [ syntax "{" - , renderRow labels tail_ - , syntax "}" - ] - match (PPTypeConstructor n) = - Just (typeCtor n) - match (PPRow labels tail_) = - Just (syntax "(" <> renderRow labels tail_ <> syntax ")") - match (PPBinaryNoParensType op l r) = - Just $ renderTypeAtom' l <> sp <> renderTypeAtom' op <> sp <> renderTypeAtom' r - match (PPTypeOp n) = - Just (typeOp n) - match (PPTypeLevelString str) = - Just (syntax (prettyPrintString str)) - match (PPTypeLevelInt nat) = - Just (syntax $ pack $ show nat) - match _ = - Nothing + match (PPTypeWildcard name) = + Just $ syntax $ maybe "_" ("?" <>) name + match (PPTypeVar var role) = + Just $ typeVar var <> roleAnn role + match (PPRecord labels tail_) = + Just $ + mintersperse + sp + [ syntax "{" + , renderRow labels tail_ + , syntax "}" + ] + match (PPTypeConstructor n) = + Just (typeCtor n) + match (PPRow labels tail_) = + Just (syntax "(" <> renderRow labels tail_ <> syntax ")") + match (PPBinaryNoParensType op l r) = + Just $ renderTypeAtom' l <> sp <> renderTypeAtom' op <> sp <> renderTypeAtom' r + match (PPTypeOp n) = + Just (typeOp n) + match (PPTypeLevelString str) = + Just (syntax (prettyPrintString str)) + match (PPTypeLevelInt nat) = + Just (syntax $ pack $ show nat) + match _ = + Nothing renderConstraint :: PrettyPrintConstraint -> RenderedCode renderConstraint (pn, ks, tys) = let instApp = foldl PPTypeApp (foldl (\a b -> PPTypeApp a (PPKindArg b)) (PPTypeConstructor (fmap coerceProperName pn)) ks) tys - in renderType' instApp + in renderType' instApp renderConstraints :: PrettyPrintConstraint -> RenderedCode -> RenderedCode renderConstraints con ty = - mintersperse sp + mintersperse + sp [ renderConstraint con , syntax "=>" , ty ] --- | --- Render code representing a Row --- +{- | +Render code representing a Row +-} renderRow :: [(Label, PrettyPrintType)] -> Maybe PrettyPrintType -> RenderedCode renderRow h t = renderHead h <> renderTail t @@ -84,7 +86,8 @@ renderHead = mintersperse (syntax "," <> sp) . map renderLabel renderLabel :: (Label, PrettyPrintType) -> RenderedCode renderLabel (label, ty) = - mintersperse sp + mintersperse + sp [ typeVar $ prettyPrintLabel label , syntax "::" , renderType' ty @@ -97,159 +100,151 @@ renderTail (Just other) = sp <> syntax "|" <> sp <> renderType' other typeApp :: Pattern () PrettyPrintType (PrettyPrintType, PrettyPrintType) typeApp = mkPattern match where - match (PPTypeApp f x) = Just (f, x) - match _ = Nothing + match (PPTypeApp f x) = Just (f, x) + match _ = Nothing kindArg :: Pattern () PrettyPrintType ((), PrettyPrintType) kindArg = mkPattern match where - match (PPKindArg ty) = Just ((), ty) - match _ = Nothing + match (PPKindArg ty) = Just ((), ty) + match _ = Nothing appliedFunction :: Pattern () PrettyPrintType (PrettyPrintType, PrettyPrintType) appliedFunction = mkPattern match where - match (PPFunction arg ret) = Just (arg, ret) - match _ = Nothing + match (PPFunction arg ret) = Just (arg, ret) + match _ = Nothing kinded :: Pattern () PrettyPrintType (PrettyPrintType, PrettyPrintType) kinded = mkPattern match where - match (PPKindedType t k) = Just (t, k) - match _ = Nothing + match (PPKindedType t k) = Just (t, k) + match _ = Nothing constrained :: Pattern () PrettyPrintType (PrettyPrintConstraint, PrettyPrintType) constrained = mkPattern match where - match (PPConstrainedType con ty) = Just (con, ty) - match _ = Nothing + match (PPConstrainedType con ty) = Just (con, ty) + match _ = Nothing explicitParens :: Pattern () PrettyPrintType ((), PrettyPrintType) explicitParens = mkPattern match where - match (PPParensInType ty) = Just ((), ty) - match _ = Nothing + match (PPParensInType ty) = Just ((), ty) + match _ = Nothing matchTypeAtom :: Pattern () PrettyPrintType RenderedCode matchTypeAtom = typeLiterals <+> fmap parens_ matchType where - parens_ x = syntax "(" <> x <> syntax ")" + parens_ x = syntax "(" <> x <> syntax ")" matchType :: Pattern () PrettyPrintType RenderedCode matchType = buildPrettyPrinter operators matchTypeAtom where - operators :: OperatorTable () PrettyPrintType RenderedCode - operators = - OperatorTable [ [ Wrap kindArg $ \_ ty -> syntax "@" <> ty ] - , [ AssocL typeApp $ \f x -> f <> sp <> x ] - , [ AssocR appliedFunction $ \arg ret -> mintersperse sp [arg, syntax "->", ret] ] - , [ Wrap constrained $ \deps ty -> renderConstraints deps ty ] - , [ Wrap forall_ $ \tyVars ty -> mconcat [ keywordForall, sp, renderTypeVars tyVars, syntax ".", sp, ty ] ] - , [ Wrap kinded $ \ty k -> mintersperse sp [renderType' ty, syntax "::", k] ] - , [ Wrap explicitParens $ \_ ty -> ty ] - ] - -forall_ :: Pattern () PrettyPrintType ([(TypeVarVisibility, Text, Maybe PrettyPrintType)], PrettyPrintType) + operators :: OperatorTable () PrettyPrintType RenderedCode + operators = + OperatorTable + [ [Wrap kindArg $ \_ ty -> syntax "@" <> ty] + , [AssocL typeApp $ \f x -> f <> sp <> x] + , [AssocR appliedFunction $ \arg ret -> mintersperse sp [arg, syntax "->", ret]] + , [Wrap constrained $ \deps ty -> renderConstraints deps ty] + , [Wrap forall_ $ \tyVars ty -> mconcat [keywordForall, sp, renderTypeVars tyVars, syntax ".", sp, ty]] + , [Wrap kinded $ \ty k -> mintersperse sp [renderType' ty, syntax "::", k]] + , [Wrap explicitParens $ \_ ty -> ty] + ] + +forall_ :: Pattern () PrettyPrintType ([(TypeVarVisibility, Text, PrettyPrintType)], PrettyPrintType) forall_ = mkPattern match where - match (PPForAll mbKindedIdents ty) = Just (mbKindedIdents, ty) - match _ = Nothing + match (PPForAll mbKindedIdents ty) = Just (mbKindedIdents, ty) + match _ = Nothing renderTypeInternal :: (PrettyPrintType -> PrettyPrintType) -> Type a -> RenderedCode renderTypeInternal insertRolesIfAny = renderType' . insertRolesIfAny . convertPrettyPrintType maxBound --- | --- Render code representing a Type --- +{- | +Render code representing a Type +-} renderType :: Type a -> RenderedCode renderType = renderTypeInternal id --- | --- Render code representing a Type --- but augment the `TypeVar`s with their `Role` if they have one --- +{- | +Render code representing a Type +but augment the `TypeVar`s with their `Role` if they have one +-} renderTypeWithRole :: [Role] -> Type a -> RenderedCode renderTypeWithRole = \case [] -> renderType roleList -> renderTypeInternal (addRole roleList [] . Left) where - -- `data Foo first second = Foo` will produce - -- ``` - -- PPTypeApp - -- (PPTypeApp (PPTypeConstructor fooName) (PPTypeVar "first" Nothing)) - -- (PPTypeVar "second" Nothing) - -- ``` - -- So, we recurse down the left side of `TypeApp` first before - -- recursing down the right side. To make this stack-safe, - -- we use a tail-recursive function with its own stack. - -- - Left = values that have not yet been examined and need - -- a role added to them (if any). There's still work "left" to do. - -- - Right = values that have been examined and now need to be - -- reassembled into their original value - addRole - :: [Role] - -> [Either PrettyPrintType PrettyPrintType] - -> Either PrettyPrintType PrettyPrintType - -> PrettyPrintType - addRole roles stack pp = case pp of - Left next -> case next of - PPTypeVar t Nothing - | Just (x, xs) <- uncons roles -> - addRole xs stack (Right $ PPTypeVar t (Just $ displayRole x)) - | otherwise -> - internalError "addRole: invalid arguments - number of roles doesn't match number of type parameters" - - PPTypeVar _ (Just _) -> - internalError "addRole: attempted to add a second role to a type parameter that already has one" - - PPTypeApp leftSide rightSide -> do - -- push right-side to stack and continue recursing on left-side - addRole roles (Left rightSide : stack) (Left leftSide) - - other -> - -- nothing to check, so move on - addRole roles stack (Right other) - - - pendingAssembly@(Right rightSideOrFinalValue) -> case stack of - (unfinishedRightSide@(Left _) : remaining) -> - -- We've finished recursing through the left-side of a `TypeApp`. - -- Now we'll recurse through the right-side. - -- We push `pendingAssembly` onto the stack so we can assemble - -- the `PPTypeApp` together once it's right-side is done. - addRole roles (pendingAssembly : remaining) unfinishedRightSide - - (Right leftSide : remaining) -> - -- We've finished recursing through the right-side of a `TypeApp` - -- We'll rebulid it and wrap it in `Right` so any other higher-level - -- `TypeApp`s can be reassembled now, too. - addRole roles remaining (Right (PPTypeApp leftSide rightSideOrFinalValue)) - - [] -> - -- We've reassembled everything. It's time to return. - rightSideOrFinalValue + -- `data Foo first second = Foo` will produce + -- ``` + -- PPTypeApp + -- (PPTypeApp (PPTypeConstructor fooName) (PPTypeVar "first" Nothing)) + -- (PPTypeVar "second" Nothing) + -- ``` + -- So, we recurse down the left side of `TypeApp` first before + -- recursing down the right side. To make this stack-safe, + -- we use a tail-recursive function with its own stack. + -- - Left = values that have not yet been examined and need + -- a role added to them (if any). There's still work "left" to do. + -- - Right = values that have been examined and now need to be + -- reassembled into their original value + addRole :: + [Role] -> + [Either PrettyPrintType PrettyPrintType] -> + Either PrettyPrintType PrettyPrintType -> + PrettyPrintType + addRole roles stack pp = case pp of + Left next -> case next of + PPTypeVar t Nothing + | Just (x, xs) <- uncons roles -> + addRole xs stack (Right $ PPTypeVar t (Just $ displayRole x)) + | otherwise -> + internalError "addRole: invalid arguments - number of roles doesn't match number of type parameters" + PPTypeVar _ (Just _) -> + internalError "addRole: attempted to add a second role to a type parameter that already has one" + PPTypeApp leftSide rightSide -> do + -- push right-side to stack and continue recursing on left-side + addRole roles (Left rightSide : stack) (Left leftSide) + other -> + -- nothing to check, so move on + addRole roles stack (Right other) + pendingAssembly@(Right rightSideOrFinalValue) -> case stack of + (unfinishedRightSide@(Left _) : remaining) -> + -- We've finished recursing through the left-side of a `TypeApp`. + -- Now we'll recurse through the right-side. + -- We push `pendingAssembly` onto the stack so we can assemble + -- the `PPTypeApp` together once it's right-side is done. + addRole roles (pendingAssembly : remaining) unfinishedRightSide + (Right leftSide : remaining) -> + -- We've finished recursing through the right-side of a `TypeApp` + -- We'll rebulid it and wrap it in `Right` so any other higher-level + -- `TypeApp`s can be reassembled now, too. + addRole roles remaining (Right (PPTypeApp leftSide rightSideOrFinalValue)) + [] -> + -- We've reassembled everything. It's time to return. + rightSideOrFinalValue renderType' :: PrettyPrintType -> RenderedCode -renderType' - = fromMaybe (internalError "Incomplete pattern") - . PA.pattern matchType () +renderType' = + fromMaybe (internalError "Incomplete pattern") + . PA.pattern matchType () -renderTypeVars :: [(TypeVarVisibility, Text, Maybe PrettyPrintType)] -> RenderedCode +renderTypeVars :: [(TypeVarVisibility, Text, PrettyPrintType)] -> RenderedCode renderTypeVars tyVars = mintersperse sp (map renderTypeVar tyVars) -renderTypeVar :: (TypeVarVisibility, Text, Maybe PrettyPrintType) -> RenderedCode -renderTypeVar (vis, v, mbK) = case mbK of - Nothing -> syntax (typeVarVisibilityPrefix vis) <> typeVar v - Just k -> mintersperse sp [ mconcat [syntax "(", syntax $ typeVarVisibilityPrefix vis, typeVar v], syntax "::", mconcat [renderType' k, syntax ")"] ] +renderTypeVar :: (TypeVarVisibility, Text, PrettyPrintType) -> RenderedCode +renderTypeVar (vis, v, k) = mintersperse sp [mconcat [syntax "(", syntax $ typeVarVisibilityPrefix vis, typeVar v], syntax "::", mconcat [renderType' k, syntax ")"]] --- | --- Render code representing a Type, as it should appear inside parentheses --- +{- | +Render code representing a Type, as it should appear inside parentheses +-} renderTypeAtom :: Type a -> RenderedCode renderTypeAtom = renderTypeAtom' . convertPrettyPrintType maxBound renderTypeAtom' :: PrettyPrintType -> RenderedCode -renderTypeAtom' - = fromMaybe (internalError "Incomplete pattern") - . PA.pattern matchTypeAtom () +renderTypeAtom' = + fromMaybe (internalError "Incomplete pattern") + . PA.pattern matchTypeAtom () diff --git a/src/Language/PureScript/Docs/RenderedCode/Types.hs b/src/Language/PureScript/Docs/RenderedCode/Types.hs index c1374899f..50173932a 100644 --- a/src/Language/PureScript/Docs/RenderedCode/Types.hs +++ b/src/Language/PureScript/Docs/RenderedCode/Types.hs @@ -1,81 +1,81 @@ --- | Data types and functions for representing a simplified form of PureScript --- code, intended for use in e.g. HTML documentation. - -module Language.PureScript.Docs.RenderedCode.Types - ( RenderedCodeElement(..) - , ContainingModule(..) - , asContainingModule - , maybeToContainingModule - , fromQualified - , Namespace(..) - , Link(..) - , FixityAlias - , RenderedCode - , outputWith - , sp - , syntax - , keyword - , keywordForall - , keywordData - , keywordType - , keywordClass - , keywordWhere - , keywordFixity - , keywordAs - , ident - , dataCtor - , typeCtor - , typeOp - , typeVar - , roleAnn - , alias - , aliasName - ) where +{- | Data types and functions for representing a simplified form of PureScript +code, intended for use in e.g. HTML documentation. +-} +module Language.PureScript.Docs.RenderedCode.Types ( + RenderedCodeElement (..), + ContainingModule (..), + asContainingModule, + maybeToContainingModule, + fromQualified, + Namespace (..), + Link (..), + FixityAlias, + RenderedCode, + outputWith, + sp, + syntax, + keyword, + keywordForall, + keywordData, + keywordType, + keywordClass, + keywordWhere, + keywordFixity, + keywordAs, + ident, + dataCtor, + typeCtor, + typeOp, + typeVar, + roleAnn, + alias, + aliasName, +) where -import Prelude import GHC.Generics (Generic) +import Prelude import Control.DeepSeq (NFData) -import Control.Monad.Error.Class (MonadError(..)) +import Control.Monad.Error.Class (MonadError (..)) -import Data.Aeson.BetterErrors (Parse, nth, withText, withValue, toAesonParser, perhaps, asText) import Data.Aeson qualified as A +import Data.Aeson.BetterErrors (Parse, asText, nth, perhaps, toAesonParser, withText, withValue) +import Data.ByteString.Lazy qualified as BS import Data.Text (Text) import Data.Text qualified as T -import Data.ByteString.Lazy qualified as BS import Data.Text.Encoding qualified as TE -import Language.PureScript.Names (pattern ByNullSourcePos, Ident(..), ModuleName, OpName(..), OpNameType(..), ProperName(..), ProperNameType(..), Qualified(..), QualifiedBy(..), moduleNameFromString, runIdent, runModuleName) -import Language.PureScript.AST (Associativity(..)) +import Language.PureScript.AST (Associativity (..)) +import Language.PureScript.Names (Ident (..), ModuleName, OpName (..), OpNameType (..), ProperName (..), ProperNameType (..), Qualified (..), QualifiedBy (..), moduleNameFromString, runIdent, runModuleName, pattern ByNullSourcePos) --- | Given a list of actions, attempt them all, returning the first success. --- If all the actions fail, 'tryAll' returns the first argument. -tryAll :: MonadError e m => m a -> [m a] -> m a +{- | Given a list of actions, attempt them all, returning the first success. +If all the actions fail, 'tryAll' returns the first argument. +-} +tryAll :: (MonadError e m) => m a -> [m a] -> m a tryAll = foldr $ \x y -> catchError x (const y) firstEq :: Text -> Parse Text a -> Parse Text a firstEq str p = nth 0 (withText (eq str)) *> p where - eq s s' = if s == s' then Right () else Left "" + eq s s' = if s == s' then Right () else Left "" --- | --- Try the given parsers in sequence. If all fail, fail with the given message, --- and include the JSON in the error. --- +{- | +Try the given parsers in sequence. If all fail, fail with the given message, +and include the JSON in the error. +-} tryParse :: Text -> [Parse Text a] -> Parse Text a tryParse msg = tryAll (withValue (Left . (fullMsg <>) . showJSON)) - where - fullMsg = "Invalid " <> msg <> ": " + fullMsg = "Invalid " <> msg <> ": " - showJSON :: A.Value -> Text - showJSON = TE.decodeUtf8 . BS.toStrict . A.encode + showJSON :: A.Value -> Text + showJSON = TE.decodeUtf8 . BS.toStrict . A.encode --- | --- This type is isomorphic to 'Maybe' 'ModuleName'. It makes code a bit --- easier to read, as the meaning is more explicit. --- +{- | +This type is isomorphic to 'Maybe' 'ModuleName'. It makes code a bit +easier to read, as the meaning is more explicit. +-} data ContainingModule = ThisModule | OtherModule ModuleName @@ -84,9 +84,9 @@ data ContainingModule instance A.ToJSON ContainingModule where toJSON = A.toJSON . go where - go = \case - ThisModule -> ["ThisModule"] - OtherModule mn -> ["OtherModule", runModuleName mn] + go = \case + ThisModule -> ["ThisModule"] + OtherModule mn -> ["OtherModule", runModuleName mn] instance A.FromJSON ContainingModule where parseJSON = toAesonParser id asContainingModule @@ -96,22 +96,22 @@ asContainingModule = tryParse "containing module" $ current ++ backwardsCompat where - current = - [ firstEq "ThisModule" (pure ThisModule) - , firstEq "OtherModule" (OtherModule <$> nth 1 asModuleName) - ] - - -- For JSON produced by compilers up to 0.10.5. - backwardsCompat = - [ maybeToContainingModule <$> perhaps asModuleName - ] - - asModuleName = moduleNameFromString <$> asText - --- | --- Convert a 'Maybe' 'ModuleName' to a 'ContainingModule', using the obvious --- isomorphism. --- + current = + [ firstEq "ThisModule" (pure ThisModule) + , firstEq "OtherModule" (OtherModule <$> nth 1 asModuleName) + ] + + -- For JSON produced by compilers up to 0.10.5. + backwardsCompat = + [ maybeToContainingModule <$> perhaps asModuleName + ] + + asModuleName = moduleNameFromString <$> asText + +{- | +Convert a 'Maybe' 'ModuleName' to a 'ContainingModule', using the obvious +isomorphism. +-} maybeToContainingModule :: Maybe ModuleName -> ContainingModule maybeToContainingModule Nothing = ThisModule maybeToContainingModule (Just mn) = OtherModule mn @@ -132,7 +132,8 @@ instance A.ToJSON Link where asLink :: Parse Text Link asLink = - tryParse "link" + tryParse + "link" [ firstEq "NoLink" (pure NoLink) , firstEq "Link" (Link <$> nth 1 asContainingModule) ] @@ -152,7 +153,8 @@ instance A.ToJSON Namespace where asNamespace :: Parse Text Namespace asNamespace = - tryParse "namespace" + tryParse + "namespace" [ withText $ \case "ValueLevel" -> Right ValueLevel "TypeLevel" -> Right TypeLevel @@ -162,18 +164,18 @@ asNamespace = instance A.FromJSON Namespace where parseJSON = toAesonParser id asNamespace --- | --- A single element in a rendered code fragment. The intention is to support --- multiple output formats. For example, plain text, or highlighted HTML. --- +{- | +A single element in a rendered code fragment. The intention is to support +multiple output formats. For example, plain text, or highlighted HTML. +-} data RenderedCodeElement = Syntax Text | Keyword Text | Space - -- | Any symbol which you might or might not want to link to, in any - -- namespace (value, type, or kind). Note that this is not related to the - -- kind called Symbol for type-level strings. - | Symbol Namespace Text Link + | -- | Any symbol which you might or might not want to link to, in any + -- namespace (value, type, or kind). Note that this is not related to the + -- kind called Symbol for type-level strings. + Symbol Namespace Text Link | Role Text deriving (Show, Eq, Ord) @@ -189,29 +191,28 @@ instance A.ToJSON RenderedCodeElement where toJSON (Role role) = A.toJSON ["role", role] --- | --- A type representing a highly simplified version of PureScript code, intended --- for use in output formats like plain text or HTML. --- -newtype RenderedCode - = RC { unRC :: [RenderedCodeElement] } +{- | +A type representing a highly simplified version of PureScript code, intended +for use in output formats like plain text or HTML. +-} +newtype RenderedCode = RC {unRC :: [RenderedCodeElement]} deriving (Show, Eq, Ord, Semigroup, Monoid) instance A.ToJSON RenderedCode where toJSON (RC elems) = A.toJSON elems --- | --- This function allows conversion of a 'RenderedCode' value into a value of --- some other type (for example, plain text, or HTML). The first argument --- is a function specifying how each individual 'RenderedCodeElement' should be --- rendered. --- -outputWith :: Monoid a => (RenderedCodeElement -> a) -> RenderedCode -> a +{- | +This function allows conversion of a 'RenderedCode' value into a value of +some other type (for example, plain text, or HTML). The first argument +is a function specifying how each individual 'RenderedCodeElement' should be +rendered. +-} +outputWith :: (Monoid a) => (RenderedCodeElement -> a) -> RenderedCode -> a outputWith f = foldMap f . unRC --- | --- A 'RenderedCode' fragment representing a space. --- +{- | +A 'RenderedCode' fragment representing a space. +-} sp :: RenderedCode sp = RC [Space] @@ -269,10 +270,10 @@ typeVar x = RC [Symbol TypeLevel x NoLink] roleAnn :: Maybe Text -> RenderedCode roleAnn = RC . maybe [] renderRole where - renderRole = \case - "nominal" -> [Role "nominal"] - "phantom" -> [Role "phantom"] - _ -> [] + renderRole = \case + "nominal" -> [Role "nominal"] + "phantom" -> [Role "phantom"] + _ -> [] type FixityAlias = Qualified (Either (ProperName 'TypeName) (Either Ident (ProperName 'ConstructorName))) @@ -280,12 +281,12 @@ alias :: FixityAlias -> RenderedCode alias for = prefix <> RC [Symbol ns name (Link mn)] where - (ns, name, mn) = unpackFixityAlias for - prefix = case ns of - TypeLevel -> - keywordType <> sp - _ -> - mempty + (ns, name, mn) = unpackFixityAlias for + prefix = case ns of + TypeLevel -> + keywordType <> sp + _ -> + mempty aliasName :: FixityAlias -> Text -> RenderedCode aliasName for name' = @@ -293,15 +294,16 @@ aliasName for name' = (ns, _, _) = unpackFixityAlias for unParen = T.tail . T.init name = unParen name' - in + in case ns of ValueLevel -> ident (Qualified ByNullSourcePos (Ident name)) TypeLevel -> typeCtor (Qualified ByNullSourcePos (ProperName name)) --- | Converts a FixityAlias into a different representation which is more --- useful to other functions in this module. +{- | Converts a FixityAlias into a different representation which is more +useful to other functions in this module. +-} unpackFixityAlias :: FixityAlias -> (Namespace, Text, ContainingModule) unpackFixityAlias (fromQualified -> (mn, x)) = case x of diff --git a/src/Language/PureScript/Docs/Tags.hs b/src/Language/PureScript/Docs/Tags.hs index e3651c9fa..d1e7e2bce 100644 --- a/src/Language/PureScript/Docs/Tags.hs +++ b/src/Language/PureScript/Docs/Tags.hs @@ -1,8 +1,8 @@ -module Language.PureScript.Docs.Tags - ( tags - , dumpCtags - , dumpEtags - ) where +module Language.PureScript.Docs.Tags ( + tags, + dumpCtags, + dumpEtags, +) where import Prelude @@ -11,14 +11,14 @@ import Data.List (sort) import Data.Maybe (mapMaybe) import Data.Text qualified as T import Language.PureScript.AST (SourceSpan, sourcePosLine, spanStart) -import Language.PureScript.Docs.Types (ChildDeclaration(..), Declaration(..), Module(..)) +import Language.PureScript.Docs.Types (ChildDeclaration (..), Declaration (..), Module (..)) tags :: Module -> [(String, Int)] tags = map (first T.unpack) . concatMap dtags . modDeclarations where dtags :: Declaration -> [(T.Text, Int)] dtags decl = case declSourceSpan decl of - Just ss -> (declTitle decl, pos ss):mapMaybe subtag (declChildren decl) + Just ss -> (declTitle decl, pos ss) : mapMaybe subtag (declChildren decl) Nothing -> mapMaybe subtag $ declChildren decl subtag :: ChildDeclaration -> Maybe (T.Text, Int) @@ -37,9 +37,10 @@ dumpEtags = concatMap renderModEtags . sort renderModEtags :: (String, Module) -> [String] renderModEtags (path, mdl) = ["\x0c", path ++ "," ++ show tagsLen] ++ tagLines - where tagsLen = sum $ map length tagLines - tagLines = map tagLine $ tags mdl - tagLine (name, line) = "\x7f" ++ name ++ "\x01" ++ show line ++ "," + where + tagsLen = sum $ map length tagLines + tagLines = map tagLine $ tags mdl + tagLine (name, line) = "\x7f" ++ name ++ "\x01" ++ show line ++ "," -- ctags files are required to be sorted: http://ctags.sourceforge.net/FORMAT -- "The tags file is sorted on {tagname}. This allows for a binary search in @@ -49,5 +50,6 @@ dumpCtags = sort . concatMap renderModCtags renderModCtags :: (String, Module) -> [String] renderModCtags (path, mdl) = sort tagLines - where tagLines = map tagLine $ tags mdl - tagLine (name, line) = name ++ "\t" ++ path ++ "\t" ++ show line + where + tagLines = map tagLine $ tags mdl + tagLine (name, line) = name ++ "\t" ++ path ++ "\t" ++ show line diff --git a/src/Language/PureScript/Docs/Types.hs b/src/Language/PureScript/Docs/Types.hs index c4e6cbeca..6ac4dfb47 100644 --- a/src/Language/PureScript/Docs/Types.hs +++ b/src/Language/PureScript/Docs/Types.hs @@ -1,28 +1,44 @@ -module Language.PureScript.Docs.Types - ( module Language.PureScript.Docs.Types - , module ReExports - ) - where +module Language.PureScript.Docs.Types ( + module Language.PureScript.Docs.Types, + module ReExports, +) +where -import Protolude hiding (to, from, unlines) -import Prelude (String, unlines, lookup) +import Protolude hiding (from, to, unlines) +import Prelude (String, lookup, unlines) import Control.Arrow ((***)) import Data.Aeson ((.=)) +import Data.Aeson qualified as A +import Data.Aeson.BetterErrors ( + Parse, + asIntegral, + asNull, + asString, + asText, + eachInArray, + eachInObjectWithKey, + fromAesonParser, + key, + keyMay, + keyOrDefault, + nth, + perhaps, + throwCustomError, + toAesonParser, + toAesonParser', + withString, + withText, + (.!), + ) import Data.Aeson.Key qualified as A.Key -import Data.Aeson.BetterErrors - (Parse, keyOrDefault, throwCustomError, key, asText, - keyMay, withString, eachInArray, asNull, (.!), toAesonParser, toAesonParser', - fromAesonParser, perhaps, withText, asIntegral, nth, eachInObjectWithKey, - asString) import Data.Map qualified as Map +import Data.Text qualified as T import Data.Time.Clock (UTCTime) import Data.Time.Format qualified as TimeFormat -import Data.Version (Version(..), showVersion) -import Data.Aeson qualified as A -import Data.Text qualified as T import Data.Vector qualified as V +import Data.Version (Version (..), showVersion) import Language.PureScript.AST qualified as P import Language.PureScript.CoreFn.FromJSON qualified as P @@ -33,13 +49,16 @@ import Language.PureScript.Roles qualified as P import Language.PureScript.Types qualified as P import Paths_purescript qualified as Paths -import Web.Bower.PackageMeta (BowerError, PackageMeta(..), PackageName, asPackageMeta, parsePackageName, runPackageName, showBowerError) +import Web.Bower.PackageMeta (BowerError, PackageMeta (..), PackageName, asPackageMeta, parsePackageName, runPackageName, showBowerError) -import Language.PureScript.Docs.RenderedCode as ReExports - (RenderedCode, - ContainingModule(..), asContainingModule, - RenderedCodeElement(..), - Namespace(..), FixityAlias) +import Language.PureScript.Docs.RenderedCode as ReExports ( + ContainingModule (..), + FixityAlias, + Namespace (..), + RenderedCode, + RenderedCodeElement (..), + asContainingModule, + ) import Language.PureScript.Publish.Registry.Compat (PursJsonError, showPursJsonError) type Type' = P.Type () @@ -49,25 +68,25 @@ type Constraint' = P.Constraint () -- Types data Package a = Package - { pkgMeta :: PackageMeta - , pkgVersion :: Version - , pkgVersionTag :: Text - -- TODO: When this field was introduced, it was given the Maybe type for the - -- sake of backwards compatibility, as older JSON blobs will not include the - -- field. It should eventually be changed to just UTCTime. - , pkgTagTime :: Maybe UTCTime - , pkgModules :: [Module] - , pkgModuleMap :: Map P.ModuleName PackageName + { pkgMeta :: PackageMeta + , pkgVersion :: Version + , pkgVersionTag :: Text + , -- TODO: When this field was introduced, it was given the Maybe type for the + -- sake of backwards compatibility, as older JSON blobs will not include the + -- field. It should eventually be changed to just UTCTime. + pkgTagTime :: Maybe UTCTime + , pkgModules :: [Module] + , pkgModuleMap :: Map P.ModuleName PackageName , pkgResolvedDependencies :: [(PackageName, Version)] - , pkgGithub :: (GithubUser, GithubRepo) - , pkgUploader :: a - , pkgCompilerVersion :: Version - -- ^ The version of the PureScript compiler which was used to generate - -- this data. We store this in order to reject packages which are too old. + , pkgGithub :: (GithubUser, GithubRepo) + , pkgUploader :: a + , pkgCompilerVersion :: Version + -- ^ The version of the PureScript compiler which was used to generate + -- this data. We store this in order to reject packages which are too old. } deriving (Show, Eq, Ord, Generic) -instance NFData a => NFData (Package a) +instance (NFData a) => NFData (Package a) data NotYetKnown = NotYetKnown deriving (Show, Eq, Ord, Generic) @@ -90,117 +109,108 @@ showManifestError = \case PursManifest err -> showPursJsonError err verifyPackage :: GithubUser -> UploadedPackage -> VerifiedPackage -verifyPackage verifiedUser Package{..} = - Package pkgMeta - pkgVersion - pkgVersionTag - pkgTagTime - pkgModules - pkgModuleMap - pkgResolvedDependencies - pkgGithub - verifiedUser - pkgCompilerVersion +verifyPackage verifiedUser Package {..} = + Package + pkgMeta + pkgVersion + pkgVersionTag + pkgTagTime + pkgModules + pkgModuleMap + pkgResolvedDependencies + pkgGithub + verifiedUser + pkgCompilerVersion packageName :: Package a -> PackageName packageName = bowerName . pkgMeta --- | --- The time format used for serializing package tag times in the JSON format. --- This is the ISO 8601 date format which includes a time and a timezone. --- +{- | +The time format used for serializing package tag times in the JSON format. +This is the ISO 8601 date format which includes a time and a timezone. +-} jsonTimeFormat :: String jsonTimeFormat = "%Y-%m-%dT%H:%M:%S%z" --- | --- Convenience function for formatting a time in the format expected by this --- module. --- +{- | +Convenience function for formatting a time in the format expected by this +module. +-} formatTime :: UTCTime -> String formatTime = TimeFormat.formatTime TimeFormat.defaultTimeLocale jsonTimeFormat --- | --- Convenience function for parsing a time in the format expected by this --- module. --- +{- | +Convenience function for parsing a time in the format expected by this +module. +-} parseTime :: String -> Maybe UTCTime parseTime = TimeFormat.parseTimeM False TimeFormat.defaultTimeLocale jsonTimeFormat data Module = Module - { modName :: P.ModuleName - , modComments :: Maybe Text + { modName :: P.ModuleName + , modComments :: Maybe Text , modDeclarations :: [Declaration] - -- Re-exported values from other modules - , modReExports :: [(InPackage P.ModuleName, [Declaration])] + , -- Re-exported values from other modules + modReExports :: [(InPackage P.ModuleName, [Declaration])] } deriving (Show, Eq, Ord, Generic) instance NFData Module data Declaration = Declaration - { declTitle :: Text - , declComments :: Maybe Text + { declTitle :: Text + , declComments :: Maybe Text , declSourceSpan :: Maybe P.SourceSpan - , declChildren :: [ChildDeclaration] - , declInfo :: DeclarationInfo - , declKind :: Maybe KindInfo + , declChildren :: [ChildDeclaration] + , declInfo :: DeclarationInfo + , declKind :: Maybe KindInfo } deriving (Show, Eq, Ord, Generic) instance NFData Declaration --- | --- A value of this type contains information that is specific to a particular --- kind of declaration (as opposed to information which exists in all kinds of --- declarations, which goes into the 'Declaration' type directly). --- --- Many of the constructors are very similar to their equivalents in the real --- PureScript AST, except that they have their name elided, since this is --- already available via the rdTitle field of 'Declaration'. --- +{- | +A value of this type contains information that is specific to a particular +kind of declaration (as opposed to information which exists in all kinds of +declarations, which goes into the 'Declaration' type directly). + +Many of the constructors are very similar to their equivalents in the real +PureScript AST, except that they have their name elided, since this is +already available via the rdTitle field of 'Declaration'. +-} data DeclarationInfo - -- | - -- A value declaration, with its type. - -- - = ValueDeclaration Type' - - -- | - -- A data/newtype declaration, with the kind of declaration (data or - -- newtype) and its type arguments. Constructors are represented as child - -- declarations. - -- - | DataDeclaration P.DataDeclType [(Text, Maybe Type')] [P.Role] - - -- | - -- A data type foreign import, with its kind. - -- - | ExternDataDeclaration Type' [P.Role] - - -- | - -- A type synonym, with its type arguments and its type. - -- - | TypeSynonymDeclaration [(Text, Maybe Type')] Type' - - -- | - -- A type class, with its type arguments, its superclasses and functional - -- dependencies. Instances and members are represented as child declarations. - -- - | TypeClassDeclaration [(Text, Maybe Type')] [Constraint'] [([Text], [Text])] - - -- | - -- An operator alias declaration, with the member the alias is for and the - -- operator's fixity. - -- - | AliasDeclaration P.Fixity FixityAlias + = -- | + -- A value declaration, with its type. + ValueDeclaration Type' + | -- | + -- A data/newtype declaration, with the kind of declaration (data or + -- newtype) and its type arguments. Constructors are represented as child + -- declarations. + DataDeclaration P.DataDeclType [(Text, Type')] [P.Role] + | -- | + -- A data type foreign import, with its kind. + ExternDataDeclaration Type' [P.Role] + | -- | + -- A type synonym, with its type arguments and its type. + TypeSynonymDeclaration [(Text, Type')] Type' + | -- | + -- A type class, with its type arguments, its superclasses and functional + -- dependencies. Instances and members are represented as child declarations. + TypeClassDeclaration [(Text, Type')] [Constraint'] [([Text], [Text])] + | -- | + -- An operator alias declaration, with the member the alias is for and the + -- operator's fixity. + AliasDeclaration P.Fixity FixityAlias deriving (Show, Eq, Ord, Generic) instance NFData DeclarationInfo --- | --- Wraps enough information to properly render the kind signature --- of a data/newtype/type/class declaration. +{- | +Wraps enough information to properly render the kind signature +of a data/newtype/type/class declaration. +-} data KindInfo = KindInfo { kiKeyword :: P.KindSignatureFor , kiKind :: Type' @@ -209,23 +219,25 @@ data KindInfo = KindInfo instance NFData KindInfo -convertFundepsToStrings :: [(Text, Maybe Type')] -> [P.FunctionalDependency] -> [([Text], [Text])] +convertFundepsToStrings :: [(Text, Type')] -> [P.FunctionalDependency] -> [([Text], [Text])] convertFundepsToStrings args fundeps = map (\(P.FunctionalDependency from to) -> toArgs from to) fundeps where - argsVec = V.fromList (map fst args) - getArg i = - fromMaybe - (P.internalError $ unlines - [ "convertDeclaration: Functional dependency index" - , show i - , "is bigger than arguments list" - , show (map fst args) - , "Functional dependencies are" - , show fundeps - ] - ) $ argsVec V.!? i - toArgs from to = (map getArg from, map getArg to) + argsVec = V.fromList (map fst args) + getArg i = + fromMaybe + ( P.internalError $ + unlines + [ "convertDeclaration: Functional dependency index" + , show i + , "is bigger than arguments list" + , show (map fst args) + , "Functional dependencies are" + , show fundeps + ] + ) + $ argsVec V.!? i + toArgs from to = (map getArg from, map getArg to) declInfoToString :: DeclarationInfo -> Text declInfoToString (ValueDeclaration _) = "value" @@ -237,47 +249,47 @@ declInfoToString (AliasDeclaration _ _) = "alias" declInfoNamespace :: DeclarationInfo -> Namespace declInfoNamespace = \case - ValueDeclaration{} -> + ValueDeclaration {} -> ValueLevel - DataDeclaration{} -> + DataDeclaration {} -> TypeLevel - ExternDataDeclaration{} -> + ExternDataDeclaration {} -> TypeLevel - TypeSynonymDeclaration{} -> + TypeSynonymDeclaration {} -> TypeLevel - TypeClassDeclaration{} -> + TypeClassDeclaration {} -> TypeLevel AliasDeclaration _ alias -> either (const TypeLevel) (const ValueLevel) (P.disqualify alias) isTypeClass :: Declaration -> Bool -isTypeClass Declaration{..} = +isTypeClass Declaration {..} = case declInfo of - TypeClassDeclaration{} -> True + TypeClassDeclaration {} -> True _ -> False isValue :: Declaration -> Bool -isValue Declaration{..} = +isValue Declaration {..} = case declInfo of - ValueDeclaration{} -> True + ValueDeclaration {} -> True _ -> False -isType :: Declaration -> Bool -isType Declaration{..} = +isType :: Declaration -> Bool +isType Declaration {..} = case declInfo of - TypeSynonymDeclaration{} -> True - DataDeclaration{} -> True - ExternDataDeclaration{} -> True + TypeSynonymDeclaration {} -> True + DataDeclaration {} -> True + ExternDataDeclaration {} -> True _ -> False isValueAlias :: Declaration -> Bool -isValueAlias Declaration{..} = +isValueAlias Declaration {..} = case declInfo of AliasDeclaration _ (P.Qualified _ d) -> isRight d _ -> False isTypeAlias :: Declaration -> Bool -isTypeAlias Declaration{..} = +isTypeAlias Declaration {..} = case declInfo of AliasDeclaration _ (P.Qualified _ d) -> isLeft d _ -> False @@ -285,41 +297,36 @@ isTypeAlias Declaration{..} = -- | Discard any children which do not satisfy the given predicate. filterChildren :: (ChildDeclaration -> Bool) -> Declaration -> Declaration filterChildren p decl = - decl { declChildren = filter p (declChildren decl) } + decl {declChildren = filter p (declChildren decl)} data ChildDeclaration = ChildDeclaration - { cdeclTitle :: Text - , cdeclComments :: Maybe Text + { cdeclTitle :: Text + , cdeclComments :: Maybe Text , cdeclSourceSpan :: Maybe P.SourceSpan - , cdeclInfo :: ChildDeclarationInfo + , cdeclInfo :: ChildDeclarationInfo } deriving (Show, Eq, Ord, Generic) instance NFData ChildDeclaration data ChildDeclarationInfo - -- | - -- A type instance declaration, with its dependencies and its type. - -- - = ChildInstance [Constraint'] Type' - - -- | - -- A data constructor, with its type arguments. - -- - | ChildDataConstructor [Type'] - - -- | - -- A type class member, with its type. Note that the type does not include - -- the type class constraint; this may be added manually if desired. For - -- example, `pure` from `Applicative` would be `forall a. a -> f a`. - -- - | ChildTypeClassMember Type' + = -- | + -- A type instance declaration, with its dependencies and its type. + ChildInstance [Constraint'] Type' + | -- | + -- A data constructor, with its type arguments. + ChildDataConstructor [Type'] + | -- | + -- A type class member, with its type. Note that the type does not include + -- the type class constraint; this may be added manually if desired. For + -- example, `pure` from `Applicative` would be `forall a. a -> f a`. + ChildTypeClassMember Type' deriving (Show, Eq, Ord, Generic) instance NFData ChildDeclarationInfo childDeclInfoToString :: ChildDeclarationInfo -> Text -childDeclInfoToString (ChildInstance _ _) = "instance" +childDeclInfoToString (ChildInstance _ _) = "instance" childDeclInfoToString (ChildDataConstructor _) = "dataConstructor" childDeclInfoToString (ChildTypeClassMember _) = "typeClassMember" @@ -330,41 +337,39 @@ childDeclInfoNamespace = -- to update this, instead of having this function (possibly incorrectly) -- just return ValueLevel for the new constructor. \case - ChildInstance{} -> + ChildInstance {} -> ValueLevel - ChildDataConstructor{} -> + ChildDataConstructor {} -> ValueLevel - ChildTypeClassMember{} -> + ChildTypeClassMember {} -> ValueLevel isTypeClassMember :: ChildDeclaration -> Bool -isTypeClassMember ChildDeclaration{..} = +isTypeClassMember ChildDeclaration {..} = case cdeclInfo of - ChildTypeClassMember{} -> True + ChildTypeClassMember {} -> True _ -> False isDataConstructor :: ChildDeclaration -> Bool -isDataConstructor ChildDeclaration{..} = +isDataConstructor ChildDeclaration {..} = case cdeclInfo of - ChildDataConstructor{} -> True + ChildDataConstructor {} -> True _ -> False -newtype GithubUser - = GithubUser { runGithubUser :: Text } +newtype GithubUser = GithubUser {runGithubUser :: Text} deriving (Show, Eq, Ord, Generic) instance NFData GithubUser -newtype GithubRepo - = GithubRepo { runGithubRepo :: Text } +newtype GithubRepo = GithubRepo {runGithubRepo :: Text} deriving (Show, Eq, Ord, Generic) instance NFData GithubRepo data PackageError - = CompilerTooOld Version Version - -- ^ Minimum allowable version for generating data with the current - -- parser, and actual version used. + = -- | Minimum allowable version for generating data with the current + -- parser, and actual version used. + CompilerTooOld Version Version | ErrorInPackageMeta ManifestError | InvalidVersion | InvalidDeclarationType Text @@ -384,7 +389,7 @@ data InPackage a | FromDep PackageName a deriving (Show, Eq, Ord, Generic) -instance NFData a => NFData (InPackage a) +instance (NFData a) => NFData (InPackage a) instance Functor InPackage where fmap f (Local x) = Local (f x) @@ -398,20 +403,20 @@ ignorePackage (FromDep _ x) = x -- Types for links between declarations data LinksContext = LinksContext - { ctxGithub :: (GithubUser, GithubRepo) - , ctxModuleMap :: Map P.ModuleName PackageName + { ctxGithub :: (GithubUser, GithubRepo) + , ctxModuleMap :: Map P.ModuleName PackageName , ctxResolvedDependencies :: [(PackageName, Version)] - , ctxPackageName :: PackageName - , ctxVersion :: Version - , ctxVersionTag :: Text + , ctxPackageName :: PackageName + , ctxVersion :: Version + , ctxVersionTag :: Text } deriving (Show, Eq, Ord, Generic) instance NFData LinksContext data DocLink = DocLink - { linkLocation :: LinkLocation - , linkTitle :: Text + { linkLocation :: LinkLocation + , linkTitle :: Text , linkNamespace :: Namespace } deriving (Show, Eq, Ord, Generic) @@ -419,66 +424,66 @@ data DocLink = DocLink instance NFData DocLink data LinkLocation - -- | A link to a declaration in the current package. - = LocalModule P.ModuleName - - -- | A link to a declaration in a different package. The arguments represent - -- the name of the other package, the version of the other package, and the - -- name of the module in the other package that the declaration is in. - | DepsModule PackageName Version P.ModuleName - - -- | A link to a declaration that is built in to the compiler, e.g. the Prim - -- module. In this case we only need to store the module that the builtin - -- comes from. Note that all builtin modules begin with "Prim", and that the - -- compiler rejects attempts to define modules whose names start with "Prim". - | BuiltinModule P.ModuleName + = -- | A link to a declaration in the current package. + LocalModule P.ModuleName + | -- | A link to a declaration in a different package. The arguments represent + -- the name of the other package, the version of the other package, and the + -- name of the module in the other package that the declaration is in. + DepsModule PackageName Version P.ModuleName + | -- | A link to a declaration that is built in to the compiler, e.g. the Prim + -- module. In this case we only need to store the module that the builtin + -- comes from. Note that all builtin modules begin with "Prim", and that the + -- compiler rejects attempts to define modules whose names start with "Prim". + BuiltinModule P.ModuleName deriving (Show, Eq, Ord, Generic) instance NFData LinkLocation --- | Given a links context, the current module name, the namespace of a thing --- to link to, its title, and its containing module, attempt to create a --- DocLink. +{- | Given a links context, the current module name, the namespace of a thing +to link to, its title, and its containing module, attempt to create a +DocLink. +-} getLink :: LinksContext -> P.ModuleName -> Namespace -> Text -> ContainingModule -> Maybe DocLink -getLink LinksContext{..} curMn namespace target containingMod = do +getLink LinksContext {..} curMn namespace target containingMod = do location <- getLinkLocation - return DocLink - { linkLocation = location - , linkTitle = target - , linkNamespace = namespace - } - + return + DocLink + { linkLocation = location + , linkTitle = target + , linkNamespace = namespace + } where - getLinkLocation = builtinLinkLocation <|> normalLinkLocation - - normalLinkLocation = do - case containingMod of - ThisModule -> - return $ LocalModule curMn - OtherModule destMn -> - case Map.lookup destMn ctxModuleMap of - Nothing -> - return $ LocalModule destMn - Just pkgName -> do - pkgVersion <- lookup pkgName ctxResolvedDependencies - return $ DepsModule pkgName pkgVersion destMn - - builtinLinkLocation = - case containingMod of - OtherModule mn | P.isBuiltinModuleName mn -> - pure $ BuiltinModule mn - _ -> - empty + getLinkLocation = builtinLinkLocation <|> normalLinkLocation + + normalLinkLocation = do + case containingMod of + ThisModule -> + return $ LocalModule curMn + OtherModule destMn -> + case Map.lookup destMn ctxModuleMap of + Nothing -> + return $ LocalModule destMn + Just pkgName -> do + pkgVersion <- lookup pkgName ctxResolvedDependencies + return $ DepsModule pkgName pkgVersion destMn + + builtinLinkLocation = + case containingMod of + OtherModule mn + | P.isBuiltinModuleName mn -> + pure $ BuiltinModule mn + _ -> + empty getLinksContext :: Package a -> LinksContext -getLinksContext Package{..} = +getLinksContext Package {..} = LinksContext - { ctxGithub = pkgGithub - , ctxModuleMap = pkgModuleMap + { ctxGithub = pkgGithub + , ctxModuleMap = pkgModuleMap , ctxResolvedDependencies = pkgResolvedDependencies - , ctxPackageName = bowerName pkgMeta - , ctxVersion = pkgVersion - , ctxVersionTag = pkgVersionTag + , ctxPackageName = bowerName pkgMeta + , ctxVersion = pkgVersion + , ctxVersionTag = pkgVersionTag } ---------------------- @@ -489,24 +494,26 @@ asPackage minimumVersion uploader = do -- If the compilerVersion key is missing, we can be sure that it was produced -- with 0.7.0.0, since that is the only released version that included the -- `psc-publish` tool (now `purs publish`) before this key was added. - compilerVersion <- keyOrDefault "compilerVersion" (Version [0,7,0,0] []) asVersion - when (compilerVersion < minimumVersion) + compilerVersion <- keyOrDefault "compilerVersion" (Version [0, 7, 0, 0] []) asVersion + when + (compilerVersion < minimumVersion) (throwCustomError $ CompilerTooOld minimumVersion compilerVersion) - Package <$> key "packageMeta" asPackageMeta .! (ErrorInPackageMeta . BowerManifest) - <*> key "version" asVersion - <*> key "versionTag" asText - <*> keyMay "tagTime" (withString parseTimeEither) - <*> key "modules" (eachInArray asModule) - <*> moduleMap - <*> key "resolvedDependencies" asResolvedDependencies - <*> key "github" asGithub - <*> key "uploader" uploader - <*> pure compilerVersion + Package + <$> key "packageMeta" asPackageMeta .! (ErrorInPackageMeta . BowerManifest) + <*> key "version" asVersion + <*> key "versionTag" asText + <*> keyMay "tagTime" (withString parseTimeEither) + <*> key "modules" (eachInArray asModule) + <*> moduleMap + <*> key "resolvedDependencies" asResolvedDependencies + <*> key "github" asGithub + <*> key "uploader" uploader + <*> pure compilerVersion where - moduleMap = - key "moduleMap" asModuleMap - `pOr` (key "bookmarks" bookmarksAsModuleMap .! ErrorInPackageMeta) + moduleMap = + key "moduleMap" asModuleMap + `pOr` (key "bookmarks" bookmarksAsModuleMap .! ErrorInPackageMeta) parseTimeEither :: String -> Either PackageError UTCTime parseTimeEither = @@ -524,9 +531,11 @@ instance A.FromJSON NotYetKnown where displayPackageError :: PackageError -> Text displayPackageError e = case e of CompilerTooOld minV usedV -> - "Expecting data produced by at least version " <> T.pack (showVersion minV) - <> " of the compiler, but it appears that " <> T.pack (showVersion usedV) - <> " was used." + "Expecting data produced by at least version " + <> T.pack (showVersion minV) + <> " of the compiler, but it appears that " + <> T.pack (showVersion usedV) + <> " was used." ErrorInPackageMeta err -> "Error in package metadata: " <> showManifestError err InvalidVersion -> @@ -548,9 +557,11 @@ displayPackageError e = case e of InvalidRole str -> "Invalid role keyword: \"" <> str <> "\"" -instance A.FromJSON a => A.FromJSON (Package a) where - parseJSON = toAesonParser displayPackageError - (asPackage (Version [0,0,0,0] []) fromAesonParser) +instance (A.FromJSON a) => A.FromJSON (Package a) where + parseJSON = + toAesonParser + displayPackageError + (asPackage (Version [0, 0, 0, 0] []) fromAesonParser) asGithubUser :: Parse e GithubUser asGithubUser = GithubUser <$> asText @@ -563,59 +574,65 @@ asVersion = withString (maybe (Left InvalidVersion) Right . P.parseVersion') asModule :: Parse PackageError Module asModule = - Module <$> key "name" (P.moduleNameFromString <$> asText) - <*> key "comments" (perhaps asText) - <*> key "declarations" (eachInArray asDeclaration) - <*> key "reExports" (eachInArray asReExport) + Module + <$> key "name" (P.moduleNameFromString <$> asText) + <*> key "comments" (perhaps asText) + <*> key "declarations" (eachInArray asDeclaration) + <*> key "reExports" (eachInArray asReExport) asDeclaration :: Parse PackageError Declaration asDeclaration = - Declaration <$> key "title" asText - <*> key "comments" (perhaps asText) - <*> key "sourceSpan" (perhaps asSourceSpan) - <*> key "children" (eachInArray asChildDeclaration) - <*> key "info" asDeclarationInfo - <*> keyOrDefault "kind" Nothing (perhaps asKindInfo) + Declaration + <$> key "title" asText + <*> key "comments" (perhaps asText) + <*> key "sourceSpan" (perhaps asSourceSpan) + <*> key "children" (eachInArray asChildDeclaration) + <*> key "info" asDeclarationInfo + <*> keyOrDefault "kind" Nothing (perhaps asKindInfo) asReExport :: Parse PackageError (InPackage P.ModuleName, [Declaration]) asReExport = - (,) <$> key "moduleName" asReExportModuleName - <*> key "declarations" (eachInArray asDeclaration) + (,) + <$> key "moduleName" asReExportModuleName + <*> key "declarations" (eachInArray asDeclaration) where - -- This is to preserve backwards compatibility with 0.10.3 and earlier versions - -- of the compiler, where the modReExports field had the type - -- [(P.ModuleName, [Declaration])]. This should eventually be removed, - -- possibly at the same time as the next breaking change to this JSON format. - asReExportModuleName :: Parse PackageError (InPackage P.ModuleName) - asReExportModuleName = - asInPackage fromAesonParser .! ErrorInPackageMeta - `pOr` fmap Local fromAesonParser + -- This is to preserve backwards compatibility with 0.10.3 and earlier versions + -- of the compiler, where the modReExports field had the type + -- [(P.ModuleName, [Declaration])]. This should eventually be removed, + -- possibly at the same time as the next breaking change to this JSON format. + asReExportModuleName :: Parse PackageError (InPackage P.ModuleName) + asReExportModuleName = + asInPackage fromAesonParser + .! ErrorInPackageMeta + `pOr` fmap Local fromAesonParser pOr :: Parse e a -> Parse e a -> Parse e a p `pOr` q = catchError p (const q) asInPackage :: Parse ManifestError a -> Parse ManifestError (InPackage a) asInPackage inner = - build <$> key "package" (perhaps (withText (mapLeft BowerManifest . parsePackageName))) - <*> key "item" inner + build + <$> key "package" (perhaps (withText (mapLeft BowerManifest . parsePackageName))) + <*> key "item" inner where - build Nothing = Local - build (Just pn) = FromDep pn + build Nothing = Local + build (Just pn) = FromDep pn asFixity :: Parse PackageError P.Fixity asFixity = - P.Fixity <$> key "associativity" asAssociativity - <*> key "precedence" asIntegral + P.Fixity + <$> key "associativity" asAssociativity + <*> key "precedence" asIntegral asFixityAlias :: Parse PackageError FixityAlias asFixityAlias = fromAesonParser parseAssociativity :: String -> Maybe P.Associativity parseAssociativity str = case str of - "infix" -> Just P.Infix + "infix" -> Just P.Infix "infixl" -> Just P.Infixl "infixr" -> Just P.Infixr - _ -> Nothing + _ -> Nothing asAssociativity :: Parse PackageError P.Associativity asAssociativity = withString (maybe (Left InvalidFixity) Right . parseAssociativity) @@ -627,22 +644,27 @@ asDeclarationInfo = do "value" -> ValueDeclaration <$> key "type" asType "data" -> - DataDeclaration <$> key "dataDeclType" asDataDeclType - <*> key "typeArguments" asTypeArguments - <*> keyOrDefault "roles" [] (eachInArray asRole) + DataDeclaration + <$> key "dataDeclType" asDataDeclType + <*> key "typeArguments" asTypeArguments + <*> keyOrDefault "roles" [] (eachInArray asRole) "externData" -> - ExternDataDeclaration <$> key "kind" asType - <*> keyOrDefault "roles" [] (eachInArray asRole) + ExternDataDeclaration + <$> key "kind" asType + <*> keyOrDefault "roles" [] (eachInArray asRole) "typeSynonym" -> - TypeSynonymDeclaration <$> key "arguments" asTypeArguments - <*> key "type" asType + TypeSynonymDeclaration + <$> key "arguments" asTypeArguments + <*> key "type" asType "typeClass" -> - TypeClassDeclaration <$> key "arguments" asTypeArguments - <*> key "superclasses" (eachInArray asConstraint) - <*> keyOrDefault "fundeps" [] asFunDeps + TypeClassDeclaration + <$> key "arguments" asTypeArguments + <*> key "superclasses" (eachInArray asConstraint) + <*> keyOrDefault "fundeps" [] asFunDeps "alias" -> - AliasDeclaration <$> key "fixity" asFixity - <*> key "alias" asFixityAlias + AliasDeclaration + <$> key "fixity" asFixity + <*> key "alias" asFixityAlias -- Backwards compat: kinds are extern data "kind" -> pure $ ExternDataDeclaration (P.kindType $> ()) [] @@ -651,8 +673,9 @@ asDeclarationInfo = do asKindInfo :: Parse PackageError KindInfo asKindInfo = - KindInfo <$> key "keyword" asKindSignatureFor - <*> key "kind" asType + KindInfo + <$> key "keyword" asKindSignatureFor + <*> key "kind" asType asKindSignatureFor :: Parse PackageError P.KindSignatureFor asKindSignatureFor = @@ -663,10 +686,10 @@ asKindSignatureFor = "type" -> Right P.TypeSynonymSig x -> Left (InvalidKindSignatureFor x) -asTypeArguments :: Parse PackageError [(Text, Maybe Type')] +asTypeArguments :: Parse PackageError [(Text, Type')] asTypeArguments = eachInArray asTypeArgument where - asTypeArgument = (,) <$> nth 0 asText <*> nth 1 (perhaps asType) + asTypeArgument = (,) <$> nth 0 asText <*> nth 1 asType asRole :: Parse PackageError P.Role asRole = @@ -682,29 +705,31 @@ asType = fromAesonParser asFunDeps :: Parse PackageError [([Text], [Text])] asFunDeps = eachInArray asFunDep where - asFunDep = (,) <$> nth 0 (eachInArray asText) <*> nth 1 (eachInArray asText) + asFunDep = (,) <$> nth 0 (eachInArray asText) <*> nth 1 (eachInArray asText) asDataDeclType :: Parse PackageError P.DataDeclType asDataDeclType = withText $ \case - "data" -> Right P.Data + "data" -> Right P.Data "newtype" -> Right P.Newtype - other -> Left (InvalidDataDeclType other) + other -> Left (InvalidDataDeclType other) asChildDeclaration :: Parse PackageError ChildDeclaration asChildDeclaration = - ChildDeclaration <$> key "title" asText - <*> key "comments" (perhaps asText) - <*> key "sourceSpan" (perhaps asSourceSpan) - <*> key "info" asChildDeclarationInfo + ChildDeclaration + <$> key "title" asText + <*> key "comments" (perhaps asText) + <*> key "sourceSpan" (perhaps asSourceSpan) + <*> key "info" asChildDeclarationInfo asChildDeclarationInfo :: Parse PackageError ChildDeclarationInfo asChildDeclarationInfo = do ty <- key "declType" asText case ty of "instance" -> - ChildInstance <$> key "dependencies" (eachInArray asConstraint) - <*> key "type" asType + ChildInstance + <$> key "dependencies" (eachInArray asConstraint) + <*> key "type" asType "dataConstructor" -> ChildDataConstructor <$> key "arguments" (eachInArray asType) "typeClassMember" -> @@ -713,38 +738,42 @@ asChildDeclarationInfo = do throwCustomError $ InvalidChildDeclarationType other asSourcePos :: Parse e P.SourcePos -asSourcePos = P.SourcePos <$> nth 0 asIntegral - <*> nth 1 asIntegral +asSourcePos = + P.SourcePos + <$> nth 0 asIntegral + <*> nth 1 asIntegral asConstraint :: Parse PackageError Constraint' -asConstraint = P.Constraint () <$> key "constraintClass" asQualifiedProperName - <*> keyOrDefault "constraintKindArgs" [] (eachInArray asType) - <*> key "constraintArgs" (eachInArray asType) - <*> pure Nothing +asConstraint = + P.Constraint () + <$> key "constraintClass" asQualifiedProperName + <*> keyOrDefault "constraintKindArgs" [] (eachInArray asType) + <*> key "constraintArgs" (eachInArray asType) + <*> pure Nothing asQualifiedProperName :: Parse e (P.Qualified (P.ProperName a)) asQualifiedProperName = fromAesonParser asModuleMap :: Parse PackageError (Map P.ModuleName PackageName) asModuleMap = - Map.fromList <$> - eachInObjectWithKey (Right . P.moduleNameFromString) - (withText parsePackageName') + Map.fromList + <$> eachInObjectWithKey + (Right . P.moduleNameFromString) + (withText parsePackageName') -- This is here to preserve backwards compatibility with compilers which used -- to generate a 'bookmarks' field in the JSON (i.e. up to 0.10.5). We should -- remove this after the next breaking change to the JSON. bookmarksAsModuleMap :: Parse ManifestError (Map P.ModuleName PackageName) bookmarksAsModuleMap = - convert <$> - eachInArray (asInPackage (nth 0 (P.moduleNameFromString <$> asText))) - + convert + <$> eachInArray (asInPackage (nth 0 (P.moduleNameFromString <$> asText))) where - convert :: [InPackage P.ModuleName] -> Map P.ModuleName PackageName - convert = Map.fromList . mapMaybe toTuple + convert :: [InPackage P.ModuleName] -> Map P.ModuleName PackageName + convert = Map.fromList . mapMaybe toTuple - toTuple (Local _) = Nothing - toTuple (FromDep pkgName mn) = Just (mn, pkgName) + toTuple (Local _) = Nothing + toTuple (FromDep pkgName mn) = Just (mn, pkgName) asResolvedDependencies :: Parse PackageError [(PackageName, Version)] asResolvedDependencies = @@ -759,66 +788,79 @@ mapLeft f (Left x) = Left (f x) mapLeft _ (Right x) = Right x asGithub :: Parse e (GithubUser, GithubRepo) -asGithub = (,) <$> nth 0 (GithubUser <$> asText) - <*> nth 1 (GithubRepo <$> asText) +asGithub = + (,) + <$> nth 0 (GithubUser <$> asText) + <*> nth 1 (GithubRepo <$> asText) asSourceSpan :: Parse e P.SourceSpan -asSourceSpan = P.SourceSpan <$> key "name" asString - <*> key "start" asSourcePos - <*> key "end" asSourcePos +asSourceSpan = + P.SourceSpan + <$> key "name" asString + <*> key "start" asSourcePos + <*> key "end" asSourcePos --------------------- -- ToJSON instances -instance A.ToJSON a => A.ToJSON (Package a) where - toJSON Package{..} = +instance (A.ToJSON a) => A.ToJSON (Package a) where + toJSON Package {..} = A.object $ - [ "packageMeta" .= pkgMeta - , "version" .= showVersion pkgVersion - , "versionTag" .= pkgVersionTag - , "modules" .= pkgModules - , "moduleMap" .= assocListToJSON (A.Key.fromText . P.runModuleName) - runPackageName - (Map.toList pkgModuleMap) - , "resolvedDependencies" .= assocListToJSON (A.Key.fromText . runPackageName) - (T.pack . showVersion) - pkgResolvedDependencies - , "github" .= pkgGithub - , "uploader" .= pkgUploader - , "compilerVersion" .= showVersion Paths.version - ] ++ - fmap (\t -> "tagTime" .= formatTime t) (maybeToList pkgTagTime) + [ "packageMeta" .= pkgMeta + , "version" .= showVersion pkgVersion + , "versionTag" .= pkgVersionTag + , "modules" .= pkgModules + , "moduleMap" + .= assocListToJSON + (A.Key.fromText . P.runModuleName) + runPackageName + (Map.toList pkgModuleMap) + , "resolvedDependencies" + .= assocListToJSON + (A.Key.fromText . runPackageName) + (T.pack . showVersion) + pkgResolvedDependencies + , "github" .= pkgGithub + , "uploader" .= pkgUploader + , "compilerVersion" .= showVersion Paths.version + ] + ++ fmap (\t -> "tagTime" .= formatTime t) (maybeToList pkgTagTime) instance A.ToJSON NotYetKnown where toJSON _ = A.Null instance A.ToJSON Module where - toJSON Module{..} = - A.object [ "name" .= P.runModuleName modName - , "comments" .= modComments - , "declarations" .= modDeclarations - , "reExports" .= map toObj modReExports - ] + toJSON Module {..} = + A.object + [ "name" .= P.runModuleName modName + , "comments" .= modComments + , "declarations" .= modDeclarations + , "reExports" .= map toObj modReExports + ] where - toObj (mn, decls) = A.object [ "moduleName" .= mn - , "declarations" .= decls - ] + toObj (mn, decls) = + A.object + [ "moduleName" .= mn + , "declarations" .= decls + ] instance A.ToJSON Declaration where - toJSON Declaration{..} = - A.object [ "title" .= declTitle - , "comments" .= declComments - , "sourceSpan" .= declSourceSpan - , "children" .= declChildren - , "info" .= declInfo - , "kind" .= declKind - ] + toJSON Declaration {..} = + A.object + [ "title" .= declTitle + , "comments" .= declComments + , "sourceSpan" .= declSourceSpan + , "children" .= declChildren + , "info" .= declInfo + , "kind" .= declKind + ] instance A.ToJSON KindInfo where - toJSON KindInfo{..} = - A.object [ "keyword" .= kindSignatureForKeyword kiKeyword - , "kind" .= kiKind - ] + toJSON KindInfo {..} = + A.object + [ "keyword" .= kindSignatureForKeyword kiKeyword + , "kind" .= kiKind + ] kindSignatureForKeyword :: P.KindSignatureFor -> Text kindSignatureForKeyword = \case @@ -828,31 +870,32 @@ kindSignatureForKeyword = \case P.ClassSig -> "class" instance A.ToJSON ChildDeclaration where - toJSON ChildDeclaration{..} = - A.object [ "title" .= cdeclTitle - , "comments" .= cdeclComments - , "sourceSpan" .= cdeclSourceSpan - , "info" .= cdeclInfo - ] + toJSON ChildDeclaration {..} = + A.object + [ "title" .= cdeclTitle + , "comments" .= cdeclComments + , "sourceSpan" .= cdeclSourceSpan + , "info" .= cdeclInfo + ] instance A.ToJSON DeclarationInfo where toJSON info = A.object $ "declType" .= declInfoToString info : props where - props = case info of - ValueDeclaration ty -> ["type" .= ty] - DataDeclaration ty args roles -> ["dataDeclType" .= ty, "typeArguments" .= args, "roles" .= roles] - ExternDataDeclaration kind roles -> ["kind" .= kind, "roles" .= roles] - TypeSynonymDeclaration args ty -> ["arguments" .= args, "type" .= ty] - TypeClassDeclaration args super fundeps -> ["arguments" .= args, "superclasses" .= super, "fundeps" .= fundeps] - AliasDeclaration fixity alias -> ["fixity" .= fixity, "alias" .= alias] + props = case info of + ValueDeclaration ty -> ["type" .= ty] + DataDeclaration ty args roles -> ["dataDeclType" .= ty, "typeArguments" .= args, "roles" .= roles] + ExternDataDeclaration kind roles -> ["kind" .= kind, "roles" .= roles] + TypeSynonymDeclaration args ty -> ["arguments" .= args, "type" .= ty] + TypeClassDeclaration args super fundeps -> ["arguments" .= args, "superclasses" .= super, "fundeps" .= fundeps] + AliasDeclaration fixity alias -> ["fixity" .= fixity, "alias" .= alias] instance A.ToJSON ChildDeclarationInfo where toJSON info = A.object $ "declType" .= childDeclInfoToString info : props where - props = case info of - ChildInstance deps ty -> ["dependencies" .= deps, "type" .= ty] - ChildDataConstructor args -> ["arguments" .= args] - ChildTypeClassMember ty -> ["type" .= ty] + props = case info of + ChildInstance deps ty -> ["dependencies" .= deps, "type" .= ty] + ChildDataConstructor args -> ["arguments" .= args] + ChildTypeClassMember ty -> ["type" .= ty] instance A.ToJSON GithubUser where toJSON = A.toJSON . runGithubUser @@ -860,23 +903,25 @@ instance A.ToJSON GithubUser where instance A.ToJSON GithubRepo where toJSON = A.toJSON . runGithubRepo --- | Given a function for turning association list keys into JSON object keys, --- and a function for turning association list values to JSON string values, --- turns an association list into a JSON object. --- --- For example: --- @assocListToJSON T.pack T.pack [("a", "b")]@ will give @{"a": "b"}@. +{- | Given a function for turning association list keys into JSON object keys, +and a function for turning association list values to JSON string values, +turns an association list into a JSON object. + +For example: +@assocListToJSON T.pack T.pack [("a", "b")]@ will give @{"a": "b"}@. +-} assocListToJSON :: (a -> A.Key) -> (b -> Text) -> [(a, b)] -> A.Value assocListToJSON f g xs = A.object (map (uncurry (.=) . (f *** g)) xs) -instance A.ToJSON a => A.ToJSON (InPackage a) where +instance (A.ToJSON a) => A.ToJSON (InPackage a) where toJSON x = case x of - Local y -> withPackage (Nothing :: Maybe ()) y + Local y -> withPackage (Nothing :: Maybe ()) y FromDep pn y -> withPackage (Just pn) y where - withPackage :: (A.ToJSON p, A.ToJSON x) => p -> x -> A.Value - withPackage p y = - A.object [ "package" .= p - , "item" .= y - ] + withPackage :: (A.ToJSON p, A.ToJSON x) => p -> x -> A.Value + withPackage p y = + A.object + [ "package" .= p + , "item" .= y + ] diff --git a/src/Language/PureScript/Docs/Utils/MonoidExtras.hs b/src/Language/PureScript/Docs/Utils/MonoidExtras.hs index 6f2bf370e..3f3e231ed 100644 --- a/src/Language/PureScript/Docs/Utils/MonoidExtras.hs +++ b/src/Language/PureScript/Docs/Utils/MonoidExtras.hs @@ -1,8 +1,8 @@ module Language.PureScript.Docs.Utils.MonoidExtras where -import Data.Monoid (Monoid(..), (<>)) +import Data.Monoid (Monoid (..), (<>)) mintersperse :: (Monoid m) => m -> [m] -> m -mintersperse _ [] = mempty -mintersperse _ [x] = x -mintersperse sep (x:xs) = x <> sep <> mintersperse sep xs +mintersperse _ [] = mempty +mintersperse _ [x] = x +mintersperse sep (x : xs) = x <> sep <> mintersperse sep xs diff --git a/src/Language/PureScript/Environment.hs b/src/Language/PureScript/Environment.hs index e1f857031..e38f7829f 100644 --- a/src/Language/PureScript/Environment.hs +++ b/src/Language/PureScript/Environment.hs @@ -1,32 +1,41 @@ +{-# HLINT ignore "Redundant bracket" #-} +{-# HLINT ignore "Use tuple-section" #-} +-- anyone who thinks this is *always* clearer is drunk +{-# LANGUAGE TypeApplications #-} +{-# OPTIONS_GHC -Wno-unrecognised-pragmas #-} + module Language.PureScript.Environment where import Prelude -import GHC.Generics (Generic) -import Control.DeepSeq (NFData) -import Control.Monad (unless) import Codec.Serialise (Serialise) -import Data.Aeson ((.=), (.:)) +import Control.DeepSeq (NFData) +import Control.Monad (unless, void) +import Data.Aeson ((.:), (.=)) import Data.Aeson qualified as A -import Data.Foldable (find, fold) +import Data.Foldable (Foldable (foldl'), find, fold) import Data.Functor ((<&>)) import Data.IntMap qualified as IM import Data.IntSet qualified as IS +import Data.List.NonEmpty qualified as NEL import Data.Map qualified as M -import Data.Set qualified as S import Data.Maybe (fromMaybe, mapMaybe) -import Data.Semigroup (First(..)) +import Data.Semigroup (First (..)) +import Data.Set qualified as S import Data.Text (Text) import Data.Text qualified as T -import Data.List.NonEmpty qualified as NEL +import GHC.Generics (Generic) -import Language.PureScript.AST.SourcePos (nullSourceAnn) +import Language.PureScript.AST.SourcePos (nullSourceAnn, pattern NullSourceAnn) +import Language.PureScript.Constants.Prim qualified as C +import Language.PureScript.Constants.Purus qualified as PLC import Language.PureScript.Crash (internalError) -import Language.PureScript.Names (Ident, ProperName(..), ProperNameType(..), Qualified, QualifiedBy, coerceProperName) -import Language.PureScript.Roles (Role(..)) +import Language.PureScript.Names (Ident (..), ProperName (..), ProperNameType (..), Qualified (..), QualifiedBy (..), coerceProperName, disqualify) +import Language.PureScript.Roles (Role (..)) import Language.PureScript.TypeClassDictionaries (NamedDict) -import Language.PureScript.Types (SourceConstraint, SourceType, Type(..), TypeVarVisibility(..), eqType, srcTypeConstructor, freeTypeVariables) -import Language.PureScript.Constants.Prim qualified as C +import Language.PureScript.Types (SourceConstraint, SourceType, Type (..), TypeVarVisibility (..), eqType, freeTypeVariables, quantify, srcTypeApp, srcTypeConstructor) + +import Language.Purus.Config (maxTupleSize) -- | The @Environment@ defines all values and types which are currently in scope: data Environment = Environment @@ -37,7 +46,7 @@ data Environment = Environment , dataConstructors :: M.Map (Qualified (ProperName 'ConstructorName)) (DataDeclType, ProperName 'TypeName, SourceType, [Ident]) -- ^ Data constructors currently in scope, along with their associated type -- constructor name, argument types and return type. - , typeSynonyms :: M.Map (Qualified (ProperName 'TypeName)) ([(Text, Maybe SourceType)], SourceType) + , typeSynonyms :: M.Map (Qualified (ProperName 'TypeName)) ([(Text, SourceType)], SourceType) -- ^ Type synonyms currently in scope , typeClassDictionaries :: M.Map QualifiedBy (M.Map (Qualified (ProperName 'ClassName)) (M.Map (Qualified Ident) (NEL.NonEmpty NamedDict))) -- ^ Available type class dictionaries. When looking up 'Nothing' in the @@ -45,13 +54,14 @@ data Environment = Environment -- scope (ie dictionaries brought in by a constrained type). , typeClasses :: M.Map (Qualified (ProperName 'ClassName)) TypeClassData -- ^ Type classes - } deriving (Show, Generic) + } + deriving (Show, Generic) instance NFData Environment -- | Information about a type class data TypeClassData = TypeClassData - { typeClassArguments :: [(Text, Maybe SourceType)] + { typeClassArguments :: [(Text, SourceType)] -- ^ A list of type argument names, and their kinds, where kind annotations -- were provided. , typeClassMembers :: [(Ident, SourceType, Maybe (S.Set (NEL.NonEmpty Int)))] @@ -71,18 +81,21 @@ data TypeClassData = TypeClassData -- ^ A sets of arguments that can be used to infer all other arguments. , typeClassIsEmpty :: Bool -- ^ Whether or not dictionaries for this type class are necessarily empty. - } deriving (Show, Generic) + } + deriving (Show, Generic) instance NFData TypeClassData --- | A functional dependency indicates a relationship between two sets of --- type arguments in a class declaration. +{- | A functional dependency indicates a relationship between two sets of +type arguments in a class declaration. +-} data FunctionalDependency = FunctionalDependency { fdDeterminers :: [Int] -- ^ the type arguments which determine the determined type arguments - , fdDetermined :: [Int] + , fdDetermined :: [Int] -- ^ the determined type arguments - } deriving (Show, Generic) + } + deriving (Show, Generic) instance NFData FunctionalDependency instance Serialise FunctionalDependency @@ -94,63 +107,76 @@ instance A.FromJSON FunctionalDependency where <*> o .: "determined" instance A.ToJSON FunctionalDependency where - toJSON FunctionalDependency{..} = - A.object [ "determiners" .= fdDeterminers - , "determined" .= fdDetermined - ] - --- | The initial environment with no values and only the default javascript types defined + toJSON FunctionalDependency {..} = + A.object + [ "determiners" .= fdDeterminers + , "determined" .= fdDetermined + ] + +{- | The initial environment with only builtin PLC functions and Prim PureScript types defined +TODO: Move all of the purus-specific stuff out of this module, + reset the initEnvironment to the default, and + modify it at the call site (Language.PureScript.Make) + + This will improve the dependency structure of the project, but also, + allows someone else to adapt Purus for another purpose. The pipeline up to + up to `GenerateDataTypes` is more-or-less backend agnostic, so + someone could easily use this to compile PureScript to another typed + functional language using the IR. +-} initEnvironment :: Environment -initEnvironment = Environment M.empty allPrimTypes M.empty M.empty M.empty allPrimClasses - --- | A constructor for TypeClassData that computes which type class arguments are fully determined --- and argument covering sets. --- Fully determined means that this argument cannot be used when selecting a type class instance. --- A covering set is a minimal collection of arguments that can be used to find an instance and --- therefore determine all other type arguments. --- --- An example of the difference between determined and fully determined would be with the class: --- ```class C a b c | a -> b, b -> a, b -> c``` --- In this case, `a` must differ when `b` differs, and vice versa - each is determined by the other. --- Both `a` and `b` can be used in selecting a type class instance. However, `c` cannot - it is --- fully determined by `a` and `b`. --- --- Define a graph of type class arguments with edges being fundep determiners to determined. Each --- argument also has a self looping edge. --- An argument is fully determined if doesn't appear at the start of a path of strongly connected components. --- An argument is not fully determined otherwise. --- --- The way we compute this is by saying: an argument X is fully determined if there are arguments that --- determine X that X does not determine. This is the same thing: everything X determines includes everything --- in its SCC, and everything determining X is either before it in an SCC path, or in the same SCC. -makeTypeClassData - :: [(Text, Maybe SourceType)] - -> [(Ident, SourceType)] - -> [SourceConstraint] - -> [FunctionalDependency] - -> Bool - -> TypeClassData +initEnvironment = Environment (builtinFunctions <> primFunctions) allPrimTypes primCtors M.empty M.empty allPrimClasses + +{- | A constructor for TypeClassData that computes which type class arguments are fully determined +and argument covering sets. +Fully determined means that this argument cannot be used when selecting a type class instance. +A covering set is a minimal collection of arguments that can be used to find an instance and +therefore determine all other type arguments. + +An example of the difference between determined and fully determined would be with the class: +```class C a b c | a -> b, b -> a, b -> c``` +In this case, `a` must differ when `b` differs, and vice versa - each is determined by the other. +Both `a` and `b` can be used in selecting a type class instance. However, `c` cannot - it is +fully determined by `a` and `b`. + +Define a graph of type class arguments with edges being fundep determiners to determined. Each +argument also has a self looping edge. +An argument is fully determined if doesn't appear at the start of a path of strongly connected components. +An argument is not fully determined otherwise. + +The way we compute this is by saying: an argument X is fully determined if there are arguments that +determine X that X does not determine. This is the same thing: everything X determines includes everything +in its SCC, and everything determining X is either before it in an SCC path, or in the same SCC. +-} +makeTypeClassData :: + [(Text, SourceType)] -> + [(Ident, SourceType)] -> + [SourceConstraint] -> + [FunctionalDependency] -> + Bool -> + TypeClassData makeTypeClassData args m s deps = TypeClassData args m' s deps determinedArgs coveringSets where - ( determinedArgs, coveringSets ) = computeCoveringSets (length args) deps + (determinedArgs, coveringSets) = computeCoveringSets (length args) deps coveringSets' = S.toList coveringSets m' = map (\(a, b) -> (a, b, addVtaInfo b)) m - + addVtaInfo :: SourceType -> Maybe (S.Set (NEL.NonEmpty Int)) addVtaInfo memberTy = do - let mentionedArgIndexes = S.fromList (mapMaybe argToIndex $ freeTypeVariables memberTy) + let mentionedArgIndexes = S.fromList (mapMaybe (argToIndex . fst) $ freeTypeVariables memberTy) let leftovers = map (`S.difference` mentionedArgIndexes) coveringSets' S.fromList <$> traverse (NEL.nonEmpty . S.toList) leftovers argToIndex :: Text -> Maybe Int - argToIndex = flip M.lookup $ M.fromList (zipWith ((,) . fst) args [0..]) + argToIndex = flip M.lookup $ M.fromList (zipWith ((,) . fst) args [0 ..]) -- A moving frontier of sets to consider, along with the fundeps that can be -- applied in each case. At each stage, all sets in the frontier will be the -- same size, decreasing by 1 each time. type Frontier = M.Map IS.IntSet (First (IM.IntMap (NEL.NonEmpty IS.IntSet))) + -- ^ ^ ^ ^ -- when *these* parameters | | | -- are still needed, | | | @@ -162,7 +188,7 @@ type Frontier = M.Map IS.IntSet (First (IM.IntMap (NEL.NonEmpty IS.IntSet))) -- parameters as inputs. computeCoveringSets :: Int -> [FunctionalDependency] -> (S.Set Int, S.Set (S.Set Int)) -computeCoveringSets nargs deps = ( determinedArgs, coveringSets ) +computeCoveringSets nargs deps = (determinedArgs, coveringSets) where argumentIndices = S.fromList [0 .. nargs - 1] @@ -170,53 +196,54 @@ computeCoveringSets nargs deps = ( determinedArgs, coveringSets ) -- functional dependencies. This is done in stages, where each stage -- considers sets of the same size to share work. allCoveringSets :: S.Set (S.Set Int) - allCoveringSets = S.map (S.fromDistinctAscList . IS.toAscList) $ fst $ search $ + allCoveringSets = S.map (S.fromDistinctAscList . IS.toAscList) + $ fst + $ search + $ -- The initial frontier consists of just the set of all parameters and all -- fundeps organized into the map structure. M.singleton - (IS.fromList [0 .. nargs - 1]) $ - First $ IM.fromListWith (<>) $ do - fd <- deps - let srcs = pure (IS.fromList (fdDeterminers fd)) - tgt <- fdDetermined fd - pure (tgt, srcs) - + (IS.fromList [0 .. nargs - 1]) + $ First + $ IM.fromListWith (<>) + $ do + fd <- deps + let srcs = pure (IS.fromList (fdDeterminers fd)) + tgt <- fdDetermined fd + pure (tgt, srcs) where - - -- Recursively advance the frontier until all frontiers are exhausted - -- and coverings sets found. The covering sets found during the process - -- are locally-minimal, in that none can be reduced by a fundep, but - -- there may be subsets found from other frontiers. - search :: Frontier -> (S.Set IS.IntSet, ()) - search frontier = unless (null frontier) $ M.foldMapWithKey step frontier >>= search - - -- The input set from the frontier is known to cover all parameters, but - -- it may be able to be reduced by more fundeps. - step :: IS.IntSet -> First (IM.IntMap (NEL.NonEmpty IS.IntSet)) -> (S.Set IS.IntSet, Frontier) - step needed (First inEdges) - -- If there are no applicable fundeps, record it as a locally minimal - -- covering set. This has already been reduced to only applicable fundeps - | IM.null inEdges = (S.singleton needed, M.empty) - | otherwise = (S.empty, foldMap removeParameter paramsToTry) - + -- Recursively advance the frontier until all frontiers are exhausted + -- and coverings sets found. The covering sets found during the process + -- are locally-minimal, in that none can be reduced by a fundep, but + -- there may be subsets found from other frontiers. + search :: Frontier -> (S.Set IS.IntSet, ()) + search frontier = unless (null frontier) $ M.foldMapWithKey step frontier >>= search + + -- The input set from the frontier is known to cover all parameters, but + -- it may be able to be reduced by more fundeps. + step :: IS.IntSet -> First (IM.IntMap (NEL.NonEmpty IS.IntSet)) -> (S.Set IS.IntSet, Frontier) + step needed (First inEdges) + -- If there are no applicable fundeps, record it as a locally minimal + -- covering set. This has already been reduced to only applicable fundeps + | IM.null inEdges = (S.singleton needed, M.empty) + | otherwise = (S.empty, foldMap removeParameter paramsToTry) where - - determined = IM.keys inEdges - -- If there is an acyclically determined functional dependency, prefer - -- it to reduce the number of cases to check. That is a dependency - -- that does not help determine other parameters. - acycDetermined = find (`IS.notMember` (IS.unions $ concatMap NEL.toList $ IM.elems inEdges)) determined - paramsToTry = maybe determined pure acycDetermined - - -- For each parameter to be removed to build the next frontier, - -- delete the fundeps that determine it and filter out the fundeps - -- that make use of it. Of course, if it an acyclic fundep we already - -- found that there are none that use it. - removeParameter :: Int -> Frontier - removeParameter y = - M.singleton - (IS.delete y needed) $ - case acycDetermined of + determined = IM.keys inEdges + -- If there is an acyclically determined functional dependency, prefer + -- it to reduce the number of cases to check. That is a dependency + -- that does not help determine other parameters. + acycDetermined = find (`IS.notMember` (IS.unions $ concatMap NEL.toList $ IM.elems inEdges)) determined + paramsToTry = maybe determined pure acycDetermined + + -- For each parameter to be removed to build the next frontier, + -- delete the fundeps that determine it and filter out the fundeps + -- that make use of it. Of course, if it an acyclic fundep we already + -- found that there are none that use it. + removeParameter :: Int -> Frontier + removeParameter y = + M.singleton + (IS.delete y needed) + $ case acycDetermined of Just _ -> First $ IM.delete y inEdges Nothing -> First $ IM.mapMaybe (NEL.nonEmpty . NEL.filter (y `IS.notMember`)) $ IM.delete y inEdges @@ -229,25 +256,26 @@ computeCoveringSets nargs deps = ( determinedArgs, coveringSets ) -- | The visibility of a name in scope data NameVisibility - = Undefined - -- ^ The name is defined in the current binding group, but is not visible - | Defined - -- ^ The name is defined in the another binding group, or has been made visible by a function binder + = -- | The name is defined in the current binding group, but is not visible + Undefined + | -- | The name is defined in the another binding group, or has been made visible by a function binder + Defined deriving (Show, Eq, Generic) instance NFData NameVisibility instance Serialise NameVisibility --- | A flag for whether a name is for an private or public value - only public values will be --- included in a generated externs file. +{- | A flag for whether a name is for an private or public value - only public values will be +included in a generated externs file. +-} data NameKind - = Private - -- ^ A private value introduced as an artifact of code generation (class instances, class member - -- accessors, etc.) - | Public - -- ^ A public value for a module member or foreign import declaration - | External - -- ^ A name for member introduced by foreign import + = -- | A private value introduced as an artifact of code generation (class instances, class member + -- accessors, etc.) + Private + | -- | A public value for a module member or foreign import declaration + Public + | -- | A name for member introduced by foreign import + External deriving (Show, Eq, Generic) instance NFData NameKind @@ -255,16 +283,16 @@ instance Serialise NameKind -- | The kinds of a type data TypeKind - = DataType DataDeclType [(Text, Maybe SourceType, Role)] [(ProperName 'ConstructorName, [SourceType])] - -- ^ Data type - | TypeSynonym - -- ^ Type synonym - | ExternData [Role] - -- ^ Foreign data - | LocalTypeVariable - -- ^ A local type variable - | ScopedTypeVar - -- ^ A scoped type variable + = -- | Data type + DataType DataDeclType [(Text, SourceType, Role)] [(ProperName 'ConstructorName, [SourceType])] + | -- | Type synonym + TypeSynonym + | -- | Foreign data + ExternData [Role] + | -- | A local type variable + LocalTypeVariable + | -- | A scoped type variable + ScopedTypeVar deriving (Show, Eq, Generic) instance NFData TypeKind @@ -272,10 +300,10 @@ instance Serialise TypeKind -- | The type ('data' or 'newtype') of a data type declaration data DataDeclType - = Data - -- ^ A standard data constructor - | Newtype - -- ^ A newtype constructor + = -- | A standard data constructor + Data + | -- | A newtype constructor + Newtype deriving (Show, Eq, Ord, Generic) instance NFData DataDeclType @@ -317,7 +345,7 @@ kindRow :: SourceType -> SourceType kindRow = TypeApp nullSourceAnn (srcTypeConstructor C.Row) kindOfREmpty :: SourceType -kindOfREmpty = tyForall "k" kindType (kindRow (tyVar "k")) +kindOfREmpty = tyForall "k" kindType (kindRow (tyVar "k" kindType)) -- | Type constructor for functions tyFunction :: SourceType @@ -344,23 +372,58 @@ tyBoolean :: SourceType tyBoolean = srcTypeConstructor C.Boolean -- | Type constructor for arrays -tyArray :: SourceType -tyArray = srcTypeConstructor C.Array +tyList :: SourceType +tyList = srcTypeConstructor C.List -- | Type constructor for records tyRecord :: SourceType tyRecord = srcTypeConstructor C.Record -tyVar :: Text -> SourceType +tyVar :: Text -> SourceType -> SourceType tyVar = TypeVar nullSourceAnn tyForall :: Text -> SourceType -> SourceType -> SourceType -tyForall var k ty = ForAll nullSourceAnn TypeVarInvisible var (Just k) ty Nothing +tyForall var k ty = ForAll nullSourceAnn TypeVarInvisible var k ty Nothing -- | Smart constructor for function types function :: SourceType -> SourceType -> SourceType function = TypeApp nullSourceAnn . TypeApp nullSourceAnn tyFunction +purusFun :: Type a -> Type a -> Type () +purusFun = f . g + where + f x = TypeApp () x . void + g = TypeApp () tyFunctionNoAnn . void + tyFunctionNoAnn = TypeConstructor () C.Function + +-- This is borderline necessary +pattern (:->) :: Type a -> Type a -> Type a +pattern a :-> b <- + TypeApp + _ + (TypeApp _ (TypeConstructor _ C.Function) a) + b + +pattern ListT :: Type a -> Type a +pattern ListT a <- + TypeApp _ (TypeConstructor _ C.List) a + +arrayT :: SourceType -> SourceType +arrayT = TypeApp NullSourceAnn (TypeConstructor NullSourceAnn C.List) + +pattern RecordT :: Type a -> Type a +pattern RecordT a <- + TypeApp _ (TypeConstructor _ C.Record) a + +mkRecordT :: SourceType -> SourceType +mkRecordT = TypeApp nullSourceAnn (TypeConstructor nullSourceAnn C.Record) + +getFunArgTy :: Type a -> Type a +getFunArgTy = \case + a :-> _ -> a + ForAll _ _ _ _ t _ -> getFunArgTy t + other -> other + -- To make reading the kind signatures below easier (-:>) :: SourceType -> SourceType -> SourceType (-:>) = function @@ -369,45 +432,125 @@ infixr 4 -:> primClass :: Qualified (ProperName 'ClassName) -> (SourceType -> SourceType) -> [(Qualified (ProperName 'TypeName), (SourceType, TypeKind))] primClass name mkKind = [ let k = mkKind kindConstraint - in (coerceProperName <$> name, (k, ExternData (nominalRolesForKind k))) + in (coerceProperName <$> name, (k, ExternData (nominalRolesForKind k))) , let k = mkKind kindType - in (dictTypeName . coerceProperName <$> name, (k, TypeSynonym)) + in (dictTypeName . coerceProperName <$> name, (k, TypeSynonym)) ] --- | The primitive types in the external environment with their --- associated kinds. There are also pseudo `Fail`, `Warn`, and `Partial` types --- that correspond to the classes with the same names. +primCtors :: M.Map (Qualified (ProperName 'ConstructorName)) (DataDeclType, ProperName 'TypeName, SourceType, [Ident]) +primCtors = + M.fromList tupleCtors + <> M.fromList + [ (mkCtor "True", (Data, disqualify C.Boolean, srcTypeConstructor C.Boolean, [])) + , (mkCtor "False", (Data, disqualify C.Boolean, srcTypeConstructor C.Boolean, [])) + , (mkCtor "Nil", (Data, disqualify C.List, forallT "x" $ \x -> arrayT x, [])) + , (mkCtor "Cons", (Data, disqualify C.List, forallT "x" $ \x -> x -:> arrayT x -:> arrayT x, [])) + ] + +mkCtor :: Text -> Qualified (ProperName 'ConstructorName) +mkCtor nm = Qualified (ByModuleName C.M_Prim) (ProperName nm) + +tupleCtors :: [(Qualified (ProperName 'ConstructorName), (DataDeclType, ProperName 'TypeName, SourceType, [a]))] +tupleCtors = + [1 .. 100] <&> \n -> + let ctorNm = mkCtor ("Tuple" <> T.pack (show n)) + ctorTyNm = coerceProperName @_ @'TypeName $ disqualify ctorNm + ctorTy = mkCtorTy (coerceProperName <$> ctorNm) n + in (ctorNm, (Data, ctorTyNm, ctorTy, [])) + +-- These need to be exported b/c we need them in CoreFn -> IR desugaring +vars :: Int -> [Text] +vars n = map (\x -> "t" <> T.pack (show x)) [1 .. n] + +mkCtorTy :: Qualified (ProperName 'TypeName) -> Int -> SourceType +mkCtorTy tNm n = + let nVars = (\x -> TypeVar NullSourceAnn x kindType) <$> vars n + nTyCon = TypeConstructor NullSourceAnn tNm + resTy = foldl' srcTypeApp nTyCon nVars + in quantify $ foldr (-:>) resTy nVars + +{- | The primitive types in the external environment with their +associated kinds. There are also pseudo `Fail`, `Warn`, and `Partial` types +that correspond to the classes with the same names. +-} primTypes :: M.Map (Qualified (ProperName 'TypeName)) (SourceType, TypeKind) primTypes = - M.fromList - [ (C.Type, (kindType, ExternData [])) - , (C.Constraint, (kindType, ExternData [])) - , (C.Symbol, (kindType, ExternData [])) - , (C.Row, (kindType -:> kindType, ExternData [Phantom])) - , (C.Function, (kindType -:> kindType -:> kindType, ExternData [Representational, Representational])) - , (C.Array, (kindType -:> kindType, ExternData [Representational])) - , (C.Record, (kindRow kindType -:> kindType, ExternData [Representational])) - , (C.String, (kindType, ExternData [])) - , (C.Char, (kindType, ExternData [])) - , (C.Number, (kindType, ExternData [])) - , (C.Int, (kindType, ExternData [])) - , (C.Boolean, (kindType, ExternData [])) - , (C.Partial <&> coerceProperName, (kindConstraint, ExternData [])) - ] + tupleTypes + <> M.fromList + [ (C.Type, (kindType, ExternData [])) + , (C.Constraint, (kindType, ExternData [])) + , (C.Symbol, (kindType, ExternData [])) + , (C.Row, (kindType -:> kindType, ExternData [Phantom])) + , (C.Function, (kindType -:> kindType -:> kindType, ExternData [Representational, Representational])) + , (C.List, (kindType -:> kindType, listData)) + , (C.Record, (kindRow kindType -:> kindType, ExternData [Representational])) + , (C.String, (kindType, ExternData [])) + , (C.Char, (kindType, ExternData [])) + , (C.Number, (kindType, ExternData [])) + , (C.Int, (kindType, ExternData [])) + , (C.Boolean, (kindType, boolData)) + , (C.Partial <&> coerceProperName, (kindConstraint, ExternData [])) + , (C.Unit, (kindType, ExternData [])) + ] + where + boolData = + DataType + Data + [] + [ (disqualify C.C_True, []) + , (disqualify C.C_False, []) + ] + listData = + DataType + Data + [("a", kindType, Representational)] + [ (disqualify C.C_Nil, []) + , (disqualify C.C_Cons, [TypeVar NullSourceAnn "a" kindType, arrayT (TypeVar NullSourceAnn "a" kindType)]) + ] -- | This 'Map' contains all of the prim types from all Prim modules. allPrimTypes :: M.Map (Qualified (ProperName 'TypeName)) (SourceType, TypeKind) -allPrimTypes = M.unions - [ primTypes - , primBooleanTypes - , primCoerceTypes - , primOrderingTypes - , primRowTypes - , primRowListTypes - , primSymbolTypes - , primIntTypes - , primTypeErrorTypes - ] +allPrimTypes = + M.unions + [ primTypes + , primBooleanTypes + , primCoerceTypes + , primOrderingTypes + , primRowTypes + , primRowListTypes + , primSymbolTypes + , primIntTypes + , primTypeErrorTypes + , -- For the sake of simplicity I'm putting the builtins here as well + builtinTypes + ] + +tupleTypes :: M.Map (Qualified (ProperName 'TypeName)) (SourceType, TypeKind) +tupleTypes = M.fromList $ go <$> [1 .. maxTupleSize] + where + mkTupleKind :: Int -> SourceType + mkTupleKind n = foldr (-:>) kindType (replicate n kindType) + + mkTupleArgVars n = vars n <&> \v -> (v, kindType, Representational) + + mkCtorTVArgs n = vars n <&> \v -> TypeVar NullSourceAnn v kindType + + go :: Int -> (Qualified (ProperName 'TypeName), (SourceType, TypeKind)) + go n = + let tName = mkTupleTyName n + tKind = mkTupleKind n + tArgs = mkTupleArgVars n + + ctorNm = coerceProperName . disqualify $ tName + ctorArgs = mkCtorTVArgs n + + datType = DataType Data tArgs [(ctorNm, ctorArgs)] + in (tName, (tKind, datType)) + +-- needs exported for DesugarCore +mkTupleTyName :: Int -> Qualified (ProperName 'TypeName) +mkTupleTyName x = + Qualified (ByModuleName C.M_Prim) (ProperName $ "Tuple" <> T.pack (show x)) primBooleanTypes :: M.Map (Qualified (ProperName 'TypeName)) (SourceType, TypeKind) primBooleanTypes = @@ -418,9 +561,10 @@ primBooleanTypes = primCoerceTypes :: M.Map (Qualified (ProperName 'TypeName)) (SourceType, TypeKind) primCoerceTypes = - M.fromList $ mconcat - [ primClass C.Coercible (\kind -> tyForall "k" kindType $ tyVar "k" -:> tyVar "k" -:> kind) - ] + M.fromList $ + mconcat + [ primClass C.Coercible (\kind -> tyForall "k" kindType $ tyVar "k" kindType -:> tyVar "k" kindType -:> kind) + ] primOrderingTypes :: M.Map (Qualified (ProperName 'TypeName)) (SourceType, TypeKind) primOrderingTypes = @@ -433,39 +577,43 @@ primOrderingTypes = primRowTypes :: M.Map (Qualified (ProperName 'TypeName)) (SourceType, TypeKind) primRowTypes = - M.fromList $ mconcat - [ primClass C.RowUnion (\kind -> tyForall "k" kindType $ kindRow (tyVar "k") -:> kindRow (tyVar "k") -:> kindRow (tyVar "k") -:> kind) - , primClass C.RowNub (\kind -> tyForall "k" kindType $ kindRow (tyVar "k") -:> kindRow (tyVar "k") -:> kind) - , primClass C.RowLacks (\kind -> tyForall "k" kindType $ kindSymbol -:> kindRow (tyVar "k") -:> kind) - , primClass C.RowCons (\kind -> tyForall "k" kindType $ kindSymbol -:> tyVar "k" -:> kindRow (tyVar "k") -:> kindRow (tyVar "k") -:> kind) - ] + M.fromList $ + mconcat + [ primClass C.RowUnion (\kind -> tyForall "k" kindType $ kindRow (tyVar "k" kindType) -:> kindRow (tyVar "k" kindType) -:> kindRow (tyVar "k" kindType) -:> kind) + , primClass C.RowNub (\kind -> tyForall "k" kindType $ kindRow (tyVar "k" kindType) -:> kindRow (tyVar "k" kindType) -:> kind) + , primClass C.RowLacks (\kind -> tyForall "k" kindType $ kindSymbol -:> kindRow (tyVar "k" kindType) -:> kind) + , primClass C.RowCons (\kind -> tyForall "k" kindType $ kindSymbol -:> tyVar "k" kindType -:> kindRow (tyVar "k" kindType) -:> kindRow (tyVar "k" kindType) -:> kind) + ] primRowListTypes :: M.Map (Qualified (ProperName 'TypeName)) (SourceType, TypeKind) primRowListTypes = M.fromList $ [ (C.RowList, (kindType -:> kindType, ExternData [Phantom])) - , (C.RowListCons, (tyForall "k" kindType $ kindSymbol -:> tyVar "k" -:> kindRowList (tyVar "k") -:> kindRowList (tyVar "k"), ExternData [Phantom, Phantom, Phantom])) - , (C.RowListNil, (tyForall "k" kindType $ kindRowList (tyVar "k"), ExternData [])) - ] <> mconcat - [ primClass C.RowToList (\kind -> tyForall "k" kindType $ kindRow (tyVar "k") -:> kindRowList (tyVar "k") -:> kind) + , (C.RowListCons, (tyForall "k" kindType $ kindSymbol -:> tyVar "k" kindType -:> kindRowList (tyVar "k" kindType) -:> kindRowList (tyVar "k" kindType), ExternData [Phantom, Phantom, Phantom])) + , (C.RowListNil, (tyForall "k" kindType $ kindRowList (tyVar "k" kindType), ExternData [])) ] + <> mconcat + [ primClass C.RowToList (\kind -> tyForall "k" kindType $ kindRow (tyVar "k" kindType) -:> kindRowList (tyVar "k" kindType) -:> kind) + ] primSymbolTypes :: M.Map (Qualified (ProperName 'TypeName)) (SourceType, TypeKind) primSymbolTypes = - M.fromList $ mconcat - [ primClass C.SymbolAppend (\kind -> kindSymbol -:> kindSymbol -:> kindSymbol -:> kind) - , primClass C.SymbolCompare (\kind -> kindSymbol -:> kindSymbol -:> kindOrdering -:> kind) - , primClass C.SymbolCons (\kind -> kindSymbol -:> kindSymbol -:> kindSymbol -:> kind) - ] + M.fromList $ + mconcat + [ primClass C.SymbolAppend (\kind -> kindSymbol -:> kindSymbol -:> kindSymbol -:> kind) + , primClass C.SymbolCompare (\kind -> kindSymbol -:> kindSymbol -:> kindOrdering -:> kind) + , primClass C.SymbolCons (\kind -> kindSymbol -:> kindSymbol -:> kindSymbol -:> kind) + ] primIntTypes :: M.Map (Qualified (ProperName 'TypeName)) (SourceType, TypeKind) primIntTypes = - M.fromList $ mconcat - [ primClass C.IntAdd (\kind -> tyInt -:> tyInt -:> tyInt -:> kind) - , primClass C.IntCompare (\kind -> tyInt -:> tyInt -:> kindOrdering -:> kind) - , primClass C.IntMul (\kind -> tyInt -:> tyInt -:> tyInt -:> kind) - , primClass C.IntToString (\kind -> tyInt -:> kindSymbol -:> kind) - ] + M.fromList $ + mconcat + [ primClass C.IntAdd (\kind -> tyInt -:> tyInt -:> tyInt -:> kind) + , primClass C.IntCompare (\kind -> tyInt -:> tyInt -:> kindOrdering -:> kind) + , primClass C.IntMul (\kind -> tyInt -:> tyInt -:> tyInt -:> kind) + , primClass C.IntToString (\kind -> tyInt -:> kindSymbol -:> kind) + ] primTypeErrorTypes :: M.Map (Qualified (ProperName 'TypeName)) (SourceType, TypeKind) primTypeErrorTypes = @@ -474,17 +622,19 @@ primTypeErrorTypes = , (C.Fail <&> coerceProperName, (kindDoc -:> kindConstraint, ExternData [Nominal])) , (C.Warn <&> coerceProperName, (kindDoc -:> kindConstraint, ExternData [Nominal])) , (C.Text, (kindSymbol -:> kindDoc, ExternData [Phantom])) - , (C.Quote, (tyForall "k" kindType $ tyVar "k" -:> kindDoc, ExternData [Phantom])) + , (C.Quote, (tyForall "k" kindType $ tyVar "k" kindType -:> kindDoc, ExternData [Phantom])) , (C.QuoteLabel, (kindSymbol -:> kindDoc, ExternData [Phantom])) , (C.Beside, (kindDoc -:> kindDoc -:> kindDoc, ExternData [Phantom, Phantom])) , (C.Above, (kindDoc -:> kindDoc -:> kindDoc, ExternData [Phantom, Phantom])) - ] <> mconcat - [ primClass C.Fail (\kind -> kindDoc -:> kind) - , primClass C.Warn (\kind -> kindDoc -:> kind) ] - --- | The primitive class map. This just contains the `Partial` class. --- `Partial` is used as a kind of magic constraint for partial functions. + <> mconcat + [ primClass C.Fail (\kind -> kindDoc -:> kind) + , primClass C.Warn (\kind -> kindDoc -:> kind) + ] + +{- | The primitive class map. This just contains the `Partial` class. +`Partial` is used as a kind of magic constraint for partial functions. +-} primClasses :: M.Map (Qualified (ProperName 'ClassName)) TypeClassData primClasses = M.fromList @@ -493,163 +643,249 @@ primClasses = -- | This contains all of the type classes from all Prim modules. allPrimClasses :: M.Map (Qualified (ProperName 'ClassName)) TypeClassData -allPrimClasses = M.unions - [ primClasses - , primCoerceClasses - , primRowClasses - , primRowListClasses - , primSymbolClasses - , primIntClasses - , primTypeErrorClasses - ] +allPrimClasses = + M.unions + [ primClasses + , primCoerceClasses + , primRowClasses + , primRowListClasses + , primSymbolClasses + , primIntClasses + , primTypeErrorClasses + ] primCoerceClasses :: M.Map (Qualified (ProperName 'ClassName)) TypeClassData primCoerceClasses = M.fromList -- class Coercible (a :: k) (b :: k) - [ (C.Coercible, makeTypeClassData - [ ("a", Just (tyVar "k")) - , ("b", Just (tyVar "k")) - ] [] [] [] True) + [ + ( C.Coercible + , makeTypeClassData + [ ("a", (tyVar "k" kindType)) + , ("b", (tyVar "k" kindType)) + ] + [] + [] + [] + True + ) ] primRowClasses :: M.Map (Qualified (ProperName 'ClassName)) TypeClassData primRowClasses = M.fromList -- class Union (left :: Row k) (right :: Row k) (union :: Row k) | left right -> union, right union -> left, union left -> right - [ (C.RowUnion, makeTypeClassData - [ ("left", Just (kindRow (tyVar "k"))) - , ("right", Just (kindRow (tyVar "k"))) - , ("union", Just (kindRow (tyVar "k"))) - ] [] [] - [ FunctionalDependency [0, 1] [2] - , FunctionalDependency [1, 2] [0] - , FunctionalDependency [2, 0] [1] - ] True) - - -- class Nub (original :: Row k) (nubbed :: Row k) | original -> nubbed - , (C.RowNub, makeTypeClassData - [ ("original", Just (kindRow (tyVar "k"))) - , ("nubbed", Just (kindRow (tyVar "k"))) - ] [] [] - [ FunctionalDependency [0] [1] - ] True) - - -- class Lacks (label :: Symbol) (row :: Row k) - , (C.RowLacks, makeTypeClassData - [ ("label", Just kindSymbol) - , ("row", Just (kindRow (tyVar "k"))) - ] [] [] [] True) - - -- class RowCons (label :: Symbol) (a :: k) (tail :: Row k) (row :: Row k) | label tail a -> row, label row -> tail a - , (C.RowCons, makeTypeClassData - [ ("label", Just kindSymbol) - , ("a", Just (tyVar "k")) - , ("tail", Just (kindRow (tyVar "k"))) - , ("row", Just (kindRow (tyVar "k"))) - ] [] [] - [ FunctionalDependency [0, 1, 2] [3] - , FunctionalDependency [0, 3] [1, 2] - ] True) + [ + ( C.RowUnion + , makeTypeClassData + [ ("left", (kindRow (tyVar "k" kindType))) + , ("right", (kindRow (tyVar "k" kindType))) + , ("union", (kindRow (tyVar "k" kindType))) + ] + [] + [] + [ FunctionalDependency [0, 1] [2] + , FunctionalDependency [1, 2] [0] + , FunctionalDependency [2, 0] [1] + ] + True + ) + , -- class Nub (original :: Row k) (nubbed :: Row k) | original -> nubbed + + ( C.RowNub + , makeTypeClassData + [ ("original", (kindRow (tyVar "k" kindType))) + , ("nubbed", (kindRow (tyVar "k" kindType))) + ] + [] + [] + [ FunctionalDependency [0] [1] + ] + True + ) + , -- class Lacks (label :: Symbol) (row :: Row k) + + ( C.RowLacks + , makeTypeClassData + [ ("label", kindSymbol) + , ("row", (kindRow (tyVar "k" kindType))) + ] + [] + [] + [] + True + ) + , -- class RowCons (label :: Symbol) (a :: k) (tail :: Row k) (row :: Row k) | label tail a -> row, label row -> tail a + + ( C.RowCons + , makeTypeClassData + [ ("label", kindSymbol) + , ("a", (tyVar "k" kindType)) + , ("tail", (kindRow (tyVar "k" kindType))) + , ("row", (kindRow (tyVar "k" kindType))) + ] + [] + [] + [ FunctionalDependency [0, 1, 2] [3] + , FunctionalDependency [0, 3] [1, 2] + ] + True + ) ] primRowListClasses :: M.Map (Qualified (ProperName 'ClassName)) TypeClassData primRowListClasses = M.fromList -- class RowToList (row :: Row k) (list :: RowList k) | row -> list - [ (C.RowToList, makeTypeClassData - [ ("row", Just (kindRow (tyVar "k"))) - , ("list", Just (kindRowList (tyVar "k"))) - ] [] [] - [ FunctionalDependency [0] [1] - ] True) + [ + ( C.RowToList + , makeTypeClassData + [ ("row", (kindRow (tyVar "k" kindType))) + , ("list", (kindRowList (tyVar "k" kindType))) + ] + [] + [] + [ FunctionalDependency [0] [1] + ] + True + ) ] primSymbolClasses :: M.Map (Qualified (ProperName 'ClassName)) TypeClassData primSymbolClasses = M.fromList -- class Append (left :: Symbol) (right :: Symbol) (appended :: Symbol) | left right -> appended, right appended -> left, appended left -> right - [ (C.SymbolAppend, makeTypeClassData - [ ("left", Just kindSymbol) - , ("right", Just kindSymbol) - , ("appended", Just kindSymbol) - ] [] [] - [ FunctionalDependency [0, 1] [2] - , FunctionalDependency [1, 2] [0] - , FunctionalDependency [2, 0] [1] - ] True) - - -- class Compare (left :: Symbol) (right :: Symbol) (ordering :: Ordering) | left right -> ordering - , (C.SymbolCompare, makeTypeClassData - [ ("left", Just kindSymbol) - , ("right", Just kindSymbol) - , ("ordering", Just kindOrdering) - ] [] [] - [ FunctionalDependency [0, 1] [2] - ] True) - - -- class Cons (head :: Symbol) (tail :: Symbol) (symbol :: Symbol) | head tail -> symbol, symbol -> head tail - , (C.SymbolCons, makeTypeClassData - [ ("head", Just kindSymbol) - , ("tail", Just kindSymbol) - , ("symbol", Just kindSymbol) - ] [] [] - [ FunctionalDependency [0, 1] [2] - , FunctionalDependency [2] [0, 1] - ] True) + [ + ( C.SymbolAppend + , makeTypeClassData + [ ("left", kindSymbol) + , ("right", kindSymbol) + , ("appended", kindSymbol) + ] + [] + [] + [ FunctionalDependency [0, 1] [2] + , FunctionalDependency [1, 2] [0] + , FunctionalDependency [2, 0] [1] + ] + True + ) + , -- class Compare (left :: Symbol) (right :: Symbol) (ordering :: Ordering) | left right -> ordering + + ( C.SymbolCompare + , makeTypeClassData + [ ("left", kindSymbol) + , ("right", kindSymbol) + , ("ordering", kindOrdering) + ] + [] + [] + [ FunctionalDependency [0, 1] [2] + ] + True + ) + , -- class Cons (head :: Symbol) (tail :: Symbol) (symbol :: Symbol) | head tail -> symbol, symbol -> head tail + + ( C.SymbolCons + , makeTypeClassData + [ ("head", kindSymbol) + , ("tail", kindSymbol) + , ("symbol", kindSymbol) + ] + [] + [] + [ FunctionalDependency [0, 1] [2] + , FunctionalDependency [2] [0, 1] + ] + True + ) ] primIntClasses :: M.Map (Qualified (ProperName 'ClassName)) TypeClassData primIntClasses = M.fromList -- class Add (left :: Int) (right :: Int) (sum :: Int) | left right -> sum, left sum -> right, right sum -> left - [ (C.IntAdd, makeTypeClassData - [ ("left", Just tyInt) - , ("right", Just tyInt) - , ("sum", Just tyInt) - ] [] [] - [ FunctionalDependency [0, 1] [2] - , FunctionalDependency [0, 2] [1] - , FunctionalDependency [1, 2] [0] - ] True) - - -- class Compare (left :: Int) (right :: Int) (ordering :: Ordering) | left right -> ordering - , (C.IntCompare, makeTypeClassData - [ ("left", Just tyInt) - , ("right", Just tyInt) - , ("ordering", Just kindOrdering) - ] [] [] - [ FunctionalDependency [0, 1] [2] - ] True) - - -- class Mul (left :: Int) (right :: Int) (product :: Int) | left right -> product - , (C.IntMul, makeTypeClassData - [ ("left", Just tyInt) - , ("right", Just tyInt) - , ("product", Just tyInt) - ] [] [] - [ FunctionalDependency [0, 1] [2] - ] True) - - -- class ToString (int :: Int) (string :: Symbol) | int -> string - , (C.IntToString, makeTypeClassData - [ ("int", Just tyInt) - , ("string", Just kindSymbol) - ] [] [] - [ FunctionalDependency [0] [1] - ] True) + [ + ( C.IntAdd + , makeTypeClassData + [ ("left", tyInt) + , ("right", tyInt) + , ("sum", tyInt) + ] + [] + [] + [ FunctionalDependency [0, 1] [2] + , FunctionalDependency [0, 2] [1] + , FunctionalDependency [1, 2] [0] + ] + True + ) + , -- class Compare (left :: Int) (right :: Int) (ordering :: Ordering) | left right -> ordering + + ( C.IntCompare + , makeTypeClassData + [ ("left", tyInt) + , ("right", tyInt) + , ("ordering", kindOrdering) + ] + [] + [] + [ FunctionalDependency [0, 1] [2] + ] + True + ) + , -- class Mul (left :: Int) (right :: Int) (product :: Int) | left right -> product + + ( C.IntMul + , makeTypeClassData + [ ("left", tyInt) + , ("right", tyInt) + , ("product", tyInt) + ] + [] + [] + [ FunctionalDependency [0, 1] [2] + ] + True + ) + , -- class ToString (int :: Int) (string :: Symbol) | int -> string + + ( C.IntToString + , makeTypeClassData + [ ("int", tyInt) + , ("string", kindSymbol) + ] + [] + [] + [ FunctionalDependency [0] [1] + ] + True + ) ] primTypeErrorClasses :: M.Map (Qualified (ProperName 'ClassName)) TypeClassData primTypeErrorClasses = M.fromList -- class Fail (message :: Symbol) - [ (C.Fail, makeTypeClassData - [("message", Just kindDoc)] [] [] [] True) - - -- class Warn (message :: Symbol) - , (C.Warn, makeTypeClassData - [("message", Just kindDoc)] [] [] [] True) + [ + ( C.Fail + , makeTypeClassData + [("message", kindDoc)] + [] + [] + [] + True + ) + , -- class Warn (message :: Symbol) + + ( C.Warn + , makeTypeClassData + [("message", kindDoc)] + [] + [] + [] + True + ) ] -- | Finds information about data constructors from the current environment. @@ -670,9 +906,10 @@ dictTypeName = ProperName . dictTypeName' . runProperName isDictTypeName :: ProperName a -> Bool isDictTypeName = T.isSuffixOf "$Dict" . runProperName --- | --- Given the kind of a type, generate a list @Nominal@ roles. This is used for --- opaque foreign types as well as type classes. +{- | +Given the kind of a type, generate a list @Nominal@ roles. This is used for +opaque foreign types as well as type classes. +-} nominalRolesForKind :: Type a -> [Role] nominalRolesForKind k = replicate (kindArity k) Nominal @@ -680,8 +917,143 @@ kindArity :: Type a -> Int kindArity = length . fst . unapplyKinds unapplyKinds :: Type a -> ([Type a], Type a) -unapplyKinds = go [] where - go kinds (TypeApp _ (TypeApp _ fn k1) k2) - | eqType fn tyFunction = go (k1 : kinds) k2 - go kinds (ForAll _ _ _ _ k _) = go kinds k - go kinds k = (reverse kinds, k) +unapplyKinds = go [] + where + go kinds (TypeApp _ (TypeApp _ fn k1) k2) + | eqType fn tyFunction = go (k1 : kinds) k2 + go kinds (ForAll _ _ _ _ k _) = go kinds k + go kinds k = (reverse kinds, k) + +{- | +Plutus Data / Builtins: +We need to provide primitives for Data-encoded objects, +builtin functions, etc +-} +tyBuiltinData :: SourceType +tyBuiltinData = srcTypeConstructor PLC.BuiltinData + +tyAsData :: SourceType -> SourceType +tyAsData = TypeApp nullSourceAnn (srcTypeConstructor PLC.AsData) + +tyBuiltinPair :: SourceType -> SourceType -> SourceType +tyBuiltinPair a b = + TypeApp + nullSourceAnn + ( TypeApp + nullSourceAnn + (srcTypeConstructor PLC.BuiltinPair) + a + ) + b + +tyBuiltinList :: SourceType -> SourceType +tyBuiltinList = TypeApp nullSourceAnn (srcTypeConstructor PLC.BuiltinList) + +tyByteString :: SourceType +tyByteString = srcTypeConstructor PLC.BuiltinByteString + +tyUnit :: SourceType +tyUnit = srcTypeConstructor C.Unit + +-- just for readability +(#@) :: Qualified Ident -> SourceType -> (Qualified Ident, SourceType) +f #@ t = (f, t) + +-- the kind is Type here. This is just to avoid potentially making a typo (and to make the manual function sigs more readable) +forallT :: Text -> (SourceType -> SourceType) -> SourceType +forallT txt f = tyForall txt kindType (f $ tyVar txt kindType) +infixr 0 #@ + +builtinTypes :: M.Map (Qualified (ProperName 'TypeName)) (SourceType, TypeKind) +builtinTypes = + M.fromList + [ (PLC.BuiltinData, (kindType, ExternData [])) + , (PLC.BuiltinPair, (kindType -:> kindType -:> kindType, ExternData [Representational, Representational])) + , (PLC.BuiltinList, (kindType -:> kindType, ExternData [Representational])) + , (PLC.BuiltinByteString, (kindType, ExternData [])) + ] + +primFunctions :: M.Map (Qualified Ident) (SourceType, NameKind, NameVisibility) +primFunctions = M.singleton (Qualified (ByModuleName C.M_Prim) (Ident "unit")) (tyUnit, Public, Defined) + +builtinFunctions :: M.Map (Qualified Ident) (SourceType, NameKind, NameVisibility) +builtinFunctions = builtinCxt <&> \x -> (x, Public, Defined) + +-- NOTE/REVIEW: I'm rendering all "Word8" types as tyInt for now. +-- I'm not sure whether that's correct +builtinCxt :: M.Map (Qualified Ident) SourceType +builtinCxt = + M.fromList + [ -- Integers + PLC.I_addInteger #@ tyInt -:> tyInt -:> tyInt + , PLC.I_subtractInteger #@ tyInt -:> tyInt -:> tyInt + , PLC.I_multiplyInteger #@ tyInt -:> tyInt -:> tyInt + , PLC.I_divideInteger #@ tyInt -:> tyInt -:> tyInt + , PLC.I_quotientInteger #@ tyInt -:> tyInt -:> tyInt + , PLC.I_remainderInteger #@ tyInt -:> tyInt -:> tyInt + , PLC.I_modInteger #@ tyInt -:> tyInt -:> tyInt + , PLC.I_equalsInteger #@ tyInt -:> tyInt -:> tyBoolean + , PLC.I_lessThanInteger #@ tyInt -:> tyInt -:> tyBoolean + , PLC.I_lessThanEqualsInteger #@ tyInt -:> tyInt -:> tyBoolean + , -- ByteStrings + PLC.I_appendByteString #@ tyByteString -:> tyByteString -:> tyByteString + , -- \/ Check the implications of the variant semantics for this (https://github.com/IntersectMBO/plutus/blob/973e03bbccbe3b860e2c8bf70c2f49418811a6ce/plutus-core/plutus-core/src/PlutusCore/Default/Builtins.hs#L1179-L1207) + PLC.I_consByteString #@ tyInt -:> tyByteString -:> tyByteString + , PLC.I_sliceByteString #@ tyInt -:> tyInt -:> tyByteString -:> tyByteString + , PLC.I_lengthOfByteString #@ tyByteString -:> tyInt + , PLC.I_indexByteString #@ tyByteString -:> tyInt -:> tyInt + , PLC.I_equalsByteString #@ tyByteString -:> tyByteString -:> tyBoolean + , PLC.I_lessThanByteString #@ tyByteString -:> tyByteString -:> tyBoolean + , PLC.I_lessThanEqualsByteString #@ tyByteString -:> tyByteString -:> tyBoolean + , -- Cryptography + PLC.I_sha2_256 #@ tyByteString -:> tyByteString + , PLC.I_sha3_256 #@ tyByteString -:> tyByteString + , PLC.I_blake2b_256 #@ tyByteString -:> tyByteString + , PLC.I_verifyEd25519Signature #@ tyByteString -:> tyByteString -:> tyByteString -:> tyBoolean + , PLC.I_verifyEcdsaSecp256k1Signature #@ tyByteString -:> tyByteString -:> tyByteString -:> tyBoolean + , PLC.I_verifySchnorrSecp256k1Signature #@ tyByteString -:> tyByteString -:> tyByteString -:> tyBoolean + , -- Strings + PLC.I_appendString #@ tyString -:> tyString -:> tyString + , PLC.I_equalsString #@ tyString -:> tyString -:> tyBoolean + , PLC.I_encodeUtf8 #@ tyString -:> tyByteString + , PLC.I_decodeUtf8 #@ tyByteString -:> tyString + , -- Bool + -- NOTE: Specializing this to "Type", which miiiight not be what we want depending on how we do the data encoding + PLC.I_ifThenElse #@ forallT "x" $ \x -> tyBoolean -:> x -:> x -:> x + , -- Unit + PLC.I_chooseUnit #@ forallT "x" $ \x -> tyUnit -:> x -:> x + , -- Tracing + PLC.I_trace #@ forallT "x" $ \x -> tyString -:> x -:> x + , -- Pairs + PLC.I_fstPair #@ forallT "a" $ \a -> forallT "b" $ \b -> tyBuiltinPair a b -:> a + , PLC.I_sndPair #@ forallT "a" $ \a -> forallT "b" $ \b -> tyBuiltinPair a b -:> b + , -- Lists + PLC.I_chooseList #@ forallT "a" $ \a -> forallT "b" $ \b -> tyBuiltinList a -:> b -:> b + , PLC.I_mkCons #@ forallT "a" $ \a -> a -:> tyBuiltinList a -:> tyBuiltinList a + , PLC.I_headList #@ forallT "a" $ \a -> tyBuiltinList a -:> a + , PLC.I_tailList #@ forallT "a" $ \a -> tyBuiltinList a -:> tyBuiltinList a + , PLC.I_nullList #@ forallT "a" $ \a -> tyBuiltinList a -:> tyBoolean + , -- Data + -- Construction + PLC.I_chooseData #@ forallT "a" $ \a -> tyBuiltinData -:> a -:> a -:> a -:> a -:> a + , PLC.I_constrData #@ tyInt -:> tyBuiltinList tyBuiltinData -:> tyBuiltinData + , PLC.I_mapData #@ tyBuiltinList (tyBuiltinPair tyBuiltinData tyBuiltinData) -:> tyBuiltinData + , PLC.I_listData #@ tyBuiltinList tyBuiltinData -:> tyBuiltinData + , PLC.I_iData #@ tyInt -:> tyBuiltinData + , PLC.I_bData #@ tyByteString -:> tyBuiltinData + , -- Destruction + PLC.I_unConstrData #@ tyBuiltinData -:> tyBuiltinPair tyInt tyBuiltinData + , PLC.I_unMapData #@ tyBuiltinData -:> tyBuiltinList (tyBuiltinPair tyBuiltinData tyBuiltinData) + , PLC.I_unListData #@ tyBuiltinData -:> tyBuiltinList tyBuiltinData + , PLC.I_unIData #@ tyBuiltinData -:> tyInt + , PLC.I_unBData #@ tyBuiltinData -:> tyByteString + , -- Data Misc + PLC.I_equalsData #@ tyBuiltinData -:> tyBuiltinData -:> tyBoolean + , PLC.I_serialiseData #@ tyBuiltinData -:> tyByteString + , -- Misc constructors + PLC.I_mkPairData #@ tyBuiltinData -:> tyBuiltinData -:> tyBuiltinPair tyBuiltinData tyBuiltinData + , PLC.I_mkNilData #@ tyUnit -:> tyBuiltinList tyBuiltinData + , PLC.I_mkNilPairData #@ tyUnit -:> tyBuiltinList (tyBuiltinPair tyBuiltinData tyBuiltinData) + -- TODO: the Bls12 crypto primfuns + -- NOTE: IntegerToByteString & ByteStringToInteger don't appear to be in the version of PlutusCore we have? + ] diff --git a/src/Language/PureScript/Errors.hs b/src/Language/PureScript/Errors.hs index 2d8225f32..decbc3e34 100644 --- a/src/Language/PureScript/Errors.hs +++ b/src/Language/PureScript/Errors.hs @@ -1,18 +1,18 @@ -module Language.PureScript.Errors - ( module Language.PureScript.AST - , module Language.PureScript.Errors - ) where +module Language.PureScript.Errors ( + module Language.PureScript.AST, + module Language.PureScript.Errors, +) where -import Prelude import Protolude (unsnoc) +import Prelude import Control.Arrow ((&&&)) import Control.Exception (displayException) import Control.Lens (both, head1, over) import Control.Monad (forM, unless) -import Control.Monad.Error.Class (MonadError(..)) +import Control.Monad.Error.Class (MonadError (..)) import Control.Monad.Trans.State.Lazy (State, evalState, get, put) -import Control.Monad.Writer (Last(..), MonadWriter(..), censor) +import Control.Monad.Writer (Last (..), MonadWriter (..), censor) import Data.Bifunctor (first, second) import Data.Bitraversable (bitraverse) import Data.Char (isSpace) @@ -21,34 +21,35 @@ import Data.Either (partitionEithers) import Data.Foldable (fold) import Data.Function (on) import Data.Functor (($>)) -import Data.Functor.Identity (Identity(..)) -import Data.List (transpose, nubBy, partition, dropWhileEnd, sortOn, uncons) +import Data.Functor.Identity (Identity (..)) +import Data.List (dropWhileEnd, nubBy, partition, sortOn, transpose, uncons) +import Data.List.NonEmpty (NonEmpty ((:|))) import Data.List.NonEmpty qualified as NEL -import Data.List.NonEmpty (NonEmpty((:|))) -import Data.Maybe (maybeToList, fromMaybe, isJust, mapMaybe) import Data.Map qualified as M -import Data.Ord (Down(..)) +import Data.Maybe (fromMaybe, isJust, mapMaybe, maybeToList) +import Data.Ord (Down (..)) import Data.Set qualified as S -import Data.Text qualified as T import Data.Text (Text) +import Data.Text qualified as T import Data.Traversable (for) import GHC.Stack qualified import Language.PureScript.AST import Language.PureScript.Bundle qualified as Bundle +import Language.PureScript.CST.Errors qualified as CST +import Language.PureScript.CST.Print qualified as CST import Language.PureScript.Constants.Libs qualified as C import Language.PureScript.Constants.Prim qualified as C import Language.PureScript.Crash (internalError) -import Language.PureScript.CST.Errors qualified as CST -import Language.PureScript.CST.Print qualified as CST -import Language.PureScript.Label (Label(..)) +import Language.PureScript.Label (Label (..)) import Language.PureScript.Names +import Language.PureScript.PSString (decodeStringWithReplacement) import Language.PureScript.Pretty (prettyPrintBinderAtom, prettyPrintLabel, prettyPrintObjectKey, prettyPrintSuggestedType, prettyPrintValue, typeAsBox, typeAtomAsBox, typeDiffAsBox) import Language.PureScript.Pretty.Common (endWith) -import Language.PureScript.PSString (decodeStringWithReplacement) +import Language.PureScript.Publish.BoxesHelpers qualified as BoxHelpers import Language.PureScript.Roles (Role, displayRole) import Language.PureScript.Traversals (sndM) -import Language.PureScript.Types (Constraint(..), ConstraintData(..), RowListItem(..), SourceConstraint, SourceType, Type(..), eraseForAllKindAnnotations, eraseKindApps, everywhereOnTypesTopDownM, getAnnForType, isMonoType, overConstraintArgs, rowFromList, rowToList, srcTUnknown) -import Language.PureScript.Publish.BoxesHelpers qualified as BoxHelpers +import Language.PureScript.Types (Constraint (..), ConstraintData (..), RowListItem (..), SourceConstraint, SourceType, Type (..), eraseKindApps, everywhereOnTypesTopDownM, getAnnForType, isMonoType, overConstraintArgs, rowFromList, rowToList, srcTUnknown) +import Language.Purus.Pretty.Types (prettyTypeStr) import System.Console.ANSI qualified as ANSI import System.FilePath (makeRelative) import Text.PrettyPrint.Boxes qualified as Box @@ -70,7 +71,8 @@ data SimpleErrorMessage | DeprecatedFFICommonJSModule ModuleName FilePath | UnsupportedFFICommonJSExports ModuleName [Text] | UnsupportedFFICommonJSImports ModuleName [Text] - | FileIOError Text IOError -- ^ A description of what we were trying to do, and the error which occurred + | -- | A description of what we were trying to do, and the error which occurred + FileIOError Text IOError | InfiniteType SourceType | InfiniteKind SourceType | MultipleValueOpFixities (OpName 'ValueOpName) @@ -109,9 +111,12 @@ data SimpleErrorMessage | ConstrainedTypeUnified SourceType SourceType | OverlappingInstances (Qualified (ProperName 'ClassName)) [SourceType] [Qualified (Either SourceType Ident)] | NoInstanceFound - SourceConstraint -- ^ constraint that could not be solved - [Qualified (Either SourceType Ident)] -- ^ a list of instances that stopped further progress in instance chains due to ambiguity - UnknownsHint -- ^ whether eliminating unknowns with annotations might help or if visible type applications are required + -- | constraint that could not be solved + SourceConstraint + -- | a list of instances that stopped further progress in instance chains due to ambiguity + [Qualified (Either SourceType Ident)] + -- | whether eliminating unknowns with annotations might help or if visible type applications are required + UnknownsHint | AmbiguousTypeVariables SourceType [(Text, Int)] | UnknownClass (Qualified (ProperName 'ClassName)) | PossiblyInfiniteInstance (Qualified (ProperName 'ClassName)) [SourceType] @@ -130,8 +135,8 @@ data SimpleErrorMessage | MissingClassMember (NEL.NonEmpty (Ident, SourceType)) | ExtraneousClassMember Ident (Qualified (ProperName 'ClassName)) | ExpectedType SourceType SourceType - -- | constructor name, expected argument count, actual argument count - | IncorrectConstructorArity (Qualified (ProperName 'ConstructorName)) Int Int + | -- | constructor name, expected argument count, actual argument count + IncorrectConstructorArity (Qualified (ProperName 'ConstructorName)) Int Int | ExprDoesNotHaveType Expr SourceType | PropertyIsMissing Label | AdditionalProperty Label @@ -173,10 +178,10 @@ data SimpleErrorMessage | CannotDeriveNewtypeForData (ProperName 'TypeName) | ExpectedWildcard (ProperName 'TypeName) | CannotUseBindWithDo Ident - -- | instance name, type class, expected argument count, actual argument count - | ClassInstanceArityMismatch Ident (Qualified (ProperName 'ClassName)) Int Int - -- | a user-defined warning raised by using the Warn type class - | UserDefinedWarning SourceType + | -- | instance name, type class, expected argument count, actual argument count + ClassInstanceArityMismatch Ident (Qualified (ProperName 'ClassName)) Int Int + | -- | a user-defined warning raised by using the Warn type class + UserDefinedWarning SourceType | CannotDefinePrimModules ModuleName | MixedAssociativityError (NEL.NonEmpty (Qualified (OpName 'AnyOpName), Associativity)) | NonAssociativeError (NEL.NonEmpty (Qualified (OpName 'AnyOpName))) @@ -184,11 +189,14 @@ data SimpleErrorMessage | QuantificationCheckFailureInType [Int] SourceType | VisibleQuantificationCheckFailureInType Text | UnsupportedTypeInKind SourceType - -- | Declared role was more permissive than inferred. - | RoleMismatch - Text -- ^ Type variable in question - Role -- ^ inferred role - Role -- ^ declared role + | -- | Declared role was more permissive than inferred. + RoleMismatch + -- | Type variable in question + Text + -- | inferred role + Role + -- | declared role + Role | InvalidCoercibleInstanceDeclaration [SourceType] | UnsupportedRoleDeclaration | RoleDeclarationArityMismatch (ProperName 'TypeName) Int Int @@ -198,9 +206,10 @@ data SimpleErrorMessage | CannotApplyExpressionOfTypeOnType SourceType SourceType deriving (Show) -data ErrorMessage = ErrorMessage - [ErrorMessageHint] - SimpleErrorMessage +data ErrorMessage + = ErrorMessage + [ErrorMessageHint] + SimpleErrorMessage deriving (Show) newtype ErrorSuggestion = ErrorSuggestion Text @@ -209,17 +218,17 @@ newtype ErrorSuggestion = ErrorSuggestion Text errorSpan :: ErrorMessage -> Maybe (NEL.NonEmpty SourceSpan) errorSpan = findHint matchPE <> findHint matchRP where - matchPE (PositionedError sss) = Just sss - matchPE _ = Nothing - matchRP (RelatedPositions sss) = Just sss - matchRP _ = Nothing + matchPE (PositionedError sss) = Just sss + matchPE _ = Nothing + matchRP (RelatedPositions sss) = Just sss + matchRP _ = Nothing -- | Get the module name for an error errorModule :: ErrorMessage -> Maybe ModuleName errorModule = findHint matchModule where - matchModule (ErrorInModule mn) = Just mn - matchModule _ = Nothing + matchModule (ErrorInModule mn) = Just mn + matchModule _ = Nothing findHint :: (ErrorMessageHint -> Maybe a) -> ErrorMessage -> Maybe a findHint f (ErrorMessage hints _) = getLast . foldMap (Last . f) $ hints @@ -228,131 +237,131 @@ findHint f (ErrorMessage hints _) = getLast . foldMap (Last . f) $ hints stripModuleAndSpan :: ErrorMessage -> ErrorMessage stripModuleAndSpan (ErrorMessage hints e) = ErrorMessage (filter (not . shouldStrip) hints) e where - shouldStrip (ErrorInModule _) = True - shouldStrip (PositionedError _) = True - shouldStrip _ = False + shouldStrip (ErrorInModule _) = True + shouldStrip (PositionedError _) = True + shouldStrip _ = False -- | Get the error code for a particular error type errorCode :: ErrorMessage -> Text errorCode em = case unwrapErrorMessage em of - InternalCompilerError{} -> "InternalCompilerError" - ModuleNotFound{} -> "ModuleNotFound" - ErrorParsingFFIModule{} -> "ErrorParsingFFIModule" - ErrorParsingCSTModule{} -> "ErrorParsingModule" - WarningParsingCSTModule{} -> "WarningParsingModule" - MissingFFIModule{} -> "MissingFFIModule" - UnnecessaryFFIModule{} -> "UnnecessaryFFIModule" - MissingFFIImplementations{} -> "MissingFFIImplementations" - UnusedFFIImplementations{} -> "UnusedFFIImplementations" - InvalidFFIIdentifier{} -> "InvalidFFIIdentifier" - DeprecatedFFIPrime{} -> "DeprecatedFFIPrime" + InternalCompilerError {} -> "InternalCompilerError" + ModuleNotFound {} -> "ModuleNotFound" + ErrorParsingFFIModule {} -> "ErrorParsingFFIModule" + ErrorParsingCSTModule {} -> "ErrorParsingModule" + WarningParsingCSTModule {} -> "WarningParsingModule" + MissingFFIModule {} -> "MissingFFIModule" + UnnecessaryFFIModule {} -> "UnnecessaryFFIModule" + MissingFFIImplementations {} -> "MissingFFIImplementations" + UnusedFFIImplementations {} -> "UnusedFFIImplementations" + InvalidFFIIdentifier {} -> "InvalidFFIIdentifier" + DeprecatedFFIPrime {} -> "DeprecatedFFIPrime" DeprecatedFFICommonJSModule {} -> "DeprecatedFFICommonJSModule" UnsupportedFFICommonJSExports {} -> "UnsupportedFFICommonJSExports" UnsupportedFFICommonJSImports {} -> "UnsupportedFFICommonJSImports" - FileIOError{} -> "FileIOError" - InfiniteType{} -> "InfiniteType" - InfiniteKind{} -> "InfiniteKind" - MultipleValueOpFixities{} -> "MultipleValueOpFixities" - MultipleTypeOpFixities{} -> "MultipleTypeOpFixities" - OrphanTypeDeclaration{} -> "OrphanTypeDeclaration" - OrphanKindDeclaration{} -> "OrphanKindDeclaration" - OrphanRoleDeclaration{} -> "OrphanRoleDeclaration" - RedefinedIdent{} -> "RedefinedIdent" - OverlappingNamesInLet{} -> "OverlappingNamesInLet" - UnknownName{} -> "UnknownName" - UnknownImport{} -> "UnknownImport" - UnknownImportDataConstructor{} -> "UnknownImportDataConstructor" - UnknownExport{} -> "UnknownExport" - UnknownExportDataConstructor{} -> "UnknownExportDataConstructor" - ScopeConflict{} -> "ScopeConflict" - ScopeShadowing{} -> "ScopeShadowing" - DeclConflict{} -> "DeclConflict" - ExportConflict{} -> "ExportConflict" - DuplicateModule{} -> "DuplicateModule" - DuplicateTypeClass{} -> "DuplicateTypeClass" - DuplicateInstance{} -> "DuplicateInstance" - DuplicateTypeArgument{} -> "DuplicateTypeArgument" + FileIOError {} -> "FileIOError" + InfiniteType {} -> "InfiniteType" + InfiniteKind {} -> "InfiniteKind" + MultipleValueOpFixities {} -> "MultipleValueOpFixities" + MultipleTypeOpFixities {} -> "MultipleTypeOpFixities" + OrphanTypeDeclaration {} -> "OrphanTypeDeclaration" + OrphanKindDeclaration {} -> "OrphanKindDeclaration" + OrphanRoleDeclaration {} -> "OrphanRoleDeclaration" + RedefinedIdent {} -> "RedefinedIdent" + OverlappingNamesInLet {} -> "OverlappingNamesInLet" + UnknownName {} -> "UnknownName" + UnknownImport {} -> "UnknownImport" + UnknownImportDataConstructor {} -> "UnknownImportDataConstructor" + UnknownExport {} -> "UnknownExport" + UnknownExportDataConstructor {} -> "UnknownExportDataConstructor" + ScopeConflict {} -> "ScopeConflict" + ScopeShadowing {} -> "ScopeShadowing" + DeclConflict {} -> "DeclConflict" + ExportConflict {} -> "ExportConflict" + DuplicateModule {} -> "DuplicateModule" + DuplicateTypeClass {} -> "DuplicateTypeClass" + DuplicateInstance {} -> "DuplicateInstance" + DuplicateTypeArgument {} -> "DuplicateTypeArgument" InvalidDoBind -> "InvalidDoBind" InvalidDoLet -> "InvalidDoLet" - CycleInDeclaration{} -> "CycleInDeclaration" - CycleInTypeSynonym{} -> "CycleInTypeSynonym" - CycleInTypeClassDeclaration{} -> "CycleInTypeClassDeclaration" - CycleInKindDeclaration{} -> "CycleInKindDeclaration" - CycleInModules{} -> "CycleInModules" - NameIsUndefined{} -> "NameIsUndefined" - UndefinedTypeVariable{} -> "UndefinedTypeVariable" - PartiallyAppliedSynonym{} -> "PartiallyAppliedSynonym" - EscapedSkolem{} -> "EscapedSkolem" - TypesDoNotUnify{} -> "TypesDoNotUnify" - KindsDoNotUnify{} -> "KindsDoNotUnify" - ConstrainedTypeUnified{} -> "ConstrainedTypeUnified" - OverlappingInstances{} -> "OverlappingInstances" - NoInstanceFound{} -> "NoInstanceFound" - AmbiguousTypeVariables{} -> "AmbiguousTypeVariables" - UnknownClass{} -> "UnknownClass" - PossiblyInfiniteInstance{} -> "PossiblyInfiniteInstance" + CycleInDeclaration {} -> "CycleInDeclaration" + CycleInTypeSynonym {} -> "CycleInTypeSynonym" + CycleInTypeClassDeclaration {} -> "CycleInTypeClassDeclaration" + CycleInKindDeclaration {} -> "CycleInKindDeclaration" + CycleInModules {} -> "CycleInModules" + NameIsUndefined {} -> "NameIsUndefined" + UndefinedTypeVariable {} -> "UndefinedTypeVariable" + PartiallyAppliedSynonym {} -> "PartiallyAppliedSynonym" + EscapedSkolem {} -> "EscapedSkolem" + TypesDoNotUnify {} -> "TypesDoNotUnify" + KindsDoNotUnify {} -> "KindsDoNotUnify" + ConstrainedTypeUnified {} -> "ConstrainedTypeUnified" + OverlappingInstances {} -> "OverlappingInstances" + NoInstanceFound {} -> "NoInstanceFound" + AmbiguousTypeVariables {} -> "AmbiguousTypeVariables" + UnknownClass {} -> "UnknownClass" + PossiblyInfiniteInstance {} -> "PossiblyInfiniteInstance" PossiblyInfiniteCoercibleInstance -> "PossiblyInfiniteCoercibleInstance" - CannotDerive{} -> "CannotDerive" - InvalidNewtypeInstance{} -> "InvalidNewtypeInstance" - MissingNewtypeSuperclassInstance{} -> "MissingNewtypeSuperclassInstance" - UnverifiableSuperclassInstance{} -> "UnverifiableSuperclassInstance" - InvalidDerivedInstance{} -> "InvalidDerivedInstance" - ExpectedTypeConstructor{} -> "ExpectedTypeConstructor" - CannotFindDerivingType{} -> "CannotFindDerivingType" - DuplicateLabel{} -> "DuplicateLabel" - DuplicateValueDeclaration{} -> "DuplicateValueDeclaration" - ArgListLengthsDiffer{} -> "ArgListLengthsDiffer" - OverlappingArgNames{} -> "OverlappingArgNames" - MissingClassMember{} -> "MissingClassMember" - ExtraneousClassMember{} -> "ExtraneousClassMember" - ExpectedType{} -> "ExpectedType" - IncorrectConstructorArity{} -> "IncorrectConstructorArity" - ExprDoesNotHaveType{} -> "ExprDoesNotHaveType" - PropertyIsMissing{} -> "PropertyIsMissing" - AdditionalProperty{} -> "AdditionalProperty" - OrphanInstance{} -> "OrphanInstance" - InvalidNewtype{} -> "InvalidNewtype" - InvalidInstanceHead{} -> "InvalidInstanceHead" - TransitiveExportError{} -> "TransitiveExportError" - TransitiveDctorExportError{} -> "TransitiveDctorExportError" - HiddenConstructors{} -> "HiddenConstructors" - ShadowedName{} -> "ShadowedName" - UnusedName{} -> "UnusedName" - UnusedDeclaration{} -> "UnusedDeclaration" - ShadowedTypeVar{} -> "ShadowedTypeVar" - UnusedTypeVar{} -> "UnusedTypeVar" - WildcardInferredType{} -> "WildcardInferredType" - HoleInferredType{} -> "HoleInferredType" - MissingTypeDeclaration{} -> "MissingTypeDeclaration" - MissingKindDeclaration{} -> "MissingKindDeclaration" - OverlappingPattern{} -> "OverlappingPattern" - IncompleteExhaustivityCheck{} -> "IncompleteExhaustivityCheck" - ImportHidingModule{} -> "ImportHidingModule" - UnusedImport{} -> "UnusedImport" - UnusedExplicitImport{} -> "UnusedExplicitImport" - UnusedDctorImport{} -> "UnusedDctorImport" - UnusedDctorExplicitImport{} -> "UnusedDctorExplicitImport" - DuplicateSelectiveImport{} -> "DuplicateSelectiveImport" - DuplicateImport{} -> "DuplicateImport" - DuplicateImportRef{} -> "DuplicateImportRef" - DuplicateExportRef{} -> "DuplicateExportRef" - IntOutOfRange{} -> "IntOutOfRange" - ImplicitQualifiedImport{} -> "ImplicitQualifiedImport" - ImplicitQualifiedImportReExport{} -> "ImplicitQualifiedImportReExport" - ImplicitImport{} -> "ImplicitImport" - HidingImport{} -> "HidingImport" - CaseBinderLengthDiffers{} -> "CaseBinderLengthDiffers" + CannotDerive {} -> "CannotDerive" + InvalidNewtypeInstance {} -> "InvalidNewtypeInstance" + MissingNewtypeSuperclassInstance {} -> "MissingNewtypeSuperclassInstance" + UnverifiableSuperclassInstance {} -> "UnverifiableSuperclassInstance" + InvalidDerivedInstance {} -> "InvalidDerivedInstance" + ExpectedTypeConstructor {} -> "ExpectedTypeConstructor" + CannotFindDerivingType {} -> "CannotFindDerivingType" + DuplicateLabel {} -> "DuplicateLabel" + DuplicateValueDeclaration {} -> "DuplicateValueDeclaration" + ArgListLengthsDiffer {} -> "ArgListLengthsDiffer" + OverlappingArgNames {} -> "OverlappingArgNames" + MissingClassMember {} -> "MissingClassMember" + ExtraneousClassMember {} -> "ExtraneousClassMember" + ExpectedType {} -> "ExpectedType" + IncorrectConstructorArity {} -> "IncorrectConstructorArity" + ExprDoesNotHaveType {} -> "ExprDoesNotHaveType" + PropertyIsMissing {} -> "PropertyIsMissing" + AdditionalProperty {} -> "AdditionalProperty" + OrphanInstance {} -> "OrphanInstance" + InvalidNewtype {} -> "InvalidNewtype" + InvalidInstanceHead {} -> "InvalidInstanceHead" + TransitiveExportError {} -> "TransitiveExportError" + TransitiveDctorExportError {} -> "TransitiveDctorExportError" + HiddenConstructors {} -> "HiddenConstructors" + ShadowedName {} -> "ShadowedName" + UnusedName {} -> "UnusedName" + UnusedDeclaration {} -> "UnusedDeclaration" + ShadowedTypeVar {} -> "ShadowedTypeVar" + UnusedTypeVar {} -> "UnusedTypeVar" + WildcardInferredType {} -> "WildcardInferredType" + HoleInferredType {} -> "HoleInferredType" + MissingTypeDeclaration {} -> "MissingTypeDeclaration" + MissingKindDeclaration {} -> "MissingKindDeclaration" + OverlappingPattern {} -> "OverlappingPattern" + IncompleteExhaustivityCheck {} -> "IncompleteExhaustivityCheck" + ImportHidingModule {} -> "ImportHidingModule" + UnusedImport {} -> "UnusedImport" + UnusedExplicitImport {} -> "UnusedExplicitImport" + UnusedDctorImport {} -> "UnusedDctorImport" + UnusedDctorExplicitImport {} -> "UnusedDctorExplicitImport" + DuplicateSelectiveImport {} -> "DuplicateSelectiveImport" + DuplicateImport {} -> "DuplicateImport" + DuplicateImportRef {} -> "DuplicateImportRef" + DuplicateExportRef {} -> "DuplicateExportRef" + IntOutOfRange {} -> "IntOutOfRange" + ImplicitQualifiedImport {} -> "ImplicitQualifiedImport" + ImplicitQualifiedImportReExport {} -> "ImplicitQualifiedImportReExport" + ImplicitImport {} -> "ImplicitImport" + HidingImport {} -> "HidingImport" + CaseBinderLengthDiffers {} -> "CaseBinderLengthDiffers" IncorrectAnonymousArgument -> "IncorrectAnonymousArgument" - InvalidOperatorInBinder{} -> "InvalidOperatorInBinder" - CannotGeneralizeRecursiveFunction{} -> "CannotGeneralizeRecursiveFunction" - CannotDeriveNewtypeForData{} -> "CannotDeriveNewtypeForData" - ExpectedWildcard{} -> "ExpectedWildcard" - CannotUseBindWithDo{} -> "CannotUseBindWithDo" - ClassInstanceArityMismatch{} -> "ClassInstanceArityMismatch" - UserDefinedWarning{} -> "UserDefinedWarning" - CannotDefinePrimModules{} -> "CannotDefinePrimModules" - MixedAssociativityError{} -> "MixedAssociativityError" - NonAssociativeError{} -> "NonAssociativeError" + InvalidOperatorInBinder {} -> "InvalidOperatorInBinder" + CannotGeneralizeRecursiveFunction {} -> "CannotGeneralizeRecursiveFunction" + CannotDeriveNewtypeForData {} -> "CannotDeriveNewtypeForData" + ExpectedWildcard {} -> "ExpectedWildcard" + CannotUseBindWithDo {} -> "CannotUseBindWithDo" + ClassInstanceArityMismatch {} -> "ClassInstanceArityMismatch" + UserDefinedWarning {} -> "UserDefinedWarning" + CannotDefinePrimModules {} -> "CannotDefinePrimModules" + MixedAssociativityError {} -> "MixedAssociativityError" + NonAssociativeError {} -> "NonAssociativeError" QuantificationCheckFailureInKind {} -> "QuantificationCheckFailureInKind" QuantificationCheckFailureInType {} -> "QuantificationCheckFailureInType" VisibleQuantificationCheckFailureInType {} -> "VisibleQuantificationCheckFailureInType" @@ -362,14 +371,15 @@ errorCode em = case unwrapErrorMessage em of UnsupportedRoleDeclaration {} -> "UnsupportedRoleDeclaration" RoleDeclarationArityMismatch {} -> "RoleDeclarationArityMismatch" DuplicateRoleDeclaration {} -> "DuplicateRoleDeclaration" - CannotDeriveInvalidConstructorArg{} -> "CannotDeriveInvalidConstructorArg" - CannotSkipTypeApplication{} -> "CannotSkipTypeApplication" - CannotApplyExpressionOfTypeOnType{} -> "CannotApplyExpressionOfTypeOnType" + CannotDeriveInvalidConstructorArg {} -> "CannotDeriveInvalidConstructorArg" + CannotSkipTypeApplication {} -> "CannotSkipTypeApplication" + CannotApplyExpressionOfTypeOnType {} -> "CannotApplyExpressionOfTypeOnType" -- | A stack trace for an error newtype MultipleErrors = MultipleErrors { runMultipleErrors :: [ErrorMessage] - } deriving (Show, Semigroup, Monoid) + } + deriving (Show, Semigroup, Monoid) -- | Check whether a collection of errors is empty or not. nonEmpty :: MultipleErrors -> Bool @@ -413,89 +423,91 @@ addHints hints = onErrorMessages $ \(ErrorMessage hints' se) -> ErrorMessage (hi -- | A map from rigid type variable name/unknown variable pairs to new variables. data TypeMap = TypeMap - { umSkolemMap :: M.Map Int (String, Int, Maybe SourceSpan) + { umSkolemMap :: M.Map Int (String, Int, Maybe SourceSpan) -- ^ a map from skolems to their new names, including source and naming info - , umUnknownMap :: M.Map Int Int + , umUnknownMap :: M.Map Int Int -- ^ a map from unification variables to their new names - , umNextIndex :: Int + , umNextIndex :: Int -- ^ unknowns and skolems share a source of names during renaming, to -- avoid overlaps in error messages. This is the next label for either case. - } deriving Show + } + deriving (Show) defaultUnknownMap :: TypeMap defaultUnknownMap = TypeMap M.empty M.empty 0 -- | How critical the issue is -data Level = Error | Warning deriving Show +data Level = Error | Warning deriving (Show) -- | Extract nested error messages from wrapper errors unwrapErrorMessage :: ErrorMessage -> SimpleErrorMessage unwrapErrorMessage (ErrorMessage _ se) = se replaceUnknowns :: SourceType -> State TypeMap SourceType -replaceUnknowns = everywhereOnTypesTopDownM replaceTypes where - replaceTypes :: SourceType -> State TypeMap SourceType - replaceTypes (TUnknown ann u) = do - m <- get - case M.lookup u (umUnknownMap m) of - Nothing -> do - let u' = umNextIndex m - put $ m { umUnknownMap = M.insert u u' (umUnknownMap m), umNextIndex = u' + 1 } - return (TUnknown ann u') - Just u' -> return (TUnknown ann u') - -- We intentionally remove the kinds from skolems, because they are never - -- presented when pretty-printing. Any unknowns in those kinds shouldn't - -- appear in the list of unknowns unless used somewhere else. - replaceTypes (Skolem ann name _ s sko) = do - m <- get - case M.lookup s (umSkolemMap m) of - Nothing -> do - let s' = umNextIndex m - put $ m { umSkolemMap = M.insert s (T.unpack name, s', Just (fst ann)) (umSkolemMap m), umNextIndex = s' + 1 } - return (Skolem ann name Nothing s' sko) - Just (_, s', _) -> return (Skolem ann name Nothing s' sko) - replaceTypes other = return other +replaceUnknowns = everywhereOnTypesTopDownM replaceTypes + where + replaceTypes :: SourceType -> State TypeMap SourceType + replaceTypes (TUnknown ann u) = do + m <- get + case M.lookup u (umUnknownMap m) of + Nothing -> do + let u' = umNextIndex m + put $ m {umUnknownMap = M.insert u u' (umUnknownMap m), umNextIndex = u' + 1} + return (TUnknown ann u') + Just u' -> return (TUnknown ann u') + -- We intentionally remove the kinds from skolems, because they are never + -- presented when pretty-printing. Any unknowns in those kinds shouldn't + -- appear in the list of unknowns unless used somewhere else. + replaceTypes (Skolem ann name k s sko) = do + m <- get + case M.lookup s (umSkolemMap m) of + Nothing -> do + let s' = umNextIndex m + put $ m {umSkolemMap = M.insert s (T.unpack name, s', Just (fst ann)) (umSkolemMap m), umNextIndex = s' + 1} + return (Skolem ann name k s' sko) + Just (_, s', _) -> return (Skolem ann name k s' sko) + replaceTypes other = return other onTypesInErrorMessage :: (SourceType -> SourceType) -> ErrorMessage -> ErrorMessage onTypesInErrorMessage f = runIdentity . onTypesInErrorMessageM (Identity . f) -onTypesInErrorMessageM :: Applicative m => (SourceType -> m SourceType) -> ErrorMessage -> m ErrorMessage +onTypesInErrorMessageM :: (Applicative m) => (SourceType -> m SourceType) -> ErrorMessage -> m ErrorMessage onTypesInErrorMessageM f (ErrorMessage hints simple) = ErrorMessage <$> traverse gHint hints <*> gSimple simple where - gSimple (InfiniteType t) = InfiniteType <$> f t - gSimple (TypesDoNotUnify t1 t2) = TypesDoNotUnify <$> f t1 <*> f t2 - gSimple (ConstrainedTypeUnified t1 t2) = ConstrainedTypeUnified <$> f t1 <*> f t2 - gSimple (ExprDoesNotHaveType e t) = ExprDoesNotHaveType e <$> f t - gSimple (InvalidInstanceHead t) = InvalidInstanceHead <$> f t - gSimple (NoInstanceFound con ambig unks) = NoInstanceFound <$> overConstraintArgs (traverse f) con <*> pure ambig <*> pure unks - gSimple (AmbiguousTypeVariables t uis) = AmbiguousTypeVariables <$> f t <*> pure uis - gSimple (OverlappingInstances cl ts insts) = OverlappingInstances cl <$> traverse f ts <*> traverse (traverse $ bitraverse f pure) insts - gSimple (PossiblyInfiniteInstance cl ts) = PossiblyInfiniteInstance cl <$> traverse f ts - gSimple (CannotDerive cl ts) = CannotDerive cl <$> traverse f ts - gSimple (InvalidNewtypeInstance cl ts) = InvalidNewtypeInstance cl <$> traverse f ts - gSimple (MissingNewtypeSuperclassInstance cl1 cl2 ts) = MissingNewtypeSuperclassInstance cl1 cl2 <$> traverse f ts - gSimple (UnverifiableSuperclassInstance cl1 cl2 ts) = UnverifiableSuperclassInstance cl1 cl2 <$> traverse f ts - gSimple (InvalidDerivedInstance cl ts n) = InvalidDerivedInstance cl <$> traverse f ts <*> pure n - gSimple (ExpectedTypeConstructor cl ts ty) = ExpectedTypeConstructor cl <$> traverse f ts <*> f ty - gSimple (ExpectedType ty k) = ExpectedType <$> f ty <*> pure k - gSimple (OrphanInstance nm cl noms ts) = OrphanInstance nm cl noms <$> traverse f ts - gSimple (WildcardInferredType ty ctx) = WildcardInferredType <$> f ty <*> traverse (sndM f) ctx - gSimple (HoleInferredType name ty ctx env) = HoleInferredType name <$> f ty <*> traverse (sndM f) ctx <*> traverse (onTypeSearchTypesM f) env - gSimple (MissingTypeDeclaration nm ty) = MissingTypeDeclaration nm <$> f ty - gSimple (MissingKindDeclaration sig nm ty) = MissingKindDeclaration sig nm <$> f ty - gSimple (CannotGeneralizeRecursiveFunction nm ty) = CannotGeneralizeRecursiveFunction nm <$> f ty - gSimple (InvalidCoercibleInstanceDeclaration tys) = InvalidCoercibleInstanceDeclaration <$> traverse f tys - gSimple other = pure other - - gHint (ErrorInSubsumption t1 t2) = ErrorInSubsumption <$> f t1 <*> f t2 - gHint (ErrorUnifyingTypes t1 t2) = ErrorUnifyingTypes <$> f t1 <*> f t2 - gHint (ErrorCheckingType e t) = ErrorCheckingType e <$> f t - gHint (ErrorCheckingKind t k) = ErrorCheckingKind <$> f t <*> f k - gHint (ErrorInferringKind t) = ErrorInferringKind <$> f t - gHint (ErrorInApplication e1 t1 e2) = ErrorInApplication e1 <$> f t1 <*> pure e2 - gHint (ErrorInInstance cl ts) = ErrorInInstance cl <$> traverse f ts - gHint (ErrorSolvingConstraint con) = ErrorSolvingConstraint <$> overConstraintArgs (traverse f) con - gHint other = pure other + gSimple (InfiniteType t) = InfiniteType <$> f t + gSimple (TypesDoNotUnify t1 t2) = TypesDoNotUnify <$> f t1 <*> f t2 + gSimple (ConstrainedTypeUnified t1 t2) = ConstrainedTypeUnified <$> f t1 <*> f t2 + gSimple (ExprDoesNotHaveType e t) = ExprDoesNotHaveType e <$> f t + gSimple (InvalidInstanceHead t) = InvalidInstanceHead <$> f t + gSimple (NoInstanceFound con ambig unks) = NoInstanceFound <$> overConstraintArgs (traverse f) con <*> pure ambig <*> pure unks + gSimple (AmbiguousTypeVariables t uis) = AmbiguousTypeVariables <$> f t <*> pure uis + gSimple (OverlappingInstances cl ts insts) = OverlappingInstances cl <$> traverse f ts <*> traverse (traverse $ bitraverse f pure) insts + gSimple (PossiblyInfiniteInstance cl ts) = PossiblyInfiniteInstance cl <$> traverse f ts + gSimple (CannotDerive cl ts) = CannotDerive cl <$> traverse f ts + gSimple (InvalidNewtypeInstance cl ts) = InvalidNewtypeInstance cl <$> traverse f ts + gSimple (MissingNewtypeSuperclassInstance cl1 cl2 ts) = MissingNewtypeSuperclassInstance cl1 cl2 <$> traverse f ts + gSimple (UnverifiableSuperclassInstance cl1 cl2 ts) = UnverifiableSuperclassInstance cl1 cl2 <$> traverse f ts + gSimple (InvalidDerivedInstance cl ts n) = InvalidDerivedInstance cl <$> traverse f ts <*> pure n + gSimple (ExpectedTypeConstructor cl ts ty) = ExpectedTypeConstructor cl <$> traverse f ts <*> f ty + gSimple (ExpectedType ty k) = ExpectedType <$> f ty <*> pure k + gSimple (OrphanInstance nm cl noms ts) = OrphanInstance nm cl noms <$> traverse f ts + gSimple (WildcardInferredType ty ctx) = WildcardInferredType <$> f ty <*> traverse (sndM f) ctx + gSimple (HoleInferredType name ty ctx env) = HoleInferredType name <$> f ty <*> traverse (sndM f) ctx <*> traverse (onTypeSearchTypesM f) env + gSimple (MissingTypeDeclaration nm ty) = MissingTypeDeclaration nm <$> f ty + gSimple (MissingKindDeclaration sig nm ty) = MissingKindDeclaration sig nm <$> f ty + gSimple (CannotGeneralizeRecursiveFunction nm ty) = CannotGeneralizeRecursiveFunction nm <$> f ty + gSimple (InvalidCoercibleInstanceDeclaration tys) = InvalidCoercibleInstanceDeclaration <$> traverse f tys + gSimple other = pure other + + gHint (ErrorInSubsumption t1 t2) = ErrorInSubsumption <$> f t1 <*> f t2 + gHint (ErrorUnifyingTypes t1 t2) = ErrorUnifyingTypes <$> f t1 <*> f t2 + gHint (ErrorCheckingType e t) = ErrorCheckingType e <$> f t + gHint (ErrorCheckingKind t k) = ErrorCheckingKind <$> f t <*> f k + gHint (ErrorInferringKind t) = ErrorInferringKind <$> f t + gHint (ErrorInApplication e1 t1 e2) = ErrorInApplication e1 <$> f t1 <*> pure e2 + gHint (ErrorInInstance cl ts) = ErrorInInstance cl <$> traverse f ts + gHint (ErrorSolvingConstraint con) = ErrorSolvingConstraint <$> overConstraintArgs (traverse f) con + gHint other = pure other errorDocUri :: ErrorMessage -> Text errorDocUri e = "https://github.com/purescript/documentation/blob/master/errors/" <> errorCode e <> ".md" @@ -505,37 +517,38 @@ errorDocUri e = "https://github.com/purescript/documentation/blob/master/errors/ -- DuplicateSelectiveImport - would require 2 ranges to remove and 1 insert errorSuggestion :: SimpleErrorMessage -> Maybe ErrorSuggestion errorSuggestion err = - case err of - UnusedImport{} -> emptySuggestion - DuplicateImport{} -> emptySuggestion - UnusedExplicitImport mn _ qual refs -> suggest $ importSuggestion mn refs qual - UnusedDctorImport mn _ qual refs -> suggest $ importSuggestion mn refs qual - UnusedDctorExplicitImport mn _ _ qual refs -> suggest $ importSuggestion mn refs qual - ImplicitImport mn refs -> suggest $ importSuggestion mn refs Nothing - ImplicitQualifiedImport mn asModule refs -> suggest $ importSuggestion mn refs (Just asModule) - ImplicitQualifiedImportReExport mn asModule refs -> suggest $ importSuggestion mn refs (Just asModule) - HidingImport mn refs -> suggest $ importSuggestion mn refs Nothing - MissingTypeDeclaration ident ty -> suggest $ showIdent ident <> " :: " <> T.pack (prettyPrintSuggestedTypeSimplified ty) <> "\n" - MissingKindDeclaration sig name ty -> suggest $ prettyPrintKindSignatureFor sig <> " " <> runProperName name <> " :: " <> T.pack (prettyPrintSuggestedTypeSimplified ty) <> "\n" - WildcardInferredType ty _ -> suggest $ T.pack (prettyPrintSuggestedTypeSimplified ty) - WarningParsingCSTModule pe -> do - let toks = CST.errToks pe - case CST.errType pe of - CST.WarnDeprecatedRowSyntax -> do - let kind = CST.printTokens $ drop 1 toks - sugg | " " `T.isPrefixOf` kind = "Row" <> kind - | otherwise = "Row " <> kind - suggest sugg - CST.WarnDeprecatedForeignKindSyntax -> suggest $ "data " <> CST.printTokens (drop 3 toks) - CST.WarnDeprecatedKindImportSyntax -> suggest $ CST.printTokens $ drop 1 toks - CST.WarnDeprecatedKindExportSyntax -> suggest $ CST.printTokens $ drop 1 toks - CST.WarnDeprecatedCaseOfOffsideSyntax -> Nothing - _ -> Nothing + case err of + UnusedImport {} -> emptySuggestion + DuplicateImport {} -> emptySuggestion + UnusedExplicitImport mn _ qual refs -> suggest $ importSuggestion mn refs qual + UnusedDctorImport mn _ qual refs -> suggest $ importSuggestion mn refs qual + UnusedDctorExplicitImport mn _ _ qual refs -> suggest $ importSuggestion mn refs qual + ImplicitImport mn refs -> suggest $ importSuggestion mn refs Nothing + ImplicitQualifiedImport mn asModule refs -> suggest $ importSuggestion mn refs (Just asModule) + ImplicitQualifiedImportReExport mn asModule refs -> suggest $ importSuggestion mn refs (Just asModule) + HidingImport mn refs -> suggest $ importSuggestion mn refs Nothing + MissingTypeDeclaration ident ty -> suggest $ showIdent ident <> " :: " <> T.pack (prettyPrintSuggestedTypeSimplified ty) <> "\n" + MissingKindDeclaration sig name ty -> suggest $ prettyPrintKindSignatureFor sig <> " " <> runProperName name <> " :: " <> T.pack (prettyPrintSuggestedTypeSimplified ty) <> "\n" + WildcardInferredType ty _ -> suggest $ T.pack (prettyPrintSuggestedTypeSimplified ty) + WarningParsingCSTModule pe -> do + let toks = CST.errToks pe + case CST.errType pe of + CST.WarnDeprecatedRowSyntax -> do + let kind = CST.printTokens $ drop 1 toks + sugg + | " " `T.isPrefixOf` kind = "Row" <> kind + | otherwise = "Row " <> kind + suggest sugg + CST.WarnDeprecatedForeignKindSyntax -> suggest $ "data " <> CST.printTokens (drop 3 toks) + CST.WarnDeprecatedKindImportSyntax -> suggest $ CST.printTokens $ drop 1 toks + CST.WarnDeprecatedKindExportSyntax -> suggest $ CST.printTokens $ drop 1 toks + CST.WarnDeprecatedCaseOfOffsideSyntax -> Nothing + _ -> Nothing where emptySuggestion = Just $ ErrorSuggestion "" suggest = Just . ErrorSuggestion - importSuggestion :: ModuleName -> [ DeclarationRef ] -> Maybe ModuleName -> Text + importSuggestion :: ModuleName -> [DeclarationRef] -> Maybe ModuleName -> Text importSuggestion mn refs qual = "import " <> runModuleName mn <> " (" <> T.intercalate ", " (mapMaybe prettyPrintRef refs) <> ")" <> qstr qual @@ -550,12 +563,12 @@ suggestionSpan e = -- spans. -garyb getSpan (unwrapErrorMessage e) . NEL.head <$> errorSpan e where - startOnly SourceSpan{spanName, spanStart} = SourceSpan {spanName, spanStart, spanEnd = spanStart} + startOnly SourceSpan {spanName, spanStart} = SourceSpan {spanName, spanStart, spanEnd = spanStart} getSpan simple ss = case simple of - MissingTypeDeclaration{} -> startOnly ss - MissingKindDeclaration{} -> startOnly ss + MissingTypeDeclaration {} -> startOnly ss + MissingKindDeclaration {} -> startOnly ss _ -> ss showSuggestion :: SimpleErrorMessage -> Text @@ -565,11 +578,11 @@ showSuggestion suggestion = case errorSuggestion suggestion of ansiColor :: (ANSI.ColorIntensity, ANSI.Color) -> String ansiColor (intensity, color) = - ANSI.setSGRCode [ANSI.SetColor ANSI.Foreground intensity color] + ANSI.setSGRCode [ANSI.SetColor ANSI.Foreground intensity color] ansiColorReset :: String ansiColorReset = - ANSI.setSGRCode [ANSI.Reset] + ANSI.setSGRCode [ANSI.Reset] colorCode :: Maybe (ANSI.ColorIntensity, ANSI.Color) -> Text -> Text colorCode codeColor code = case codeColor of @@ -582,12 +595,13 @@ colorCodeBox codeColor b = case codeColor of Just cc | Box.rows b == 1 -> Box.text (ansiColor cc) Box.<> b `endWith` Box.text ansiColorReset - - | otherwise -> Box.hcat Box.left -- making two boxes, one for each side of the box so that it will set each row it's own color and will reset it afterwards - [ Box.vcat Box.top $ replicate (Box.rows b) $ Box.text $ ansiColor cc - , b - , Box.vcat Box.top $ replicate (Box.rows b) $ Box.text ansiColorReset - ] + | otherwise -> + Box.hcat + Box.left -- making two boxes, one for each side of the box so that it will set each row it's own color and will reset it afterwards + [ Box.vcat Box.top $ replicate (Box.rows b) $ Box.text $ ansiColor cc + , b + , Box.vcat Box.top $ replicate (Box.rows b) $ Box.text ansiColorReset + ] commasAndConjunction :: Text -> [Text] -> Text commasAndConjunction conj = \case @@ -602,24 +616,31 @@ defaultCodeColor = (ANSI.Dull, ANSI.Yellow) -- | `prettyPrintSingleError` Options data PPEOptions = PPEOptions - { ppeCodeColor :: Maybe (ANSI.ColorIntensity, ANSI.Color) -- ^ Color code with this color... or not - , ppeFull :: Bool -- ^ Should write a full error message? - , ppeLevel :: Level -- ^ Should this report an error or a warning? - , ppeShowDocs :: Bool -- ^ Should show a link to error message's doc page? - , ppeRelativeDirectory :: FilePath -- ^ FilePath to which the errors are relative - , ppeFileContents :: [(FilePath, Text)] -- ^ Unparsed contents of source files + { ppeCodeColor :: Maybe (ANSI.ColorIntensity, ANSI.Color) + -- ^ Color code with this color... or not + , ppeFull :: Bool + -- ^ Should write a full error message? + , ppeLevel :: Level + -- ^ Should this report an error or a warning? + , ppeShowDocs :: Bool + -- ^ Should show a link to error message's doc page? + , ppeRelativeDirectory :: FilePath + -- ^ FilePath to which the errors are relative + , ppeFileContents :: [(FilePath, Text)] + -- ^ Unparsed contents of source files } -- | Default options for PPEOptions defaultPPEOptions :: PPEOptions -defaultPPEOptions = PPEOptions - { ppeCodeColor = Just defaultCodeColor - , ppeFull = False - , ppeLevel = Error - , ppeShowDocs = True - , ppeRelativeDirectory = mempty - , ppeFileContents = [] - } +defaultPPEOptions = + PPEOptions + { ppeCodeColor = Just defaultCodeColor + , ppeFull = False + , ppeLevel = Error + , ppeShowDocs = True + , ppeRelativeDirectory = mempty + , ppeFileContents = [] + } -- | Pretty print a single error, simplifying if necessary prettyPrintSingleError :: PPEOptions -> ErrorMessage -> Box.Box @@ -628,1263 +649,1537 @@ prettyPrintSingleError (PPEOptions codeColor full level showDocs relPath fileCon um <- get return (prettyPrintErrorMessage um em) where - (markCode, markCodeBox) = (colorCode &&& colorCodeBox) codeColor - - -- Pretty print an ErrorMessage - prettyPrintErrorMessage :: TypeMap -> ErrorMessage -> Box.Box - prettyPrintErrorMessage typeMap (ErrorMessage hints simple) = - paras $ - [ foldr renderHint (indent (renderSimpleErrorMessage simple)) hints - ] ++ - maybe [] (return . Box.moveDown 1) typeInformation ++ - [ Box.moveDown 1 $ paras - [ line $ "See " <> errorDocUri e <> " for more information, " - , line $ "or to contribute content related to this " <> levelText <> "." - ] - | showDocs - ] - where - typeInformation :: Maybe Box.Box - typeInformation | not (null types) = Just $ Box.hsep 1 Box.left [ line "where", paras types ] - | otherwise = Nothing + (markCode, markCodeBox) = (colorCode &&& colorCodeBox) codeColor + + -- Pretty print an ErrorMessage + prettyPrintErrorMessage :: TypeMap -> ErrorMessage -> Box.Box + prettyPrintErrorMessage typeMap (ErrorMessage hints simple) = + paras $ + [ foldr renderHint (indent (renderSimpleErrorMessage simple)) hints + ] + ++ maybe [] (return . Box.moveDown 1) typeInformation + ++ [ Box.moveDown 1 $ + paras + [ line $ "See " <> errorDocUri e <> " for more information, " + , line $ "or to contribute content related to this " <> levelText <> "." + ] + | showDocs + ] where - types :: [Box.Box] - types = map skolemInfo (M.elems (umSkolemMap typeMap)) ++ - map unknownInfo (M.elems (umUnknownMap typeMap)) - - skolemInfo :: (String, Int, Maybe SourceSpan) -> Box.Box - skolemInfo (name, s, ss) = - paras $ - line (markCode (T.pack (name <> show s)) <> " is a rigid type variable") - : foldMap (return . line . (" bound at " <>) . displayStartEndPos) ss - - unknownInfo :: Int -> Box.Box - unknownInfo u = line $ markCode ("t" <> T.pack (show u)) <> " is an unknown type" - - renderSimpleErrorMessage :: SimpleErrorMessage -> Box.Box - renderSimpleErrorMessage (InternalCompilerError ctx err) = - paras [ line "Internal compiler error:" + typeInformation :: Maybe Box.Box + typeInformation + | not (null types) = Just $ Box.hsep 1 Box.left [line "where", paras types] + | otherwise = Nothing + where + types :: [Box.Box] + types = + map skolemInfo (M.elems (umSkolemMap typeMap)) + ++ map unknownInfo (M.elems (umUnknownMap typeMap)) + + skolemInfo :: (String, Int, Maybe SourceSpan) -> Box.Box + skolemInfo (name, s, ss) = + paras $ + line (markCode (T.pack (name <> show s)) <> " is a rigid type variable") + : foldMap (return . line . (" bound at " <>) . displayStartEndPos) ss + + unknownInfo :: Int -> Box.Box + unknownInfo u = line $ markCode ("t" <> T.pack (show u)) <> " is an unknown type" + + renderSimpleErrorMessage :: SimpleErrorMessage -> Box.Box + renderSimpleErrorMessage (InternalCompilerError ctx err) = + paras + [ line "Internal compiler error:" , indent $ line err , line ctx , line "Please report this at https://github.com/purescript/purescript/issues" ] - renderSimpleErrorMessage (ModuleNotFound mn) = - paras [ line $ "Module " <> markCode (runModuleName mn) <> " was not found." + renderSimpleErrorMessage (ModuleNotFound mn) = + paras + [ line $ "Module " <> markCode (runModuleName mn) <> " was not found." , line $ if isBuiltinModuleName mn - then - "Module names in the Prim namespace are reserved for built-in modules, but this version of the compiler does not provide module " <> markCode (runModuleName mn) <> ". You may be able to fix this by updating your compiler to a newer version." - else - "Make sure the source file exists, and that it has been provided as an input to the compiler." + then "Module names in the Prim namespace are reserved for built-in modules, but this version of the compiler does not provide module " <> markCode (runModuleName mn) <> ". You may be able to fix this by updating your compiler to a newer version." + else "Make sure the source file exists, and that it has been provided as an input to the compiler." ] - renderSimpleErrorMessage (FileIOError doWhat err) = - paras [ line $ "I/O error while trying to " <> doWhat + renderSimpleErrorMessage (FileIOError doWhat err) = + paras + [ line $ "I/O error while trying to " <> doWhat , indent . lineS $ displayException err ] - renderSimpleErrorMessage (ErrorParsingFFIModule path extra) = - paras $ [ line "Unable to parse foreign module:" - , indent . lineS $ path - ] ++ - map (indent . lineS) (concatMap Bundle.printErrorMessage (maybeToList extra)) - renderSimpleErrorMessage (ErrorParsingCSTModule err) = - paras [ line "Unable to parse module: " + renderSimpleErrorMessage (ErrorParsingFFIModule path extra) = + paras $ + [ line "Unable to parse foreign module:" + , indent . lineS $ path + ] + ++ map (indent . lineS) (concatMap Bundle.printErrorMessage (maybeToList extra)) + renderSimpleErrorMessage (ErrorParsingCSTModule err) = + paras + [ line "Unable to parse module: " , line $ T.pack $ CST.prettyPrintErrorMessage err ] - renderSimpleErrorMessage (WarningParsingCSTModule err) = - paras [ line $ T.pack $ CST.prettyPrintWarningMessage err + renderSimpleErrorMessage (WarningParsingCSTModule err) = + paras + [ line $ T.pack $ CST.prettyPrintWarningMessage err ] - renderSimpleErrorMessage (MissingFFIModule mn) = - line $ "The foreign module implementation for module " <> markCode (runModuleName mn) <> " is missing." - renderSimpleErrorMessage (UnnecessaryFFIModule mn path) = - paras [ line $ "An unnecessary foreign module implementation was provided for module " <> markCode (runModuleName mn) <> ": " + renderSimpleErrorMessage (MissingFFIModule mn) = + line $ "The foreign module implementation for module " <> markCode (runModuleName mn) <> " is missing." + renderSimpleErrorMessage (UnnecessaryFFIModule mn path) = + paras + [ line $ "An unnecessary foreign module implementation was provided for module " <> markCode (runModuleName mn) <> ": " , indent . lineS $ path , line $ "Module " <> markCode (runModuleName mn) <> " does not contain any foreign import declarations, so a foreign module is not necessary." ] - renderSimpleErrorMessage (MissingFFIImplementations mn idents) = - paras [ line $ "The following values are not defined in the foreign module for module " <> markCode (runModuleName mn) <> ": " + renderSimpleErrorMessage (MissingFFIImplementations mn idents) = + paras + [ line $ "The following values are not defined in the foreign module for module " <> markCode (runModuleName mn) <> ": " , indent . paras $ map (line . runIdent) idents ] - renderSimpleErrorMessage (UnusedFFIImplementations mn idents) = - paras [ line $ "The following definitions in the foreign module for module " <> markCode (runModuleName mn) <> " are unused: " + renderSimpleErrorMessage (UnusedFFIImplementations mn idents) = + paras + [ line $ "The following definitions in the foreign module for module " <> markCode (runModuleName mn) <> " are unused: " , indent . paras $ map (line . runIdent) idents ] - renderSimpleErrorMessage (InvalidFFIIdentifier mn ident) = - paras [ line $ "In the FFI module for " <> markCode (runModuleName mn) <> ":" + renderSimpleErrorMessage (InvalidFFIIdentifier mn ident) = + paras + [ line $ "In the FFI module for " <> markCode (runModuleName mn) <> ":" , indent . paras $ [ line $ "The identifier " <> markCode ident <> " is not valid in PureScript." , line "Note that exported identifiers in FFI modules must be valid PureScript identifiers." ] ] - renderSimpleErrorMessage (DeprecatedFFIPrime mn ident) = - paras [ line $ "In the FFI module for " <> markCode (runModuleName mn) <> ":" + renderSimpleErrorMessage (DeprecatedFFIPrime mn ident) = + paras + [ line $ "In the FFI module for " <> markCode (runModuleName mn) <> ":" , indent . paras $ [ line $ "The identifier " <> markCode ident <> " contains a prime (" <> markCode "'" <> ")." , line "Primes are not allowed in identifiers exported from FFI modules." ] ] - renderSimpleErrorMessage (DeprecatedFFICommonJSModule mn path) = - paras [ line $ "A CommonJS foreign module implementation was provided for module " <> markCode (runModuleName mn) <> ": " + renderSimpleErrorMessage (DeprecatedFFICommonJSModule mn path) = + paras + [ line $ "A CommonJS foreign module implementation was provided for module " <> markCode (runModuleName mn) <> ": " , indent . lineS $ path , line "CommonJS foreign modules are no longer supported. Use native JavaScript/ECMAScript module syntax instead." ] - renderSimpleErrorMessage (UnsupportedFFICommonJSExports mn idents) = - paras [ line $ "The following CommonJS exports are not supported in the ES foreign module for module " <> markCode (runModuleName mn) <> ": " + renderSimpleErrorMessage (UnsupportedFFICommonJSExports mn idents) = + paras + [ line $ "The following CommonJS exports are not supported in the ES foreign module for module " <> markCode (runModuleName mn) <> ": " , indent . paras $ map line idents ] - renderSimpleErrorMessage (UnsupportedFFICommonJSImports mn mids) = - paras [ line $ "The following CommonJS imports are not supported in the ES foreign module for module " <> markCode (runModuleName mn) <> ": " + renderSimpleErrorMessage (UnsupportedFFICommonJSImports mn mids) = + paras + [ line $ "The following CommonJS imports are not supported in the ES foreign module for module " <> markCode (runModuleName mn) <> ": " , indent . paras $ map line mids ] - renderSimpleErrorMessage InvalidDoBind = - line "The last statement in a 'do' block must be an expression, but this block ends with a binder." - renderSimpleErrorMessage InvalidDoLet = - line "The last statement in a 'do' block must be an expression, but this block ends with a let binding." - renderSimpleErrorMessage (OverlappingNamesInLet name) = - line $ "The name " <> markCode (showIdent name) <> " was defined multiple times in a binding group" - renderSimpleErrorMessage (InfiniteType ty) = - paras [ line "An infinite type was inferred for an expression: " + renderSimpleErrorMessage InvalidDoBind = + line "The last statement in a 'do' block must be an expression, but this block ends with a binder." + renderSimpleErrorMessage InvalidDoLet = + line "The last statement in a 'do' block must be an expression, but this block ends with a let binding." + renderSimpleErrorMessage (OverlappingNamesInLet name) = + line $ "The name " <> markCode (showIdent name) <> " was defined multiple times in a binding group" + renderSimpleErrorMessage (InfiniteType ty) = + paras + [ line "An infinite type was inferred for an expression: " , markCodeBox $ indent $ prettyType ty ] - renderSimpleErrorMessage (InfiniteKind ki) = - paras [ line "An infinite kind was inferred for a type: " + renderSimpleErrorMessage (InfiniteKind ki) = + paras + [ line "An infinite kind was inferred for a type: " , markCodeBox $ indent $ prettyType ki ] - renderSimpleErrorMessage (MultipleValueOpFixities op) = - line $ "There are multiple fixity/precedence declarations for operator " <> markCode (showOp op) - renderSimpleErrorMessage (MultipleTypeOpFixities op) = - line $ "There are multiple fixity/precedence declarations for type operator " <> markCode (showOp op) - renderSimpleErrorMessage (OrphanTypeDeclaration nm) = - line $ "The type declaration for " <> markCode (showIdent nm) <> " should be followed by its definition." - renderSimpleErrorMessage (OrphanKindDeclaration nm) = - line $ "The kind declaration for " <> markCode (runProperName nm) <> " should be followed by its definition." - renderSimpleErrorMessage (OrphanRoleDeclaration nm) = - line $ "The role declaration for " <> markCode (runProperName nm) <> " should follow its definition." - renderSimpleErrorMessage (RedefinedIdent name) = - line $ "The value " <> markCode (showIdent name) <> " has been defined multiple times" - renderSimpleErrorMessage (UnknownName name@(Qualified (BySourcePos _) (IdentName (Ident i)))) | i `elem` [ C.S_bind, C.S_discard ] = - line $ "Unknown " <> printName name <> ". You're probably using do-notation, which the compiler replaces with calls to the " <> markCode "bind" <> " and " <> markCode "discard" <> " functions. Please import " <> markCode i <> " from module " <> markCode "Prelude" - renderSimpleErrorMessage (UnknownName name@(Qualified (BySourcePos _) (IdentName (Ident C.S_negate)))) = - line $ "Unknown " <> printName name <> ". You're probably using numeric negation (the unary " <> markCode "-" <> " operator), which the compiler replaces with calls to the " <> markCode C.S_negate <> " function. Please import " <> markCode C.S_negate <> " from module " <> markCode "Prelude" - renderSimpleErrorMessage (UnknownName name) = - line $ "Unknown " <> printName name - renderSimpleErrorMessage (UnknownImport mn name) = - paras [ line $ "Cannot import " <> printName (Qualified ByNullSourcePos name) <> " from module " <> markCode (runModuleName mn) + renderSimpleErrorMessage (MultipleValueOpFixities op) = + line $ "There are multiple fixity/precedence declarations for operator " <> markCode (showOp op) + renderSimpleErrorMessage (MultipleTypeOpFixities op) = + line $ "There are multiple fixity/precedence declarations for type operator " <> markCode (showOp op) + renderSimpleErrorMessage (OrphanTypeDeclaration nm) = + line $ "The type declaration for " <> markCode (showIdent nm) <> " should be followed by its definition." + renderSimpleErrorMessage (OrphanKindDeclaration nm) = + line $ "The kind declaration for " <> markCode (runProperName nm) <> " should be followed by its definition." + renderSimpleErrorMessage (OrphanRoleDeclaration nm) = + line $ "The role declaration for " <> markCode (runProperName nm) <> " should follow its definition." + renderSimpleErrorMessage (RedefinedIdent name) = + line $ "The value " <> markCode (showIdent name) <> " has been defined multiple times" + renderSimpleErrorMessage (UnknownName name@(Qualified (BySourcePos _) (IdentName (Ident i)))) + | i `elem` [C.S_bind, C.S_discard] = + line $ "Unknown " <> printName name <> ". You're probably using do-notation, which the compiler replaces with calls to the " <> markCode "bind" <> " and " <> markCode "discard" <> " functions. Please import " <> markCode i <> " from module " <> markCode "Prelude" + renderSimpleErrorMessage (UnknownName name@(Qualified (BySourcePos _) (IdentName (Ident C.S_negate)))) = + line $ "Unknown " <> printName name <> ". You're probably using numeric negation (the unary " <> markCode "-" <> " operator), which the compiler replaces with calls to the " <> markCode C.S_negate <> " function. Please import " <> markCode C.S_negate <> " from module " <> markCode "Prelude" + renderSimpleErrorMessage (UnknownName name) = + line $ "Unknown " <> printName name + renderSimpleErrorMessage (UnknownImport mn name) = + paras + [ line $ "Cannot import " <> printName (Qualified ByNullSourcePos name) <> " from module " <> markCode (runModuleName mn) , line "It either does not exist or the module does not export it." ] - renderSimpleErrorMessage (UnknownImportDataConstructor mn tcon dcon) = - line $ "Module " <> runModuleName mn <> " does not export data constructor " <> markCode (runProperName dcon) <> " for type " <> markCode (runProperName tcon) - renderSimpleErrorMessage (UnknownExport name) = - line $ "Cannot export unknown " <> printName (Qualified ByNullSourcePos name) - renderSimpleErrorMessage (UnknownExportDataConstructor tcon dcon) = - line $ "Cannot export data constructor " <> markCode (runProperName dcon) <> " for type " <> markCode (runProperName tcon) <> ", as it has not been declared." - renderSimpleErrorMessage (ScopeConflict nm ms) = - paras [ line $ "Conflicting definitions are in scope for " <> printName (Qualified ByNullSourcePos nm) <> " from the following modules:" + renderSimpleErrorMessage (UnknownImportDataConstructor mn tcon dcon) = + line $ "Module " <> runModuleName mn <> " does not export data constructor " <> markCode (runProperName dcon) <> " for type " <> markCode (runProperName tcon) + renderSimpleErrorMessage (UnknownExport name) = + line $ "Cannot export unknown " <> printName (Qualified ByNullSourcePos name) + renderSimpleErrorMessage (UnknownExportDataConstructor tcon dcon) = + line $ "Cannot export data constructor " <> markCode (runProperName dcon) <> " for type " <> markCode (runProperName tcon) <> ", as it has not been declared." + renderSimpleErrorMessage (ScopeConflict nm ms) = + paras + [ line $ "Conflicting definitions are in scope for " <> printName (Qualified ByNullSourcePos nm) <> " from the following modules:" , indent $ paras $ map (line . markCode . runModuleName) ms ] - renderSimpleErrorMessage (ScopeShadowing nm exmn ms) = - paras [ line $ "Shadowed definitions are in scope for " <> printName (Qualified ByNullSourcePos nm) <> " from the following open imports:" + renderSimpleErrorMessage (ScopeShadowing nm exmn ms) = + paras + [ line $ "Shadowed definitions are in scope for " <> printName (Qualified ByNullSourcePos nm) <> " from the following open imports:" , indent $ paras $ map (line . markCode . ("import " <>) . runModuleName) ms - , line $ "These will be ignored and the " <> case exmn of - Just exmn' -> "declaration from " <> markCode (runModuleName exmn') <> " will be used." - Nothing -> "local declaration will be used." - ] - renderSimpleErrorMessage (DeclConflict new existing) = - line $ "Declaration for " <> printName (Qualified ByNullSourcePos new) <> " conflicts with an existing " <> nameType existing <> " of the same name." - renderSimpleErrorMessage (ExportConflict new existing) = - line $ "Export for " <> printName new <> " conflicts with " <> printName existing - renderSimpleErrorMessage (DuplicateModule mn) = - line $ "Module " <> markCode (runModuleName mn) <> " has been defined multiple times" - renderSimpleErrorMessage (DuplicateTypeClass pn ss) = - paras [ line ("Type class " <> markCode (runProperName pn) <> " has been defined multiple times:") + , line $ + "These will be ignored and the " <> case exmn of + Just exmn' -> "declaration from " <> markCode (runModuleName exmn') <> " will be used." + Nothing -> "local declaration will be used." + ] + renderSimpleErrorMessage (DeclConflict new existing) = + line $ "Declaration for " <> printName (Qualified ByNullSourcePos new) <> " conflicts with an existing " <> nameType existing <> " of the same name." + renderSimpleErrorMessage (ExportConflict new existing) = + line $ "Export for " <> printName new <> " conflicts with " <> printName existing + renderSimpleErrorMessage (DuplicateModule mn) = + line $ "Module " <> markCode (runModuleName mn) <> " has been defined multiple times" + renderSimpleErrorMessage (DuplicateTypeClass pn ss) = + paras + [ line ("Type class " <> markCode (runProperName pn) <> " has been defined multiple times:") , indent $ line $ displaySourceSpan relPath ss ] - renderSimpleErrorMessage (DuplicateInstance pn ss) = - paras [ line ("Instance " <> markCode (showIdent pn) <> " has been defined multiple times:") + renderSimpleErrorMessage (DuplicateInstance pn ss) = + paras + [ line ("Instance " <> markCode (showIdent pn) <> " has been defined multiple times:") , indent $ line $ displaySourceSpan relPath ss ] - renderSimpleErrorMessage (CycleInDeclaration nm) = - line $ "The value of " <> markCode (showIdent nm) <> " is undefined here, so this reference is not allowed." - renderSimpleErrorMessage (CycleInModules mns) = - case mns of - mn :| [] -> - line $ "Module " <> markCode (runModuleName mn) <> " imports itself." - _ -> - paras [ line "There is a cycle in module dependencies in these modules: " + renderSimpleErrorMessage (CycleInDeclaration nm) = + line $ "The value of " <> markCode (showIdent nm) <> " is undefined here, so this reference is not allowed." + renderSimpleErrorMessage (CycleInModules mns) = + case mns of + mn :| [] -> + line $ "Module " <> markCode (runModuleName mn) <> " imports itself." + _ -> + paras + [ line "There is a cycle in module dependencies in these modules: " , indent $ paras (line . markCode . runModuleName <$> NEL.toList mns) ] - renderSimpleErrorMessage (CycleInTypeSynonym names) = - paras $ cycleError <> - [ line "Cycles are disallowed because they can lead to loops in the type checker." - , line "Consider using a 'newtype' instead." - ] - where - cycleError = case names of - pn :| [] -> pure . line $ "A cycle appears in the definition of type synonym " <> markCode (runProperName pn) - _ -> [ line " A cycle appears in a set of type synonym definitions:" - , indent $ line $ "{" <> T.intercalate ", " (markCode . runProperName <$> NEL.toList names) <> "}" - ] - renderSimpleErrorMessage (CycleInTypeClassDeclaration (name :| [])) = - paras [ line $ "A type class '" <> markCode (runProperName (disqualify name)) <> "' may not have itself as a superclass." ] - renderSimpleErrorMessage (CycleInTypeClassDeclaration names) = - paras [ line "A cycle appears in a set of type class definitions:" + renderSimpleErrorMessage (CycleInTypeSynonym names) = + paras $ + cycleError + <> [ line "Cycles are disallowed because they can lead to loops in the type checker." + , line "Consider using a 'newtype' instead." + ] + where + cycleError = case names of + pn :| [] -> pure . line $ "A cycle appears in the definition of type synonym " <> markCode (runProperName pn) + _ -> + [ line " A cycle appears in a set of type synonym definitions:" + , indent $ line $ "{" <> T.intercalate ", " (markCode . runProperName <$> NEL.toList names) <> "}" + ] + renderSimpleErrorMessage (CycleInTypeClassDeclaration (name :| [])) = + paras [line $ "A type class '" <> markCode (runProperName (disqualify name)) <> "' may not have itself as a superclass."] + renderSimpleErrorMessage (CycleInTypeClassDeclaration names) = + paras + [ line "A cycle appears in a set of type class definitions:" , indent $ line $ "{" <> T.intercalate ", " (markCode . runProperName . disqualify <$> NEL.toList names) <> "}" , line "Cycles are disallowed because they can lead to loops in the type checker." ] - renderSimpleErrorMessage (CycleInKindDeclaration (name :| [])) = - paras [ line $ "A kind declaration '" <> markCode (runProperName (disqualify name)) <> "' may not refer to itself in its own signature." ] - renderSimpleErrorMessage (CycleInKindDeclaration names) = - paras [ line "A cycle appears in a set of kind declarations:" + renderSimpleErrorMessage (CycleInKindDeclaration (name :| [])) = + paras [line $ "A kind declaration '" <> markCode (runProperName (disqualify name)) <> "' may not refer to itself in its own signature."] + renderSimpleErrorMessage (CycleInKindDeclaration names) = + paras + [ line "A cycle appears in a set of kind declarations:" , indent $ line $ "{" <> T.intercalate ", " (markCode . runProperName . disqualify <$> NEL.toList names) <> "}" , line "Kind declarations may not refer to themselves in their own signatures." ] - renderSimpleErrorMessage (NameIsUndefined ident) = - line $ "Value " <> markCode (showIdent ident) <> " is undefined." - renderSimpleErrorMessage (UndefinedTypeVariable name) = - line $ "Type variable " <> markCode (runProperName name) <> " is undefined." - renderSimpleErrorMessage (PartiallyAppliedSynonym name) = - paras [ line $ "Type synonym " <> markCode (showQualified runProperName name) <> " is partially applied." + renderSimpleErrorMessage (NameIsUndefined ident) = + line $ "Value " <> markCode (showIdent ident) <> " is undefined." + renderSimpleErrorMessage (UndefinedTypeVariable name) = + line $ "Type variable " <> markCode (runProperName name) <> " is undefined." + renderSimpleErrorMessage (PartiallyAppliedSynonym name) = + paras + [ line $ "Type synonym " <> markCode (showQualified runProperName name) <> " is partially applied." , line "Type synonyms must be applied to all of their type arguments." ] - renderSimpleErrorMessage (EscapedSkolem name Nothing ty) = - paras [ line $ "The type variable " <> markCode name <> " has escaped its scope, appearing in the type" + renderSimpleErrorMessage (EscapedSkolem name Nothing ty) = + paras + [ line $ "The type variable " <> markCode name <> " has escaped its scope, appearing in the type" , markCodeBox $ indent $ prettyType ty ] - renderSimpleErrorMessage (EscapedSkolem name (Just srcSpan) ty) = - paras [ line $ "The type variable " <> markCode name <> ", bound at" + renderSimpleErrorMessage (EscapedSkolem name (Just srcSpan) ty) = + paras + [ line $ "The type variable " <> markCode name <> ", bound at" , indent $ line $ displaySourceSpan relPath srcSpan , line "has escaped its scope, appearing in the type" , markCodeBox $ indent $ prettyType ty ] - renderSimpleErrorMessage (TypesDoNotUnify u1 u2) - = let (row1Box, row2Box) = printRows u1 u2 - - in paras [ line "Could not match type" - , row1Box - , line "with type" - , row2Box - ] - - renderSimpleErrorMessage (KindsDoNotUnify k1 k2) = - paras [ line "Could not match kind" + renderSimpleErrorMessage (TypesDoNotUnify u1 u2) = + let (row1Box, row2Box) = printRows u1 u2 + in paras + [ line "Could not match type" + , row1Box + , line "with type" + , row2Box + ] + renderSimpleErrorMessage (KindsDoNotUnify k1 k2) = + paras + [ line "Could not match kind" , markCodeBox $ indent $ prettyType k1 , line "with kind" , markCodeBox $ indent $ prettyType k2 ] - renderSimpleErrorMessage (ConstrainedTypeUnified t1 t2) = - paras [ line "Could not match constrained type" + renderSimpleErrorMessage (ConstrainedTypeUnified t1 t2) = + paras + [ line "Could not match constrained type" , markCodeBox $ indent $ prettyType t1 , line "with type" , markCodeBox $ indent $ prettyType t2 ] - renderSimpleErrorMessage (OverlappingInstances _ _ []) = internalError "OverlappingInstances: empty instance list" - renderSimpleErrorMessage (OverlappingInstances nm ts ds) = - paras [ line "Overlapping type class instances found for" - , markCodeBox $ indent $ Box.hsep 1 Box.left - [ line (showQualified runProperName nm) - , Box.vcat Box.left (map prettyTypeAtom ts) - ] + renderSimpleErrorMessage (OverlappingInstances _ _ []) = internalError "OverlappingInstances: empty instance list" + renderSimpleErrorMessage (OverlappingInstances nm ts ds) = + paras + [ line "Overlapping type class instances found for" + , markCodeBox $ + indent $ + Box.hsep + 1 + Box.left + [ line (showQualified runProperName nm) + , Box.vcat Box.left (map prettyTypeAtom ts) + ] , line "The following instances were found:" , indent $ paras (map prettyInstanceName ds) ] - renderSimpleErrorMessage (UnknownClass nm) = - paras [ line "No type class instance was found for class" + renderSimpleErrorMessage (UnknownClass nm) = + paras + [ line "No type class instance was found for class" , markCodeBox $ indent $ line (showQualified runProperName nm) , line "because the class was not in scope. Perhaps it was not exported." ] - renderSimpleErrorMessage (NoInstanceFound (Constraint _ C.Fail _ [ ty ] _) _ _) | Just box <- toTypelevelString ty = - paras [ line "Custom error:" - , indent box - ] - renderSimpleErrorMessage (NoInstanceFound (Constraint _ C.Partial - _ - _ - (Just (PartialConstraintData bs b))) _ _) = - paras [ line "A case expression could not be determined to cover all inputs." - , line "The following additional cases are required to cover all inputs:" - , indent $ paras $ - Box.hsep 1 Box.left - (map (paras . map (line . markCode)) (transpose bs)) - : [line "..." | not b] - , line "Alternatively, add a Partial constraint to the type of the enclosing value." - ] - renderSimpleErrorMessage (NoInstanceFound (Constraint _ C.Discard _ [ty] _) _ _) = - paras [ line "A result of type" + renderSimpleErrorMessage (NoInstanceFound (Constraint _ C.Fail _ [ty] _) _ _) + | Just box <- toTypelevelString ty = + paras + [ line "Custom error:" + , indent box + ] + renderSimpleErrorMessage + ( NoInstanceFound + ( Constraint + _ + C.Partial + _ + _ + (Just (PartialConstraintData bs b)) + ) + _ + _ + ) = + paras + [ line "A case expression could not be determined to cover all inputs." + , line "The following additional cases are required to cover all inputs:" + , indent $ + paras $ + Box.hsep + 1 + Box.left + (map (paras . map (line . markCode)) (transpose bs)) + : [line "..." | not b] + , line "Alternatively, add a Partial constraint to the type of the enclosing value." + ] + renderSimpleErrorMessage (NoInstanceFound (Constraint _ C.Discard _ [ty] _) _ _) = + paras + [ line "A result of type" , markCodeBox $ indent $ prettyType ty , line "was implicitly discarded in a do notation block." , line ("You can use " <> markCode "_ <- ..." <> " to explicitly discard the result.") ] - renderSimpleErrorMessage (NoInstanceFound (Constraint _ nm _ ts _) ambiguous unks) = - paras $ + renderSimpleErrorMessage (NoInstanceFound (Constraint _ nm _ ts _) ambiguous unks) = + paras $ [ line "No type class instance was found for" - , markCodeBox $ indent $ Box.hsep 1 Box.left - [ line (showQualified runProperName nm) - , Box.vcat Box.left (map prettyTypeAtom ts) - ] - , paras $ let useMessage msg = - [ line msg - , indent $ paras (map prettyInstanceName ambiguous) - ] - in case ambiguous of - [] -> [] - [_] -> useMessage "The following instance partially overlaps the above constraint, which means the rest of its instance chain will not be considered:" - _ -> useMessage "The following instances partially overlap the above constraint, which means the rest of their instance chains will not be considered:" - ] <> case unks of - NoUnknowns -> - [] - Unknowns -> - [ line "The instance head contains unknown type variables. Consider adding a type annotation." ] - UnknownsWithVtaRequiringArgs tyClassMembersRequiringVtas -> - let - renderSingleTyClassMember (tyClassMember, argsRequiringVtas) = - Box.moveRight 2 $ paras $ - [ line $ markCode (showQualified showIdent tyClassMember) ] - <> case argsRequiringVtas of + , markCodeBox $ + indent $ + Box.hsep + 1 + Box.left + [ line (showQualified runProperName nm) + , Box.vcat Box.left (map prettyTypeAtom ts) + ] + , paras $ + let useMessage msg = + [ line msg + , indent $ paras (map prettyInstanceName ambiguous) + ] + in case ambiguous of + [] -> [] + [_] -> useMessage "The following instance partially overlaps the above constraint, which means the rest of its instance chain will not be considered:" + _ -> useMessage "The following instances partially overlap the above constraint, which means the rest of their instance chains will not be considered:" + ] + <> case unks of + NoUnknowns -> + [] + Unknowns -> + [line "The instance head contains unknown type variables. Consider adding a type annotation."] + UnknownsWithVtaRequiringArgs tyClassMembersRequiringVtas -> + let + renderSingleTyClassMember (tyClassMember, argsRequiringVtas) = + Box.moveRight 2 $ + paras $ + [line $ markCode (showQualified showIdent tyClassMember)] + <> case argsRequiringVtas of [required] -> - [ Box.moveRight 2 $ line $ T.intercalate ", " required ] - options -> + [Box.moveRight 2 $ line $ T.intercalate ", " required] + options -> [ Box.moveRight 2 $ line "One of the following sets of type variables:" - , Box.moveRight 2 $ paras $ - map (\set -> Box.moveRight 2 $ line $ T.intercalate ", " set) options + , Box.moveRight 2 $ + paras $ + map (\set -> Box.moveRight 2 $ line $ T.intercalate ", " set) options ] - in - [ paras + in + [ paras [ line "The instance head contains unknown type variables." - , Box.moveDown 1 $ paras $ - [ line $ "Note: The following type class members found in the expression require visible type applications to be unambiguous (e.g. " <> markCode "tyClassMember @Int" <> ")."] - <> map renderSingleTyClassMember (NEL.toList tyClassMembersRequiringVtas) + , Box.moveDown 1 $ + paras $ + [line $ "Note: The following type class members found in the expression require visible type applications to be unambiguous (e.g. " <> markCode "tyClassMember @Int" <> ")."] + <> map renderSingleTyClassMember (NEL.toList tyClassMembersRequiringVtas) ] - ] - renderSimpleErrorMessage (AmbiguousTypeVariables t uis) = - paras [ line "The inferred type" + ] + renderSimpleErrorMessage (AmbiguousTypeVariables t uis) = + paras + [ line "The inferred type" , markCodeBox $ indent $ prettyType t , line "has type variables which are not determined by those mentioned in the body of the type:" - , indent $ Box.hsep 1 Box.left - [ Box.vcat Box.left - [ line $ markCode (u <> T.pack (show i)) <> " could not be determined" - | (u, i) <- uis ] - ] + , indent $ + Box.hsep + 1 + Box.left + [ Box.vcat + Box.left + [ line $ markCode (u <> T.pack (show i)) <> " could not be determined" + | (u, i) <- uis + ] + ] , line "Consider adding a type annotation." ] - renderSimpleErrorMessage (PossiblyInfiniteInstance nm ts) = - paras [ line "Type class instance for" - , markCodeBox $ indent $ Box.hsep 1 Box.left - [ line (showQualified runProperName nm) - , Box.vcat Box.left (map prettyTypeAtom ts) - ] + renderSimpleErrorMessage (PossiblyInfiniteInstance nm ts) = + paras + [ line "Type class instance for" + , markCodeBox $ + indent $ + Box.hsep + 1 + Box.left + [ line (showQualified runProperName nm) + , Box.vcat Box.left (map prettyTypeAtom ts) + ] , line "is possibly infinite." ] - renderSimpleErrorMessage PossiblyInfiniteCoercibleInstance = - line $ "A " <> markCode "Coercible" <> " instance is possibly infinite." - renderSimpleErrorMessage (CannotDerive nm ts) = - paras [ line "Cannot derive a type class instance for" - , markCodeBox $ indent $ Box.hsep 1 Box.left - [ line (showQualified runProperName nm) - , Box.vcat Box.left (map prettyTypeAtom ts) - ] + renderSimpleErrorMessage PossiblyInfiniteCoercibleInstance = + line $ "A " <> markCode "Coercible" <> " instance is possibly infinite." + renderSimpleErrorMessage (CannotDerive nm ts) = + paras + [ line "Cannot derive a type class instance for" + , markCodeBox $ + indent $ + Box.hsep + 1 + Box.left + [ line (showQualified runProperName nm) + , Box.vcat Box.left (map prettyTypeAtom ts) + ] , line "since instances of this type class are not derivable." ] - renderSimpleErrorMessage (InvalidNewtypeInstance nm ts) = - paras [ line "Cannot derive newtype instance for" - , markCodeBox $ indent $ Box.hsep 1 Box.left - [ line (showQualified runProperName nm) - , Box.vcat Box.left (map prettyTypeAtom ts) - ] + renderSimpleErrorMessage (InvalidNewtypeInstance nm ts) = + paras + [ line "Cannot derive newtype instance for" + , markCodeBox $ + indent $ + Box.hsep + 1 + Box.left + [ line (showQualified runProperName nm) + , Box.vcat Box.left (map prettyTypeAtom ts) + ] , line "Make sure this is a newtype." ] - renderSimpleErrorMessage (MissingNewtypeSuperclassInstance su cl ts) = - paras [ line "The derived newtype instance for" - , markCodeBox $ indent $ Box.hsep 1 Box.left - [ line (showQualified runProperName cl) - , Box.vcat Box.left (map prettyTypeAtom ts) - ] + renderSimpleErrorMessage (MissingNewtypeSuperclassInstance su cl ts) = + paras + [ line "The derived newtype instance for" + , markCodeBox $ + indent $ + Box.hsep + 1 + Box.left + [ line (showQualified runProperName cl) + , Box.vcat Box.left (map prettyTypeAtom ts) + ] , line $ "does not include a derived superclass instance for " <> markCode (showQualified runProperName su) <> "." ] - renderSimpleErrorMessage (UnverifiableSuperclassInstance su cl ts) = - paras [ line "The derived newtype instance for" - , markCodeBox $ indent $ Box.hsep 1 Box.left - [ line (showQualified runProperName cl) - , Box.vcat Box.left (map prettyTypeAtom ts) - ] + renderSimpleErrorMessage (UnverifiableSuperclassInstance su cl ts) = + paras + [ line "The derived newtype instance for" + , markCodeBox $ + indent $ + Box.hsep + 1 + Box.left + [ line (showQualified runProperName cl) + , Box.vcat Box.left (map prettyTypeAtom ts) + ] , line $ "implies an superclass instance for " <> markCode (showQualified runProperName su) <> " which could not be verified." ] - renderSimpleErrorMessage (InvalidDerivedInstance nm ts argCount) = - paras [ line "Cannot derive the type class instance" - , markCodeBox $ indent $ Box.hsep 1 Box.left - [ line (showQualified runProperName nm) - , Box.vcat Box.left (map prettyTypeAtom ts) - ] - , line $ fold - [ "because the " - , markCode (showQualified runProperName nm) - , " type class has " - , T.pack (show argCount) - , " type " - , if argCount == 1 then "argument" else "arguments" - , ", but the declaration specifies " <> T.pack (show (length ts)) <> "." - ] - ] - renderSimpleErrorMessage (ExpectedTypeConstructor nm ts ty) = - paras [ line "Cannot derive the type class instance" - , markCodeBox $ indent $ Box.hsep 1 Box.left - [ line (showQualified runProperName nm) - , Box.vcat Box.left (map prettyTypeAtom ts) - ] + renderSimpleErrorMessage (InvalidDerivedInstance nm ts argCount) = + paras + [ line "Cannot derive the type class instance" + , markCodeBox $ + indent $ + Box.hsep + 1 + Box.left + [ line (showQualified runProperName nm) + , Box.vcat Box.left (map prettyTypeAtom ts) + ] + , line $ + fold + [ "because the " + , markCode (showQualified runProperName nm) + , " type class has " + , T.pack (show argCount) + , " type " + , if argCount == 1 then "argument" else "arguments" + , ", but the declaration specifies " <> T.pack (show (length ts)) <> "." + ] + ] + renderSimpleErrorMessage (ExpectedTypeConstructor nm ts ty) = + paras + [ line "Cannot derive the type class instance" + , markCodeBox $ + indent $ + Box.hsep + 1 + Box.left + [ line (showQualified runProperName nm) + , Box.vcat Box.left (map prettyTypeAtom ts) + ] , "because the type" , markCodeBox $ indent $ prettyType ty , line "is not of the required form T a_1 ... a_n, where T is a type constructor defined in the same module." ] - renderSimpleErrorMessage (CannotFindDerivingType nm) = - line $ "Cannot derive a type class instance, because the type declaration for " <> markCode (runProperName nm) <> " could not be found." - renderSimpleErrorMessage (DuplicateLabel l expr) = - paras $ [ line $ "Label " <> markCode (prettyPrintLabel l) <> " appears more than once in a row type." ] - <> foldMap (\expr' -> [ line "Relevant expression: " - , markCodeBox $ indent $ prettyPrintValue prettyDepth expr' - ]) expr - renderSimpleErrorMessage (DuplicateTypeArgument name) = - line $ "Type argument " <> markCode name <> " appears more than once." - renderSimpleErrorMessage (DuplicateValueDeclaration nm) = - line $ "Multiple value declarations exist for " <> markCode (showIdent nm) <> "." - renderSimpleErrorMessage (ArgListLengthsDiffer ident) = - line $ "Argument list lengths differ in declaration " <> markCode (showIdent ident) - renderSimpleErrorMessage (OverlappingArgNames ident) = - line $ "Overlapping names in function/binder" <> foldMap ((" in declaration " <>) . showIdent) ident - renderSimpleErrorMessage (MissingClassMember identsAndTypes) = - paras [ line "The following type class members have not been implemented:" - , Box.vcat Box.left - [ markCodeBox $ Box.text (T.unpack (showIdent ident)) Box.<> " :: " Box.<> prettyType ty - | (ident, ty) <- NEL.toList identsAndTypes ] - ] - renderSimpleErrorMessage (ExtraneousClassMember ident className) = - line $ "" <> markCode (showIdent ident) <> " is not a member of type class " <> markCode (showQualified runProperName className) - renderSimpleErrorMessage (ExpectedType ty kind) = - paras [ line $ "In a type-annotated expression " <> markCode "x :: t" <> ", the type " <> markCode "t" <> " must have kind " <> markCode (runProperName . disqualify $ C.Type) <> "." + renderSimpleErrorMessage (CannotFindDerivingType nm) = + line $ "Cannot derive a type class instance, because the type declaration for " <> markCode (runProperName nm) <> " could not be found." + renderSimpleErrorMessage (DuplicateLabel l expr) = + paras $ + [line $ "Label " <> markCode (prettyPrintLabel l) <> " appears more than once in a row type."] + <> foldMap + ( \expr' -> + [ line "Relevant expression: " + , markCodeBox $ indent $ prettyPrintValue prettyDepth expr' + ] + ) + expr + renderSimpleErrorMessage (DuplicateTypeArgument name) = + line $ "Type argument " <> markCode name <> " appears more than once." + renderSimpleErrorMessage (DuplicateValueDeclaration nm) = + line $ "Multiple value declarations exist for " <> markCode (showIdent nm) <> "." + renderSimpleErrorMessage (ArgListLengthsDiffer ident) = + line $ "Argument list lengths differ in declaration " <> markCode (showIdent ident) + renderSimpleErrorMessage (OverlappingArgNames ident) = + line $ "Overlapping names in function/binder" <> foldMap ((" in declaration " <>) . showIdent) ident + renderSimpleErrorMessage (MissingClassMember identsAndTypes) = + paras + [ line "The following type class members have not been implemented:" + , Box.vcat + Box.left + [ markCodeBox $ Box.text (T.unpack (showIdent ident)) Box.<> " :: " Box.<> prettyType ty + | (ident, ty) <- NEL.toList identsAndTypes + ] + ] + renderSimpleErrorMessage (ExtraneousClassMember ident className) = + line $ "" <> markCode (showIdent ident) <> " is not a member of type class " <> markCode (showQualified runProperName className) + renderSimpleErrorMessage (ExpectedType ty kind) = + paras + [ line $ "In a type-annotated expression " <> markCode "x :: t" <> ", the type " <> markCode "t" <> " must have kind " <> markCode (runProperName . disqualify $ C.Type) <> "." , line "The error arises from the type" , markCodeBox $ indent $ prettyType ty , line "having the kind" , markCodeBox $ indent $ prettyType kind , line "instead." ] - renderSimpleErrorMessage (IncorrectConstructorArity nm expected actual) = - paras [ line $ "Data constructor " <> markCode (showQualified runProperName nm) <> " was given " <> T.pack (show actual) <> " arguments in a case expression, but expected " <> T.pack (show expected) <> " arguments." + renderSimpleErrorMessage (IncorrectConstructorArity nm expected actual) = + paras + [ line $ "Data constructor " <> markCode (showQualified runProperName nm) <> " was given " <> T.pack (show actual) <> " arguments in a case expression, but expected " <> T.pack (show expected) <> " arguments." , line $ "This problem can be fixed by giving " <> markCode (showQualified runProperName nm) <> " " <> T.pack (show expected) <> " arguments." ] - renderSimpleErrorMessage (ExprDoesNotHaveType expr ty) = - paras [ line "Expression" + renderSimpleErrorMessage (ExprDoesNotHaveType expr ty) = + paras + [ line "Expression" , markCodeBox $ indent $ prettyPrintValue prettyDepth expr , line "does not have type" , markCodeBox $ indent $ prettyType ty ] - renderSimpleErrorMessage (PropertyIsMissing prop) = - line $ "Type of expression lacks required label " <> markCode (prettyPrintLabel prop) <> "." - renderSimpleErrorMessage (AdditionalProperty prop) = - line $ "Type of expression contains additional label " <> markCode (prettyPrintLabel prop) <> "." - renderSimpleErrorMessage (OrphanInstance nm cnm nonOrphanModules ts) = - paras [ line $ "Orphan instance" <> prettyPrintPlainIdent nm <> " found for " - , markCodeBox $ indent $ Box.hsep 1 Box.left - [ line (showQualified runProperName cnm) - , Box.vcat Box.left (map prettyTypeAtom ts) - ] + renderSimpleErrorMessage (PropertyIsMissing prop) = + line $ "Type of expression lacks required label " <> markCode (prettyPrintLabel prop) <> "." + renderSimpleErrorMessage (AdditionalProperty prop) = + line $ "Type of expression contains additional label " <> markCode (prettyPrintLabel prop) <> "." + renderSimpleErrorMessage (OrphanInstance nm cnm nonOrphanModules ts) = + paras + [ line $ "Orphan instance" <> prettyPrintPlainIdent nm <> " found for " + , markCodeBox $ + indent $ + Box.hsep + 1 + Box.left + [ line (showQualified runProperName cnm) + , Box.vcat Box.left (map prettyTypeAtom ts) + ] , Box.vcat Box.left $ case modulesToList of - [] -> [ line "There is nowhere this instance can be placed without being an orphan." - , line "A newtype wrapper can be used to avoid this problem." - ] - _ -> [ Box.text $ "This problem can be resolved by declaring the instance in " - <> T.unpack formattedModules - <> ", or by defining the instance on a newtype wrapper." - ] - ] - where - modulesToList = S.toList $ S.delete (moduleNameFromString "Prim") nonOrphanModules - formattedModules = T.intercalate " or " (markCode . runModuleName <$> modulesToList) - renderSimpleErrorMessage (InvalidNewtype name) = - paras [ line $ "Newtype " <> markCode (runProperName name) <> " is invalid." + [] -> + [ line "There is nowhere this instance can be placed without being an orphan." + , line "A newtype wrapper can be used to avoid this problem." + ] + _ -> + [ Box.text $ + "This problem can be resolved by declaring the instance in " + <> T.unpack formattedModules + <> ", or by defining the instance on a newtype wrapper." + ] + ] + where + modulesToList = S.toList $ S.delete (moduleNameFromString "Prim") nonOrphanModules + formattedModules = T.intercalate " or " (markCode . runModuleName <$> modulesToList) + renderSimpleErrorMessage (InvalidNewtype name) = + paras + [ line $ "Newtype " <> markCode (runProperName name) <> " is invalid." , line "Newtypes must define a single constructor with a single argument." ] - renderSimpleErrorMessage (InvalidInstanceHead ty) = - paras [ line "Type class instance head is invalid due to use of type" + renderSimpleErrorMessage (InvalidInstanceHead ty) = + paras + [ line "Type class instance head is invalid due to use of type" , markCodeBox $ indent $ prettyType ty , line "All types appearing in instance declarations must be of the form T a_1 .. a_n, where each type a_i is of the same form, unless the type is fully determined by other type class arguments via functional dependencies." ] - renderSimpleErrorMessage (TransitiveExportError x ys) = - paras [ line $ "An export for " <> markCode (prettyPrintExport x) <> " requires the following to also be exported: " + renderSimpleErrorMessage (TransitiveExportError x ys) = + paras + [ line $ "An export for " <> markCode (prettyPrintExport x) <> " requires the following to also be exported: " , indent $ paras $ map (line . markCode . prettyPrintExport) ys ] - renderSimpleErrorMessage (TransitiveDctorExportError x ctors) = - paras [ line $ "An export for " <> markCode (prettyPrintExport x) <> " requires the following data constructor" <> (if length ctors == 1 then "" else "s") <> " to also be exported: " + renderSimpleErrorMessage (TransitiveDctorExportError x ctors) = + paras + [ line $ "An export for " <> markCode (prettyPrintExport x) <> " requires the following data constructor" <> (if length ctors == 1 then "" else "s") <> " to also be exported: " , indent $ paras $ map (line . markCode . runProperName) ctors ] - renderSimpleErrorMessage (HiddenConstructors x className) = - paras [ line $ "An export for " <> markCode (prettyPrintExport x) <> " hides data constructors but the type declares an instance of " <> markCode (showQualified runProperName className) <> "." + renderSimpleErrorMessage (HiddenConstructors x className) = + paras + [ line $ "An export for " <> markCode (prettyPrintExport x) <> " hides data constructors but the type declares an instance of " <> markCode (showQualified runProperName className) <> "." , line "Such instance allows to match and construct values of this type, effectively making the constructors public." ] - renderSimpleErrorMessage (ShadowedName nm) = - line $ "Name " <> markCode (showIdent nm) <> " was shadowed." - renderSimpleErrorMessage (ShadowedTypeVar tv) = - line $ "Type variable " <> markCode tv <> " was shadowed." - renderSimpleErrorMessage (UnusedName nm) = - line $ "Name " <> markCode (showIdent nm) <> " was introduced but not used." - renderSimpleErrorMessage (UnusedDeclaration nm) = - line $ "Declaration " <> markCode (showIdent nm) <> " was not used, and is not exported." - renderSimpleErrorMessage (UnusedTypeVar tv) = - line $ "Type variable " <> markCode tv <> " is ambiguous, since it is unused in the polymorphic type which introduces it." - renderSimpleErrorMessage (ImportHidingModule name) = - paras [ line "hiding imports cannot be used to hide modules." + renderSimpleErrorMessage (ShadowedName nm) = + line $ "Name " <> markCode (showIdent nm) <> " was shadowed." + renderSimpleErrorMessage (ShadowedTypeVar tv) = + line $ "Type variable " <> markCode tv <> " was shadowed." + renderSimpleErrorMessage (UnusedName nm) = + line $ "Name " <> markCode (showIdent nm) <> " was introduced but not used." + renderSimpleErrorMessage (UnusedDeclaration nm) = + line $ "Declaration " <> markCode (showIdent nm) <> " was not used, and is not exported." + renderSimpleErrorMessage (UnusedTypeVar tv) = + line $ "Type variable " <> markCode tv <> " is ambiguous, since it is unused in the polymorphic type which introduces it." + renderSimpleErrorMessage (ImportHidingModule name) = + paras + [ line "hiding imports cannot be used to hide modules." , line $ "An attempt was made to hide the import of " <> markCode (runModuleName name) ] - renderSimpleErrorMessage (WildcardInferredType ty ctx) = - paras $ [ line "Wildcard type definition has the inferred type " - , markCodeBox $ indent $ prettyType ty - ] <> renderContext ctx - renderSimpleErrorMessage (HoleInferredType name ty ctx ts) = - let - maxTSResults = 15 - tsResult = case ts of - Just TSAfter{tsAfterIdentifiers=idents} | not (null idents) -> - let - formatTS (names, types) = - let - idBoxes = Box.text . T.unpack . showQualified id <$> names - tyBoxes = (\t -> BoxHelpers.indented - (Box.text ":: " Box.<> prettyType t)) <$> types - longestId = maximum (map Box.cols idBoxes) - in - Box.vcat Box.top $ - zipWith (Box.<>) - (Box.alignHoriz Box.left longestId <$> idBoxes) - tyBoxes - in [ line "You could substitute the hole with one of these values:" - , markCodeBox (indent (formatTS (unzip (take maxTSResults idents)))) - ] - _ -> [] - in - paras $ [ line $ "Hole '" <> markCode name <> "' has the inferred type " - , markCodeBox (indent (prettyTypeWithDepth maxBound ty)) - ] ++ tsResult ++ renderContext ctx - renderSimpleErrorMessage (MissingTypeDeclaration ident ty) = - paras [ line $ "No type declaration was provided for the top-level declaration of " <> markCode (showIdent ident) <> "." + renderSimpleErrorMessage (WildcardInferredType ty ctx) = + paras $ + [ line "Wildcard type definition has the inferred type " + , markCodeBox $ indent $ prettyType ty + ] + <> renderContext ctx + renderSimpleErrorMessage (HoleInferredType name ty ctx ts) = + let + maxTSResults = 15 + tsResult = case ts of + Just TSAfter {tsAfterIdentifiers = idents} + | not (null idents) -> + let + formatTS (names, types) = + let + idBoxes = Box.text . T.unpack . showQualified id <$> names + tyBoxes = + ( \t -> + BoxHelpers.indented + (Box.text ":: " Box.<> prettyType t) + ) + <$> types + longestId = maximum (map Box.cols idBoxes) + in + Box.vcat Box.top $ + zipWith + (Box.<>) + (Box.alignHoriz Box.left longestId <$> idBoxes) + tyBoxes + in + [ line "You could substitute the hole with one of these values:" + , markCodeBox (indent (formatTS (unzip (take maxTSResults idents)))) + ] + _ -> [] + in + paras $ + [ line $ "Hole '" <> markCode name <> "' has the inferred type " + , markCodeBox (indent (prettyTypeWithDepth maxBound ty)) + ] + ++ tsResult + ++ renderContext ctx + renderSimpleErrorMessage (MissingTypeDeclaration ident ty) = + paras + [ line $ "No type declaration was provided for the top-level declaration of " <> markCode (showIdent ident) <> "." , line "It is good practice to provide type declarations as a form of documentation." , line $ "The inferred type of " <> markCode (showIdent ident) <> " was:" , markCodeBox $ indent $ prettyTypeWithDepth maxBound ty ] - renderSimpleErrorMessage (MissingKindDeclaration sig name ty) = - let sigKw = prettyPrintKindSignatureFor sig in - paras [ line $ "The inferred kind for the " <> sigKw <> " declaration " <> markCode (runProperName name) <> " contains polymorphic kinds." - , line "Consider adding a top-level kind signature as a form of documentation." - , markCodeBox $ indent $ Box.hsep 1 Box.left - [ line $ sigKw <> " " <> runProperName name <> " ::" - , prettyTypeWithDepth maxBound ty + renderSimpleErrorMessage (MissingKindDeclaration sig name ty) = + let sigKw = prettyPrintKindSignatureFor sig + in paras + [ line $ "The inferred kind for the " <> sigKw <> " declaration " <> markCode (runProperName name) <> " contains polymorphic kinds." + , line "Consider adding a top-level kind signature as a form of documentation." + , markCodeBox $ + indent $ + Box.hsep + 1 + Box.left + [ line $ sigKw <> " " <> runProperName name <> " ::" + , prettyTypeWithDepth maxBound ty + ] ] + renderSimpleErrorMessage (OverlappingPattern bs b) = + paras $ + [ line "A case expression contains unreachable cases:\n" + , Box.hsep 1 Box.left (map (paras . map (line . prettyPrintBinderAtom)) (transpose bs)) ] - renderSimpleErrorMessage (OverlappingPattern bs b) = - paras $ [ line "A case expression contains unreachable cases:\n" - , Box.hsep 1 Box.left (map (paras . map (line . prettyPrintBinderAtom)) (transpose bs)) - ] ++ - [ line "..." | not b ] - renderSimpleErrorMessage IncompleteExhaustivityCheck = - paras [ line "An exhaustivity check was abandoned due to too many possible cases." + ++ [line "..." | not b] + renderSimpleErrorMessage IncompleteExhaustivityCheck = + paras + [ line "An exhaustivity check was abandoned due to too many possible cases." , line "You may want to decompose your data types into smaller types." ] - - renderSimpleErrorMessage (UnusedImport mn qualifier) = - let - mark = markCode . runModuleName - unqualified = "The import of " <> mark mn <> " is redundant" - msg' q = "The qualified import of " <> mark mn <> " as " <> mark q <> " is redundant" - msg = maybe unqualified msg' - in line $ msg qualifier - - renderSimpleErrorMessage msg@(UnusedExplicitImport mn names _ _) = - paras [ line $ "The import of module " <> markCode (runModuleName mn) <> " contains the following unused references:" + renderSimpleErrorMessage (UnusedImport mn qualifier) = + let + mark = markCode . runModuleName + unqualified = "The import of " <> mark mn <> " is redundant" + msg' q = "The qualified import of " <> mark mn <> " as " <> mark q <> " is redundant" + msg = maybe unqualified msg' + in + line $ msg qualifier + renderSimpleErrorMessage msg@(UnusedExplicitImport mn names _ _) = + paras + [ line $ "The import of module " <> markCode (runModuleName mn) <> " contains the following unused references:" , indent $ paras $ map (line . markCode . runName . Qualified ByNullSourcePos) names , line "It could be replaced with:" - , indent $ line $ markCode $ showSuggestion msg ] - - renderSimpleErrorMessage msg@(UnusedDctorImport mn name _ _) = - paras [line $ "The import of type " <> markCode (runProperName name) - <> " from module " <> markCode (runModuleName mn) <> " includes data constructors but only the type is used" + , indent $ line $ markCode $ showSuggestion msg + ] + renderSimpleErrorMessage msg@(UnusedDctorImport mn name _ _) = + paras + [ line $ + "The import of type " + <> markCode (runProperName name) + <> " from module " + <> markCode (runModuleName mn) + <> " includes data constructors but only the type is used" , line "It could be replaced with:" - , indent $ line $ markCode $ showSuggestion msg ] - - renderSimpleErrorMessage msg@(UnusedDctorExplicitImport mn name names _ _) = - paras [ line $ "The import of type " <> markCode (runProperName name) - <> " from module " <> markCode (runModuleName mn) <> " includes the following unused data constructors:" + , indent $ line $ markCode $ showSuggestion msg + ] + renderSimpleErrorMessage msg@(UnusedDctorExplicitImport mn name names _ _) = + paras + [ line $ + "The import of type " + <> markCode (runProperName name) + <> " from module " + <> markCode (runModuleName mn) + <> " includes the following unused data constructors:" , indent $ paras $ map (line . markCode . runProperName) names , line "It could be replaced with:" - , indent $ line $ markCode $ showSuggestion msg ] - - renderSimpleErrorMessage (DuplicateSelectiveImport name) = - line $ "There is an existing import of " <> markCode (runModuleName name) <> ", consider merging the import lists" - - renderSimpleErrorMessage (DuplicateImport name imp qual) = - line $ "Duplicate import of " <> markCode (prettyPrintImport name imp qual) - - renderSimpleErrorMessage (DuplicateImportRef name) = - line $ "Import list contains multiple references to " <> printName (Qualified ByNullSourcePos name) - - renderSimpleErrorMessage (DuplicateExportRef name) = - line $ "Export list contains multiple references to " <> printName (Qualified ByNullSourcePos name) - - renderSimpleErrorMessage (IntOutOfRange value backend lo hi) = - paras [ line $ "Integer value " <> markCode (T.pack (show value)) <> " is out of range for the " <> backend <> " backend." - , line $ "Acceptable values fall within the range " <> markCode (T.pack (show lo)) <> " to " <> markCode (T.pack (show hi)) <> " (inclusive)." ] - - renderSimpleErrorMessage msg@(ImplicitQualifiedImport importedModule asModule _) = - paras [ line $ "Module " <> markCode (runModuleName importedModule) <> " was imported as " <> markCode (runModuleName asModule) <> " with unspecified imports." + , indent $ line $ markCode $ showSuggestion msg + ] + renderSimpleErrorMessage (DuplicateSelectiveImport name) = + line $ "There is an existing import of " <> markCode (runModuleName name) <> ", consider merging the import lists" + renderSimpleErrorMessage (DuplicateImport name imp qual) = + line $ "Duplicate import of " <> markCode (prettyPrintImport name imp qual) + renderSimpleErrorMessage (DuplicateImportRef name) = + line $ "Import list contains multiple references to " <> printName (Qualified ByNullSourcePos name) + renderSimpleErrorMessage (DuplicateExportRef name) = + line $ "Export list contains multiple references to " <> printName (Qualified ByNullSourcePos name) + renderSimpleErrorMessage (IntOutOfRange value backend lo hi) = + paras + [ line $ "Integer value " <> markCode (T.pack (show value)) <> " is out of range for the " <> backend <> " backend." + , line $ "Acceptable values fall within the range " <> markCode (T.pack (show lo)) <> " to " <> markCode (T.pack (show hi)) <> " (inclusive)." + ] + renderSimpleErrorMessage msg@(ImplicitQualifiedImport importedModule asModule _) = + paras + [ line $ "Module " <> markCode (runModuleName importedModule) <> " was imported as " <> markCode (runModuleName asModule) <> " with unspecified imports." , line $ "As there are multiple modules being imported as " <> markCode (runModuleName asModule) <> ", consider using the explicit form:" , indent $ line $ markCode $ showSuggestion msg ] - renderSimpleErrorMessage msg@(ImplicitQualifiedImportReExport importedModule asModule _) = - paras [ line $ "Module " <> markCode (runModuleName importedModule) <> " was imported as " <> markCode (runModuleName asModule) <> " with unspecified imports." + renderSimpleErrorMessage msg@(ImplicitQualifiedImportReExport importedModule asModule _) = + paras + [ line $ "Module " <> markCode (runModuleName importedModule) <> " was imported as " <> markCode (runModuleName asModule) <> " with unspecified imports." , line "As this module is being re-exported, consider using the explicit form:" , indent $ line $ markCode $ showSuggestion msg ] - - renderSimpleErrorMessage msg@(ImplicitImport mn _) = - paras [ line $ "Module " <> markCode (runModuleName mn) <> " has unspecified imports, consider using the explicit form: " + renderSimpleErrorMessage msg@(ImplicitImport mn _) = + paras + [ line $ "Module " <> markCode (runModuleName mn) <> " has unspecified imports, consider using the explicit form: " , indent $ line $ markCode $ showSuggestion msg ] - - renderSimpleErrorMessage msg@(HidingImport mn _) = - paras [ line $ "Module " <> markCode (runModuleName mn) <> " has unspecified imports, consider using the inclusive form: " + renderSimpleErrorMessage msg@(HidingImport mn _) = + paras + [ line $ "Module " <> markCode (runModuleName mn) <> " has unspecified imports, consider using the inclusive form: " , indent $ line $ markCode $ showSuggestion msg ] - - renderSimpleErrorMessage (CaseBinderLengthDiffers l bs) = - paras [ line "Binder list length differs in case alternative:" + renderSimpleErrorMessage (CaseBinderLengthDiffers l bs) = + paras + [ line "Binder list length differs in case alternative:" , indent $ line $ T.intercalate ", " $ fmap prettyPrintBinderAtom bs , line $ "Expecting " <> T.pack (show l) <> " binder" <> (if l == 1 then "" else "s") <> "." ] - - renderSimpleErrorMessage IncorrectAnonymousArgument = - line "An anonymous function argument appears in an invalid context." - - renderSimpleErrorMessage (InvalidOperatorInBinder op fn) = - paras [ line $ "Operator " <> markCode (showQualified showOp op) <> " cannot be used in a pattern as it is an alias for function " <> showQualified showIdent fn <> "." + renderSimpleErrorMessage IncorrectAnonymousArgument = + line "An anonymous function argument appears in an invalid context." + renderSimpleErrorMessage (InvalidOperatorInBinder op fn) = + paras + [ line $ "Operator " <> markCode (showQualified showOp op) <> " cannot be used in a pattern as it is an alias for function " <> showQualified showIdent fn <> "." , line "Only aliases for data constructors may be used in patterns." ] - - renderSimpleErrorMessage (CannotGeneralizeRecursiveFunction ident ty) = - paras [ line $ "Unable to generalize the type of the recursive function " <> markCode (showIdent ident) <> "." + renderSimpleErrorMessage (CannotGeneralizeRecursiveFunction ident ty) = + paras + [ line $ "Unable to generalize the type of the recursive function " <> markCode (showIdent ident) <> "." , line $ "The inferred type of " <> markCode (showIdent ident) <> " was:" , markCodeBox $ indent $ prettyType ty , line "Try adding a type signature." ] - - renderSimpleErrorMessage (CannotDeriveNewtypeForData tyName) = - paras [ line $ "Cannot derive an instance of the " <> markCode "Newtype" <> " class for non-newtype " <> markCode (runProperName tyName) <> "." + renderSimpleErrorMessage (CannotDeriveNewtypeForData tyName) = + paras + [ line $ "Cannot derive an instance of the " <> markCode "Newtype" <> " class for non-newtype " <> markCode (runProperName tyName) <> "." ] - - renderSimpleErrorMessage (ExpectedWildcard tyName) = - paras [ line $ "Expected a type wildcard (_) when deriving an instance for " <> markCode (runProperName tyName) <> "." + renderSimpleErrorMessage (ExpectedWildcard tyName) = + paras + [ line $ "Expected a type wildcard (_) when deriving an instance for " <> markCode (runProperName tyName) <> "." ] - - renderSimpleErrorMessage (CannotUseBindWithDo name) = - paras [ line $ "The name " <> markCode (showIdent name) <> " cannot be brought into scope in a do notation block, since do notation uses the same name." + renderSimpleErrorMessage (CannotUseBindWithDo name) = + paras + [ line $ "The name " <> markCode (showIdent name) <> " cannot be brought into scope in a do notation block, since do notation uses the same name." ] - - renderSimpleErrorMessage (ClassInstanceArityMismatch dictName className expected actual) = - paras [ line $ "The type class " <> markCode (showQualified runProperName className) <> - " expects " <> T.pack (show expected) <> " " <> argsMsg <> "." + renderSimpleErrorMessage (ClassInstanceArityMismatch dictName className expected actual) = + paras + [ line $ + "The type class " + <> markCode (showQualified runProperName className) + <> " expects " + <> T.pack (show expected) + <> " " + <> argsMsg + <> "." , line $ "But the instance" <> prettyPrintPlainIdent dictName <> mismatchMsg <> T.pack (show actual) <> "." ] - where - mismatchMsg = if actual > expected then " provided " else " only provided " - argsMsg = if expected > 1 then "arguments" else "argument" - - renderSimpleErrorMessage (UserDefinedWarning msgTy) = - let msg = fromMaybe (prettyType msgTy) (toTypelevelString msgTy) in - paras [ line "A custom warning occurred while solving type class constraints:" - , indent msg + where + mismatchMsg = if actual > expected then " provided " else " only provided " + argsMsg = if expected > 1 then "arguments" else "argument" + renderSimpleErrorMessage (UserDefinedWarning msgTy) = + let msg = fromMaybe (prettyType msgTy) (toTypelevelString msgTy) + in paras + [ line "A custom warning occurred while solving type class constraints:" + , indent msg + ] + renderSimpleErrorMessage (CannotDefinePrimModules mn) = + paras + [ line $ "The module name " <> markCode (runModuleName mn) <> " is in the Prim namespace." + , line "The Prim namespace is reserved for compiler-defined terms." ] - - renderSimpleErrorMessage (CannotDefinePrimModules mn) = - paras - [ line $ "The module name " <> markCode (runModuleName mn) <> " is in the Prim namespace." - , line "The Prim namespace is reserved for compiler-defined terms." - ] - - renderSimpleErrorMessage (MixedAssociativityError opsWithAssoc) = - paras - [ line "Cannot parse an expression that uses operators of the same precedence but mixed associativity:" - , indent $ paras $ map (\(name, assoc) -> line $ markCode (showQualified showOp name) <> " is " <> markCode (T.pack (showAssoc assoc))) (NEL.toList opsWithAssoc) - , line "Use parentheses to resolve this ambiguity." - ] - - renderSimpleErrorMessage (NonAssociativeError ops) = - if NEL.length ops == 1 - then + renderSimpleErrorMessage (MixedAssociativityError opsWithAssoc) = paras - [ line $ "Cannot parse an expression that uses multiple instances of the non-associative operator " <> markCode (showQualified showOp (NEL.head ops)) <> "." + [ line "Cannot parse an expression that uses operators of the same precedence but mixed associativity:" + , indent $ paras $ map (\(name, assoc) -> line $ markCode (showQualified showOp name) <> " is " <> markCode (T.pack (showAssoc assoc))) (NEL.toList opsWithAssoc) , line "Use parentheses to resolve this ambiguity." ] - else + renderSimpleErrorMessage (NonAssociativeError ops) = + if NEL.length ops == 1 + then + paras + [ line $ "Cannot parse an expression that uses multiple instances of the non-associative operator " <> markCode (showQualified showOp (NEL.head ops)) <> "." + , line "Use parentheses to resolve this ambiguity." + ] + else + paras + [ line "Cannot parse an expression that uses multiple non-associative operators of the same precedence:" + , indent $ paras $ map (line . markCode . showQualified showOp) (NEL.toList ops) + , line "Use parentheses to resolve this ambiguity." + ] + renderSimpleErrorMessage (QuantificationCheckFailureInKind var) = paras - [ line "Cannot parse an expression that uses multiple non-associative operators of the same precedence:" - , indent $ paras $ map (line . markCode . showQualified showOp) (NEL.toList ops) - , line "Use parentheses to resolve this ambiguity." + [ line $ "Cannot generalize the kind of type variable " <> markCode var <> " since it would not be well-scoped." + , line "Try adding a kind annotation." + ] + renderSimpleErrorMessage (QuantificationCheckFailureInType us ty) = + let unks = + fmap + ( \u -> + Box.hsep + 1 + Box.top + [ "where" + , markCodeBox (prettyType (srcTUnknown u)) + , "is an unknown kind." + ] + ) + us + in paras + [ line "Cannot unambiguously generalize kinds appearing in the elaborated type:" + , indent $ markCodeBox $ typeAsBox prettyDepth ty + , paras unks + , line "Try adding additional kind signatures or polymorphic kind variables." + ] + renderSimpleErrorMessage (VisibleQuantificationCheckFailureInType var) = + paras + [ line $ "Visible dependent quantification of type variable " <> markCode var <> " is not supported." + , line "If you would like this feature supported, please bother Liam Goodacre (@LiamGoodacre)." ] - - renderSimpleErrorMessage (QuantificationCheckFailureInKind var) = - paras - [ line $ "Cannot generalize the kind of type variable " <> markCode var <> " since it would not be well-scoped." - , line "Try adding a kind annotation." - ] - - renderSimpleErrorMessage (QuantificationCheckFailureInType us ty) = - let unks = - fmap (\u -> Box.hsep 1 Box.top [ "where" - , markCodeBox (prettyType (srcTUnknown u)) - , "is an unknown kind." - ]) us - in paras - [ line "Cannot unambiguously generalize kinds appearing in the elaborated type:" - , indent $ markCodeBox $ typeAsBox prettyDepth ty - , paras unks - , line "Try adding additional kind signatures or polymorphic kind variables." - ] - - renderSimpleErrorMessage (VisibleQuantificationCheckFailureInType var) = - paras - [ line $ "Visible dependent quantification of type variable " <> markCode var <> " is not supported." - , line "If you would like this feature supported, please bother Liam Goodacre (@LiamGoodacre)." - ] - - renderSimpleErrorMessage (UnsupportedTypeInKind ty) = - paras - [ line "The type:" - , indent $ markCodeBox $ prettyType ty - , line "is not supported in kinds." - ] - - renderSimpleErrorMessage (RoleMismatch var inferred declared) = - paras - [ line $ "Role mismatch for the type parameter " <> markCode var <> ":" - , indent . line $ - "The annotation says " <> markCode (displayRole declared) <> - " but the role " <> markCode (displayRole inferred) <> - " is required." - ] - - renderSimpleErrorMessage (InvalidCoercibleInstanceDeclaration tys) = - paras - [ line "Invalid type class instance declaration for" - , markCodeBox $ indent $ Box.hsep 1 Box.left - [ line (showQualified runProperName C.Coercible) - , Box.vcat Box.left (map prettyTypeAtom tys) + renderSimpleErrorMessage (UnsupportedTypeInKind ty) = + paras + [ line "The type:" + , indent $ markCodeBox $ prettyType ty + , line "is not supported in kinds." ] - , line "Instance declarations of this type class are disallowed." - ] - - renderSimpleErrorMessage UnsupportedRoleDeclaration = - line "Role declarations are only supported for data types, not for type synonyms nor type classes." - - renderSimpleErrorMessage (RoleDeclarationArityMismatch name expected actual) = - line $ T.intercalate " " - [ "The type" - , markCode (runProperName name) - , "expects" - , T.pack (show expected) - , if expected == 1 then "argument" else "arguments" - , "but its role declaration lists" - <> if actual > expected then "" else " only" - , T.pack (show actual) - , if actual > 1 then "roles" else "role" - ] <> "." - - renderSimpleErrorMessage (DuplicateRoleDeclaration name) = - line $ "Duplicate role declaration for " <> markCode (runProperName name) <> "." - - renderSimpleErrorMessage (CannotDeriveInvalidConstructorArg className relatedClasses checkVariance) = - paras - [ line $ "One or more type variables are in positions that prevent " <> markCode (runProperName $ disqualify className) <> " from being derived." - , line $ "To derive this class, make sure that these variables are only used as the final arguments to type constructors, " - <> (if checkVariance then "that their variance matches the variance of " <> markCode (runProperName $ disqualify className) <> ", " else "") - <> "and that those type constructors themselves have instances of " <> commasAndConjunction "or" (markCode . showQualified runProperName <$> relatedClasses) <> "." - ] - - renderSimpleErrorMessage (CannotSkipTypeApplication tyFn) = - paras - [ "An expression of type:" - , markCodeBox $ indent $ prettyType tyFn - , "cannot be skipped." - ] - - renderSimpleErrorMessage (CannotApplyExpressionOfTypeOnType tyFn tyAr) = - paras $ infoLine <> - [ markCodeBox $ indent $ prettyType tyFn - , "cannot be applied to:" - , markCodeBox $ indent $ prettyType tyAr - ] - where - infoLine = - if isMonoType tyFn then - [ "An expression of monomorphic type:" ] - else - [ "An expression of polymorphic type" - , line $ "with the invisible type variable " <> markCode typeVariable <> ":" - ] - - typeVariable = case tyFn of - ForAll _ _ v _ _ _ -> v - _ -> internalError "renderSimpleErrorMessage: Impossible!" - - renderHint :: ErrorMessageHint -> Box.Box -> Box.Box - renderHint (ErrorUnifyingTypes t1@RCons{} t2@RCons{}) detail = - let (row1Box, row2Box) = printRows t1 t2 - in paras [ detail - , Box.hsep 1 Box.top [ line "while trying to match type" - , row1Box - ] - , Box.moveRight 2 $ Box.hsep 1 Box.top [ line "with type" - , row2Box - ] - ] - renderHint (ErrorUnifyingTypes t1 t2) detail = - paras [ detail - , Box.hsep 1 Box.top [ line "while trying to match type" - , markCodeBox $ typeAsBox prettyDepth t1 - ] - , Box.moveRight 2 $ Box.hsep 1 Box.top [ line "with type" - , markCodeBox $ typeAsBox prettyDepth t2 - ] - ] - renderHint (ErrorInExpression expr) detail = - paras [ detail - , Box.hsep 1 Box.top [ Box.text "in the expression" - , markCodeBox $ markCodeBox $ prettyPrintValue prettyDepth expr - ] - ] - renderHint (ErrorInModule mn) detail = - paras [ line $ "in module " <> markCode (runModuleName mn) + renderSimpleErrorMessage (RoleMismatch var inferred declared) = + paras + [ line $ "Role mismatch for the type parameter " <> markCode var <> ":" + , indent . line $ + "The annotation says " + <> markCode (displayRole declared) + <> " but the role " + <> markCode (displayRole inferred) + <> " is required." + ] + renderSimpleErrorMessage (InvalidCoercibleInstanceDeclaration tys) = + paras + [ line "Invalid type class instance declaration for" + , markCodeBox $ + indent $ + Box.hsep + 1 + Box.left + [ line (showQualified runProperName C.Coercible) + , Box.vcat Box.left (map prettyTypeAtom tys) + ] + , line "Instance declarations of this type class are disallowed." + ] + renderSimpleErrorMessage UnsupportedRoleDeclaration = + line "Role declarations are only supported for data types, not for type synonyms nor type classes." + renderSimpleErrorMessage (RoleDeclarationArityMismatch name expected actual) = + line $ + T.intercalate + " " + [ "The type" + , markCode (runProperName name) + , "expects" + , T.pack (show expected) + , if expected == 1 then "argument" else "arguments" + , "but its role declaration lists" + <> if actual > expected then "" else " only" + , T.pack (show actual) + , if actual > 1 then "roles" else "role" + ] + <> "." + renderSimpleErrorMessage (DuplicateRoleDeclaration name) = + line $ "Duplicate role declaration for " <> markCode (runProperName name) <> "." + renderSimpleErrorMessage (CannotDeriveInvalidConstructorArg className relatedClasses checkVariance) = + paras + [ line $ "One or more type variables are in positions that prevent " <> markCode (runProperName $ disqualify className) <> " from being derived." + , line $ + "To derive this class, make sure that these variables are only used as the final arguments to type constructors, " + <> (if checkVariance then "that their variance matches the variance of " <> markCode (runProperName $ disqualify className) <> ", " else "") + <> "and that those type constructors themselves have instances of " + <> commasAndConjunction "or" (markCode . showQualified runProperName <$> relatedClasses) + <> "." + ] + renderSimpleErrorMessage (CannotSkipTypeApplication tyFn) = + paras + [ "An expression of type:" + , markCodeBox $ indent $ prettyType tyFn + , "cannot be skipped." + ] + renderSimpleErrorMessage (CannotApplyExpressionOfTypeOnType tyFn tyAr) = + paras $ + infoLine + <> [ markCodeBox $ indent $ prettyType tyFn + , "cannot be applied to:" + , markCodeBox $ indent $ prettyType tyAr + ] + where + infoLine = + if isMonoType tyFn + then ["An expression of monomorphic type:"] + else + [ "An expression of polymorphic type" + , line $ "with the invisible type variable " <> markCode typeVariable <> ":" + ] + + typeVariable = case tyFn of + ForAll _ _ v _ _ _ -> v + _ -> internalError "renderSimpleErrorMessage: Impossible!" + + renderHint :: ErrorMessageHint -> Box.Box -> Box.Box + renderHint (ErrorUnifyingTypes t1@RCons {} t2@RCons {}) detail = + let (row1Box, row2Box) = printRows t1 t2 + in paras + [ detail + , Box.hsep + 1 + Box.top + [ line "while trying to match type" + , row1Box + ] + , Box.moveRight 2 $ + Box.hsep + 1 + Box.top + [ line "with type" + , row2Box + ] + ] + renderHint (ErrorUnifyingTypes t1 t2) detail = + paras + [ detail + , Box.hsep + 1 + Box.top + [ line "while trying to match type" + , markCodeBox $ typeAsBox prettyDepth t1 + ] + , Box.moveRight 2 $ + Box.hsep + 1 + Box.top + [ line "with type" + , markCodeBox $ typeAsBox prettyDepth t2 + ] + ] + renderHint (ErrorInExpression expr) detail = + paras + [ detail + , Box.hsep + 1 + Box.top + [ Box.text "in the expression" + , markCodeBox $ markCodeBox $ prettyPrintValue prettyDepth expr + ] + ] + renderHint (ErrorInModule mn) detail = + paras + [ line $ "in module " <> markCode (runModuleName mn) , detail ] - renderHint (ErrorInSubsumption t1 t2) detail = - paras [ detail - , Box.hsep 1 Box.top [ line "while checking that type" - , markCodeBox $ typeAsBox prettyDepth t1 - ] - , Box.moveRight 2 $ Box.hsep 1 Box.top [ line "is at least as general as type" - , markCodeBox $ typeAsBox prettyDepth t2 - ] - ] - renderHint (ErrorInRowLabel lb) detail = - paras [ detail - , Box.hsep 1 Box.top [ line "while matching label" - , markCodeBox $ line $ prettyPrintObjectKey (runLabel lb) - ] - ] - renderHint (ErrorInInstance nm ts) detail = - paras [ detail + renderHint (ErrorInSubsumption t1 t2) detail = + paras + [ detail + , Box.hsep + 1 + Box.top + [ line "while checking that type" + , markCodeBox $ typeAsBox prettyDepth t1 + ] + , Box.moveRight 2 $ + Box.hsep + 1 + Box.top + [ line "is at least as general as type" + , markCodeBox $ typeAsBox prettyDepth t2 + ] + ] + renderHint (ErrorInRowLabel lb) detail = + paras + [ detail + , Box.hsep + 1 + Box.top + [ line "while matching label" + , markCodeBox $ line $ prettyPrintObjectKey (runLabel lb) + ] + ] + renderHint (ErrorInInstance nm ts) detail = + paras + [ detail , line "in type class instance" - , markCodeBox $ indent $ Box.hsep 1 Box.top - [ line $ showQualified runProperName nm - , Box.vcat Box.left (map (typeAtomAsBox prettyDepth) ts) - ] - ] - renderHint (ErrorCheckingKind ty kd) detail = - paras [ detail - , Box.hsep 1 Box.top [ line "while checking that type" - , markCodeBox $ typeAsBox prettyDepth ty - ] - , Box.moveRight 2 $ Box.hsep 1 Box.top [ line "has kind" - , markCodeBox $ typeAsBox prettyDepth kd - ] - ] - renderHint (ErrorInferringKind ty) detail = - paras [ detail - , Box.hsep 1 Box.top [ line "while inferring the kind of" - , markCodeBox $ typeAsBox prettyDepth ty - ] - ] - renderHint ErrorCheckingGuard detail = - paras [ detail + , markCodeBox $ + indent $ + Box.hsep + 1 + Box.top + [ line $ showQualified runProperName nm + , Box.vcat Box.left (map (typeAtomAsBox prettyDepth) ts) + ] + ] + renderHint (ErrorCheckingKind ty kd) detail = + paras + [ detail + , Box.hsep + 1 + Box.top + [ line "while checking that type" + , markCodeBox $ typeAsBox prettyDepth ty + ] + , Box.moveRight 2 $ + Box.hsep + 1 + Box.top + [ line "has kind" + , markCodeBox $ typeAsBox prettyDepth kd + ] + ] + renderHint (ErrorInferringKind ty) detail = + paras + [ detail + , Box.hsep + 1 + Box.top + [ line "while inferring the kind of" + , markCodeBox $ typeAsBox prettyDepth ty + ] + ] + renderHint ErrorCheckingGuard detail = + paras + [ detail , line "while checking the type of a guard clause" ] - renderHint (ErrorInferringType expr) detail = - paras [ detail - , Box.hsep 1 Box.top [ line "while inferring the type of" - , markCodeBox $ prettyPrintValue prettyDepth expr - ] - ] - renderHint (ErrorCheckingType expr ty) detail = - paras [ detail - , Box.hsep 1 Box.top [ line "while checking that expression" - , markCodeBox $ prettyPrintValue prettyDepth expr - ] - , Box.moveRight 2 $ Box.hsep 1 Box.top [ line "has type" - , markCodeBox $ typeAsBox prettyDepth ty - ] - ] - renderHint (ErrorCheckingAccessor expr prop) detail = - paras [ detail - , Box.hsep 1 Box.top [ line "while checking type of property accessor" - , markCodeBox $ prettyPrintValue prettyDepth (Accessor prop expr) - ] - ] - renderHint (ErrorInApplication f t a) detail = - paras [ detail - , Box.hsep 1 Box.top [ line "while applying a function" - , markCodeBox $ prettyPrintValue prettyDepth f - ] - , Box.moveRight 2 $ Box.hsep 1 Box.top [ line "of type" - , markCodeBox $ typeAsBox prettyDepth t - ] - , Box.moveRight 2 $ Box.hsep 1 Box.top [ line "to argument" - , markCodeBox $ prettyPrintValue prettyDepth a - ] - ] - renderHint (ErrorInDataConstructor nm) detail = - paras [ detail + renderHint (ErrorInferringType expr) detail = + paras + [ detail + , Box.hsep + 1 + Box.top + [ line "while inferring the type of" + , markCodeBox $ prettyPrintValue prettyDepth expr + ] + ] + renderHint (ErrorCheckingType expr ty) detail = + paras + [ detail + , Box.hsep + 1 + Box.top + [ line "while checking that expression" + , markCodeBox $ prettyPrintValue prettyDepth expr + ] + , Box.moveRight 2 $ + Box.hsep + 1 + Box.top + [ line "has type" + , markCodeBox $ typeAsBox prettyDepth ty + ] + ] + renderHint (ErrorCheckingAccessor expr prop) detail = + paras + [ detail + , Box.hsep + 1 + Box.top + [ line "while checking type of property accessor" + , markCodeBox $ prettyPrintValue prettyDepth (Accessor prop expr) + ] + ] + renderHint (ErrorInApplication f t a) detail = + paras + [ detail + , Box.hsep + 1 + Box.top + [ line "while applying a function" + , markCodeBox $ prettyPrintValue prettyDepth f + ] + , Box.moveRight 2 $ + Box.hsep + 1 + Box.top + [ line "of type" + , markCodeBox $ typeAsBox prettyDepth t + ] + , Box.moveRight 2 $ + Box.hsep + 1 + Box.top + [ line "to argument" + , markCodeBox $ prettyPrintValue prettyDepth a + ] + ] + renderHint (ErrorInDataConstructor nm) detail = + paras + [ detail , line $ "in data constructor " <> markCode (runProperName nm) ] - renderHint (ErrorInTypeConstructor nm) detail = - paras [ detail + renderHint (ErrorInTypeConstructor nm) detail = + paras + [ detail , line $ "in type constructor " <> markCode (runProperName nm) ] - renderHint (ErrorInBindingGroup nms) detail = - paras [ detail + renderHint (ErrorInBindingGroup nms) detail = + paras + [ detail , line $ "in binding group " <> T.intercalate ", " (NEL.toList (fmap showIdent nms)) ] - renderHint (ErrorInDataBindingGroup nms) detail = - paras [ detail + renderHint (ErrorInDataBindingGroup nms) detail = + paras + [ detail , line $ "in data binding group " <> T.intercalate ", " (map runProperName nms) ] - renderHint (ErrorInTypeSynonym name) detail = - paras [ detail + renderHint (ErrorInTypeSynonym name) detail = + paras + [ detail , line $ "in type synonym " <> markCode (runProperName name) ] - renderHint (ErrorInValueDeclaration n) detail = - paras [ detail + renderHint (ErrorInValueDeclaration n) detail = + paras + [ detail , line $ "in value declaration " <> markCode (showIdent n) ] - renderHint (ErrorInTypeDeclaration n) detail = - paras [ detail + renderHint (ErrorInTypeDeclaration n) detail = + paras + [ detail , line $ "in type declaration for " <> markCode (showIdent n) ] - renderHint (ErrorInTypeClassDeclaration name) detail = - paras [ detail + renderHint (ErrorInTypeClassDeclaration name) detail = + paras + [ detail , line $ "in type class declaration for " <> markCode (runProperName name) ] - renderHint (ErrorInKindDeclaration name) detail = - paras [ detail + renderHint (ErrorInKindDeclaration name) detail = + paras + [ detail , line $ "in kind declaration for " <> markCode (runProperName name) ] - renderHint (ErrorInRoleDeclaration name) detail = - paras [ detail + renderHint (ErrorInRoleDeclaration name) detail = + paras + [ detail , line $ "in role declaration for " <> markCode (runProperName name) ] - renderHint (ErrorInForeignImport nm) detail = - paras [ detail + renderHint (ErrorInForeignImport nm) detail = + paras + [ detail , line $ "in foreign import " <> markCode (showIdent nm) ] - renderHint (ErrorInForeignImportData nm) detail = - paras [ detail + renderHint (ErrorInForeignImportData nm) detail = + paras + [ detail , line $ "in foreign data type declaration for " <> markCode (runProperName nm) ] - renderHint (ErrorSolvingConstraint (Constraint _ nm _ ts _)) detail = - paras [ detail + renderHint (ErrorSolvingConstraint (Constraint _ nm _ ts _)) detail = + paras + [ detail , line "while solving type class constraint" - , markCodeBox $ indent $ Box.hsep 1 Box.left - [ line (showQualified runProperName nm) - , Box.vcat Box.left (map (typeAtomAsBox prettyDepth) ts) - ] + , markCodeBox $ + indent $ + Box.hsep + 1 + Box.left + [ line (showQualified runProperName nm) + , Box.vcat Box.left (map (typeAtomAsBox prettyDepth) ts) + ] ] - renderHint (MissingConstructorImportForCoercible name) detail = - paras - [ detail - , Box.moveUp 1 $ Box.moveRight 2 $ line $ "Solving this instance requires the newtype constructor " <> markCode (showQualified runProperName name) <> " to be in scope." - ] - renderHint (PositionedError srcSpan) detail = - paras [ line $ "at " <> displaySourceSpan relPath (NEL.head srcSpan) + renderHint (MissingConstructorImportForCoercible name) detail = + paras + [ detail + , Box.moveUp 1 $ Box.moveRight 2 $ line $ "Solving this instance requires the newtype constructor " <> markCode (showQualified runProperName name) <> " to be in scope." + ] + renderHint (PositionedError srcSpan) detail = + paras + [ line $ "at " <> displaySourceSpan relPath (NEL.head srcSpan) , detail ] - renderHint (RelatedPositions srcSpans) detail = - paras - [ detail - , Box.moveRight 2 $ showSourceSpansInContext srcSpans - ] - - printRow :: (Int -> Type a -> Box.Box) -> Type a -> Box.Box - printRow f = markCodeBox . indent . f prettyDepth . - if full then id else eraseForAllKindAnnotations . eraseKindApps - - -- If both rows are not empty, print them as diffs - -- If verbose print all rows else only print unique rows - printRows :: Type a -> Type a -> (Box.Box, Box.Box) - printRows r1 r2 = case (full, r1, r2) of - (True, _ , _) -> (printRow typeAsBox r1, printRow typeAsBox r2) - - (_, RCons{}, RCons{}) -> - let (sorted1, sorted2) = filterRows (rowToList r1) (rowToList r2) - in (printRow typeDiffAsBox sorted1, printRow typeDiffAsBox sorted2) - - (_, _, _) -> (printRow typeAsBox r1, printRow typeAsBox r2) - - - -- Keep the unique labels only - filterRows :: ([RowListItem a], Type a) -> ([RowListItem a], Type a) -> (Type a, Type a) - filterRows (s1, r1) (s2, r2) = - let sort' = sortOn $ \(RowListItem _ name ty) -> (name, ty) - (unique1, unique2) = diffSortedRowLists (sort' s1, sort' s2) - in ( rowFromList (unique1, r1) - , rowFromList (unique2, r2) - ) - - -- Importantly, this removes exactly the same number of elements from - -- both lists, even if there are repeated (name, ty) keys. It requires - -- the inputs to be sorted but ensures that the outputs remain sorted. - diffSortedRowLists :: ([RowListItem a], [RowListItem a]) -> ([RowListItem a], [RowListItem a]) - diffSortedRowLists = go where - go = \case - (s1@(h1@(RowListItem _ name1 ty1) : t1), s2@(h2@(RowListItem _ name2 ty2) : t2)) -> - case (name1, ty1) `compare` (name2, ty2) of - EQ -> go (t1, t2) - LT -> first (h1:) $ go (t1, s2) - GT -> second (h2:) $ go (s1, t2) - other -> other - - renderContext :: Context -> [Box.Box] - renderContext [] = [] - renderContext ctx = - [ line "in the following context:" - , indent $ paras - [ Box.hcat Box.left [ Box.text (T.unpack (showIdent ident) ++ " :: ") - , markCodeBox $ typeAsBox prettyDepth ty' - ] - | (ident, ty') <- take 30 ctx + renderHint (RelatedPositions srcSpans) detail = + paras + [ detail + , Box.moveRight 2 $ showSourceSpansInContext srcSpans + ] + + printRow :: (Int -> Type a -> Box.Box) -> Type a -> Box.Box + printRow f = + markCodeBox + . indent + . f prettyDepth + . if full then id else eraseKindApps + + -- If both rows are not empty, print them as diffs + -- If verbose print all rows else only print unique rows + printRows :: (Show a) => Type a -> Type a -> (Box.Box, Box.Box) + printRows r1 r2 = case (full, r1, r2) of + (True, _, _) -> (printRow typeAsBox r1, printRow typeAsBox r2) + (_, RCons {}, RCons {}) -> + let (sorted1, sorted2) = filterRows (rowToList r1) (rowToList r2) + in (printRow typeDiffAsBox sorted1, printRow typeDiffAsBox sorted2) + (_, _, _) -> (printRow typeAsBox r1, printRow typeAsBox r2) + + -- Keep the unique labels only + filterRows :: ([RowListItem a], Type a) -> ([RowListItem a], Type a) -> (Type a, Type a) + filterRows (s1, r1) (s2, r2) = + let sort' = sortOn $ \(RowListItem _ name ty) -> (name, ty) + (unique1, unique2) = diffSortedRowLists (sort' s1, sort' s2) + in ( rowFromList (unique1, r1) + , rowFromList (unique2, r2) + ) + + -- Importantly, this removes exactly the same number of elements from + -- both lists, even if there are repeated (name, ty) keys. It requires + -- the inputs to be sorted but ensures that the outputs remain sorted. + diffSortedRowLists :: ([RowListItem a], [RowListItem a]) -> ([RowListItem a], [RowListItem a]) + diffSortedRowLists = go + where + go = \case + (s1@(h1@(RowListItem _ name1 ty1) : t1), s2@(h2@(RowListItem _ name2 ty2) : t2)) -> + case (name1, ty1) `compare` (name2, ty2) of + EQ -> go (t1, t2) + LT -> first (h1 :) $ go (t1, s2) + GT -> second (h2 :) $ go (s1, t2) + other -> other + + renderContext :: Context -> [Box.Box] + renderContext [] = [] + renderContext ctx = + [ line "in the following context:" + , indent $ + paras + [ Box.hcat + Box.left + [ Box.text (T.unpack (showIdent ident) ++ " :: ") + , markCodeBox $ typeAsBox prettyDepth ty' + ] + | (ident, ty') <- take 30 ctx + ] ] - ] - printName :: Qualified Name -> Text - printName qn = nameType (disqualify qn) <> " " <> markCode (runName qn) - - nameType :: Name -> Text - nameType (IdentName _) = "value" - nameType (ValOpName _) = "operator" - nameType (TyName _) = "type" - nameType (TyOpName _) = "type operator" - nameType (DctorName _) = "data constructor" - nameType (TyClassName _) = "type class" - nameType (ModName _) = "module" - - runName :: Qualified Name -> Text - runName (Qualified qb (IdentName name)) = - showQualified showIdent (Qualified qb name) - runName (Qualified qb (ValOpName op)) = - showQualified showOp (Qualified qb op) - runName (Qualified qb (TyName name)) = - showQualified runProperName (Qualified qb name) - runName (Qualified qb (TyOpName op)) = - showQualified showOp (Qualified qb op) - runName (Qualified qb (DctorName name)) = - showQualified runProperName (Qualified qb name) - runName (Qualified qb (TyClassName name)) = - showQualified runProperName (Qualified qb name) - runName (Qualified (BySourcePos _) (ModName name)) = - runModuleName name - runName (Qualified _ ModName{}) = - internalError "qualified ModName in runName" - - prettyDepth :: Int - prettyDepth | full = 1000 - | otherwise = 3 - - prettyType :: Type a -> Box.Box - prettyType = prettyTypeWithDepth prettyDepth - - prettyTypeWithDepth :: Int -> Type a -> Box.Box - prettyTypeWithDepth depth - | full = typeAsBox depth - | otherwise = typeAsBox depth . eraseForAllKindAnnotations . eraseKindApps - - prettyTypeAtom :: Type a -> Box.Box - prettyTypeAtom - | full = typeAtomAsBox prettyDepth - | otherwise = typeAtomAsBox prettyDepth . eraseForAllKindAnnotations . eraseKindApps - - levelText :: Text - levelText = case level of - Error -> "error" - Warning -> "warning" - - paras :: forall f. Foldable f => f Box.Box -> Box.Box - paras = Box.vcat Box.left - - -- Simplify an error message - simplifyErrorMessage :: ErrorMessage -> ErrorMessage - simplifyErrorMessage (ErrorMessage hints simple) = ErrorMessage (simplifyHints hints) simple - where - -- Take the last instance of each "hint category" - simplifyHints :: [ErrorMessageHint] -> [ErrorMessageHint] - simplifyHints = reverse . nubBy categoriesEqual . stripRedundantHints simple . reverse - - -- Don't remove hints in the "other" category - categoriesEqual :: ErrorMessageHint -> ErrorMessageHint -> Bool - categoriesEqual x y = - case (hintCategory x, hintCategory y) of - (OtherHint, _) -> False - (_, OtherHint) -> False - (c1, c2) -> c1 == c2 - - -- See https://github.com/purescript/purescript/issues/1802 - stripRedundantHints :: SimpleErrorMessage -> [ErrorMessageHint] -> [ErrorMessageHint] - stripRedundantHints ExprDoesNotHaveType{} = stripFirst isCheckHint - where - isCheckHint ErrorCheckingType{} = True - isCheckHint _ = False - stripRedundantHints TypesDoNotUnify{} = stripFirst isUnifyHint - where - isUnifyHint ErrorUnifyingTypes{} = True - isUnifyHint _ = False - stripRedundantHints (NoInstanceFound (Constraint _ C.Coercible _ args _) _ _) = filter (not . isSolverHint) - where - isSolverHint (ErrorSolvingConstraint (Constraint _ C.Coercible _ args' _)) = args == args' - isSolverHint _ = False - stripRedundantHints NoInstanceFound{} = stripFirst isSolverHint - where - isSolverHint ErrorSolvingConstraint{} = True - isSolverHint _ = False - stripRedundantHints _ = id - - stripFirst :: (ErrorMessageHint -> Bool) -> [ErrorMessageHint] -> [ErrorMessageHint] - stripFirst p (PositionedError pos : hs) = PositionedError pos : stripFirst p hs - stripFirst p (ErrorInModule mn : hs) = ErrorInModule mn : stripFirst p hs - stripFirst p (hint : hs) - | p hint = hs - | otherwise = hint : hs - stripFirst _ [] = [] - - hintCategory :: ErrorMessageHint -> HintCategory - hintCategory ErrorCheckingType{} = ExprHint - hintCategory ErrorInferringType{} = ExprHint - hintCategory ErrorInExpression{} = ExprHint - hintCategory ErrorUnifyingTypes{} = CheckHint - hintCategory ErrorInSubsumption{} = CheckHint - hintCategory ErrorInApplication{} = CheckHint - hintCategory ErrorCheckingKind{} = CheckHint - hintCategory ErrorSolvingConstraint{} = SolverHint - hintCategory PositionedError{} = PositionHint - hintCategory ErrorInDataConstructor{} = DeclarationHint - hintCategory ErrorInTypeConstructor{} = DeclarationHint - hintCategory ErrorInBindingGroup{} = DeclarationHint - hintCategory ErrorInDataBindingGroup{} = DeclarationHint - hintCategory ErrorInTypeSynonym{} = DeclarationHint - hintCategory ErrorInValueDeclaration{} = DeclarationHint - hintCategory ErrorInTypeDeclaration{} = DeclarationHint - hintCategory ErrorInTypeClassDeclaration{} = DeclarationHint - hintCategory ErrorInKindDeclaration{} = DeclarationHint - hintCategory ErrorInRoleDeclaration{} = DeclarationHint - hintCategory ErrorInForeignImport{} = DeclarationHint - hintCategory _ = OtherHint - - prettyPrintPlainIdent :: Ident -> Text - prettyPrintPlainIdent ident = - if isPlainIdent ident - then " " <> markCode (showIdent ident) - else "" - - prettyInstanceName :: Qualified (Either SourceType Ident) -> Box.Box - prettyInstanceName = \case - Qualified qb (Left ty) -> - "instance " - Box.<> (case qb of - ByModuleName mn -> "in module " - Box.<> line (markCode $ runModuleName mn) - Box.<> " " - _ -> Box.nullBox) - Box.<> "with type " - Box.<> markCodeBox (prettyType ty) - Box.<> " " - Box.<> (line . displayStartEndPos . fst $ getAnnForType ty) - Qualified mn (Right inst) -> line . markCode . showQualified showIdent $ Qualified mn inst - - -- As of this writing, this function assumes that all provided SourceSpans - -- are non-overlapping (except for exact duplicates) and span no line breaks. A - -- more sophisticated implementation without this limitation would be possible - -- but isn't yet needed. - showSourceSpansInContext :: NonEmpty SourceSpan -> Box.Box - showSourceSpansInContext - = maybe Box.nullBox (paras . fmap renderFile . NEL.groupWith1 spanName . NEL.sort) - . NEL.nonEmpty - . NEL.filter ((> 0) . sourcePosLine . spanStart) - where - renderFile :: NonEmpty SourceSpan -> Box.Box - renderFile sss = maybe Box.nullBox (linesToBox . T.lines) $ lookup fileName fileContents - where - fileName = spanName $ NEL.head sss - header = lineS . (<> ":") . makeRelative relPath $ fileName - lineBlocks = makeLineBlocks $ NEL.groupWith1 (sourcePosLine . spanStart) sss - - linesToBox fileLines = Box.moveUp 1 $ header Box.// body - where - body - = Box.punctuateV Box.left (lineNumberStyle "...") - . map (paras . fmap renderLine) - . flip evalState (fileLines, 1) - . traverse (wither (\(i, x) -> fmap (i, , x) <$> ascLookupInState i) . NEL.toList) - $ NEL.toList lineBlocks - - makeLineBlocks :: NonEmpty (NonEmpty SourceSpan) -> NonEmpty (NonEmpty (Int, [SourceSpan])) - makeLineBlocks = startBlock + printName :: Qualified Name -> Text + printName qn = nameType (disqualify qn) <> " " <> markCode (runName qn) + + nameType :: Name -> Text + nameType (IdentName _) = "value" + nameType (ValOpName _) = "operator" + nameType (TyName _) = "type" + nameType (TyOpName _) = "type operator" + nameType (DctorName _) = "data constructor" + nameType (TyClassName _) = "type class" + nameType (ModName _) = "module" + + runName :: Qualified Name -> Text + runName (Qualified qb (IdentName name)) = + showQualified showIdent (Qualified qb name) + runName (Qualified qb (ValOpName op)) = + showQualified showOp (Qualified qb op) + runName (Qualified qb (TyName name)) = + showQualified runProperName (Qualified qb name) + runName (Qualified qb (TyOpName op)) = + showQualified showOp (Qualified qb op) + runName (Qualified qb (DctorName name)) = + showQualified runProperName (Qualified qb name) + runName (Qualified qb (TyClassName name)) = + showQualified runProperName (Qualified qb name) + runName (Qualified (BySourcePos _) (ModName name)) = + runModuleName name + runName (Qualified _ ModName {}) = + internalError "qualified ModName in runName" + + prettyDepth :: Int + prettyDepth + | full = 1000 + | otherwise = 3 + + prettyType :: SourceType -> Box.Box + prettyType = Box.text . prettyTypeStr + + prettyTypeWithDepth :: (Show a) => Int -> Type a -> Box.Box + prettyTypeWithDepth depth + | full = typeAsBox depth + | otherwise = typeAsBox depth . eraseKindApps + + prettyTypeAtom :: Type a -> Box.Box + prettyTypeAtom + | full = typeAtomAsBox prettyDepth + | otherwise = typeAtomAsBox prettyDepth . eraseKindApps + + levelText :: Text + levelText = case level of + Error -> "error" + Warning -> "warning" + + paras :: forall f. (Foldable f) => f Box.Box -> Box.Box + paras = Box.vcat Box.left + + -- Simplify an error message + simplifyErrorMessage :: ErrorMessage -> ErrorMessage + simplifyErrorMessage (ErrorMessage hints simple) = ErrorMessage (simplifyHints hints) simple where - startBlock (h :| t) = over head1 (NEL.cons (pred $ headLineNumber h, [])) $ continueBlock h t - - continueBlock :: NonEmpty SourceSpan -> [NonEmpty SourceSpan] -> NonEmpty (NonEmpty (Int, [SourceSpan])) - continueBlock lineGroup = \case - [] -> - endBlock lineGroup [] - nextGroup : groups -> case pred $ ((-) `on` headLineNumber) nextGroup lineGroup of - n | n <= 3 -> - over head1 (appendExtraLines n lineGroup <>) $ continueBlock nextGroup groups - _ -> - endBlock lineGroup . NEL.toList . startBlock $ nextGroup :| groups - - endBlock :: NonEmpty SourceSpan -> [NonEmpty (Int, [SourceSpan])] -> NonEmpty (NonEmpty (Int, [SourceSpan])) - endBlock h t = appendExtraLines 1 h :| t - - headLineNumber = sourcePosLine . spanStart . NEL.head - - appendExtraLines :: Int -> NonEmpty SourceSpan -> NonEmpty (Int, [SourceSpan]) - appendExtraLines n lineGroup = (lineNum, NEL.toList lineGroup) :| [(lineNum + i, []) | i <- [1..n]] - where - lineNum = headLineNumber lineGroup - - renderLine :: (Int, Text, [SourceSpan]) -> Box.Box - renderLine (lineNum, text, sss) = numBox Box.<+> lineBox + -- Take the last instance of each "hint category" + simplifyHints :: [ErrorMessageHint] -> [ErrorMessageHint] + simplifyHints = reverse . nubBy categoriesEqual . stripRedundantHints simple . reverse + + -- Don't remove hints in the "other" category + categoriesEqual :: ErrorMessageHint -> ErrorMessageHint -> Bool + categoriesEqual x y = + case (hintCategory x, hintCategory y) of + (OtherHint, _) -> False + (_, OtherHint) -> False + (c1, c2) -> c1 == c2 + + -- See https://github.com/purescript/purescript/issues/1802 + stripRedundantHints :: SimpleErrorMessage -> [ErrorMessageHint] -> [ErrorMessageHint] + stripRedundantHints ExprDoesNotHaveType {} = stripFirst isCheckHint + where + isCheckHint ErrorCheckingType {} = True + isCheckHint _ = False + stripRedundantHints TypesDoNotUnify {} = stripFirst isUnifyHint + where + isUnifyHint ErrorUnifyingTypes {} = True + isUnifyHint _ = False + stripRedundantHints (NoInstanceFound (Constraint _ C.Coercible _ args _) _ _) = filter (not . isSolverHint) + where + isSolverHint (ErrorSolvingConstraint (Constraint _ C.Coercible _ args' _)) = args == args' + isSolverHint _ = False + stripRedundantHints NoInstanceFound {} = stripFirst isSolverHint + where + isSolverHint ErrorSolvingConstraint {} = True + isSolverHint _ = False + stripRedundantHints _ = id + + stripFirst :: (ErrorMessageHint -> Bool) -> [ErrorMessageHint] -> [ErrorMessageHint] + stripFirst p (PositionedError pos : hs) = PositionedError pos : stripFirst p hs + stripFirst p (ErrorInModule mn : hs) = ErrorInModule mn : stripFirst p hs + stripFirst p (hint : hs) + | p hint = hs + | otherwise = hint : hs + stripFirst _ [] = [] + + hintCategory :: ErrorMessageHint -> HintCategory + hintCategory ErrorCheckingType {} = ExprHint + hintCategory ErrorInferringType {} = ExprHint + hintCategory ErrorInExpression {} = ExprHint + hintCategory ErrorUnifyingTypes {} = CheckHint + hintCategory ErrorInSubsumption {} = CheckHint + hintCategory ErrorInApplication {} = CheckHint + hintCategory ErrorCheckingKind {} = CheckHint + hintCategory ErrorSolvingConstraint {} = SolverHint + hintCategory PositionedError {} = PositionHint + hintCategory ErrorInDataConstructor {} = DeclarationHint + hintCategory ErrorInTypeConstructor {} = DeclarationHint + hintCategory ErrorInBindingGroup {} = DeclarationHint + hintCategory ErrorInDataBindingGroup {} = DeclarationHint + hintCategory ErrorInTypeSynonym {} = DeclarationHint + hintCategory ErrorInValueDeclaration {} = DeclarationHint + hintCategory ErrorInTypeDeclaration {} = DeclarationHint + hintCategory ErrorInTypeClassDeclaration {} = DeclarationHint + hintCategory ErrorInKindDeclaration {} = DeclarationHint + hintCategory ErrorInRoleDeclaration {} = DeclarationHint + hintCategory ErrorInForeignImport {} = DeclarationHint + hintCategory _ = OtherHint + + prettyPrintPlainIdent :: Ident -> Text + prettyPrintPlainIdent ident = + if isPlainIdent ident + then " " <> markCode (showIdent ident) + else "" + + prettyInstanceName :: Qualified (Either SourceType Ident) -> Box.Box + prettyInstanceName = \case + Qualified qb (Left ty) -> + "instance " + Box.<> ( case qb of + ByModuleName mn -> + "in module " + Box.<> line (markCode $ runModuleName mn) + Box.<> " " + _ -> Box.nullBox + ) + Box.<> "with type " + Box.<> markCodeBox (prettyType ty) + Box.<> " " + Box.<> (line . displayStartEndPos . fst $ getAnnForType ty) + Qualified mn (Right inst) -> line . markCode . showQualified showIdent $ Qualified mn inst + + -- As of this writing, this function assumes that all provided SourceSpans + -- are non-overlapping (except for exact duplicates) and span no line breaks. A + -- more sophisticated implementation without this limitation would be possible + -- but isn't yet needed. + showSourceSpansInContext :: NonEmpty SourceSpan -> Box.Box + showSourceSpansInContext = + maybe Box.nullBox (paras . fmap renderFile . NEL.groupWith1 spanName . NEL.sort) + . NEL.nonEmpty + . NEL.filter ((> 0) . sourcePosLine . spanStart) where - colSpans = nubOrdOn fst $ map (over both (pred . sourcePosColumn) . (spanStart &&& spanEnd)) sss - numBox = lineNumberStyle $ show lineNum - lineBox = - if isJust codeColor - then colorCodeBox codeColor $ line $ foldr highlightSpan text colSpans - else line text Box.// line (finishUnderline $ foldr underlineSpan (T.length text, "") colSpans) - - highlightSpan :: (Int, Int) -> Text -> Text - highlightSpan (startCol, endCol) text - = prefix - <> T.pack (ANSI.setSGRCode [ANSI.SetSwapForegroundBackground True]) - <> spanText - <> T.pack (ANSI.setSGRCode [ANSI.SetSwapForegroundBackground False]) - <> suffix - where - (prefix, rest) = T.splitAt startCol text - (spanText, suffix) = T.splitAt (endCol - startCol) rest - - underlineSpan :: (Int, Int) -> (Int, Text) -> (Int, Text) - underlineSpan (startCol, endCol) (len, accum) = (startCol, T.replicate (endCol - startCol) "^" <> T.replicate (len - endCol) " " <> accum) - - finishUnderline :: (Int, Text) -> Text - finishUnderline (len, accum) = T.replicate len " " <> accum - - lineNumberStyle :: String -> Box.Box - lineNumberStyle = colorCodeBox (codeColor $> (ANSI.Vivid, ANSI.Black)) . Box.alignHoriz Box.right 5 . lineS - - -- Lookup the nth element of a list, but without retraversing the list every - -- time, by instead keeping a tail of the list and the current element number - -- in State. Only works if the argument provided is strictly ascending over - -- the life of the State. - ascLookupInState :: forall a. Int -> State ([a], Int) (Maybe a) - ascLookupInState j = get >>= \(as, i) -> for (uncons $ drop (j - i) as) $ \(a, as') -> put (as', succ j) $> a + renderFile :: NonEmpty SourceSpan -> Box.Box + renderFile sss = maybe Box.nullBox (linesToBox . T.lines) $ lookup fileName fileContents + where + fileName = spanName $ NEL.head sss + header = lineS . (<> ":") . makeRelative relPath $ fileName + lineBlocks = makeLineBlocks $ NEL.groupWith1 (sourcePosLine . spanStart) sss + + linesToBox fileLines = Box.moveUp 1 $ header Box.// body + where + body = + Box.punctuateV Box.left (lineNumberStyle "...") + . map (paras . fmap renderLine) + . flip evalState (fileLines, 1) + . traverse (wither (\(i, x) -> fmap (i,,x) <$> ascLookupInState i) . NEL.toList) + $ NEL.toList lineBlocks + + makeLineBlocks :: NonEmpty (NonEmpty SourceSpan) -> NonEmpty (NonEmpty (Int, [SourceSpan])) + makeLineBlocks = startBlock + where + startBlock (h :| t) = over head1 (NEL.cons (pred $ headLineNumber h, [])) $ continueBlock h t + + continueBlock :: NonEmpty SourceSpan -> [NonEmpty SourceSpan] -> NonEmpty (NonEmpty (Int, [SourceSpan])) + continueBlock lineGroup = \case + [] -> + endBlock lineGroup [] + nextGroup : groups -> case pred $ ((-) `on` headLineNumber) nextGroup lineGroup of + n + | n <= 3 -> + over head1 (appendExtraLines n lineGroup <>) $ continueBlock nextGroup groups + _ -> + endBlock lineGroup . NEL.toList . startBlock $ nextGroup :| groups + + endBlock :: NonEmpty SourceSpan -> [NonEmpty (Int, [SourceSpan])] -> NonEmpty (NonEmpty (Int, [SourceSpan])) + endBlock h t = appendExtraLines 1 h :| t + + headLineNumber = sourcePosLine . spanStart . NEL.head + + appendExtraLines :: Int -> NonEmpty SourceSpan -> NonEmpty (Int, [SourceSpan]) + appendExtraLines n lineGroup = (lineNum, NEL.toList lineGroup) :| [(lineNum + i, []) | i <- [1 .. n]] + where + lineNum = headLineNumber lineGroup + + renderLine :: (Int, Text, [SourceSpan]) -> Box.Box + renderLine (lineNum, text, sss) = numBox Box.<+> lineBox + where + colSpans = nubOrdOn fst $ map (over both (pred . sourcePosColumn) . (spanStart &&& spanEnd)) sss + numBox = lineNumberStyle $ show lineNum + lineBox = + if isJust codeColor + then colorCodeBox codeColor $ line $ foldr highlightSpan text colSpans + else line text Box.// line (finishUnderline $ foldr underlineSpan (T.length text, "") colSpans) + + highlightSpan :: (Int, Int) -> Text -> Text + highlightSpan (startCol, endCol) text = + prefix + <> T.pack (ANSI.setSGRCode [ANSI.SetSwapForegroundBackground True]) + <> spanText + <> T.pack (ANSI.setSGRCode [ANSI.SetSwapForegroundBackground False]) + <> suffix + where + (prefix, rest) = T.splitAt startCol text + (spanText, suffix) = T.splitAt (endCol - startCol) rest + + underlineSpan :: (Int, Int) -> (Int, Text) -> (Int, Text) + underlineSpan (startCol, endCol) (len, accum) = (startCol, T.replicate (endCol - startCol) "^" <> T.replicate (len - endCol) " " <> accum) + + finishUnderline :: (Int, Text) -> Text + finishUnderline (len, accum) = T.replicate len " " <> accum + + lineNumberStyle :: String -> Box.Box + lineNumberStyle = colorCodeBox (codeColor $> (ANSI.Vivid, ANSI.Black)) . Box.alignHoriz Box.right 5 . lineS + + -- Lookup the nth element of a list, but without retraversing the list every + -- time, by instead keeping a tail of the list and the current element number + -- in State. Only works if the argument provided is strictly ascending over + -- the life of the State. + ascLookupInState :: forall a. Int -> State ([a], Int) (Maybe a) + ascLookupInState j = get >>= \(as, i) -> for (uncons $ drop (j - i) as) $ \(a, as') -> put (as', succ j) $> a -- Pretty print and export declaration prettyPrintExport :: DeclarationRef -> Text @@ -1897,10 +2192,10 @@ prettyPrintExport ref = prettyPrintImport :: ModuleName -> ImportDeclarationType -> Maybe ModuleName -> Text prettyPrintImport mn idt qual = let i = case idt of - Implicit -> runModuleName mn - Explicit refs -> runModuleName mn <> " (" <> T.intercalate ", " (mapMaybe prettyPrintRef refs) <> ")" - Hiding refs -> runModuleName mn <> " hiding (" <> T.intercalate ", " (mapMaybe prettyPrintRef refs) <> ")" - in i <> maybe "" (\q -> " as " <> runModuleName q) qual + Implicit -> runModuleName mn + Explicit refs -> runModuleName mn <> " (" <> T.intercalate ", " (mapMaybe prettyPrintRef refs) <> ")" + Hiding refs -> runModuleName mn <> " hiding (" <> T.intercalate ", " (mapMaybe prettyPrintRef refs) <> ")" + in i <> maybe "" (\q -> " as " <> runModuleName q) qual prettyPrintRef :: DeclarationRef -> Maybe Text prettyPrintRef (TypeRef _ pn Nothing) = @@ -1923,7 +2218,7 @@ prettyPrintRef (TypeInstanceRef _ _ CompilerNamed) = Nothing prettyPrintRef (ModuleRef _ name) = Just $ "module " <> runModuleName name -prettyPrintRef ReExportRef{} = +prettyPrintRef ReExportRef {} = Nothing prettyPrintKindSignatureFor :: KindSignatureFor -> Text @@ -1933,7 +2228,7 @@ prettyPrintKindSignatureFor TypeSynonymSig = "type" prettyPrintKindSignatureFor ClassSig = "class" prettyPrintSuggestedTypeSimplified :: Type a -> String -prettyPrintSuggestedTypeSimplified = prettyPrintSuggestedType . eraseForAllKindAnnotations . eraseKindApps +prettyPrintSuggestedTypeSimplified = prettyPrintSuggestedType . eraseKindApps -- | Pretty print multiple errors prettyPrintMultipleErrors :: PPEOptions -> MultipleErrors -> String @@ -1945,26 +2240,29 @@ prettyPrintMultipleWarnings ppeOptions = unlines . map renderBox . prettyPrintMu -- | Pretty print warnings as a Box prettyPrintMultipleWarningsBox :: PPEOptions -> MultipleErrors -> [Box.Box] -prettyPrintMultipleWarningsBox ppeOptions = prettyPrintMultipleErrorsWith (ppeOptions { ppeLevel = Warning }) "Warning found:" "Warning" +prettyPrintMultipleWarningsBox ppeOptions = prettyPrintMultipleErrorsWith (ppeOptions {ppeLevel = Warning}) "Warning found:" "Warning" -- | Pretty print errors as a Box prettyPrintMultipleErrorsBox :: PPEOptions -> MultipleErrors -> [Box.Box] -prettyPrintMultipleErrorsBox ppeOptions = prettyPrintMultipleErrorsWith (ppeOptions { ppeLevel = Error }) "Error found:" "Error" +prettyPrintMultipleErrorsBox ppeOptions = prettyPrintMultipleErrorsWith (ppeOptions {ppeLevel = Error}) "Error found:" "Error" prettyPrintMultipleErrorsWith :: PPEOptions -> String -> String -> MultipleErrors -> [Box.Box] prettyPrintMultipleErrorsWith ppeOptions intro _ (MultipleErrors [e]) = let result = prettyPrintSingleError ppeOptions e - in [ Box.vcat Box.left [ Box.text intro - , result - ] - ] + in [ Box.vcat + Box.left + [ Box.text intro + , result + ] + ] prettyPrintMultipleErrorsWith ppeOptions _ intro (MultipleErrors es) = let result = map (prettyPrintSingleError ppeOptions) es - in concat $ zipWith withIntro [1 :: Int ..] result + in concat $ zipWith withIntro [1 :: Int ..] result where - withIntro i err = [ Box.text (intro ++ " " ++ show i ++ " of " ++ show (length es) ++ ":") - , Box.moveRight 2 err - ] + withIntro i err = + [ Box.text (intro ++ " " ++ show i ++ " of " ++ show (length es) ++ ":") + , Box.moveRight 2 err + ] -- | Indent to the right, and pad on top and bottom. indent :: Box.Box -> Box.Box @@ -1977,16 +2275,17 @@ lineS :: String -> Box.Box lineS = Box.text renderBox :: Box.Box -> String -renderBox = unlines - . map (dropWhileEnd isSpace) - . dropWhile whiteSpace - . dropWhileEnd whiteSpace - . lines - . Box.render +renderBox = + unlines + . map (dropWhileEnd isSpace) + . dropWhile whiteSpace + . dropWhileEnd whiteSpace + . lines + . Box.render where - whiteSpace = all isSpace + whiteSpace = all isSpace -toTypelevelString :: Type a -> Maybe Box.Box +toTypelevelString :: (Show a) => Type a -> Maybe Box.Box toTypelevelString (TypeLevelString _ s) = Just . Box.text $ decodeStringWithReplacement s toTypelevelString (TypeApp _ (TypeConstructor _ C.Text) x) = @@ -2025,19 +2324,20 @@ withPosition pos (ErrorMessage hints se) = ErrorMessage (positionedError pos : h withoutPosition :: ErrorMessage -> ErrorMessage withoutPosition (ErrorMessage hints se) = ErrorMessage (filter go hints) se where - go (PositionedError _) = False - go _ = True + go (PositionedError _) = False + go _ = True positionedError :: SourceSpan -> ErrorMessageHint positionedError = PositionedError . pure --- | Runs a computation listening for warnings and then escalating any warnings --- that match the predicate to error status. -escalateWarningWhen - :: (MonadWriter MultipleErrors m, MonadError MultipleErrors m) - => (ErrorMessage -> Bool) - -> m a - -> m a +{- | Runs a computation listening for warnings and then escalating any warnings +that match the predicate to error status. +-} +escalateWarningWhen :: + (MonadWriter MultipleErrors m, MonadError MultipleErrors m) => + (ErrorMessage -> Bool) -> + m a -> + m a escalateWarningWhen isError ma = do (a, w) <- censor (const mempty) $ listen ma let (errors, warnings) = partition isError (runMultipleErrors w) @@ -2046,14 +2346,14 @@ escalateWarningWhen isError ma = do return a -- | Collect errors in in parallel -parU - :: forall m a b - . MonadError MultipleErrors m - => [a] - -> (a -> m b) - -> m [b] +parU :: + forall m a b. + (MonadError MultipleErrors m) => + [a] -> + (a -> m b) -> + m [b] parU xs f = - forM xs (withError . f) >>= collectErrors + forM xs (withError . f) >>= collectErrors where withError :: m b -> m (Either MultipleErrors b) withError u = catchError (Right <$> u) (return . Left) @@ -2063,10 +2363,10 @@ parU xs f = ([], rs) -> return rs (errs, _) -> throwError $ fold errs -internalCompilerError - :: (MonadError MultipleErrors m, GHC.Stack.HasCallStack) - => Text - -> m a +internalCompilerError :: + (MonadError MultipleErrors m, GHC.Stack.HasCallStack) => + Text -> + m a internalCompilerError = throwError . errorMessage diff --git a/src/Language/PureScript/Errors/JSON.hs b/src/Language/PureScript/Errors/JSON.hs index 9e2af7866..c16e5ebc6 100644 --- a/src/Language/PureScript/Errors/JSON.hs +++ b/src/Language/PureScript/Errors/JSON.hs @@ -15,12 +15,14 @@ data ErrorPosition = ErrorPosition , startColumn :: Int , endLine :: Int , endColumn :: Int - } deriving (Show, Eq, Ord) + } + deriving (Show, Eq, Ord) data ErrorSuggestion = ErrorSuggestion { replacement :: Text , replaceRange :: Maybe ErrorPosition - } deriving (Show, Eq) + } + deriving (Show, Eq) data JSONError = JSONError { position :: Maybe ErrorPosition @@ -31,12 +33,14 @@ data JSONError = JSONError , moduleName :: Maybe Text , suggestion :: Maybe ErrorSuggestion , allSpans :: [P.SourceSpan] - } deriving (Show, Eq) + } + deriving (Show, Eq) data JSONResult = JSONResult { warnings :: [JSONError] , errors :: [JSONError] - } deriving (Show, Eq) + } + deriving (Show, Eq) $(A.deriveJSON A.defaultOptions ''ErrorPosition) $(A.deriveJSON A.defaultOptions ''ErrorSuggestion) @@ -48,28 +52,30 @@ toJSONErrors verbose level files = map (toJSONError verbose level files) . P.run toJSONError :: Bool -> P.Level -> [(FilePath, Text)] -> P.ErrorMessage -> JSONError toJSONError verbose level files e = - JSONError (toErrorPosition <$> fmap NEL.head spans) - (P.renderBox (P.prettyPrintSingleError (P.PPEOptions Nothing verbose level False mempty files) (P.stripModuleAndSpan e))) - (P.errorCode e) - (P.errorDocUri e) - (P.spanName <$> fmap NEL.head spans) - (P.runModuleName <$> P.errorModule e) - (toSuggestion e) - (maybe [] NEL.toList spans) + JSONError + (toErrorPosition <$> fmap NEL.head spans) + (P.renderBox (P.prettyPrintSingleError (P.PPEOptions Nothing verbose level False mempty files) (P.stripModuleAndSpan e))) + (P.errorCode e) + (P.errorDocUri e) + (P.spanName <$> fmap NEL.head spans) + (P.runModuleName <$> P.errorModule e) + (toSuggestion e) + (maybe [] NEL.toList spans) where - spans :: Maybe (NEL.NonEmpty P.SourceSpan) - spans = P.errorSpan e + spans :: Maybe (NEL.NonEmpty P.SourceSpan) + spans = P.errorSpan e - toErrorPosition :: P.SourceSpan -> ErrorPosition - toErrorPosition ss = - ErrorPosition (P.sourcePosLine (P.spanStart ss)) - (P.sourcePosColumn (P.spanStart ss)) - (P.sourcePosLine (P.spanEnd ss)) - (P.sourcePosColumn (P.spanEnd ss)) - toSuggestion :: P.ErrorMessage -> Maybe ErrorSuggestion - toSuggestion em = - case P.errorSuggestion $ P.unwrapErrorMessage em of - Nothing -> Nothing - Just s -> Just $ ErrorSuggestion (suggestionText s) (toErrorPosition <$> P.suggestionSpan em) + toErrorPosition :: P.SourceSpan -> ErrorPosition + toErrorPosition ss = + ErrorPosition + (P.sourcePosLine (P.spanStart ss)) + (P.sourcePosColumn (P.spanStart ss)) + (P.sourcePosLine (P.spanEnd ss)) + (P.sourcePosColumn (P.spanEnd ss)) + toSuggestion :: P.ErrorMessage -> Maybe ErrorSuggestion + toSuggestion em = + case P.errorSuggestion $ P.unwrapErrorMessage em of + Nothing -> Nothing + Just s -> Just $ ErrorSuggestion (suggestionText s) (toErrorPosition <$> P.suggestionSpan em) - suggestionText (P.ErrorSuggestion s) = s + suggestionText (P.ErrorSuggestion s) = s diff --git a/src/Language/PureScript/Externs.hs b/src/Language/PureScript/Externs.hs index 29d15ec8c..d0b27dfa3 100644 --- a/src/Language/PureScript/Externs.hs +++ b/src/Language/PureScript/Externs.hs @@ -1,39 +1,39 @@ --- | --- This module generates code for \"externs\" files, i.e. files containing only --- foreign import declarations. --- -module Language.PureScript.Externs - ( ExternsFile(..) - , ExternsImport(..) - , ExternsFixity(..) - , ExternsTypeFixity(..) - , ExternsDeclaration(..) - , externsIsCurrentVersion - , moduleToExternsFile - , applyExternsFileToEnvironment - , externsFileName - ) where +{- | +This module generates code for \"externs\" files, i.e. files containing only +foreign import declarations. +-} +module Language.PureScript.Externs ( + ExternsFile (..), + ExternsImport (..), + ExternsFixity (..), + ExternsTypeFixity (..), + ExternsDeclaration (..), + externsIsCurrentVersion, + moduleToExternsFile, + applyExternsFileToEnvironment, + externsFileName, +) where import Prelude import Codec.Serialise (Serialise) import Control.Monad (join) -import GHC.Generics (Generic) -import Data.Maybe (fromMaybe, mapMaybe, maybeToList) -import Data.List (foldl', find) import Data.Foldable (fold) +import Data.List (find, foldl') +import Data.List.NonEmpty qualified as NEL +import Data.Map qualified as M +import Data.Maybe (fromMaybe, mapMaybe, maybeToList) import Data.Text (Text) import Data.Text qualified as T import Data.Version (showVersion) -import Data.Map qualified as M -import Data.List.NonEmpty qualified as NEL +import GHC.Generics (Generic) -import Language.PureScript.AST (Associativity, Declaration(..), DeclarationRef(..), Fixity(..), ImportDeclarationType, Module(..), NameSource(..), Precedence, SourceSpan, pattern TypeFixityDeclaration, pattern ValueFixityDeclaration, getTypeOpRef, getValueOpRef) +import Language.PureScript.AST (Associativity, Declaration (..), DeclarationRef (..), Fixity (..), ImportDeclarationType, Module (..), NameSource (..), Precedence, SourceSpan, getTypeOpRef, getValueOpRef, pattern TypeFixityDeclaration, pattern ValueFixityDeclaration) import Language.PureScript.AST.Declarations.ChainId (ChainId) import Language.PureScript.Crash (internalError) -import Language.PureScript.Environment (DataDeclType, Environment(..), FunctionalDependency, NameKind(..), NameVisibility(..), TypeClassData(..), TypeKind(..), dictTypeName, makeTypeClassData) -import Language.PureScript.Names (Ident, ModuleName, OpName, OpNameType(..), ProperName, ProperNameType(..), Qualified(..), QualifiedBy(..), coerceProperName, isPlainIdent) -import Language.PureScript.TypeClassDictionaries (NamedDict, TypeClassDictionaryInScope(..)) +import Language.PureScript.Environment (DataDeclType, Environment (..), FunctionalDependency, NameKind (..), NameVisibility (..), TypeClassData (..), TypeKind (..), dictTypeName, makeTypeClassData) +import Language.PureScript.Names (Ident, ModuleName, OpName, OpNameType (..), ProperName, ProperNameType (..), Qualified (..), QualifiedBy (..), coerceProperName, isPlainIdent) +import Language.PureScript.TypeClassDictionaries (NamedDict, TypeClassDictionaryInScope (..)) import Language.PureScript.Types (SourceConstraint, SourceType, srcInstanceType) import Paths_purescript as Paths @@ -59,220 +59,227 @@ data ExternsFile = ExternsFile -- ^ List of type and value declaration , efSourceSpan :: SourceSpan -- ^ Source span for error reporting - } deriving (Show, Generic) + } + deriving (Show, Generic) instance Serialise ExternsFile -- | A module import in an externs file data ExternsImport = ExternsImport - { - -- | The imported module - eiModule :: ModuleName - -- | The import type: regular, qualified or hiding + { eiModule :: ModuleName + -- ^ The imported module , eiImportType :: ImportDeclarationType - -- | The imported-as name, for qualified imports + -- ^ The import type: regular, qualified or hiding , eiImportedAs :: Maybe ModuleName - } deriving (Show, Generic) + -- ^ The imported-as name, for qualified imports + } + deriving (Show, Generic) instance Serialise ExternsImport -- | A fixity declaration in an externs file data ExternsFixity = ExternsFixity - { - -- | The associativity of the operator - efAssociativity :: Associativity - -- | The precedence level of the operator + { efAssociativity :: Associativity + -- ^ The associativity of the operator , efPrecedence :: Precedence - -- | The operator symbol + -- ^ The precedence level of the operator , efOperator :: OpName 'ValueOpName - -- | The value the operator is an alias for + -- ^ The operator symbol , efAlias :: Qualified (Either Ident (ProperName 'ConstructorName)) - } deriving (Show, Generic) + -- ^ The value the operator is an alias for + } + deriving (Show, Generic) instance Serialise ExternsFixity -- | A type fixity declaration in an externs file data ExternsTypeFixity = ExternsTypeFixity - { - -- | The associativity of the operator - efTypeAssociativity :: Associativity - -- | The precedence level of the operator + { efTypeAssociativity :: Associativity + -- ^ The associativity of the operator , efTypePrecedence :: Precedence - -- | The operator symbol + -- ^ The precedence level of the operator , efTypeOperator :: OpName 'TypeOpName - -- | The value the operator is an alias for + -- ^ The operator symbol , efTypeAlias :: Qualified (ProperName 'TypeName) - } deriving (Show, Generic) + -- ^ The value the operator is an alias for + } + deriving (Show, Generic) instance Serialise ExternsTypeFixity -- | A type or value declaration appearing in an externs file -data ExternsDeclaration = - -- | A type declaration +data ExternsDeclaration + = -- | A type declaration EDType - { edTypeName :: ProperName 'TypeName - , edTypeKind :: SourceType - , edTypeDeclarationKind :: TypeKind + { edTypeName :: ProperName 'TypeName + , edTypeKind :: SourceType + , edTypeDeclarationKind :: TypeKind } - -- | A type synonym - | EDTypeSynonym - { edTypeSynonymName :: ProperName 'TypeName - , edTypeSynonymArguments :: [(Text, Maybe SourceType)] - , edTypeSynonymType :: SourceType + | -- | A type synonym + EDTypeSynonym + { edTypeSynonymName :: ProperName 'TypeName + , edTypeSynonymArguments :: [(Text, SourceType)] + , edTypeSynonymType :: SourceType } - -- | A data constructor - | EDDataConstructor - { edDataCtorName :: ProperName 'ConstructorName - , edDataCtorOrigin :: DataDeclType - , edDataCtorTypeCtor :: ProperName 'TypeName - , edDataCtorType :: SourceType - , edDataCtorFields :: [Ident] + | -- | A data constructor + EDDataConstructor + { edDataCtorName :: ProperName 'ConstructorName + , edDataCtorOrigin :: DataDeclType + , edDataCtorTypeCtor :: ProperName 'TypeName + , edDataCtorType :: SourceType + , edDataCtorFields :: [Ident] } - -- | A value declaration - | EDValue - { edValueName :: Ident - , edValueType :: SourceType + | -- | A value declaration + EDValue + { edValueName :: Ident + , edValueType :: SourceType } - -- | A type class declaration - | EDClass - { edClassName :: ProperName 'ClassName - , edClassTypeArguments :: [(Text, Maybe SourceType)] - , edClassMembers :: [(Ident, SourceType)] - , edClassConstraints :: [SourceConstraint] - , edFunctionalDependencies :: [FunctionalDependency] - , edIsEmpty :: Bool + | -- | A type class declaration + EDClass + { edClassName :: ProperName 'ClassName + , edClassTypeArguments :: [(Text, SourceType)] + , edClassMembers :: [(Ident, SourceType)] + , edClassConstraints :: [SourceConstraint] + , edFunctionalDependencies :: [FunctionalDependency] + , edIsEmpty :: Bool } - -- | An instance declaration - | EDInstance - { edInstanceClassName :: Qualified (ProperName 'ClassName) - , edInstanceName :: Ident - , edInstanceForAll :: [(Text, SourceType)] - , edInstanceKinds :: [SourceType] - , edInstanceTypes :: [SourceType] - , edInstanceConstraints :: Maybe [SourceConstraint] - , edInstanceChain :: Maybe ChainId - , edInstanceChainIndex :: Integer - , edInstanceNameSource :: NameSource - , edInstanceSourceSpan :: SourceSpan + | -- | An instance declaration + EDInstance + { edInstanceClassName :: Qualified (ProperName 'ClassName) + , edInstanceName :: Ident + , edInstanceForAll :: [(Text, SourceType)] + , edInstanceKinds :: [SourceType] + , edInstanceTypes :: [SourceType] + , edInstanceConstraints :: Maybe [SourceConstraint] + , edInstanceChain :: Maybe ChainId + , edInstanceChainIndex :: Integer + , edInstanceNameSource :: NameSource + , edInstanceSourceSpan :: SourceSpan } deriving (Show, Generic) instance Serialise ExternsDeclaration --- | Check whether the version in an externs file matches the currently running --- version. +{- | Check whether the version in an externs file matches the currently running +version. +-} externsIsCurrentVersion :: ExternsFile -> Bool externsIsCurrentVersion ef = T.unpack (efVersion ef) == showVersion Paths.version -- | Convert an externs file back into a module applyExternsFileToEnvironment :: ExternsFile -> Environment -> Environment -applyExternsFileToEnvironment ExternsFile{..} = flip (foldl' applyDecl) efDeclarations +applyExternsFileToEnvironment ExternsFile {..} = flip (foldl' applyDecl) efDeclarations where - applyDecl :: Environment -> ExternsDeclaration -> Environment - applyDecl env (EDType pn kind tyKind) = env { types = M.insert (qual pn) (kind, tyKind) (types env) } - applyDecl env (EDTypeSynonym pn args ty) = env { typeSynonyms = M.insert (qual pn) (args, ty) (typeSynonyms env) } - applyDecl env (EDDataConstructor pn dTy tNm ty nms) = env { dataConstructors = M.insert (qual pn) (dTy, tNm, ty, nms) (dataConstructors env) } - applyDecl env (EDValue ident ty) = env { names = M.insert (Qualified (ByModuleName efModuleName) ident) (ty, External, Defined) (names env) } - applyDecl env (EDClass pn args members cs deps tcIsEmpty) = env { typeClasses = M.insert (qual pn) (makeTypeClassData args members cs deps tcIsEmpty) (typeClasses env) } - applyDecl env (EDInstance className ident vars kinds tys cs ch idx ns ss) = - env { typeClassDictionaries = + applyDecl :: Environment -> ExternsDeclaration -> Environment + applyDecl env (EDType pn kind tyKind) = env {types = M.insert (qual pn) (kind, tyKind) (types env)} + applyDecl env (EDTypeSynonym pn args ty) = env {typeSynonyms = M.insert (qual pn) (args, ty) (typeSynonyms env)} + applyDecl env (EDDataConstructor pn dTy tNm ty nms) = env {dataConstructors = M.insert (qual pn) (dTy, tNm, ty, nms) (dataConstructors env)} + applyDecl env (EDValue ident ty) = env {names = M.insert (Qualified (ByModuleName efModuleName) ident) (ty, External, Defined) (names env)} + applyDecl env (EDClass pn args members cs deps tcIsEmpty) = env {typeClasses = M.insert (qual pn) (makeTypeClassData args members cs deps tcIsEmpty) (typeClasses env)} + applyDecl env (EDInstance className ident vars kinds tys cs ch idx ns ss) = + env + { typeClassDictionaries = updateMap (updateMap (M.insertWith (<>) (qual ident) (pure dict)) className) - (ByModuleName efModuleName) (typeClassDictionaries env) } - where - dict :: NamedDict - dict = TypeClassDictionaryInScope ch idx (qual ident) [] className vars kinds tys cs instTy + (ByModuleName efModuleName) + (typeClassDictionaries env) + } + where + dict :: NamedDict + dict = TypeClassDictionaryInScope ch idx (qual ident) [] className vars kinds tys cs instTy + + updateMap :: (Ord k, Monoid a) => (a -> a) -> k -> M.Map k a -> M.Map k a + updateMap f = M.alter (Just . f . fold) - updateMap :: (Ord k, Monoid a) => (a -> a) -> k -> M.Map k a -> M.Map k a - updateMap f = M.alter (Just . f . fold) + instTy :: Maybe SourceType + instTy = case ns of + CompilerNamed -> Just $ srcInstanceType ss vars className tys + UserNamed -> Nothing - instTy :: Maybe SourceType - instTy = case ns of - CompilerNamed -> Just $ srcInstanceType ss vars className tys - UserNamed -> Nothing + qual :: a -> Qualified a + qual = Qualified (ByModuleName efModuleName) - qual :: a -> Qualified a - qual = Qualified (ByModuleName efModuleName) +{- | Generate an externs file for all declarations in a module. --- | Generate an externs file for all declarations in a module. --- --- The `Map Ident Ident` argument should contain any top-level `GenIdent`s that --- were rewritten to `Ident`s when the module was compiled; this rewrite only --- happens in the CoreFn, not the original module AST, so it needs to be --- applied to the exported names here also. (The appropriate map is returned by --- `L.P.Renamer.renameInModule`.) +The `Map Ident Ident` argument should contain any top-level `GenIdent`s that +were rewritten to `Ident`s when the module was compiled; this rewrite only +happens in the CoreFn, not the original module AST, so it needs to be +applied to the exported names here also. (The appropriate map is returned by +`L.P.Renamer.renameInModule`.) +-} moduleToExternsFile :: Module -> Environment -> M.Map Ident Ident -> ExternsFile moduleToExternsFile (Module _ _ _ _ Nothing) _ _ = internalError "moduleToExternsFile: module exports were not elaborated" -moduleToExternsFile (Module ss _ mn ds (Just exps)) env renamedIdents = ExternsFile{..} +moduleToExternsFile (Module ss _ mn ds (Just exps)) env renamedIdents = ExternsFile {..} where - efVersion = T.pack (showVersion Paths.version) - efModuleName = mn - efExports = map renameRef exps - efImports = mapMaybe importDecl ds - efFixities = mapMaybe fixityDecl ds - efTypeFixities = mapMaybe typeFixityDecl ds - efDeclarations = concatMap toExternsDeclaration exps - efSourceSpan = ss + efVersion = T.pack (showVersion Paths.version) + efModuleName = mn + efExports = map renameRef exps + efImports = mapMaybe importDecl ds + efFixities = mapMaybe fixityDecl ds + efTypeFixities = mapMaybe typeFixityDecl ds + efDeclarations = concatMap toExternsDeclaration exps + efSourceSpan = ss - fixityDecl :: Declaration -> Maybe ExternsFixity - fixityDecl (ValueFixityDeclaration _ (Fixity assoc prec) name op) = - fmap (const (ExternsFixity assoc prec op name)) (find ((== Just op) . getValueOpRef) exps) - fixityDecl _ = Nothing + fixityDecl :: Declaration -> Maybe ExternsFixity + fixityDecl (ValueFixityDeclaration _ (Fixity assoc prec) name op) = + fmap (const (ExternsFixity assoc prec op name)) (find ((== Just op) . getValueOpRef) exps) + fixityDecl _ = Nothing - typeFixityDecl :: Declaration -> Maybe ExternsTypeFixity - typeFixityDecl (TypeFixityDeclaration _ (Fixity assoc prec) name op) = - fmap (const (ExternsTypeFixity assoc prec op name)) (find ((== Just op) . getTypeOpRef) exps) - typeFixityDecl _ = Nothing + typeFixityDecl :: Declaration -> Maybe ExternsTypeFixity + typeFixityDecl (TypeFixityDeclaration _ (Fixity assoc prec) name op) = + fmap (const (ExternsTypeFixity assoc prec op name)) (find ((== Just op) . getTypeOpRef) exps) + typeFixityDecl _ = Nothing - importDecl :: Declaration -> Maybe ExternsImport - importDecl (ImportDeclaration _ m mt qmn) = Just (ExternsImport m mt qmn) - importDecl _ = Nothing + importDecl :: Declaration -> Maybe ExternsImport + importDecl (ImportDeclaration _ m mt qmn) = Just (ExternsImport m mt qmn) + importDecl _ = Nothing - toExternsDeclaration :: DeclarationRef -> [ExternsDeclaration] - toExternsDeclaration (TypeRef _ pn dctors) = - case Qualified (ByModuleName mn) pn `M.lookup` types env of - Nothing -> internalError "toExternsDeclaration: no kind in toExternsDeclaration" - Just (kind, TypeSynonym) - | Just (args, synTy) <- Qualified (ByModuleName mn) pn `M.lookup` typeSynonyms env -> [ EDType pn kind TypeSynonym, EDTypeSynonym pn args synTy ] - Just (kind, ExternData rs) -> [ EDType pn kind (ExternData rs) ] - Just (kind, tk@(DataType _ _ tys)) -> - EDType pn kind tk : [ EDDataConstructor dctor dty pn ty args - | dctor <- fromMaybe (map fst tys) dctors - , (dty, _, ty, args) <- maybeToList (Qualified (ByModuleName mn) dctor `M.lookup` dataConstructors env) - ] - _ -> internalError "toExternsDeclaration: Invalid input" - toExternsDeclaration (ValueRef _ ident) - | Just (ty, _, _) <- Qualified (ByModuleName mn) ident `M.lookup` names env - = [ EDValue (lookupRenamedIdent ident) ty ] - toExternsDeclaration (TypeClassRef _ className) - | let dictName = dictTypeName . coerceProperName $ className - , Just TypeClassData{..} <- Qualified (ByModuleName mn) className `M.lookup` typeClasses env - , Just (kind, tk) <- Qualified (ByModuleName mn) (coerceProperName className) `M.lookup` types env - , Just (dictKind, dictData@(DataType _ _ [(dctor, _)])) <- Qualified (ByModuleName mn) dictName `M.lookup` types env - , Just (dty, _, ty, args) <- Qualified (ByModuleName mn) dctor `M.lookup` dataConstructors env - = [ EDType (coerceProperName className) kind tk - , EDType dictName dictKind dictData - , EDDataConstructor dctor dty dictName ty args - , EDClass className typeClassArguments ((\(a, b, _) -> (a, b)) <$> typeClassMembers) typeClassSuperclasses typeClassDependencies typeClassIsEmpty - ] - toExternsDeclaration (TypeInstanceRef ss' ident ns) - = [ EDInstance tcdClassName (lookupRenamedIdent ident) tcdForAll tcdInstanceKinds tcdInstanceTypes tcdDependencies tcdChain tcdIndex ns ss' + toExternsDeclaration :: DeclarationRef -> [ExternsDeclaration] + toExternsDeclaration (TypeRef _ pn dctors) = + case Qualified (ByModuleName mn) pn `M.lookup` types env of + Nothing -> internalError "toExternsDeclaration: no kind in toExternsDeclaration" + Just (kind, TypeSynonym) + | Just (args, synTy) <- Qualified (ByModuleName mn) pn `M.lookup` typeSynonyms env -> [EDType pn kind TypeSynonym, EDTypeSynonym pn args synTy] + Just (kind, ExternData rs) -> [EDType pn kind (ExternData rs)] + Just (kind, tk@(DataType _ _ tys)) -> + EDType pn kind tk + : [ EDDataConstructor dctor dty pn ty args + | dctor <- fromMaybe (map fst tys) dctors + , (dty, _, ty, args) <- maybeToList (Qualified (ByModuleName mn) dctor `M.lookup` dataConstructors env) + ] + _ -> internalError "toExternsDeclaration: Invalid input" + toExternsDeclaration (ValueRef _ ident) + | Just (ty, _, _) <- Qualified (ByModuleName mn) ident `M.lookup` names env = + [EDValue (lookupRenamedIdent ident) ty] + toExternsDeclaration (TypeClassRef _ className) + | let dictName = dictTypeName . coerceProperName $ className + , Just TypeClassData {..} <- Qualified (ByModuleName mn) className `M.lookup` typeClasses env + , Just (kind, tk) <- Qualified (ByModuleName mn) (coerceProperName className) `M.lookup` types env + , Just (dictKind, dictData@(DataType _ _ [(dctor, _)])) <- Qualified (ByModuleName mn) dictName `M.lookup` types env + , Just (dty, _, ty, args) <- Qualified (ByModuleName mn) dctor `M.lookup` dataConstructors env = + [ EDType (coerceProperName className) kind tk + , EDType dictName dictKind dictData + , EDDataConstructor dctor dty dictName ty args + , EDClass className typeClassArguments ((\(a, b, _) -> (a, b)) <$> typeClassMembers) typeClassSuperclasses typeClassDependencies typeClassIsEmpty + ] + toExternsDeclaration (TypeInstanceRef ss' ident ns) = + [ EDInstance tcdClassName (lookupRenamedIdent ident) tcdForAll tcdInstanceKinds tcdInstanceTypes tcdDependencies tcdChain tcdIndex ns ss' | m1 <- maybeToList (M.lookup (ByModuleName mn) (typeClassDictionaries env)) , m2 <- M.elems m1 , nel <- maybeToList (M.lookup (Qualified (ByModuleName mn) ident) m2) - , TypeClassDictionaryInScope{..} <- NEL.toList nel + , TypeClassDictionaryInScope {..} <- NEL.toList nel ] - toExternsDeclaration _ = [] + toExternsDeclaration _ = [] - renameRef :: DeclarationRef -> DeclarationRef - renameRef = \case - ValueRef ss' ident -> ValueRef ss' $ lookupRenamedIdent ident - TypeInstanceRef ss' ident _ | not $ isPlainIdent ident -> TypeInstanceRef ss' (lookupRenamedIdent ident) CompilerNamed - other -> other + renameRef :: DeclarationRef -> DeclarationRef + renameRef = \case + ValueRef ss' ident -> ValueRef ss' $ lookupRenamedIdent ident + TypeInstanceRef ss' ident _ | not $ isPlainIdent ident -> TypeInstanceRef ss' (lookupRenamedIdent ident) CompilerNamed + other -> other - lookupRenamedIdent :: Ident -> Ident - lookupRenamedIdent = flip (join M.findWithDefault) renamedIdents + lookupRenamedIdent :: Ident -> Ident + lookupRenamedIdent = flip (join M.findWithDefault) renamedIdents externsFileName :: FilePath externsFileName = "externs.cbor" diff --git a/src/Language/PureScript/Graph.hs b/src/Language/PureScript/Graph.hs index fc2ae68fc..fc8725e90 100644 --- a/src/Language/PureScript/Graph.hs +++ b/src/Language/PureScript/Graph.hs @@ -15,8 +15,8 @@ import Data.Maybe (fromMaybe) import Data.Text (Text) import System.IO.UTF8 (readUTF8FileT) -import Language.PureScript.Crash qualified as Crash import Language.PureScript.CST qualified as CST +import Language.PureScript.Crash qualified as Crash import Language.PureScript.Make qualified as Make import Language.PureScript.ModuleDependencies qualified as Dependencies import Language.PureScript.Options qualified as Options @@ -24,9 +24,9 @@ import Language.PureScript.Options qualified as Options import Language.PureScript.Errors (MultipleErrors) import Language.PureScript.Names (ModuleName, runModuleName) - --- | Given a set of filepaths, try to build the dependency graph and return --- that as its JSON representation (or a bunch of errors, if any) +{- | Given a set of filepaths, try to build the dependency graph and return + that as its JSON representation (or a bunch of errors, if any) +-} graph :: [FilePath] -> IO (Either MultipleErrors Json.Value, MultipleErrors) graph input = do moduleFiles <- readInput input @@ -34,25 +34,27 @@ graph input = do ms <- CST.parseModulesFromFiles id moduleFiles let parsedModuleSig = Dependencies.moduleSignature . CST.resPartial (_sorted, moduleGraph) <- Dependencies.sortModules Dependencies.Direct (parsedModuleSig . snd) ms - let pathMap = Map.fromList $ - map (\(p, m) -> (Dependencies.sigModuleName (parsedModuleSig m), p)) ms + let pathMap = + Map.fromList $ + map (\(p, m) -> (Dependencies.sigModuleName (parsedModuleSig m), p)) ms pure (moduleGraphToJSON pathMap moduleGraph) -moduleGraphToJSON - :: Map ModuleName FilePath - -> Dependencies.ModuleGraph - -> Json.Value +moduleGraphToJSON :: + Map ModuleName FilePath -> + Dependencies.ModuleGraph -> + Json.Value moduleGraphToJSON paths = Json.Object . foldl' insert mempty where - insert :: Json.Object -> (ModuleName, [ModuleName]) -> Json.Object - insert obj (mn, depends) = Json.Map.insert (Json.Key.fromText (runModuleName mn)) value obj - where - path = fromMaybe (Crash.internalError "missing module name in graph") $ Map.lookup mn paths - value = Json.object - [ "path" .= path - , "depends" .= fmap runModuleName depends - ] + insert :: Json.Object -> (ModuleName, [ModuleName]) -> Json.Object + insert obj (mn, depends) = Json.Map.insert (Json.Key.fromText (runModuleName mn)) value obj + where + path = fromMaybe (Crash.internalError "missing module name in graph") $ Map.lookup mn paths + value = + Json.object + [ "path" .= path + , "depends" .= fmap runModuleName depends + ] readInput :: [FilePath] -> IO [(FilePath, Text)] readInput inputFiles = - forM inputFiles $ \inFile -> (inFile, ) <$> readUTF8FileT inFile + forM inputFiles $ \inFile -> (inFile,) <$> readUTF8FileT inFile diff --git a/src/Language/PureScript/Hierarchy.hs b/src/Language/PureScript/Hierarchy.hs index c4919fb60..d2d0a8402 100644 --- a/src/Language/PureScript/Hierarchy.hs +++ b/src/Language/PureScript/Hierarchy.hs @@ -8,15 +8,16 @@ -- Stability : experimental -- Portability : -- --- | --- Generate Directed Graphs of PureScript TypeClasses --- + ----------------------------------------------------------------------------- +{- | +Generate Directed Graphs of PureScript TypeClasses +-} module Language.PureScript.Hierarchy where -import Prelude import Protolude (ordNub) +import Prelude import Data.List (sort) import Data.Text qualified as T @@ -25,7 +26,7 @@ import Language.PureScript qualified as P newtype SuperMap = SuperMap { _unSuperMap :: Either (P.ProperName 'P.ClassName) (P.ProperName 'P.ClassName, P.ProperName 'P.ClassName) } - deriving Eq + deriving (Eq) instance Ord SuperMap where compare (SuperMap s) (SuperMap s') = getCls s `compare` getCls s' @@ -57,17 +58,17 @@ runModuleName :: P.ModuleName -> GraphName runModuleName (P.ModuleName name) = GraphName $ T.replace "." "_" name -typeClasses :: Functor f => f P.Module -> f (Maybe Graph) +typeClasses :: (Functor f) => f P.Module -> f (Maybe Graph) typeClasses = fmap typeClassGraph typeClassGraph :: P.Module -> Maybe Graph typeClassGraph (P.Module _ _ moduleName decls _) = if null supers then Nothing else Just (Graph name graph) - where - name = runModuleName moduleName - supers = sort . ordNub $ concatMap superClasses decls - graph = Digraph $ typeClassPrologue name <> typeClassBody supers <> typeClassEpilogue + where + name = runModuleName moduleName + supers = sort . ordNub $ concatMap superClasses decls + graph = Digraph $ typeClassPrologue name <> typeClassBody supers <> typeClassEpilogue typeClassPrologue :: GraphName -> T.Text typeClassPrologue (GraphName name) = "digraph " <> name <> " {\n" @@ -79,7 +80,7 @@ typeClassEpilogue :: T.Text typeClassEpilogue = "\n}" superClasses :: P.Declaration -> [SuperMap] -superClasses (P.TypeClassDeclaration _ sub _ supers@(_:_) _ _) = +superClasses (P.TypeClassDeclaration _ sub _ supers@(_ : _) _ _) = fmap (\(P.Constraint _ (P.Qualified _ super) _ _ _) -> SuperMap (Right (super, sub))) supers superClasses (P.TypeClassDeclaration _ sub _ _ _ _) = [SuperMap (Left sub)] superClasses _ = [] diff --git a/src/Language/PureScript/Ide.hs b/src/Language/PureScript/Ide.hs index 746eec259..b35ab1f28 100644 --- a/src/Language/PureScript/Ide.hs +++ b/src/Language/PureScript/Ide.hs @@ -8,26 +8,25 @@ -- Maintainer : Christoph Hegemann -- Stability : experimental -- --- | --- Interface for the psc-ide-server ----------------------------------------------------------------------------- - {-# LANGUAGE PackageImports #-} -module Language.PureScript.Ide - ( handleCommand - ) where +{- | +Interface for the psc-ide-server +-} +module Language.PureScript.Ide ( + handleCommand, +) where import Protolude hiding (moduleName) -import "monad-logger" Control.Monad.Logger (MonadLogger, logWarnN) import Data.Map qualified as Map import Data.Text qualified as T import Language.PureScript qualified as P import Language.PureScript.Ide.CaseSplit qualified as CS -import Language.PureScript.Ide.Command (Command(..), ImportCommand(..), ListType(..)) +import Language.PureScript.Ide.Command (Command (..), ImportCommand (..), ListType (..)) import Language.PureScript.Ide.Completion (CompletionOptions, completionFromMatch, getCompletions, getExactCompletions, simpleExport) -import Language.PureScript.Ide.Error (IdeError(..)) +import Language.PureScript.Ide.Error (IdeError (..)) import Language.PureScript.Ide.Externs (readExternFile) import Language.PureScript.Ide.Filter (Filter) import Language.PureScript.Ide.Imports (parseImportsFromFile) @@ -37,19 +36,21 @@ import Language.PureScript.Ide.Prim (idePrimDeclarations) import Language.PureScript.Ide.Rebuild (rebuildFileAsync, rebuildFileSync) import Language.PureScript.Ide.SourceFile (parseModulesFromFiles) import Language.PureScript.Ide.State (getAllModules, getLoadedModulenames, insertExterns, insertModule, populateVolatileState, populateVolatileStateSync, resetIdeState) -import Language.PureScript.Ide.Types (Annotation(..), Ide, IdeConfiguration(..), IdeDeclarationAnn(..), IdeEnvironment(..), Success(..)) -import Language.PureScript.Ide.Util (discardAnn, identifierFromIdeDeclaration, namespaceForDeclaration, withEmptyAnn) +import Language.PureScript.Ide.Types (Annotation (..), Ide, IdeConfiguration (..), IdeDeclarationAnn (..), IdeEnvironment (..), Success (..)) import Language.PureScript.Ide.Usage (findUsages) -import System.Directory (getCurrentDirectory, getDirectoryContents, doesDirectoryExist, doesFileExist) -import System.FilePath ((), normalise) +import Language.PureScript.Ide.Util (discardAnn, identifierFromIdeDeclaration, namespaceForDeclaration, withEmptyAnn) +import System.Directory (doesDirectoryExist, doesFileExist, getCurrentDirectory, getDirectoryContents) +import System.FilePath (normalise, ()) import System.FilePath.Glob (glob) +import "monad-logger" Control.Monad.Logger (MonadLogger, logWarnN) --- | Accepts a Command and runs it against psc-ide's State. This is the main --- entry point for the server. -handleCommand - :: (Ide m, MonadLogger m, MonadError IdeError m) - => Command - -> m Success +{- | Accepts a Command and runs it against psc-ide's State. This is the main +entry point for the server. +-} +handleCommand :: + (Ide m, MonadLogger m, MonadError IdeError m) => + Command -> + m Success handleCommand c = case c of Load [] -> -- Clearing the State before populating it to avoid a space leak @@ -77,15 +78,20 @@ handleCommand c = case c of AddClause l wca -> MultilineTextResult <$> CS.addClause l wca FindUsages moduleName ident namespace -> do - Map.lookup moduleName <$> getAllModules Nothing >>= \case - Nothing -> throwError (GeneralError "Module not found") - Just decls -> do - case find (\d -> namespaceForDeclaration (discardAnn d) == namespace - && identifierFromIdeDeclaration (discardAnn d) == ident) decls of - Nothing -> throwError (GeneralError "Declaration not found") - Just declaration -> do - let sourceModule = fromMaybe moduleName (declaration & _idaAnnotation & _annExportedFrom) - UsagesResult . foldMap toList <$> findUsages (discardAnn declaration) sourceModule + Map.lookup moduleName + <$> getAllModules Nothing >>= \case + Nothing -> throwError (GeneralError "Module not found") + Just decls -> do + case find + ( \d -> + namespaceForDeclaration (discardAnn d) == namespace + && identifierFromIdeDeclaration (discardAnn d) == ident + ) + decls of + Nothing -> throwError (GeneralError "Declaration not found") + Just declaration -> do + let sourceModule = fromMaybe moduleName (declaration & _idaAnnotation & _annExportedFrom) + UsagesResult . foldMap toList <$> findUsages (discardAnn declaration) sourceModule Import fp outfp _ (AddImplicitImport mn) -> do rs <- addImplicitImport fp mn answerRequest outfp rs @@ -109,39 +115,39 @@ handleCommand c = case c of Quit -> liftIO exitSuccess -findCompletions - :: Ide m - => [Filter] - -> Matcher IdeDeclarationAnn - -> Maybe P.ModuleName - -> CompletionOptions - -> m Success +findCompletions :: + (Ide m) => + [Filter] -> + Matcher IdeDeclarationAnn -> + Maybe P.ModuleName -> + CompletionOptions -> + m Success findCompletions filters matcher currentModule complOptions = do modules <- getAllModules currentModule let insertPrim = Map.union idePrimDeclarations pure (CompletionResult (getCompletions filters matcher complOptions (insertPrim modules))) -findType - :: Ide m - => Text - -> [Filter] - -> Maybe P.ModuleName - -> m Success +findType :: + (Ide m) => + Text -> + [Filter] -> + Maybe P.ModuleName -> + m Success findType search filters currentModule = do modules <- getAllModules currentModule let insertPrim = Map.union idePrimDeclarations pure (CompletionResult (getExactCompletions search filters (insertPrim modules))) -printModules :: Ide m => m Success +printModules :: (Ide m) => m Success printModules = ModuleList . map P.runModuleName <$> getLoadedModulenames -outputDirectory :: Ide m => m FilePath +outputDirectory :: (Ide m) => m FilePath outputDirectory = do outputPath <- confOutputPath . ideConfiguration <$> ask cwd <- liftIO getCurrentDirectory pure (cwd outputPath) -listAvailableModules :: Ide m => m Success +listAvailableModules :: (Ide m) => m Success listAvailableModules = do oDir <- outputDirectory liftIO $ do @@ -149,18 +155,26 @@ listAvailableModules = do let cleaned = filter (`notElem` [".", ".."]) contents return (ModuleList (map toS cleaned)) -caseSplit :: (Ide m, MonadError IdeError m) => - Text -> Int -> Int -> CS.WildcardAnnotations -> Text -> m Success +caseSplit :: + (Ide m, MonadError IdeError m) => + Text -> + Int -> + Int -> + CS.WildcardAnnotations -> + Text -> + m Success caseSplit l b e csa t = do patterns <- CS.makePattern l b e csa <$> CS.caseSplit t pure (MultilineTextResult patterns) --- | Finds all the externs inside the output folder and returns the --- corresponding module names +{- | Finds all the externs inside the output folder and returns the +corresponding module names +-} findAvailableExterns :: (Ide m, MonadError IdeError m) => m [P.ModuleName] findAvailableExterns = do oDir <- outputDirectory - unlessM (liftIO (doesDirectoryExist oDir)) + unlessM + (liftIO (doesDirectoryExist oDir)) (throwError (GeneralError $ "Couldn't locate your output directory at: " <> T.pack (normalise oDir))) liftIO $ do directories <- getDirectoryContents oDir @@ -177,37 +191,38 @@ findAvailableExterns = do doesFileExist file -- | Finds all matches for the globs specified at the commandline -findAllSourceFiles :: Ide m => m [FilePath] +findAllSourceFiles :: (Ide m) => m [FilePath] findAllSourceFiles = do globs <- confGlobs . ideConfiguration <$> ask liftIO (concatMapM glob globs) --- | Looks up the ExternsFiles for the given Modulenames and loads them into the --- server state. Then proceeds to parse all the specified sourcefiles and --- inserts their ASTs into the state. Finally kicks off an async worker, which --- populates the VolatileState. -loadModulesAsync - :: (Ide m, MonadError IdeError m, MonadLogger m) - => [P.ModuleName] - -> m Success +{- | Looks up the ExternsFiles for the given Modulenames and loads them into the +server state. Then proceeds to parse all the specified sourcefiles and +inserts their ASTs into the state. Finally kicks off an async worker, which +populates the VolatileState. +-} +loadModulesAsync :: + (Ide m, MonadError IdeError m, MonadLogger m) => + [P.ModuleName] -> + m Success loadModulesAsync moduleNames = do tr <- loadModules moduleNames _ <- populateVolatileState pure tr -loadModulesSync - :: (Ide m, MonadError IdeError m, MonadLogger m) - => [P.ModuleName] - -> m Success +loadModulesSync :: + (Ide m, MonadError IdeError m, MonadLogger m) => + [P.ModuleName] -> + m Success loadModulesSync moduleNames = do tr <- loadModules moduleNames populateVolatileStateSync pure tr -loadModules - :: (Ide m, MonadError IdeError m, MonadLogger m) - => [P.ModuleName] - -> m Success +loadModules :: + (Ide m, MonadError IdeError m, MonadLogger m) => + [P.ModuleName] -> + m Success loadModules moduleNames = do -- We resolve all the modulenames to externs files and load these into memory. oDir <- outputDirectory @@ -224,5 +239,12 @@ loadModules moduleNames = do logWarnN ("Failed to parse: " <> show failures) traverse_ insertModule allModules - pure (TextResult ("Loaded " <> show (length efiles) <> " modules and " - <> show (length allModules) <> " source files.")) + pure + ( TextResult + ( "Loaded " + <> show (length efiles) + <> " modules and " + <> show (length allModules) + <> " source files." + ) + ) diff --git a/src/Language/PureScript/Ide/CaseSplit.hs b/src/Language/PureScript/Ide/CaseSplit.hs index 8c66f5545..24eeafbde 100644 --- a/src/Language/PureScript/Ide/CaseSplit.hs +++ b/src/Language/PureScript/Ide/CaseSplit.hs @@ -8,20 +8,22 @@ -- Maintainer : Christoph Hegemann -- Stability : experimental -- --- | --- Casesplitting and adding function clauses + ----------------------------------------------------------------------------- -module Language.PureScript.Ide.CaseSplit - ( WildcardAnnotations() - , explicitAnnotations - , noAnnotations - , makePattern - , addClause - , caseSplit - ) where +{- | +Casesplitting and adding function clauses +-} +module Language.PureScript.Ide.CaseSplit ( + WildcardAnnotations (), + explicitAnnotations, + noAnnotations, + makePattern, + addClause, + caseSplit, +) where -import Protolude hiding (Constructor) +import Protolude hiding (Constructor) import Data.List.NonEmpty qualified as NE import Data.Map qualified as M @@ -29,8 +31,8 @@ import Data.Text qualified as T import Language.PureScript qualified as P import Language.PureScript.CST qualified as CST -import Language.PureScript.Externs (ExternsDeclaration(..), ExternsFile(..)) -import Language.PureScript.Ide.Error (IdeError(..)) +import Language.PureScript.Externs (ExternsDeclaration (..), ExternsFile (..)) +import Language.PureScript.Ide.Error (IdeError (..)) import Language.PureScript.Ide.State (cachedRebuild, getExternFiles) import Language.PureScript.Ide.Types (Ide) @@ -44,12 +46,12 @@ explicitAnnotations = WildcardAnnotations True noAnnotations :: WildcardAnnotations noAnnotations = WildcardAnnotations False -type DataType = ([(Text, Maybe P.SourceType, P.Role)], [(P.ProperName 'P.ConstructorName, [P.SourceType])]) +type DataType = ([(Text, P.SourceType, P.Role)], [(P.ProperName 'P.ConstructorName, [P.SourceType])]) -caseSplit - :: (Ide m, MonadError IdeError m) - => Text - -> m [Constructor] +caseSplit :: + (Ide m, MonadError IdeError m) => + Text -> + m [Constructor] caseSplit q = do type' <- parseType' q (tc, args) <- splitTypeConstructor type' @@ -58,10 +60,10 @@ caseSplit q = do let appliedCtors = map (second (map applyTypeVars)) ctors pure appliedCtors -findTypeDeclaration - :: (Ide m, MonadError IdeError m) - => P.ProperName 'P.TypeName - -> m DataType +findTypeDeclaration :: + (Ide m, MonadError IdeError m) => + P.ProperName 'P.TypeName -> + m DataType findTypeDeclaration q = do efs <- getExternFiles efs' <- maybe efs (flip (uncurry M.insert) efs) <$> cachedRebuild @@ -70,18 +72,25 @@ findTypeDeclaration q = do Just mn -> pure mn Nothing -> throwError (GeneralError "Not Found") -findTypeDeclaration' - :: P.ProperName 'P.TypeName - -> ExternsFile - -> First DataType -findTypeDeclaration' t ExternsFile{..} = - First $ head $ mapMaybe (\case +findTypeDeclaration' :: + P.ProperName 'P.TypeName -> + ExternsFile -> + First DataType +findTypeDeclaration' t ExternsFile {..} = + First $ + head $ + mapMaybe + ( \case EDType tn _ (P.DataType _ typeVars ctors) | tn == t -> Just (typeVars, ctors) - _ -> Nothing) efDeclarations - -splitTypeConstructor :: (MonadError IdeError m) => - P.Type a -> m (P.ProperName 'P.TypeName, [P.Type a]) + _ -> Nothing + ) + efDeclarations + +splitTypeConstructor :: + (MonadError IdeError m) => + P.Type a -> + m (P.ProperName 'P.TypeName, [P.Type a]) splitTypeConstructor = go [] where go acc (P.TypeApp _ ty arg) = go (arg : acc) ty @@ -91,8 +100,11 @@ splitTypeConstructor = go [] prettyCtor :: WildcardAnnotations -> Constructor -> Text prettyCtor _ (ctorName, []) = P.runProperName ctorName prettyCtor wsa (ctorName, ctorArgs) = - "(" <> P.runProperName ctorName <> " " - <> T.unwords (map (prettyPrintWildcard wsa) ctorArgs) <> ")" + "(" + <> P.runProperName ctorName + <> " " + <> T.unwords (map (prettyPrintWildcard wsa) ctorArgs) + <> ")" prettyPrintWildcard :: WildcardAnnotations -> P.Type a -> Text prettyPrintWildcard (WildcardAnnotations True) = prettyWildcard @@ -102,12 +114,18 @@ prettyWildcard :: P.Type a -> Text prettyWildcard t = "( _ :: " <> T.strip (T.pack (P.prettyPrintTypeAtom maxBound t)) <> ")" -- | Constructs Patterns to insert into a sourcefile -makePattern :: Text -- ^ Current line - -> Int -- ^ Begin of the split - -> Int -- ^ End of the split - -> WildcardAnnotations -- ^ Whether to explicitly type the splits - -> [Constructor] -- ^ Constructors to split - -> [Text] +makePattern :: + -- | Current line + Text -> + -- | Begin of the split + Int -> + -- | End of the split + Int -> + -- | Whether to explicitly type the splits + WildcardAnnotations -> + -- | Constructors to split + [Constructor] -> + [Text] makePattern t x y wsa = makePattern' (T.take x t) (T.drop y t) where makePattern' lhs rhs = map (\ctor -> lhs <> prettyCtor wsa ctor <> rhs) @@ -116,32 +134,45 @@ addClause :: (MonadError IdeError m) => Text -> WildcardAnnotations -> m [Text] addClause s wca = do (fName, fType) <- parseTypeDeclaration' s let args = splitFunctionType fType - template = P.runIdent fName <> " " <> - T.unwords (map (prettyPrintWildcard wca) args) <> - " = ?" <> (T.strip . P.runIdent $ fName) + template = + P.runIdent fName + <> " " + <> T.unwords (map (prettyPrintWildcard wca) args) + <> " = ?" + <> (T.strip . P.runIdent $ fName) pure [s, template] -parseType' :: (MonadError IdeError m) => - Text -> m P.SourceType +parseType' :: + (MonadError IdeError m) => + Text -> + m P.SourceType parseType' s = case CST.runTokenParser CST.parseType $ CST.lex s of - Right type' -> pure $ CST.convertType "" $ snd type' + Right type' -> pure $ CST.runConvert . CST.convertType "" $ snd type' Left err -> - throwError (GeneralError ("Parsing the splittype failed with:" - <> show err)) + throwError + ( GeneralError + ( "Parsing the splittype failed with:" + <> show err + ) + ) parseTypeDeclaration' :: (MonadError IdeError m) => Text -> m (P.Ident, P.SourceType) parseTypeDeclaration' s = - let x = fmap (CST.convertDeclaration "" . snd) - $ CST.runTokenParser CST.parseDecl - $ CST.lex s - in - case x of - Right [P.TypeDeclaration td] -> pure (P.unwrapTypeDeclaration td) - Right _ -> throwError (GeneralError "Found a non-type-declaration") - Left errs -> - throwError (GeneralError ("Parsing the type signature failed with: " - <> toS (CST.prettyPrintErrorMessage $ NE.head errs))) + let x = + fmap (CST.runConvert . CST.convertDeclaration "" . snd) $ + CST.runTokenParser CST.parseDecl $ + CST.lex s + in case x of + Right [P.TypeDeclaration td] -> pure (P.unwrapTypeDeclaration td) + Right _ -> throwError (GeneralError "Found a non-type-declaration") + Left errs -> + throwError + ( GeneralError + ( "Parsing the type signature failed with: " + <> toS (CST.prettyPrintErrorMessage $ NE.head errs) + ) + ) splitFunctionType :: P.Type a -> [P.Type a] splitFunctionType t = fromMaybe [] arguments @@ -151,5 +182,5 @@ splitFunctionType t = fromMaybe [] arguments splitType' (P.ForAll _ _ _ _ t' _) = splitType' t' splitType' (P.ConstrainedType _ _ t') = splitType' t' splitType' (P.TypeApp _ (P.TypeApp _ t' lhs) rhs) - | P.eqType t' P.tyFunction = lhs : splitType' rhs + | P.eqType t' P.tyFunction = lhs : splitType' rhs splitType' t' = [t'] diff --git a/src/Language/PureScript/Ide/Command.hs b/src/Language/PureScript/Ide/Command.hs index ae4b6c9d8..cd73ef39c 100644 --- a/src/Language/PureScript/Ide/Command.hs +++ b/src/Language/PureScript/Ide/Command.hs @@ -8,16 +8,18 @@ -- Maintainer : Christoph Hegemann -- Stability : experimental -- --- | --- Datatypes for the commands psc-ide accepts + ----------------------------------------------------------------------------- +{- | +Datatypes for the commands psc-ide accepts +-} module Language.PureScript.Ide.Command where import Protolude import Control.Monad.Fail (fail) -import Data.Aeson (FromJSON(..), withObject, (.!=), (.:), (.:?)) +import Data.Aeson (FromJSON (..), withObject, (.!=), (.:), (.:?)) import Data.Map qualified as Map import Data.Set qualified as Set import Language.PureScript qualified as P @@ -28,60 +30,60 @@ import Language.PureScript.Ide.Matcher (Matcher) import Language.PureScript.Ide.Types (IdeDeclarationAnn, IdeNamespace) data Command - = Load [P.ModuleName] - | LoadSync [P.ModuleName] -- used in tests - | Type - { typeSearch :: Text - , typeFilters :: [Filter] + = Load [P.ModuleName] + | LoadSync [P.ModuleName] -- used in tests + | Type + { typeSearch :: Text + , typeFilters :: [Filter] , typeCurrentModule :: Maybe P.ModuleName } - | Complete - { completeFilters :: [Filter] - , completeMatcher :: Matcher IdeDeclarationAnn + | Complete + { completeFilters :: [Filter] + , completeMatcher :: Matcher IdeDeclarationAnn , completeCurrentModule :: Maybe P.ModuleName - , completeOptions :: CompletionOptions + , completeOptions :: CompletionOptions } - | CaseSplit - { caseSplitLine :: Text - , caseSplitBegin :: Int - , caseSplitEnd :: Int + | CaseSplit + { caseSplitLine :: Text + , caseSplitBegin :: Int + , caseSplitEnd :: Int , caseSplitAnnotations :: WildcardAnnotations - , caseSplitType :: Text + , caseSplitType :: Text } - | AddClause - { addClauseLine :: Text + | AddClause + { addClauseLine :: Text , addClauseAnnotations :: WildcardAnnotations } - | FindUsages + | FindUsages { usagesModule :: P.ModuleName , usagesIdentifier :: Text , usagesNamespace :: IdeNamespace } - -- Import InputFile OutputFile - | Import FilePath (Maybe FilePath) [Filter] ImportCommand - | List { listType :: ListType } - | Rebuild FilePath (Maybe FilePath) (Set P.CodegenTarget) - | RebuildSync FilePath (Maybe FilePath) (Set P.CodegenTarget) - | Cwd - | Reset - | Quit + | -- Import InputFile OutputFile + Import FilePath (Maybe FilePath) [Filter] ImportCommand + | List {listType :: ListType} + | Rebuild FilePath (Maybe FilePath) (Set P.CodegenTarget) + | RebuildSync FilePath (Maybe FilePath) (Set P.CodegenTarget) + | Cwd + | Reset + | Quit commandName :: Command -> Text commandName c = case c of - Load{} -> "Load" - LoadSync{} -> "LoadSync" - Type{} -> "Type" - Complete{} -> "Complete" - CaseSplit{} -> "CaseSplit" - AddClause{} -> "AddClause" - FindUsages{} -> "FindUsages" - Import{} -> "Import" - List{} -> "List" - Rebuild{} -> "Rebuild" - RebuildSync{} -> "RebuildSync" - Cwd{} -> "Cwd" - Reset{} -> "Reset" - Quit{} -> "Quit" + Load {} -> "Load" + LoadSync {} -> "LoadSync" + Type {} -> "Type" + Complete {} -> "Complete" + CaseSplit {} -> "CaseSplit" + AddClause {} -> "AddClause" + FindUsages {} -> "FindUsages" + Import {} -> "Import" + List {} -> "List" + Rebuild {} -> "Rebuild" + RebuildSync {} -> "RebuildSync" + Cwd {} -> "Cwd" + Reset {} -> "Reset" + Quit {} -> "Quit" data ImportCommand = AddImplicitImport P.ModuleName @@ -103,7 +105,6 @@ instance FromJSON ImportCommand where AddImportForIdentifier <$> (o .: "identifier") <*> (fmap P.moduleNameFromString <$> o .:? "qualifier") - s -> fail ("Unknown import command: " <> show s) data ListType = LoadedModules | Imports FilePath | AvailableModules @@ -122,7 +123,7 @@ instance FromJSON Command where (command :: Text) <- o .: "command" case command of "list" -> List <$> o .:? "params" .!= LoadedModules - "cwd" -> pure Cwd + "cwd" -> pure Cwd "quit" -> pure Quit "reset" -> pure Reset "load" -> do @@ -175,7 +176,7 @@ instance FromJSON Command where Rebuild <$> params .: "file" <*> params .:? "actualFile" - <*> (parseCodegenTargets =<< params .:? "codegen" .!= [ "js" ]) + <*> (parseCodegenTargets =<< params .:? "codegen" .!= ["js"]) c -> fail ("Unknown command: " <> show c) where parseCodegenTargets ts = diff --git a/src/Language/PureScript/Ide/Completion.hs b/src/Language/PureScript/Ide/Completion.hs index 87fe81de9..91a4ada32 100644 --- a/src/Language/PureScript/Ide/Completion.hs +++ b/src/Language/PureScript/Ide/Completion.hs @@ -1,18 +1,18 @@ -module Language.PureScript.Ide.Completion - ( getCompletions - , getExactMatches - , getExactCompletions - , simpleExport - , completionFromMatch - , CompletionOptions(..) - , defaultCompletionOptions - , applyCompletionOptions - ) where - -import Protolude hiding ((<&>), moduleName) +module Language.PureScript.Ide.Completion ( + getCompletions, + getExactMatches, + getExactCompletions, + simpleExport, + completionFromMatch, + CompletionOptions (..), + defaultCompletionOptions, + applyCompletionOptions, +) where + +import Protolude hiding (moduleName, (<&>)) import Control.Lens ((.~), (<&>), (^.)) -import Data.Aeson (FromJSON(..), withObject, (.!=), (.:?)) +import Data.Aeson (FromJSON (..), withObject, (.!=), (.:?)) import Data.Map qualified as Map import Data.Text qualified as T import Language.PureScript qualified as P @@ -22,34 +22,35 @@ import Language.PureScript.Ide.Matcher (Matcher, runMatcher) import Language.PureScript.Ide.Types import Language.PureScript.Ide.Util (identT, identifierFromIdeDeclaration, namespaceForDeclaration, properNameT, typeOperatorAliasT, valueOperatorAliasT) --- | Applies the CompletionFilters and the Matcher to the given Modules --- and sorts the found Completions according to the Matching Score -getCompletions - :: [Filter] - -> Matcher IdeDeclarationAnn - -> CompletionOptions - -> ModuleMap [IdeDeclarationAnn] - -> [Completion] +{- | Applies the CompletionFilters and the Matcher to the given Modules + and sorts the found Completions according to the Matching Score +-} +getCompletions :: + [Filter] -> + Matcher IdeDeclarationAnn -> + CompletionOptions -> + ModuleMap [IdeDeclarationAnn] -> + [Completion] getCompletions filters matcher options modules = modules - & applyFilters filters - & matchesFromModules - & runMatcher matcher - & applyCompletionOptions options - <&> completionFromMatch + & applyFilters filters + & matchesFromModules + & runMatcher matcher + & applyCompletionOptions options + <&> completionFromMatch getExactMatches :: Text -> [Filter] -> ModuleMap [IdeDeclarationAnn] -> [Match IdeDeclarationAnn] getExactMatches search filters modules = modules - & applyFilters (exactFilter search : filters) - & matchesFromModules + & applyFilters (exactFilter search : filters) + & matchesFromModules getExactCompletions :: Text -> [Filter] -> ModuleMap [IdeDeclarationAnn] -> [Completion] getExactCompletions search filters modules = modules - & getExactMatches search filters - <&> simpleExport - <&> completionFromMatch + & getExactMatches search filters + <&> simpleExport + <&> completionFromMatch matchesFromModules :: ModuleMap [IdeDeclarationAnn] -> [Match IdeDeclarationAnn] matchesFromModules = Map.foldMapWithKey completionFromModule @@ -66,19 +67,24 @@ instance FromJSON CompletionOptions where parseJSON = withObject "CompletionOptions" $ \o -> do maxResults <- o .:? "maxResults" groupReexports <- o .:? "groupReexports" .!= False - pure (CompletionOptions { coMaxResults = maxResults - , coGroupReexports = groupReexports - }) + pure + ( CompletionOptions + { coMaxResults = maxResults + , coGroupReexports = groupReexports + } + ) defaultCompletionOptions :: CompletionOptions -defaultCompletionOptions = CompletionOptions { coMaxResults = Nothing, coGroupReexports = False } +defaultCompletionOptions = CompletionOptions {coMaxResults = Nothing, coGroupReexports = False} applyCompletionOptions :: CompletionOptions -> [Match IdeDeclarationAnn] -> [(Match IdeDeclarationAnn, [P.ModuleName])] -applyCompletionOptions co decls = decls - & (if coGroupReexports co - then groupCompletionReexports - else map simpleExport) - & maybe identity take (coMaxResults co) +applyCompletionOptions co decls = + decls + & ( if coGroupReexports co + then groupCompletionReexports + else map simpleExport + ) + & maybe identity take (coMaxResults co) simpleExport :: Match a -> (Match a, [P.ModuleName]) simpleExport match@(Match (moduleName, _)) = (match, [moduleName]) @@ -90,15 +96,19 @@ groupCompletionReexports initial = go (Match (moduleName, d@(IdeDeclarationAnn ann decl))) = let origin = fromMaybe moduleName (ann ^. annExportedFrom) - in + in Map.alter - (insertDeclaration moduleName origin d) - (Namespaced (namespaceForDeclaration decl) - (P.runModuleName origin <> "." <> identifierFromIdeDeclaration decl)) + (insertDeclaration moduleName origin d) + ( Namespaced + (namespaceForDeclaration decl) + (P.runModuleName origin <> "." <> identifierFromIdeDeclaration decl) + ) insertDeclaration moduleName origin d old = case old of - Nothing -> Just ( Match (origin, d & idaAnnotation . annExportedFrom .~ Nothing) - , [moduleName] - ) + Nothing -> + Just + ( Match (origin, d & idaAnnotation . annExportedFrom .~ Nothing) + , [moduleName] + ) Just x -> Just (second (moduleName :) x) data Namespaced a = Namespaced IdeNamespace a @@ -137,5 +147,4 @@ completionFromMatch (Match (m, IdeDeclarationAnn ann decl), mns) = P.Infix -> "infix" P.Infixl -> "infixl" P.Infixr -> "infixr" - in T.unwords [asso, show p, r, "as", P.runOpName o] - + in T.unwords [asso, show p, r, "as", P.runOpName o] diff --git a/src/Language/PureScript/Ide/Error.hs b/src/Language/PureScript/Ide/Error.hs index 8a23f574e..194c96e26 100644 --- a/src/Language/PureScript/Ide/Error.hs +++ b/src/Language/PureScript/Ide/Error.hs @@ -8,63 +8,79 @@ -- Maintainer : Christoph Hegemann -- Stability : experimental -- --- | --- Error types for psc-ide + ----------------------------------------------------------------------------- -module Language.PureScript.Ide.Error - ( IdeError(..) - , prettyPrintTypeSingleLine - ) where +{- | +Error types for psc-ide +-} +module Language.PureScript.Ide.Error ( + IdeError (..), + prettyPrintTypeSingleLine, +) where -import Data.Aeson (KeyValue(..), ToJSON(..), Value, object) -import Data.Aeson.Types qualified as Aeson +import Data.Aeson (KeyValue (..), ToJSON (..), Value, object) import Data.Aeson.KeyMap qualified as KM +import Data.Aeson.Types qualified as Aeson import Data.Text qualified as T import Language.PureScript qualified as P import Language.PureScript.Errors.JSON (toJSONError) -import Language.PureScript.Ide.Types (ModuleIdent, Completion(..)) +import Language.PureScript.Ide.Types (Completion (..), ModuleIdent) import Protolude data IdeError - = GeneralError Text - | NotFound Text - | ModuleNotFound ModuleIdent - | ModuleFileNotFound ModuleIdent - | RebuildError [(FilePath, Text)] P.MultipleErrors - deriving (Show) + = GeneralError Text + | NotFound Text + | ModuleNotFound ModuleIdent + | ModuleFileNotFound ModuleIdent + | RebuildError [(FilePath, Text)] P.MultipleErrors + deriving (Show) instance ToJSON IdeError where - toJSON (RebuildError files errs) = object - [ "resultType" .= ("error" :: Text) - , "result" .= encodeRebuildErrors files errs - ] - toJSON err = object - [ "resultType" .= ("error" :: Text) - , "result" .= textError err - ] + toJSON (RebuildError files errs) = + object + [ "resultType" .= ("error" :: Text) + , "result" .= encodeRebuildErrors files errs + ] + toJSON err = + object + [ "resultType" .= ("error" :: Text) + , "result" .= textError err + ] encodeRebuildErrors :: [(FilePath, Text)] -> P.MultipleErrors -> Value encodeRebuildErrors files = toJSON . map encodeRebuildError . P.runMultipleErrors where encodeRebuildError err = case err of - (P.ErrorMessage _ - ((P.HoleInferredType name _ _ - (Just P.TSAfter{tsAfterIdentifiers=idents, tsAfterRecordFields=fields})))) -> - insertTSCompletions name idents (fromMaybe [] fields) (toJSON (toJSONError False P.Error files err)) + ( P.ErrorMessage + _ + ( ( P.HoleInferredType + name + _ + _ + (Just P.TSAfter {tsAfterIdentifiers = idents, tsAfterRecordFields = fields}) + ) + ) + ) -> + insertTSCompletions name idents (fromMaybe [] fields) (toJSON (toJSONError False P.Error files err)) _ -> (toJSON . toJSONError False P.Error files) err insertTSCompletions name idents fields (Aeson.Object value) = Aeson.Object - (KM.insert "pursIde" - (object [ "name" .= name - , "completions" .= ordNub (map identCompletion idents ++ map fieldCompletion fields) - ]) value) + ( KM.insert + "pursIde" + ( object + [ "name" .= name + , "completions" .= ordNub (map identCompletion idents ++ map fieldCompletion fields) + ] + ) + value + ) insertTSCompletions _ _ _ v = v identCompletion (P.Qualified mn i, ty) = - Completion + Completion { complModule = maybe "" P.runModuleName $ P.toMaybeModuleName mn , complIdentifier = i , complType = prettyPrintTypeSingleLine ty @@ -75,7 +91,7 @@ encodeRebuildErrors files = toJSON . map encodeRebuildError . P.runMultipleError , complDeclarationType = Nothing } fieldCompletion (label, ty) = - Completion + Completion { complModule = "" , complIdentifier = "_." <> P.prettyPrintLabel label , complType = prettyPrintTypeSingleLine ty @@ -87,11 +103,11 @@ encodeRebuildErrors files = toJSON . map encodeRebuildError . P.runMultipleError } textError :: IdeError -> Text -textError (GeneralError msg) = msg -textError (NotFound ident) = "Symbol '" <> ident <> "' not found." -textError (ModuleNotFound ident) = "Module '" <> ident <> "' not found." -textError (ModuleFileNotFound ident) = "Extern file for module " <> ident <> " could not be found" -textError (RebuildError _ err) = show err +textError (GeneralError msg) = msg +textError (NotFound ident) = "Symbol '" <> ident <> "' not found." +textError (ModuleNotFound ident) = "Module '" <> ident <> "' not found." +textError (ModuleFileNotFound ident) = "Extern file for module " <> ident <> " could not be found" +textError (RebuildError _ err) = show err prettyPrintTypeSingleLine :: P.Type a -> Text prettyPrintTypeSingleLine = T.unwords . map T.strip . T.lines . T.pack . P.prettyPrintTypeWithUnicode maxBound diff --git a/src/Language/PureScript/Ide/Externs.hs b/src/Language/PureScript/Ide/Externs.hs index 120c2da4f..c5ce9aecc 100644 --- a/src/Language/PureScript/Ide/Externs.hs +++ b/src/Language/PureScript/Ide/Externs.hs @@ -1,54 +1,60 @@ -{-# language PackageImports, BlockArguments #-} +{-# LANGUAGE BlockArguments #-} +{-# LANGUAGE PackageImports #-} -module Language.PureScript.Ide.Externs - ( readExternFile - , convertExterns - ) where +module Language.PureScript.Ide.Externs ( + readExternFile, + convertExterns, +) where -import Protolude hiding (to, from, (&)) +import Protolude hiding (from, to, (&)) import Codec.CBOR.Term as Term import Control.Lens (preview, view, (&), (^.)) -import "monad-logger" Control.Monad.Logger (MonadLogger, logErrorN) -import Data.Version (showVersion) import Data.Text qualified as Text +import Data.Version (showVersion) import Language.PureScript qualified as P -import Language.PureScript.Make.Monad qualified as Make import Language.PureScript.Ide.Error (IdeError (..)) -import Language.PureScript.Ide.Types (IdeDataConstructor(..), IdeDeclaration(..), IdeDeclarationAnn(..), IdeType(..), IdeTypeClass(..), IdeTypeOperator(..), IdeTypeSynonym(..), IdeValue(..), IdeValueOperator(..), _IdeDeclType, anyOf, emptyAnn, ideTypeKind, ideTypeName) +import Language.PureScript.Ide.Types (IdeDataConstructor (..), IdeDeclaration (..), IdeDeclarationAnn (..), IdeType (..), IdeTypeClass (..), IdeTypeOperator (..), IdeTypeSynonym (..), IdeValue (..), IdeValueOperator (..), anyOf, emptyAnn, ideTypeKind, ideTypeName, _IdeDeclType) import Language.PureScript.Ide.Util (properNameT) +import Language.PureScript.Make.Monad qualified as Make +import "monad-logger" Control.Monad.Logger (MonadLogger, logErrorN) -readExternFile - :: (MonadIO m, MonadError IdeError m, MonadLogger m) - => FilePath - -> m P.ExternsFile +readExternFile :: + (MonadIO m, MonadError IdeError m, MonadLogger m) => + FilePath -> + m P.ExternsFile readExternFile fp = do externsFile <- liftIO (Make.readCborFileIO fp) case externsFile of - Just externs | version == P.efVersion externs -> - pure externs + Just externs + | version == P.efVersion externs -> + pure externs _ -> liftIO (Make.readCborFileIO fp) >>= \case Just (Term.TList (_tag : Term.TString efVersion : _rest)) -> do let errMsg = "Version mismatch for the externs at: " - <> toS fp - <> " Expected: " <> version - <> " Found: " <> efVersion + <> toS fp + <> " Expected: " + <> version + <> " Found: " + <> efVersion logErrorN errMsg throwError (GeneralError errMsg) _ -> throwError (GeneralError ("Parsing the extern at: " <> toS fp <> " failed")) - where - version = toS (showVersion P.version) + where + version = toS (showVersion P.version) convertExterns :: P.ExternsFile -> ([IdeDeclarationAnn], [(P.ModuleName, P.DeclarationRef)]) convertExterns ef = (decls, exportDecls) where - decls = moduleDecl : map - (IdeDeclarationAnn emptyAnn) - (resolvedDeclarations <> operatorDecls <> tyOperatorDecls) + decls = + moduleDecl + : map + (IdeDeclarationAnn emptyAnn) + (resolvedDeclarations <> operatorDecls <> tyOperatorDecls) exportDecls = mapMaybe convertExport (P.efExports ef) operatorDecls = convertOperator <$> P.efFixities ef tyOperatorDecls = convertTypeOperator <$> P.efTypeFixities ef @@ -57,10 +63,10 @@ convertExterns ef = second catMaybes (partitionEithers (map convertDecl (P.efDeclarations ef))) resolvedDeclarations = resolveSynonymsAndClasses toResolve declarations -resolveSynonymsAndClasses - :: [ToResolve] - -> [IdeDeclaration] - -> [IdeDeclaration] +resolveSynonymsAndClasses :: + [ToResolve] -> + [IdeDeclaration] -> + [IdeDeclaration] resolveSynonymsAndClasses trs decls = foldr go decls trs where go tr acc = case tr of @@ -68,16 +74,17 @@ resolveSynonymsAndClasses trs decls = foldr go decls trs case findType (P.coerceProperName tcn) acc of Nothing -> acc - Just tyDecl -> IdeDeclTypeClass - (IdeTypeClass tcn (tyDecl ^. ideTypeKind) []) - : filter (not . anyOf (_IdeDeclType . ideTypeName) (== P.coerceProperName tcn)) acc + Just tyDecl -> + IdeDeclTypeClass + (IdeTypeClass tcn (tyDecl ^. ideTypeKind) []) + : filter (not . anyOf (_IdeDeclType . ideTypeName) (== P.coerceProperName tcn)) acc SynonymToResolve tn ty -> case findType tn acc of Nothing -> acc Just tyDecl -> IdeDeclTypeSynonym (IdeTypeSynonym tn ty (tyDecl ^. ideTypeKind)) - : filter (not . anyOf (_IdeDeclType . ideTypeName) (== tn)) acc + : filter (not . anyOf (_IdeDeclType . ideTypeName) (== tn)) acc findType :: P.ProperName 'P.TypeName -> [IdeDeclaration] -> Maybe IdeType findType tn decls = @@ -102,41 +109,44 @@ convertDecl ed = case ed of -- We need to filter all types and synonyms that contain a '$' -- because those are typechecker internal definitions that shouldn't -- be user facing - P.EDType{..} -> Right do + P.EDType {..} -> Right do guard (isNothing (Text.find (== '$') (edTypeName ^. properNameT))) Just (IdeDeclType (IdeType edTypeName edTypeKind [])) - P.EDTypeSynonym{..} -> + P.EDTypeSynonym {..} -> if isNothing (Text.find (== '$') (edTypeSynonymName ^. properNameT)) then Left (SynonymToResolve edTypeSynonymName edTypeSynonymType) else Right Nothing - P.EDDataConstructor{..} -> Right do + P.EDDataConstructor {..} -> Right do guard (isNothing (Text.find (== '$') (edDataCtorName ^. properNameT))) Just - (IdeDeclDataConstructor - (IdeDataConstructor edDataCtorName edDataCtorTypeCtor edDataCtorType)) - P.EDValue{..} -> + ( IdeDeclDataConstructor + (IdeDataConstructor edDataCtorName edDataCtorTypeCtor edDataCtorType) + ) + P.EDValue {..} -> Right (Just (IdeDeclValue (IdeValue edValueName edValueType))) - P.EDClass{..} -> + P.EDClass {..} -> Left (TypeClassToResolve edClassName) - P.EDInstance{} -> + P.EDInstance {} -> Right Nothing convertOperator :: P.ExternsFixity -> IdeDeclaration -convertOperator P.ExternsFixity{..} = +convertOperator P.ExternsFixity {..} = IdeDeclValueOperator - (IdeValueOperator - efOperator - efAlias - efPrecedence - efAssociativity - Nothing) + ( IdeValueOperator + efOperator + efAlias + efPrecedence + efAssociativity + Nothing + ) convertTypeOperator :: P.ExternsTypeFixity -> IdeDeclaration -convertTypeOperator P.ExternsTypeFixity{..} = +convertTypeOperator P.ExternsTypeFixity {..} = IdeDeclTypeOperator - (IdeTypeOperator - efTypeOperator - efTypeAlias - efTypePrecedence - efTypeAssociativity - Nothing) + ( IdeTypeOperator + efTypeOperator + efTypeAlias + efTypePrecedence + efTypeAssociativity + Nothing + ) diff --git a/src/Language/PureScript/Ide/Filter.hs b/src/Language/PureScript/Ide/Filter.hs index 9bb29d6e4..71506fb70 100644 --- a/src/Language/PureScript/Ide/Filter.hs +++ b/src/Language/PureScript/Ide/Filter.hs @@ -8,40 +8,42 @@ -- Maintainer : Christoph Hegemann -- Stability : experimental -- --- | --- Filters for psc-ide commands ------------------------------------------------------------------------------ -module Language.PureScript.Ide.Filter - ( Filter - , moduleFilter - , namespaceFilter - , exactFilter - , prefixFilter - , declarationTypeFilter - , dependencyFilter - , applyFilters - ) where +----------------------------------------------------------------------------- -import Protolude hiding (isPrefixOf, Prefix) +{- | +Filters for psc-ide commands +-} +module Language.PureScript.Ide.Filter ( + Filter, + moduleFilter, + namespaceFilter, + exactFilter, + prefixFilter, + declarationTypeFilter, + dependencyFilter, + applyFilters, +) where + +import Protolude hiding (Prefix, isPrefixOf) import Control.Monad.Fail (fail) -import Data.Aeson (FromJSON(..), withObject, (.:), (.:?)) -import Data.Text (isPrefixOf) -import Data.Set qualified as Set +import Data.Aeson (FromJSON (..), withObject, (.:), (.:?)) import Data.Map qualified as Map +import Data.Set qualified as Set +import Data.Text (isPrefixOf) import Language.PureScript.Ide.Filter.Declaration (DeclarationType) -import Language.PureScript.Ide.Types (IdeDeclarationAnn, IdeNamespace, ModuleMap, declarationType) import Language.PureScript.Ide.Imports (Import, sliceImportSection) +import Language.PureScript.Ide.Types (IdeDeclarationAnn, IdeNamespace, ModuleMap, declarationType) import Language.PureScript.Ide.Util (discardAnn, identifierFromIdeDeclaration, namespaceForDeclaration) -import Language.PureScript qualified as P import Data.Text qualified as T +import Language.PureScript qualified as P import Language.PureScript.Ide.Filter.Imports (matchImport) newtype Filter = Filter (Either (Set P.ModuleName) DeclarationFilter) - deriving Show + deriving (Show) unFilter :: Filter -> Either (Set P.ModuleName) DeclarationFilter unFilter (Filter f) = f @@ -51,8 +53,8 @@ data DeclarationFilter | Exact Text | Namespace (Set IdeNamespace) | DeclType (Set DeclarationType) - | Dependencies { qualifier :: Maybe P.ModuleName, currentModuleName :: P.ModuleName, dependencyImports :: [Import] } - deriving Show + | Dependencies {qualifier :: Maybe P.ModuleName, currentModuleName :: P.ModuleName, dependencyImports :: [Import]} + deriving (Show) -- | Only keeps Declarations in the given modules moduleFilter :: Set P.ModuleName -> Filter @@ -82,7 +84,7 @@ optimizeFilters = first smashModuleFilters . partitionEithers . map unFilter where smashModuleFilters [] = Nothing - smashModuleFilters (x:xs) = + smashModuleFilters (x : xs) = Just (foldr Set.intersection x xs) applyFilters :: [Filter] -> ModuleMap [IdeDeclarationAnn] -> ModuleMap [IdeDeclarationAnn] @@ -92,19 +94,19 @@ applyFilters fs modules = case optimizeFilters fs of (Just moduleFilter', declarationFilters) -> applyDeclarationFilters declarationFilters (Map.restrictKeys modules moduleFilter') -applyDeclarationFilters - :: [DeclarationFilter] - -> ModuleMap [IdeDeclarationAnn] - -> ModuleMap [IdeDeclarationAnn] +applyDeclarationFilters :: + [DeclarationFilter] -> + ModuleMap [IdeDeclarationAnn] -> + ModuleMap [IdeDeclarationAnn] applyDeclarationFilters fs = Map.filter (not . null) - . Map.mapWithKey (\modl decls -> foldr (.) identity (map (applyDeclarationFilter modl) fs) decls) + . Map.mapWithKey (\modl decls -> foldr (.) identity (map (applyDeclarationFilter modl) fs) decls) -applyDeclarationFilter - :: P.ModuleName - -> DeclarationFilter - -> [IdeDeclarationAnn] - -> [IdeDeclarationAnn] +applyDeclarationFilter :: + P.ModuleName -> + DeclarationFilter -> + [IdeDeclarationAnn] -> + [IdeDeclarationAnn] applyDeclarationFilter modl f = case f of Prefix prefix -> prefixFilter' prefix Exact t -> exactFilter' t @@ -130,10 +132,9 @@ declarationTypeFilter' declTypes = dependencyFilter' :: P.ModuleName -> Maybe P.ModuleName -> P.ModuleName -> [Import] -> [IdeDeclarationAnn] -> [IdeDeclarationAnn] dependencyFilter' modl qual currentModuleName imports = - if modl == currentModuleName && isNothing qual then - identity - else - filter (\decl -> any (matchImport qual modl decl) imports) + if modl == currentModuleName && isNothing qual + then identity + else filter (\decl -> any (matchImport qual modl decl) imports) instance FromJSON Filter where parseJSON = withObject "filter" $ \o -> do @@ -164,5 +165,5 @@ instance FromJSON Filter where qualifier <- fmap P.moduleNameFromString <$> params .:? "qualifier" case sliceImportSection (T.lines moduleText) of Left err -> fail ("Couldn't parse module imports: " <> T.unpack err) - Right (currentModuleName, _, imports, _ ) -> pure (dependencyFilter qualifier currentModuleName imports) + Right (currentModuleName, _, imports, _) -> pure (dependencyFilter qualifier currentModuleName imports) s -> fail ("Unknown filter: " <> show s) diff --git a/src/Language/PureScript/Ide/Filter/Declaration.hs b/src/Language/PureScript/Ide/Filter/Declaration.hs index 7875f7851..80d339d0e 100644 --- a/src/Language/PureScript/Ide/Filter/Declaration.hs +++ b/src/Language/PureScript/Ide/Filter/Declaration.hs @@ -1,11 +1,11 @@ -module Language.PureScript.Ide.Filter.Declaration - ( DeclarationType(..) - ) where +module Language.PureScript.Ide.Filter.Declaration ( + DeclarationType (..), +) where -import Protolude hiding (isPrefixOf) +import Protolude hiding (isPrefixOf) import Control.Monad.Fail (fail) -import Data.Aeson (FromJSON(..), ToJSON(..), withText) +import Data.Aeson (FromJSON (..), ToJSON (..), withText) data DeclarationType = Value @@ -20,23 +20,24 @@ data DeclarationType instance FromJSON DeclarationType where parseJSON = withText "Declaration type tag" $ \case - "value" -> pure Value - "type" -> pure Type - "synonym" -> pure Synonym - "dataconstructor" -> pure DataConstructor - "typeclass" -> pure TypeClass - "valueoperator" -> pure ValueOperator - "typeoperator" -> pure TypeOperator - "module" -> pure Module - s -> fail ("Unknown declaration type: " <> show s) + "value" -> pure Value + "type" -> pure Type + "synonym" -> pure Synonym + "dataconstructor" -> pure DataConstructor + "typeclass" -> pure TypeClass + "valueoperator" -> pure ValueOperator + "typeoperator" -> pure TypeOperator + "module" -> pure Module + s -> fail ("Unknown declaration type: " <> show s) instance ToJSON DeclarationType where - toJSON = toJSON . \case - Value -> "value" :: Text - Type -> "type" - Synonym -> "synonym" - DataConstructor -> "dataconstructor" - TypeClass -> "typeclass" - ValueOperator -> "valueoperator" - TypeOperator -> "typeoperator" - Module -> "module" + toJSON = + toJSON . \case + Value -> "value" :: Text + Type -> "type" + Synonym -> "synonym" + DataConstructor -> "dataconstructor" + TypeClass -> "typeclass" + ValueOperator -> "valueoperator" + TypeOperator -> "typeoperator" + Module -> "module" diff --git a/src/Language/PureScript/Ide/Filter/Imports.hs b/src/Language/PureScript/Ide/Filter/Imports.hs index bd1d70065..eaf7bf9af 100644 --- a/src/Language/PureScript/Ide/Filter/Imports.hs +++ b/src/Language/PureScript/Ide/Filter/Imports.hs @@ -1,16 +1,15 @@ module Language.PureScript.Ide.Filter.Imports where +import Protolude hiding (isPrefixOf) -import Protolude hiding (isPrefixOf) - -import Language.PureScript.Ide.Types (IdeDataConstructor(..), IdeDeclaration(..), IdeDeclarationAnn(..), IdeType(..), IdeTypeClass(..), IdeTypeOperator(..), IdeTypeSynonym(..), IdeValue(..), IdeValueOperator(..)) -import Language.PureScript.Ide.Imports (Import(..)) +import Language.PureScript.Ide.Imports (Import (..)) +import Language.PureScript.Ide.Types (IdeDataConstructor (..), IdeDeclaration (..), IdeDeclarationAnn (..), IdeType (..), IdeTypeClass (..), IdeTypeOperator (..), IdeTypeSynonym (..), IdeValue (..), IdeValueOperator (..)) import Language.PureScript qualified as P matchImport :: Maybe P.ModuleName -> P.ModuleName -> IdeDeclarationAnn -> Import -> Bool matchImport matchQualifier declMod (IdeDeclarationAnn _ decl) (Import importMod declTy qualifier) | declMod == importMod && matchQualifier == qualifier = - case declTy of + case declTy of P.Implicit -> True P.Explicit refs -> any (matchRef decl) refs P.Hiding refs -> not $ any (matchRef decl) refs @@ -18,14 +17,11 @@ matchImport matchQualifier declMod (IdeDeclarationAnn _ decl) (Import importMod matchRef (IdeDeclValue (IdeValue ident _)) (P.ValueRef _ ident') = ident == ident' matchRef (IdeDeclType (IdeType tname _kind _dctors)) (P.TypeRef _ tname' _dctors') = tname == tname' matchRef (IdeDeclTypeSynonym (IdeTypeSynonym tname _type _kind)) (P.TypeRef _ tname' _dctors) = tname == tname' -- Can this occur? - matchRef (IdeDeclDataConstructor (IdeDataConstructor dcname tname _type)) (P.TypeRef _ tname' dctors) = tname == tname' - && maybe True (dcname `elem`) dctors -- (..) or explicitly lists constructor - + && maybe True (dcname `elem`) dctors -- (..) or explicitly lists constructor matchRef (IdeDeclTypeClass (IdeTypeClass tcname _kind _instances)) (P.TypeClassRef _ tcname') = tcname == tcname' - matchRef (IdeDeclValueOperator (IdeValueOperator{ _ideValueOpName })) (P.ValueOpRef _ opname) = _ideValueOpName == opname - matchRef (IdeDeclTypeOperator (IdeTypeOperator{ _ideTypeOpName })) (P.TypeOpRef _ opname) = _ideTypeOpName == opname + matchRef (IdeDeclValueOperator (IdeValueOperator {_ideValueOpName})) (P.ValueOpRef _ opname) = _ideValueOpName == opname + matchRef (IdeDeclTypeOperator (IdeTypeOperator {_ideTypeOpName})) (P.TypeOpRef _ opname) = _ideTypeOpName == opname matchRef _ _ = False - matchImport _ _ _ _ = False diff --git a/src/Language/PureScript/Ide/Imports.hs b/src/Language/PureScript/Ide/Imports.hs index b96f090a7..dd1500405 100644 --- a/src/Language/PureScript/Ide/Imports.hs +++ b/src/Language/PureScript/Ide/Imports.hs @@ -8,63 +8,68 @@ -- Maintainer : Christoph Hegemann -- Stability : experimental -- --- | --- Provides functionality to manage imports + ----------------------------------------------------------------------------- -module Language.PureScript.Ide.Imports - ( parseImportsFromFile - , parseImportsFromFile' - -- for tests - , parseImport - , prettyPrintImportSection - , sliceImportSection - , prettyPrintImport' - , Import(Import) - ) - where +{- | +Provides functionality to manage imports +-} +module Language.PureScript.Ide.Imports ( + parseImportsFromFile, + parseImportsFromFile', + -- for tests + parseImport, + prettyPrintImportSection, + sliceImportSection, + prettyPrintImport', + Import (Import), +) +where import Protolude hiding (moduleName) -import Control.Lens ((^.), (%~), ix) +import Control.Lens (ix, (%~), (^.)) import Data.List (partition) import Data.List.NonEmpty qualified as NE import Data.Text qualified as T import Language.PureScript qualified as P import Language.PureScript.CST qualified as CST -import Language.PureScript.Ide.Error (IdeError(..)) +import Language.PureScript.Ide.Error (IdeError (..)) import Language.PureScript.Ide.Util (ideReadFile) data Import = Import P.ModuleName P.ImportDeclarationType (Maybe P.ModuleName) - deriving (Eq, Show) + deriving (Eq, Show) --- | Reads a file and returns the parsed module name as well as the parsed --- imports, while ignoring eventual parse errors that aren't relevant to the --- import section -parseImportsFromFile - :: (MonadIO m, MonadError IdeError m) - => FilePath - -> m (P.ModuleName, [(P.ModuleName, P.ImportDeclarationType, Maybe P.ModuleName)]) +{- | Reads a file and returns the parsed module name as well as the parsed +imports, while ignoring eventual parse errors that aren't relevant to the +import section +-} +parseImportsFromFile :: + (MonadIO m, MonadError IdeError m) => + FilePath -> + m (P.ModuleName, [(P.ModuleName, P.ImportDeclarationType, Maybe P.ModuleName)]) parseImportsFromFile file = do (mn, _, imports, _) <- parseImportsFromFile' file pure (mn, unwrapImport <$> imports) where unwrapImport (Import a b c) = (a, b, c) --- | Reads a file and returns the (lines before the imports, the imports, the --- lines after the imports) -parseImportsFromFile' - :: (MonadIO m, MonadError IdeError m) - => FilePath - -> m (P.ModuleName, [Text], [Import], [Text]) +{- | Reads a file and returns the (lines before the imports, the imports, the +lines after the imports) +-} +parseImportsFromFile' :: + (MonadIO m, MonadError IdeError m) => + FilePath -> + m (P.ModuleName, [Text], [Import], [Text]) parseImportsFromFile' fp = do (_, file) <- ideReadFile fp case sliceImportSection (T.lines file) of Right res -> pure res Left err -> throwError (GeneralError err) --- | @ImportParse@ holds the data we extract out of a partial parse of the --- sourcefile +{- | @ImportParse@ holds the data we extract out of a partial parse of the +sourcefile +-} data ImportParse = ImportParse { ipModuleName :: P.ModuleName -- ^ the module name we parse @@ -83,7 +88,7 @@ parseModuleHeader src = do let mn = CST.nameValue $ CST.modNamespace md decls = flip fmap (CST.modImports md) $ \decl -> do - let ((ss, _), mn', it, qual) = CST.convertImportDecl "" decl + let ((ss, _), mn', it, qual) = CST.runConvert $ CST.convertImportDecl "" decl (ss, Import mn' it qual) case (head decls, lastMay decls) of (Just hd, Just ls) -> do @@ -97,13 +102,13 @@ parseModuleHeader src = do sliceImportSection :: [Text] -> Either Text (P.ModuleName, [Text], [Import], [Text]) sliceImportSection fileLines = first (toS . CST.prettyPrintError . NE.head) $ do - ImportParse{..} <- parseModuleHeader file + ImportParse {..} <- parseModuleHeader file pure ( ipModuleName , sliceFile (P.SourcePos 1 1) (prevPos ipStart) , ipImports - -- Not sure why I need to drop 1 here, but it makes the tests pass - , drop 1 (sliceFile (nextPos ipEnd) (P.SourcePos (length fileLines) (lineLength (length fileLines)))) + , -- Not sure why I need to drop 1 here, but it makes the tests pass + drop 1 (sliceFile (nextPos ipEnd) (P.SourcePos (length fileLines) (lineLength (length fileLines)))) ) where prevPos (P.SourcePos l c) @@ -117,10 +122,10 @@ sliceImportSection fileLines = first (toS . CST.prettyPrintError . NE.head) $ do lineLength l = T.length (fileLines ^. ix (l - 1)) sliceFile (P.SourcePos l1 c1) (P.SourcePos l2 c2) = fileLines - & drop (l1 - 1) - & take (l2 - l1 + 1) - & ix 0 %~ T.drop (c1 - 1) - & ix (l2 - l1) %~ T.take c2 + & drop (l1 - 1) + & take (l2 - l1 + 1) + & ix 0 %~ T.drop (c1 - 1) + & ix (l2 - l1) %~ T.take c2 prettyPrintImport' :: Import -> Text prettyPrintImport' (Import mn idt qual) = @@ -130,7 +135,7 @@ prettyPrintImportSection :: [Import] -> [Text] prettyPrintImportSection imports = let (implicitImports, explicitImports) = partition isImplicitImport imports - in + in sort (map prettyPrintImport' implicitImports) -- Only add the extra spacing if both implicit as well as -- explicit/qualified imports exist @@ -146,9 +151,9 @@ prettyPrintImportSection imports = -- | Test and ghci helper parseImport :: Text -> Maybe Import parseImport t = - case fmap (CST.convertImportDecl "" . snd) - $ CST.runTokenParser CST.parseImportDeclP - $ CST.lex t of + case fmap (CST.runConvert . CST.convertImportDecl "" . snd) $ + CST.runTokenParser CST.parseImportDeclP $ + CST.lex t of Right (_, mn, idt, mmn) -> Just (Import mn idt mmn) _ -> Nothing diff --git a/src/Language/PureScript/Ide/Imports/Actions.hs b/src/Language/PureScript/Ide/Imports/Actions.hs index bc79f2184..49a845750 100644 --- a/src/Language/PureScript/Ide/Imports/Actions.hs +++ b/src/Language/PureScript/Ide/Imports/Actions.hs @@ -1,40 +1,41 @@ -module Language.PureScript.Ide.Imports.Actions - ( addImplicitImport - , addQualifiedImport - , addImportForIdentifier - , answerRequest - - -- for tests - , addImplicitImport' - , addQualifiedImport' - , addExplicitImport' - ) +module Language.PureScript.Ide.Imports.Actions ( + addImplicitImport, + addQualifiedImport, + addImportForIdentifier, + answerRequest, + -- for tests + addImplicitImport', + addQualifiedImport', + addExplicitImport', +) where import Protolude hiding (moduleName) -import Control.Lens ((^.), has) +import Control.Lens (has, (^.)) import Data.List (nubBy) import Data.Map qualified as Map import Data.Text qualified as T import Language.PureScript qualified as P import Language.PureScript.Constants.Prim qualified as C import Language.PureScript.Ide.Completion (getExactMatches) -import Language.PureScript.Ide.Error (IdeError(..)) +import Language.PureScript.Ide.Error (IdeError (..)) import Language.PureScript.Ide.Filter (Filter) -import Language.PureScript.Ide.Imports (Import(..), parseImportsFromFile', prettyPrintImportSection) -import Language.PureScript.Ide.State (getAllModules) +import Language.PureScript.Ide.Imports (Import (..), parseImportsFromFile', prettyPrintImportSection) import Language.PureScript.Ide.Prim (idePrimDeclarations) -import Language.PureScript.Ide.Types (Ide, IdeDeclaration(..), IdeType(..), Match(..), Success(..), _IdeDeclModule, ideDtorName, ideDtorTypeName, ideTCName, ideTypeName, ideTypeOpName, ideValueOpName) +import Language.PureScript.Ide.State (getAllModules) +import Language.PureScript.Ide.Types (Ide, IdeDeclaration (..), IdeType (..), Match (..), Success (..), ideDtorName, ideDtorTypeName, ideTCName, ideTypeName, ideTypeOpName, ideValueOpName, _IdeDeclModule) import Language.PureScript.Ide.Util (discardAnn, identifierFromIdeDeclaration) import System.IO.UTF8 (writeUTF8FileT) -- | Adds an implicit import like @import Prelude@ to a Sourcefile. -addImplicitImport - :: (MonadIO m, MonadError IdeError m) - => FilePath -- ^ The source file read from - -> P.ModuleName -- ^ The module to import - -> m [Text] +addImplicitImport :: + (MonadIO m, MonadError IdeError m) => + -- | The source file read from + FilePath -> + -- | The module to import + P.ModuleName -> + m [Text] addImplicitImport fp mn = do (_, pre, imports, post) <- parseImportsFromFile' fp let newImportSection = addImplicitImport' imports mn @@ -45,15 +46,15 @@ addImplicitImport' imports mn = prettyPrintImportSection (Import mn P.Implicit Nothing : imports) -- | Adds a qualified import like @import Data.Map as Map@ to a source file. -addQualifiedImport - :: (MonadIO m, MonadError IdeError m) - => FilePath - -- ^ The sourcefile read from - -> P.ModuleName - -- ^ The module to import - -> P.ModuleName - -- ^ The qualifier under which to import - -> m [Text] +addQualifiedImport :: + (MonadIO m, MonadError IdeError m) => + -- | The sourcefile read from + FilePath -> + -- | The module to import + P.ModuleName -> + -- | The qualifier under which to import + P.ModuleName -> + m [Text] addQualifiedImport fp mn qualifier = do (_, pre, imports, post) <- parseImportsFromFile' fp let newImportSection = addQualifiedImport' imports mn qualifier @@ -63,47 +64,61 @@ addQualifiedImport' :: [Import] -> P.ModuleName -> P.ModuleName -> [Text] addQualifiedImport' imports mn qualifier = prettyPrintImportSection (Import mn P.Implicit (Just qualifier) : imports) --- | Adds an explicit import like @import Prelude (unit)@ to a Sourcefile. If an --- explicit import already exists for the given module, it adds the identifier --- to that imports list. --- --- So @addExplicitImport "/File.purs" "bind" "Prelude"@ with an already existing --- @import Prelude (bind)@ in the file File.purs returns @["import Prelude --- (bind, unit)"]@ -addExplicitImport :: (MonadIO m, MonadError IdeError m) => - FilePath -> IdeDeclaration -> P.ModuleName -> Maybe P.ModuleName -> m [Text] +{- | Adds an explicit import like @import Prelude (unit)@ to a Sourcefile. If an +explicit import already exists for the given module, it adds the identifier +to that imports list. + +So @addExplicitImport "/File.purs" "bind" "Prelude"@ with an already existing +@import Prelude (bind)@ in the file File.purs returns @["import Prelude +(bind, unit)"]@ +-} +addExplicitImport :: + (MonadIO m, MonadError IdeError m) => + FilePath -> + IdeDeclaration -> + P.ModuleName -> + Maybe P.ModuleName -> + m [Text] addExplicitImport fp decl moduleName qualifier = do (mn, pre, imports, post) <- parseImportsFromFile' fp let newImportSection = -- TODO: Open an issue when this PR is merged, we should optimise this -- so that this case does not write to disc if mn == moduleName - then imports - else addExplicitImport' decl moduleName qualifier imports + then imports + else addExplicitImport' decl moduleName qualifier imports pure $ joinSections (pre, prettyPrintImportSection newImportSection, post) addExplicitImport' :: IdeDeclaration -> P.ModuleName -> Maybe P.ModuleName -> [Import] -> [Import] addExplicitImport' decl moduleName qualifier imports = let isImplicitlyImported = - any (\case - Import mn P.Implicit qualifier' -> mn == moduleName && qualifier == qualifier' - _ -> False) imports + any + ( \case + Import mn P.Implicit qualifier' -> mn == moduleName && qualifier == qualifier' + _ -> False + ) + imports isNotExplicitlyImportedFromPrim = - moduleName == C.M_Prim && - not (any (\case - Import C.M_Prim (P.Explicit _) Nothing -> True - _ -> False) imports) + moduleName == C.M_Prim + && not + ( any + ( \case + Import C.M_Prim (P.Explicit _) Nothing -> True + _ -> False + ) + imports + ) -- We can't import Modules from other modules isModule = has _IdeDeclModule decl matches (Import mn (P.Explicit _) qualifier') = mn == moduleName && qualifier == qualifier' matches _ = False freshImport = Import moduleName (P.Explicit [refFromDeclaration decl]) qualifier - in + in if isImplicitlyImported || isNotExplicitlyImportedFromPrim || isModule - then imports - else updateAtFirstOrPrepend matches (insertDeclIntoImport decl) freshImport imports + then imports + else updateAtFirstOrPrepend matches (insertDeclIntoImport decl) freshImport imports where refFromDeclaration (IdeDeclTypeClass tc) = P.TypeClassRef ideSpan (tc ^. ideTCName) @@ -146,22 +161,26 @@ addExplicitImport' decl moduleName qualifier imports = matchType tn (P.TypeRef _ n _) = tn == n matchType _ _ = False +{- | Looks up the given identifier in the currently loaded modules. --- | Looks up the given identifier in the currently loaded modules. --- --- * Throws an error if the identifier cannot be found. --- --- * If exactly one match is found, adds an explicit import to the importsection --- --- * If more than one possible imports are found, reports the possibilities as a --- list of completions. -addImportForIdentifier - :: (Ide m, MonadError IdeError m) - => FilePath -- ^ The Sourcefile to read from - -> Text -- ^ The identifier to import - -> Maybe P.ModuleName -- ^ The optional qualifier under which to import - -> [Filter] -- ^ Filters to apply before searching for the identifier - -> m (Either [Match IdeDeclaration] [Text]) +* Throws an error if the identifier cannot be found. + +* If exactly one match is found, adds an explicit import to the importsection + +* If more than one possible imports are found, reports the possibilities as a +list of completions. +-} +addImportForIdentifier :: + (Ide m, MonadError IdeError m) => + -- | The Sourcefile to read from + FilePath -> + -- | The identifier to import + Text -> + -- | The optional qualifier under which to import + Maybe P.ModuleName -> + -- | Filters to apply before searching for the identifier + [Filter] -> + m (Either [Match IdeDeclaration] [Text]) addImportForIdentifier fp ident qual filters = do let addPrim = Map.union idePrimDeclarations modules <- getAllModules Nothing @@ -173,14 +192,15 @@ addImportForIdentifier fp ident qual filters = do case matches of [] -> - throwError (NotFound "Couldn't find the given identifier. \ - \Have you loaded the corresponding module?") - + throwError + ( NotFound + "Couldn't find the given identifier. \ + \Have you loaded the corresponding module?" + ) -- Only one match was found for the given identifier, so we can insert it -- right away [Match (m, decl)] -> Right <$> addExplicitImport fp decl m qual - -- This case comes up for newtypes and dataconstructors. Because values and -- types don't share a namespace we can get multiple matches from the same -- module. This also happens for parameterized types, as these generate both @@ -188,64 +208,63 @@ addImportForIdentifier fp ident qual filters = do ms@[Match (m1, d1), Match (m2, d2)] -> if m1 /= m2 - -- If the modules don't line up we just ask the user to specify the - -- module - then pure (Left ms) - else case decideRedundantCase d1 d2 <|> decideRedundantCase d2 d1 of - -- If dataconstructor and type line up we just import the - -- dataconstructor as that will give us an unnecessary import warning at - -- worst - Just decl -> - Right <$> addExplicitImport fp decl m1 qual - -- Here we need the user to specify whether they wanted a - -- dataconstructor or a type - Nothing -> - throwError (GeneralError "Undecidable between type and dataconstructor") - + then -- If the modules don't line up we just ask the user to specify the + -- module + pure (Left ms) + else case decideRedundantCase d1 d2 <|> decideRedundantCase d2 d1 of + -- If dataconstructor and type line up we just import the + -- dataconstructor as that will give us an unnecessary import warning at + -- worst + Just decl -> + Right <$> addExplicitImport fp decl m1 qual + -- Here we need the user to specify whether they wanted a + -- dataconstructor or a type + Nothing -> + throwError (GeneralError "Undecidable between type and dataconstructor") -- Multiple matches were found so we need to ask the user to clarify which -- module they meant xs -> pure (Left xs) - where - decideRedundantCase d@(IdeDeclDataConstructor dtor) (IdeDeclType t) = - if dtor ^. ideDtorTypeName == t ^. ideTypeName then Just d else Nothing - decideRedundantCase IdeDeclType{} ts@IdeDeclTypeSynonym{} = - Just ts - decideRedundantCase _ _ = Nothing - --- | Writes a list of lines to @Just filepath@ and responds with a @TextResult@, --- or returns the lines as a @MultilineTextResult@ if @Nothing@ was given as the --- first argument. + where + decideRedundantCase d@(IdeDeclDataConstructor dtor) (IdeDeclType t) = + if dtor ^. ideDtorTypeName == t ^. ideTypeName then Just d else Nothing + decideRedundantCase IdeDeclType {} ts@IdeDeclTypeSynonym {} = + Just ts + decideRedundantCase _ _ = Nothing + +{- | Writes a list of lines to @Just filepath@ and responds with a @TextResult@, +or returns the lines as a @MultilineTextResult@ if @Nothing@ was given as the +first argument. +-} answerRequest :: (MonadIO m) => Maybe FilePath -> [Text] -> m Success -answerRequest outfp rs = +answerRequest outfp rs = case outfp of Nothing -> pure (MultilineTextResult rs) Just outfp' -> do liftIO (writeUTF8FileT outfp' (T.unlines rs)) pure (TextResult ("Written to " <> T.pack outfp')) - --- | If none of the elements of the list satisfy the given predicate 'predicate', then prepend the default value 'def' --- to the given list. Otherwise, update the first element of the list that satisfies 'predicate' with the updating --- function 'update'. +{- | If none of the elements of the list satisfy the given predicate 'predicate', then prepend the default value 'def' +to the given list. Otherwise, update the first element of the list that satisfies 'predicate' with the updating +function 'update'. +-} updateAtFirstOrPrepend :: (a -> Bool) -> (a -> a) -> a -> [a] -> [a] updateAtFirstOrPrepend predicate update def xs = case break predicate xs of (before, []) -> def : before (before, x : after) -> before ++ [update x] ++ after - ideSpan :: P.SourceSpan ideSpan = P.internalModuleSourceSpan "" joinSections :: ([Text], [Text], [Text]) -> [Text] joinSections (pre, decls, post) = pre `joinLine` (decls `joinLine` post) where - isBlank = T.all (== ' ') - joinLine as bs - | Just ln1 <- lastMay as - , Just ln2 <- head bs - , not (isBlank ln1) && not (isBlank ln2) = - as ++ [""] ++ bs - | otherwise = - as ++ bs + isBlank = T.all (== ' ') + joinLine as bs + | Just ln1 <- lastMay as + , Just ln2 <- head bs + , not (isBlank ln1) && not (isBlank ln2) = + as ++ [""] ++ bs + | otherwise = + as ++ bs diff --git a/src/Language/PureScript/Ide/Logging.hs b/src/Language/PureScript/Ide/Logging.hs index 925881b2d..a86a23436 100644 --- a/src/Language/PureScript/Ide/Logging.hs +++ b/src/Language/PureScript/Ide/Logging.hs @@ -1,29 +1,32 @@ -{-# LANGUAGE PackageImports #-} +{-# LANGUAGE PackageImports #-} -module Language.PureScript.Ide.Logging - ( runLogger - , logPerf - , displayTimeSpec - , labelTimespec - ) where +module Language.PureScript.Ide.Logging ( + runLogger, + logPerf, + displayTimeSpec, + labelTimespec, +) where import Protolude -import "monad-logger" Control.Monad.Logger (LogLevel(..), LoggingT, MonadLogger, filterLogger, logOtherN, runStdoutLoggingT) import Data.Text qualified as T -import Language.PureScript.Ide.Types (IdeLogLevel(..)) -import System.Clock (Clock(..), TimeSpec, diffTimeSpec, getTime, toNanoSecs) +import Language.PureScript.Ide.Types (IdeLogLevel (..)) +import System.Clock (Clock (..), TimeSpec, diffTimeSpec, getTime, toNanoSecs) import Text.Printf (printf) +import "monad-logger" Control.Monad.Logger (LogLevel (..), LoggingT, MonadLogger, filterLogger, logOtherN, runStdoutLoggingT) -runLogger :: MonadIO m => IdeLogLevel -> LoggingT m a -> m a +runLogger :: (MonadIO m) => IdeLogLevel -> LoggingT m a -> m a runLogger logLevel' = - runStdoutLoggingT . filterLogger (\_ logLevel -> - case logLevel' of - LogAll -> True - LogDefault -> not (logLevel == LevelOther "perf" || logLevel == LevelDebug) - LogNone -> False - LogDebug -> logLevel /= LevelOther "perf" - LogPerf -> logLevel == LevelOther "perf") + runStdoutLoggingT + . filterLogger + ( \_ logLevel -> + case logLevel' of + LogAll -> True + LogDefault -> not (logLevel == LevelOther "perf" || logLevel == LevelDebug) + LogNone -> False + LogDebug -> logLevel /= LevelOther "perf" + LogPerf -> logLevel == LevelOther "perf" + ) labelTimespec :: Text -> TimeSpec -> Text labelTimespec label duration = label <> ": " <> displayTimeSpec duration diff --git a/src/Language/PureScript/Ide/Matcher.hs b/src/Language/PureScript/Ide/Matcher.hs index d77516bd3..f50c83293 100644 --- a/src/Language/PureScript/Ide/Matcher.hs +++ b/src/Language/PureScript/Ide/Matcher.hs @@ -8,21 +8,23 @@ -- Maintainer : Christoph Hegemann -- Stability : experimental -- --- | --- Matchers for psc-ide commands + ----------------------------------------------------------------------------- -module Language.PureScript.Ide.Matcher - ( Matcher - , runMatcher - -- for tests - , flexMatcher - ) where +{- | +Matchers for psc-ide commands +-} +module Language.PureScript.Ide.Matcher ( + Matcher, + runMatcher, + -- for tests + flexMatcher, +) where import Protolude import Control.Monad.Fail (fail) -import Data.Aeson (FromJSON(..), withObject, (.:), (.:?)) +import Data.Aeson (FromJSON (..), withObject, (.:), (.:?)) import Data.Text qualified as T import Data.Text.Encoding qualified as TE import Language.PureScript.Ide.Types (IdeDeclarationAnn, Match) @@ -30,7 +32,6 @@ import Language.PureScript.Ide.Util (discardAnn, identifierFromIdeDeclaration, u import Text.EditDistance (defaultEditCosts, levenshteinDistance) import Text.Regex.TDFA ((=~)) - type ScoredMatch a = (Match a, Double) newtype Matcher a = Matcher (Endo [Match a]) deriving (Semigroup, Monoid) @@ -50,13 +51,14 @@ instance FromJSON (Matcher IdeDeclarationAnn) where Just s -> fail ("Unknown matcher: " <> show s) Nothing -> return mempty --- | Matches any occurrence of the search string with intersections --- --- The scoring measures how far the matches span the string where --- closer is better. --- Examples: --- flMa matches flexMatcher. Score: 14.28 --- sons matches sortCompletions. Score: 6.25 +{- | Matches any occurrence of the search string with intersections + +The scoring measures how far the matches span the string where +closer is better. +Examples: + flMa matches flexMatcher. Score: 14.28 + sons matches sortCompletions. Score: 6.25 +-} flexMatcher :: Text -> Matcher IdeDeclarationAnn flexMatcher p = mkMatcher (flexMatch p) @@ -66,18 +68,19 @@ distanceMatcher q maxDist = mkMatcher (distanceMatcher' q maxDist) distanceMatcher' :: Text -> Int -> [Match IdeDeclarationAnn] -> [ScoredMatch IdeDeclarationAnn] distanceMatcher' q maxDist = mapMaybe go where - go m = let d = dist (T.unpack y) - y = identifierFromIdeDeclaration (discardAnn (unwrapMatch m)) - in if d <= maxDist - then Just (m, 1 / fromIntegral d) - else Nothing + go m = + let d = dist (T.unpack y) + y = identifierFromIdeDeclaration (discardAnn (unwrapMatch m)) + in if d <= maxDist + then Just (m, 1 / fromIntegral d) + else Nothing dist = levenshteinDistance defaultEditCosts (T.unpack q) mkMatcher :: ([Match a] -> [ScoredMatch a]) -> Matcher a -mkMatcher matcher = Matcher . Endo $ fmap fst . sortCompletions . matcher +mkMatcher matcher = Matcher . Endo $ fmap fst . sortCompletions . matcher runMatcher :: Matcher a -> [Match a] -> [Match a] -runMatcher (Matcher m)= appEndo m +runMatcher (Matcher m) = appEndo m sortCompletions :: [ScoredMatch a] -> [ScoredMatch a] sortCompletions = sortOn (Down . snd) @@ -102,8 +105,8 @@ flexScore pat str = Nothing -> Nothing Just (first', p) -> case TE.encodeUtf8 str =~ TE.encodeUtf8 pat' :: (Int, Int) of - (-1,0) -> Nothing - (start,len) -> Just $ calcScore start (start + len) + (-1, 0) -> Nothing + (start, len) -> Just $ calcScore start (start + len) where escapedPattern :: [Text] escapedPattern = map escape (T.unpack p) @@ -111,9 +114,10 @@ flexScore pat str = -- escape prepends a backslash to "regexy" characters to prevent the -- matcher from crashing when trying to build the regex escape :: Char -> Text - escape c = if c `elem` T.unpack "[\\^$.|?*+(){}" - then T.pack ['\\', c] - else T.singleton c + escape c = + if c `elem` T.unpack "[\\^$.|?*+(){}" + then T.pack ['\\', c] + else T.singleton c -- This just interleaves the search pattern with .* -- abcd[*] -> a.*b.*c.*d.*[*] pat' = escape first' <> foldMap (<> ".*") escapedPattern diff --git a/src/Language/PureScript/Ide/Prim.hs b/src/Language/PureScript/Ide/Prim.hs index 398c01375..9001b0767 100644 --- a/src/Language/PureScript/Ide/Prim.hs +++ b/src/Language/PureScript/Ide/Prim.hs @@ -2,40 +2,49 @@ module Language.PureScript.Ide.Prim (idePrimDeclarations) where import Protolude -import Data.Text qualified as T import Data.Map qualified as Map +import Data.Text qualified as T import Language.PureScript qualified as P import Language.PureScript.Constants.Prim qualified as C import Language.PureScript.Environment qualified as PEnv -import Language.PureScript.Ide.Types (IdeDeclaration(..), IdeDeclarationAnn(..), IdeType(..), IdeTypeClass(..), ModuleMap, emptyAnn) +import Language.PureScript.Ide.Types (IdeDeclaration (..), IdeDeclarationAnn (..), IdeType (..), IdeTypeClass (..), ModuleMap, emptyAnn) idePrimDeclarations :: ModuleMap [IdeDeclarationAnn] -idePrimDeclarations = Map.fromList - [ ( C.M_Prim - , mconcat [primTypes, primClasses] - ) - , ( C.M_Prim_Boolean - , mconcat [primBooleanTypes] - ) - , ( C.M_Prim_Ordering - , mconcat [primOrderingTypes] - ) - , ( C.M_Prim_Row - , mconcat [primRowTypes, primRowClasses] - ) - , ( C.M_Prim_RowList - , mconcat [primRowListTypes, primRowListClasses] - ) - , ( C.M_Prim_Symbol - , mconcat [primSymbolTypes, primSymbolClasses] - ) - , ( C.M_Prim_Int - , mconcat [primIntTypes, primIntClasses] - ) - , ( C.M_Prim_TypeError - , mconcat [primTypeErrorTypes, primTypeErrorClasses] - ) - ] +idePrimDeclarations = + Map.fromList + [ + ( C.M_Prim + , mconcat [primTypes, primClasses] + ) + , + ( C.M_Prim_Boolean + , mconcat [primBooleanTypes] + ) + , + ( C.M_Prim_Ordering + , mconcat [primOrderingTypes] + ) + , + ( C.M_Prim_Row + , mconcat [primRowTypes, primRowClasses] + ) + , + ( C.M_Prim_RowList + , mconcat [primRowListTypes, primRowListClasses] + ) + , + ( C.M_Prim_Symbol + , mconcat [primSymbolTypes, primSymbolClasses] + ) + , + ( C.M_Prim_Int + , mconcat [primIntTypes, primIntClasses] + ) + , + ( C.M_Prim_TypeError + , mconcat [primTypeErrorTypes, primTypeErrorClasses] + ) + ] where annType tys = flip mapMaybe (Map.toList tys) $ \(tn, (kind, _)) -> do let name = P.disqualify tn @@ -45,7 +54,7 @@ idePrimDeclarations = Map.fromList Just (IdeDeclarationAnn emptyAnn (IdeDeclType (IdeType name kind []))) annClass cls = foreach (Map.toList cls) $ \(cn, _) -> -- Dummy kind and instances here, but we primarily care about the name completion - IdeDeclarationAnn emptyAnn (IdeDeclTypeClass (IdeTypeClass (P.disqualify cn) P.kindType []) ) + IdeDeclarationAnn emptyAnn (IdeDeclTypeClass (IdeTypeClass (P.disqualify cn) P.kindType [])) -- The Environment for typechecking holds both a type class as well as a -- type declaration for every class, but we filter the types out when we -- load the Externs, so we do the same here diff --git a/src/Language/PureScript/Ide/Rebuild.hs b/src/Language/PureScript/Ide/Rebuild.hs index ebc34339e..7ef2a6195 100644 --- a/src/Language/PureScript/Ide/Rebuild.hs +++ b/src/Language/PureScript/Ide/Rebuild.hs @@ -1,58 +1,60 @@ -{-# language PackageImports, TemplateHaskell, BlockArguments #-} +{-# LANGUAGE BlockArguments #-} +{-# LANGUAGE PackageImports #-} +{-# LANGUAGE TemplateHaskell #-} -module Language.PureScript.Ide.Rebuild - ( rebuildFileSync - , rebuildFileAsync - , rebuildFile - ) where +module Language.PureScript.Ide.Rebuild ( + rebuildFileSync, + rebuildFileAsync, + rebuildFile, +) where import Protolude hiding (moduleName) -import "monad-logger" Control.Monad.Logger (LoggingT, MonadLogger, logDebug) import Data.List qualified as List import Data.Map.Lazy qualified as M import Data.Maybe (fromJust) import Data.Set qualified as S -import Data.Time qualified as Time import Data.Text qualified as Text +import Data.Time qualified as Time import Language.PureScript qualified as P -import Language.PureScript.Make (ffiCodegen') -import Language.PureScript.Make.Cache (CacheInfo(..), normaliseForCache) import Language.PureScript.CST qualified as CST +import Language.PureScript.Make.Cache (CacheInfo (..), normaliseForCache) +import "monad-logger" Control.Monad.Logger (LoggingT, MonadLogger, logDebug) -import Language.PureScript.Ide.Error (IdeError(..)) +import Language.PureScript.Ide.Error (IdeError (..)) import Language.PureScript.Ide.Logging (labelTimespec, logPerf, runLogger) import Language.PureScript.Ide.State (cacheRebuild, getExternFiles, insertExterns, insertModule, populateVolatileState, updateCacheTimestamp) -import Language.PureScript.Ide.Types (Ide, IdeConfiguration(..), IdeEnvironment(..), ModuleMap, Success(..)) +import Language.PureScript.Ide.Types (Ide, IdeConfiguration (..), IdeEnvironment (..), ModuleMap, Success (..)) import Language.PureScript.Ide.Util (ideReadFile) import System.Directory (getCurrentDirectory) --- | Given a filepath performs the following steps: --- --- * Reads and parses a PureScript module from the filepath. --- --- * Builds a dependency graph for the parsed module from the already loaded --- ExternsFiles. --- --- * Attempts to find an FFI definition file for the module by looking --- for a file with the same filepath except for a .js extension. --- --- * Passes all the created artifacts to @rebuildModule@. --- --- * If the rebuilding succeeds, returns a @RebuildSuccess@ with the generated --- warnings, and if rebuilding fails, returns a @RebuildError@ with the --- generated errors. -rebuildFile - :: (Ide m, MonadLogger m, MonadError IdeError m) - => FilePath - -- ^ The file to rebuild - -> Maybe FilePath - -- ^ The file to use as the location for parsing and errors - -> Set P.CodegenTarget - -- ^ The targets to codegen - -> (ReaderT IdeEnvironment (LoggingT IO) () -> m ()) - -- ^ A runner for the second build with open exports - -> m Success +{- | Given a filepath performs the following steps: + +* Reads and parses a PureScript module from the filepath. + +* Builds a dependency graph for the parsed module from the already loaded +ExternsFiles. + +* Attempts to find an FFI definition file for the module by looking +for a file with the same filepath except for a .js extension. + +* Passes all the created artifacts to @rebuildModule@. + +* If the rebuilding succeeds, returns a @RebuildSuccess@ with the generated +warnings, and if rebuilding fails, returns a @RebuildError@ with the +generated errors. +-} +rebuildFile :: + (Ide m, MonadLogger m, MonadError IdeError m) => + -- | The file to rebuild + FilePath -> + -- | The file to use as the location for parsing and errors + Maybe FilePath -> + -- | The targets to codegen + Set P.CodegenTarget -> + -- | A runner for the second build with open exports + (ReaderT IdeEnvironment (LoggingT IO) () -> m ()) -> + m Success rebuildFile file actualFile codegenTargets runOpenBuild = do (fp, input) <- case List.stripPrefix "data:" file of @@ -74,15 +76,15 @@ rebuildFile file actualFile codegenTargets runOpenBuild = do let pureRebuild = fp == "" let modulePath = if pureRebuild then fp' else file foreigns <- P.inferForeignModules (M.singleton moduleName (Right modulePath)) - let makeEnv = P.buildMakeActions outputDirectory filePathMap foreigns False - & (if pureRebuild then enableForeignCheck foreigns codegenTargets . shushCodegen else identity) - & shushProgress + let makeEnv = + P.buildMakeActions outputDirectory filePathMap foreigns False + & shushProgress -- Rebuild the single module using the cached externs (result, warnings) <- logPerf (labelTimespec "Rebuilding Module") $ - liftIO $ P.runMake (P.defaultOptions { P.optionsCodegenTargets = codegenTargets }) do + liftIO $ P.runMake (P.defaultOptions {P.optionsCodegenTargets = codegenTargets}) do newExterns <- P.rebuildModule makeEnv externs m - unless pureRebuild - $ updateCacheDb codegenTargets outputDirectory file actualFile moduleName + unless pureRebuild $ + updateCacheDb codegenTargets outputDirectory file actualFile moduleName pure newExterns case result of Left errors -> @@ -95,78 +97,92 @@ rebuildFile file actualFile codegenTargets runOpenBuild = do runOpenBuild (rebuildModuleOpen makeEnv externs m) pure (RebuildSuccess (CST.toMultipleWarnings fp pwarnings <> warnings)) --- | When adjusting the cache db file after a rebuild we always pick a --- non-sensical timestamp ("1858-11-17T00:00:00Z"), and rely on the --- content hash to tell whether the module needs rebuilding. This is --- because IDE rebuilds may be triggered on temporary files to not --- force editors to save the actual source file to get at diagnostics +{- | When adjusting the cache db file after a rebuild we always pick a +non-sensical timestamp ("1858-11-17T00:00:00Z"), and rely on the +content hash to tell whether the module needs rebuilding. This is +because IDE rebuilds may be triggered on temporary files to not +force editors to save the actual source file to get at diagnostics +-} dayZero :: Time.UTCTime dayZero = Time.UTCTime (Time.ModifiedJulianDay 0) 0 -updateCacheDb - :: MonadIO m - => MonadError P.MultipleErrors m - => Set P.CodegenTarget - -> FilePath - -- ^ The output directory - -> FilePath - -- ^ The file to read the content hash from - -> Maybe FilePath - -- ^ The file name to update in the cache - -> P.ModuleName - -- ^ The module name to update in the cache - -> m () +updateCacheDb :: + (MonadIO m) => + (MonadError P.MultipleErrors m) => + Set P.CodegenTarget -> + -- | The output directory + FilePath -> + -- | The file to read the content hash from + FilePath -> + -- | The file name to update in the cache + Maybe FilePath -> + -- | The module name to update in the cache + P.ModuleName -> + m () updateCacheDb codegenTargets outputDirectory file actualFile moduleName = do cwd <- liftIO getCurrentDirectory contentHash <- P.hashFile file let moduleCacheInfo = (normaliseForCache cwd (fromMaybe file actualFile), (dayZero, contentHash)) foreignCacheInfo <- + {- if S.member P.JS codegenTargets then do foreigns' <- P.inferForeignModules (M.singleton moduleName (Right (fromMaybe file actualFile))) for (M.lookup moduleName foreigns') \foreignPath -> do foreignHash <- P.hashFile foreignPath pure (normaliseForCache cwd foreignPath, (dayZero, foreignHash)) else - pure Nothing + -} + pure Nothing let cacheInfo = M.fromList (moduleCacheInfo : maybeToList foreignCacheInfo) cacheDb <- P.readCacheDb' outputDirectory P.writeCacheDb' outputDirectory (M.insert moduleName (CacheInfo cacheInfo) cacheDb) -rebuildFileAsync - :: forall m. (Ide m, MonadLogger m, MonadError IdeError m) - => FilePath -> Maybe FilePath -> Set P.CodegenTarget -> m Success +rebuildFileAsync :: + forall m. + (Ide m, MonadLogger m, MonadError IdeError m) => + FilePath -> + Maybe FilePath -> + Set P.CodegenTarget -> + m Success rebuildFileAsync fp fp' ts = rebuildFile fp fp' ts asyncRun where asyncRun :: ReaderT IdeEnvironment (LoggingT IO) () -> m () asyncRun action = do - env <- ask - let ll = confLogLevel (ideConfiguration env) - void (liftIO (async (runLogger ll (runReaderT action env)))) - -rebuildFileSync - :: forall m. (Ide m, MonadLogger m, MonadError IdeError m) - => FilePath -> Maybe FilePath -> Set P.CodegenTarget -> m Success + env <- ask + let ll = confLogLevel (ideConfiguration env) + void (liftIO (async (runLogger ll (runReaderT action env)))) + +rebuildFileSync :: + forall m. + (Ide m, MonadLogger m, MonadError IdeError m) => + FilePath -> + Maybe FilePath -> + Set P.CodegenTarget -> + m Success rebuildFileSync fp fp' ts = rebuildFile fp fp' ts syncRun where syncRun :: ReaderT IdeEnvironment (LoggingT IO) () -> m () syncRun action = do - env <- ask - let ll = confLogLevel (ideConfiguration env) - void (liftIO (runLogger ll (runReaderT action env))) - --- | Rebuilds a module but opens up its export list first and stores the result --- inside the rebuild cache -rebuildModuleOpen - :: (Ide m, MonadLogger m) - => P.MakeActions P.Make - -> [P.ExternsFile] - -> P.Module - -> m () + env <- ask + let ll = confLogLevel (ideConfiguration env) + void (liftIO (runLogger ll (runReaderT action env))) + +{- | Rebuilds a module but opens up its export list first and stores the result +inside the rebuild cache +-} +rebuildModuleOpen :: + (Ide m, MonadLogger m) => + P.MakeActions P.Make -> + [P.ExternsFile] -> + P.Module -> + m () rebuildModuleOpen makeEnv externs m = void $ runExceptT do - (openResult, _) <- liftIO $ P.runMake P.defaultOptions $ - P.rebuildModule (shushProgress (shushCodegen makeEnv)) externs (openModuleExports m) + (openResult, _) <- + liftIO $ + P.runMake P.defaultOptions $ + P.rebuildModule (shushProgress (shushCodegen makeEnv)) externs (openModuleExports m) case openResult of Left _ -> throwError (GeneralError "Failed when rebuilding with open exports") @@ -176,42 +192,35 @@ rebuildModuleOpen makeEnv externs m = void $ runExceptT do cacheRebuild result -- | Shuts the compiler up about progress messages -shushProgress :: Monad m => P.MakeActions m -> P.MakeActions m +shushProgress :: (Monad m) => P.MakeActions m -> P.MakeActions m shushProgress ma = - ma { P.progress = \_ -> pure () } + ma {P.progress = \_ -> pure ()} -- | Stops any kind of codegen -shushCodegen :: Monad m => P.MakeActions m -> P.MakeActions m +shushCodegen :: (Monad m) => P.MakeActions m -> P.MakeActions m shushCodegen ma = - ma { P.codegen = \_ _ _ -> pure () - , P.ffiCodegen = \_ -> pure () - } - --- | Enables foreign module check without actual codegen. -enableForeignCheck - :: M.Map P.ModuleName FilePath - -> S.Set P.CodegenTarget - -> P.MakeActions P.Make - -> P.MakeActions P.Make -enableForeignCheck foreigns codegenTargets ma = - ma { P.ffiCodegen = ffiCodegen' foreigns codegenTargets Nothing - } - --- | Returns a topologically sorted list of dependent ExternsFiles for the given --- module. Throws an error if there is a cyclic dependency within the --- ExternsFiles -sortExterns - :: (Ide m, MonadError IdeError m) - => P.Module - -> ModuleMap P.ExternsFile - -> m [P.ExternsFile] + ma + { P.codegen = \_ _ _ -> pure () + } + +{- | Returns a topologically sorted list of dependent ExternsFiles for the given +module. Throws an error if there is a cyclic dependency within the +ExternsFiles +-} +sortExterns :: + (Ide m, MonadError IdeError m) => + P.Module -> + ModuleMap P.ExternsFile -> + m [P.ExternsFile] sortExterns m ex = do - sorted' <- runExceptT - . P.sortModules P.Transitive P.moduleSignature - . (:) m - . map mkShallowModule - . M.elems - . M.delete (P.getModuleName m) $ ex + sorted' <- + runExceptT + . P.sortModules P.Transitive P.moduleSignature + . (:) m + . map mkShallowModule + . M.elems + . M.delete (P.getModuleName m) + $ ex case sorted' of Left err -> throwError (RebuildError [] err) @@ -219,7 +228,7 @@ sortExterns m ex = do let deps = fromJust (List.lookup (P.getModuleName m) graph) pure $ mapMaybe getExtern (deps `inOrderOf` map P.getModuleName sorted) where - mkShallowModule P.ExternsFile{..} = + mkShallowModule P.ExternsFile {..} = P.Module (P.internalModuleSourceSpan "") [] efModuleName (map mkImport efImports) Nothing mkImport (P.ExternsImport mn it iq) = P.ImportDeclaration (P.internalModuleSourceSpan "", []) mn it iq diff --git a/src/Language/PureScript/Ide/Reexports.hs b/src/Language/PureScript/Ide/Reexports.hs index a50b9de7a..6e78117f7 100644 --- a/src/Language/PureScript/Ide/Reexports.hs +++ b/src/Language/PureScript/Ide/Reexports.hs @@ -9,18 +9,20 @@ -- Maintainer : Christoph Hegemann -- Stability : experimental -- --- | --- Resolves reexports for psc-ide + ----------------------------------------------------------------------------- -module Language.PureScript.Ide.Reexports - ( resolveReexports - , prettyPrintReexportResult - , reexportHasFailures - , ReexportResult(..) +{- | +Resolves reexports for psc-ide +-} +module Language.PureScript.Ide.Reexports ( + resolveReexports, + prettyPrintReexportResult, + reexportHasFailures, + ReexportResult (..), -- for tests - , resolveReexports' - ) where + resolveReexports', +) where import Protolude hiding (moduleName) @@ -31,52 +33,58 @@ import Language.PureScript.Ide.Types import Language.PureScript.Ide.Util (discardAnn) -- | Contains the module with resolved reexports, and possible failures -data ReexportResult a - = ReexportResult +data ReexportResult a = ReexportResult { reResolved :: a - , reFailed :: [(P.ModuleName, P.DeclarationRef)] - } deriving (Show, Eq, Functor, Generic) + , reFailed :: [(P.ModuleName, P.DeclarationRef)] + } + deriving (Show, Eq, Functor, Generic) -instance NFData a => NFData (ReexportResult a) +instance (NFData a) => NFData (ReexportResult a) --- | Uses the passed formatter to format the resolved module, and adds possible --- failures -prettyPrintReexportResult - :: (a -> Text) - -- ^ Formatter for the resolved result - -> ReexportResult a - -- ^ The Result to be pretty printed - -> Text -prettyPrintReexportResult f ReexportResult{..} +{- | Uses the passed formatter to format the resolved module, and adds possible +failures +-} +prettyPrintReexportResult :: + -- | Formatter for the resolved result + (a -> Text) -> + -- | The Result to be pretty printed + ReexportResult a -> + Text +prettyPrintReexportResult f ReexportResult {..} | null reFailed = "Successfully resolved reexports for " <> f reResolved | otherwise = "Failed to resolve reexports for " - <> f reResolved - <> foldMap (\(mn, ref) -> P.runModuleName mn <> show ref) reFailed + <> f reResolved + <> foldMap (\(mn, ref) -> P.runModuleName mn <> show ref) reFailed -- | Whether any Refs couldn't be resolved reexportHasFailures :: ReexportResult a -> Bool reexportHasFailures = not . null . reFailed --- | Resolves Reexports for the given Modules, by looking up the reexported --- values from the passed in DeclarationRefs -resolveReexports - :: ModuleMap [(P.ModuleName, P.DeclarationRef)] - -- ^ the references to resolve - -> ModuleMap [IdeDeclarationAnn] - -- ^ Modules to search for the reexported declarations - -> ModuleMap (ReexportResult [IdeDeclarationAnn]) +{- | Resolves Reexports for the given Modules, by looking up the reexported +values from the passed in DeclarationRefs +-} +resolveReexports :: + -- | the references to resolve + ModuleMap [(P.ModuleName, P.DeclarationRef)] -> + -- | Modules to search for the reexported declarations + ModuleMap [IdeDeclarationAnn] -> + ModuleMap (ReexportResult [IdeDeclarationAnn]) resolveReexports reexportRefs modules = - Map.mapWithKey (\moduleName decls -> - maybe (ReexportResult decls []) - (map (decls <>) . resolveReexports' modules) - (Map.lookup moduleName reexportRefs)) modules + Map.mapWithKey + ( \moduleName decls -> + maybe + (ReexportResult decls []) + (map (decls <>) . resolveReexports' modules) + (Map.lookup moduleName reexportRefs) + ) + modules -resolveReexports' - :: ModuleMap [IdeDeclarationAnn] - -> [(P.ModuleName, P.DeclarationRef)] - -> ReexportResult [IdeDeclarationAnn] +resolveReexports' :: + ModuleMap [IdeDeclarationAnn] -> + [(P.ModuleName, P.DeclarationRef)] -> + ReexportResult [IdeDeclarationAnn] resolveReexports' modules refs = ReexportResult (concat resolvedRefs) failedRefs where @@ -86,26 +94,28 @@ resolveReexports' modules refs = Just decls' -> let setExportedFrom = set (idaAnnotation . annExportedFrom) . Just - in + in bimap (mn,) (map (setExportedFrom mn)) (resolveRef decls' r) -resolveRef - :: [IdeDeclarationAnn] - -> P.DeclarationRef - -> Either P.DeclarationRef [IdeDeclarationAnn] +resolveRef :: + [IdeDeclarationAnn] -> + P.DeclarationRef -> + Either P.DeclarationRef [IdeDeclarationAnn] resolveRef decls ref = case ref of P.TypeRef _ tn mdtors -> case findRef (anyOf (_IdeDeclType . ideTypeName) (== tn)) - <|> findRef (anyOf (_IdeDeclTypeSynonym . ideSynonymName) (== tn)) of + <|> findRef (anyOf (_IdeDeclTypeSynonym . ideSynonymName) (== tn)) of Nothing -> Left ref - Just d -> Right $ d : case mdtors of - Nothing -> - -- If the dataconstructor field inside the TypeRef is Nothing, that - -- means that all data constructors are exported, so we need to look - -- those up ourselves - findDtors tn - Just dtors -> mapMaybe lookupDtor dtors + Just d -> + Right $ + d : case mdtors of + Nothing -> + -- If the dataconstructor field inside the TypeRef is Nothing, that + -- means that all data constructors are exported, so we need to look + -- those up ourselves + findDtors tn + Just dtors -> mapMaybe lookupDtor dtors P.ValueRef _ i -> findWrapped (anyOf (_IdeDeclValue . ideValueIdent) (== i)) P.ValueOpRef _ name -> @@ -123,7 +133,13 @@ resolveRef decls ref = case ref of lookupDtor name = findRef (anyOf (_IdeDeclDataConstructor . ideDtorName) (== name)) - findDtors tn = filter (anyOf - (idaDeclaration - . _IdeDeclDataConstructor - . ideDtorTypeName) (== tn)) decls + findDtors tn = + filter + ( anyOf + ( idaDeclaration + . _IdeDeclDataConstructor + . ideDtorTypeName + ) + (== tn) + ) + decls diff --git a/src/Language/PureScript/Ide/SourceFile.hs b/src/Language/PureScript/Ide/SourceFile.hs index ea49fd6a5..1cdfcb644 100644 --- a/src/Language/PureScript/Ide/SourceFile.hs +++ b/src/Language/PureScript/Ide/SourceFile.hs @@ -8,26 +8,28 @@ -- Maintainer : Christoph Hegemann -- Stability : experimental -- --- | --- Getting declarations from PureScript sourcefiles + ----------------------------------------------------------------------------- -module Language.PureScript.Ide.SourceFile - ( parseModulesFromFiles - , extractAstInformation +{- | +Getting declarations from PureScript sourcefiles +-} +module Language.PureScript.Ide.SourceFile ( + parseModulesFromFiles, + extractAstInformation, -- for tests - , extractSpans - , extractTypeAnnotations - ) where + extractSpans, + extractTypeAnnotations, +) where import Protolude -import Control.Parallel.Strategies (withStrategy, parList, rseq) +import Control.Parallel.Strategies (parList, rseq, withStrategy) import Data.Map qualified as Map import Language.PureScript qualified as P import Language.PureScript.CST qualified as CST import Language.PureScript.Ide.Error (IdeError) -import Language.PureScript.Ide.Types (DefinitionSites, IdeNamespace(..), IdeNamespaced(..), TypeAnnotations) +import Language.PureScript.Ide.Types (DefinitionSites, IdeNamespace (..), IdeNamespaced (..), TypeAnnotations) import Language.PureScript.Ide.Util (ideReadFile) parseModule :: FilePath -> Text -> Either FilePath (FilePath, P.Module) @@ -36,10 +38,10 @@ parseModule path file = Left _ -> Left path Right m -> Right (path, m) -parseModulesFromFiles - :: (MonadIO m, MonadError IdeError m) - => [FilePath] - -> m [Either FilePath (FilePath, P.Module)] +parseModulesFromFiles :: + (MonadIO m, MonadError IdeError m) => + [FilePath] -> + m [Either FilePath (FilePath, P.Module)] parseModulesFromFiles paths = do files <- traverse ideReadFile paths pure (inParallel (map (uncurry parseModule) files)) @@ -48,28 +50,30 @@ parseModulesFromFiles paths = do inParallel = withStrategy (parList rseq) -- | Extracts AST information from a parsed module -extractAstInformation - :: P.Module - -> (DefinitionSites P.SourceSpan, TypeAnnotations) +extractAstInformation :: + P.Module -> + (DefinitionSites P.SourceSpan, TypeAnnotations) extractAstInformation (P.Module moduleSpan _ mn decls _) = let definitions = Map.insert - (IdeNamespaced IdeNSModule (P.runModuleName mn)) moduleSpan + (IdeNamespaced IdeNSModule (P.runModuleName mn)) + moduleSpan (Map.fromList (concatMap extractSpans decls)) typeAnnotations = Map.fromList (extractTypeAnnotations decls) - in (definitions, typeAnnotations) + in (definitions, typeAnnotations) -- | Extracts type annotations for functions from a given Module extractTypeAnnotations :: [P.Declaration] -> [(P.Ident, P.SourceType)] extractTypeAnnotations = mapMaybe (map P.unwrapTypeDeclaration . P.getTypeDeclaration) --- | Given a surrounding Sourcespan and a Declaration from the PS AST, extracts --- definition sites inside that Declaration. -extractSpans - :: P.Declaration - -- ^ The declaration to extract spans from - -> [(IdeNamespaced, P.SourceSpan)] - -- ^ Declarations and their source locations +{- | Given a surrounding Sourcespan and a Declaration from the PS AST, extracts +definition sites inside that Declaration. +-} +extractSpans :: + -- | The declaration to extract spans from + P.Declaration -> + -- | Declarations and their source locations + [(IdeNamespaced, P.SourceSpan)] extractSpans d = case d of P.ValueDecl (ss, _) i _ _ _ -> [(IdeNamespaced IdeNSValue (P.runIdent i), ss)] @@ -90,7 +94,7 @@ extractSpans d = case d of _ -> [] where dtorSpan :: P.DataConstructorDeclaration -> (IdeNamespaced, P.SourceSpan) - dtorSpan P.DataConstructorDeclaration{ P.dataCtorName = name, P.dataCtorAnn = (ss, _) } = + dtorSpan P.DataConstructorDeclaration {P.dataCtorName = name, P.dataCtorAnn = (ss, _)} = (IdeNamespaced IdeNSValue (P.runProperName name), ss) -- We need this special case to be able to also get the position info for -- typeclass member functions. Typedeclarations would clash with value diff --git a/src/Language/PureScript/Ide/State.hs b/src/Language/PureScript/Ide/State.hs index 06eed507e..7b92ddadf 100644 --- a/src/Language/PureScript/Ide/State.hs +++ b/src/Language/PureScript/Ide/State.hs @@ -8,76 +8,76 @@ -- Maintainer : Christoph Hegemann -- Stability : experimental -- --- | --- Functions to access psc-ide's state ----------------------------------------------------------------------------- - {-# LANGUAGE PackageImports #-} {-# LANGUAGE TypeApplications #-} -module Language.PureScript.Ide.State - ( getLoadedModulenames - , getExternFiles - , getFileState - , resetIdeState - , cacheRebuild - , cachedRebuild - , insertExterns - , insertModule - , insertExternsSTM - , getAllModules - , populateVolatileState - , populateVolatileStateSync - , populateVolatileStateSTM - , getOutputDirectory - , updateCacheTimestamp +{- | +Functions to access psc-ide's state +-} +module Language.PureScript.Ide.State ( + getLoadedModulenames, + getExternFiles, + getFileState, + resetIdeState, + cacheRebuild, + cachedRebuild, + insertExterns, + insertModule, + insertExternsSTM, + getAllModules, + populateVolatileState, + populateVolatileStateSync, + populateVolatileStateSTM, + getOutputDirectory, + updateCacheTimestamp, -- for tests - , resolveOperatorsForModule - , resolveInstances - , resolveDataConstructorsForModule - ) where + resolveOperatorsForModule, + resolveInstances, + resolveDataConstructorsForModule, +) where import Protolude hiding (moduleName, unzip) import Control.Concurrent.STM (TVar, modifyTVar, readTVar, readTVarIO, writeTVar) -import Control.Lens (Ixed(..), preview, view, (%~), (.~), (^.)) -import "monad-logger" Control.Monad.Logger (MonadLogger, logWarnN) +import Control.Lens (Ixed (..), preview, view, (%~), (.~), (^.)) import Data.IORef (readIORef, writeIORef) import Data.Map.Lazy qualified as Map import Data.Time.Clock (UTCTime) import Data.Zip (unzip) import Language.PureScript qualified as P import Language.PureScript.Docs.Convert.Single (convertComments) -import Language.PureScript.Externs (ExternsDeclaration(..), ExternsFile(..)) -import Language.PureScript.Make.Actions (cacheDbFile) +import Language.PureScript.Externs (ExternsDeclaration (..), ExternsFile (..)) import Language.PureScript.Ide.Externs (convertExterns) -import Language.PureScript.Ide.Reexports (ReexportResult(..), prettyPrintReexportResult, reexportHasFailures, resolveReexports) +import Language.PureScript.Ide.Reexports (ReexportResult (..), prettyPrintReexportResult, reexportHasFailures, resolveReexports) import Language.PureScript.Ide.SourceFile (extractAstInformation) import Language.PureScript.Ide.Types import Language.PureScript.Ide.Util (discardAnn, displayTimeSpec, logPerf, opNameT, properNameT, runLogger) +import Language.PureScript.Make.Actions (cacheDbFile) import System.Directory (getModificationTime) +import "monad-logger" Control.Monad.Logger (MonadLogger, logWarnN) -- | Resets all State inside psc-ide -resetIdeState :: Ide m => m () +resetIdeState :: (Ide m) => m () resetIdeState = do ideVar <- ideStateVar <$> ask liftIO (atomically (writeTVar ideVar emptyIdeState)) -getOutputDirectory :: Ide m => m FilePath +getOutputDirectory :: (Ide m) => m FilePath getOutputDirectory = do confOutputPath . ideConfiguration <$> ask -getCacheTimestamp :: Ide m => m (Maybe UTCTime) +getCacheTimestamp :: (Ide m) => m (Maybe UTCTime) getCacheTimestamp = do x <- ideCacheDbTimestamp <$> ask liftIO (readIORef x) -readCacheTimestamp :: Ide m => m (Maybe UTCTime) +readCacheTimestamp :: (Ide m) => m (Maybe UTCTime) readCacheTimestamp = do cacheDb <- cacheDbFile <$> getOutputDirectory liftIO (hush <$> try @SomeException (getModificationTime cacheDb)) -updateCacheTimestamp :: Ide m => m (Maybe (Maybe UTCTime, Maybe UTCTime)) +updateCacheTimestamp :: (Ide m) => m (Maybe (Maybe UTCTime, Maybe UTCTime)) updateCacheTimestamp = do old <- getCacheTimestamp new <- readCacheTimestamp @@ -89,15 +89,15 @@ updateCacheTimestamp = do pure (Just (old, new)) -- | Gets the loaded Modulenames -getLoadedModulenames :: Ide m => m [P.ModuleName] +getLoadedModulenames :: (Ide m) => m [P.ModuleName] getLoadedModulenames = Map.keys <$> getExternFiles -- | Gets all loaded ExternFiles -getExternFiles :: Ide m => m (ModuleMap ExternsFile) +getExternFiles :: (Ide m) => m (ModuleMap ExternsFile) getExternFiles = fsExterns <$> getFileState -- | Insert a Module into Stage1 of the State -insertModule :: Ide m => (FilePath, P.Module) -> m () +insertModule :: (Ide m) => (FilePath, P.Module) -> m () insertModule module' = do stateVar <- ideStateVar <$> ask liftIO . atomically $ insertModuleSTM stateVar module' @@ -106,15 +106,21 @@ insertModule module' = do insertModuleSTM :: TVar IdeState -> (FilePath, P.Module) -> STM () insertModuleSTM ref (fp, module') = modifyTVar ref $ \x -> - x { ideFileState = (ideFileState x) { - fsModules = Map.insert - (P.getModuleName module') - (module', fp) - (fsModules (ideFileState x))}} - --- | Retrieves the FileState from the State. This includes loaded Externfiles --- and parsed Modules -getFileState :: Ide m => m IdeFileState + x + { ideFileState = + (ideFileState x) + { fsModules = + Map.insert + (P.getModuleName module') + (module', fp) + (fsModules (ideFileState x)) + } + } + +{- | Retrieves the FileState from the State. This includes loaded Externfiles +and parsed Modules +-} +getFileState :: (Ide m) => m IdeFileState getFileState = do st <- ideStateVar <$> ask ideFileState <$> liftIO (readTVarIO st) @@ -123,9 +129,10 @@ getFileState = do getFileStateSTM :: TVar IdeState -> STM IdeFileState getFileStateSTM ref = ideFileState <$> readTVar ref --- | Retrieves VolatileState from the State. --- This includes the denormalized Declarations and cached rebuilds -getVolatileState :: Ide m => m IdeVolatileState +{- | Retrieves VolatileState from the State. +This includes the denormalized Declarations and cached rebuilds +-} +getVolatileState :: (Ide m) => m IdeVolatileState getVolatileState = do st <- ideStateVar <$> ask liftIO (atomically (getVolatileStateSTM st)) @@ -141,10 +148,11 @@ setVolatileStateSTM ref vs = do x {ideVolatileState = vs} pure () --- | Checks if the given ModuleName matches the last rebuild cache and if it --- does returns all loaded definitions + the definitions inside the rebuild --- cache -getAllModules :: Ide m => Maybe P.ModuleName -> m (ModuleMap [IdeDeclarationAnn]) +{- | Checks if the given ModuleName matches the last rebuild cache and if it +does returns all loaded definitions + the definitions inside the rebuild +cache +-} +getAllModules :: (Ide m) => Maybe P.ModuleName -> m (ModuleMap [IdeDeclarationAnn]) getAllModules mmoduleName = do declarations <- vsDeclarations <$> getVolatileState rebuild <- cachedRebuild @@ -168,10 +176,11 @@ getAllModules mmoduleName = do pure resolved _ -> pure declarations --- | Adds an ExternsFile into psc-ide's FileState. This does not populate the --- VolatileState, which needs to be done after all the necessary Externs and --- SourceFiles have been loaded. -insertExterns :: Ide m => ExternsFile -> m () +{- | Adds an ExternsFile into psc-ide's FileState. This does not populate the +VolatileState, which needs to be done after all the necessary Externs and +SourceFiles have been loaded. +-} +insertExterns :: (Ide m) => ExternsFile -> m () insertExterns ef = do st <- ideStateVar <$> ask liftIO (atomically (insertExternsSTM st ef)) @@ -180,19 +189,27 @@ insertExterns ef = do insertExternsSTM :: TVar IdeState -> ExternsFile -> STM () insertExternsSTM ref ef = modifyTVar ref $ \x -> - x { ideFileState = (ideFileState x) { - fsExterns = Map.insert (efModuleName ef) ef (fsExterns (ideFileState x))}} + x + { ideFileState = + (ideFileState x) + { fsExterns = Map.insert (efModuleName ef) ef (fsExterns (ideFileState x)) + } + } -- | Sets rebuild cache to the given ExternsFile -cacheRebuild :: Ide m => ExternsFile -> m () +cacheRebuild :: (Ide m) => ExternsFile -> m () cacheRebuild ef = do st <- ideStateVar <$> ask liftIO . atomically . modifyTVar st $ \x -> - x { ideVolatileState = (ideVolatileState x) { - vsCachedRebuild = Just (efModuleName ef, ef)}} + x + { ideVolatileState = + (ideVolatileState x) + { vsCachedRebuild = Just (efModuleName ef, ef) + } + } -- | Retrieves the rebuild cache -cachedRebuild :: Ide m => m (Maybe (P.ModuleName, ExternsFile)) +cachedRebuild :: (Ide m) => m (Maybe (P.ModuleName, ExternsFile)) cachedRebuild = vsCachedRebuild <$> getVolatileState -- | Resolves reexports and populates VolatileState with data to be used in queries. @@ -203,11 +220,12 @@ populateVolatileStateSync = do results <- logPerf message $ do !r <- liftIO (atomically (populateVolatileStateSTM st)) pure r - void $ Map.traverseWithKey - (\mn -> logWarnN . prettyPrintReexportResult (const (P.runModuleName mn))) - (Map.filter reexportHasFailures results) + void $ + Map.traverseWithKey + (\mn -> logWarnN . prettyPrintReexportResult (const (P.runModuleName mn))) + (Map.filter reexportHasFailures results) -populateVolatileState :: Ide m => m (Async ()) +populateVolatileState :: (Ide m) => m (Async ()) populateVolatileState = do env <- ask let ll = confLogLevel (ideConfiguration env) @@ -216,11 +234,11 @@ populateVolatileState = do liftIO (async (runLogger ll (runReaderT populateVolatileStateSync env))) -- | STM version of populateVolatileState -populateVolatileStateSTM - :: TVar IdeState - -> STM (ModuleMap (ReexportResult [IdeDeclarationAnn])) +populateVolatileStateSTM :: + TVar IdeState -> + STM (ModuleMap (ReexportResult [IdeDeclarationAnn])) populateVolatileStateSTM ref = do - IdeFileState{fsExterns = externs, fsModules = modules} <- getFileStateSTM ref + IdeFileState {fsExterns = externs, fsModules = modules} <- getFileStateSTM ref -- We're not using the cached rebuild for anything other than preserving it -- through the repopulation rebuildCache <- vsCachedRebuild <$> getVolatileStateSTM ref @@ -228,57 +246,64 @@ populateVolatileStateSTM ref = do let (moduleDeclarations, reexportRefs) = unzip (Map.map convertExterns externs) results = moduleDeclarations - & map resolveDataConstructorsForModule - & resolveLocations asts - & resolveDocumentation (map fst modules) - & resolveInstances externs - & resolveOperators - & resolveReexports reexportRefs + & map resolveDataConstructorsForModule + & resolveLocations asts + & resolveDocumentation (map fst modules) + & resolveInstances externs + & resolveOperators + & resolveReexports reexportRefs setVolatileStateSTM ref (IdeVolatileState (AstData asts) (map reResolved results) rebuildCache) pure (force results) -resolveLocations - :: ModuleMap (DefinitionSites P.SourceSpan, TypeAnnotations) - -> ModuleMap [IdeDeclarationAnn] - -> ModuleMap [IdeDeclarationAnn] +resolveLocations :: + ModuleMap (DefinitionSites P.SourceSpan, TypeAnnotations) -> + ModuleMap [IdeDeclarationAnn] -> + ModuleMap [IdeDeclarationAnn] resolveLocations asts = - Map.mapWithKey (\mn decls -> - maybe decls (flip resolveLocationsForModule decls) (Map.lookup mn asts)) - -resolveLocationsForModule - :: (DefinitionSites P.SourceSpan, TypeAnnotations) - -> [IdeDeclarationAnn] - -> [IdeDeclarationAnn] + Map.mapWithKey + ( \mn decls -> + maybe decls (flip resolveLocationsForModule decls) (Map.lookup mn asts) + ) + +resolveLocationsForModule :: + (DefinitionSites P.SourceSpan, TypeAnnotations) -> + [IdeDeclarationAnn] -> + [IdeDeclarationAnn] resolveLocationsForModule (defs, types) = map convertDeclaration where convertDeclaration :: IdeDeclarationAnn -> IdeDeclarationAnn - convertDeclaration (IdeDeclarationAnn ann d) = convertDeclaration' - annotateFunction - annotateValue - annotateDataConstructor - annotateType - annotateType -- type classes live in the type namespace - annotateModule - d + convertDeclaration (IdeDeclarationAnn ann d) = + convertDeclaration' + annotateFunction + annotateValue + annotateDataConstructor + annotateType + annotateType -- type classes live in the type namespace + annotateModule + d where - annotateFunction x = IdeDeclarationAnn (ann { _annLocation = Map.lookup (IdeNamespaced IdeNSValue (P.runIdent x)) defs - , _annTypeAnnotation = Map.lookup x types - }) + annotateFunction x = + IdeDeclarationAnn + ( ann + { _annLocation = Map.lookup (IdeNamespaced IdeNSValue (P.runIdent x)) defs + , _annTypeAnnotation = Map.lookup x types + } + ) annotateValue x = IdeDeclarationAnn (ann {_annLocation = Map.lookup (IdeNamespaced IdeNSValue x) defs}) annotateDataConstructor x = IdeDeclarationAnn (ann {_annLocation = Map.lookup (IdeNamespaced IdeNSValue x) defs}) annotateType x = IdeDeclarationAnn (ann {_annLocation = Map.lookup (IdeNamespaced IdeNSType x) defs}) annotateModule x = IdeDeclarationAnn (ann {_annLocation = Map.lookup (IdeNamespaced IdeNSModule x) defs}) -convertDeclaration' - :: (P.Ident -> IdeDeclaration -> IdeDeclarationAnn) - -> (Text -> IdeDeclaration -> IdeDeclarationAnn) - -> (Text -> IdeDeclaration -> IdeDeclarationAnn) - -> (Text -> IdeDeclaration -> IdeDeclarationAnn) - -> (Text -> IdeDeclaration -> IdeDeclarationAnn) - -> (Text -> IdeDeclaration -> IdeDeclarationAnn) - -> IdeDeclaration - -> IdeDeclarationAnn +convertDeclaration' :: + (P.Ident -> IdeDeclaration -> IdeDeclarationAnn) -> + (Text -> IdeDeclaration -> IdeDeclarationAnn) -> + (Text -> IdeDeclaration -> IdeDeclarationAnn) -> + (Text -> IdeDeclaration -> IdeDeclarationAnn) -> + (Text -> IdeDeclaration -> IdeDeclarationAnn) -> + (Text -> IdeDeclaration -> IdeDeclarationAnn) -> + IdeDeclaration -> + IdeDeclarationAnn convertDeclaration' annotateFunction annotateValue annotateDataConstructor annotateType annotateClass annotateModule d = case d of IdeDeclValue v -> @@ -298,143 +323,158 @@ convertDeclaration' annotateFunction annotateValue annotateDataConstructor annot IdeDeclModule mn -> annotateModule (P.runModuleName mn) d -resolveDocumentation - :: ModuleMap P.Module - -> ModuleMap [IdeDeclarationAnn] - -> ModuleMap [IdeDeclarationAnn] +resolveDocumentation :: + ModuleMap P.Module -> + ModuleMap [IdeDeclarationAnn] -> + ModuleMap [IdeDeclarationAnn] resolveDocumentation modules = - Map.mapWithKey (\mn decls -> - maybe decls (flip resolveDocumentationForModule decls) (Map.lookup mn modules)) - -resolveDocumentationForModule - :: P.Module - -> [IdeDeclarationAnn] - -> [IdeDeclarationAnn] + Map.mapWithKey + ( \mn decls -> + maybe decls (flip resolveDocumentationForModule decls) (Map.lookup mn modules) + ) + +resolveDocumentationForModule :: + P.Module -> + [IdeDeclarationAnn] -> + [IdeDeclarationAnn] resolveDocumentationForModule (P.Module _ moduleComments moduleName sdecls _) = map convertDecl where - extractDeclComments :: P.Declaration -> [(P.Name, [P.Comment])] - extractDeclComments = \case - P.DataDeclaration (_, cs) _ ctorName _ ctors -> - (P.TyName ctorName, cs) : map dtorComments ctors - P.TypeClassDeclaration (_, cs) tyClassName _ _ _ members -> - (P.TyClassName tyClassName, cs) : concatMap extractDeclComments members - decl -> - maybe [] (\name' -> [(name', snd (P.declSourceAnn decl))]) (name decl) - - comments :: Map P.Name [P.Comment] - comments = Map.insert (P.ModName moduleName) moduleComments $ - Map.fromListWith (flip (<>)) $ concatMap extractDeclComments sdecls - - dtorComments :: P.DataConstructorDeclaration -> (P.Name, [P.Comment]) - dtorComments dcd = (P.DctorName (P.dataCtorName dcd), snd (P.dataCtorAnn dcd)) - - name :: P.Declaration -> Maybe P.Name - name (P.TypeDeclaration d) = Just $ P.IdentName $ P.tydeclIdent d - name decl = P.declName decl - - convertDecl :: IdeDeclarationAnn -> IdeDeclarationAnn - convertDecl (IdeDeclarationAnn ann d) = - convertDeclaration' - (annotateValue . P.IdentName) - (annotateValue . P.IdentName . P.Ident) - (annotateValue . P.DctorName . P.ProperName) - (annotateValue . P.TyName . P.ProperName) - (annotateValue . P.TyClassName . P.ProperName) - (annotateValue . P.ModName . P.moduleNameFromString) - d - where - docs :: P.Name -> Text - docs ident = fromMaybe "" $ convertComments =<< Map.lookup ident comments - - annotateValue ident = IdeDeclarationAnn (ann { _annDocumentation = Just $ docs ident }) - -resolveInstances - :: ModuleMap P.ExternsFile - -> ModuleMap [IdeDeclarationAnn] - -> ModuleMap [IdeDeclarationAnn] + extractDeclComments :: P.Declaration -> [(P.Name, [P.Comment])] + extractDeclComments = \case + P.DataDeclaration (_, cs) _ ctorName _ ctors -> + (P.TyName ctorName, cs) : map dtorComments ctors + P.TypeClassDeclaration (_, cs) tyClassName _ _ _ members -> + (P.TyClassName tyClassName, cs) : concatMap extractDeclComments members + decl -> + maybe [] (\name' -> [(name', snd (P.declSourceAnn decl))]) (name decl) + + comments :: Map P.Name [P.Comment] + comments = + Map.insert (P.ModName moduleName) moduleComments $ + Map.fromListWith (flip (<>)) $ + concatMap extractDeclComments sdecls + + dtorComments :: P.DataConstructorDeclaration -> (P.Name, [P.Comment]) + dtorComments dcd = (P.DctorName (P.dataCtorName dcd), snd (P.dataCtorAnn dcd)) + + name :: P.Declaration -> Maybe P.Name + name (P.TypeDeclaration d) = Just $ P.IdentName $ P.tydeclIdent d + name decl = P.declName decl + + convertDecl :: IdeDeclarationAnn -> IdeDeclarationAnn + convertDecl (IdeDeclarationAnn ann d) = + convertDeclaration' + (annotateValue . P.IdentName) + (annotateValue . P.IdentName . P.Ident) + (annotateValue . P.DctorName . P.ProperName) + (annotateValue . P.TyName . P.ProperName) + (annotateValue . P.TyClassName . P.ProperName) + (annotateValue . P.ModName . P.moduleNameFromString) + d + where + docs :: P.Name -> Text + docs ident = fromMaybe "" $ convertComments =<< Map.lookup ident comments + + annotateValue ident = IdeDeclarationAnn (ann {_annDocumentation = Just $ docs ident}) + +resolveInstances :: + ModuleMap P.ExternsFile -> + ModuleMap [IdeDeclarationAnn] -> + ModuleMap [IdeDeclarationAnn] resolveInstances externs declarations = Map.foldr (flip (foldr go)) declarations - . Map.mapWithKey (\mn ef -> mapMaybe (extractInstances mn) (efDeclarations ef)) - $ externs + . Map.mapWithKey (\mn ef -> mapMaybe (extractInstances mn) (efDeclarations ef)) + $ externs where - extractInstances mn P.EDInstance{..} = + extractInstances mn P.EDInstance {..} = case edInstanceClassName of - P.Qualified (P.ByModuleName classModule) className -> - Just (IdeInstance mn - edInstanceName - edInstanceTypes - edInstanceConstraints, classModule, className) - _ -> Nothing + P.Qualified (P.ByModuleName classModule) className -> + Just + ( IdeInstance + mn + edInstanceName + edInstanceTypes + edInstanceConstraints + , classModule + , className + ) + _ -> Nothing extractInstances _ _ = Nothing - go - :: (IdeInstance, P.ModuleName, P.ProperName 'P.ClassName) - -> ModuleMap [IdeDeclarationAnn] - -> ModuleMap [IdeDeclarationAnn] + go :: + (IdeInstance, P.ModuleName, P.ProperName 'P.ClassName) -> + ModuleMap [IdeDeclarationAnn] -> + ModuleMap [IdeDeclarationAnn] go (ideInstance, classModule, className) acc' = let matchTC = anyOf (idaDeclaration . _IdeDeclTypeClass . ideTCName) (== className) updateDeclaration = - mapIf matchTC (idaDeclaration - . _IdeDeclTypeClass - . ideTCInstances - %~ (ideInstance :)) - in + mapIf + matchTC + ( idaDeclaration + . _IdeDeclTypeClass + . ideTCInstances + %~ (ideInstance :) + ) + in acc' & ix classModule %~ updateDeclaration -resolveOperators - :: ModuleMap [IdeDeclarationAnn] - -> ModuleMap [IdeDeclarationAnn] +resolveOperators :: + ModuleMap [IdeDeclarationAnn] -> + ModuleMap [IdeDeclarationAnn] resolveOperators modules = map (resolveOperatorsForModule modules) modules --- | Looks up the types and kinds for operators and assigns them to their --- declarations -resolveOperatorsForModule - :: ModuleMap [IdeDeclarationAnn] - -> [IdeDeclarationAnn] - -> [IdeDeclarationAnn] +{- | Looks up the types and kinds for operators and assigns them to their +declarations +-} +resolveOperatorsForModule :: + ModuleMap [IdeDeclarationAnn] -> + [IdeDeclarationAnn] -> + [IdeDeclarationAnn] resolveOperatorsForModule modules = map (idaDeclaration %~ resolveOperator) where getDeclarations :: P.ModuleName -> [IdeDeclaration] getDeclarations moduleName = Map.lookup moduleName modules - & foldMap (map discardAnn) + & foldMap (map discardAnn) resolveOperator (IdeDeclValueOperator op) | (P.Qualified (P.ByModuleName mn) (Left ident)) <- op ^. ideValueOpAlias = - let t = getDeclarations mn + let t = + getDeclarations mn & mapMaybe (preview _IdeDeclValue) & filter (anyOf ideValueIdent (== ident)) & map (view ideValueType) & listToMaybe - in IdeDeclValueOperator (op & ideValueOpType .~ t) + in IdeDeclValueOperator (op & ideValueOpType .~ t) | (P.Qualified (P.ByModuleName mn) (Right dtor)) <- op ^. ideValueOpAlias = - let t = getDeclarations mn + let t = + getDeclarations mn & mapMaybe (preview _IdeDeclDataConstructor) & filter (anyOf ideDtorName (== dtor)) & map (view ideDtorType) & listToMaybe - in IdeDeclValueOperator (op & ideValueOpType .~ t) + in IdeDeclValueOperator (op & ideValueOpType .~ t) resolveOperator (IdeDeclTypeOperator op) | P.Qualified (P.ByModuleName mn) properName <- op ^. ideTypeOpAlias = - let k = getDeclarations mn + let k = + getDeclarations mn & mapMaybe (preview _IdeDeclType) & filter (anyOf ideTypeName (== properName)) & map (view ideTypeKind) & listToMaybe - in IdeDeclTypeOperator (op & ideTypeOpKind .~ k) + in IdeDeclTypeOperator (op & ideTypeOpKind .~ k) resolveOperator x = x - -mapIf :: Functor f => (b -> Bool) -> (b -> b) -> f b -> f b +mapIf :: (Functor f) => (b -> Bool) -> (b -> b) -> f b -> f b mapIf p f = map (\x -> if p x then f x else x) -resolveDataConstructorsForModule - :: [IdeDeclarationAnn] - -> [IdeDeclarationAnn] +resolveDataConstructorsForModule :: + [IdeDeclarationAnn] -> + [IdeDeclarationAnn] resolveDataConstructorsForModule decls = map (idaDeclaration %~ resolveDataConstructors) decls where @@ -447,6 +487,9 @@ resolveDataConstructorsForModule decls = dtors = decls - & mapMaybe (preview (idaDeclaration . _IdeDeclDataConstructor)) - & foldr (\(IdeDataConstructor name typeName type') -> - Map.insertWith (<>) typeName [(name, type')]) Map.empty + & mapMaybe (preview (idaDeclaration . _IdeDeclDataConstructor)) + & foldr + ( \(IdeDataConstructor name typeName type') -> + Map.insertWith (<>) typeName [(name, type')] + ) + Map.empty diff --git a/src/Language/PureScript/Ide/Types.hs b/src/Language/PureScript/Ide/Types.hs index db17094a2..9185b727d 100644 --- a/src/Language/PureScript/Ide/Types.hs +++ b/src/Language/PureScript/Ide/Types.hs @@ -1,8 +1,10 @@ --- | --- Type definitions for psc-ide - -{-# language DeriveAnyClass, NoGeneralizedNewtypeDeriving, TemplateHaskell #-} +{-# LANGUAGE DeriveAnyClass #-} +{-# LANGUAGE TemplateHaskell #-} +{-# LANGUAGE NoGeneralizedNewtypeDeriving #-} +{- | +Type definitions for psc-ide +-} module Language.PureScript.Ide.Types where import Protolude hiding (moduleName) @@ -10,14 +12,14 @@ import Protolude hiding (moduleName) import Control.Concurrent.STM (TVar) import Control.Lens (Getting, Traversal', makeLenses) import Control.Monad.Fail (fail) -import Data.Aeson (ToJSON, FromJSON, (.=)) +import Data.Aeson (FromJSON, ToJSON, (.=)) import Data.Aeson qualified as Aeson import Data.IORef (IORef) -import Data.Time.Clock (UTCTime) import Data.Map.Lazy qualified as M +import Data.Time.Clock (UTCTime) import Language.PureScript qualified as P import Language.PureScript.Errors.JSON qualified as P -import Language.PureScript.Ide.Filter.Declaration (DeclarationType(..)) +import Language.PureScript.Ide.Filter.Declaration (DeclarationType (..)) type ModuleIdent = Text type ModuleMap a = Map P.ModuleName a @@ -36,38 +38,44 @@ data IdeDeclaration data IdeValue = IdeValue { _ideValueIdent :: P.Ident , _ideValueType :: P.SourceType - } deriving (Show, Eq, Ord, Generic, NFData) + } + deriving (Show, Eq, Ord, Generic, NFData) data IdeType = IdeType - { _ideTypeName :: P.ProperName 'P.TypeName - , _ideTypeKind :: P.SourceType - , _ideTypeDtors :: [(P.ProperName 'P.ConstructorName, P.SourceType)] - } deriving (Show, Eq, Ord, Generic, NFData) + { _ideTypeName :: P.ProperName 'P.TypeName + , _ideTypeKind :: P.SourceType + , _ideTypeDtors :: [(P.ProperName 'P.ConstructorName, P.SourceType)] + } + deriving (Show, Eq, Ord, Generic, NFData) data IdeTypeSynonym = IdeTypeSynonym { _ideSynonymName :: P.ProperName 'P.TypeName , _ideSynonymType :: P.SourceType , _ideSynonymKind :: P.SourceType - } deriving (Show, Eq, Ord, Generic, NFData) + } + deriving (Show, Eq, Ord, Generic, NFData) data IdeDataConstructor = IdeDataConstructor { _ideDtorName :: P.ProperName 'P.ConstructorName , _ideDtorTypeName :: P.ProperName 'P.TypeName , _ideDtorType :: P.SourceType - } deriving (Show, Eq, Ord, Generic, NFData) + } + deriving (Show, Eq, Ord, Generic, NFData) data IdeTypeClass = IdeTypeClass { _ideTCName :: P.ProperName 'P.ClassName , _ideTCKind :: P.SourceType , _ideTCInstances :: [IdeInstance] - } deriving (Show, Eq, Ord, Generic, NFData) + } + deriving (Show, Eq, Ord, Generic, NFData) data IdeInstance = IdeInstance { _ideInstanceModule :: P.ModuleName , _ideInstanceName :: P.Ident , _ideInstanceTypes :: [P.SourceType] , _ideInstanceConstraints :: Maybe [P.SourceConstraint] - } deriving (Show, Eq, Ord, Generic, NFData) + } + deriving (Show, Eq, Ord, Generic, NFData) data IdeValueOperator = IdeValueOperator { _ideValueOpName :: P.OpName 'P.ValueOpName @@ -75,7 +83,8 @@ data IdeValueOperator = IdeValueOperator , _ideValueOpPrecedence :: P.Precedence , _ideValueOpAssociativity :: P.Associativity , _ideValueOpType :: Maybe P.SourceType - } deriving (Show, Eq, Ord, Generic, NFData) + } + deriving (Show, Eq, Ord, Generic, NFData) data IdeTypeOperator = IdeTypeOperator { _ideTypeOpName :: P.OpName 'P.TypeOpName @@ -83,7 +92,8 @@ data IdeTypeOperator = IdeTypeOperator , _ideTypeOpPrecedence :: P.Precedence , _ideTypeOpAssociativity :: P.Associativity , _ideTypeOpKind :: Maybe P.SourceType - } deriving (Show, Eq, Ord, Generic, NFData) + } + deriving (Show, Eq, Ord, Generic, NFData) _IdeDeclValue :: Traversal' IdeDeclaration IdeValue _IdeDeclValue f (IdeDeclValue x) = map IdeDeclValue (f x) @@ -131,15 +141,16 @@ makeLenses ''IdeTypeOperator data IdeDeclarationAnn = IdeDeclarationAnn { _idaAnnotation :: Annotation , _idaDeclaration :: IdeDeclaration - } deriving (Show, Eq, Ord, Generic, NFData) + } + deriving (Show, Eq, Ord, Generic, NFData) -data Annotation - = Annotation +data Annotation = Annotation { _annLocation :: Maybe P.SourceSpan , _annExportedFrom :: Maybe P.ModuleName , _annTypeAnnotation :: Maybe P.SourceType , _annDocumentation :: Maybe Text - } deriving (Show, Eq, Ord, Generic, NFData) + } + deriving (Show, Eq, Ord, Generic, NFData) makeLenses ''Annotation makeLenses ''IdeDeclarationAnn @@ -149,23 +160,22 @@ emptyAnn = Annotation Nothing Nothing Nothing Nothing type DefinitionSites a = Map IdeNamespaced a type TypeAnnotations = Map P.Ident P.SourceType -newtype AstData a = AstData (ModuleMap (DefinitionSites a, TypeAnnotations)) - -- ^ SourceSpans for the definition sites of values and types as well as type - -- annotations found in a module +newtype AstData a + = -- | SourceSpans for the definition sites of values and types as well as type + -- annotations found in a module + AstData (ModuleMap (DefinitionSites a, TypeAnnotations)) deriving (Show, Eq, Ord, Generic, NFData, Functor, Foldable) data IdeLogLevel = LogDebug | LogPerf | LogAll | LogDefault | LogNone deriving (Show, Eq) -data IdeConfiguration = - IdeConfiguration +data IdeConfiguration = IdeConfiguration { confOutputPath :: FilePath , confLogLevel :: IdeLogLevel , confGlobs :: [FilePath] } -data IdeEnvironment = - IdeEnvironment +data IdeEnvironment = IdeEnvironment { ideStateVar :: TVar IdeState , ideConfiguration :: IdeConfiguration , ideCacheDbTimestamp :: IORef (Maybe UTCTime) @@ -176,7 +186,8 @@ type Ide m = (MonadIO m, MonadReader IdeEnvironment m) data IdeState = IdeState { ideFileState :: IdeFileState , ideVolatileState :: IdeVolatileState - } deriving (Show) + } + deriving (Show) emptyIdeState :: IdeState emptyIdeState = IdeState emptyFileState emptyVolatileState @@ -187,32 +198,35 @@ emptyFileState = IdeFileState M.empty M.empty emptyVolatileState :: IdeVolatileState emptyVolatileState = IdeVolatileState (AstData M.empty) M.empty Nothing - --- | @IdeFileState@ holds data that corresponds 1-to-1 to an entity on the --- filesystem. Externs correspond to the ExternsFiles the compiler emits into --- the output folder, and modules are parsed ASTs from source files. This means, --- that we can update single modules or ExternsFiles inside this state whenever --- the corresponding entity changes on the file system. +{- | @IdeFileState@ holds data that corresponds 1-to-1 to an entity on the +filesystem. Externs correspond to the ExternsFiles the compiler emits into +the output folder, and modules are parsed ASTs from source files. This means, +that we can update single modules or ExternsFiles inside this state whenever +the corresponding entity changes on the file system. +-} data IdeFileState = IdeFileState { fsExterns :: ModuleMap P.ExternsFile , fsModules :: ModuleMap (P.Module, FilePath) - } deriving (Show) - --- | @IdeVolatileState@ is derived from the @IdeFileState@ and needs to be --- invalidated and refreshed carefully. It holds @AstData@, which is the data we --- extract from the parsed ASTs, as well as the IdeDeclarations, which contain --- lots of denormalized data, so they need to fully rebuilt whenever --- @IdeFileState@ changes. The vsCachedRebuild field can hold a rebuild result --- with open imports which is used to provide completions for module private --- declarations + } + deriving (Show) + +{- | @IdeVolatileState@ is derived from the @IdeFileState@ and needs to be +invalidated and refreshed carefully. It holds @AstData@, which is the data we +extract from the parsed ASTs, as well as the IdeDeclarations, which contain +lots of denormalized data, so they need to fully rebuilt whenever +@IdeFileState@ changes. The vsCachedRebuild field can hold a rebuild result +with open imports which is used to provide completions for module private +declarations +-} data IdeVolatileState = IdeVolatileState { vsAstData :: AstData P.SourceSpan , vsDeclarations :: ModuleMap [IdeDeclarationAnn] , vsCachedRebuild :: Maybe (P.ModuleName, P.ExternsFile) - } deriving (Show) + } + deriving (Show) newtype Match a = Match (P.ModuleName, a) - deriving (Show, Eq, Functor) + deriving (Show, Eq, Functor) -- | A completion as it gets sent to the editors data Completion = Completion @@ -224,7 +238,8 @@ data Completion = Completion , complDocumentation :: Maybe Text , complExportedFrom :: [P.ModuleName] , complDeclarationType :: Maybe DeclarationType - } deriving (Show, Eq, Ord) + } + deriving (Show, Eq, Ord) instance ToJSON Completion where toJSON Completion {..} = @@ -258,8 +273,8 @@ declarationType decl = case decl of IdeDeclValueOperator _ -> ValueOperator IdeDeclTypeOperator _ -> TypeOperator IdeDeclModule _ -> Module -data Success = - CompletionResult [Completion] +data Success + = CompletionResult [Completion] | TextResult Text | UsagesResult [P.SourceSpan] | MultilineTextResult [Text] @@ -268,7 +283,7 @@ data Success = | RebuildSuccess P.MultipleErrors deriving (Show) -encodeSuccess :: ToJSON a => a -> Aeson.Value +encodeSuccess :: (ToJSON a) => a -> Aeson.Value encodeSuccess res = Aeson.object ["resultType" .= ("success" :: Text), "result" .= res] @@ -281,10 +296,11 @@ instance ToJSON Success where ImportList (moduleName, imports) -> Aeson.object [ "resultType" .= ("success" :: Text) - , "result" .= Aeson.object - [ "imports" .= map encodeImport imports - , "moduleName" .= P.runModuleName moduleName - ] + , "result" + .= Aeson.object + [ "imports" .= map encodeImport imports + , "moduleName" .= P.runModuleName moduleName + ] ] ModuleList modules -> encodeSuccess modules RebuildSuccess warnings -> encodeSuccess (P.toJSONErrors False P.Warning [] warnings) @@ -295,19 +311,22 @@ encodeImport (P.runModuleName -> mn, importType, map P.runModuleName -> qualifie Aeson.object $ [ "module" .= mn , "importType" .= ("implicit" :: Text) - ] ++ map ("qualifier" .=) (maybeToList qualifier) + ] + ++ map ("qualifier" .=) (maybeToList qualifier) P.Explicit refs -> Aeson.object $ [ "module" .= mn , "importType" .= ("explicit" :: Text) , "identifiers" .= (identifierFromDeclarationRef <$> refs) - ] ++ map ("qualifier" .=) (maybeToList qualifier) + ] + ++ map ("qualifier" .=) (maybeToList qualifier) P.Hiding refs -> Aeson.object $ [ "module" .= mn , "importType" .= ("hiding" :: Text) , "identifiers" .= (identifierFromDeclarationRef <$> refs) - ] ++ map ("qualifier" .=) (maybeToList qualifier) + ] + ++ map ("qualifier" .=) (maybeToList qualifier) -- | Denotes the different namespaces a name in PureScript can reside in. data IdeNamespace = IdeNSValue | IdeNSType | IdeNSModule diff --git a/src/Language/PureScript/Ide/Usage.hs b/src/Language/PureScript/Ide/Usage.hs index 3e773efe5..5b7b1837c 100644 --- a/src/Language/PureScript/Ide/Usage.hs +++ b/src/Language/PureScript/Ide/Usage.hs @@ -1,10 +1,10 @@ -module Language.PureScript.Ide.Usage - ( findReexportingModules - , directDependants - , eligibleModules - , applySearch - , findUsages - ) where +module Language.PureScript.Ide.Usage ( + findReexportingModules, + directDependants, + eligibleModules, + applySearch, + findUsages, +) where import Protolude hiding (moduleName) @@ -16,49 +16,54 @@ import Language.PureScript.Ide.State (getAllModules, getFileState) import Language.PureScript.Ide.Types import Language.PureScript.Ide.Util (identifierFromIdeDeclaration, namespaceForDeclaration) --- | --- How we find usages, given an IdeDeclaration and the module it was defined in: --- --- 1. Find all modules that reexport the given declaration --- 2. Find all modules that import from those modules, and while traversing the --- imports build a specification for how the identifier can be found in the --- module. --- 3. Apply the collected search specifications and collect the results -findUsages - :: Ide m - => IdeDeclaration - -> P.ModuleName - -> m (ModuleMap (NonEmpty P.SourceSpan)) +{- | +How we find usages, given an IdeDeclaration and the module it was defined in: + +1. Find all modules that reexport the given declaration +2. Find all modules that import from those modules, and while traversing the +imports build a specification for how the identifier can be found in the +module. +3. Apply the collected search specifications and collect the results +-} +findUsages :: + (Ide m) => + IdeDeclaration -> + P.ModuleName -> + m (ModuleMap (NonEmpty P.SourceSpan)) findUsages declaration moduleName = do ms <- getAllModules Nothing asts <- Map.map fst . fsModules <$> getFileState let elig = eligibleModules (moduleName, declaration) ms asts - pure - $ Map.mapMaybe nonEmpty - $ Map.mapWithKey (\mn searches -> - foldMap (\m -> foldMap (applySearch m) searches) (Map.lookup mn asts)) elig + pure $ + Map.mapMaybe nonEmpty $ + Map.mapWithKey + ( \mn searches -> + foldMap (\m -> foldMap (applySearch m) searches) (Map.lookup mn asts) + ) + elig --- | A declaration can either be imported qualified, or unqualified. All the --- information we need to find usages through a Traversal is thus captured in --- the `Search` type. +{- | A declaration can either be imported qualified, or unqualified. All the +information we need to find usages through a Traversal is thus captured in +the `Search` type. +-} type Search = P.Qualified IdeDeclaration -findReexportingModules - :: (P.ModuleName, IdeDeclaration) - -- ^ The declaration and the module it is defined in for which we are +findReexportingModules :: + -- | The declaration and the module it is defined in for which we are -- searching usages - -> ModuleMap [IdeDeclarationAnn] - -- ^ Our declaration cache. Needs to have reexports resolved - -> [P.ModuleName] - -- ^ All the modules that reexport the declaration. This does NOT include + (P.ModuleName, IdeDeclaration) -> + -- | Our declaration cache. Needs to have reexports resolved + ModuleMap [IdeDeclarationAnn] -> + -- | All the modules that reexport the declaration. This does NOT include -- the defining module + [P.ModuleName] findReexportingModules (moduleName, declaration) decls = Map.keys (Map.filter (any hasReexport) decls) where hasReexport d = (d & _idaDeclaration & identifierFromIdeDeclaration) == identifierFromIdeDeclaration declaration - && (d & _idaAnnotation & _annExportedFrom) == Just moduleName - && (d & _idaDeclaration & namespaceForDeclaration) == namespaceForDeclaration declaration + && (d & _idaAnnotation & _annExportedFrom) == Just moduleName + && (d & _idaDeclaration & namespaceForDeclaration) == namespaceForDeclaration declaration directDependants :: IdeDeclaration -> ModuleMap P.Module -> P.ModuleName -> ModuleMap (NonEmpty Search) directDependants declaration modules mn = Map.mapMaybe (nonEmpty . go) modules @@ -67,20 +72,23 @@ directDependants declaration modules mn = Map.mapMaybe (nonEmpty . go) modules go = foldMap isImporting . P.getModuleDeclarations isImporting d = case d of - P.ImportDeclaration _ mn' it qual | mn == mn' -> P.Qualified (P.byMaybeModuleName qual) <$> case it of - P.Implicit -> pure declaration - P.Explicit refs - | any (declaration `matchesRef`) refs -> pure declaration - P.Explicit _ -> [] - P.Hiding refs - | not (any (declaration `matchesRef`) refs) -> pure declaration - P.Hiding _ -> [] + P.ImportDeclaration _ mn' it qual + | mn == mn' -> + P.Qualified (P.byMaybeModuleName qual) <$> case it of + P.Implicit -> pure declaration + P.Explicit refs + | any (declaration `matchesRef`) refs -> pure declaration + P.Explicit _ -> [] + P.Hiding refs + | not (any (declaration `matchesRef`) refs) -> pure declaration + P.Hiding _ -> [] _ -> [] --- | Determines whether an IdeDeclaration is referenced by a DeclarationRef. --- --- TODO(Christoph): We should also extract the spans of matching refs here, --- since they also count as a usage (at least for rename refactorings) +{- | Determines whether an IdeDeclaration is referenced by a DeclarationRef. + +TODO(Christoph): We should also extract the spans of matching refs here, +since they also count as a usage (at least for rename refactorings) +-} matchesRef :: IdeDeclaration -> P.DeclarationRef -> Bool matchesRef declaration ref = case declaration of IdeDeclValue valueDecl -> case ref of @@ -94,9 +102,9 @@ matchesRef declaration ref = case declaration of _ -> False IdeDeclDataConstructor dtor -> case ref of P.TypeRef _ tn dtors - -- We check if the given data constructor constructs the type imported - -- here. - -- This way we match `Just` with an import like `import Data.Maybe (Maybe(..))` + -- We check if the given data constructor constructs the type imported + -- here. + -- This way we match `Just` with an import like `import Data.Maybe (Maybe(..))` | _ideDtorTypeName dtor == tn -> maybe True (elem (_ideDtorName dtor)) dtors _ -> False @@ -113,15 +121,15 @@ matchesRef declaration ref = case declaration of P.ModuleRef _ mn -> m == mn _ -> False -eligibleModules - :: (P.ModuleName, IdeDeclaration) - -> ModuleMap [IdeDeclarationAnn] - -> ModuleMap P.Module - -> ModuleMap (NonEmpty Search) +eligibleModules :: + (P.ModuleName, IdeDeclaration) -> + ModuleMap [IdeDeclarationAnn] -> + ModuleMap P.Module -> + ModuleMap (NonEmpty Search) eligibleModules query@(moduleName, declaration) decls modules = let searchDefiningModule = P.Qualified P.ByNullSourcePos declaration :| [] - in + in Map.insert moduleName searchDefiningModule $ foldMap (directDependants declaration modules) (moduleName :| findReexportingModules query decls) @@ -134,28 +142,28 @@ applySearch module_ search = findUsageInDeclaration = let (extr, _, _, _, _) = P.everythingWithScope mempty goExpr goBinder mempty mempty - in + in extr mempty goExpr scope expr = case expr of P.Var sp i | Just ideValue <- preview _IdeDeclValue (P.disqualify search) , P.isQualified search - || not (P.LocalIdent (_ideValueIdent ideValue) `Set.member` scope) -> - [sp | map P.runIdent i == map identifierFromIdeDeclaration search] + || not (P.LocalIdent (_ideValueIdent ideValue) `Set.member` scope) -> + [sp | map P.runIdent i == map identifierFromIdeDeclaration search] P.Constructor sp name | Just ideDtor <- traverse (preview _IdeDeclDataConstructor) search -> - [sp | name == map _ideDtorName ideDtor] + [sp | name == map _ideDtorName ideDtor] P.Op sp opName | Just ideOp <- traverse (preview _IdeDeclValueOperator) search -> - [sp | opName == map _ideValueOpName ideOp] + [sp | opName == map _ideValueOpName ideOp] _ -> [] goBinder _ binder = case binder of P.ConstructorBinder sp ctorName _ | Just ideDtor <- traverse (preview _IdeDeclDataConstructor) search -> - [sp | ctorName == map _ideDtorName ideDtor] + [sp | ctorName == map _ideDtorName ideDtor] P.OpBinder sp opName | Just op <- traverse (preview _IdeDeclValueOperator) search -> - [sp | opName == map _ideValueOpName op] + [sp | opName == map _ideValueOpName op] _ -> [] diff --git a/src/Language/PureScript/Ide/Util.hs b/src/Language/PureScript/Ide/Util.hs index 854391dca..cb47ebf37 100644 --- a/src/Language/PureScript/Ide/Util.hs +++ b/src/Language/PureScript/Ide/Util.hs @@ -8,41 +8,46 @@ -- Maintainer : Christoph Hegemann -- Stability : experimental -- --- | --- Generally useful functions + ----------------------------------------------------------------------------- -module Language.PureScript.Ide.Util - ( identifierFromIdeDeclaration - , unwrapMatch - , namespaceForDeclaration - , encodeT - , decodeT - , discardAnn - , withEmptyAnn - , valueOperatorAliasT - , typeOperatorAliasT - , properNameT - , identT - , opNameT - , ideReadFile - , module Language.PureScript.Ide.Logging - ) where - -import Protolude hiding (decodeUtf8, - encodeUtf8, to) +{- | +Generally useful functions +-} +module Language.PureScript.Ide.Util ( + identifierFromIdeDeclaration, + unwrapMatch, + namespaceForDeclaration, + encodeT, + decodeT, + discardAnn, + withEmptyAnn, + valueOperatorAliasT, + typeOperatorAliasT, + properNameT, + identT, + opNameT, + ideReadFile, + module Language.PureScript.Ide.Logging, +) where + +import Protolude hiding ( + decodeUtf8, + encodeUtf8, + to, + ) import Control.Lens (Getting, to, (^.)) import Data.Aeson (FromJSON, ToJSON, eitherDecode, encode) import Data.Text qualified as T import Data.Text.Lazy qualified as TL -import Data.Text.Lazy.Encoding as TLE +import Data.Text.Lazy.Encoding as TLE import Language.PureScript qualified as P -import Language.PureScript.Ide.Error (IdeError(..)) +import Language.PureScript.Ide.Error (IdeError (..)) import Language.PureScript.Ide.Logging -import Language.PureScript.Ide.Types (IdeDeclaration(..), IdeDeclarationAnn(..), IdeNamespace(..), Match(..), emptyAnn, ideDtorName, ideSynonymName, ideTCName, ideTypeName, ideTypeOpName, ideValueIdent, ideValueOpName) -import System.IO.UTF8 (readUTF8FileT) +import Language.PureScript.Ide.Types (IdeDeclaration (..), IdeDeclarationAnn (..), IdeNamespace (..), Match (..), emptyAnn, ideDtorName, ideSynonymName, ideTCName, ideTypeName, ideTypeOpName, ideValueIdent, ideValueOpName) import System.Directory (makeAbsolute) +import System.IO.UTF8 (readUTF8FileT) identifierFromIdeDeclaration :: IdeDeclaration -> Text identifierFromIdeDeclaration d = case d of @@ -75,13 +80,13 @@ withEmptyAnn = IdeDeclarationAnn emptyAnn unwrapMatch :: Match a -> a unwrapMatch (Match (_, ed)) = ed -valueOperatorAliasT - :: P.Qualified (Either P.Ident (P.ProperName 'P.ConstructorName)) -> Text +valueOperatorAliasT :: + P.Qualified (Either P.Ident (P.ProperName 'P.ConstructorName)) -> Text valueOperatorAliasT = P.showQualified $ either P.runIdent P.runProperName -typeOperatorAliasT - :: P.Qualified (P.ProperName 'P.TypeName) -> Text +typeOperatorAliasT :: + P.Qualified (P.ProperName 'P.TypeName) -> Text typeOperatorAliasT = P.showQualified P.runProperName @@ -100,25 +105,29 @@ identT = to P.runIdent opNameT :: Getting r (P.OpName a) Text opNameT = to P.runOpName -ideReadFile' - :: (MonadIO m, MonadError IdeError m) - => (FilePath -> IO Text) - -> FilePath - -> m (FilePath, Text) +ideReadFile' :: + (MonadIO m, MonadError IdeError m) => + (FilePath -> IO Text) -> + FilePath -> + m (FilePath, Text) ideReadFile' fileReader fp = do - absPath <- liftIO (try (makeAbsolute fp)) >>= \case - Left (err :: IOException) -> - throwError - (GeneralError - ("Couldn't resolve path for: " <> show fp <> ", Error: " <> show err)) - Right absPath -> pure absPath - contents <- liftIO (try (fileReader absPath)) >>= \case - Left (err :: IOException) -> - throwError - (GeneralError - ("Couldn't find file at: " <> show absPath <> ", Error: " <> show err)) - Right contents -> - pure contents + absPath <- + liftIO (try (makeAbsolute fp)) >>= \case + Left (err :: IOException) -> + throwError + ( GeneralError + ("Couldn't resolve path for: " <> show fp <> ", Error: " <> show err) + ) + Right absPath -> pure absPath + contents <- + liftIO (try (fileReader absPath)) >>= \case + Left (err :: IOException) -> + throwError + ( GeneralError + ("Couldn't find file at: " <> show absPath <> ", Error: " <> show err) + ) + Right contents -> + pure contents pure (absPath, contents) ideReadFile :: (MonadIO m, MonadError IdeError m) => FilePath -> m (FilePath, Text) diff --git a/src/Language/PureScript/Interactive.hs b/src/Language/PureScript/Interactive.hs index 5f88b079c..7ca6cb96f 100644 --- a/src/Language/PureScript/Interactive.hs +++ b/src/Language/PureScript/Interactive.hs @@ -1,126 +1,134 @@ {-# LANGUAGE DoAndIfThenElse #-} -module Language.PureScript.Interactive - ( handleCommand - , module Interactive - +module Language.PureScript.Interactive ( + handleCommand, + module Interactive, -- TODO: remove these exports - , make - , runMake - ) where + make, + runMake, +) where -import Prelude import Protolude (ordNub) +import Prelude -import Data.List (sort, find, foldl') -import Data.Maybe (fromMaybe, mapMaybe) +import Data.List (find, foldl', sort) import Data.Map qualified as M +import Data.Maybe (fromMaybe, mapMaybe) import Data.Set qualified as S import Data.Text (Text) import Data.Text qualified as T import Control.Monad.IO.Class (MonadIO, liftIO) -import Control.Monad.State.Class (MonadState(..), gets, modify) import Control.Monad.Reader.Class (MonadReader, asks) -import Control.Monad.Trans.Except (ExceptT(..), runExceptT) -import Control.Monad.Trans.State.Strict (StateT, runStateT, evalStateT) -import Control.Monad.Writer.Strict (Writer(), runWriter) +import Control.Monad.State.Class (MonadState (..), gets, modify) +import Control.Monad.Trans.Except (ExceptT (..), runExceptT) +import Control.Monad.Trans.State.Strict (StateT, evalStateT, runStateT) +import Control.Monad.Writer.Strict (Writer (), runWriter) import Language.PureScript qualified as P import Language.PureScript.CST qualified as CST -import Language.PureScript.Names qualified as N import Language.PureScript.Constants.Prim qualified as C +import Language.PureScript.Names qualified as N -import Language.PureScript.Interactive.Completion as Interactive -import Language.PureScript.Interactive.IO as Interactive -import Language.PureScript.Interactive.Message as Interactive -import Language.PureScript.Interactive.Module as Interactive -import Language.PureScript.Interactive.Parser as Interactive -import Language.PureScript.Interactive.Printer as Interactive -import Language.PureScript.Interactive.Types as Interactive +import Language.PureScript.Interactive.Completion as Interactive +import Language.PureScript.Interactive.IO as Interactive +import Language.PureScript.Interactive.Message as Interactive +import Language.PureScript.Interactive.Module as Interactive +import Language.PureScript.Interactive.Parser as Interactive +import Language.PureScript.Interactive.Printer as Interactive +import Language.PureScript.Interactive.Types as Interactive import System.Directory (getCurrentDirectory) import System.FilePath (()) import System.FilePath.Glob (glob) -- | Pretty-print errors -printErrors :: MonadIO m => P.MultipleErrors -> m () +printErrors :: (MonadIO m) => P.MultipleErrors -> m () printErrors errs = liftIO $ do pwd <- getCurrentDirectory putStrLn $ P.prettyPrintMultipleErrors P.defaultPPEOptions {P.ppeRelativeDirectory = pwd} errs --- | This is different than the runMake in 'Language.PureScript.Make' in that it specifies the --- options and ignores the warning messages. +{- | This is different than the runMake in 'Language.PureScript.Make' in that it specifies the +options and ignores the warning messages. +-} runMake :: P.Make a -> IO (Either P.MultipleErrors a) runMake mk = fst <$> P.runMake P.defaultOptions mk -- | Rebuild a module, using the cached externs data for dependencies. -rebuild - :: [P.ExternsFile] - -> P.Module - -> P.Make (P.ExternsFile, P.Environment) +rebuild :: + [P.ExternsFile] -> + P.Module -> + P.Make (P.ExternsFile, P.Environment) rebuild loadedExterns m = do - externs <- P.rebuildModule buildActions loadedExterns m - return (externs, foldl' (flip P.applyExternsFileToEnvironment) P.initEnvironment (loadedExterns ++ [externs])) + externs <- P.rebuildModule buildActions loadedExterns m + return (externs, foldl' (flip P.applyExternsFileToEnvironment) P.initEnvironment (loadedExterns ++ [externs])) where buildActions :: P.MakeActions P.Make buildActions = - (P.buildMakeActions modulesDir - filePathMap - M.empty - False) { P.progress = const (return ()) } + ( P.buildMakeActions + modulesDir + filePathMap + M.empty + False + ) + { P.progress = const (return ()) + } filePathMap :: M.Map P.ModuleName (Either P.RebuildPolicy FilePath) filePathMap = M.singleton (P.getModuleName m) (Left P.RebuildAlways) -- | Build the collection of modules from scratch. This is usually done on startup. -make - :: [(FilePath, CST.PartialResult P.Module)] - -> P.Make ([P.ExternsFile], P.Environment) +make :: + [(FilePath, CST.PartialResult P.Module)] -> + P.Make ([P.ExternsFile], P.Environment) make ms = do - foreignFiles <- P.inferForeignModules filePathMap - externs <- P.make (buildActions foreignFiles) (map snd ms) - return (externs, foldl' (flip P.applyExternsFileToEnvironment) P.initEnvironment externs) + foreignFiles <- P.inferForeignModules filePathMap + externs <- P.make (buildActions foreignFiles) (map snd ms) + return (externs, foldl' (flip P.applyExternsFileToEnvironment) P.initEnvironment externs) where buildActions :: M.Map P.ModuleName FilePath -> P.MakeActions P.Make buildActions foreignFiles = - P.buildMakeActions modulesDir - filePathMap - foreignFiles - False + P.buildMakeActions + modulesDir + filePathMap + foreignFiles + False filePathMap :: M.Map P.ModuleName (Either P.RebuildPolicy FilePath) filePathMap = M.fromList $ map (\(fp, m) -> (P.getModuleName $ CST.resPartial m, Right fp)) ms -- | Performs a PSCi command -handleCommand - :: (MonadReader PSCiConfig m, MonadState PSCiState m, MonadIO m) - => (String -> m ()) -- ^ evaluate JS - -> m () -- ^ reload - -> (String -> m ()) -- ^ print into console - -> Command - -> m () -handleCommand _ _ p ShowHelp = p helpMessage -handleCommand _ r _ ReloadState = handleReloadState r -handleCommand _ r _ ClearState = handleClearState r -handleCommand e _ _ (Expression val) = handleExpression e val -handleCommand _ _ _ (Import im) = handleImport im -handleCommand _ _ _ (Decls l) = handleDecls l -handleCommand _ _ p (TypeOf val) = handleTypeOf p val -handleCommand _ _ p (KindOf typ) = handleKindOf p typ +handleCommand :: + (MonadReader PSCiConfig m, MonadState PSCiState m, MonadIO m) => + -- | evaluate JS + (String -> m ()) -> + -- | reload + m () -> + -- | print into console + (String -> m ()) -> + Command -> + m () +handleCommand _ _ p ShowHelp = p helpMessage +handleCommand _ r _ ReloadState = handleReloadState r +handleCommand _ r _ ClearState = handleClearState r +handleCommand e _ _ (Expression val) = handleExpression e val +handleCommand _ _ _ (Import im) = handleImport im +handleCommand _ _ _ (Decls l) = handleDecls l +handleCommand _ _ p (TypeOf val) = handleTypeOf p val +handleCommand _ _ p (KindOf typ) = handleKindOf p typ handleCommand _ _ p (BrowseModule moduleName) = handleBrowse p moduleName -handleCommand _ _ p (ShowInfo QueryLoaded) = handleShowLoadedModules p -handleCommand _ _ p (ShowInfo QueryImport) = handleShowImportedModules p -handleCommand _ _ p (ShowInfo QueryPrint) = handleShowPrint p -handleCommand _ _ p (CompleteStr prefix) = handleComplete p prefix -handleCommand _ _ p (SetInteractivePrint ip) = handleSetInteractivePrint p ip -handleCommand _ _ _ _ = P.internalError "handleCommand: unexpected command" +handleCommand _ _ p (ShowInfo QueryLoaded) = handleShowLoadedModules p +handleCommand _ _ p (ShowInfo QueryImport) = handleShowImportedModules p +handleCommand _ _ p (ShowInfo QueryPrint) = handleShowPrint p +handleCommand _ _ p (CompleteStr prefix) = handleComplete p prefix +handleCommand _ _ p (SetInteractivePrint ip) = handleSetInteractivePrint p ip +handleCommand _ _ _ _ = P.internalError "handleCommand: unexpected command" -- | Reload the application state -handleReloadState - :: (MonadReader PSCiConfig m, MonadState PSCiState m, MonadIO m) - => m () - -> m () +handleReloadState :: + (MonadReader PSCiConfig m, MonadState PSCiState m, MonadIO m) => + m () -> + m () handleReloadState reload = do modify $ updateLets (const []) globs <- asks psciFileGlobs @@ -136,20 +144,20 @@ handleReloadState reload = do reload -- | Clear the application state -handleClearState - :: (MonadReader PSCiConfig m, MonadState PSCiState m, MonadIO m) - => m () - -> m () +handleClearState :: + (MonadReader PSCiConfig m, MonadState PSCiState m, MonadIO m) => + m () -> + m () handleClearState reload = do modify $ updateImportedModules (const []) handleReloadState reload -- | Takes a value expression and evaluates it with the current state. -handleExpression - :: (MonadReader PSCiConfig m, MonadState PSCiState m, MonadIO m) - => (String -> m ()) - -> P.Expr - -> m () +handleExpression :: + (MonadReader PSCiConfig m, MonadState PSCiState m, MonadIO m) => + (String -> m ()) -> + P.Expr -> + m () handleExpression evaluate val = do st <- get let m = createTemporaryModule True st val @@ -160,14 +168,14 @@ handleExpression evaluate val = do js <- liftIO $ readFile (modulesDir "$PSCI" "index.js") evaluate js --- | --- Takes a list of declarations and updates the environment, then run a make. If the declaration fails, --- restore the original environment. --- -handleDecls - :: (MonadReader PSCiConfig m, MonadState PSCiState m, MonadIO m) - => [P.Declaration] - -> m () +{- | +Takes a list of declarations and updates the environment, then run a make. If the declaration fails, +restore the original environment. +-} +handleDecls :: + (MonadReader PSCiConfig m, MonadState PSCiState m, MonadIO m) => + [P.Declaration] -> + m () handleDecls ds = do st <- gets (updateLets (++ ds)) let m = createTemporaryModule False st (P.Literal P.nullSourceSpan (P.ObjectLiteral [])) @@ -177,62 +185,64 @@ handleDecls ds = do Right _ -> put st -- | Show actual loaded modules in psci. -handleShowLoadedModules - :: MonadState PSCiState m - => (String -> m ()) - -> m () +handleShowLoadedModules :: + (MonadState PSCiState m) => + (String -> m ()) -> + m () handleShowLoadedModules print' = do - loadedModules <- gets psciLoadedExterns - print' $ readModules loadedModules + loadedModules <- gets psciLoadedExterns + print' $ readModules loadedModules where readModules = unlines . sort . ordNub . map (T.unpack . P.runModuleName . P.getModuleName . fst) -- | Show the imported modules in psci. -handleShowImportedModules - :: MonadState PSCiState m - => (String -> m ()) - -> m () +handleShowImportedModules :: + (MonadState PSCiState m) => + (String -> m ()) -> + m () handleShowImportedModules print' = do importedModules <- psciImportedModules <$> get print' $ showModules importedModules where - showModules = unlines . sort . map (T.unpack . showModule) - showModule (mn, declType, asQ) = - "import " <> N.runModuleName mn <> showDeclType declType <> - foldMap (\mn' -> " as " <> N.runModuleName mn') asQ - - showDeclType P.Implicit = "" - showDeclType (P.Explicit refs) = refsList refs - showDeclType (P.Hiding refs) = " hiding " <> refsList refs - refsList refs = " (" <> commaList (mapMaybe showRef refs) <> ")" - - showRef :: P.DeclarationRef -> Maybe Text - showRef (P.TypeRef _ pn dctors) = - Just $ N.runProperName pn <> "(" <> maybe ".." (commaList . map N.runProperName) dctors <> ")" - showRef (P.TypeOpRef _ op) = - Just $ "type " <> N.showOp op - showRef (P.ValueRef _ ident) = - Just $ N.runIdent ident - showRef (P.ValueOpRef _ op) = - Just $ N.showOp op - showRef (P.TypeClassRef _ pn) = - Just $ "class " <> N.runProperName pn - showRef (P.TypeInstanceRef _ ident P.UserNamed) = - Just $ N.runIdent ident - showRef (P.TypeInstanceRef _ _ P.CompilerNamed) = - Nothing - showRef (P.ModuleRef _ name) = - Just $ "module " <> N.runModuleName name - showRef (P.ReExportRef _ _ _) = - Nothing - - commaList :: [Text] -> Text - commaList = T.intercalate ", " - -handleShowPrint - :: MonadState PSCiState m - => (String -> m ()) - -> m () + showModules = unlines . sort . map (T.unpack . showModule) + showModule (mn, declType, asQ) = + "import " + <> N.runModuleName mn + <> showDeclType declType + <> foldMap (\mn' -> " as " <> N.runModuleName mn') asQ + + showDeclType P.Implicit = "" + showDeclType (P.Explicit refs) = refsList refs + showDeclType (P.Hiding refs) = " hiding " <> refsList refs + refsList refs = " (" <> commaList (mapMaybe showRef refs) <> ")" + + showRef :: P.DeclarationRef -> Maybe Text + showRef (P.TypeRef _ pn dctors) = + Just $ N.runProperName pn <> "(" <> maybe ".." (commaList . map N.runProperName) dctors <> ")" + showRef (P.TypeOpRef _ op) = + Just $ "type " <> N.showOp op + showRef (P.ValueRef _ ident) = + Just $ N.runIdent ident + showRef (P.ValueOpRef _ op) = + Just $ N.showOp op + showRef (P.TypeClassRef _ pn) = + Just $ "class " <> N.runProperName pn + showRef (P.TypeInstanceRef _ ident P.UserNamed) = + Just $ N.runIdent ident + showRef (P.TypeInstanceRef _ _ P.CompilerNamed) = + Nothing + showRef (P.ModuleRef _ name) = + Just $ "module " <> N.runModuleName name + showRef (P.ReExportRef _ _ _) = + Nothing + + commaList :: [Text] -> Text + commaList = T.intercalate ", " + +handleShowPrint :: + (MonadState PSCiState m) => + (String -> m ()) -> + m () handleShowPrint print' = do current <- psciInteractivePrint <$> get if current == initialInteractivePrint @@ -241,31 +251,34 @@ handleShowPrint print' = do "The interactive print function is currently set to the default (`" ++ showPrint current ++ "`)" else print' $ - "The interactive print function is currently set to `" ++ showPrint current ++ "`\n" ++ - "The default can be restored with `:print " ++ showPrint initialInteractivePrint ++ "`" - + "The interactive print function is currently set to `" + ++ showPrint current + ++ "`\n" + ++ "The default can be restored with `:print " + ++ showPrint initialInteractivePrint + ++ "`" where - showPrint (mn, ident) = T.unpack (N.runModuleName mn <> "." <> N.runIdent ident) + showPrint (mn, ident) = T.unpack (N.runModuleName mn <> "." <> N.runIdent ident) -- | Imports a module, preserving the initial state on failure. -handleImport - :: (MonadReader PSCiConfig m, MonadState PSCiState m, MonadIO m) - => ImportedModule - -> m () +handleImport :: + (MonadReader PSCiConfig m, MonadState PSCiState m, MonadIO m) => + ImportedModule -> + m () handleImport im = do - st <- gets (updateImportedModules (im :)) - let m = createTemporaryModuleForImports st - e <- liftIO . runMake $ rebuild (map snd (psciLoadedExterns st)) m - case e of - Left errs -> printErrors errs - Right _ -> put st + st <- gets (updateImportedModules (im :)) + let m = createTemporaryModuleForImports st + e <- liftIO . runMake $ rebuild (map snd (psciLoadedExterns st)) m + case e of + Left errs -> printErrors errs + Right _ -> put st -- | Takes a value and prints its type -handleTypeOf - :: (MonadReader PSCiConfig m, MonadState PSCiState m, MonadIO m) - => (String -> m ()) - -> P.Expr - -> m () +handleTypeOf :: + (MonadReader PSCiConfig m, MonadState PSCiState m, MonadIO m) => + (String -> m ()) -> + P.Expr -> + m () handleTypeOf print' val = do st <- get let m = createTemporaryModule False st val @@ -278,11 +291,11 @@ handleTypeOf print' val = do Nothing -> print' "Could not find type" -- | Takes a type and prints its kind -handleKindOf - :: (MonadReader PSCiConfig m, MonadState PSCiState m, MonadIO m) - => (String -> m ()) - -> P.SourceType - -> m () +handleKindOf :: + (MonadReader PSCiConfig m, MonadState PSCiState m, MonadIO m) => + (String -> m ()) -> + P.SourceType -> + m () handleKindOf print' typ = do st <- get let m = createTemporaryModuleForKind st typ @@ -293,60 +306,61 @@ handleKindOf print' typ = do Right (_, env') -> case M.lookup (P.Qualified (P.ByModuleName mName) $ P.ProperName "IT") (P.typeSynonyms env') of Just (_, typ') -> do - let chk = (P.emptyCheckState env') { P.checkCurrentModule = Just mName } - k = check (snd <$> P.kindOf typ') chk + let chk = (P.emptyCheckState env') {P.checkCurrentModule = Just mName} + k = check (snd <$> P.kindOf typ') chk check :: StateT P.CheckState (ExceptT P.MultipleErrors (Writer P.MultipleErrors)) a -> P.CheckState -> Either P.MultipleErrors (a, P.CheckState) check sew = fst . runWriter . runExceptT . runStateT sew case k of - Left err -> printErrors err + Left err -> printErrors err Right (kind, _) -> print' . P.prettyPrintType 1024 $ kind Nothing -> print' "Could not find kind" -- | Browse a module and displays its signature -handleBrowse - :: (MonadReader PSCiConfig m, MonadState PSCiState m) - => (String -> m ()) - -> P.ModuleName - -> m () +handleBrowse :: + (MonadReader PSCiConfig m, MonadState PSCiState m) => + (String -> m ()) -> + P.ModuleName -> + m () handleBrowse print' moduleName = do st <- get let env = psciEnvironment st case findMod moduleName (psciLoadedExterns st) (psciImportedModules st) of Just qualName -> print' $ printModuleSignatures qualName env - Nothing -> failNotInEnv moduleName + Nothing -> failNotInEnv moduleName where findMod needle externs imports = let qualMod = fromMaybe needle (lookupUnQualifiedModName needle imports) modules = S.fromList (C.primModules <> (P.getModuleName . fst <$> externs)) - in if qualMod `S.member` modules - then Just qualMod - else Nothing + in if qualMod `S.member` modules + then Just qualMod + else Nothing failNotInEnv modName = print' $ T.unpack $ "Module '" <> N.runModuleName modName <> "' is not valid." lookupUnQualifiedModName needle imports = - (\(modName,_,_) -> modName) <$> find (\(_,_,mayQuaName) -> mayQuaName == Just needle) imports + (\(modName, _, _) -> modName) <$> find (\(_, _, mayQuaName) -> mayQuaName == Just needle) imports -- | Return output as would be returned by tab completion, for tools integration etc. -handleComplete - :: (MonadState PSCiState m, MonadIO m) - => (String -> m ()) - -> String - -> m () +handleComplete :: + (MonadState PSCiState m, MonadIO m) => + (String -> m ()) -> + String -> + m () handleComplete print' prefix = do st <- get let act = liftCompletionM (completion' (reverse prefix, "")) results <- evalStateT act st print' $ unlines (formatCompletions results) --- | Attempt to set the interactive print function. Note that the state will --- only be updated if the interactive print function exists and appears to --- work; we test it by attempting to evaluate '0'. -handleSetInteractivePrint - :: (MonadState PSCiState m, MonadIO m) - => (String -> m ()) - -> (P.ModuleName, P.Ident) - -> m () +{- | Attempt to set the interactive print function. Note that the state will +only be updated if the interactive print function exists and appears to +work; we test it by attempting to evaluate '0'. +-} +handleSetInteractivePrint :: + (MonadState PSCiState m, MonadIO m) => + (String -> m ()) -> + (P.ModuleName, P.Ident) -> + m () handleSetInteractivePrint print' new = do current <- gets psciInteractivePrint modify (setInteractivePrint new) diff --git a/src/Language/PureScript/Interactive/Completion.hs b/src/Language/PureScript/Interactive/Completion.hs index d9e61e9cc..8858ae7ce 100644 --- a/src/Language/PureScript/Interactive/Completion.hs +++ b/src/Language/PureScript/Interactive/Completion.hs @@ -1,34 +1,34 @@ -module Language.PureScript.Interactive.Completion - ( CompletionM - , liftCompletionM - , completion - , completion' - , formatCompletions - ) where +module Language.PureScript.Interactive.Completion ( + CompletionM, + liftCompletionM, + completion, + completion', + formatCompletions, +) where -import Prelude import Protolude (ordNub) +import Prelude -import Control.Monad.IO.Class (MonadIO(..)) -import Control.Monad.State.Class (MonadState(..)) -import Control.Monad.Trans.Reader (asks, runReaderT, ReaderT) -import Data.List (nub, isPrefixOf, isInfixOf, isSuffixOf, sortBy, stripPrefix) +import Control.Monad.IO.Class (MonadIO (..)) +import Control.Monad.State.Class (MonadState (..)) +import Control.Monad.Trans.Reader (ReaderT, asks, runReaderT) +import Data.List (isInfixOf, isPrefixOf, isSuffixOf, nub, sortBy, stripPrefix) import Data.Map (keys) import Data.Maybe (mapMaybe) import Data.Text qualified as T import Language.PureScript qualified as P import Language.PureScript.Interactive.Directive qualified as D -import Language.PureScript.Interactive.Types (Directive(..), PSCiState, psciExports, psciImports, psciLoadedExterns, replQueryStrings) -import System.Console.Haskeline (Completion(..), CompletionFunc, completeWordWithPrev, listFiles, simpleCompletion) +import Language.PureScript.Interactive.Types (Directive (..), PSCiState, psciExports, psciImports, psciLoadedExterns, replQueryStrings) +import System.Console.Haskeline (Completion (..), CompletionFunc, completeWordWithPrev, listFiles, simpleCompletion) -- Completions may read the state, but not modify it. type CompletionM = ReaderT PSCiState IO -- Lift a `CompletionM` action into a state monad. -liftCompletionM - :: (MonadState PSCiState m, MonadIO m) - => CompletionM a - -> m a +liftCompletionM :: + (MonadState PSCiState m, MonadIO m) => + CompletionM a -> + m a liftCompletionM act = do st <- get liftIO $ runReaderT act st @@ -36,23 +36,24 @@ liftCompletionM act = do -- Haskeline completions -- | Loads module, function, and file completions. -completion - :: (MonadState PSCiState m, MonadIO m) - => CompletionFunc m +completion :: + (MonadState PSCiState m, MonadIO m) => + CompletionFunc m completion = liftCompletionM . completion' completion' :: CompletionFunc CompletionM completion' = completeWordWithPrev Nothing " \t\n\r([" findCompletions --- | Callback for Haskeline's `completeWordWithPrev`. --- Expects: --- * Line contents to the left of the word, reversed --- * Word to be completed +{- | Callback for Haskeline's `completeWordWithPrev`. +Expects: + * Line contents to the left of the word, reversed + * Word to be completed +-} findCompletions :: String -> String -> CompletionM [Completion] findCompletions prev word = do - let ctx = completionContext (words (reverse prev)) word - completions <- concat <$> traverse getCompletions ctx - return $ sortBy directivesFirst completions + let ctx = completionContext (words (reverse prev)) word + completions <- concat <$> traverse getCompletions ctx + return $ sortBy directivesFirst completions where getCompletions :: CompletionContext -> CompletionM [Completion] getCompletions = fmap (mapMaybe (either (prefixedBy word) Just)) . getCompletion @@ -60,31 +61,33 @@ findCompletions prev word = do getCompletion :: CompletionContext -> CompletionM [Either String Completion] getCompletion ctx = case ctx of - CtxFilePath f -> map Right <$> listFiles f - CtxModule -> map Left <$> getModuleNames - CtxIdentifier -> map Left <$> ((++) <$> getIdentNames <*> getDctorNames) - CtxType pre -> map (Left . (pre ++)) <$> getTypeNames - CtxFixed str -> return [Left str] - CtxDirective d -> return (map Left (completeDirectives d)) + CtxFilePath f -> map Right <$> listFiles f + CtxModule -> map Left <$> getModuleNames + CtxIdentifier -> map Left <$> ((++) <$> getIdentNames <*> getDctorNames) + CtxType pre -> map (Left . (pre ++)) <$> getTypeNames + CtxFixed str -> return [Left str] + CtxDirective d -> return (map Left (completeDirectives d)) completeDirectives :: String -> [String] completeDirectives = map (':' :) . D.directiveStringsFor prefixedBy :: String -> String -> Maybe Completion - prefixedBy w cand = if w `isPrefixOf` cand - then Just (simpleCompletion cand) - else Nothing + prefixedBy w cand = + if w `isPrefixOf` cand + then Just (simpleCompletion cand) + else Nothing directivesFirst :: Completion -> Completion -> Ordering directivesFirst (Completion _ d1 _) (Completion _ d2 _) = go d1 d2 where - go (':' : xs) (':' : ys) = compare xs ys - go (':' : _) _ = LT - go _ (':' : _) = GT - go xs ys = compare xs ys - --- | --- Convert Haskeline completion result to results as they would be displayed + go (':' : xs) (':' : ys) = compare xs ys + go (':' : _) _ = LT + go _ (':' : _) = GT + go xs ys = compare xs ys + +{- | +Convert Haskeline completion result to results as they would be displayed +-} formatCompletions :: (String, [Completion]) -> [String] formatCompletions (unusedR, completions) = actuals where @@ -100,12 +103,13 @@ data CompletionContext | CtxFixed String deriving (Show) --- | --- Decide what kind of completion we need based on input. This function expects --- a list of complete words (to the left of the cursor) as the first argument, --- and the current word as the second argument. +{- | +Decide what kind of completion we need based on input. This function expects +a list of complete words (to the left of the cursor) as the first argument, +and the current word as the second argument. +-} completionContext :: [String] -> String -> [CompletionContext] -completionContext _ w | "::" `isInfixOf` w = [CtxType (w `endingWith` "::")] +completionContext _ w | "::" `isInfixOf` w = [CtxType (w `endingWith` "::")] completionContext ws _ | lastSatisfies ("::" `isSuffixOf`) ws = [CtxType ""] completionContext [] _ = [CtxDirective "", CtxIdentifier, CtxFixed "import"] completionContext ws w | headSatisfies (":" `isPrefixOf`) ws = completeDirective ws w @@ -115,38 +119,38 @@ completionContext _ _ = [CtxIdentifier] endingWith :: String -> String -> String endingWith str stop = aux "" str where - aux acc s@(x:xs) - | stop `isPrefixOf` s = reverse (stop ++ acc) - | otherwise = aux (x:acc) xs - aux acc [] = reverse (stop ++ acc) + aux acc s@(x : xs) + | stop `isPrefixOf` s = reverse (stop ++ acc) + | otherwise = aux (x : acc) xs + aux acc [] = reverse (stop ++ acc) completeDirective :: [String] -> String -> [CompletionContext] completeDirective ws w = case ws of - [] -> [CtxDirective w] - (x:xs) -> case D.directivesFor <$> stripPrefix ":" x of - -- only offer completions if the directive is unambiguous - Just [dir] -> directiveArg xs dir - _ -> [] + [] -> [CtxDirective w] + (x : xs) -> case D.directivesFor <$> stripPrefix ":" x of + -- only offer completions if the directive is unambiguous + Just [dir] -> directiveArg xs dir + _ -> [] directiveArg :: [String] -> Directive -> [CompletionContext] -directiveArg [] Browse = [CtxModule] -- only complete very next term -directiveArg [] Show = map CtxFixed replQueryStrings -- only complete very next term -directiveArg _ Type = [CtxIdentifier] -directiveArg _ Kind = [CtxType ""] -directiveArg _ _ = [] +directiveArg [] Browse = [CtxModule] -- only complete very next term +directiveArg [] Show = map CtxFixed replQueryStrings -- only complete very next term +directiveArg _ Type = [CtxIdentifier] +directiveArg _ Kind = [CtxType ""] +directiveArg _ _ = [] completeImport :: [String] -> String -> [CompletionContext] completeImport ws w' = case (ws, w') of (["import"], _) -> [CtxModule] - _ -> [] + _ -> [] headSatisfies :: (a -> Bool) -> [a] -> Bool headSatisfies p str = case str of - (c:_) -> p c - _ -> False + (c : _) -> p c + _ -> False lastSatisfies :: (a -> Bool) -> [a] -> Bool lastSatisfies _ [] = False @@ -166,10 +170,11 @@ getIdentNames = do importedValOps <- asks (keys . P.importedValueOps . psciImports) exportedValOps <- asks (keys . P.exportedValueOps . psciExports) - return . nub $ map (T.unpack . P.showQualified P.showIdent) importedVals - ++ map (T.unpack . P.showQualified P.runOpName) importedValOps - ++ map (T.unpack . P.showIdent) exportedVals - ++ map (T.unpack . P.runOpName) exportedValOps + return . nub $ + map (T.unpack . P.showQualified P.showIdent) importedVals + ++ map (T.unpack . P.showQualified P.runOpName) importedValOps + ++ map (T.unpack . P.showIdent) exportedVals + ++ map (T.unpack . P.runOpName) exportedValOps getDctorNames :: CompletionM [String] getDctorNames = do @@ -184,10 +189,11 @@ getTypeNames = do importedTypeOps <- asks (keys . P.importedTypeOps . psciImports) exportedTypeOps <- asks (keys . P.exportedTypeOps . psciExports) - return . nub $ map (T.unpack . P.showQualified P.runProperName) importedTypes - ++ map (T.unpack . P.showQualified P.runOpName) importedTypeOps - ++ map (T.unpack . P.runProperName) exportedTypes - ++ map (T.unpack . P.runOpName) exportedTypeOps + return . nub $ + map (T.unpack . P.showQualified P.runProperName) importedTypes + ++ map (T.unpack . P.showQualified P.runOpName) importedTypeOps + ++ map (T.unpack . P.runProperName) exportedTypes + ++ map (T.unpack . P.runOpName) exportedTypeOps moduleNames :: [P.Module] -> [String] moduleNames = ordNub . map (T.unpack . P.runModuleName . P.getModuleName) diff --git a/src/Language/PureScript/Interactive/Directive.hs b/src/Language/PureScript/Interactive/Directive.hs index 4a75f0f36..c8743242f 100644 --- a/src/Language/PureScript/Interactive/Directive.hs +++ b/src/Language/PureScript/Interactive/Directive.hs @@ -1,63 +1,63 @@ --- | --- Directives for PSCI. --- +{- | +Directives for PSCI. +-} module Language.PureScript.Interactive.Directive where import Prelude -import Data.Maybe (fromJust) import Data.List (isPrefixOf) +import Data.Maybe (fromJust) import Data.Tuple (swap) -import Language.PureScript.Interactive.Types (Directive(..)) +import Language.PureScript.Interactive.Types (Directive (..)) --- | --- A mapping of directives to the different strings that can be used to invoke --- them. --- +{- | +A mapping of directives to the different strings that can be used to invoke +them. +-} directiveStrings :: [(Directive, [String])] directiveStrings = - [ (Help , ["?", "help"]) - , (Quit , ["quit"]) - , (Reload , ["reload"]) - , (Clear , ["clear"]) - , (Browse , ["browse"]) - , (Type , ["type"]) - , (Kind , ["kind"]) - , (Show , ["show"]) - , (Paste , ["paste"]) - , (Complete , ["complete"]) - , (Print , ["print"]) - ] + [ (Help, ["?", "help"]) + , (Quit, ["quit"]) + , (Reload, ["reload"]) + , (Clear, ["clear"]) + , (Browse, ["browse"]) + , (Type, ["type"]) + , (Kind, ["kind"]) + , (Show, ["show"]) + , (Paste, ["paste"]) + , (Complete, ["complete"]) + , (Print, ["print"]) + ] --- | --- Like directiveStrings, but the other way around. --- +{- | +Like directiveStrings, but the other way around. +-} directiveStrings' :: [(String, Directive)] directiveStrings' = concatMap go directiveStrings where - go (dir, strs) = map (, dir) strs + go (dir, strs) = map (,dir) strs --- | --- Returns all possible string representations of a directive. --- +{- | +Returns all possible string representations of a directive. +-} stringsFor :: Directive -> [String] stringsFor d = fromJust (lookup d directiveStrings) --- | --- Returns the default string representation of a directive. --- +{- | +Returns the default string representation of a directive. +-} stringFor :: Directive -> String stringFor = head . stringsFor --- | --- Returns the list of directives which could be expanded from the string --- argument, together with the string alias that matched. --- +{- | +Returns the list of directives which could be expanded from the string +argument, together with the string alias that matched. +-} directivesFor' :: String -> [(Directive, String)] directivesFor' str = go directiveStrings' where - go = map swap . filter ((str `isPrefixOf`) . fst) + go = map swap . filter ((str `isPrefixOf`) . fst) directivesFor :: String -> [Directive] directivesFor = map fst . directivesFor' @@ -65,23 +65,22 @@ directivesFor = map fst . directivesFor' directiveStringsFor :: String -> [String] directiveStringsFor = map snd . directivesFor' --- | --- The help menu. --- +{- | +The help menu. +-} help :: [(Directive, String, String)] help = - [ (Help, "", "Show this help menu") - , (Quit, "", "Quit PSCi") - , (Reload, "", "Reload all imported modules while discarding bindings") - , (Clear, "", "Discard all imported modules and declared bindings") - , (Browse, "", "See all functions in ") - , (Type, "", "Show the type of ") - , (Kind, "", "Show the kind of ") - , (Show, "import", "Show all imported modules") - , (Show, "loaded", "Show all loaded modules") - , (Show, "print", "Show the repl's current printing function") - , (Paste, "paste", "Enter multiple lines, terminated by ^D") - , (Complete, "", "Show completions for as if pressing tab") - , (Print, "", "Set the repl's printing function to (which must be fully qualified)") + [ (Help, "", "Show this help menu") + , (Quit, "", "Quit PSCi") + , (Reload, "", "Reload all imported modules while discarding bindings") + , (Clear, "", "Discard all imported modules and declared bindings") + , (Browse, "", "See all functions in ") + , (Type, "", "Show the type of ") + , (Kind, "", "Show the kind of ") + , (Show, "import", "Show all imported modules") + , (Show, "loaded", "Show all loaded modules") + , (Show, "print", "Show the repl's current printing function") + , (Paste, "paste", "Enter multiple lines, terminated by ^D") + , (Complete, "", "Show completions for as if pressing tab") + , (Print, "", "Set the repl's printing function to (which must be fully qualified)") ] - diff --git a/src/Language/PureScript/Interactive/IO.hs b/src/Language/PureScript/Interactive/IO.hs index 34c9a287a..05ffc2c91 100644 --- a/src/Language/PureScript/Interactive/IO.hs +++ b/src/Language/PureScript/Interactive/IO.hs @@ -7,35 +7,41 @@ import Prelude import Control.Monad (msum, void) import Control.Monad.Error.Class (throwError) import Control.Monad.Trans.Class (lift) -import Control.Monad.Trans.Except (ExceptT(..), runExceptT) -import Control.Monad.Trans.Maybe (MaybeT(..), runMaybeT) +import Control.Monad.Trans.Except (ExceptT (..), runExceptT) +import Control.Monad.Trans.Maybe (MaybeT (..), runMaybeT) import Data.Functor ((<&>)) import Data.List (isInfixOf) -import System.Directory (XdgDirectory (..), createDirectoryIfMissing, - getAppUserDataDirectory, getXdgDirectory, - findExecutable, doesFileExist) -import System.Exit (ExitCode(ExitFailure, ExitSuccess)) +import Protolude (note) +import System.Directory ( + XdgDirectory (..), + createDirectoryIfMissing, + doesFileExist, + findExecutable, + getAppUserDataDirectory, + getXdgDirectory, + ) +import System.Exit (ExitCode (ExitFailure, ExitSuccess)) import System.FilePath (takeDirectory, ()) import System.Process (readProcessWithExitCode) -import Text.Parsec ((), many1, parse, sepBy) +import Text.Parsec (many1, parse, sepBy, ()) import Text.Parsec.Char (char, digit) -import Protolude (note) mkdirp :: FilePath -> IO () mkdirp = createDirectoryIfMissing True . takeDirectory -- File helpers -onFirstFileMatching :: Monad m => (b -> m (Maybe a)) -> [b] -> m (Maybe a) +onFirstFileMatching :: (Monad m) => (b -> m (Maybe a)) -> [b] -> m (Maybe a) onFirstFileMatching f pathVariants = runMaybeT . msum $ map (MaybeT . f) pathVariants --- | --- Locates the node executable. --- Checks for either @nodejs@ or @node@. --- +{- | +Locates the node executable. +Checks for either @nodejs@ or @node@. +-} findNodeProcess :: IO (Either String String) -findNodeProcess = onFirstFileMatching findExecutable ["nodejs", "node"] <&> - note "Could not find Node.js. Do you have Node.js installed and available in your PATH?" +findNodeProcess = + onFirstFileMatching findExecutable ["nodejs", "node"] + <&> note "Could not find Node.js. Do you have Node.js installed and available in your PATH?" findNodeVersion :: String -> IO (Maybe String) findNodeVersion node = do @@ -47,18 +53,19 @@ findNodeVersion node = do readNodeProcessWithExitCode :: Maybe FilePath -> [String] -> String -> IO (Either String (ExitCode, String, String)) readNodeProcessWithExitCode nodePath nodeArgs stdin = runExceptT $ do process <- maybe (ExceptT findNodeProcess) pure nodePath - (major, _, _) <- lift (findNodeVersion process) >>= \case - Nothing -> throwError "Could not find Node.js version." - Just version -> do - let semver = do - void $ char 'v' - major : minor : patch : _ <- fmap (read @Int) (many1 digit) `sepBy` void (char '.') - pure (major, minor, patch) - case parse (semver "Could not parse Node.js version.") "" version of - Left err -> throwError $ show err - Right (major, minor, patch) - | major < 12 -> throwError $ "Unsupported Node.js version " <> show major <> ". Required Node.js version >=12." - | otherwise -> pure (major, minor, patch) + (major, _, _) <- + lift (findNodeVersion process) >>= \case + Nothing -> throwError "Could not find Node.js version." + Just version -> do + let semver = do + void $ char 'v' + major : minor : patch : _ <- fmap (read @Int) (many1 digit) `sepBy` void (char '.') + pure (major, minor, patch) + case parse (semver "Could not parse Node.js version.") "" version of + Left err -> throwError $ show err + Right (major, minor, patch) + | major < 12 -> throwError $ "Unsupported Node.js version " <> show major <> ". Required Node.js version >=12." + | otherwise -> pure (major, minor, patch) let nodeArgs' = if major < 13 then "--experimental-modules" : nodeArgs else nodeArgs lift (readProcessWithExitCode process nodeArgs' stdin) <&> \case (ExitSuccess, out, err) -> @@ -70,17 +77,17 @@ censorExperimentalWarnings :: String -> String censorExperimentalWarnings = unlines . filter (not . ("ExperimentalWarning" `isInfixOf`)) . lines --- | --- Grabs the filename where the history is stored. --- +{- | +Grabs the filename where the history is stored. +-} getHistoryFilename :: IO FilePath getHistoryFilename = do appuserdata <- getAppUserDataDirectory "purescript" olddirbool <- doesFileExist (appuserdata "psci_history") if olddirbool - then return (appuserdata "psci_history") - else do - datadir <- getXdgDirectory XdgData "purescript" - let filename = datadir "psci_history" - mkdirp filename - return filename + then return (appuserdata "psci_history") + else do + datadir <- getXdgDirectory XdgData "purescript" + let filename = datadir "psci_history" + mkdirp filename + return filename diff --git a/src/Language/PureScript/Interactive/Message.hs b/src/Language/PureScript/Interactive/Message.hs index 800b61475..03b9f101c 100644 --- a/src/Language/PureScript/Interactive/Message.hs +++ b/src/Language/PureScript/Interactive/Message.hs @@ -4,9 +4,9 @@ import Prelude import Data.List (intercalate) import Data.Version (showVersion) -import Paths_purescript qualified as Paths import Language.PureScript.Interactive.Directive qualified as D import Language.PureScript.Interactive.Types (Directive) +import Paths_purescript qualified as Paths -- Messages @@ -16,43 +16,50 @@ guideURL = "https://github.com/purescript/documentation/blob/master/guides/PSCi. -- | The help message. helpMessage :: String -helpMessage = "The following commands are available:\n\n " ++ - intercalate "\n " (map line D.help) ++ - "\n\n" ++ extraHelp +helpMessage = + "The following commands are available:\n\n " + ++ intercalate "\n " (map line D.help) + ++ "\n\n" + ++ extraHelp where - line :: (Directive, String, String) -> String - line (dir, arg, desc) = - let cmd = ':' : D.stringFor dir - in unwords [ cmd - , replicate (11 - length cmd) ' ' - , arg - , replicate (11 - length arg) ' ' - , desc - ] - - extraHelp = - "Further information is available on the PureScript documentation repository:\n" ++ - " --> " ++ guideURL + line :: (Directive, String, String) -> String + line (dir, arg, desc) = + let cmd = ':' : D.stringFor dir + in unwords + [ cmd + , replicate (11 - length cmd) ' ' + , arg + , replicate (11 - length arg) ' ' + , desc + ] + + extraHelp = + "Further information is available on the PureScript documentation repository:\n" + ++ " --> " + ++ guideURL -- | The welcome prologue. prologueMessage :: String -prologueMessage = unlines - [ "PSCi, version " ++ showVersion Paths.version - , "Type :? for help" - ] +prologueMessage = + unlines + [ "PSCi, version " ++ showVersion Paths.version + , "Type :? for help" + ] noInputMessage :: String -noInputMessage = unlines - [ "purs repl: No input files; try running `pulp psci` instead." - , "For help getting started, visit " ++ guideURL - , "Usage: For basic information, try the `--help' option." - ] +noInputMessage = + unlines + [ "purs repl: No input files; try running `pulp psci` instead." + , "For help getting started, visit " ++ guideURL + , "Usage: For basic information, try the `--help' option." + ] supportModuleMessage :: String -supportModuleMessage = unlines - [ "purs repl: PSCi requires the psci-support package." - , "For help getting started, visit " ++ guideURL - ] +supportModuleMessage = + unlines + [ "purs repl: PSCi requires the psci-support package." + , "For help getting started, visit " ++ guideURL + ] -- | The quit message. quitMessage :: String diff --git a/src/Language/PureScript/Interactive/Module.hs b/src/Language/PureScript/Interactive/Module.hs index 61083eee2..28f013fbd 100644 --- a/src/Language/PureScript/Interactive/Module.hs +++ b/src/Language/PureScript/Interactive/Module.hs @@ -6,7 +6,7 @@ import Language.PureScript qualified as P import Language.PureScript.CST qualified as CST import Language.PureScript.Interactive.Types (ImportedModule, PSCiState, initialInteractivePrint, psciImportedModules, psciInteractivePrint, psciLetBindings) import System.Directory (getCurrentDirectory) -import System.FilePath (pathSeparator, makeRelative) +import System.FilePath (makeRelative, pathSeparator) import System.IO.UTF8 (readUTF8FilesT) -- * Support Module @@ -28,58 +28,65 @@ loadAllModules files = do filesAndContent <- readUTF8FilesT files return $ fmap (fmap snd) <$> CST.parseFromFiles (makeRelative pwd) filesAndContent --- | --- Makes a volatile module to execute the current expression. --- +{- | +Makes a volatile module to execute the current expression. +-} createTemporaryModule :: Bool -> PSCiState -> P.Expr -> P.Module createTemporaryModule exec st val = let - imports = psciImportedModules st - lets = psciLetBindings st - moduleName = P.ModuleName "$PSCI" + imports = psciImportedModules st + lets = psciLetBindings st + moduleName = P.ModuleName "$PSCI" effModuleName = P.ModuleName "Effect" - effImport = (effModuleName, P.Implicit, Just (P.ModuleName "$Effect")) + effImport = (effModuleName, P.Implicit, Just (P.ModuleName "$Effect")) supportImport = (fst (psciInteractivePrint st), P.Implicit, Just (P.ModuleName "$Support")) - eval = P.Var internalSpan (P.Qualified (P.ByModuleName (P.ModuleName "$Support")) (snd (psciInteractivePrint st))) - mainValue = P.App eval (P.Var internalSpan (P.Qualified P.ByNullSourcePos (P.Ident "it"))) - itDecl = P.ValueDecl (internalSpan, []) (P.Ident "it") P.Public [] [P.MkUnguarded val] - typeDecl = P.TypeDeclaration - (P.TypeDeclarationData (internalSpan, []) (P.Ident "$main") - (P.srcTypeApp - (P.srcTypeConstructor - (P.Qualified (P.ByModuleName (P.ModuleName "$Effect")) (P.ProperName "Effect"))) - P.srcTypeWildcard)) - mainDecl = P.ValueDecl (internalSpan, []) (P.Ident "$main") P.Public [] [P.MkUnguarded mainValue] - decls = if exec then [itDecl, typeDecl, mainDecl] else [itDecl] - in - P.Module internalSpan - [] moduleName - ((importDecl `map` (effImport : supportImport : imports)) ++ lets ++ decls) - Nothing - + eval = P.Var internalSpan (P.Qualified (P.ByModuleName (P.ModuleName "$Support")) (snd (psciInteractivePrint st))) + mainValue = P.App eval (P.Var internalSpan (P.Qualified P.ByNullSourcePos (P.Ident "it"))) + itDecl = P.ValueDecl (internalSpan, []) (P.Ident "it") P.Public [] [P.MkUnguarded val] + typeDecl = + P.TypeDeclaration + ( P.TypeDeclarationData + (internalSpan, []) + (P.Ident "$main") + ( P.srcTypeApp + ( P.srcTypeConstructor + (P.Qualified (P.ByModuleName (P.ModuleName "$Effect")) (P.ProperName "Effect")) + ) + P.srcTypeWildcard + ) + ) + mainDecl = P.ValueDecl (internalSpan, []) (P.Ident "$main") P.Public [] [P.MkUnguarded mainValue] + decls = if exec then [itDecl, typeDecl, mainDecl] else [itDecl] + in + P.Module + internalSpan + [] + moduleName + ((importDecl `map` (effImport : supportImport : imports)) ++ lets ++ decls) + Nothing --- | --- Makes a volatile module to hold a non-qualified type synonym for a fully-qualified data type declaration. --- +{- | +Makes a volatile module to hold a non-qualified type synonym for a fully-qualified data type declaration. +-} createTemporaryModuleForKind :: PSCiState -> P.SourceType -> P.Module createTemporaryModuleForKind st typ = let - imports = psciImportedModules st - lets = psciLetBindings st + imports = psciImportedModules st + lets = psciLetBindings st moduleName = P.ModuleName "$PSCI" - itDecl = P.TypeSynonymDeclaration (internalSpan, []) (P.ProperName "IT") [] typ - in + itDecl = P.TypeSynonymDeclaration (internalSpan, []) (P.ProperName "IT") [] typ + in P.Module internalSpan [] moduleName ((importDecl `map` imports) ++ lets ++ [itDecl]) Nothing --- | --- Makes a volatile module to execute the current imports. --- +{- | +Makes a volatile module to execute the current imports. +-} createTemporaryModuleForImports :: PSCiState -> P.Module createTemporaryModuleForImports st = let - imports = psciImportedModules st + imports = psciImportedModules st moduleName = P.ModuleName "$PSCI" - in + in P.Module internalSpan [] moduleName (importDecl `map` imports) Nothing importDecl :: ImportedModule -> P.Declaration diff --git a/src/Language/PureScript/Interactive/Parser.hs b/src/Language/PureScript/Interactive/Parser.hs index d888683b6..c8015f430 100644 --- a/src/Language/PureScript/Interactive/Parser.hs +++ b/src/Language/PureScript/Interactive/Parser.hs @@ -1,10 +1,10 @@ --- | --- Parser for PSCI. --- -module Language.PureScript.Interactive.Parser - ( parseDotFile - , parseCommand - ) where +{- | +Parser for PSCI. +-} +module Language.PureScript.Interactive.Parser ( + parseDotFile, + parseCommand, +) where import Prelude @@ -18,11 +18,11 @@ import Language.PureScript qualified as P import Language.PureScript.CST qualified as CST import Language.PureScript.CST.Monad qualified as CSTM import Language.PureScript.Interactive.Directive qualified as D -import Language.PureScript.Interactive.Types (Command(..), Directive(..), ReplQuery(..), parseReplQuery, replQueryStrings) +import Language.PureScript.Interactive.Types (Command (..), Directive (..), ReplQuery (..), parseReplQuery, replQueryStrings) --- | --- Parses a limited set of commands from from .purs-repl --- +{- | +Parses a limited set of commands from from .purs-repl +-} parseDotFile :: FilePath -> String -> Either String [Command] parseDotFile filePath = bimap (CST.prettyPrintError . NE.head) snd @@ -30,31 +30,33 @@ parseDotFile filePath = . CST.lexTopLevel . T.pack where - parser = CSTM.oneOf $ NE.fromList - [ psciImport filePath - , do - tok <- CSTM.munch - CSTM.parseFail tok $ CST.ErrCustom "The .purs-repl file only supports import declarations" - ] - --- | --- Parses PSCI metacommands or expressions input from the user. --- + parser = + CSTM.oneOf $ + NE.fromList + [ psciImport filePath + , do + tok <- CSTM.munch + CSTM.parseFail tok $ CST.ErrCustom "The .purs-repl file only supports import declarations" + ] + +{- | +Parses PSCI metacommands or expressions input from the user. +-} parseCommand :: String -> Either String [Command] parseCommand cmdString = case cmdString of (':' : cmd) -> pure <$> parseDirective cmd _ -> parseRest (mergeDecls <$> parseMany psciCommand) cmdString where - mergeDecls (Decls as : bs) = - case mergeDecls bs of - Decls bs' : cs' -> - Decls (as <> bs') : cs' - cs' -> - Decls as : cs' - mergeDecls (a : bs) = - a : mergeDecls bs - mergeDecls [] = [] + mergeDecls (Decls as : bs) = + case mergeDecls bs of + Decls bs' : cs' -> + Decls (as <> bs') : cs' + cs' -> + Decls as : cs' + mergeDecls (a : bs) = + a : mergeDecls bs + mergeDecls [] = [] parseMany :: CST.Parser a -> CST.Parser [a] parseMany = CSTM.manyDelimited CST.TokLayoutStart CST.TokLayoutEnd CST.TokLayoutSep @@ -64,18 +66,19 @@ parseOne p = CSTM.token CST.TokLayoutStart *> p <* CSTM.token CST.TokLayoutEnd parseRest :: CST.Parser a -> String -> Either String a parseRest p = - bimap (CST.prettyPrintError . NE.head) snd + bimap (CST.prettyPrintError . NE.head) snd . CST.runTokenParser (p <* CSTM.token CST.TokEof) . CST.lexTopLevel . T.pack psciCommand :: CST.Parser Command psciCommand = - CSTM.oneOf $ NE.fromList - [ psciImport "" - , psciDeclaration - , psciExpression - ] + CSTM.oneOf $ + NE.fromList + [ psciImport "" + , psciDeclaration + , psciExpression + ] trim :: String -> String trim = trimEnd . trimStart @@ -90,50 +93,62 @@ parseDirective :: String -> Either String Command parseDirective cmd = case D.directivesFor' dstr of [(d, _)] -> commandFor d - [] -> Left "Unrecognized directive. Type :? for help." - ds -> Left ("Ambiguous directive. Possible matches: " ++ - intercalate ", " (map snd ds) ++ ". Type :? for help.") + [] -> Left "Unrecognized directive. Type :? for help." + ds -> + Left + ( "Ambiguous directive. Possible matches: " + ++ intercalate ", " (map snd ds) + ++ ". Type :? for help." + ) where - (dstr, arg) = trim <$> break isSpace cmd - - commandFor d = case d of - Help -> return ShowHelp - Quit -> return QuitPSCi - Reload -> return ReloadState - Clear -> return ClearState - Paste -> return PasteLines - Browse -> BrowseModule . CST.nameValue <$> parseRest (parseOne CST.parseModuleNameP) arg - Show -> ShowInfo <$> parseReplQuery' arg - Type -> TypeOf . CST.convertExpr "" <$> parseRest (parseOne CST.parseExprP) arg - Kind -> KindOf . CST.convertType "" <$> parseRest (parseOne CST.parseTypeP) arg - Complete -> return (CompleteStr arg) - Print - | arg == "" -> return $ ShowInfo QueryPrint - | otherwise -> SetInteractivePrint <$> parseRest (parseOne parseFullyQualifiedIdent) arg - --- | --- Parses expressions entered at the PSCI repl. --- + (dstr, arg) = trim <$> break isSpace cmd + + commandFor d = case d of + Help -> return ShowHelp + Quit -> return QuitPSCi + Reload -> return ReloadState + Clear -> return ClearState + Paste -> return PasteLines + Browse -> BrowseModule . CST.nameValue <$> parseRest (parseOne CST.parseModuleNameP) arg + Show -> ShowInfo <$> parseReplQuery' arg + Type -> TypeOf . (CST.runConvert . CST.convertExpr "") <$> parseRest (parseOne CST.parseExprP) arg + Kind -> KindOf . (CST.runConvert . CST.convertType "") <$> parseRest (parseOne CST.parseTypeP) arg + Complete -> return (CompleteStr arg) + Print + | arg == "" -> return $ ShowInfo QueryPrint + | otherwise -> SetInteractivePrint <$> parseRest (parseOne parseFullyQualifiedIdent) arg + +{- | +Parses expressions entered at the PSCI repl. +-} psciExpression :: CST.Parser Command -psciExpression = Expression . CST.convertExpr "" <$> CST.parseExprP +psciExpression = Expression . (CST.runConvert . CST.convertExpr "") <$> CST.parseExprP --- | Imports must be handled separately from other declarations, so that --- :show import works, for example. +{- | Imports must be handled separately from other declarations, so that +:show import works, for example. +-} psciImport :: FilePath -> CST.Parser Command psciImport filePath = do - (_, mn, declType, asQ) <- CST.convertImportDecl filePath <$> CST.parseImportDeclP + (_, mn, declType, asQ) <- (CST.runConvert . CST.convertImportDecl filePath) <$> CST.parseImportDeclP pure $ Import (mn, declType, asQ) --- | Any declaration that we don't need a 'special case' parser for --- (like import declarations). +{- | Any declaration that we don't need a 'special case' parser for +(like import declarations). +-} psciDeclaration :: CST.Parser Command -psciDeclaration = Decls . CST.convertDeclaration "" <$> CST.parseDeclP +psciDeclaration = Decls . (CST.runConvert . CST.convertDeclaration "") <$> CST.parseDeclP parseReplQuery' :: String -> Either String ReplQuery parseReplQuery' str = case parseReplQuery str of - Nothing -> Left ("Don't know how to show " ++ str ++ ". Try one of: " ++ - intercalate ", " replQueryStrings ++ ".") + Nothing -> + Left + ( "Don't know how to show " + ++ str + ++ ". Try one of: " + ++ intercalate ", " replQueryStrings + ++ "." + ) Just query -> Right query parseFullyQualifiedIdent :: CST.Parser (P.ModuleName, P.Ident) diff --git a/src/Language/PureScript/Interactive/Printer.hs b/src/Language/PureScript/Interactive/Printer.hs index ed2d14521..fd433e5f7 100644 --- a/src/Language/PureScript/Interactive/Printer.hs +++ b/src/Language/PureScript/Interactive/Printer.hs @@ -5,8 +5,8 @@ import Prelude import Data.List (intersperse) import Data.Map qualified as M import Data.Maybe (mapMaybe) -import Data.Text qualified as T import Data.Text (Text) +import Data.Text qualified as T import Language.PureScript qualified as P import Text.PrettyPrint.Boxes qualified as Box @@ -16,117 +16,110 @@ textT = Box.text . T.unpack -- Printers --- | --- Pretty print a module's signatures --- +{- | +Pretty print a module's signatures +-} printModuleSignatures :: P.ModuleName -> P.Environment -> String -printModuleSignatures moduleName P.Environment{..} = - -- get relevant components of a module from environment - let moduleNamesIdent = byModuleName names - moduleTypeClasses = byModuleName typeClasses - moduleTypes = byModuleName types - - byModuleName :: M.Map (P.Qualified a) b -> [P.Qualified a] - byModuleName = filter ((== Just moduleName) . P.getQual) . M.keys - - in - -- print each component - (unlines . map trimEnd . lines . Box.render . Box.vsep 1 Box.left) - [ printModule's (mapMaybe (showTypeClass . findTypeClass typeClasses)) moduleTypeClasses -- typeClasses - , printModule's (mapMaybe (showType typeClasses dataConstructors typeSynonyms . findType types)) moduleTypes -- types - , printModule's (map (showNameType . findNameType names)) moduleNamesIdent -- functions - ] - - where printModule's showF = Box.vsep 1 Box.left . showF - - findNameType :: M.Map (P.Qualified P.Ident) (P.SourceType, P.NameKind, P.NameVisibility) - -> P.Qualified P.Ident - -> (P.Ident, Maybe (P.SourceType, P.NameKind, P.NameVisibility)) - findNameType envNames m = (P.disqualify m, M.lookup m envNames) - - showNameType :: (P.Ident, Maybe (P.SourceType, P.NameKind, P.NameVisibility)) -> Box.Box - showNameType (mIdent, Just (mType, _, _)) = textT (P.showIdent mIdent <> " :: ") Box.<> P.typeAsBox maxBound mType - showNameType _ = P.internalError "The impossible happened in printModuleSignatures." - - findTypeClass - :: M.Map (P.Qualified (P.ProperName 'P.ClassName)) P.TypeClassData - -> P.Qualified (P.ProperName 'P.ClassName) - -> (P.Qualified (P.ProperName 'P.ClassName), Maybe P.TypeClassData) - findTypeClass envTypeClasses name = (name, M.lookup name envTypeClasses) - - showTypeClass - :: (P.Qualified (P.ProperName 'P.ClassName), Maybe P.TypeClassData) - -> Maybe Box.Box - showTypeClass (_, Nothing) = Nothing - showTypeClass (P.Qualified _ name, Just P.TypeClassData{..}) = - let constraints = - if null typeClassSuperclasses - then Box.text "" - else Box.text "(" - Box.<> Box.hcat Box.left (intersperse (Box.text ", ") $ map (\(P.Constraint _ (P.Qualified _ pn) _ lt _) -> textT (P.runProperName pn) Box.<+> Box.hcat Box.left (map (P.typeAtomAsBox maxBound) lt)) typeClassSuperclasses) - Box.<> Box.text ") <= " - className = - textT (P.runProperName name) - Box.<> textT (foldMap ((" " <>) . fst) typeClassArguments) - classBody = - Box.vcat Box.top (map (\(i, t, _) -> textT (P.showIdent i <> " ::") Box.<+> P.typeAsBox maxBound t) typeClassMembers) - - in - Just $ - (Box.text "class " +printModuleSignatures moduleName P.Environment {..} = + -- get relevant components of a module from environment + let moduleNamesIdent = byModuleName names + moduleTypeClasses = byModuleName typeClasses + moduleTypes = byModuleName types + + byModuleName :: M.Map (P.Qualified a) b -> [P.Qualified a] + byModuleName = filter ((== Just moduleName) . P.getQual) . M.keys + in -- print each component + (unlines . map trimEnd . lines . Box.render . Box.vsep 1 Box.left) + [ printModule's (mapMaybe (showTypeClass . findTypeClass typeClasses)) moduleTypeClasses -- typeClasses + , printModule's (mapMaybe (showType typeClasses dataConstructors typeSynonyms . findType types)) moduleTypes -- types + , printModule's (map (showNameType . findNameType names)) moduleNamesIdent -- functions + ] + where + printModule's showF = Box.vsep 1 Box.left . showF + + findNameType :: + M.Map (P.Qualified P.Ident) (P.SourceType, P.NameKind, P.NameVisibility) -> + P.Qualified P.Ident -> + (P.Ident, Maybe (P.SourceType, P.NameKind, P.NameVisibility)) + findNameType envNames m = (P.disqualify m, M.lookup m envNames) + + showNameType :: (P.Ident, Maybe (P.SourceType, P.NameKind, P.NameVisibility)) -> Box.Box + showNameType (mIdent, Just (mType, _, _)) = textT (P.showIdent mIdent <> " :: ") Box.<> P.typeAsBox maxBound mType + showNameType _ = P.internalError "The impossible happened in printModuleSignatures." + + findTypeClass :: + M.Map (P.Qualified (P.ProperName 'P.ClassName)) P.TypeClassData -> + P.Qualified (P.ProperName 'P.ClassName) -> + (P.Qualified (P.ProperName 'P.ClassName), Maybe P.TypeClassData) + findTypeClass envTypeClasses name = (name, M.lookup name envTypeClasses) + + showTypeClass :: + (P.Qualified (P.ProperName 'P.ClassName), Maybe P.TypeClassData) -> + Maybe Box.Box + showTypeClass (_, Nothing) = Nothing + showTypeClass (P.Qualified _ name, Just P.TypeClassData {..}) = + let constraints = + if null typeClassSuperclasses + then Box.text "" + else + Box.text "(" + Box.<> Box.hcat Box.left (intersperse (Box.text ", ") $ map (\(P.Constraint _ (P.Qualified _ pn) _ lt _) -> textT (P.runProperName pn) Box.<+> Box.hcat Box.left (map (P.typeAtomAsBox maxBound) lt)) typeClassSuperclasses) + Box.<> Box.text ") <= " + className = + textT (P.runProperName name) + Box.<> textT (foldMap ((" " <>) . fst) typeClassArguments) + classBody = + Box.vcat Box.top (map (\(i, t, _) -> textT (P.showIdent i <> " ::") Box.<+> P.typeAsBox maxBound t) typeClassMembers) + in Just $ + ( Box.text "class " Box.<> constraints Box.<> className - Box.<+> if null typeClassMembers then Box.text "" else Box.text "where") - Box.// Box.moveRight 2 classBody - - - findType - :: M.Map (P.Qualified (P.ProperName 'P.TypeName)) (P.SourceType, P.TypeKind) - -> P.Qualified (P.ProperName 'P.TypeName) - -> (P.Qualified (P.ProperName 'P.TypeName), Maybe (P.SourceType, P.TypeKind)) - findType envTypes name = (name, M.lookup name envTypes) - - showType - :: M.Map (P.Qualified (P.ProperName 'P.ClassName)) P.TypeClassData - -> M.Map (P.Qualified (P.ProperName 'P.ConstructorName)) (P.DataDeclType, P.ProperName 'P.TypeName, P.SourceType, [P.Ident]) - -> M.Map (P.Qualified (P.ProperName 'P.TypeName)) ([(Text, Maybe P.SourceType)], P.SourceType) - -> (P.Qualified (P.ProperName 'P.TypeName), Maybe (P.SourceType, P.TypeKind)) - -> Maybe Box.Box - showType typeClassesEnv dataConstructorsEnv typeSynonymsEnv (n@(P.Qualified modul name), typ) = - case (typ, M.lookup n typeSynonymsEnv) of - (Just (_, P.TypeSynonym), Just (typevars, dtType)) -> - if M.member (fmap P.coerceProperName n) typeClassesEnv - then - Nothing - else - Just $ - textT ("type " <> P.runProperName name <> foldMap ((" " <>) . fst) typevars) - Box.// Box.moveRight 2 (Box.text "=" Box.<+> P.typeAsBox maxBound dtType) - - (Just (_, P.DataType _ typevars pt), _) -> - let prefix = - case pt of - [(dtProperName,_)] -> - case M.lookup (P.Qualified modul dtProperName) dataConstructorsEnv of - Just (dataDeclType, _, _, _) -> P.showDataDeclType dataDeclType - _ -> "data" + Box.<+> if null typeClassMembers then Box.text "" else Box.text "where" + ) + Box.// Box.moveRight 2 classBody + + findType :: + M.Map (P.Qualified (P.ProperName 'P.TypeName)) (P.SourceType, P.TypeKind) -> + P.Qualified (P.ProperName 'P.TypeName) -> + (P.Qualified (P.ProperName 'P.TypeName), Maybe (P.SourceType, P.TypeKind)) + findType envTypes name = (name, M.lookup name envTypes) + + showType :: + M.Map (P.Qualified (P.ProperName 'P.ClassName)) P.TypeClassData -> + M.Map (P.Qualified (P.ProperName 'P.ConstructorName)) (P.DataDeclType, P.ProperName 'P.TypeName, P.SourceType, [P.Ident]) -> + M.Map (P.Qualified (P.ProperName 'P.TypeName)) ([(Text, P.SourceType)], P.SourceType) -> + (P.Qualified (P.ProperName 'P.TypeName), Maybe (P.SourceType, P.TypeKind)) -> + Maybe Box.Box + showType typeClassesEnv dataConstructorsEnv typeSynonymsEnv (n@(P.Qualified modul name), typ) = + case (typ, M.lookup n typeSynonymsEnv) of + (Just (_, P.TypeSynonym), Just (typevars, dtType)) -> + if M.member (fmap P.coerceProperName n) typeClassesEnv + then Nothing + else + Just $ + textT ("type " <> P.runProperName name <> foldMap ((" " <>) . fst) typevars) + Box.// Box.moveRight 2 (Box.text "=" Box.<+> P.typeAsBox maxBound dtType) + (Just (_, P.DataType _ typevars pt), _) -> + let prefix = + case pt of + [(dtProperName, _)] -> + case M.lookup (P.Qualified modul dtProperName) dataConstructorsEnv of + Just (dataDeclType, _, _, _) -> P.showDataDeclType dataDeclType _ -> "data" - - in - Just $ textT (prefix <> " " <> P.runProperName name <> foldMap ((" " <>) . (\(v, _, _) -> v)) typevars) Box.// printCons pt - - _ -> - Nothing - - where printCons pt = - Box.moveRight 2 $ - Box.vcat Box.left $ - mapFirstRest (Box.text "=" Box.<+>) (Box.text "|" Box.<+>) $ - map (\(cons,idents) -> textT (P.runProperName cons) Box.<> Box.hcat Box.left (map prettyPrintType idents)) pt - - prettyPrintType t = Box.text " " Box.<> P.typeAtomAsBox maxBound t - - mapFirstRest _ _ [] = [] - mapFirstRest f g (x:xs) = f x : map g xs - - trimEnd = reverse . dropWhile (== ' ') . reverse + _ -> "data" + in Just $ textT (prefix <> " " <> P.runProperName name <> foldMap ((" " <>) . (\(v, _, _) -> v)) typevars) Box.// printCons pt + _ -> + Nothing + where + printCons pt = + Box.moveRight 2 $ + Box.vcat Box.left $ + mapFirstRest (Box.text "=" Box.<+>) (Box.text "|" Box.<+>) $ + map (\(cons, idents) -> textT (P.runProperName cons) Box.<> Box.hcat Box.left (map prettyPrintType idents)) pt + + prettyPrintType t = Box.text " " Box.<> P.typeAtomAsBox maxBound t + + mapFirstRest _ _ [] = [] + mapFirstRest f g (x : xs) = f x : map g xs + + trimEnd = reverse . dropWhile (== ' ') . reverse diff --git a/src/Language/PureScript/Interactive/Types.hs b/src/Language/PureScript/Interactive/Types.hs index 83fedf811..4827589d1 100644 --- a/src/Language/PureScript/Interactive/Types.hs +++ b/src/Language/PureScript/Interactive/Types.hs @@ -1,72 +1,74 @@ --- | --- Type declarations and associated basic functions for PSCI. --- -module Language.PureScript.Interactive.Types - ( PSCiConfig(..) - , psciEnvironment - , PSCiState -- constructor is not exported, to prevent psciImports and psciExports from - -- becoming inconsistent with importedModules, letBindings and loadedExterns - , ImportedModule - , psciExports - , psciImports - , psciLoadedExterns - , psciInteractivePrint - , psciImportedModules - , psciLetBindings - , initialPSCiState - , initialInteractivePrint - , updateImportedModules - , updateLoadedExterns - , updateLets - , setInteractivePrint - , Command(..) - , ReplQuery(..) - , replQueries - , replQueryStrings - , showReplQuery - , parseReplQuery - , Directive(..) - ) where +{- | +Type declarations and associated basic functions for PSCI. +-} +module Language.PureScript.Interactive.Types ( + PSCiConfig (..), + psciEnvironment, + PSCiState, -- constructor is not exported, to prevent psciImports and psciExports from + -- becoming inconsistent with importedModules, letBindings and loadedExterns + ImportedModule, + psciExports, + psciImports, + psciLoadedExterns, + psciInteractivePrint, + psciImportedModules, + psciLetBindings, + initialPSCiState, + initialInteractivePrint, + updateImportedModules, + updateLoadedExterns, + updateLets, + setInteractivePrint, + Command (..), + ReplQuery (..), + replQueries, + replQueryStrings, + showReplQuery, + parseReplQuery, + Directive (..), +) where import Prelude -import Language.PureScript qualified as P -import Data.Map qualified as M -import Data.List (foldl') -import Language.PureScript.Sugar.Names.Env (nullImports, primExports) import Control.Monad (foldM) import Control.Monad.Trans.Except (runExceptT) import Control.Monad.Trans.State (execStateT) import Control.Monad.Writer.Strict (runWriterT) +import Data.List (foldl') +import Data.Map qualified as M +import Language.PureScript qualified as P +import Language.PureScript.Sugar.Names.Env (nullImports, primExports) +{- | The PSCI configuration. --- | The PSCI configuration. --- --- These configuration values do not change during execution. --- +These configuration values do not change during execution. +-} newtype PSCiConfig = PSCiConfig { psciFileGlobs :: [String] - } deriving Show - --- | The PSCI state. --- --- Holds a list of imported modules, loaded files, and partial let bindings, --- plus the currently configured interactive printing function. --- --- The let bindings are partial, because it makes more sense to apply the --- binding to the final evaluated expression. --- --- The last two fields are derived from the first three via updateImportExports --- each time a module is imported, a let binding is added, or the session is --- cleared or reloaded -data PSCiState = PSCiState - [ImportedModule] - [P.Declaration] - [(P.Module, P.ExternsFile)] - (P.ModuleName, P.Ident) - P.Imports - P.Exports - deriving Show + } + deriving (Show) + +{- | The PSCI state. + +Holds a list of imported modules, loaded files, and partial let bindings, +plus the currently configured interactive printing function. + +The let bindings are partial, because it makes more sense to apply the +binding to the final evaluated expression. + +The last two fields are derived from the first three via updateImportExports +each time a module is imported, a let binding is added, or the session is +cleared or reloaded +-} +data PSCiState + = PSCiState + [ImportedModule] + [P.Declaration] + [(P.Module, P.ExternsFile)] + (P.ModuleName, P.Ident) + P.Imports + P.Exports + deriving (Show) psciImportedModules :: PSCiState -> [ImportedModule] psciImportedModules (PSCiState x _ _ _ _ _) = x @@ -95,17 +97,18 @@ initialInteractivePrint = (P.moduleNameFromString "PSCI.Support", P.Ident "eval" psciEnvironment :: PSCiState -> P.Environment psciEnvironment st = foldl' (flip P.applyExternsFileToEnvironment) P.initEnvironment externs - where externs = map snd (psciLoadedExterns st) - --- | All of the data that is contained by an ImportDeclaration in the AST. --- That is: --- --- * A module name, the name of the module which is being imported --- * An ImportDeclarationType which specifies whether there is an explicit --- import list, a hiding list, or neither. --- * If the module is imported qualified, its qualified name in the importing --- module. Otherwise, Nothing. --- + where + externs = map snd (psciLoadedExterns st) + +{- | All of the data that is contained by an ImportDeclaration in the AST. +That is: + +* A module name, the name of the module which is being imported +* An ImportDeclarationType which specifies whether there is an explicit + import list, a hiding list, or neither. +* If the module is imported qualified, its qualified name in the importing + module. Otherwise, Nothing. +-} type ImportedModule = (P.ModuleName, P.ImportDeclarationType, Maybe P.ModuleName) -- * State helpers @@ -116,35 +119,34 @@ type ImportedModule = (P.ModuleName, P.ImportDeclarationType, Maybe P.ModuleName updateImportExports :: PSCiState -> PSCiState updateImportExports st@(PSCiState modules lets externs iprint _ _) = case createEnv (map snd externs) >>= flip desugarModule temporaryModule of - Left _ -> st -- TODO: can this fail and what should we do? - Right env -> + Left _ -> st -- TODO: can this fail and what should we do? + Right env -> case M.lookup temporaryName env of - Just (_, is, es) -> PSCiState modules lets externs iprint is es - _ -> st -- impossible + Just (_, is, es) -> PSCiState modules lets externs iprint is es + _ -> st -- impossible where + desugarModule :: P.Env -> P.Module -> Either P.MultipleErrors P.Env + desugarModule e = runExceptT =<< fmap (fst . fst) . runWriterT . flip execStateT (e, mempty) . P.desugarImports - desugarModule :: P.Env -> P.Module -> Either P.MultipleErrors P.Env - desugarModule e = runExceptT =<< fmap (fst . fst) . runWriterT . flip execStateT (e, mempty) . P.desugarImports - - createEnv :: [P.ExternsFile] -> Either P.MultipleErrors P.Env - createEnv = runExceptT =<< fmap fst . runWriterT . foldM P.externsEnv P.primEnv + createEnv :: [P.ExternsFile] -> Either P.MultipleErrors P.Env + createEnv = runExceptT =<< fmap fst . runWriterT . foldM P.externsEnv P.primEnv - temporaryName :: P.ModuleName - temporaryName = P.ModuleName "$PSCI" + temporaryName :: P.ModuleName + temporaryName = P.ModuleName "$PSCI" - temporaryModule :: P.Module - temporaryModule = - let - prim = (P.ModuleName "Prim", P.Implicit, Nothing) - decl = (importDecl `map` (prim : modules)) ++ lets - in - P.Module internalSpan [] temporaryName decl Nothing + temporaryModule :: P.Module + temporaryModule = + let + prim = (P.ModuleName "Prim", P.Implicit, Nothing) + decl = (importDecl `map` (prim : modules)) ++ lets + in + P.Module internalSpan [] temporaryName decl Nothing - importDecl :: ImportedModule -> P.Declaration - importDecl (mn, declType, asQ) = P.ImportDeclaration (internalSpan, []) mn declType asQ + importDecl :: ImportedModule -> P.Declaration + importDecl (mn, declType, asQ) = P.ImportDeclaration (internalSpan, []) mn declType asQ - internalSpan :: P.SourceSpan - internalSpan = P.internalModuleSourceSpan "" + internalSpan :: P.SourceSpan + internalSpan = P.internalModuleSourceSpan "" -- | Updates the imported modules in the state record. updateImportedModules :: ([ImportedModule] -> [ImportedModule]) -> PSCiState -> PSCiState @@ -161,47 +163,48 @@ updateLets :: ([P.Declaration] -> [P.Declaration]) -> PSCiState -> PSCiState updateLets f (PSCiState a x b c d e) = updateImportExports (PSCiState a (f x) b c d e) --- | Replaces the interactive printing function in the state record with a new --- one. +{- | Replaces the interactive printing function in the state record with a new +one. +-} setInteractivePrint :: (P.ModuleName, P.Ident) -> PSCiState -> PSCiState setInteractivePrint iprint (PSCiState a b c _ d e) = PSCiState a b c iprint d e -- * Commands --- | --- Valid Meta-commands for PSCI --- +{- | +Valid Meta-commands for PSCI +-} data Command - -- | A purescript expression - = Expression P.Expr - -- | Show the help (ie, list of directives) - | ShowHelp - -- | Import a module from a loaded file - | Import ImportedModule - -- | Browse a module - | BrowseModule P.ModuleName - -- | Exit PSCI - | QuitPSCi - -- | Reload all the imported modules of the REPL - | ReloadState - -- | Clear the state of the REPL - | ClearState - -- | Add some declarations to the current evaluation context - | Decls [P.Declaration] - -- | Find the type of an expression - | TypeOf P.Expr - -- | Find the kind of an expression - | KindOf P.SourceType - -- | Shows information about the current state of the REPL - | ShowInfo ReplQuery - -- | Paste multiple lines - | PasteLines - -- | Return auto-completion output as if pressing - | CompleteStr String - -- | Set the interactive printing function - | SetInteractivePrint (P.ModuleName, P.Ident) - deriving Show + = -- | A purescript expression + Expression P.Expr + | -- | Show the help (ie, list of directives) + ShowHelp + | -- | Import a module from a loaded file + Import ImportedModule + | -- | Browse a module + BrowseModule P.ModuleName + | -- | Exit PSCI + QuitPSCi + | -- | Reload all the imported modules of the REPL + ReloadState + | -- | Clear the state of the REPL + ClearState + | -- | Add some declarations to the current evaluation context + Decls [P.Declaration] + | -- | Find the type of an expression + TypeOf P.Expr + | -- | Find the kind of an expression + KindOf P.SourceType + | -- | Shows information about the current state of the REPL + ShowInfo ReplQuery + | -- | Paste multiple lines + PasteLines + | -- | Return auto-completion output as if pressing + CompleteStr String + | -- | Set the interactive printing function + SetInteractivePrint (P.ModuleName, P.Ident) + deriving (Show) data ReplQuery = QueryLoaded diff --git a/src/Language/PureScript/Label.hs b/src/Language/PureScript/Label.hs index a5d080a76..98282c0ac 100644 --- a/src/Language/PureScript/Label.hs +++ b/src/Language/PureScript/Label.hs @@ -1,20 +1,20 @@ -module Language.PureScript.Label (Label(..)) where +module Language.PureScript.Label (Label (..)) where -import Prelude -import GHC.Generics (Generic) import Codec.Serialise (Serialise) import Control.DeepSeq (NFData) -import Data.Monoid () -import Data.String (IsString(..)) import Data.Aeson qualified as A +import Data.Monoid () +import Data.String (IsString (..)) +import GHC.Generics (Generic) +import Prelude import Language.PureScript.PSString (PSString) --- | --- Labels are used as record keys and row entry names. Labels newtype PSString --- because records are indexable by PureScript strings at runtime. --- -newtype Label = Label { runLabel :: PSString } +{- | +Labels are used as record keys and row entry names. Labels newtype PSString +because records are indexable by PureScript strings at runtime. +-} +newtype Label = Label {runLabel :: PSString} deriving (Show, Eq, Ord, IsString, Semigroup, Monoid, A.ToJSON, A.FromJSON, Generic) instance NFData Label diff --git a/src/Language/PureScript/Linter.hs b/src/Language/PureScript/Linter.hs index 9bce1909d..a6cb4ac73 100644 --- a/src/Language/PureScript/Linter.hs +++ b/src/Language/PureScript/Linter.hs @@ -1,137 +1,136 @@ --- | --- This module implements a simple linting pass on the PureScript AST. --- +{- | +This module implements a simple linting pass on the PureScript AST. +-} module Language.PureScript.Linter (lint, module L) where import Prelude -import Control.Monad.Writer.Class (MonadWriter(..), censor) +import Control.Monad.Writer.Class (MonadWriter (..), censor) +import Control.Monad ((<=<)) import Data.Maybe (mapMaybe) import Data.Set qualified as S import Data.Text (Text) import Data.Text qualified as Text -import Control.Monad ((<=<)) import Language.PureScript.AST -import Language.PureScript.Errors (MultipleErrors, SimpleErrorMessage(..), addHint, errorMessage') +import Language.PureScript.Constants.Libs qualified as C +import Language.PureScript.Errors (MultipleErrors, SimpleErrorMessage (..), addHint, errorMessage') import Language.PureScript.Linter.Exhaustive as L import Language.PureScript.Linter.Imports as L -import Language.PureScript.Names (Ident(..), Qualified(..), QualifiedBy(..), getIdentName, runIdent) -import Language.PureScript.Types (Constraint(..), SourceType, Type(..), everythingWithContextOnTypes) -import Language.PureScript.Constants.Libs qualified as C +import Language.PureScript.Names (Ident (..), Qualified (..), QualifiedBy (..), getIdentName, runIdent) +import Language.PureScript.Types (Constraint (..), SourceType, Type (..), everythingWithContextOnTypes) --- | Lint the PureScript AST. --- | --- | Right now, this pass performs a shadowing check and a check for unused bindings. +{- | Lint the PureScript AST. +| +| Right now, this pass performs a shadowing check and a check for unused bindings. +-} lint :: forall m. (MonadWriter MultipleErrors m) => Module -> m () lint modl@(Module _ _ mn ds _) = do lintUnused modl censor (addHint (ErrorInModule mn)) $ mapM_ lintDeclaration ds - where - moduleNames :: S.Set ScopedIdent - moduleNames = S.fromList (map ToplevelIdent (mapMaybe getDeclIdent ds)) - - getDeclIdent :: Declaration -> Maybe Ident - getDeclIdent = getIdentName <=< declName + moduleNames :: S.Set ScopedIdent + moduleNames = S.fromList (map ToplevelIdent (mapMaybe getDeclIdent ds)) - lintDeclaration :: Declaration -> m () - lintDeclaration = tell . f - where - (warningsInDecl, _, _, _, _) = everythingWithScope (\_ _ -> mempty) stepE stepB (\_ _ -> mempty) stepDo + getDeclIdent :: Declaration -> Maybe Ident + getDeclIdent = getIdentName <=< declName - f :: Declaration -> MultipleErrors - f (TypeClassDeclaration _ name args _ _ decs) = addHint (ErrorInTypeClassDeclaration name) (foldMap (f' (S.fromList $ fst <$> args)) decs) - f dec = f' S.empty dec - - f' :: S.Set Text -> Declaration -> MultipleErrors - f' s dec@(ValueDeclaration vd) = - addHint (ErrorInValueDeclaration (valdeclIdent vd)) (warningsInDecl moduleNames dec <> checkTypeVarsInDecl s dec) - f' s (TypeDeclaration td@(TypeDeclarationData (ss, _) _ _)) = - addHint (ErrorInTypeDeclaration (tydeclIdent td)) (checkTypeVars ss s (tydeclType td)) - f' s dec = warningsInDecl moduleNames dec <> checkTypeVarsInDecl s dec - - stepE :: S.Set ScopedIdent -> Expr -> MultipleErrors - stepE s (Abs (VarBinder ss name) _) | name `inScope` s = errorMessage' ss (ShadowedName name) - stepE s (Let _ ds' _) = foldMap go ds' + lintDeclaration :: Declaration -> m () + lintDeclaration = tell . f where - go d | Just i <- getDeclIdent d - , inScope i s = errorMessage' (declSourceSpan d) (ShadowedName i) - | otherwise = mempty - stepE _ _ = mempty - - stepB :: S.Set ScopedIdent -> Binder -> MultipleErrors - stepB s (VarBinder ss name) - | name `inScope` s - = errorMessage' ss (ShadowedName name) - stepB s (NamedBinder ss name _) - | inScope name s - = errorMessage' ss (ShadowedName name) - stepB _ _ = mempty - - stepDo :: S.Set ScopedIdent -> DoNotationElement -> MultipleErrors - stepDo s (DoNotationLet ds') = foldMap go ds' + (warningsInDecl, _, _, _, _) = everythingWithScope (\_ _ -> mempty) stepE stepB (\_ _ -> mempty) stepDo + + f :: Declaration -> MultipleErrors + f (TypeClassDeclaration _ name args _ _ decs) = addHint (ErrorInTypeClassDeclaration name) (foldMap (f' (S.fromList $ fst <$> args)) decs) + f dec = f' S.empty dec + + f' :: S.Set Text -> Declaration -> MultipleErrors + f' s dec@(ValueDeclaration vd) = + addHint (ErrorInValueDeclaration (valdeclIdent vd)) (warningsInDecl moduleNames dec <> checkTypeVarsInDecl s dec) + f' s (TypeDeclaration td@(TypeDeclarationData (ss, _) _ _)) = + addHint (ErrorInTypeDeclaration (tydeclIdent td)) (checkTypeVars ss s (tydeclType td)) + f' s dec = warningsInDecl moduleNames dec <> checkTypeVarsInDecl s dec + + stepE :: S.Set ScopedIdent -> Expr -> MultipleErrors + stepE s (Abs (VarBinder ss name) _) | name `inScope` s = errorMessage' ss (ShadowedName name) + stepE s (Let _ ds' _) = foldMap go ds' + where + go d + | Just i <- getDeclIdent d + , inScope i s = + errorMessage' (declSourceSpan d) (ShadowedName i) + | otherwise = mempty + stepE _ _ = mempty + + stepB :: S.Set ScopedIdent -> Binder -> MultipleErrors + stepB s (VarBinder ss name) + | name `inScope` s = + errorMessage' ss (ShadowedName name) + stepB s (NamedBinder ss name _) + | inScope name s = + errorMessage' ss (ShadowedName name) + stepB _ _ = mempty + + stepDo :: S.Set ScopedIdent -> DoNotationElement -> MultipleErrors + stepDo s (DoNotationLet ds') = foldMap go ds' + where + go d + | Just i <- getDeclIdent d, i `inScope` s = errorMessage' (declSourceSpan d) (ShadowedName i) + | otherwise = mempty + stepDo _ _ = mempty + + checkTypeVarsInDecl :: S.Set Text -> Declaration -> MultipleErrors + checkTypeVarsInDecl s d = let (f, _, _, _, _) = accumTypes (checkTypeVars (declSourceSpan d) s) in f d + + checkTypeVars :: SourceSpan -> S.Set Text -> SourceType -> MultipleErrors + checkTypeVars ss set ty = everythingWithContextOnTypes set mempty mappend step ty <> snd (findUnused ty) where - go d - | Just i <- getDeclIdent d, i `inScope` s = errorMessage' (declSourceSpan d) (ShadowedName i) - | otherwise = mempty - stepDo _ _ = mempty - - checkTypeVarsInDecl :: S.Set Text -> Declaration -> MultipleErrors - checkTypeVarsInDecl s d = let (f, _, _, _, _) = accumTypes (checkTypeVars (declSourceSpan d) s) in f d - - checkTypeVars :: SourceSpan -> S.Set Text -> SourceType -> MultipleErrors - checkTypeVars ss set ty = everythingWithContextOnTypes set mempty mappend step ty <> snd (findUnused ty) - where - - step :: S.Set Text -> SourceType -> (S.Set Text, MultipleErrors) - step s (ForAll _ _ tv _ _ _) = bindVar s tv - step s _ = (s, mempty) - - bindVar :: S.Set Text -> Text -> (S.Set Text, MultipleErrors) - bindVar = bind ss ShadowedTypeVar - - findUnused :: SourceType -> (S.Set Text, MultipleErrors) - findUnused = go set where - -- Recursively walk the type and prune used variables from `unused` - go :: S.Set Text -> SourceType -> (S.Set Text, MultipleErrors) - go unused (TypeVar _ v) = (S.delete v unused, mempty) - go unused (ForAll _ _ tv mbK t1 _) = - let (nowUnused, errors) - | Just k <- mbK = go unused k `combine` go (S.insert tv unused) t1 - | otherwise = go (S.insert tv unused) t1 - restoredUnused = if S.member tv unused then S.insert tv nowUnused else nowUnused - combinedErrors = if S.member tv nowUnused then errors <> errorMessage' ss (UnusedTypeVar tv) else errors - in (restoredUnused, combinedErrors) - go unused (TypeApp _ f x) = go unused f `combine` go unused x - go unused (KindApp _ f x) = go unused f `combine` go unused x - go unused (ConstrainedType _ c t1) = foldl combine (unused, mempty) $ map (go unused) (constraintArgs c <> [t1]) - go unused (RCons _ _ t1 rest) = go unused t1 `combine` go unused rest - go unused (KindedType _ t1 _) = go unused t1 - go unused (ParensInType _ t1) = go unused t1 - go unused (BinaryNoParensType _ t1 t2 t3) = go unused t1 `combine` go unused t2 `combine` go unused t3 - go unused TUnknown{} = (unused, mempty) - go unused TypeLevelString{} = (unused, mempty) - go unused TypeLevelInt{} = (unused, mempty) - go unused TypeWildcard{} = (unused, mempty) - go unused TypeConstructor{} = (unused, mempty) - go unused TypeOp{} = (unused, mempty) - go unused Skolem{} = (unused, mempty) - go unused REmpty{} = (unused, mempty) - - combine :: - (S.Set Text, MultipleErrors) -> - (S.Set Text, MultipleErrors) -> - (S.Set Text, MultipleErrors) - combine (a, b) (c, d) = (S.intersection a c, b <> d) - - bind :: (Ord a) => SourceSpan -> (a -> SimpleErrorMessage) -> S.Set a -> a -> (S.Set a, MultipleErrors) - bind ss mkError s name - | name `S.member` s = (s, errorMessage' ss (mkError name)) - | otherwise = (S.insert name s, mempty) - - + step :: S.Set Text -> SourceType -> (S.Set Text, MultipleErrors) + step s (ForAll _ _ tv _ _ _) = bindVar s tv + step s _ = (s, mempty) + + bindVar :: S.Set Text -> Text -> (S.Set Text, MultipleErrors) + bindVar = bind ss ShadowedTypeVar + + findUnused :: SourceType -> (S.Set Text, MultipleErrors) + findUnused = go set + where + -- Recursively walk the type and prune used variables from `unused` + go :: S.Set Text -> SourceType -> (S.Set Text, MultipleErrors) + go unused (TypeVar _ v _) = (S.delete v unused, mempty) + go unused (ForAll _ _ tv k t1 _) = + let (nowUnused, errors) = go unused k `combine` go (S.insert tv unused) t1 + + restoredUnused = if S.member tv unused then S.insert tv nowUnused else nowUnused + combinedErrors = if S.member tv nowUnused then errors <> errorMessage' ss (UnusedTypeVar tv) else errors + in (restoredUnused, combinedErrors) + go unused (TypeApp _ f x) = go unused f `combine` go unused x + go unused (KindApp _ f x) = go unused f `combine` go unused x + go unused (ConstrainedType _ c t1) = foldl combine (unused, mempty) $ map (go unused) (constraintArgs c <> [t1]) + go unused (RCons _ _ t1 rest) = go unused t1 `combine` go unused rest + go unused (KindedType _ t1 _) = go unused t1 + go unused (ParensInType _ t1) = go unused t1 + go unused (BinaryNoParensType _ t1 t2 t3) = go unused t1 `combine` go unused t2 `combine` go unused t3 + go unused TUnknown {} = (unused, mempty) + go unused TypeLevelString {} = (unused, mempty) + go unused TypeLevelInt {} = (unused, mempty) + go unused TypeWildcard {} = (unused, mempty) + go unused TypeConstructor {} = (unused, mempty) + go unused TypeOp {} = (unused, mempty) + go unused Skolem {} = (unused, mempty) + go unused REmpty {} = (unused, mempty) + + combine :: + (S.Set Text, MultipleErrors) -> + (S.Set Text, MultipleErrors) -> + (S.Set Text, MultipleErrors) + combine (a, b) (c, d) = (S.intersection a c, b <> d) + + bind :: (Ord a) => SourceSpan -> (a -> SimpleErrorMessage) -> S.Set a -> a -> (S.Set a, MultipleErrors) + bind ss mkError s name + | name `S.member` s = (s, errorMessage' ss (mkError name)) + | otherwise = (S.insert name s, mempty) lintUnused :: forall m. (MonadWriter MultipleErrors m) => Module -> m () lintUnused (Module modSS _ mn modDecls exports) = @@ -144,156 +143,134 @@ lintUnused (Module modSS _ mn modDecls exports) = Just exports' | any thisModuleRef exports' -> pure () | otherwise -> do - let exportIds = S.fromList $ mapMaybe getValueRef exports' - expectedUsedDecls = S.fromList (mapMaybe getDeclIdent $ filter isValueDecl modDecls) `S.difference` exportIds - unused = (expectedUsedDecls `S.difference` allVars) `S.difference` rebindable - newErrs = mconcat $ map unusedDeclError $ S.toList unused - tell newErrs - pure () + let exportIds = S.fromList $ mapMaybe getValueRef exports' + expectedUsedDecls = S.fromList (mapMaybe getDeclIdent $ filter isValueDecl modDecls) `S.difference` exportIds + unused = (expectedUsedDecls `S.difference` allVars) `S.difference` rebindable + newErrs = mconcat $ map unusedDeclError $ S.toList unused + tell newErrs + pure () where - unusedDeclError ident = errorMessage' ss $ UnusedDeclaration ident - where - ss = case filter ((== Just ident) . getDeclIdent) modDecls of - decl:_ -> declSourceSpan decl - _ -> modSS - - thisModuleRef :: DeclarationRef -> Bool - thisModuleRef (ModuleRef _ mn') = mn == mn' - thisModuleRef _ = False - - rebindable :: S.Set Ident - rebindable = S.fromList [ Ident C.S_bind, Ident C.S_discard ] - - getDeclIdent :: Declaration -> Maybe Ident - getDeclIdent = getIdentName <=< declName - - lintDeclaration :: Declaration -> m (S.Set Ident) - lintDeclaration declToLint = do - let (vars, errs) = goDecl declToLint - tell errs - pure vars - where - - goDecl :: Declaration -> (S.Set Ident, MultipleErrors) - goDecl (ValueDeclaration vd) = - let allExprs = concatMap unguard $ valdeclExpression vd - bindNewNames = S.fromList (concatMap binderNamesWithSpans $ valdeclBinders vd) - (vars, errs) = removeAndWarn bindNewNames $ mconcat $ map go allExprs - errs' = addHint (ErrorInValueDeclaration $ valdeclIdent vd) errs - in - (vars, errs') - - goDecl (ValueFixityDeclaration _ _ (Qualified _ (Left v)) _) = (S.singleton v, mempty) - - goDecl (TypeInstanceDeclaration _ _ _ _ _ _ _ _ (ExplicitInstance decls)) = mconcat $ map goDecl decls - goDecl _ = mempty - - go :: Expr -> (S.Set Ident, MultipleErrors) - go (Var _ (Qualified (BySourcePos _) v)) = (S.singleton v, mempty) - go (Var _ _) = (S.empty, mempty) - - go (Let _ ds e) = onDecls ds (go e) - - go (Abs binder v1) = - let newNames = S.fromList (binderNamesWithSpans binder) - in - removeAndWarn newNames $ go v1 - - go (UnaryMinus _ v1) = go v1 - go (BinaryNoParens v0 v1 v2) = go v0 <> go v1 <> go v2 - go (Parens v1) = go v1 - go (Accessor _ v1) = go v1 - - go (ObjectUpdate obj vs) = mconcat (go obj : map (go . snd) vs) - go (ObjectUpdateNested obj vs) = go obj <> goTree vs + unusedDeclError ident = errorMessage' ss $ UnusedDeclaration ident where - goTree (PathTree tree) = mconcat $ map (goNode . snd) (runAssocList tree) - goNode (Leaf val) = go val - goNode (Branch val) = goTree val - - go (App v1 v2) = go v1 <> go v2 - go (VisibleTypeApp v _) = go v - go (Unused v) = go v - go (IfThenElse v1 v2 v3) = go v1 <> go v2 <> go v3 - go (Case vs alts) = - let f (CaseAlternative binders gexprs) = - let bindNewNames = S.fromList (concatMap binderNamesWithSpans binders) - allExprs = concatMap unguard gexprs - in - removeAndWarn bindNewNames $ mconcat $ map go allExprs - in - mconcat $ map go vs ++ map f alts + ss = case filter ((== Just ident) . getDeclIdent) modDecls of + decl : _ -> declSourceSpan decl + _ -> modSS - go (TypedValue _ v1 _) = go v1 - go (Do _ es) = doElts es Nothing - go (Ado _ es v1) = doElts es (Just v1) + thisModuleRef :: DeclarationRef -> Bool + thisModuleRef (ModuleRef _ mn') = mn == mn' + thisModuleRef _ = False - go (Literal _ (ArrayLiteral es)) = mconcat $ map go es - go (Literal _ (ObjectLiteral oo)) = mconcat $ map (go . snd) oo + rebindable :: S.Set Ident + rebindable = S.fromList [Ident C.S_bind, Ident C.S_discard] - go (PositionedValue _ _ v1) = go v1 + getDeclIdent :: Declaration -> Maybe Ident + getDeclIdent = getIdentName <=< declName - go (Literal _ _) = mempty - go (Op _ _) = mempty - go (Constructor _ _) = mempty - go (TypeClassDictionary _ _ _) = mempty - go (DeferredDictionary _ _) = mempty - go (DerivedInstancePlaceholder _ _) = mempty - go AnonymousArgument = mempty - go (Hole _) = mempty - - - doElts :: [DoNotationElement] -> Maybe Expr -> (S.Set Ident, MultipleErrors) - doElts (DoNotationValue e : rest) v = go e <> doElts rest v - doElts (DoNotationBind binder e : rest) v = - let bindNewNames = S.fromList (binderNamesWithSpans binder) - in go e <> removeAndWarn bindNewNames (doElts rest v) - - doElts (DoNotationLet ds : rest) v = onDecls ds (doElts rest v) - - doElts (PositionedDoNotationElement _ _ e : rest) v = doElts (e : rest) v - doElts [] (Just e) = go e <> (rebindable, mempty) - doElts [] Nothing = (rebindable, mempty) - - -- (non-recursively, recursively) bound idents in decl - declIdents :: Declaration -> (S.Set (SourceSpan, Ident), S.Set (SourceSpan, Ident)) - declIdents (ValueDecl (ss,_) ident _ _ _) = (S.empty, S.singleton (ss, ident)) - declIdents (BoundValueDeclaration _ binders _) = (S.fromList $ binderNamesWithSpans binders, S.empty) - declIdents _ = (S.empty, S.empty) - - onDecls :: [ Declaration ] -> (S.Set Ident, MultipleErrors) -> (S.Set Ident, MultipleErrors) - onDecls ds errs = - let - onDecl d (accErrs, accLetNamesRec) = - let (letNames, recNames) = declIdents d - dErrs = underDecl d - errs' = dErrs <> removeAndWarn letNames accErrs - in - (errs', accLetNamesRec <> recNames) - (errs'', letNamesRec) = foldr onDecl (errs, S.empty) ds - in - removeAndWarn letNamesRec errs'' - - -- let f x = e -- check the x in e (but not the f) - underDecl (ValueDecl _ _ _ binders gexprs) = - let bindNewNames = S.fromList (concatMap binderNamesWithSpans binders) - allExprs = concatMap unguard gexprs - in - removeAndWarn bindNewNames $ foldr1 (<>) $ map go allExprs - -- let {x} = e -- no binding to check inside e - underDecl (BoundValueDeclaration _ _ expr) = go expr - underDecl _ = (mempty, mempty) - - unguard (GuardedExpr guards expr) = map unguard' guards ++ [expr] - unguard' (ConditionGuard ee) = ee - unguard' (PatternGuard _ ee) = ee - - removeAndWarn :: S.Set (SourceSpan, Ident) -> (S.Set Ident, MultipleErrors) -> (S.Set Ident, MultipleErrors) - removeAndWarn newNamesWithSpans (used, errors) = - let newNames = S.map snd newNamesWithSpans - filteredUsed = used `S.difference` newNames - warnUnused = S.filter (not . Text.isPrefixOf "_" . runIdent) (newNames `S.difference` used) - warnUnusedSpans = S.filter (\(_,ident) -> ident `elem` warnUnused) newNamesWithSpans - combinedErrors = if not $ S.null warnUnusedSpans then errors <> mconcat (map (\(ss,ident) -> errorMessage' ss $ UnusedName ident) $ S.toList warnUnusedSpans) else errors - in - (filteredUsed, combinedErrors) + lintDeclaration :: Declaration -> m (S.Set Ident) + lintDeclaration declToLint = do + let (vars, errs) = goDecl declToLint + tell errs + pure vars + where + goDecl :: Declaration -> (S.Set Ident, MultipleErrors) + goDecl (ValueDeclaration vd) = + let allExprs = concatMap unguard $ valdeclExpression vd + bindNewNames = S.fromList (concatMap binderNamesWithSpans $ valdeclBinders vd) + (vars, errs) = removeAndWarn bindNewNames $ mconcat $ map go allExprs + errs' = addHint (ErrorInValueDeclaration $ valdeclIdent vd) errs + in (vars, errs') + goDecl (ValueFixityDeclaration _ _ (Qualified _ (Left v)) _) = (S.singleton v, mempty) + goDecl (TypeInstanceDeclaration _ _ _ _ _ _ _ _ (ExplicitInstance decls)) = mconcat $ map goDecl decls + goDecl _ = mempty + + go :: Expr -> (S.Set Ident, MultipleErrors) + go (Var _ (Qualified (BySourcePos _) v)) = (S.singleton v, mempty) + go (Var _ _) = (S.empty, mempty) + go (Let _ ds e) = onDecls ds (go e) + go (Abs binder v1) = + let newNames = S.fromList (binderNamesWithSpans binder) + in removeAndWarn newNames $ go v1 + go (UnaryMinus _ v1) = go v1 + go (BinaryNoParens v0 v1 v2) = go v0 <> go v1 <> go v2 + go (Parens v1) = go v1 + go (Accessor _ v1) = go v1 + go (ObjectUpdate obj vs) = mconcat (go obj : map (go . snd) vs) + go (ObjectUpdateNested obj vs) = go obj <> goTree vs + where + goTree (PathTree tree) = mconcat $ map (goNode . snd) (runAssocList tree) + goNode (Leaf val) = go val + goNode (Branch val) = goTree val + go (App v1 v2) = go v1 <> go v2 + go (VisibleTypeApp v _) = go v + go (Unused v) = go v + go (IfThenElse v1 v2 v3) = go v1 <> go v2 <> go v3 + go (Case vs alts) = + let f (CaseAlternative binders gexprs) = + let bindNewNames = S.fromList (concatMap binderNamesWithSpans binders) + allExprs = concatMap unguard gexprs + in removeAndWarn bindNewNames $ mconcat $ map go allExprs + in mconcat $ map go vs ++ map f alts + go (TypedValue _ v1 _) = go v1 + go (Do _ es) = doElts es Nothing + go (Ado _ es v1) = doElts es (Just v1) + go (Literal _ (ListLiteral es)) = mconcat $ map go es + go (Literal _ (ObjectLiteral oo)) = mconcat $ map (go . snd) oo + go (PositionedValue _ _ v1) = go v1 + go (Literal _ _) = mempty + go (Op _ _) = mempty + go (Constructor _ _) = mempty + go (TypeClassDictionary _ _ _) = mempty + go (DeferredDictionary _ _) = mempty + go (DerivedInstancePlaceholder _ _) = mempty + go AnonymousArgument = mempty + go (Hole _) = mempty + + doElts :: [DoNotationElement] -> Maybe Expr -> (S.Set Ident, MultipleErrors) + doElts (DoNotationValue e : rest) v = go e <> doElts rest v + doElts (DoNotationBind binder e : rest) v = + let bindNewNames = S.fromList (binderNamesWithSpans binder) + in go e <> removeAndWarn bindNewNames (doElts rest v) + doElts (DoNotationLet ds : rest) v = onDecls ds (doElts rest v) + doElts (PositionedDoNotationElement _ _ e : rest) v = doElts (e : rest) v + doElts [] (Just e) = go e <> (rebindable, mempty) + doElts [] Nothing = (rebindable, mempty) + + -- (non-recursively, recursively) bound idents in decl + declIdents :: Declaration -> (S.Set (SourceSpan, Ident), S.Set (SourceSpan, Ident)) + declIdents (ValueDecl (ss, _) ident _ _ _) = (S.empty, S.singleton (ss, ident)) + declIdents (BoundValueDeclaration _ binders _) = (S.fromList $ binderNamesWithSpans binders, S.empty) + declIdents _ = (S.empty, S.empty) + + onDecls :: [Declaration] -> (S.Set Ident, MultipleErrors) -> (S.Set Ident, MultipleErrors) + onDecls ds errs = + let + onDecl d (accErrs, accLetNamesRec) = + let (letNames, recNames) = declIdents d + dErrs = underDecl d + errs' = dErrs <> removeAndWarn letNames accErrs + in (errs', accLetNamesRec <> recNames) + (errs'', letNamesRec) = foldr onDecl (errs, S.empty) ds + in + removeAndWarn letNamesRec errs'' + + -- let f x = e -- check the x in e (but not the f) + underDecl (ValueDecl _ _ _ binders gexprs) = + let bindNewNames = S.fromList (concatMap binderNamesWithSpans binders) + allExprs = concatMap unguard gexprs + in removeAndWarn bindNewNames $ foldr1 (<>) $ map go allExprs + -- let {x} = e -- no binding to check inside e + underDecl (BoundValueDeclaration _ _ expr) = go expr + underDecl _ = (mempty, mempty) + + unguard (GuardedExpr guards expr) = map unguard' guards ++ [expr] + unguard' (ConditionGuard ee) = ee + unguard' (PatternGuard _ ee) = ee + + removeAndWarn :: S.Set (SourceSpan, Ident) -> (S.Set Ident, MultipleErrors) -> (S.Set Ident, MultipleErrors) + removeAndWarn newNamesWithSpans (used, errors) = + let newNames = S.map snd newNamesWithSpans + filteredUsed = used `S.difference` newNames + warnUnused = S.filter (not . Text.isPrefixOf "_" . runIdent) (newNames `S.difference` used) + warnUnusedSpans = S.filter (\(_, ident) -> ident `elem` warnUnused) newNamesWithSpans + combinedErrors = if not $ S.null warnUnusedSpans then errors <> mconcat (map (\(ss, ident) -> errorMessage' ss $ UnusedName ident) $ S.toList warnUnusedSpans) else errors + in (filteredUsed, combinedErrors) diff --git a/src/Language/PureScript/Linter/Exhaustive.hs b/src/Language/PureScript/Linter/Exhaustive.hs index 697fefe8a..4a967ad5d 100644 --- a/src/Language/PureScript/Linter/Exhaustive.hs +++ b/src/Language/PureScript/Linter/Exhaustive.hs @@ -1,97 +1,98 @@ --- | --- Module for exhaustivity checking over pattern matching definitions --- The algorithm analyses the clauses of a definition one by one from top --- to bottom, where in each step it has the cases already missing (uncovered), --- and it generates the new set of missing cases. --- -module Language.PureScript.Linter.Exhaustive - ( checkExhaustiveExpr - ) where +{- | +Module for exhaustivity checking over pattern matching definitions +The algorithm analyses the clauses of a definition one by one from top +to bottom, where in each step it has the cases already missing (uncovered), +and it generates the new set of missing cases. +-} +module Language.PureScript.Linter.Exhaustive ( + checkExhaustiveExpr, +) where -import Prelude import Protolude (ordNub) +import Prelude -import Control.Applicative (Applicative(..)) +import Control.Applicative (Applicative (..)) import Control.Arrow (first, second) import Control.Monad (unless) -import Control.Monad.Writer.Class (MonadWriter(..)) +import Control.Monad.Writer.Class (MonadWriter (..)) import Data.List (foldl', sortOn) -import Data.Maybe (fromMaybe) import Data.Map qualified as M +import Data.Maybe (fromMaybe) import Data.Text qualified as T -import Language.PureScript.AST.Binders (Binder(..)) -import Language.PureScript.AST.Declarations (CaseAlternative(..), Expr(..), Guard(..), GuardedExpr(..), pattern MkUnguarded, isTrueExpr) -import Language.PureScript.AST.Literals (Literal(..)) +import Language.PureScript.AST.Binders (Binder (..)) +import Language.PureScript.AST.Declarations (CaseAlternative (..), Expr (..), Guard (..), GuardedExpr (..), isTrueExpr, pattern MkUnguarded) +import Language.PureScript.AST.Literals (Literal (..)) import Language.PureScript.AST.Traversals (everywhereOnValuesM) +import Language.PureScript.Constants.Prim qualified as C import Language.PureScript.Crash (internalError) -import Language.PureScript.Environment (DataDeclType, Environment(..), TypeKind(..)) -import Language.PureScript.Errors (MultipleErrors, pattern NullSourceAnn, SimpleErrorMessage(..), SourceSpan, errorMessage') +import Language.PureScript.Environment (DataDeclType, Environment (..), TypeKind (..)) +import Language.PureScript.Errors (MultipleErrors, SimpleErrorMessage (..), SourceSpan, errorMessage', pattern NullSourceAnn) import Language.PureScript.Names as P import Language.PureScript.Pretty.Values (prettyPrintBinderAtom) import Language.PureScript.Types as P -import Language.PureScript.Constants.Prim qualified as C --- | There are two modes of failure for the redundancy check: --- --- 1. Exhaustivity was incomplete due to too many cases, so we couldn't determine redundancy. --- 2. We didn't attempt to determine redundancy for a binder, e.g. an integer binder. --- --- We want to warn the user in the first case. +{- | There are two modes of failure for the redundancy check: + +1. Exhaustivity was incomplete due to too many cases, so we couldn't determine redundancy. +2. We didn't attempt to determine redundancy for a binder, e.g. an integer binder. + +We want to warn the user in the first case. +-} data RedundancyError = Incomplete | Unknown --- | --- Qualifies a propername from a given qualified propername and a default module name --- -qualifyName - :: ProperName a - -> ModuleName - -> Qualified (ProperName b) - -> Qualified (ProperName a) +{- | +Qualifies a propername from a given qualified propername and a default module name +-} +qualifyName :: + ProperName a -> + ModuleName -> + Qualified (ProperName b) -> + Qualified (ProperName a) qualifyName n defmn qn = Qualified (ByModuleName mn) n where - (mn, _) = qualify defmn qn - --- | --- Given an environment and a datatype or newtype name, --- this function returns the associated data constructors if it is the case of a datatype --- where: - ProperName is the name of the constructor (for example, "Nothing" in Maybe) --- - [Type] is the list of arguments, if it has (for example, "Just" has [TypeVar "a"]) --- + (mn, _) = qualify defmn qn + +{- | +Given an environment and a datatype or newtype name, +this function returns the associated data constructors if it is the case of a datatype +where: - ProperName is the name of the constructor (for example, "Nothing" in Maybe) + - [Type] is the list of arguments, if it has (for example, "Just" has [TypeVar "a"]) +-} getConstructors :: Environment -> ModuleName -> Qualified (ProperName 'ConstructorName) -> [(ProperName 'ConstructorName, [SourceType])] getConstructors env defmn n = extractConstructors lnte where + extractConstructors :: Maybe (SourceType, TypeKind) -> [(ProperName 'ConstructorName, [SourceType])] + extractConstructors (Just (_, DataType _ _ pt)) = pt + extractConstructors _ = internalError "Data name not in the scope of the current environment in extractConstructors" - extractConstructors :: Maybe (SourceType, TypeKind) -> [(ProperName 'ConstructorName, [SourceType])] - extractConstructors (Just (_, DataType _ _ pt)) = pt - extractConstructors _ = internalError "Data name not in the scope of the current environment in extractConstructors" + lnte :: Maybe (SourceType, TypeKind) + lnte = M.lookup qpn (types env) - lnte :: Maybe (SourceType, TypeKind) - lnte = M.lookup qpn (types env) + qpn :: Qualified (ProperName 'TypeName) + qpn = getConsDataName n - qpn :: Qualified (ProperName 'TypeName) - qpn = getConsDataName n + getConsDataName :: Qualified (ProperName 'ConstructorName) -> Qualified (ProperName 'TypeName) + getConsDataName con = + case getConsInfo con of + Nothing -> internalError $ "Constructor " ++ T.unpack (showQualified runProperName con) ++ " not in the scope of the current environment in getConsDataName." + Just (_, pm, _, _) -> qualifyName pm defmn con - getConsDataName :: Qualified (ProperName 'ConstructorName) -> Qualified (ProperName 'TypeName) - getConsDataName con = - case getConsInfo con of - Nothing -> internalError $ "Constructor " ++ T.unpack (showQualified runProperName con) ++ " not in the scope of the current environment in getConsDataName." - Just (_, pm, _, _) -> qualifyName pm defmn con + getConsInfo :: Qualified (ProperName 'ConstructorName) -> Maybe (DataDeclType, ProperName 'TypeName, SourceType, [Ident]) + getConsInfo con = M.lookup con (dataConstructors env) - getConsInfo :: Qualified (ProperName 'ConstructorName) -> Maybe (DataDeclType, ProperName 'TypeName, SourceType, [Ident]) - getConsInfo con = M.lookup con (dataConstructors env) - --- | --- Replicates a wildcard binder --- +{- | +Replicates a wildcard binder +-} initialize :: Int -> [Binder] initialize l = replicate l NullBinder --- | --- Applies a function over two lists of tuples that may lack elements --- -genericMerge :: Ord a => +{- | +Applies a function over two lists of tuples that may lack elements +-} +genericMerge :: + (Ord a) => (a -> Maybe b -> Maybe c -> d) -> [(a, b)] -> [(a, c)] -> @@ -99,15 +100,15 @@ genericMerge :: Ord a => genericMerge _ [] [] = [] genericMerge f bs [] = map (\(s, b) -> f s (Just b) Nothing) bs genericMerge f [] bs = map (\(s, b) -> f s Nothing (Just b)) bs -genericMerge f bsl@((s, b):bs) bsr@((s', b'):bs') +genericMerge f bsl@((s, b) : bs) bsr@((s', b') : bs') | s < s' = f s (Just b) Nothing : genericMerge f bs bsr | s > s' = f s' Nothing (Just b') : genericMerge f bsl bs' | otherwise = f s (Just b) (Just b') : genericMerge f bs bs' --- | --- Find the uncovered set between two binders: --- the first binder is the case we are trying to cover, the second one is the matching binder --- +{- | +Find the uncovered set between two binders: +the first binder is the case we are trying to cover, the second one is the matching binder +-} missingCasesSingle :: Environment -> ModuleName -> Binder -> Binder -> ([Binder], Either RedundancyError Bool) missingCasesSingle _ _ _ NullBinder = ([], return True) missingCasesSingle _ _ _ (VarBinder _ _) = ([], return True) @@ -116,33 +117,34 @@ missingCasesSingle env mn br (NamedBinder _ _ bl) = missingCasesSingle env mn br missingCasesSingle env mn NullBinder cb@(ConstructorBinder ss con _) = (concatMap (\cp -> fst $ missingCasesSingle env mn cp cb) allPatterns, return True) where - allPatterns = map (\(p, t) -> ConstructorBinder ss (qualifyName p mn con) (initialize $ length t)) - $ getConstructors env mn con + allPatterns = + map (\(p, t) -> ConstructorBinder ss (qualifyName p mn con) (initialize $ length t)) $ + getConstructors env mn con missingCasesSingle env mn cb@(ConstructorBinder ss con bs) (ConstructorBinder _ con' bs') | con == con' = let (bs'', pr) = missingCasesMultiple env mn bs bs' in (map (ConstructorBinder ss con) bs'', pr) | otherwise = ([cb], return False) missingCasesSingle env mn NullBinder (LiteralBinder ss (ObjectLiteral bs)) = (map (LiteralBinder ss . ObjectLiteral . zip (map fst bs)) allMisses, pr) where - (allMisses, pr) = missingCasesMultiple env mn (initialize $ length bs) (map snd bs) + (allMisses, pr) = missingCasesMultiple env mn (initialize $ length bs) (map snd bs) missingCasesSingle env mn (LiteralBinder _ (ObjectLiteral bs)) (LiteralBinder ss (ObjectLiteral bs')) = (map (LiteralBinder ss . ObjectLiteral . zip sortedNames) allMisses, pr) where - (allMisses, pr) = uncurry (missingCasesMultiple env mn) (unzip binders) + (allMisses, pr) = uncurry (missingCasesMultiple env mn) (unzip binders) - sortNames = sortOn fst + sortNames = sortOn fst - (sbs, sbs') = (sortNames bs, sortNames bs') + (sbs, sbs') = (sortNames bs, sortNames bs') - compB :: a -> Maybe a -> Maybe a -> (a, a) - compB e b b' = (fm b, fm b') - where - fm = fromMaybe e + compB :: a -> Maybe a -> Maybe a -> (a, a) + compB e b b' = (fm b, fm b') + where + fm = fromMaybe e - compBS :: b -> a -> Maybe b -> Maybe b -> (a, (b, b)) - compBS e s b b' = (s, compB e b b') + compBS :: b -> a -> Maybe b -> Maybe b -> (a, (b, b)) + compBS e s b b' = (s, compB e b b') - (sortedNames, binders) = unzip $ genericMerge (compBS NullBinder) sbs sbs' + (sortedNames, binders) = unzip $ genericMerge (compBS NullBinder) sbs sbs' missingCasesSingle _ _ NullBinder (LiteralBinder ss (BooleanLiteral b)) = ([LiteralBinder ss . BooleanLiteral $ not b], return True) missingCasesSingle _ _ (LiteralBinder ss (BooleanLiteral bl)) (LiteralBinder _ (BooleanLiteral br)) | bl == br = ([], return True) @@ -151,73 +153,73 @@ missingCasesSingle env mn b (PositionedBinder _ _ cb) = missingCasesSingle env m missingCasesSingle env mn b (TypedBinder _ cb) = missingCasesSingle env mn b cb missingCasesSingle _ _ b _ = ([b], Left Unknown) --- | --- Returns the uncovered set of binders --- the first argument is the list of uncovered binders at step i --- the second argument is the (i+1)th clause of a pattern matching definition --- --- The idea of the algorithm is as follows: --- it processes each binder of the two lists (say, `x` and `y`) one by one --- at each step two cases arises: --- - there are no missing cases between `x` and `y`: this is very straightforward, it continues with the remaining cases --- but keeps the uncovered binder in its position. --- - there are missing cases, let us call it the set `U`: on the one hand, we mix each new uncovered case in `U` --- with the current tail of uncovered set. On the other hand, it continues with the remaining cases: here we --- can use `x` (but it will generate overlapping cases), or `y`, which will generate non-overlapping cases. --- --- As an example, consider: --- --- data N = Z | S N --- f Z Z = Z --> {[S _, _], [Z, S _]} which are the right non-overlapping cases (GHC uses this). --- --- if we use `x` instead of `y` (in this case, `y` stands for `Z` and `x` for `_`) we obtain: --- f Z Z = Z --> {[S _, _], [_, S _]} you can see that both cases overlaps each other. --- --- Up to now, we've decided to use `x` just because we expect to generate uncovered cases which might be --- redundant or not, but uncovered at least. If we use `y` instead, we'll need to have a redundancy checker --- (which ought to be available soon), or increase the complexity of the algorithm. --- +{- | +Returns the uncovered set of binders +the first argument is the list of uncovered binders at step i +the second argument is the (i+1)th clause of a pattern matching definition + +The idea of the algorithm is as follows: +it processes each binder of the two lists (say, `x` and `y`) one by one +at each step two cases arises: + - there are no missing cases between `x` and `y`: this is very straightforward, it continues with the remaining cases + but keeps the uncovered binder in its position. + - there are missing cases, let us call it the set `U`: on the one hand, we mix each new uncovered case in `U` + with the current tail of uncovered set. On the other hand, it continues with the remaining cases: here we + can use `x` (but it will generate overlapping cases), or `y`, which will generate non-overlapping cases. + + As an example, consider: + + data N = Z | S N + f Z Z = Z --> {[S _, _], [Z, S _]} which are the right non-overlapping cases (GHC uses this). + + if we use `x` instead of `y` (in this case, `y` stands for `Z` and `x` for `_`) we obtain: + f Z Z = Z --> {[S _, _], [_, S _]} you can see that both cases overlaps each other. + + Up to now, we've decided to use `x` just because we expect to generate uncovered cases which might be + redundant or not, but uncovered at least. If we use `y` instead, we'll need to have a redundancy checker + (which ought to be available soon), or increase the complexity of the algorithm. +-} missingCasesMultiple :: Environment -> ModuleName -> [Binder] -> [Binder] -> ([[Binder]], Either RedundancyError Bool) missingCasesMultiple env mn = go where - go (x:xs) (y:ys) = (map (: xs) miss1 ++ map (x :) miss2, liftA2 (&&) pr1 pr2) - where - (miss1, pr1) = missingCasesSingle env mn x y - (miss2, pr2) = go xs ys - go _ _ = ([], pure True) - --- | --- Guard handling --- --- We say a guard is exhaustive iff it has an `otherwise` (or `true`) expression. --- Example: --- f x | x < 0 = 0 --- | otherwise = 1 --- is exhaustive, whereas `f x | x < 0` is not --- --- or in case of a pattern guard if the pattern is exhaustive. --- --- The function below say whether or not a guard has an `otherwise` expression --- It is considered that `otherwise` is defined in Prelude --- + go (x : xs) (y : ys) = (map (: xs) miss1 ++ map (x :) miss2, liftA2 (&&) pr1 pr2) + where + (miss1, pr1) = missingCasesSingle env mn x y + (miss2, pr2) = go xs ys + go _ _ = ([], pure True) + +{- | +Guard handling + +We say a guard is exhaustive iff it has an `otherwise` (or `true`) expression. +Example: + f x | x < 0 = 0 + | otherwise = 1 + is exhaustive, whereas `f x | x < 0` is not + +or in case of a pattern guard if the pattern is exhaustive. + +The function below say whether or not a guard has an `otherwise` expression +It is considered that `otherwise` is defined in Prelude +-} isExhaustiveGuard :: Environment -> ModuleName -> [GuardedExpr] -> Bool isExhaustiveGuard _ _ [MkUnguarded _] = True -isExhaustiveGuard env moduleName gs = +isExhaustiveGuard env moduleName gs = any (\(GuardedExpr grd _) -> isExhaustive grd) gs where isExhaustive :: [Guard] -> Bool isExhaustive = all checkGuard checkGuard :: Guard -> Bool - checkGuard (ConditionGuard cond) = isTrueExpr cond + checkGuard (ConditionGuard cond) = isTrueExpr cond checkGuard (PatternGuard binder _) = case missingCasesMultiple env moduleName [NullBinder] [binder] of ([], _) -> True -- there are no missing pattern for this guard - _ -> False + _ -> False --- | --- Returns the uncovered set of case alternatives --- +{- | +Returns the uncovered set of case alternatives +-} missingCases :: Environment -> ModuleName -> [Binder] -> CaseAlternative -> ([[Binder]], Either RedundancyError Bool) missingCases env mn uncovered ca = missingCasesMultiple env mn uncovered (caseAlternativeBinders ca) @@ -226,84 +228,89 @@ missingAlternative env mn ca uncovered | isExhaustiveGuard env mn (caseAlternativeResult ca) = mcases | otherwise = ([uncovered], snd mcases) where - mcases = missingCases env mn uncovered ca - --- | --- Main exhaustivity checking function --- Starting with the set `uncovered = { _ }` (nothing covered, one `_` for each function argument), --- it partitions that set with the new uncovered cases, until it consumes the whole set of clauses. --- Then, returns the uncovered set of case alternatives. --- -checkExhaustive - :: forall m - . MonadWriter MultipleErrors m - => SourceSpan - -> Environment - -> ModuleName - -> Int - -> [CaseAlternative] - -> Expr - -> m Expr + mcases = missingCases env mn uncovered ca + +{- | +Main exhaustivity checking function +Starting with the set `uncovered = { _ }` (nothing covered, one `_` for each function argument), +it partitions that set with the new uncovered cases, until it consumes the whole set of clauses. +Then, returns the uncovered set of case alternatives. +-} +checkExhaustive :: + forall m. + (MonadWriter MultipleErrors m) => + SourceSpan -> + Environment -> + ModuleName -> + Int -> + [CaseAlternative] -> + Expr -> + m Expr checkExhaustive ss env mn numArgs cas expr = makeResult . first ordNub $ foldl' step ([initialize numArgs], (pure True, [])) cas where - step :: ([[Binder]], (Either RedundancyError Bool, [[Binder]])) -> CaseAlternative -> ([[Binder]], (Either RedundancyError Bool, [[Binder]])) - step (uncovered, (nec, redundant)) ca = - let (missed, pr) = unzip (map (missingAlternative env mn ca) uncovered) - (missed', approx) = splitAt 10000 (ordNub (concat missed)) - cond = or <$> sequenceA pr - in (missed', ( if null approx - then liftA2 (&&) cond nec - else Left Incomplete - , if and cond - then redundant - else caseAlternativeBinders ca : redundant - ) - ) - - makeResult :: ([[Binder]], (Either RedundancyError Bool, [[Binder]])) -> m Expr - makeResult (bss, (rr, bss')) = - do unless (null bss') tellRedundant - case rr of - Left Incomplete -> tellIncomplete - _ -> return () - return $ if null bss - then expr - else addPartialConstraint (second null (splitAt 5 bss)) expr - where - tellRedundant = tell . errorMessage' ss . uncurry OverlappingPattern . second null . splitAt 5 $ bss' - tellIncomplete = tell . errorMessage' ss $ IncompleteExhaustivityCheck - - -- We add a Partial constraint by annotating the expression to have type `Partial => _`. - -- - -- The binder information is provided so that it can be embedded in the constraint, - -- and then included in the error message. - addPartialConstraint :: ([[Binder]], Bool) -> Expr -> Expr - addPartialConstraint (bss, complete) e = - TypedValue True e $ - srcConstrainedType (srcConstraint C.Partial [] [] (Just constraintData)) $ TypeWildcard NullSourceAnn IgnoredWildcard - where - constraintData :: ConstraintData - constraintData = - PartialConstraintData (map (map prettyPrintBinderAtom) bss) complete - --- | --- Exhaustivity checking --- -checkExhaustiveExpr - :: forall m - . MonadWriter MultipleErrors m - => SourceSpan - -> Environment - -> ModuleName - -> Expr - -> m Expr + step :: ([[Binder]], (Either RedundancyError Bool, [[Binder]])) -> CaseAlternative -> ([[Binder]], (Either RedundancyError Bool, [[Binder]])) + step (uncovered, (nec, redundant)) ca = + let (missed, pr) = unzip (map (missingAlternative env mn ca) uncovered) + (missed', approx) = splitAt 10000 (ordNub (concat missed)) + cond = or <$> sequenceA pr + in ( missed' + , + ( if null approx + then liftA2 (&&) cond nec + else Left Incomplete + , if and cond + then redundant + else caseAlternativeBinders ca : redundant + ) + ) + + makeResult :: ([[Binder]], (Either RedundancyError Bool, [[Binder]])) -> m Expr + makeResult (bss, (rr, bss')) = + do + unless (null bss') tellRedundant + case rr of + Left Incomplete -> tellIncomplete + _ -> return () + return $ + if null bss + then expr + else addPartialConstraint (second null (splitAt 5 bss)) expr + where + tellRedundant = tell . errorMessage' ss . uncurry OverlappingPattern . second null . splitAt 5 $ bss' + tellIncomplete = tell . errorMessage' ss $ IncompleteExhaustivityCheck + + -- We add a Partial constraint by annotating the expression to have type `Partial => _`. + -- + -- The binder information is provided so that it can be embedded in the constraint, + -- and then included in the error message. + addPartialConstraint :: ([[Binder]], Bool) -> Expr -> Expr + addPartialConstraint (bss, complete) e = + TypedValue True e $ + srcConstrainedType (srcConstraint C.Partial [] [] (Just constraintData)) $ + TypeWildcard NullSourceAnn IgnoredWildcard + where + constraintData :: ConstraintData + constraintData = + PartialConstraintData (map (map prettyPrintBinderAtom) bss) complete + +{- | +Exhaustivity checking +-} +checkExhaustiveExpr :: + forall m. + (MonadWriter MultipleErrors m) => + SourceSpan -> + Environment -> + ModuleName -> + Expr -> + m Expr checkExhaustiveExpr ss env mn = onExpr' where - (_, onExpr', _) = everywhereOnValuesM pure onExpr pure - - onExpr :: Expr -> m Expr - onExpr e = case e of - Case es cas -> - checkExhaustive ss env mn (length es) cas e - _ -> - pure e + (_, onExpr', _) = everywhereOnValuesM pure onExpr pure + + onExpr :: Expr -> m Expr + onExpr e = case e of + Case es cas -> + checkExhaustive ss env mn (length es) cas e + _ -> + pure e diff --git a/src/Language/PureScript/Linter/Imports.hs b/src/Language/PureScript/Linter/Imports.hs index e8a2eb0f2..fc5c5237a 100644 --- a/src/Language/PureScript/Linter/Imports.hs +++ b/src/Language/PureScript/Linter/Imports.hs @@ -1,65 +1,65 @@ -module Language.PureScript.Linter.Imports - ( lintImports - , Name(..) - , UsedImports() - ) where +module Language.PureScript.Linter.Imports ( + lintImports, + Name (..), + UsedImports (), +) where -import Prelude import Protolude (ordNub) +import Prelude -import Control.Monad (join, unless, foldM, (<=<)) -import Control.Monad.Writer.Class (MonadWriter(..)) +import Control.Monad (foldM, join, unless, (<=<)) +import Control.Monad.Writer.Class (MonadWriter (..)) -import Data.Function (on) import Data.Foldable (for_) -import Data.List (find, intersect, groupBy, sort, sortOn, (\\)) +import Data.Function (on) +import Data.List (find, groupBy, intersect, sort, sortOn, (\\)) +import Data.Map qualified as M import Data.Maybe (mapMaybe) -import Data.Monoid (Sum(..)) -import Data.Traversable (forM) +import Data.Monoid (Sum (..)) import Data.Text qualified as T -import Data.Map qualified as M +import Data.Traversable (forM) -import Language.PureScript.AST.Declarations (Declaration(..), DeclarationRef(..), ExportSource, ImportDeclarationType(..), Module(..), getTypeRef, isExplicit) +import Language.PureScript.AST.Declarations (Declaration (..), DeclarationRef (..), ExportSource, ImportDeclarationType (..), Module (..), getTypeRef, isExplicit) import Language.PureScript.AST.SourcePos (SourceSpan) +import Language.PureScript.Constants.Prim qualified as C +import Language.PureScript.Constants.Purus qualified as PLC import Language.PureScript.Crash (internalError) -import Language.PureScript.Errors (MultipleErrors, SimpleErrorMessage(..), errorMessage') +import Language.PureScript.Errors (MultipleErrors, SimpleErrorMessage (..), errorMessage') import Language.PureScript.Names import Language.PureScript.Sugar.Names.Common (warnDuplicateRefs) -import Language.PureScript.Sugar.Names.Env (Env, Exports(..), ImportRecord(..), Imports(..), envModuleExports, nullImports) +import Language.PureScript.Sugar.Names.Env (Env, Exports (..), ImportRecord (..), Imports (..), envModuleExports, nullImports) import Language.PureScript.Sugar.Names.Imports (ImportDef, findImports) -import Language.PureScript.Constants.Prim qualified as C --- | --- Map of module name to list of imported names from that module which have --- been used. --- +{- | +Map of module name to list of imported names from that module which have +been used. +-} type UsedImports = M.Map ModuleName [Qualified Name] --- | --- Find and warn on: --- --- * Unused import statements (qualified or unqualified) --- --- * Unused references in an explicit import list --- --- * Implicit imports of modules --- --- * Implicit imports into a virtual module (unless the virtual module only has --- members from one module imported) --- --- * Imports using `hiding` (this is another form of implicit importing) --- -lintImports - :: forall m - . MonadWriter MultipleErrors m - => Module - -> Env - -> UsedImports - -> m () +{- | +Find and warn on: + +* Unused import statements (qualified or unqualified) + +* Unused references in an explicit import list + +* Implicit imports of modules + +* Implicit imports into a virtual module (unless the virtual module only has + members from one module imported) + +* Imports using `hiding` (this is another form of implicit importing) +-} +lintImports :: + forall m. + (MonadWriter MultipleErrors m) => + Module -> + Env -> + UsedImports -> + m () lintImports (Module _ _ _ _ Nothing) _ _ = internalError "lintImports needs desugared exports" lintImports (Module _ _ mn mdecls (Just mexports)) env usedImps = do - -- TODO: this needs some work to be easier to understand let scope = maybe nullImports (\(_, imps', _) -> imps') (M.lookup mn env) @@ -69,8 +69,9 @@ lintImports (Module _ _ mn mdecls (Just mexports)) env usedImps = do imports = M.toAscList (findImports mdecls) for_ imports $ \(mni, decls) -> - unless (isPrim mni) . - for_ decls $ \(ss, declType, qualifierName) -> do + unless (isPrim mni) + . for_ decls + $ \(ss, declType, qualifierName) -> do let names = ordNub $ M.findWithDefault [] mni usedImps' lintImportDecl env mni qualifierName names ss declType allowImplicit @@ -81,21 +82,23 @@ lintImports (Module _ _ mn mdecls (Just mexports)) env usedImps = do for_ implicits $ \(ss, _, mni) -> do let names = ordNub $ M.findWithDefault [] mni usedImps' usedRefs = findUsedRefs ss env mni (Just mnq) names - unless (null usedRefs) . - tell . errorMessage' ss $ ImplicitQualifiedImport mni mnq $ map (simplifyTypeRef $ const True) usedRefs + unless (null usedRefs) + . tell + . errorMessage' ss + $ ImplicitQualifiedImport mni mnq + $ map (simplifyTypeRef $ const True) usedRefs for_ imports $ \(mnq, imps) -> do - warned <- foldM (checkDuplicateImports mnq) [] (selfCartesianSubset imps) let unwarned = imps \\ warned - duplicates - = join - . map tail - . filter ((> 1) . length) - . groupBy ((==) `on` defQual) - . sortOn defQual - $ unwarned + duplicates = + join + . map tail + . filter ((> 1) . length) + . groupBy ((==) `on` defQual) + . sortOn defQual + $ unwarned for_ duplicates $ \(pos, _, _) -> tell . errorMessage' pos $ DuplicateSelectiveImport mnq @@ -118,88 +121,85 @@ lintImports (Module _ _ mn mdecls (Just mexports)) env usedImps = do let names = ordNub $ M.findWithDefault [] mni usedImps' usedRefs = findUsedRefs ss env mni (Just mnq) names tell . errorMessage' ss $ - ImplicitQualifiedImportReExport mni mnq - $ map (simplifyTypeRef $ const True) usedRefs + ImplicitQualifiedImportReExport mni mnq $ + map (simplifyTypeRef $ const True) usedRefs _ -> pure () _ -> pure () - where - - defQual :: ImportDef -> Maybe ModuleName - defQual (_, _, q) = q - - selfCartesianSubset :: [a] -> [(a, a)] - selfCartesianSubset (x : xs) = [(x, y) | y <- xs] ++ selfCartesianSubset xs - selfCartesianSubset [] = [] - - countOpenImports :: Declaration -> Int - countOpenImports (ImportDeclaration _ mn' Implicit Nothing) - | not (isPrim mn' || mn == mn') = 1 - countOpenImports (ImportDeclaration _ mn' (Hiding _) Nothing) - | not (isPrim mn' || mn == mn') = 1 - countOpenImports _ = 0 - - -- Checks whether a module is the Prim module - used to suppress any checks - -- made, as Prim is always implicitly imported. - isPrim :: ModuleName -> Bool - isPrim = (== C.M_Prim) - - -- Creates a map of virtual modules mapped to all the declarations that - -- import to that module, with the corresponding source span, import type, - -- and module being imported - byQual - :: [(ModuleName, [(SourceSpan, ImportDeclarationType, Maybe ModuleName)])] - -> M.Map ModuleName [(SourceSpan, ImportDeclarationType, ModuleName)] - byQual = foldr goImp M.empty - where - goImp (mni, xs) acc = foldr (goDecl mni) acc xs - goDecl mni (ss', declType, Just qmn) acc = - let entry = (ss', declType, mni) - in M.alter (Just . maybe [entry] (entry :)) qmn acc - goDecl _ _ acc = acc - - -- The list of modules that are being re-exported by the current module. Any - -- module that appears in this list is always considered to be used. - exportedModules :: [ModuleName] - exportedModules = ordNub $ mapMaybe extractModule mexports - where - extractModule (ModuleRef _ mne) = Just mne - extractModule _ = Nothing - - -- Elaborates the UsedImports to include values from modules that are being - -- re-exported. This ensures explicit export hints are printed for modules - -- that are implicitly exported and then re-exported. - elaborateUsed :: Imports -> ModuleName -> UsedImports -> UsedImports - elaborateUsed scope mne used = - foldr go used - $ extractByQual mne (importedTypeClasses scope) TyClassName - ++ extractByQual mne (importedTypeOps scope) TyOpName - ++ extractByQual mne (importedTypes scope) TyName - ++ extractByQual mne (importedDataConstructors scope) DctorName - ++ extractByQual mne (importedValues scope) IdentName - ++ extractByQual mne (importedValueOps scope) ValOpName - where - go :: (ModuleName, Qualified Name) -> UsedImports -> UsedImports - go (q, name) = M.alter (Just . maybe [name] (name :)) q - - extractByQual - :: ModuleName - -> M.Map (Qualified a) [ImportRecord a] - -> (a -> Name) - -> [(ModuleName, Qualified Name)] - extractByQual k m toName = mapMaybe go (M.toList m) - where - go (q@(Qualified mnq _), is) - | isUnqualified q = - case find (isQualifiedWith k) (map importName is) of - Just (Qualified _ name) -> Just (k, Qualified mnq (toName name)) - _ -> Nothing - | isQualifiedWith k q = - case importName (head is) of - Qualified (ByModuleName mn') name -> Just (mn', Qualified mnq (toName name)) - _ -> internalError "unqualified name in extractByQual" - go _ = Nothing - + defQual :: ImportDef -> Maybe ModuleName + defQual (_, _, q) = q + + selfCartesianSubset :: [a] -> [(a, a)] + selfCartesianSubset (x : xs) = [(x, y) | y <- xs] ++ selfCartesianSubset xs + selfCartesianSubset [] = [] + + countOpenImports :: Declaration -> Int + countOpenImports (ImportDeclaration _ mn' Implicit Nothing) + | not (isPrim mn' || mn == mn') = 1 + countOpenImports (ImportDeclaration _ mn' (Hiding _) Nothing) + | not (isPrim mn' || mn == mn') = 1 + countOpenImports _ = 0 + + -- Checks whether a module is the Prim module - used to suppress any checks + -- made, as Prim is always implicitly imported. + isPrim :: ModuleName -> Bool + isPrim mx = (mx == C.M_Prim) || mx == PLC.M_Builtin + + -- Creates a map of virtual modules mapped to all the declarations that + -- import to that module, with the corresponding source span, import type, + -- and module being imported + byQual :: + [(ModuleName, [(SourceSpan, ImportDeclarationType, Maybe ModuleName)])] -> + M.Map ModuleName [(SourceSpan, ImportDeclarationType, ModuleName)] + byQual = foldr goImp M.empty + where + goImp (mni, xs) acc = foldr (goDecl mni) acc xs + goDecl mni (ss', declType, Just qmn) acc = + let entry = (ss', declType, mni) + in M.alter (Just . maybe [entry] (entry :)) qmn acc + goDecl _ _ acc = acc + + -- The list of modules that are being re-exported by the current module. Any + -- module that appears in this list is always considered to be used. + exportedModules :: [ModuleName] + exportedModules = ordNub $ mapMaybe extractModule mexports + where + extractModule (ModuleRef _ mne) = Just mne + extractModule _ = Nothing + + -- Elaborates the UsedImports to include values from modules that are being + -- re-exported. This ensures explicit export hints are printed for modules + -- that are implicitly exported and then re-exported. + elaborateUsed :: Imports -> ModuleName -> UsedImports -> UsedImports + elaborateUsed scope mne used = + foldr go used $ + extractByQual mne (importedTypeClasses scope) TyClassName + ++ extractByQual mne (importedTypeOps scope) TyOpName + ++ extractByQual mne (importedTypes scope) TyName + ++ extractByQual mne (importedDataConstructors scope) DctorName + ++ extractByQual mne (importedValues scope) IdentName + ++ extractByQual mne (importedValueOps scope) ValOpName + where + go :: (ModuleName, Qualified Name) -> UsedImports -> UsedImports + go (q, name) = M.alter (Just . maybe [name] (name :)) q + + extractByQual :: + ModuleName -> + M.Map (Qualified a) [ImportRecord a] -> + (a -> Name) -> + [(ModuleName, Qualified Name)] + extractByQual k m toName = mapMaybe go (M.toList m) + where + go (q@(Qualified mnq _), is) + | isUnqualified q = + case find (isQualifiedWith k) (map importName is) of + Just (Qualified _ name) -> Just (k, Qualified mnq (toName name)) + _ -> Nothing + | isQualifiedWith k q = + case importName (head is) of + Qualified (ByModuleName mn') name -> Just (mn', Qualified mnq (toName name)) + _ -> internalError "unqualified name in extractByQual" + go _ = Nothing -- Replace explicit type refs with data constructor lists from listing the -- used constructors explicitly `T(X, Y, [...])` to `T(..)` for suggestion @@ -211,116 +211,113 @@ simplifyTypeRef shouldOpen (TypeRef ss name (Just dctors)) | not (null dctors) && shouldOpen name = TypeRef ss name Nothing simplifyTypeRef _ other = other -lintImportDecl - :: forall m - . MonadWriter MultipleErrors m - => Env - -> ModuleName - -> Maybe ModuleName - -> [Qualified Name] - -> SourceSpan - -> ImportDeclarationType - -> Bool - -> m Bool +lintImportDecl :: + forall m. + (MonadWriter MultipleErrors m) => + Env -> + ModuleName -> + Maybe ModuleName -> + [Qualified Name] -> + SourceSpan -> + ImportDeclarationType -> + Bool -> + m Bool lintImportDecl env mni qualifierName names ss declType allowImplicit = case declType of Implicit -> case qualifierName of Nothing -> if null allRefs - then unused - else unless' allowImplicit (checkImplicit ImplicitImport) + then unused + else unless' allowImplicit (checkImplicit ImplicitImport) Just q -> unless' (q `elem` mapMaybe getQual names) unused Hiding _ -> unless' allowImplicit (checkImplicit HidingImport) Explicit [] -> unused Explicit declrefs -> checkExplicit declrefs - where - - checkImplicit - :: (ModuleName -> [DeclarationRef] -> SimpleErrorMessage) - -> m Bool - checkImplicit warning = - if null allRefs - then unused - else warn (warning mni (map (simplifyTypeRef $ const True) allRefs)) - - checkExplicit - :: [DeclarationRef] - -> m Bool - checkExplicit declrefs = do - let idents = ordNub (mapMaybe runDeclRef declrefs) - dctors = mapMaybe (getDctorName <=< disqualifyFor qualifierName) names - usedNames = mapMaybe (matchName (typeForDCtor mni) <=< disqualifyFor qualifierName) names - diff = idents \\ usedNames - - didWarn <- case (length diff, length idents) of - (0, _) -> return False - (n, m) | n == m -> unused - _ -> warn (UnusedExplicitImport mni diff qualifierName $ map simplifyTypeRef' allRefs) - - didWarn' <- forM (mapMaybe getTypeRef declrefs) $ \(tn, c) -> do - let allCtors = dctorsForType mni tn - -- If we've not already warned a type is unused, check its data constructors - unless' (TyName tn `notElem` usedNames) $ - case (c, dctors `intersect` allCtors) of - (_, []) | c /= Just [] -> warn (UnusedDctorImport mni tn qualifierName $ map simplifyTypeRef' allRefs) - (Just ctors, dctors') -> - let ddiff = ctors \\ dctors' - in unless' (null ddiff) . warn $ UnusedDctorExplicitImport mni tn ddiff qualifierName $ map simplifyTypeRef' allRefs - _ -> return False - - return (didWarn || or didWarn') - - where - simplifyTypeRef' :: DeclarationRef -> DeclarationRef - simplifyTypeRef' = simplifyTypeRef (\name -> any (isMatch name) declrefs) - where - isMatch name (TypeRef _ name' Nothing) = name == name' - isMatch _ _ = False - - unused :: m Bool - unused = warn (UnusedImport mni qualifierName) - - warn :: SimpleErrorMessage -> m Bool - warn err = tell (errorMessage' ss err) >> return True - - -- Unless the boolean is true, run the action. Return false when the action is - -- not run, otherwise return whatever the action does. - -- - -- The return value is intended for cases where we want to track whether some - -- work was done, as there may be further conditions in the action that mean - -- it ends up doing nothing. - unless' :: Bool -> m Bool -> m Bool - unless' False m = m - unless' True _ = return False - - allRefs :: [DeclarationRef] - allRefs = findUsedRefs ss env mni qualifierName names - - dtys - :: ModuleName - -> M.Map (ProperName 'TypeName) ([ProperName 'ConstructorName], ExportSource) - dtys mn = foldMap (exportedTypes . envModuleExports) $ mn `M.lookup` env - - dctorsForType - :: ModuleName - -> ProperName 'TypeName - -> [ProperName 'ConstructorName] - dctorsForType mn tn = maybe [] fst $ tn `M.lookup` dtys mn - - typeForDCtor - :: ModuleName - -> ProperName 'ConstructorName - -> Maybe (ProperName 'TypeName) - typeForDCtor mn pn = fst <$> find (elem pn . fst . snd) (M.toList (dtys mn)) - -findUsedRefs - :: SourceSpan - -> Env - -> ModuleName - -> Maybe ModuleName - -> [Qualified Name] - -> [DeclarationRef] + checkImplicit :: + (ModuleName -> [DeclarationRef] -> SimpleErrorMessage) -> + m Bool + checkImplicit warning = + if null allRefs + then unused + else warn (warning mni (map (simplifyTypeRef $ const True) allRefs)) + + checkExplicit :: + [DeclarationRef] -> + m Bool + checkExplicit declrefs = do + let idents = ordNub (mapMaybe runDeclRef declrefs) + dctors = mapMaybe (getDctorName <=< disqualifyFor qualifierName) names + usedNames = mapMaybe (matchName (typeForDCtor mni) <=< disqualifyFor qualifierName) names + diff = idents \\ usedNames + + didWarn <- case (length diff, length idents) of + (0, _) -> return False + (n, m) | n == m -> unused + _ -> warn (UnusedExplicitImport mni diff qualifierName $ map simplifyTypeRef' allRefs) + + didWarn' <- forM (mapMaybe getTypeRef declrefs) $ \(tn, c) -> do + let allCtors = dctorsForType mni tn + -- If we've not already warned a type is unused, check its data constructors + unless' (TyName tn `notElem` usedNames) $ + case (c, dctors `intersect` allCtors) of + (_, []) | c /= Just [] -> warn (UnusedDctorImport mni tn qualifierName $ map simplifyTypeRef' allRefs) + (Just ctors, dctors') -> + let ddiff = ctors \\ dctors' + in unless' (null ddiff) . warn $ UnusedDctorExplicitImport mni tn ddiff qualifierName $ map simplifyTypeRef' allRefs + _ -> return False + + return (didWarn || or didWarn') + where + simplifyTypeRef' :: DeclarationRef -> DeclarationRef + simplifyTypeRef' = simplifyTypeRef (\name -> any (isMatch name) declrefs) + where + isMatch name (TypeRef _ name' Nothing) = name == name' + isMatch _ _ = False + + unused :: m Bool + unused = warn (UnusedImport mni qualifierName) + + warn :: SimpleErrorMessage -> m Bool + warn err = tell (errorMessage' ss err) >> return True + + -- Unless the boolean is true, run the action. Return false when the action is + -- not run, otherwise return whatever the action does. + -- + -- The return value is intended for cases where we want to track whether some + -- work was done, as there may be further conditions in the action that mean + -- it ends up doing nothing. + unless' :: Bool -> m Bool -> m Bool + unless' False m = m + unless' True _ = return False + + allRefs :: [DeclarationRef] + allRefs = findUsedRefs ss env mni qualifierName names + + dtys :: + ModuleName -> + M.Map (ProperName 'TypeName) ([ProperName 'ConstructorName], ExportSource) + dtys mn = foldMap (exportedTypes . envModuleExports) $ mn `M.lookup` env + + dctorsForType :: + ModuleName -> + ProperName 'TypeName -> + [ProperName 'ConstructorName] + dctorsForType mn tn = maybe [] fst $ tn `M.lookup` dtys mn + + typeForDCtor :: + ModuleName -> + ProperName 'ConstructorName -> + Maybe (ProperName 'TypeName) + typeForDCtor mn pn = fst <$> find (elem pn . fst . snd) (M.toList (dtys mn)) + +findUsedRefs :: + SourceSpan -> + Env -> + ModuleName -> + Maybe ModuleName -> + [Qualified Name] -> + [DeclarationRef] findUsedRefs ss env mni qn names = let classRefs = TypeClassRef ss <$> mapMaybe (getClassName <=< disqualifyFor qn) names @@ -331,39 +328,38 @@ findUsedRefs ss env mni qn names = dctors = mapMaybe (getDctorName <=< disqualifyFor qn) names typesWithDctors = reconstructTypeRefs dctors typesWithoutDctors = filter (`M.notMember` typesWithDctors) types - typesRefs - = map (flip (TypeRef ss) (Just [])) typesWithoutDctors - ++ map (\(ty, ds) -> TypeRef ss ty (Just ds)) (M.toList typesWithDctors) - in sort $ classRefs ++ typeOpRefs ++ typesRefs ++ valueRefs ++ valueOpRefs - + typesRefs = + map (flip (TypeRef ss) (Just [])) typesWithoutDctors + ++ map (\(ty, ds) -> TypeRef ss ty (Just ds)) (M.toList typesWithDctors) + in + sort $ classRefs ++ typeOpRefs ++ typesRefs ++ valueRefs ++ valueOpRefs where - - reconstructTypeRefs - :: [ProperName 'ConstructorName] - -> M.Map (ProperName 'TypeName) [ProperName 'ConstructorName] - reconstructTypeRefs = foldr accumDctors M.empty - where - accumDctors dctor = - M.alter (Just . maybe [dctor] (dctor :)) (findTypeForDctor mni dctor) - - findTypeForDctor - :: ModuleName - -> ProperName 'ConstructorName - -> ProperName 'TypeName - findTypeForDctor mn dctor = - case mn `M.lookup` env of - Just (_, _, exps) -> - case find (elem dctor . fst . snd) (M.toList (exportedTypes exps)) of - Just (ty, _) -> ty - Nothing -> internalError $ "missing type for data constructor " ++ T.unpack (runProperName dctor) ++ " in findTypeForDctor" - Nothing -> internalError $ "missing module " ++ T.unpack (runModuleName mn) ++ " in findTypeForDctor" - -matchName - :: (ProperName 'ConstructorName -> Maybe (ProperName 'TypeName)) - -> Name - -> Maybe Name + reconstructTypeRefs :: + [ProperName 'ConstructorName] -> + M.Map (ProperName 'TypeName) [ProperName 'ConstructorName] + reconstructTypeRefs = foldr accumDctors M.empty + where + accumDctors dctor = + M.alter (Just . maybe [dctor] (dctor :)) (findTypeForDctor mni dctor) + + findTypeForDctor :: + ModuleName -> + ProperName 'ConstructorName -> + ProperName 'TypeName + findTypeForDctor mn dctor = + case mn `M.lookup` env of + Just (_, _, exps) -> + case find (elem dctor . fst . snd) (M.toList (exportedTypes exps)) of + Just (ty, _) -> ty + Nothing -> internalError $ "missing type for data constructor " ++ T.unpack (runProperName dctor) ++ " in findTypeForDctor" + Nothing -> internalError $ "missing module " ++ T.unpack (runModuleName mn) ++ " in findTypeForDctor" + +matchName :: + (ProperName 'ConstructorName -> Maybe (ProperName 'TypeName)) -> + Name -> + Maybe Name matchName lookupDc (DctorName x) = TyName <$> lookupDc x -matchName _ ModName{} = Nothing +matchName _ ModName {} = Nothing matchName _ name = Just name runDeclRef :: DeclarationRef -> Maybe Name @@ -374,15 +370,15 @@ runDeclRef (TypeOpRef _ op) = Just $ TyOpName op runDeclRef (TypeClassRef _ pn) = Just $ TyClassName pn runDeclRef _ = Nothing -checkDuplicateImports - :: MonadWriter MultipleErrors m - => ModuleName - -> [ImportDef] - -> (ImportDef, ImportDef) - -> m [ImportDef] +checkDuplicateImports :: + (MonadWriter MultipleErrors m) => + ModuleName -> + [ImportDef] -> + (ImportDef, ImportDef) -> + m [ImportDef] checkDuplicateImports mn xs ((_, t1, q1), (pos, t2, q2)) = if t1 == t2 && q1 == q2 - then do - tell . errorMessage' pos $ DuplicateImport mn t2 q2 - return $ (pos, t2, q2) : xs - else return xs + then do + tell . errorMessage' pos $ DuplicateImport mn t2 q2 + return $ (pos, t2, q2) : xs + else return xs diff --git a/src/Language/PureScript/Linter/Wildcards.hs b/src/Language/PureScript/Linter/Wildcards.hs index a8b5fcf23..a76e36eb1 100644 --- a/src/Language/PureScript/Linter/Wildcards.hs +++ b/src/Language/PureScript/Linter/Wildcards.hs @@ -1,40 +1,40 @@ -module Language.PureScript.Linter.Wildcards - ( ignoreWildcardsUnderCompleteTypeSignatures - ) where +module Language.PureScript.Linter.Wildcards ( + ignoreWildcardsUnderCompleteTypeSignatures, +) where import Protolude hiding (Type) -import Language.PureScript.AST (Binder(..), Declaration, Expr(..), everywhereWithContextOnValues) -import Language.PureScript.Types (Type(..), WildcardData(..), everythingOnTypes, everywhereOnTypes) - --- | --- Replaces `TypeWildcard _ UnnamedWildcard` with --- `TypeWildcard _ IgnoredWildcard` in places where we don't want to emit a --- warning about wildcards. --- --- The guiding principle here is that a wildcard can be ignored if there is a --- complete (wildcard-free) type signature on a binding somewhere between the --- type in which the wildcard occurs and the top level of the module. In --- particular, this means that top-level signatures containing wildcards are --- always warnings, and a top-level signature always prevents wildcards on --- inner bindings from emitting warnings. --- +import Language.PureScript.AST (Binder (..), Declaration, Expr (..), everywhereWithContextOnValues) +import Language.PureScript.Types (Type (..), WildcardData (..), everythingOnTypes, everywhereOnTypes) + +{- | +Replaces `TypeWildcard _ UnnamedWildcard` with +`TypeWildcard _ IgnoredWildcard` in places where we don't want to emit a +warning about wildcards. + +The guiding principle here is that a wildcard can be ignored if there is a +complete (wildcard-free) type signature on a binding somewhere between the +type in which the wildcard occurs and the top level of the module. In +particular, this means that top-level signatures containing wildcards are +always warnings, and a top-level signature always prevents wildcards on +inner bindings from emitting warnings. +-} ignoreWildcardsUnderCompleteTypeSignatures :: Declaration -> Declaration ignoreWildcardsUnderCompleteTypeSignatures = onDecl where - (onDecl, _, _, _, _, _) = everywhereWithContextOnValues False (,) handleExpr handleBinder (,) (,) (,) + (onDecl, _, _, _, _, _) = everywhereWithContextOnValues False (,) handleExpr handleBinder (,) (,) (,) - handleExpr isCovered = \case - tv@(TypedValue chk v ty) - | isCovered -> (True, TypedValue chk v $ ignoreWildcards ty) - | otherwise -> (isComplete ty, tv) - other -> (isCovered, other) + handleExpr isCovered = \case + tv@(TypedValue chk v ty) + | isCovered -> (True, TypedValue chk v $ ignoreWildcards ty) + | otherwise -> (isComplete ty, tv) + other -> (isCovered, other) - handleBinder isCovered = \case - tb@(TypedBinder ty b) - | isCovered -> (True, TypedBinder (ignoreWildcards ty) b) - | otherwise -> (isComplete ty, tb) - other -> (isCovered, other) + handleBinder isCovered = \case + tb@(TypedBinder ty b) + | isCovered -> (True, TypedBinder (ignoreWildcards ty) b) + | otherwise -> (isComplete ty, tb) + other -> (isCovered, other) ignoreWildcards :: Type a -> Type a ignoreWildcards = everywhereOnTypes $ \case @@ -43,5 +43,5 @@ ignoreWildcards = everywhereOnTypes $ \case isComplete :: Type a -> Bool isComplete = everythingOnTypes (&&) $ \case - TypeWildcard{} -> False + TypeWildcard {} -> False _ -> True diff --git a/src/Language/PureScript/Make.hs b/src/Language/PureScript/Make.hs index 8340d77ca..fc3b5ca01 100644 --- a/src/Language/PureScript/Make.hs +++ b/src/Language/PureScript/Make.hs @@ -1,106 +1,124 @@ -module Language.PureScript.Make - ( +module Language.PureScript.Make ( -- * Make API - rebuildModule - , rebuildModule' - , make - , inferForeignModules - , module Monad - , module Actions - ) where + rebuildModule, + rebuildModule', + make, + inferForeignModules, + module Monad, + module Actions, +) where import Prelude import Control.Concurrent.Lifted as C import Control.Exception.Base (onException) import Control.Monad (foldM, unless, when) -import Control.Monad.Error.Class (MonadError(..)) -import Control.Monad.IO.Class (MonadIO(..)) +import Control.Monad.Error.Class (MonadError (..)) +import Control.Monad.IO.Class (MonadIO (..)) import Control.Monad.Supply (evalSupplyT, runSupply, runSupplyT) -import Control.Monad.Trans.Control (MonadBaseControl(..), control) +import Control.Monad.Trans.Control (MonadBaseControl (..), control) import Control.Monad.Trans.State (runStateT) -import Control.Monad.Writer.Class (MonadWriter(..), censor) +import Control.Monad.Writer.Class (MonadWriter (..), censor) import Control.Monad.Writer.Strict (runWriterT) -import Data.Function (on) import Data.Foldable (fold, for_) +import Data.Function (on) import Data.List (foldl', sortOn) import Data.List.NonEmpty qualified as NEL -import Data.Maybe (fromMaybe) import Data.Map qualified as M +import Data.Maybe (fromMaybe) import Data.Set qualified as S import Data.Text qualified as T -import Language.PureScript.AST (ErrorMessageHint(..), Module(..), SourceSpan(..), getModuleName, getModuleSourceSpan, importPrim) -import Language.PureScript.Crash (internalError) +import Language.PureScript.AST (ErrorMessageHint (..), Module (..), SourceSpan (..), getModuleName, getModuleSourceSpan, importPrim) import Language.PureScript.CST qualified as CST +import Language.PureScript.CoreFn qualified as CF +import Language.PureScript.CoreFn qualified as CFT +import Language.PureScript.Crash (internalError) import Language.PureScript.Docs.Convert qualified as Docs -import Language.PureScript.Environment (initEnvironment) -import Language.PureScript.Errors (MultipleErrors, SimpleErrorMessage(..), addHint, defaultPPEOptions, errorMessage', errorMessage'', prettyPrintMultipleErrors) +import Language.PureScript.Environment (Environment (..), initEnvironment) +import Language.PureScript.Errors (MultipleErrors, SimpleErrorMessage (..), addHint, defaultPPEOptions, errorMessage', errorMessage'', prettyPrintMultipleErrors) import Language.PureScript.Externs (ExternsFile, applyExternsFileToEnvironment, moduleToExternsFile) -import Language.PureScript.Linter (Name(..), lint, lintImports) -import Language.PureScript.ModuleDependencies (DependencyDepth(..), moduleSignature, sortModules) -import Language.PureScript.Names (ModuleName, isBuiltinModuleName, runModuleName) -import Language.PureScript.Renamer (renameInModule) -import Language.PureScript.Sugar (Env, collapseBindingGroups, createBindingGroups, desugar, desugarCaseGuards, externsEnv, primEnv) -import Language.PureScript.TypeChecker (CheckState(..), emptyCheckState, typeCheckModule) -import Language.PureScript.Make.BuildPlan (BuildJobResult(..), BuildPlan(..), getResult) +import Language.PureScript.Linter (Name (..), lint, lintImports) +import Language.PureScript.Make.Actions as Actions +import Language.PureScript.Make.BuildPlan (BuildJobResult (..), BuildPlan (..), getResult) import Language.PureScript.Make.BuildPlan qualified as BuildPlan import Language.PureScript.Make.Cache qualified as Cache -import Language.PureScript.Make.Actions as Actions import Language.PureScript.Make.Monad as Monad -import Language.PureScript.CoreFn qualified as CF +import Language.PureScript.ModuleDependencies (DependencyDepth (..), moduleSignature, sortModules) +import Language.PureScript.Names (ModuleName, isBuiltinModuleName, runModuleName, showIdent, showQualified) +import Language.PureScript.Renamer (renameInModule) +import Language.PureScript.Sugar (Env, collapseBindingGroups, createBindingGroups, desugar, desugarCaseGuards, externsEnv, primEnv) +import Language.PureScript.TypeChecker (CheckState (..), emptyCheckState, typeCheckModule) +import Language.Purus.Pretty qualified as CFT +import Language.Purus.Prim.Ledger + import System.Directory (doesFileExist) import System.FilePath (replaceExtension) --- | Rebuild a single module. --- --- This function is used for fast-rebuild workflows (PSCi and psc-ide are examples). -rebuildModule - :: forall m - . (MonadBaseControl IO m, MonadError MultipleErrors m, MonadWriter MultipleErrors m) - => MakeActions m - -> [ExternsFile] - -> Module - -> m ExternsFile +-- Temporary +import Debug.Trace (traceM) +import Language.Purus.Pretty (ppType) + +initEnvironmentPurus :: Environment +initEnvironmentPurus = case initEnvironment of + Environment nms tys dCons tSyns tcDicts tcs -> + Environment nms (M.fromList ledgerTypes <> tys) (dCons <> ledgerConstructorsEnv) tSyns tcDicts tcs + +{- | Rebuild a single module. + +This function is used for fast-rebuild workflows (PSCi and psc-ide are examples). +-} +rebuildModule :: + forall m. + (MonadBaseControl IO m, MonadError MultipleErrors m, MonadWriter MultipleErrors m) => + MakeActions m -> + [ExternsFile] -> + Module -> + m ExternsFile rebuildModule actions externs m = do env <- fmap fst . runWriterT $ foldM externsEnv primEnv externs rebuildModule' actions env externs m -rebuildModule' - :: forall m - . (MonadBaseControl IO m, MonadError MultipleErrors m, MonadWriter MultipleErrors m) - => MakeActions m - -> Env - -> [ExternsFile] - -> Module - -> m ExternsFile +rebuildModule' :: + forall m. + (MonadBaseControl IO m, MonadError MultipleErrors m, MonadWriter MultipleErrors m) => + MakeActions m -> + Env -> + [ExternsFile] -> + Module -> + m ExternsFile rebuildModule' act env ext mdl = rebuildModuleWithIndex act env ext mdl Nothing -rebuildModuleWithIndex - :: forall m - . (MonadBaseControl IO m, MonadError MultipleErrors m, MonadWriter MultipleErrors m) - => MakeActions m - -> Env - -> [ExternsFile] - -> Module - -> Maybe (Int, Int) - -> m ExternsFile -rebuildModuleWithIndex MakeActions{..} exEnv externs m@(Module _ _ moduleName _ _) moduleIndex = do +rebuildModuleWithIndex :: + forall m. + (MonadBaseControl IO m, MonadError MultipleErrors m, MonadWriter MultipleErrors m) => + MakeActions m -> + Env -> + [ExternsFile] -> + Module -> + Maybe (Int, Int) -> + m ExternsFile +rebuildModuleWithIndex MakeActions {..} exEnv externs m@(Module _ _ moduleName _ _) moduleIndex = do progress $ CompilingModule moduleName moduleIndex - let env = foldl' (flip applyExternsFileToEnvironment) initEnvironment externs + let env = foldl' (flip applyExternsFileToEnvironment) initEnvironmentPurus externs withPrim = importPrim m lint withPrim - ((Module ss coms _ elaborated exps, env'), nextVar) <- runSupplyT 0 $ do + ((Module ss coms _ elaborated exps, env', chkSt), nextVar) <- runSupplyT 0 $ do (desugared, (exEnv', usedImports)) <- runStateT (desugar externs withPrim) (exEnv, mempty) let modulesExports = (\(_, _, exports) -> exports) <$> exEnv' - (checked, CheckState{..}) <- runStateT (typeCheckModule modulesExports desugared) $ emptyCheckState env - let usedImports' = foldl' (flip $ \(fromModuleName, newtypeCtorName) -> - M.alter (Just . (fmap DctorName newtypeCtorName :) . fold) fromModuleName) usedImports checkConstructorImportsForCoercible + (checked, chkSt@CheckState {..}) <- runStateT (typeCheckModule modulesExports desugared) $ emptyCheckState env + let usedImports' = + foldl' + ( flip $ \(fromModuleName, newtypeCtorName) -> + M.alter (Just . (fmap DctorName newtypeCtorName :) . fold) fromModuleName + ) + usedImports + checkConstructorImportsForCoercible -- Imports cannot be linted before type checking because we need to -- known which newtype constructors are used to solve Coercible -- constraints in order to not report them as unused. censor (addHint (ErrorInModule moduleName)) $ lintImports checked exEnv' usedImports' - return (checked, checkEnv) + return (checked, checkEnv, chkSt) -- desugar case declarations *after* type- and exhaustiveness checking -- since pattern guards introduces cases which the exhaustiveness checker @@ -109,12 +127,18 @@ rebuildModuleWithIndex MakeActions{..} exEnv externs m@(Module _ _ moduleName _ desugarCaseGuards elaborated regrouped <- createBindingGroups moduleName . collapseBindingGroups $ deguarded + let mod' = Module ss coms moduleName regrouped exps - corefn = CF.moduleToCoreFn env' mod' - (optimized, nextVar'') = runSupply nextVar' $ CF.optimizeCoreFn corefn + traceM $ "PURUS START HERE: " <> T.unpack (runModuleName moduleName) + -- pTrace regrouped + -- pTrace exps + ((coreFn, chkSt'), nextVar'') <- runSupplyT nextVar' $ runStateT (CFT.moduleToCoreFn mod') chkSt -- (emptyCheckState env') + traceM . T.unpack $ CFT.prettyModuleTxt coreFn + let corefn = coreFn + (optimized, nextVar''') = runSupply nextVar'' $ CF.optimizeCoreFn corefn (renamedIdents, renamed) = renameInModule optimized exts = moduleToExternsFile mod' env' renamedIdents - ffiCodegen renamed + -- pTrace exts -- It may seem more obvious to write `docs <- Docs.convertModule m env' here, -- but I have not done so for two reasons: @@ -124,23 +148,39 @@ rebuildModuleWithIndex MakeActions{..} exEnv externs m@(Module _ _ moduleName _ -- 2. We do not want to perform any extra work generating docs unless the -- user has asked for docs to be generated. let docs = case Docs.convertModule externs exEnv env' m of - Left errs -> internalError $ - "Failed to produce docs for " ++ T.unpack (runModuleName moduleName) - ++ "; details:\n" ++ prettyPrintMultipleErrors defaultPPEOptions errs - Right d -> d + Left errs -> + internalError $ + "Failed to produce docs for " + ++ T.unpack (runModuleName moduleName) + ++ "; details:\n" + ++ prettyPrintMultipleErrors defaultPPEOptions errs + Right d -> d - evalSupplyT nextVar'' $ codegen renamed docs exts + evalSupplyT nextVar''' $ codegen renamed docs exts return exts + where + prettyEnv :: Environment -> String + prettyEnv Environment {..} = M.foldlWithKey' goPretty "" names + where + goPretty acc ident (ty, _, _) = + acc + <> "\n" + <> T.unpack (showQualified showIdent ident) + <> " :: " + <> ppType 10 ty --- | Compiles in "make" mode, compiling each module separately to a @.js@ file and an @externs.cbor@ file. --- --- If timestamps or hashes have not changed, existing externs files can be used to provide upstream modules' types without --- having to typecheck those modules again. -make :: forall m. (MonadBaseControl IO m, MonadError MultipleErrors m, MonadWriter MultipleErrors m) - => MakeActions m - -> [CST.PartialResult Module] - -> m [ExternsFile] -make ma@MakeActions{..} ms = do +{- | Compiles in "make" mode, compiling each module separately to a @.js@ file and an @externs.cbor@ file. + +If timestamps or hashes have not changed, existing externs files can be used to provide upstream modules' types without +having to typecheck those modules again. +-} +make :: + forall m. + (MonadBaseControl IO m, MonadError MultipleErrors m, MonadWriter MultipleErrors m) => + MakeActions m -> + [CST.PartialResult Module] -> + m [ExternsFile] +make ma@MakeActions {..} ms = do checkModuleNames cacheDb <- readCacheDb @@ -148,17 +188,19 @@ make ma@MakeActions{..} ms = do (buildPlan, newCacheDb) <- BuildPlan.construct ma cacheDb (sorted, graph) - let toBeRebuilt = filter (BuildPlan.needsRebuild buildPlan . getModuleName . CST.resPartial) sorted + let toBeRebuilt = sorted -- filter (BuildPlan.needsRebuild buildPlan . getModuleName . CST.resPartial) sorted let totalModuleCount = length toBeRebuilt for_ toBeRebuilt $ \m -> fork $ do let moduleName = getModuleName . CST.resPartial $ m let deps = fromMaybe (internalError "make: module not found in dependency graph.") (lookup moduleName graph) - buildModule buildPlan moduleName totalModuleCount + buildModule + buildPlan + moduleName + totalModuleCount (spanName . getModuleSourceSpan . CST.resPartial $ m) (fst $ CST.resFull m) (fmap importPrim . snd $ CST.resFull m) (deps `inOrderOf` map (getModuleName . CST.resPartial) sorted) - -- Prevent hanging on other modules when there is an internal error -- (the exception is thrown, but other threads waiting on MVars are released) `onExceptionLifted` BuildPlan.markComplete buildPlan moduleName (BuildJobFailed mempty) @@ -173,7 +215,7 @@ make ma@MakeActions{..} ms = do Left errs BuildJobSkipped -> Left mempty - in + in M.mapEither splitResults <$> BuildPlan.collectResults buildPlan -- Write the updated build cache database to disk @@ -192,84 +234,84 @@ make ma@MakeActions{..} ms = do -- so they can be folded into an Environment. This result is used in the tests -- and in PSCI. let lookupResult mn = - fromMaybe (internalError "make: module not found in results") - $ M.lookup mn successes + fromMaybe (internalError "make: module not found in results") $ + M.lookup mn successes return (map (lookupResult . getModuleName . CST.resPartial) sorted) - where - checkModuleNames :: m () - checkModuleNames = checkNoPrim *> checkModuleNamesAreUnique - - checkNoPrim :: m () - checkNoPrim = - for_ ms $ \m -> - let mn = getModuleName $ CST.resPartial m - in when (isBuiltinModuleName mn) $ - throwError - . errorMessage' (getModuleSourceSpan $ CST.resPartial m) - $ CannotDefinePrimModules mn - - checkModuleNamesAreUnique :: m () - checkModuleNamesAreUnique = - for_ (findDuplicates (getModuleName . CST.resPartial) ms) $ \mss -> - throwError . flip foldMap mss $ \ms' -> - let mn = getModuleName . CST.resPartial . NEL.head $ ms' - in errorMessage'' (fmap (getModuleSourceSpan . CST.resPartial) ms') $ DuplicateModule mn - - -- Find all groups of duplicate values in a list based on a projection. - findDuplicates :: Ord b => (a -> b) -> [a] -> Maybe [NEL.NonEmpty a] - findDuplicates f xs = - case filter ((> 1) . length) . NEL.groupBy ((==) `on` f) . sortOn f $ xs of - [] -> Nothing - xss -> Just xss - - -- Sort a list so its elements appear in the same order as in another list. - inOrderOf :: (Ord a) => [a] -> [a] -> [a] - inOrderOf xs ys = let s = S.fromList xs in filter (`S.member` s) ys - - buildModule :: BuildPlan -> ModuleName -> Int -> FilePath -> [CST.ParserWarning] -> Either (NEL.NonEmpty CST.ParserError) Module -> [ModuleName] -> m () - buildModule buildPlan moduleName cnt fp pwarnings mres deps = do - result <- flip catchError (return . BuildJobFailed) $ do - let pwarnings' = CST.toMultipleWarnings fp pwarnings - tell pwarnings' - m <- CST.unwrapParserError fp mres - -- We need to wait for dependencies to be built, before checking if the current - -- module should be rebuilt, so the first thing to do is to wait on the - -- MVars for the module's dependencies. - mexterns <- fmap unzip . sequence <$> traverse (getResult buildPlan) deps - - case mexterns of - Just (_, externs) -> do - -- We need to ensure that all dependencies have been included in Env - C.modifyMVar_ (bpEnv buildPlan) $ \env -> do - let - go :: Env -> ModuleName -> m Env - go e dep = case lookup dep (zip deps externs) of - Just exts - | not (M.member dep e) -> externsEnv e exts - _ -> return e - foldM go env deps - env <- C.readMVar (bpEnv buildPlan) - idx <- C.takeMVar (bpIndex buildPlan) - C.putMVar (bpIndex buildPlan) (idx + 1) - (exts, warnings) <- listen $ rebuildModuleWithIndex ma env externs m (Just (idx, cnt)) - return $ BuildJobSucceeded (pwarnings' <> warnings) exts - Nothing -> return BuildJobSkipped - - BuildPlan.markComplete buildPlan moduleName result - - onExceptionLifted :: m a -> m b -> m a - onExceptionLifted l r = control $ \runInIO -> runInIO l `onException` runInIO r - --- | Infer the module name for a module by looking for the same filename with --- a .js extension. -inferForeignModules - :: forall m - . MonadIO m - => M.Map ModuleName (Either RebuildPolicy FilePath) - -> m (M.Map ModuleName FilePath) + checkModuleNames :: m () + checkModuleNames = checkNoPrim *> checkModuleNamesAreUnique + + checkNoPrim :: m () + checkNoPrim = + for_ ms $ \m -> + let mn = getModuleName $ CST.resPartial m + in when (isBuiltinModuleName mn) + $ throwError + . errorMessage' (getModuleSourceSpan $ CST.resPartial m) + $ CannotDefinePrimModules mn + + checkModuleNamesAreUnique :: m () + checkModuleNamesAreUnique = + for_ (findDuplicates (getModuleName . CST.resPartial) ms) $ \mss -> + throwError . flip foldMap mss $ \ms' -> + let mn = getModuleName . CST.resPartial . NEL.head $ ms' + in errorMessage'' (fmap (getModuleSourceSpan . CST.resPartial) ms') $ DuplicateModule mn + + -- Find all groups of duplicate values in a list based on a projection. + findDuplicates :: (Ord b) => (a -> b) -> [a] -> Maybe [NEL.NonEmpty a] + findDuplicates f xs = + case filter ((> 1) . length) . NEL.groupBy ((==) `on` f) . sortOn f $ xs of + [] -> Nothing + xss -> Just xss + + -- Sort a list so its elements appear in the same order as in another list. + inOrderOf :: (Ord a) => [a] -> [a] -> [a] + inOrderOf xs ys = let s = S.fromList xs in filter (`S.member` s) ys + + buildModule :: BuildPlan -> ModuleName -> Int -> FilePath -> [CST.ParserWarning] -> Either (NEL.NonEmpty CST.ParserError) Module -> [ModuleName] -> m () + buildModule buildPlan moduleName cnt fp pwarnings mres deps = do + result <- flip catchError (return . BuildJobFailed) $ do + let pwarnings' = CST.toMultipleWarnings fp pwarnings + tell pwarnings' + m <- CST.unwrapParserError fp mres + -- We need to wait for dependencies to be built, before checking if the current + -- module should be rebuilt, so the first thing to do is to wait on the + -- MVars for the module's dependencies. + mexterns <- fmap unzip . sequence <$> traverse (getResult buildPlan) deps + + case mexterns of + Just (_, externs) -> do + -- We need to ensure that all dependencies have been included in Env + C.modifyMVar_ (bpEnv buildPlan) $ \env -> do + let + go :: Env -> ModuleName -> m Env + go e dep = case lookup dep (zip deps externs) of + Just exts + | not (M.member dep e) -> externsEnv e exts + _ -> return e + foldM go env deps + env <- C.readMVar (bpEnv buildPlan) + idx <- C.takeMVar (bpIndex buildPlan) + C.putMVar (bpIndex buildPlan) (idx + 1) + (exts, warnings) <- listen $ rebuildModuleWithIndex ma env externs m (Just (idx, cnt)) + return $ BuildJobSucceeded (pwarnings' <> warnings) exts + Nothing -> return BuildJobSkipped + + BuildPlan.markComplete buildPlan moduleName result + + onExceptionLifted :: m a -> m b -> m a + onExceptionLifted l r = control $ \runInIO -> runInIO l `onException` runInIO r + +{- | Infer the module name for a module by looking for the same filename with +a .js extension. +-} +inferForeignModules :: + forall m. + (MonadIO m) => + M.Map ModuleName (Either RebuildPolicy FilePath) -> + m (M.Map ModuleName FilePath) inferForeignModules = - fmap (M.mapMaybe id) . traverse inferForeignModule + fmap (M.mapMaybe id) . traverse inferForeignModule where inferForeignModule :: Either RebuildPolicy FilePath -> m (Maybe FilePath) inferForeignModule (Left _) = return Nothing diff --git a/src/Language/PureScript/Make/Actions.hs b/src/Language/PureScript/Make/Actions.hs index f138327c8..1a38632c7 100644 --- a/src/Language/PureScript/Make/Actions.hs +++ b/src/Language/PureScript/Make/Actions.hs @@ -1,26 +1,27 @@ -module Language.PureScript.Make.Actions - ( MakeActions(..) - , RebuildPolicy(..) - , ProgressMessage(..) - , renderProgressMessage - , buildMakeActions - , checkForeignDecls - , cacheDbFile - , readCacheDb' - , writeCacheDb' - , ffiCodegen' - ) where +{-# LANGUAGE TypeApplications #-} + +module Language.PureScript.Make.Actions ( + MakeActions (..), + RebuildPolicy (..), + ProgressMessage (..), + renderProgressMessage, + buildMakeActions, + checkForeignDecls, + cacheDbFile, + readCacheDb', + writeCacheDb', +) where import Prelude import Control.Monad (unless, when) -import Control.Monad.Error.Class (MonadError(..)) -import Control.Monad.IO.Class (MonadIO(..)) +import Control.Monad.Error.Class (MonadError (..)) +import Control.Monad.IO.Class (MonadIO (..)) import Control.Monad.Reader (asks) import Control.Monad.Supply (SupplyT) -import Control.Monad.Trans.Class (MonadTrans(..)) -import Control.Monad.Writer.Class (MonadWriter(..)) -import Data.Aeson (Value(String), (.=), object) +import Control.Monad.Trans.Class (MonadTrans (..)) +import Control.Monad.Writer.Class (MonadWriter (..)) +import Data.Aeson (Result (..), Value (String), fromJSON, object, (.=)) import Data.Bifunctor (bimap, first) import Data.Either (partitionEithers) import Data.Foldable (for_) @@ -30,47 +31,45 @@ import Data.Maybe (fromMaybe, maybeToList) import Data.Set qualified as S import Data.Text qualified as T import Data.Text.IO qualified as TIO -import Data.Text.Encoding qualified as TE import Data.Time.Clock (UTCTime) -import Data.Version (showVersion) +import Data.Version (makeVersion) import Language.JavaScript.Parser qualified as JS -import Language.PureScript.AST (SourcePos(..)) +import Language.PureScript.AST (SourcePos (..)) import Language.PureScript.Bundle qualified as Bundle -import Language.PureScript.CodeGen.JS qualified as J -import Language.PureScript.CodeGen.JS.Printer (prettyPrintJS, prettyPrintJSWithSourceMaps) +import Language.PureScript.CST qualified as CST import Language.PureScript.CoreFn qualified as CF -import Language.PureScript.CoreFn.ToJSON qualified as CFJ +import Language.PureScript.CoreFn.FromJSON () +import Language.PureScript.CoreFn.ToJSON (moduleToJSON) import Language.PureScript.Crash (internalError) -import Language.PureScript.CST qualified as CST import Language.PureScript.Docs.Prim qualified as Docs.Prim import Language.PureScript.Docs.Types qualified as Docs -import Language.PureScript.Errors (MultipleErrors, SimpleErrorMessage(..), errorMessage, errorMessage') +import Language.PureScript.Errors (MultipleErrors, SimpleErrorMessage (..), errorMessage, errorMessage') import Language.PureScript.Externs (ExternsFile, externsFileName) -import Language.PureScript.Make.Monad (Make, copyFile, getTimestamp, getTimestampMaybe, hashFile, makeIO, readExternsFile, readJSONFile, readTextFile, writeCborFile, writeJSONFile, writeTextFile) import Language.PureScript.Make.Cache (CacheDb, ContentHash, normaliseForCache) -import Language.PureScript.Names (Ident(..), ModuleName, runModuleName) -import Language.PureScript.Options (CodegenTarget(..), Options(..)) -import Language.PureScript.Pretty.Common (SMap(..)) -import Paths_purescript qualified as Paths +import Language.PureScript.Make.Monad (Make, getTimestamp, getTimestampMaybe, hashFile, makeIO, readExternsFile, readJSONFile, readTextFile, writeCborFile, writeJSONFile) +import Language.PureScript.Names (Ident (..), ModuleName (..), runModuleName) +import Language.PureScript.Options (CodegenTarget (..), Options (..)) +import Language.PureScript.Pretty.Common (SMap (..)) +import Language.Purus.Pretty (writeModule) import SourceMap (generate) -import SourceMap.Types (Mapping(..), Pos(..), SourceMapping(..)) +import SourceMap.Types (Mapping (..), Pos (..), SourceMapping (..)) import System.Directory (getCurrentDirectory) -import System.FilePath ((), makeRelative, splitPath, normalise, splitDirectories) +import System.FilePath (makeRelative, normalise, splitDirectories, splitPath, ()) import System.FilePath.Posix qualified as Posix -import System.IO (stderr) +import System.IO (IOMode (WriteMode), stderr, withFile) -- | Determines when to rebuild a module data RebuildPolicy - -- | Never rebuild this module - = RebuildNever - -- | Always rebuild this module - | RebuildAlways + = -- | Never rebuild this module + RebuildNever + | -- | Always rebuild this module + RebuildAlways deriving (Show, Eq, Ord) -- | Progress messages from the make process data ProgressMessage - = CompilingModule ModuleName (Maybe (Int, Int)) - -- ^ Compilation started for the specified module + = -- | Compilation started for the specified module + CompilingModule ModuleName (Maybe (Int, Int)) deriving (Show, Eq, Ord) -- | Render a progress message @@ -82,20 +81,21 @@ renderProgressMessage infx (CompilingModule mn mi) = , runModuleName mn ] where - renderProgressIndex :: Maybe (Int, Int) -> T.Text - renderProgressIndex = maybe "" $ \(start, end) -> - let start' = T.pack (show start) - end' = T.pack (show end) - preSpace = T.replicate (T.length end' - T.length start') " " - in "[" <> preSpace <> start' <> " of " <> end' <> "] " - --- | Actions that require implementations when running in "make" mode. --- --- This type exists to make two things abstract: --- --- * The particular backend being used (JavaScript, C++11, etc.) --- --- * The details of how files are read/written etc. + renderProgressIndex :: Maybe (Int, Int) -> T.Text + renderProgressIndex = maybe "" $ \(start, end) -> + let start' = T.pack (show start) + end' = T.pack (show end) + preSpace = T.replicate (T.length end' - T.length start') " " + in "[" <> preSpace <> start' <> " of " <> end' <> "] " + +{- | Actions that require implementations when running in "make" mode. + +This type exists to make two things abstract: + +* The particular backend being used (JavaScript, C++11, etc.) + +* The details of how files are read/written etc. +-} data MakeActions m = MakeActions { getInputTimestampsAndHashes :: ModuleName -> m (Either RebuildPolicy (M.Map FilePath (UTCTime, m ContentHash))) -- ^ Get the timestamps and content hashes for the input files for a module. @@ -112,10 +112,8 @@ data MakeActions m = MakeActions , readExterns :: ModuleName -> m (FilePath, Maybe ExternsFile) -- ^ Read the externs file for a module as a string and also return the actual -- path for the file. - , codegen :: CF.Module CF.Ann -> Docs.Module -> ExternsFile -> SupplyT m () + , codegen :: CF.Module (CF.Bind CF.Ann) CF.PurusType CF.PurusType CF.Ann -> Docs.Module -> ExternsFile -> SupplyT m () -- ^ Run the code generator for the module and write any required output files. - , ffiCodegen :: CF.Module CF.Ann -> m () - -- ^ Check ffi and print it in the output directory. , progress :: ProgressMessage -> m () -- ^ Respond to a progress update. , readCacheDb :: m CacheDb @@ -131,205 +129,213 @@ data MakeActions m = MakeActions -- ^ If generating docs, output the documentation for the Prim modules } --- | Given the output directory, determines the location for the --- CacheDb file +{- | Given the output directory, determines the location for the +CacheDb file +-} cacheDbFile :: FilePath -> FilePath cacheDbFile = ( "cache-db.json") -readCacheDb' - :: (MonadIO m, MonadError MultipleErrors m) - => FilePath - -- ^ The path to the output directory - -> m CacheDb +readCacheDb' :: + (MonadIO m, MonadError MultipleErrors m) => + -- | The path to the output directory + FilePath -> + m CacheDb readCacheDb' outputDir = fromMaybe mempty <$> readJSONFile (cacheDbFile outputDir) -writeCacheDb' - :: (MonadIO m, MonadError MultipleErrors m) - => FilePath - -- ^ The path to the output directory - -> CacheDb - -- ^ The CacheDb to be written - -> m () +writeCacheDb' :: + (MonadIO m, MonadError MultipleErrors m) => + -- | The path to the output directory + FilePath -> + -- | The CacheDb to be written + CacheDb -> + m () writeCacheDb' = writeJSONFile . cacheDbFile -writePackageJson' - :: (MonadIO m, MonadError MultipleErrors m) - => FilePath - -- ^ The path to the output directory - -> m () -writePackageJson' outputDir = writeJSONFile (outputDir "package.json") $ object - [ "type" .= String "module" - ] +writePackageJson' :: + (MonadIO m, MonadError MultipleErrors m) => + -- | The path to the output directory + FilePath -> + m () +writePackageJson' outputDir = + writeJSONFile (outputDir "package.json") $ + object + [ "type" .= String "module" + ] -- | A set of make actions that read and write modules from the given directory. -buildMakeActions - :: FilePath - -- ^ the output directory - -> M.Map ModuleName (Either RebuildPolicy FilePath) - -- ^ a map between module names and paths to the file containing the PureScript module - -> M.Map ModuleName FilePath - -- ^ a map between module name and the file containing the foreign javascript for the module - -> Bool - -- ^ Generate a prefix comment? - -> MakeActions Make +buildMakeActions :: + -- | the output directory + FilePath -> + -- | a map between module names and paths to the file containing the PureScript module + M.Map ModuleName (Either RebuildPolicy FilePath) -> + -- | a map between module name and the file containing the foreign javascript for the module + M.Map ModuleName FilePath -> + -- | Generate a prefix comment? + Bool -> + MakeActions Make buildMakeActions outputDir filePathMap foreigns usePrefix = - MakeActions getInputTimestampsAndHashes getOutputTimestamp readExterns codegen ffiCodegen progress readCacheDb writeCacheDb writePackageJson outputPrimDocs + MakeActions getInputTimestampsAndHashes getOutputTimestamp readExterns codegen progress readCacheDb writeCacheDb writePackageJson outputPrimDocs where - - getInputTimestampsAndHashes - :: ModuleName - -> Make (Either RebuildPolicy (M.Map FilePath (UTCTime, Make ContentHash))) - getInputTimestampsAndHashes mn = do - let path = fromMaybe (internalError "Module has no filename in 'make'") $ M.lookup mn filePathMap - case path of - Left policy -> - return (Left policy) - Right filePath -> do - cwd <- makeIO "Getting the current directory" getCurrentDirectory - let inputPaths = map (normaliseForCache cwd) (filePath : maybeToList (M.lookup mn foreigns)) - getInfo fp = do - ts <- getTimestamp fp - return (ts, hashFile fp) - pathsWithInfo <- traverse (\fp -> (fp,) <$> getInfo fp) inputPaths - return $ Right $ M.fromList pathsWithInfo - - outputFilename :: ModuleName -> String -> FilePath - outputFilename mn fn = - let filePath = T.unpack (runModuleName mn) - in outputDir filePath fn - - targetFilename :: ModuleName -> CodegenTarget -> FilePath - targetFilename mn = \case - JS -> outputFilename mn "index.js" - JSSourceMap -> outputFilename mn "index.js.map" - CoreFn -> outputFilename mn "corefn.json" - Docs -> outputFilename mn "docs.json" - - getOutputTimestamp :: ModuleName -> Make (Maybe UTCTime) - getOutputTimestamp mn = do - codegenTargets <- asks optionsCodegenTargets - mExternsTimestamp <- getTimestampMaybe (outputFilename mn externsFileName) - case mExternsTimestamp of - Nothing -> - -- If there is no externs file, we will need to compile the module in - -- order to produce one. - pure Nothing - Just externsTimestamp -> - case NEL.nonEmpty (fmap (targetFilename mn) (S.toList codegenTargets)) of - Nothing -> - -- If the externs file exists and no other codegen targets have - -- been requested, then we can consider the module up-to-date - pure (Just externsTimestamp) - Just outputPaths -> do - -- If any of the other output paths are nonexistent or older than - -- the externs file, then they should be considered outdated, and - -- so the module will need rebuilding. - mmodTimes <- traverse getTimestampMaybe outputPaths - pure $ case sequence mmodTimes of - Nothing -> - Nothing - Just modTimes -> - if externsTimestamp <= minimum modTimes - then Just externsTimestamp - else Nothing - - readExterns :: ModuleName -> Make (FilePath, Maybe ExternsFile) - readExterns mn = do - let path = outputDir T.unpack (runModuleName mn) externsFileName - (path, ) <$> readExternsFile path - - outputPrimDocs :: Make () - outputPrimDocs = do - codegenTargets <- asks optionsCodegenTargets - when (S.member Docs codegenTargets) $ for_ Docs.Prim.primModules $ \docsMod@Docs.Module{..} -> - writeJSONFile (outputFilename modName "docs.json") docsMod - - codegen :: CF.Module CF.Ann -> Docs.Module -> ExternsFile -> SupplyT Make () - codegen m docs exts = do - let mn = CF.moduleName m - lift $ writeCborFile (outputFilename mn externsFileName) exts - codegenTargets <- lift $ asks optionsCodegenTargets - when (S.member CoreFn codegenTargets) $ do - let coreFnFile = targetFilename mn CoreFn - json = CFJ.moduleToJSON Paths.version m - lift $ writeJSONFile coreFnFile json - when (S.member JS codegenTargets) $ do - foreignInclude <- case mn `M.lookup` foreigns of - Just _ - | not $ requiresForeign m -> do - return Nothing - | otherwise -> do - return $ Just "./foreign.js" - Nothing | requiresForeign m -> throwError . errorMessage' (CF.moduleSourceSpan m) $ MissingFFIModule mn - | otherwise -> return Nothing - rawJs <- J.moduleToJs m foreignInclude - dir <- lift $ makeIO "get the current directory" getCurrentDirectory - let sourceMaps = S.member JSSourceMap codegenTargets - (pjs, mappings) = if sourceMaps then prettyPrintJSWithSourceMaps rawJs else (prettyPrintJS rawJs, []) - jsFile = targetFilename mn JS - mapFile = targetFilename mn JSSourceMap - prefix = ["Generated by purs version " <> T.pack (showVersion Paths.version) | usePrefix] - js = T.unlines $ map ("// " <>) prefix ++ [pjs] - mapRef = if sourceMaps then "//# sourceMappingURL=index.js.map\n" else "" - lift $ do - writeTextFile jsFile (TE.encodeUtf8 $ js <> mapRef) - when sourceMaps $ genSourceMap dir mapFile (length prefix) mappings - when (S.member Docs codegenTargets) $ do - lift $ writeJSONFile (outputFilename mn "docs.json") docs - - ffiCodegen :: CF.Module CF.Ann -> Make () - ffiCodegen m = do - codegenTargets <- asks optionsCodegenTargets - ffiCodegen' foreigns codegenTargets (Just outputFilename) m - - genSourceMap :: String -> String -> Int -> [SMap] -> Make () - genSourceMap dir mapFile extraLines mappings = do - let pathToDir = iterate (".." Posix.) ".." !! length (splitPath $ normalise outputDir) - sourceFile = case mappings of - (SMap file _ _ : _) -> Just $ pathToDir Posix. normalizeSMPath (makeRelative dir (T.unpack file)) - _ -> Nothing - let rawMapping = SourceMapping { smFile = "index.js", smSourceRoot = Nothing, smMappings = - map (\(SMap _ orig gen) -> Mapping { - mapOriginal = Just $ convertPos $ add 0 (-1) orig - , mapSourceFile = sourceFile - , mapGenerated = convertPos $ add (extraLines + 1) 0 gen - , mapName = Nothing - }) mappings - } - let mapping = generate rawMapping - writeJSONFile mapFile mapping - where - add :: Int -> Int -> SourcePos -> SourcePos - add n m (SourcePos n' m') = SourcePos (n + n') (m + m') - - convertPos :: SourcePos -> Pos - convertPos SourcePos { sourcePosLine = l, sourcePosColumn = c } = - Pos { posLine = fromIntegral l, posColumn = fromIntegral c } - - normalizeSMPath :: FilePath -> FilePath - normalizeSMPath = Posix.joinPath . splitDirectories - - requiresForeign :: CF.Module a -> Bool - requiresForeign = not . null . CF.moduleForeign - - progress :: ProgressMessage -> Make () - progress = liftIO . TIO.hPutStr stderr . (<> "\n") . renderProgressMessage "Compiling " - - readCacheDb :: Make CacheDb - readCacheDb = readCacheDb' outputDir - - writeCacheDb :: CacheDb -> Make () - writeCacheDb = writeCacheDb' outputDir - - writePackageJson :: Make () - writePackageJson = writePackageJson' outputDir + getInputTimestampsAndHashes :: + ModuleName -> + Make (Either RebuildPolicy (M.Map FilePath (UTCTime, Make ContentHash))) + getInputTimestampsAndHashes mn = do + codegenTargets <- asks optionsCodegenTargets + if CheckCoreFn `S.member` codegenTargets + then pure (Left RebuildAlways) + else do + let path = fromMaybe (internalError "Module has no filename in 'make'") $ M.lookup mn filePathMap + case path of + Left policy -> + return (Left policy) + Right filePath -> do + cwd <- makeIO "Getting the current directory" getCurrentDirectory + let inputPaths = map (normaliseForCache cwd) (filePath : maybeToList (M.lookup mn foreigns)) + getInfo fp = do + ts <- getTimestamp fp + return (ts, hashFile fp) + pathsWithInfo <- traverse (\fp -> (fp,) <$> getInfo fp) inputPaths + return $ Right $ M.fromList pathsWithInfo + + outputFilename :: ModuleName -> String -> FilePath + outputFilename mn fn = + let filePath = T.unpack (runModuleName mn) + in outputDir filePath fn + + targetFilename :: ModuleName -> CodegenTarget -> FilePath + targetFilename mn@(ModuleName nm) = \case + Docs -> outputFilename mn "docs.json" + CoreFn -> outputFilename mn (T.unpack nm <> ".cfn") + CheckCoreFn -> outputFilename mn (T.unpack nm <> ".cfn") + + getOutputTimestamp :: ModuleName -> Make (Maybe UTCTime) + getOutputTimestamp mn = do + codegenTargets <- asks optionsCodegenTargets + mExternsTimestamp <- getTimestampMaybe (outputFilename mn externsFileName) + case mExternsTimestamp of + Nothing -> + -- If there is no externs file, we will need to compile the module in + -- order to produce one. + pure Nothing + Just externsTimestamp -> + case NEL.nonEmpty (fmap (targetFilename mn) (S.toList codegenTargets)) of + Nothing -> + -- If the externs file exists and no other codegen targets have + -- been requested, then we can consider the module up-to-date + pure (Just externsTimestamp) + Just outputPaths -> do + -- If any of the other output paths are nonexistent or older than + -- the externs file, then they should be considered outdated, and + -- so the module will need rebuilding. + mmodTimes <- traverse getTimestampMaybe outputPaths + pure $ case sequence mmodTimes of + Nothing -> + Nothing + Just modTimes -> + if externsTimestamp <= minimum modTimes + then Just externsTimestamp + else Nothing + + readExterns :: ModuleName -> Make (FilePath, Maybe ExternsFile) + readExterns mn = do + let path = outputDir T.unpack (runModuleName mn) externsFileName + (path,) <$> readExternsFile path + + outputPrimDocs :: Make () + outputPrimDocs = do + codegenTargets <- asks optionsCodegenTargets + when (S.member Docs codegenTargets) $ for_ Docs.Prim.primModules $ \docsMod@Docs.Module {..} -> + writeJSONFile (outputFilename modName "docs.json") docsMod + + codegen :: CF.Module (CF.Bind CF.Ann) CF.PurusType CF.PurusType CF.Ann -> Docs.Module -> ExternsFile -> SupplyT Make () + codegen m docs exts = do + let mn = CF.moduleName m + lift $ writeCborFile (outputFilename mn externsFileName) exts + codegenTargets <- lift $ asks optionsCodegenTargets + {- -when (S.member UPLC codegenTargets) $ do + let coreFnFile = targetFilename mn UPLC + json = CFJ.moduleToJSON Paths.version m + lift $ writeJSONFile coreFnFile json + -} + when (S.member Docs codegenTargets) $ do + lift $ writeJSONFile (outputFilename mn "docs.json") docs + when (S.member CoreFn codegenTargets) $ do + let targetFile = targetFilename mn CoreFn + lift $ writeJSONFile targetFile (moduleToJSON (makeVersion [0, 0, 1]) m) + lift $ makeIO "write pretty core" $ withFile (targetFile <> ".pretty") WriteMode $ \handle -> + writeModule handle m + when (S.member CheckCoreFn codegenTargets) $ do + let mn' = T.unpack (runModuleName mn) + mabOldModule <- lift $ readJSONFile (targetFilename mn CoreFn) + case mabOldModule of + Nothing -> error "Cannot check CoreFn output - could not parse JSON serialization of old module" + Just oldM -> do + lift $ makeIO "print golden result" $ putStrLn $ mn' <> ": old module == new module: " <> show (m == oldM) + where + jsonRoundTrip :: + CF.Module (CF.Bind CF.Ann) CF.PurusType CF.PurusType CF.Ann -> + CF.Module (CF.Bind CF.Ann) CF.PurusType CF.PurusType CF.Ann + jsonRoundTrip mdl = case fromJSON $ moduleToJSON (makeVersion [0, 0, 1]) mdl of + Error str -> error str + Success a -> a + + genSourceMap :: String -> String -> Int -> [SMap] -> Make () + genSourceMap dir mapFile extraLines mappings = do + let pathToDir = iterate (".." Posix.) ".." !! length (splitPath $ normalise outputDir) + sourceFile = case mappings of + (SMap file _ _ : _) -> Just $ pathToDir Posix. normalizeSMPath (makeRelative dir (T.unpack file)) + _ -> Nothing + let rawMapping = + SourceMapping + { smFile = "index.js" + , smSourceRoot = Nothing + , smMappings = + map + ( \(SMap _ orig gen) -> + Mapping + { mapOriginal = Just $ convertPos $ add 0 (-1) orig + , mapSourceFile = sourceFile + , mapGenerated = convertPos $ add (extraLines + 1) 0 gen + , mapName = Nothing + } + ) + mappings + } + let mapping = generate rawMapping + writeJSONFile mapFile mapping + where + add :: Int -> Int -> SourcePos -> SourcePos + add n m (SourcePos n' m') = SourcePos (n + n') (m + m') + + convertPos :: SourcePos -> Pos + convertPos SourcePos {sourcePosLine = l, sourcePosColumn = c} = + Pos {posLine = fromIntegral l, posColumn = fromIntegral c} + + normalizeSMPath :: FilePath -> FilePath + normalizeSMPath = Posix.joinPath . splitDirectories + + requiresForeign :: CF.Module (CF.Bind a) k t a -> Bool + requiresForeign = not . null . CF.moduleForeign + + progress :: ProgressMessage -> Make () + progress = liftIO . TIO.hPutStr stderr . (<> "\n") . renderProgressMessage "Compiling " + + readCacheDb :: Make CacheDb + readCacheDb = readCacheDb' outputDir + + writeCacheDb :: CacheDb -> Make () + writeCacheDb = writeCacheDb' outputDir + + writePackageJson :: Make () + writePackageJson = writePackageJson' outputDir data ForeignModuleType = ESModule | CJSModule deriving (Show) --- | Check that the declarations in a given PureScript module match with those --- in its corresponding foreign module. -checkForeignDecls :: CF.Module ann -> FilePath -> Make (Either MultipleErrors (ForeignModuleType, S.Set Ident)) +{- | Check that the declarations in a given PureScript module match with those +in its corresponding foreign module. +-} +checkForeignDecls :: CF.Module (CF.Bind ann) CF.PurusType CF.PurusType ann -> FilePath -> Make (Either MultipleErrors (ForeignModuleType, S.Set Ident)) checkForeignDecls m path = do jsStr <- T.unpack <$> readTextFile path @@ -337,17 +343,16 @@ checkForeignDecls m path = do parseResult :: Either MultipleErrors JS.JSAST parseResult = first (errorParsingModule . Bundle.UnableToParseModule) $ JS.parseModule jsStr path traverse checkFFI parseResult - where - mname = CF.moduleName m - modSS = CF.moduleSourceSpan m + mname = CF.moduleName m + modSS = CF.moduleSourceSpan m - checkFFI :: JS.JSAST -> Make (ForeignModuleType, S.Set Ident) - checkFFI js = do - (foreignModuleType, foreignIdentsStrs) <- + checkFFI :: JS.JSAST -> Make (ForeignModuleType, S.Set Ident) + checkFFI js = do + (foreignModuleType, foreignIdentsStrs) <- case (,) <$> getForeignModuleExports js <*> getForeignModuleImports js of Left reason -> throwError $ errorParsingModule reason - Right (Bundle.ForeignModuleExports{..}, Bundle.ForeignModuleImports{..}) + Right (Bundle.ForeignModuleExports {..}, Bundle.ForeignModuleImports {..}) | not (null cjsExports && null cjsImports) , null esExports , null esImports -> do @@ -365,91 +370,62 @@ checkForeignDecls m path = do pure (ESModule, esExports) - foreignIdents <- either - errorInvalidForeignIdentifiers - (pure . S.fromList) - (parseIdents foreignIdentsStrs) - let importedIdents = S.fromList (CF.moduleForeign m) - - let unusedFFI = foreignIdents S.\\ importedIdents - unless (null unusedFFI) $ - tell . errorMessage' modSS . UnusedFFIImplementations mname $ - S.toList unusedFFI - - let missingFFI = importedIdents S.\\ foreignIdents - unless (null missingFFI) $ - throwError . errorMessage' modSS . MissingFFIImplementations mname $ - S.toList missingFFI - pure (foreignModuleType, foreignIdents) - - errorParsingModule :: Bundle.ErrorMessage -> MultipleErrors - errorParsingModule = errorMessage' modSS . ErrorParsingFFIModule path . Just - - getForeignModuleExports :: JS.JSAST -> Either Bundle.ErrorMessage Bundle.ForeignModuleExports - getForeignModuleExports = Bundle.getExportedIdentifiers (T.unpack (runModuleName mname)) - - getForeignModuleImports :: JS.JSAST -> Either Bundle.ErrorMessage Bundle.ForeignModuleImports - getForeignModuleImports = Bundle.getImportedModules (T.unpack (runModuleName mname)) - - errorInvalidForeignIdentifiers :: [String] -> Make a - errorInvalidForeignIdentifiers = - throwError . mconcat . map (errorMessage . InvalidFFIIdentifier mname . T.pack) - - errorDeprecatedForeignPrimes :: [String] -> Make a - errorDeprecatedForeignPrimes = - throwError . mconcat . map (errorMessage' modSS . DeprecatedFFIPrime mname . T.pack) - - errorUnsupportedFFICommonJSExports :: [String] -> Make a - errorUnsupportedFFICommonJSExports = - throwError . errorMessage' modSS . UnsupportedFFICommonJSExports mname . map T.pack - - errorUnsupportedFFICommonJSImports :: [String] -> Make a - errorUnsupportedFFICommonJSImports = - throwError . errorMessage' modSS . UnsupportedFFICommonJSImports mname . map T.pack - - parseIdents :: [String] -> Either [String] [Ident] - parseIdents strs = - case partitionEithers (map parseIdent strs) of - ([], idents) -> - Right idents - (errs, _) -> - Left errs - - -- We ignore the error message here, just being told it's an invalid - -- identifier should be enough. - parseIdent :: String -> Either String Ident - parseIdent str = - bimap (const str) (Ident . CST.getIdent . CST.nameValue . snd) - . CST.runTokenParser CST.parseIdent - . CST.lex - $ T.pack str - --- | FFI check and codegen action. --- If path maker is supplied copies foreign module to the output. -ffiCodegen' - :: M.Map ModuleName FilePath - -> S.Set CodegenTarget - -> Maybe (ModuleName -> String -> FilePath) - -> CF.Module CF.Ann - -> Make () -ffiCodegen' foreigns codegenTargets makeOutputPath m = do - when (S.member JS codegenTargets) $ do - let mn = CF.moduleName m - case mn `M.lookup` foreigns of - Just path - | not $ requiresForeign m -> - tell $ errorMessage' (CF.moduleSourceSpan m) $ UnnecessaryFFIModule mn path - | otherwise -> do - checkResult <- checkForeignDecls m path - case checkResult of - Left _ -> copyForeign path mn - Right (ESModule, _) -> copyForeign path mn - Right (CJSModule, _) -> do - throwError $ errorMessage' (CF.moduleSourceSpan m) $ DeprecatedFFICommonJSModule mn path - Nothing | requiresForeign m -> throwError . errorMessage' (CF.moduleSourceSpan m) $ MissingFFIModule mn - | otherwise -> return () - where - requiresForeign = not . null . CF.moduleForeign - - copyForeign path mn = - for_ makeOutputPath (\outputFilename -> copyFile path (outputFilename mn "foreign.js")) + foreignIdents <- + either + errorInvalidForeignIdentifiers + (pure . S.fromList) + (parseIdents foreignIdentsStrs) + let importedIdents = S.fromList (CF.moduleForeign m) + + let unusedFFI = foreignIdents S.\\ importedIdents + unless (null unusedFFI) $ + tell . errorMessage' modSS . UnusedFFIImplementations mname $ + S.toList unusedFFI + + let missingFFI = importedIdents S.\\ foreignIdents + unless (null missingFFI) $ + throwError . errorMessage' modSS . MissingFFIImplementations mname $ + S.toList missingFFI + pure (foreignModuleType, foreignIdents) + + errorParsingModule :: Bundle.ErrorMessage -> MultipleErrors + errorParsingModule = errorMessage' modSS . ErrorParsingFFIModule path . Just + + getForeignModuleExports :: JS.JSAST -> Either Bundle.ErrorMessage Bundle.ForeignModuleExports + getForeignModuleExports = Bundle.getExportedIdentifiers (T.unpack (runModuleName mname)) + + getForeignModuleImports :: JS.JSAST -> Either Bundle.ErrorMessage Bundle.ForeignModuleImports + getForeignModuleImports = Bundle.getImportedModules (T.unpack (runModuleName mname)) + + errorInvalidForeignIdentifiers :: [String] -> Make a + errorInvalidForeignIdentifiers = + throwError . mconcat . map (errorMessage . InvalidFFIIdentifier mname . T.pack) + + errorDeprecatedForeignPrimes :: [String] -> Make a + errorDeprecatedForeignPrimes = + throwError . mconcat . map (errorMessage' modSS . DeprecatedFFIPrime mname . T.pack) + + errorUnsupportedFFICommonJSExports :: [String] -> Make a + errorUnsupportedFFICommonJSExports = + throwError . errorMessage' modSS . UnsupportedFFICommonJSExports mname . map T.pack + + errorUnsupportedFFICommonJSImports :: [String] -> Make a + errorUnsupportedFFICommonJSImports = + throwError . errorMessage' modSS . UnsupportedFFICommonJSImports mname . map T.pack + + parseIdents :: [String] -> Either [String] [Ident] + parseIdents strs = + case partitionEithers (map parseIdent strs) of + ([], idents) -> + Right idents + (errs, _) -> + Left errs + + -- We ignore the error message here, just being told it's an invalid + -- identifier should be enough. + parseIdent :: String -> Either String Ident + parseIdent str = + bimap (const str) (Ident . CST.getIdent . CST.nameValue . snd) + . CST.runTokenParser CST.parseIdent + . CST.lex + $ T.pack str diff --git a/src/Language/PureScript/Make/BuildPlan.hs b/src/Language/PureScript/Make/BuildPlan.hs index 3eba2359a..4e306a4c6 100644 --- a/src/Language/PureScript/Make/BuildPlan.hs +++ b/src/Language/PureScript/Make/BuildPlan.hs @@ -1,30 +1,30 @@ -module Language.PureScript.Make.BuildPlan - ( BuildPlan(bpEnv, bpIndex) - , BuildJobResult(..) - , buildJobSuccess - , construct - , getResult - , collectResults - , markComplete - , needsRebuild - ) where +module Language.PureScript.Make.BuildPlan ( + BuildPlan (bpEnv, bpIndex), + BuildJobResult (..), + buildJobSuccess, + construct, + getResult, + collectResults, + markComplete, + needsRebuild, +) where import Prelude import Control.Concurrent.Async.Lifted as A import Control.Concurrent.Lifted as C -import Control.Monad.Base (liftBase) import Control.Monad (foldM) -import Control.Monad.Trans.Control (MonadBaseControl(..)) -import Control.Monad.Trans.Maybe (MaybeT(..), runMaybeT) +import Control.Monad.Base (liftBase) +import Control.Monad.Trans.Control (MonadBaseControl (..)) +import Control.Monad.Trans.Maybe (MaybeT (..), runMaybeT) import Data.Foldable (foldl') import Data.Map qualified as M import Data.Maybe (fromMaybe, mapMaybe) import Data.Time.Clock (UTCTime) import Language.PureScript.AST (Module, getModuleName) -import Language.PureScript.Crash (internalError) import Language.PureScript.CST qualified as CST -import Language.PureScript.Errors (MultipleErrors(..)) +import Language.PureScript.Crash (internalError) +import Language.PureScript.Errors (MultipleErrors (..)) import Language.PureScript.Externs (ExternsFile) import Language.PureScript.Make.Actions as Actions import Language.PureScript.Make.Cache (CacheDb, CacheInfo, checkChanged) @@ -32,8 +32,9 @@ import Language.PureScript.Names (ModuleName) import Language.PureScript.Sugar.Names.Env (Env, primEnv) import System.Directory (getCurrentDirectory) --- | The BuildPlan tracks information about our build progress, and holds all --- prebuilt modules for incremental builds. +{- | The BuildPlan tracks information about our build progress, and holds all +prebuilt modules for incremental builds. +-} data BuildPlan = BuildPlan { bpPrebuilt :: M.Map ModuleName Prebuilt , bpBuildJobs :: M.Map ModuleName BuildJob @@ -48,45 +49,45 @@ data Prebuilt = Prebuilt newtype BuildJob = BuildJob { bjResult :: C.MVar BuildJobResult - -- ^ Note: an empty MVar indicates that the build job has not yet finished. + -- ^ Note: an empty MVar indicates that the build job has not yet finished. } data BuildJobResult - = BuildJobSucceeded !MultipleErrors !ExternsFile - -- ^ Succeeded, with warnings and externs - -- - | BuildJobFailed !MultipleErrors - -- ^ Failed, with errors - - | BuildJobSkipped - -- ^ The build job was not run, because an upstream build job failed + = -- | Succeeded, with warnings and externs + BuildJobSucceeded !MultipleErrors !ExternsFile + | -- | Failed, with errors + BuildJobFailed !MultipleErrors + | -- | The build job was not run, because an upstream build job failed + BuildJobSkipped buildJobSuccess :: BuildJobResult -> Maybe (MultipleErrors, ExternsFile) buildJobSuccess (BuildJobSucceeded warnings externs) = Just (warnings, externs) buildJobSuccess _ = Nothing --- | Information obtained about a particular module while constructing a build --- plan; used to decide whether a module needs rebuilding. +{- | Information obtained about a particular module while constructing a build +plan; used to decide whether a module needs rebuilding. +-} data RebuildStatus = RebuildStatus { statusModuleName :: ModuleName , statusRebuildNever :: Bool , statusNewCacheInfo :: Maybe CacheInfo - -- ^ New cache info for this module which should be stored for subsequent - -- incremental builds. A value of Nothing indicates that cache info for - -- this module should not be stored in the build cache, because it is being - -- rebuilt according to a RebuildPolicy instead. + -- ^ New cache info for this module which should be stored for subsequent + -- incremental builds. A value of Nothing indicates that cache info for + -- this module should not be stored in the build cache, because it is being + -- rebuilt according to a RebuildPolicy instead. , statusPrebuilt :: Maybe Prebuilt - -- ^ Prebuilt externs and timestamp for this module, if any. + -- ^ Prebuilt externs and timestamp for this module, if any. } --- | Called when we finished compiling a module and want to report back the --- compilation result, as well as any potential errors that were thrown. -markComplete - :: (MonadBaseControl IO m) - => BuildPlan - -> ModuleName - -> BuildJobResult - -> m () +{- | Called when we finished compiling a module and want to report back the +compilation result, as well as any potential errors that were thrown. +-} +markComplete :: + (MonadBaseControl IO m) => + BuildPlan -> + ModuleName -> + BuildJobResult -> + m () markComplete buildPlan moduleName result = do let BuildJob rVar = fromMaybe (internalError "make: markComplete no barrier") $ M.lookup moduleName (bpBuildJobs buildPlan) putMVar rVar result @@ -95,25 +96,27 @@ markComplete buildPlan moduleName result = do needsRebuild :: BuildPlan -> ModuleName -> Bool needsRebuild bp moduleName = M.member moduleName (bpBuildJobs bp) --- | Collects results for all prebuilt as well as rebuilt modules. This will --- block until all build jobs are finished. Prebuilt modules always return no --- warnings. -collectResults - :: (MonadBaseControl IO m) - => BuildPlan - -> m (M.Map ModuleName BuildJobResult) +{- | Collects results for all prebuilt as well as rebuilt modules. This will +block until all build jobs are finished. Prebuilt modules always return no +warnings. +-} +collectResults :: + (MonadBaseControl IO m) => + BuildPlan -> + m (M.Map ModuleName BuildJobResult) collectResults buildPlan = do let prebuiltResults = M.map (BuildJobSucceeded (MultipleErrors []) . pbExternsFile) (bpPrebuilt buildPlan) barrierResults <- traverse (readMVar . bjResult) $ bpBuildJobs buildPlan pure (M.union prebuiltResults barrierResults) --- | Gets the the build result for a given module name independent of whether it --- was rebuilt or prebuilt. Prebuilt modules always return no warnings. -getResult - :: (MonadBaseControl IO m) - => BuildPlan - -> ModuleName - -> m (Maybe (MultipleErrors, ExternsFile)) +{- | Gets the the build result for a given module name independent of whether it +was rebuilt or prebuilt. Prebuilt modules always return no warnings. +-} +getResult :: + (MonadBaseControl IO m) => + BuildPlan -> + ModuleName -> + m (Maybe (MultipleErrors, ExternsFile)) getResult buildPlan moduleName = case M.lookup moduleName (bpPrebuilt buildPlan) of Just es -> @@ -122,22 +125,24 @@ getResult buildPlan moduleName = r <- readMVar $ bjResult $ fromMaybe (internalError "make: no barrier") $ M.lookup moduleName (bpBuildJobs buildPlan) pure $ buildJobSuccess r --- | Constructs a BuildPlan for the given module graph. --- --- The given MakeActions are used to collect various timestamps in order to --- determine whether a module needs rebuilding. -construct - :: forall m. MonadBaseControl IO m - => MakeActions m - -> CacheDb - -> ([CST.PartialResult Module], [(ModuleName, [ModuleName])]) - -> m (BuildPlan, CacheDb) -construct MakeActions{..} cacheDb (sorted, graph) = do +{- | Constructs a BuildPlan for the given module graph. + +The given MakeActions are used to collect various timestamps in order to +determine whether a module needs rebuilding. +-} +construct :: + forall m. + (MonadBaseControl IO m) => + MakeActions m -> + CacheDb -> + ([CST.PartialResult Module], [(ModuleName, [ModuleName])]) -> + m (BuildPlan, CacheDb) +construct MakeActions {..} cacheDb (sorted, graph) = do let sortedModuleNames = map (getModuleName . CST.resPartial) sorted rebuildStatuses <- A.forConcurrently sortedModuleNames getRebuildStatus let prebuilt = foldl' collectPrebuiltModules M.empty $ - mapMaybe (\s -> (statusModuleName s, statusRebuildNever s,) <$> statusPrebuilt s) rebuildStatuses + mapMaybe (\s -> (statusModuleName s,statusRebuildNever s,) <$> statusPrebuilt s) rebuildStatuses let toBeRebuilt = filter (not . flip M.member prebuilt) sortedModuleNames buildJobs <- foldM makeBuildJob M.empty toBeRebuilt env <- C.newMVar primEnv @@ -147,7 +152,7 @@ construct MakeActions{..} cacheDb (sorted, graph) = do , let update = flip $ \s -> M.alter (const (statusNewCacheInfo s)) (statusModuleName s) - in + in foldl' update cacheDb rebuildStatuses ) where @@ -161,19 +166,23 @@ construct MakeActions{..} cacheDb (sorted, graph) = do case inputInfo of Left RebuildNever -> do prebuilt <- findExistingExtern moduleName - pure (RebuildStatus - { statusModuleName = moduleName - , statusRebuildNever = True - , statusPrebuilt = prebuilt - , statusNewCacheInfo = Nothing - }) + pure + ( RebuildStatus + { statusModuleName = moduleName + , statusRebuildNever = True + , statusPrebuilt = prebuilt + , statusNewCacheInfo = Nothing + } + ) Left RebuildAlways -> do - pure (RebuildStatus - { statusModuleName = moduleName - , statusRebuildNever = False - , statusPrebuilt = Nothing - , statusNewCacheInfo = Nothing - }) + pure + ( RebuildStatus + { statusModuleName = moduleName + , statusRebuildNever = False + , statusPrebuilt = Nothing + , statusNewCacheInfo = Nothing + } + ) Right cacheInfo -> do cwd <- liftBase getCurrentDirectory (newCacheInfo, isUpToDate) <- checkChanged cacheDb moduleName cwd cacheInfo @@ -181,12 +190,14 @@ construct MakeActions{..} cacheDb (sorted, graph) = do if isUpToDate then findExistingExtern moduleName else pure Nothing - pure (RebuildStatus - { statusModuleName = moduleName - , statusRebuildNever = False - , statusPrebuilt = prebuilt - , statusNewCacheInfo = Just newCacheInfo - }) + pure + ( RebuildStatus + { statusModuleName = moduleName + , statusRebuildNever = False + , statusPrebuilt = prebuilt + , statusNewCacheInfo = Just newCacheInfo + } + ) findExistingExtern :: ModuleName -> m (Maybe Prebuilt) findExistingExtern moduleName = runMaybeT $ do @@ -207,10 +218,11 @@ construct MakeActions{..} cacheDb (sorted, graph) = do prev Just modTimes -> case maximumMaybe modTimes of - Just depModTime | pbModificationTime pb < depModTime -> - prev + Just depModTime + | pbModificationTime pb < depModTime -> + prev _ -> M.insert moduleName pb prev -maximumMaybe :: Ord a => [a] -> Maybe a +maximumMaybe :: (Ord a) => [a] -> Maybe a maximumMaybe [] = Nothing maximumMaybe xs = Just $ maximum xs diff --git a/src/Language/PureScript/Make/Cache.hs b/src/Language/PureScript/Make/Cache.hs index 092544fa7..be98b66d5 100644 --- a/src/Language/PureScript/Make/Cache.hs +++ b/src/Language/PureScript/Make/Cache.hs @@ -1,31 +1,31 @@ -module Language.PureScript.Make.Cache - ( ContentHash - , hash - , CacheDb - , CacheInfo(..) - , checkChanged - , removeModules - , normaliseForCache - ) where +module Language.PureScript.Make.Cache ( + ContentHash, + hash, + CacheDb, + CacheInfo (..), + checkChanged, + removeModules, + normaliseForCache, +) where import Prelude import Control.Category ((>>>)) import Control.Monad ((>=>)) -import Crypto.Hash (HashAlgorithm, Digest, SHA512) +import Crypto.Hash (Digest, HashAlgorithm, SHA512) import Crypto.Hash qualified as Hash import Data.Aeson qualified as Aeson import Data.Align (align) -import Data.ByteArray.Encoding (Base(Base16), convertToBase, convertFromBase) +import Data.ByteArray.Encoding (Base (Base16), convertFromBase, convertToBase) import Data.ByteString qualified as BS import Data.Map (Map) import Data.Map qualified as Map import Data.Maybe (fromMaybe) -import Data.Monoid (All(..)) +import Data.Monoid (All (..)) import Data.Set (Set) import Data.Text (Text) -import Data.Text.Encoding (encodeUtf8, decodeUtf8) -import Data.These (These(..)) +import Data.Text.Encoding (decodeUtf8, encodeUtf8) +import Data.These (These (..)) import Data.Time.Clock (UTCTime) import Data.Traversable (for) import System.FilePath qualified as FilePath @@ -35,15 +35,15 @@ import Language.PureScript.Names (ModuleName) digestToHex :: Digest a -> Text digestToHex = decodeUtf8 . convertToBase Base16 -digestFromHex :: forall a. HashAlgorithm a => Text -> Maybe (Digest a) +digestFromHex :: forall a. (HashAlgorithm a) => Text -> Maybe (Digest a) digestFromHex = encodeUtf8 - >>> either (const Nothing) Just . convertFromBase Base16 - >=> (Hash.digestFromByteString :: BS.ByteString -> Maybe (Digest a)) + >>> either (const Nothing) Just . convertFromBase Base16 + >=> (Hash.digestFromByteString :: BS.ByteString -> Maybe (Digest a)) -- | Defines the hash algorithm we use for cache invalidation of input files. newtype ContentHash = ContentHash - { unContentHash :: Digest SHA512 } + {unContentHash :: Digest SHA512} deriving (Show, Eq, Ord) instance Aeson.ToJSON ContentHash where @@ -63,41 +63,42 @@ hash = ContentHash . Hash.hash type CacheDb = Map ModuleName CacheInfo --- | A CacheInfo contains all of the information we need to store about a --- particular module in the cache database. +{- | A CacheInfo contains all of the information we need to store about a +particular module in the cache database. +-} newtype CacheInfo = CacheInfo - { unCacheInfo :: Map FilePath (UTCTime, ContentHash) } + {unCacheInfo :: Map FilePath (UTCTime, ContentHash)} deriving stock (Show) deriving newtype (Eq, Ord, Semigroup, Monoid, Aeson.FromJSON, Aeson.ToJSON) --- | Given a module name, and a map containing the associated input files --- together with current metadata i.e. timestamps and hashes, check whether the --- input files have changed, based on comparing with the database stored in the --- monadic state. --- --- The CacheInfo in the return value should be stored in the cache for future --- builds. --- --- The Bool in the return value indicates whether it is safe to use existing --- build artifacts for this module, at least based on the timestamps and hashes --- of the module's input files. --- --- If the timestamps are the same as those in the database, assume the file is --- unchanged, and return True without checking hashes. --- --- If any of the timestamps differ from what is in the database, check the --- hashes of those files. In this case, update the database with any changed --- timestamps and hashes, and return True if and only if all of the hashes are --- unchanged. -checkChanged - :: Monad m - => CacheDb - -> ModuleName - -> FilePath - -> Map FilePath (UTCTime, m ContentHash) - -> m (CacheInfo, Bool) +{- | Given a module name, and a map containing the associated input files +together with current metadata i.e. timestamps and hashes, check whether the +input files have changed, based on comparing with the database stored in the +monadic state. + +The CacheInfo in the return value should be stored in the cache for future +builds. + +The Bool in the return value indicates whether it is safe to use existing +build artifacts for this module, at least based on the timestamps and hashes +of the module's input files. + +If the timestamps are the same as those in the database, assume the file is +unchanged, and return True without checking hashes. + +If any of the timestamps differ from what is in the database, check the +hashes of those files. In this case, update the database with any changed +timestamps and hashes, and return True if and only if all of the hashes are +unchanged. +-} +checkChanged :: + (Monad m) => + CacheDb -> + ModuleName -> + FilePath -> + Map FilePath (UTCTime, m ContentHash) -> + m (CacheInfo, Bool) checkChanged cacheDb mn basePath currentInfo = do - let dbInfo = unCacheInfo $ fromMaybe mempty (Map.lookup mn cacheDb) (newInfo, isUpToDate) <- fmap mconcat $ @@ -126,24 +127,25 @@ checkChanged cacheDb mn basePath currentInfo = do pure (CacheInfo newInfo, getAll isUpToDate) --- | Remove any modules from the given set from the cache database; used when --- they failed to build. +{- | Remove any modules from the given set from the cache database; used when +they failed to build. +-} removeModules :: Set ModuleName -> CacheDb -> CacheDb removeModules = flip Map.withoutKeys --- | 1. Any path that is beneath our current working directory will be --- stored as a normalised relative path --- 2. Any path that isn't will be stored as an absolute path +{- | 1. Any path that is beneath our current working directory will be +stored as a normalised relative path +2. Any path that isn't will be stored as an absolute path +-} normaliseForCache :: FilePath -> FilePath -> FilePath normaliseForCache basePath fp = - if FilePath.isRelative fp then - FilePath.normalise fp + if FilePath.isRelative fp + then FilePath.normalise fp else - let relativePath = FilePath.makeRelative basePath fp in - if FilePath.isRelative relativePath then - FilePath.normalise relativePath - else - -- If the path is still absolute after trying to make it - -- relative to the base that means it is not underneath - -- the base path - FilePath.normalise fp + let relativePath = FilePath.makeRelative basePath fp + in if FilePath.isRelative relativePath + then FilePath.normalise relativePath + else -- If the path is still absolute after trying to make it + -- relative to the base that means it is not underneath + -- the base path + FilePath.normalise fp diff --git a/src/Language/PureScript/Make/Monad.hs b/src/Language/PureScript/Make/Monad.hs index d8326ee12..dfe15063b 100644 --- a/src/Language/PureScript/Make/Monad.hs +++ b/src/Language/PureScript/Make/Monad.hs @@ -1,57 +1,58 @@ -module Language.PureScript.Make.Monad - ( -- * Implementation of Make API using files on disk - Make(..) - , runMake - , makeIO - , getTimestamp - , getTimestampMaybe - , readTextFile - , readJSONFile - , readJSONFileIO - , readCborFile - , readCborFileIO - , readExternsFile - , hashFile - , writeTextFile - , writeJSONFile - , writeCborFile - , writeCborFileIO - , copyFile - ) where +module Language.PureScript.Make.Monad ( + -- * Implementation of Make API using files on disk + Make (..), + runMake, + makeIO, + getTimestamp, + getTimestampMaybe, + readTextFile, + readJSONFile, + readJSONFileIO, + readCborFile, + readCborFileIO, + readExternsFile, + hashFile, + writeTextFile, + writeJSONFile, + writeCborFile, + writeCborFileIO, + copyFile, +) where import Prelude import Codec.Serialise (Serialise) import Codec.Serialise qualified as Serialise import Control.Exception (fromException, tryJust) -import Control.Monad (join, guard) -import Control.Monad.Base (MonadBase(..)) -import Control.Monad.Error.Class (MonadError(..)) -import Control.Monad.IO.Class (MonadIO(..)) +import Control.Monad (guard, join) +import Control.Monad.Base (MonadBase (..)) +import Control.Monad.Error.Class (MonadError (..)) +import Control.Monad.IO.Class (MonadIO (..)) import Control.Monad.Logger (Logger, runLogger') -import Control.Monad.Reader (MonadReader(..), ReaderT(..)) -import Control.Monad.Trans.Control (MonadBaseControl(..)) +import Control.Monad.Reader (MonadReader (..), ReaderT (..)) +import Control.Monad.Trans.Control (MonadBaseControl (..)) import Control.Monad.Trans.Except (ExceptT, runExceptT) -import Control.Monad.Writer.Class (MonadWriter(..)) +import Control.Monad.Writer.Class (MonadWriter (..)) import Data.Aeson qualified as Aeson import Data.ByteString qualified as B import Data.Text (Text) import Data.Text qualified as Text import Data.Time.Clock (UTCTime) -import Language.PureScript.Errors (ErrorMessage(..), MultipleErrors, SimpleErrorMessage(..), singleError) +import Language.PureScript.Errors (ErrorMessage (..), MultipleErrors, SimpleErrorMessage (..), singleError) import Language.PureScript.Externs (ExternsFile, externsIsCurrentVersion) import Language.PureScript.Make.Cache (ContentHash, hash) import Language.PureScript.Options (Options) import System.Directory (createDirectoryIfMissing, getModificationTime) import System.Directory qualified as Directory import System.FilePath (takeDirectory) -import System.IO.Error (tryIOError, isDoesNotExistError) +import System.IO.Error (isDoesNotExistError, tryIOError) import System.IO.UTF8 (readUTF8FileT) -- | A monad for running make actions newtype Make a = Make { unMake :: ReaderT Options (ExceptT MultipleErrors (Logger MultipleErrors)) a - } deriving (Functor, Applicative, Monad, MonadIO, MonadError MultipleErrors, MonadWriter MultipleErrors, MonadReader Options) + } + deriving (Functor, Applicative, Monad, MonadIO, MonadError MultipleErrors, MonadWriter MultipleErrors, MonadReader Options) instance MonadBase IO Make where liftBase = liftIO @@ -65,60 +66,67 @@ instance MonadBaseControl IO Make where runMake :: Options -> Make a -> IO (Either MultipleErrors a, MultipleErrors) runMake opts = runLogger' . runExceptT . flip runReaderT opts . unMake --- | Run an 'IO' action in the 'Make' monad. The 'String' argument should --- describe what we were trying to do; it is used for rendering errors in the --- case that an IOException is thrown. +{- | Run an 'IO' action in the 'Make' monad. The 'String' argument should +describe what we were trying to do; it is used for rendering errors in the +case that an IOException is thrown. +-} makeIO :: (MonadIO m, MonadError MultipleErrors m) => Text -> IO a -> m a makeIO description io = do res <- liftIO (tryIOError io) either (throwError . singleError . ErrorMessage [] . FileIOError description) pure res --- | Get a file's modification time in the 'Make' monad, capturing any errors --- using the 'MonadError' instance. +{- | Get a file's modification time in the 'Make' monad, capturing any errors +using the 'MonadError' instance. +-} getTimestamp :: (MonadIO m, MonadError MultipleErrors m) => FilePath -> m UTCTime getTimestamp path = makeIO ("get a timestamp for file: " <> Text.pack path) $ getModificationTime path --- | Get a file's modification time in the 'Make' monad, returning Nothing if --- the file does not exist. +{- | Get a file's modification time in the 'Make' monad, returning Nothing if +the file does not exist. +-} getTimestampMaybe :: (MonadIO m, MonadError MultipleErrors m) => FilePath -> m (Maybe UTCTime) getTimestampMaybe path = makeIO ("get a timestamp for file: " <> Text.pack path) $ catchDoesNotExist $ getModificationTime path --- | Read a text file strictly in the 'Make' monad, capturing any errors using --- the 'MonadError' instance. +{- | Read a text file strictly in the 'Make' monad, capturing any errors using +the 'MonadError' instance. +-} readTextFile :: (MonadIO m, MonadError MultipleErrors m) => FilePath -> m Text readTextFile path = makeIO ("read file: " <> Text.pack path) $ readUTF8FileT path --- | Read a JSON file in the 'Make' monad, returning 'Nothing' if the file does --- not exist or could not be parsed. Errors are captured using the 'MonadError' --- instance. -readJSONFile :: (MonadIO m, MonadError MultipleErrors m) => Aeson.FromJSON a => FilePath -> m (Maybe a) +{- | Read a JSON file in the 'Make' monad, returning 'Nothing' if the file does +not exist or could not be parsed. Errors are captured using the 'MonadError' +instance. +-} +readJSONFile :: (MonadIO m, MonadError MultipleErrors m) => (Aeson.FromJSON a) => FilePath -> m (Maybe a) readJSONFile path = makeIO ("read JSON file: " <> Text.pack path) (readJSONFileIO path) -readJSONFileIO :: Aeson.FromJSON a => FilePath -> IO (Maybe a) +readJSONFileIO :: (Aeson.FromJSON a) => FilePath -> IO (Maybe a) readJSONFileIO path = do r <- catchDoesNotExist $ Aeson.decodeFileStrict' path return $ join r --- | Read a Cbor encoded file in the 'Make' monad, returning --- 'Nothing' if the file does not exist or could not be parsed. Errors --- are captured using the 'MonadError' instance. -readCborFile :: (MonadIO m, MonadError MultipleErrors m) => Serialise a => FilePath -> m (Maybe a) +{- | Read a Cbor encoded file in the 'Make' monad, returning +'Nothing' if the file does not exist or could not be parsed. Errors +are captured using the 'MonadError' instance. +-} +readCborFile :: (MonadIO m, MonadError MultipleErrors m) => (Serialise a) => FilePath -> m (Maybe a) readCborFile path = makeIO ("read Binary file: " <> Text.pack path) (readCborFileIO path) -readCborFileIO :: Serialise a => FilePath -> IO (Maybe a) +readCborFileIO :: (Serialise a) => FilePath -> IO (Maybe a) readCborFileIO path = do r <- catchDoesNotExist $ catchDeserialiseFailure $ Serialise.readFileDeserialise path return (join r) --- | Read an externs file, returning 'Nothing' if the file does not exist, --- could not be parsed, or was generated by a different version of the --- compiler. +{- | Read an externs file, returning 'Nothing' if the file does not exist, +could not be parsed, or was generated by a different version of the +compiler. +-} readExternsFile :: (MonadIO m, MonadError MultipleErrors m) => FilePath -> m (Maybe ExternsFile) readExternsFile path = do mexterns <- readCborFile path @@ -129,11 +137,13 @@ readExternsFile path = do hashFile :: (MonadIO m, MonadError MultipleErrors m) => FilePath -> m ContentHash hashFile path = do - makeIO ("hash file: " <> Text.pack path) + makeIO + ("hash file: " <> Text.pack path) (hash <$> B.readFile path) --- | If the provided action threw an 'isDoesNotExist' error, catch it and --- return Nothing. Otherwise return Just the result of the inner action. +{- | If the provided action threw an 'isDoesNotExist' error, catch it and +return Nothing. Otherwise return Just the result of the inner action. +-} catchDoesNotExist :: IO a -> IO (Maybe a) catchDoesNotExist inner = do r <- tryJust (guard . isDoesNotExistError) inner @@ -152,31 +162,34 @@ catchDeserialiseFailure inner = do Right x -> return (Just x) --- | Write a text file in the 'Make' monad, capturing any errors using the --- 'MonadError' instance. +{- | Write a text file in the 'Make' monad, capturing any errors using the +'MonadError' instance. +-} writeTextFile :: FilePath -> B.ByteString -> Make () writeTextFile path text = makeIO ("write file: " <> Text.pack path) $ do createParentDirectory path B.writeFile path text --- | Write a JSON file in the 'Make' monad, capturing any errors using the --- 'MonadError' instance. -writeJSONFile :: (MonadIO m, MonadError MultipleErrors m) => Aeson.ToJSON a => FilePath -> a -> m () +{- | Write a JSON file in the 'Make' monad, capturing any errors using the +'MonadError' instance. +-} +writeJSONFile :: (MonadIO m, MonadError MultipleErrors m) => (Aeson.ToJSON a) => FilePath -> a -> m () writeJSONFile path value = makeIO ("write JSON file: " <> Text.pack path) $ do createParentDirectory path Aeson.encodeFile path value -writeCborFile :: (MonadIO m, MonadError MultipleErrors m) => Serialise a => FilePath -> a -> m () +writeCborFile :: (MonadIO m, MonadError MultipleErrors m) => (Serialise a) => FilePath -> a -> m () writeCborFile path value = makeIO ("write Cbor file: " <> Text.pack path) (writeCborFileIO path value) -writeCborFileIO :: Serialise a => FilePath -> a -> IO () +writeCborFileIO :: (Serialise a) => FilePath -> a -> IO () writeCborFileIO path value = do createParentDirectory path Serialise.writeFileSerialise path value --- | Copy a file in the 'Make' monad, capturing any errors using the --- 'MonadError' instance. +{- | Copy a file in the 'Make' monad, capturing any errors using the +'MonadError' instance. +-} copyFile :: (MonadIO m, MonadError MultipleErrors m) => FilePath -> FilePath -> m () copyFile src dest = makeIO ("copy file: " <> Text.pack src <> " -> " <> Text.pack dest) $ do diff --git a/src/Language/PureScript/ModuleDependencies.hs b/src/Language/PureScript/ModuleDependencies.hs index 3bcb914fb..080bb4f9f 100644 --- a/src/Language/PureScript/ModuleDependencies.hs +++ b/src/Language/PureScript/ModuleDependencies.hs @@ -1,21 +1,21 @@ -- | Provides the ability to sort modules based on module dependencies -module Language.PureScript.ModuleDependencies - ( DependencyDepth(..) - , sortModules - , ModuleGraph - , ModuleSignature(..) - , moduleSignature - ) where +module Language.PureScript.ModuleDependencies ( + DependencyDepth (..), + sortModules, + ModuleGraph, + ModuleSignature (..), + moduleSignature, +) where import Protolude hiding (head) import Data.Array ((!)) -import Data.Graph (SCC(..), graphFromEdges, reachable, stronglyConnComp) +import Data.Graph (SCC (..), graphFromEdges, reachable, stronglyConnComp) import Data.Set qualified as S -import Language.PureScript.AST (Declaration(..), ErrorMessageHint(..), Module(..), SourceSpan) +import Language.PureScript.AST (Declaration (..), ErrorMessageHint (..), Module (..), SourceSpan) import Language.PureScript.Constants.Prim qualified as C import Language.PureScript.Crash (internalError) -import Language.PureScript.Errors (MultipleErrors, SimpleErrorMessage(..), addHint, errorMessage', errorMessage'', parU) +import Language.PureScript.Errors (MultipleErrors, SimpleErrorMessage (..), addHint, errorMessage', errorMessage'', parU) import Language.PureScript.Names (ModuleName) -- | A list of modules with their transitive dependencies @@ -30,40 +30,42 @@ data ModuleSignature = ModuleSignature data DependencyDepth = Direct | Transitive --- | Sort a collection of modules based on module dependencies. --- --- Reports an error if the module graph contains a cycle. -sortModules - :: forall m a - . MonadError MultipleErrors m - => DependencyDepth - -> (a -> ModuleSignature) - -> [a] - -> m ([a], ModuleGraph) +{- | Sort a collection of modules based on module dependencies. + +Reports an error if the module graph contains a cycle. +-} +sortModules :: + forall m a. + (MonadError MultipleErrors m) => + DependencyDepth -> + (a -> ModuleSignature) -> + [a] -> + m ([a], ModuleGraph) sortModules dependencyDepth toSig ms = do - let - ms' = (\m -> (m, toSig m)) <$> ms - mns = S.fromList $ map (sigModuleName . snd) ms' - verts <- parU ms' (toGraphNode mns) - ms'' <- parU (stronglyConnComp verts) toModule - let (graph, fromVertex, toVertex) = graphFromEdges verts - moduleGraph = do (_, mn, _) <- verts - let v = fromMaybe (internalError "sortModules: vertex not found") (toVertex mn) - deps = case dependencyDepth of - Direct -> graph ! v - Transitive -> reachable graph v - toKey i = case fromVertex i of (_, key, _) -> key - return (mn, filter (/= mn) (map toKey deps)) - return (fst <$> ms'', moduleGraph) + let + ms' = (\m -> (m, toSig m)) <$> ms + mns = S.fromList $ map (sigModuleName . snd) ms' + verts <- parU ms' (toGraphNode mns) + ms'' <- parU (stronglyConnComp verts) toModule + let (graph, fromVertex, toVertex) = graphFromEdges verts + moduleGraph = do + (_, mn, _) <- verts + let v = fromMaybe (internalError "sortModules: vertex not found") (toVertex mn) + deps = case dependencyDepth of + Direct -> graph ! v + Transitive -> reachable graph v + toKey i = case fromVertex i of (_, key, _) -> key + return (mn, filter (/= mn) (map toKey deps)) + return (fst <$> ms'', moduleGraph) where toGraphNode :: S.Set ModuleName -> (a, ModuleSignature) -> m ((a, ModuleSignature), ModuleName, [ModuleName]) toGraphNode mns m@(_, ModuleSignature _ mn deps) = do void . parU deps $ \(dep, pos) -> - when (dep `notElem` C.primModules && S.notMember dep mns) . - throwError - . addHint (ErrorInModule mn) - . errorMessage' pos - $ ModuleNotFound dep + when (dep `notElem` C.primModules && S.notMember dep mns) + . throwError + . addHint (ErrorInModule mn) + . errorMessage' pos + $ ModuleNotFound dep pure (m, mn, map fst deps) -- | Calculate a list of used modules based on explicit imports and qualified names. @@ -74,7 +76,7 @@ usedModules (ImportDeclaration (ss, _) mn _ _) = pure (mn, ss) usedModules _ = Nothing -- | Convert a strongly connected component of the module graph to a module -toModule :: MonadError MultipleErrors m => SCC (a, ModuleSignature) -> m (a, ModuleSignature) +toModule :: (MonadError MultipleErrors m) => SCC (a, ModuleSignature) -> m (a, ModuleSignature) toModule (AcyclicSCC m) = return m toModule (CyclicSCC ms) = case nonEmpty ms of diff --git a/src/Language/PureScript/Names.hs b/src/Language/PureScript/Names.hs index e5df3610b..a6ac55c3e 100644 --- a/src/Language/PureScript/Names.hs +++ b/src/Language/PureScript/Names.hs @@ -1,24 +1,27 @@ +{-# LANGUAGE DerivingVia #-} +{-# LANGUAGE GeneralizedNewtypeDeriving #-} +{-# LANGUAGE StandaloneDeriving #-} {-# LANGUAGE TemplateHaskell #-} --- | --- Data types for names --- +{- | +Data types for names +-} module Language.PureScript.Names where import Prelude import Codec.Serialise (Serialise) import Control.Applicative ((<|>)) -import Control.Monad.Supply.Class (MonadSupply(..)) import Control.DeepSeq (NFData) +import Control.Monad.Supply.Class (MonadSupply (..)) import Data.Functor.Contravariant (contramap) import Data.Vector qualified as V -import GHC.Generics (Generic) -import Data.Aeson (FromJSON(..), FromJSONKey(..), Options(..), SumEncoding(..), ToJSON(..), ToJSONKey(..), defaultOptions, parseJSON2, toJSON2, withArray) +import Data.Aeson (FromJSON (..), FromJSONKey (..), Options (..), SumEncoding (..), ToJSON (..), ToJSONKey (..), defaultOptions, parseJSON2, toJSON2, withArray) import Data.Aeson.TH (deriveJSON) import Data.Text (Text) import Data.Text qualified as T +import GHC.Generics (Generic) import Language.PureScript.AST.SourcePos (SourcePos, pattern SourcePos) @@ -60,41 +63,38 @@ getClassName :: Name -> Maybe (ProperName 'ClassName) getClassName (TyClassName name) = Just name getClassName _ = Nothing --- | --- This type is meant to be extended with any new uses for idents that come --- along. Adding constructors to this type is cheaper than adding them to --- `Ident` because functions that match on `Ident` can ignore all --- `InternalIdent`s with a single pattern, and thus don't have to change if --- a new `InternalIdentData` constructor is created. --- +{- | +This type is meant to be extended with any new uses for idents that come +along. Adding constructors to this type is cheaper than adding them to +`Ident` because functions that match on `Ident` can ignore all +`InternalIdent`s with a single pattern, and thus don't have to change if +a new `InternalIdentData` constructor is created. +-} data InternalIdentData - -- Used by CoreFn.Laziness - = RuntimeLazyFactory | Lazy !Text + = -- Used by CoreFn.Laziness + RuntimeLazyFactory + | Lazy !Text deriving (Show, Eq, Ord, Generic) instance NFData InternalIdentData instance Serialise InternalIdentData --- | --- Names for value identifiers --- +{- | +Names for value identifiers +-} data Ident - -- | - -- An alphanumeric identifier - -- - = Ident Text - -- | - -- A generated name for an identifier - -- - | GenIdent (Maybe Text) Integer - -- | - -- A generated name used only for type-checking - -- - | UnusedIdent - -- | - -- A generated name used only for internal transformations - -- - | InternalIdent !InternalIdentData + = -- | + -- An alphanumeric identifier + Ident Text + | -- | + -- A generated name for an identifier + GenIdent (Maybe Text) Integer + | -- | + -- A generated name used only for type-checking + UnusedIdent + | -- | + -- A generated name used only for internal transformations + InternalIdent !InternalIdentData deriving (Show, Eq, Ord, Generic) instance NFData Ident @@ -106,27 +106,27 @@ unusedIdent = "$__unused" runIdent :: Ident -> Text runIdent (Ident i) = i runIdent (GenIdent Nothing n) = "$" <> T.pack (show n) -runIdent (GenIdent (Just name) n) = "$" <> name <> T.pack (show n) +runIdent (GenIdent (Just name) n) = "$" <> name <> "%" <> T.pack (show n) runIdent UnusedIdent = unusedIdent -runIdent InternalIdent{} = error "unexpected InternalIdent" +runIdent InternalIdent {} = error "unexpected InternalIdent" showIdent :: Ident -> Text showIdent = runIdent -freshIdent :: MonadSupply m => Text -> m Ident +freshIdent :: (MonadSupply m) => Text -> m Ident freshIdent name = GenIdent (Just name) <$> fresh -freshIdent' :: MonadSupply m => m Ident +freshIdent' :: (MonadSupply m) => m Ident freshIdent' = GenIdent Nothing <$> fresh isPlainIdent :: Ident -> Bool -isPlainIdent Ident{} = True +isPlainIdent Ident {} = True isPlainIdent _ = False --- | --- Operator alias names. --- -newtype OpName (a :: OpNameType) = OpName { runOpName :: Text } +{- | +Operator alias names. +-} +newtype OpName (a :: OpNameType) = OpName {runOpName :: Text} deriving (Show, Eq, Ord, Generic) instance NFData (OpName a) @@ -141,9 +141,9 @@ instance FromJSON (OpName a) where showOp :: OpName a -> Text showOp op = "(" <> runOpName op <> ")" --- | --- The closed set of operator alias types. --- +{- | +The closed set of operator alias types. +-} data OpNameType = ValueOpName | TypeOpName | AnyOpName eraseOpName :: OpName a -> OpName 'AnyOpName @@ -152,11 +152,12 @@ eraseOpName = OpName . runOpName coerceOpName :: OpName a -> OpName b coerceOpName = OpName . runOpName --- | --- Proper names, i.e. capitalized names for e.g. module names, type//data constructors. --- -newtype ProperName (a :: ProperNameType) = ProperName { runProperName :: Text } +{- | +Proper names, i.e. capitalized names for e.g. module names, type//data constructors. +-} +newtype ProperName (a :: ProperNameType) = ProperName {runProperName :: Text} deriving (Show, Eq, Ord, Generic) + deriving newtype (ToJSONKey, FromJSONKey) instance NFData (ProperName a) instance Serialise (ProperName a) @@ -167,29 +168,29 @@ instance ToJSON (ProperName a) where instance FromJSON (ProperName a) where parseJSON = fmap ProperName . parseJSON --- | --- The closed set of proper name types. --- +{- | +The closed set of proper name types. +-} data ProperNameType = TypeName | ConstructorName | ClassName | Namespace --- | --- Coerces a ProperName from one ProperNameType to another. This should be used --- with care, and is primarily used to convert ClassNames into TypeNames after --- classes have been desugared. --- +{- | +Coerces a ProperName from one ProperNameType to another. This should be used +with care, and is primarily used to convert ClassNames into TypeNames after +classes have been desugared. +-} coerceProperName :: ProperName a -> ProperName b coerceProperName = ProperName . runProperName --- | --- Module names --- +{- | +Module names +-} newtype ModuleName = ModuleName Text deriving (Show, Eq, Ord, Generic) - deriving newtype Serialise + deriving newtype (Serialise) instance NFData ModuleName @@ -207,9 +208,15 @@ data QualifiedBy | ByModuleName ModuleName deriving (Show, Eq, Ord, Generic) +instance ToJSON QualifiedBy +instance FromJSON QualifiedBy + pattern ByNullSourcePos :: QualifiedBy pattern ByNullSourcePos = BySourcePos (SourcePos 0 0) +pattern ByThisModuleName :: Text -> QualifiedBy +pattern ByThisModuleName t = ByModuleName (ModuleName t) + instance NFData QualifiedBy instance Serialise QualifiedBy @@ -225,32 +232,32 @@ toMaybeModuleName :: QualifiedBy -> Maybe ModuleName toMaybeModuleName (ByModuleName mn) = Just mn toMaybeModuleName (BySourcePos _) = Nothing --- | --- A qualified name, i.e. a name with an optional module name --- +{- | +A qualified name, i.e. a name with an optional module name +-} data Qualified a = Qualified QualifiedBy a deriving (Show, Eq, Ord, Functor, Foldable, Traversable, Generic) -instance NFData a => NFData (Qualified a) -instance Serialise a => Serialise (Qualified a) +instance (NFData a) => NFData (Qualified a) +instance (Serialise a) => Serialise (Qualified a) showQualified :: (a -> Text) -> Qualified a -> Text -showQualified f (Qualified (BySourcePos _) a) = f a +showQualified f (Qualified (BySourcePos _) a) = f a showQualified f (Qualified (ByModuleName name) a) = runModuleName name <> "." <> f a getQual :: Qualified a -> Maybe ModuleName getQual (Qualified qb _) = toMaybeModuleName qb --- | --- Provide a default module name, if a name is unqualified --- +{- | +Provide a default module name, if a name is unqualified +-} qualify :: ModuleName -> Qualified a -> (ModuleName, a) qualify m (Qualified (BySourcePos _) a) = (m, a) qualify _ (Qualified (ByModuleName m) a) = (m, a) --- | --- Makes a qualified value from a name and module name. --- +{- | +Makes a qualified value from a name and module name. +-} mkQualified :: a -> ModuleName -> Qualified a mkQualified name mn = Qualified (ByModuleName mn) name @@ -258,51 +265,51 @@ mkQualified name mn = Qualified (ByModuleName mn) name disqualify :: Qualified a -> a disqualify (Qualified _ a) = a --- | --- Remove the qualification from a value when it is qualified with a particular --- module name. --- +{- | +Remove the qualification from a value when it is qualified with a particular +module name. +-} disqualifyFor :: Maybe ModuleName -> Qualified a -> Maybe a disqualifyFor mn (Qualified qb a) | mn == toMaybeModuleName qb = Just a disqualifyFor _ _ = Nothing --- | --- Checks whether a qualified value is actually qualified with a module reference --- +{- | +Checks whether a qualified value is actually qualified with a module reference +-} isQualified :: Qualified a -> Bool -isQualified (Qualified (BySourcePos _) _) = False +isQualified (Qualified (BySourcePos _) _) = False isQualified _ = True --- | --- Checks whether a qualified value is not actually qualified with a module reference --- +{- | +Checks whether a qualified value is not actually qualified with a module reference +-} isUnqualified :: Qualified a -> Bool isUnqualified = not . isQualified --- | --- Checks whether a qualified value is qualified with a particular module --- +{- | +Checks whether a qualified value is qualified with a particular module +-} isQualifiedWith :: ModuleName -> Qualified a -> Bool isQualifiedWith mn (Qualified (ByModuleName mn') _) = mn == mn' isQualifiedWith _ _ = False -instance ToJSON a => ToJSON (Qualified a) where +instance (ToJSON a) => ToJSON (Qualified a) where toJSON (Qualified qb a) = case qb of ByModuleName mn -> toJSON2 (mn, a) BySourcePos ss -> toJSON2 (ss, a) -instance FromJSON a => FromJSON (Qualified a) where +instance (FromJSON a) => FromJSON (Qualified a) where parseJSON v = byModule <|> bySourcePos <|> byMaybeModuleName' where - byModule = do - (mn, a) <- parseJSON2 v - pure $ Qualified (ByModuleName mn) a - bySourcePos = do - (ss, a) <- parseJSON2 v - pure $ Qualified (BySourcePos ss) a - byMaybeModuleName' = do - (mn, a) <- parseJSON2 v - pure $ Qualified (byMaybeModuleName mn) a + byModule = do + (mn, a) <- parseJSON2 v + pure $ Qualified (ByModuleName mn) a + bySourcePos = do + (ss, a) <- parseJSON2 v + pure $ Qualified (BySourcePos ss) a + byMaybeModuleName' = do + (mn, a) <- parseJSON2 v + pure $ Qualified (byMaybeModuleName mn) a instance ToJSON ModuleName where toJSON (ModuleName name) = toJSON (T.splitOn "." name) @@ -318,5 +325,12 @@ instance ToJSONKey ModuleName where instance FromJSONKey ModuleName where fromJSONKey = fmap moduleNameFromString fromJSONKey -$(deriveJSON (defaultOptions { sumEncoding = ObjectWithSingleField }) ''InternalIdentData) -$(deriveJSON (defaultOptions { sumEncoding = ObjectWithSingleField }) ''Ident) +$(deriveJSON (defaultOptions {sumEncoding = ObjectWithSingleField}) ''InternalIdentData) +$(deriveJSON (defaultOptions {sumEncoding = ObjectWithSingleField}) ''Ident) + +instance ToJSONKey (Qualified (ProperName 'TypeName)) +instance ToJSONKey (Qualified (ProperName 'ConstructorName)) +instance ToJSONKey (Qualified Ident) +instance FromJSONKey (Qualified Ident) +instance FromJSONKey (Qualified (ProperName 'TypeName)) +instance FromJSONKey (Qualified (ProperName 'ConstructorName)) diff --git a/src/Language/PureScript/Options.hs b/src/Language/PureScript/Options.hs index d94d344cf..88b691a9c 100644 --- a/src/Language/PureScript/Options.hs +++ b/src/Language/PureScript/Options.hs @@ -1,10 +1,10 @@ -- | The data type of compiler options module Language.PureScript.Options where -import Prelude -import Data.Set qualified as S import Data.Map (Map) import Data.Map qualified as Map +import Data.Set qualified as S +import Prelude -- | The data type of compiler options data Options = Options @@ -14,19 +14,27 @@ data Options = Options -- ^ Remove the comments from the generated js , optionsCodegenTargets :: S.Set CodegenTarget -- ^ Codegen targets (JS, CoreFn, etc.) - } deriving Show + } + deriving (Show) -- Default make options defaultOptions :: Options -defaultOptions = Options False False (S.singleton JS) +defaultOptions = Options False False (S.singleton CoreFn) -data CodegenTarget = JS | JSSourceMap | CoreFn | Docs +data CodegenTarget + = Docs + | CoreFn + | {- N.B. We need a compilation mode that tests for changes from existing serialized CoreFn. + This is the easiest way to implement that (though maybe we should do something else for the final version) + -} + CheckCoreFn deriving (Eq, Ord, Show) codegenTargets :: Map String CodegenTarget -codegenTargets = Map.fromList - [ ("js", JS) - , ("sourcemaps", JSSourceMap) - , ("corefn", CoreFn) - , ("docs", Docs) - ] +codegenTargets = + Map.fromList + [ ("coreFn", CoreFn) + , ("checkCoreFn", CheckCoreFn) + , -- , ("corefn", CoreFn) + ("docs", Docs) + ] diff --git a/src/Language/PureScript/PSString.hs b/src/Language/PureScript/PSString.hs index 2ceb48118..3c374e33b 100644 --- a/src/Language/PureScript/PSString.hs +++ b/src/Language/PureScript/PSString.hs @@ -1,55 +1,58 @@ -module Language.PureScript.PSString - ( PSString - , toUTF16CodeUnits - , decodeString - , decodeStringEither - , decodeStringWithReplacement - , prettyPrintString - , prettyPrintStringJS - , mkString - ) where +{-# LANGUAGE DeriveLift #-} + +module Language.PureScript.PSString ( + PSString, + toUTF16CodeUnits, + decodeString, + decodeStringEither, + decodeStringWithReplacement, + prettyPrintString, + prettyPrintStringJS, + mkString, +) where -import Prelude -import GHC.Generics (Generic) import Codec.Serialise (Serialise) -import Control.DeepSeq (NFData) -import Control.Exception (try, evaluate) import Control.Applicative ((<|>)) -import Data.Char qualified as Char +import Control.DeepSeq (NFData) +import Control.Exception (evaluate, try) +import Data.Aeson qualified as A +import Data.Aeson.Types qualified as A import Data.Bits (shiftR) +import Data.ByteString (ByteString) +import Data.ByteString qualified as BS +import Data.Char qualified as Char import Data.Either (fromRight) import Data.List (unfoldr) import Data.Scientific (toBoundedInteger) -import Data.String (IsString(..)) -import Data.ByteString (ByteString) -import Data.ByteString qualified as BS +import Data.String (IsString (..)) import Data.Text (Text) import Data.Text qualified as T import Data.Text.Encoding (decodeUtf16BE) import Data.Text.Encoding.Error (UnicodeException) import Data.Vector qualified as V import Data.Word (Word16, Word8) +import GHC.Generics (Generic) import Numeric (showHex) import System.IO.Unsafe (unsafePerformIO) -import Data.Aeson qualified as A -import Data.Aeson.Types qualified as A +import Prelude +import Language.Haskell.TH.Syntax (Lift) + +{- | +Strings in PureScript are sequences of UTF-16 code units, which do not +necessarily represent UTF-16 encoded text. For example, it is permissible +for a string to contain *lone surrogates,* i.e. characters in the range +U+D800 to U+DFFF which do not appear as a part of a surrogate pair. + +The Show instance for PSString produces a string literal which would +represent the same data were it inserted into a PureScript source file. --- | --- Strings in PureScript are sequences of UTF-16 code units, which do not --- necessarily represent UTF-16 encoded text. For example, it is permissible --- for a string to contain *lone surrogates,* i.e. characters in the range --- U+D800 to U+DFFF which do not appear as a part of a surrogate pair. --- --- The Show instance for PSString produces a string literal which would --- represent the same data were it inserted into a PureScript source file. --- --- Because JSON parsers vary wildly in terms of how they deal with lone --- surrogates in JSON strings, the ToJSON instance for PSString produces JSON --- strings where that would be safe (i.e. when there are no lone surrogates), --- and arrays of UTF-16 code units (integers) otherwise. --- -newtype PSString = PSString { toUTF16CodeUnits :: [Word16] } - deriving (Eq, Ord, Semigroup, Monoid, Generic) +Because JSON parsers vary wildly in terms of how they deal with lone +surrogates in JSON strings, the ToJSON instance for PSString produces JSON +strings where that would be safe (i.e. when there are no lone surrogates), +and arrays of UTF-16 code units (integers) otherwise. +-} +newtype PSString = PSString {toUTF16CodeUnits :: [Word16]} + deriving (Eq, Ord, Semigroup, Monoid, Generic, Lift) instance NFData PSString instance Serialise PSString @@ -57,75 +60,77 @@ instance Serialise PSString instance Show PSString where show = show . codePoints --- | --- Decode a PSString to a String, representing any lone surrogates as the --- reserved code point with that index. Warning: if there are any lone --- surrogates, converting the result to Text via Data.Text.pack will result in --- loss of information as those lone surrogates will be replaced with U+FFFD --- REPLACEMENT CHARACTER. Because this function requires care to use correctly, --- we do not export it. --- +{- | +Decode a PSString to a String, representing any lone surrogates as the +reserved code point with that index. Warning: if there are any lone +surrogates, converting the result to Text via Data.Text.pack will result in +loss of information as those lone surrogates will be replaced with U+FFFD +REPLACEMENT CHARACTER. Because this function requires care to use correctly, +we do not export it. +-} codePoints :: PSString -> String codePoints = map (either (Char.chr . fromIntegral) id) . decodeStringEither --- | --- Decode a PSString as UTF-16 text. Lone surrogates will be replaced with --- U+FFFD REPLACEMENT CHARACTER --- +{- | +Decode a PSString as UTF-16 text. Lone surrogates will be replaced with +U+FFFD REPLACEMENT CHARACTER +-} decodeStringWithReplacement :: PSString -> String decodeStringWithReplacement = map (fromRight '\xFFFD') . decodeStringEither --- | --- Decode a PSString as UTF-16. Lone surrogates in the input are represented in --- the output with the Left constructor; characters which were successfully --- decoded are represented with the Right constructor. --- +{- | +Decode a PSString as UTF-16. Lone surrogates in the input are represented in +the output with the Left constructor; characters which were successfully +decoded are represented with the Right constructor. +-} decodeStringEither :: PSString -> [Either Word16 Char] decodeStringEither = unfoldr decode . toUTF16CodeUnits where - decode :: [Word16] -> Maybe (Either Word16 Char, [Word16]) - decode (h:l:rest) | isLead h && isTrail l = Just (Right (unsurrogate h l), rest) - decode (c:rest) | isSurrogate c = Just (Left c, rest) - decode (c:rest) = Just (Right (toChar c), rest) - decode [] = Nothing - - unsurrogate :: Word16 -> Word16 -> Char - unsurrogate h l = toEnum ((toInt h - 0xD800) * 0x400 + (toInt l - 0xDC00) + 0x10000) - --- | --- Attempt to decode a PSString as UTF-16 text. This will fail (returning --- Nothing) if the argument contains lone surrogates. --- + decode :: [Word16] -> Maybe (Either Word16 Char, [Word16]) + decode (h : l : rest) | isLead h && isTrail l = Just (Right (unsurrogate h l), rest) + decode (c : rest) | isSurrogate c = Just (Left c, rest) + decode (c : rest) = Just (Right (toChar c), rest) + decode [] = Nothing + + unsurrogate :: Word16 -> Word16 -> Char + unsurrogate h l = toEnum ((toInt h - 0xD800) * 0x400 + (toInt l - 0xDC00) + 0x10000) + +{- | +Attempt to decode a PSString as UTF-16 text. This will fail (returning +Nothing) if the argument contains lone surrogates. +-} decodeString :: PSString -> Maybe Text decodeString = hush . decodeEither . BS.pack . concatMap unpair . toUTF16CodeUnits where - unpair w = [highByte w, lowByte w] + unpair w = [highByte w, lowByte w] - lowByte :: Word16 -> Word8 - lowByte = fromIntegral + lowByte :: Word16 -> Word8 + lowByte = fromIntegral - highByte :: Word16 -> Word8 - highByte = fromIntegral . (`shiftR` 8) + highByte :: Word16 -> Word8 + highByte = fromIntegral . (`shiftR` 8) - -- Based on a similar function from Data.Text.Encoding for utf8. This is a - -- safe usage of unsafePerformIO because there are no side effects after - -- handling any thrown UnicodeExceptions. - decodeEither :: ByteString -> Either UnicodeException Text - decodeEither = unsafePerformIO . try . evaluate . decodeUtf16BE + -- Based on a similar function from Data.Text.Encoding for utf8. This is a + -- safe usage of unsafePerformIO because there are no side effects after + -- handling any thrown UnicodeExceptions. + decodeEither :: ByteString -> Either UnicodeException Text + decodeEither = unsafePerformIO . try . evaluate . decodeUtf16BE - hush = either (const Nothing) Just + hush = either (const Nothing) Just instance IsString PSString where fromString a = PSString $ concatMap encodeUTF16 a where - surrogates :: Char -> (Word16, Word16) - surrogates c = (toWord (h + 0xD800), toWord (l + 0xDC00)) - where (h, l) = divMod (fromEnum c - 0x10000) 0x400 + surrogates :: Char -> (Word16, Word16) + surrogates c = (toWord (h + 0xD800), toWord (l + 0xDC00)) + where + (h, l) = divMod (fromEnum c - 0x10000) 0x400 - encodeUTF16 :: Char -> [Word16] - encodeUTF16 c | fromEnum c > 0xFFFF = [high, low] - where (high, low) = surrogates c - encodeUTF16 c = [toWord $ fromEnum c] + encodeUTF16 :: Char -> [Word16] + encodeUTF16 c | fromEnum c > 0xFFFF = [high, low] + where + (high, low) = surrogates c + encodeUTF16 c = [toWord $ fromEnum c] instance A.ToJSON PSString where toJSON str = @@ -136,87 +141,87 @@ instance A.ToJSON PSString where instance A.FromJSON PSString where parseJSON a = jsonString <|> arrayOfCodeUnits where - jsonString = fromString <$> A.parseJSON a + jsonString = fromString <$> A.parseJSON a - arrayOfCodeUnits = PSString <$> parseArrayOfCodeUnits a + arrayOfCodeUnits = PSString <$> parseArrayOfCodeUnits a - parseArrayOfCodeUnits :: A.Value -> A.Parser [Word16] - parseArrayOfCodeUnits = A.withArray "array of UTF-16 code units" (traverse parseCodeUnit . V.toList) + parseArrayOfCodeUnits :: A.Value -> A.Parser [Word16] + parseArrayOfCodeUnits = A.withArray "array of UTF-16 code units" (traverse parseCodeUnit . V.toList) - parseCodeUnit :: A.Value -> A.Parser Word16 - parseCodeUnit b = A.withScientific "two-byte non-negative integer" (maybe (A.typeMismatch "" b) return . toBoundedInteger) b + parseCodeUnit :: A.Value -> A.Parser Word16 + parseCodeUnit b = A.withScientific "two-byte non-negative integer" (maybe (A.typeMismatch "" b) return . toBoundedInteger) b --- | --- Pretty print a PSString, using PureScript escape sequences. --- +{- | +Pretty print a PSString, using PureScript escape sequences. +-} prettyPrintString :: PSString -> Text prettyPrintString s = "\"" <> foldMap encodeChar (decodeStringEither s) <> "\"" where - encodeChar :: Either Word16 Char -> Text - encodeChar (Left c) = "\\x" <> showHex' 6 c - encodeChar (Right c) - | c == '\t' = "\\t" - | c == '\r' = "\\r" - | c == '\n' = "\\n" - | c == '"' = "\\\"" - | c == '\'' = "\\\'" - | c == '\\' = "\\\\" - | shouldPrint c = T.singleton c - | otherwise = "\\x" <> showHex' 6 (Char.ord c) - - -- Note we do not use Data.Char.isPrint here because that includes things - -- like zero-width spaces and combining punctuation marks, which could be - -- confusing to print unescaped. - shouldPrint :: Char -> Bool - -- The standard space character, U+20 SPACE, is the only space char we should - -- print without escaping - shouldPrint ' ' = True - shouldPrint c = - Char.generalCategory c `elem` - [ Char.UppercaseLetter - , Char.LowercaseLetter - , Char.TitlecaseLetter - , Char.OtherLetter - , Char.DecimalNumber - , Char.LetterNumber - , Char.OtherNumber - , Char.ConnectorPunctuation - , Char.DashPunctuation - , Char.OpenPunctuation - , Char.ClosePunctuation - , Char.InitialQuote - , Char.FinalQuote - , Char.OtherPunctuation - , Char.MathSymbol - , Char.CurrencySymbol - , Char.ModifierSymbol - , Char.OtherSymbol - ] - --- | --- Pretty print a PSString, using JavaScript escape sequences. Intended for --- use in compiled JS output. --- + encodeChar :: Either Word16 Char -> Text + encodeChar (Left c) = "\\x" <> showHex' 6 c + encodeChar (Right c) + | c == '\t' = "\\t" + | c == '\r' = "\\r" + | c == '\n' = "\\n" + | c == '"' = "\\\"" + | c == '\'' = "\\\'" + | c == '\\' = "\\\\" + | shouldPrint c = T.singleton c + | otherwise = "\\x" <> showHex' 6 (Char.ord c) + + -- Note we do not use Data.Char.isPrint here because that includes things + -- like zero-width spaces and combining punctuation marks, which could be + -- confusing to print unescaped. + shouldPrint :: Char -> Bool + -- The standard space character, U+20 SPACE, is the only space char we should + -- print without escaping + shouldPrint ' ' = True + shouldPrint c = + Char.generalCategory c + `elem` [ Char.UppercaseLetter + , Char.LowercaseLetter + , Char.TitlecaseLetter + , Char.OtherLetter + , Char.DecimalNumber + , Char.LetterNumber + , Char.OtherNumber + , Char.ConnectorPunctuation + , Char.DashPunctuation + , Char.OpenPunctuation + , Char.ClosePunctuation + , Char.InitialQuote + , Char.FinalQuote + , Char.OtherPunctuation + , Char.MathSymbol + , Char.CurrencySymbol + , Char.ModifierSymbol + , Char.OtherSymbol + ] + +{- | +Pretty print a PSString, using JavaScript escape sequences. Intended for +use in compiled JS output. +-} prettyPrintStringJS :: PSString -> Text prettyPrintStringJS s = "\"" <> foldMap encodeChar (toUTF16CodeUnits s) <> "\"" where - encodeChar :: Word16 -> Text - encodeChar c | c > 0xFF = "\\u" <> showHex' 4 c - encodeChar c | c > 0x7E || c < 0x20 = "\\x" <> showHex' 2 c - encodeChar c | toChar c == '\b' = "\\b" - encodeChar c | toChar c == '\t' = "\\t" - encodeChar c | toChar c == '\n' = "\\n" - encodeChar c | toChar c == '\v' = "\\v" - encodeChar c | toChar c == '\f' = "\\f" - encodeChar c | toChar c == '\r' = "\\r" - encodeChar c | toChar c == '"' = "\\\"" - encodeChar c | toChar c == '\\' = "\\\\" - encodeChar c = T.singleton $ toChar c - -showHex' :: Enum a => Int -> a -> Text + encodeChar :: Word16 -> Text + encodeChar c | c > 0xFF = "\\u" <> showHex' 4 c + encodeChar c | c > 0x7E || c < 0x20 = "\\x" <> showHex' 2 c + encodeChar c | toChar c == '\b' = "\\b" + encodeChar c | toChar c == '\t' = "\\t" + encodeChar c | toChar c == '\n' = "\\n" + encodeChar c | toChar c == '\v' = "\\v" + encodeChar c | toChar c == '\f' = "\\f" + encodeChar c | toChar c == '\r' = "\\r" + encodeChar c | toChar c == '"' = "\\\"" + encodeChar c | toChar c == '\\' = "\\\\" + encodeChar c = T.singleton $ toChar c + +showHex' :: (Enum a) => Int -> a -> Text showHex' width c = - let hs = showHex (fromEnum c) "" in - T.pack (replicate (width - length hs) '0' <> hs) + let hs = showHex (fromEnum c) "" + in T.pack (replicate (width - length hs) '0' <> hs) isLead :: Word16 -> Bool isLead h = h >= 0xD800 && h <= 0xDBFF diff --git a/src/Language/PureScript/Pretty.hs b/src/Language/PureScript/Pretty.hs index 87c42cf75..15d924aea 100644 --- a/src/Language/PureScript/Pretty.hs +++ b/src/Language/PureScript/Pretty.hs @@ -1,12 +1,13 @@ --- | A collection of pretty printers for core data types: --- --- * [@Language.PureScript.Pretty.Kinds@] Pretty printer for kinds --- --- * [@Language.PureScript.Pretty.Values@] Pretty printer for values --- --- * [@Language.PureScript.Pretty.Types@] Pretty printer for types +{- | A collection of pretty printers for core data types: + +* [@Language.PureScript.Pretty.Kinds@] Pretty printer for kinds + +* [@Language.PureScript.Pretty.Values@] Pretty printer for values + +* [@Language.PureScript.Pretty.Types@] Pretty printer for types +-} module Language.PureScript.Pretty (module P) where +import Language.PureScript.PSString as P (prettyPrintString) import Language.PureScript.Pretty.Types as P import Language.PureScript.Pretty.Values as P -import Language.PureScript.PSString as P (prettyPrintString) diff --git a/src/Language/PureScript/Pretty/Common.hs b/src/Language/PureScript/Pretty/Common.hs index a62e776ca..c75f2b790 100644 --- a/src/Language/PureScript/Pretty/Common.hs +++ b/src/Language/PureScript/Pretty/Common.hs @@ -1,20 +1,20 @@ --- | --- Common pretty-printing utility functions --- +{- | +Common pretty-printing utility functions +-} module Language.PureScript.Pretty.Common where import Prelude -import Control.Monad.State (StateT, modify, get) +import Control.Monad.State (StateT, get, modify) import Data.List (elemIndices, intersperse) import Data.Text (Text) import Data.Text qualified as T -import Language.PureScript.AST (SourcePos(..), SourceSpan(..), nullSourceSpan) +import Language.PureScript.AST (SourcePos (..), SourceSpan (..), nullSourceSpan) import Language.PureScript.CST.Lexer (isUnquotedKey) -import Text.PrettyPrint.Boxes (Box(..), emptyBox, text, top, vcat, (//)) +import Text.PrettyPrint.Boxes (Box (..), emptyBox, text, top, vcat, (//)) import Text.PrettyPrint.Boxes qualified as Box parensT :: Text -> Text @@ -23,10 +23,10 @@ parensT s = "(" <> s <> ")" parensPos :: (Emit gen) => gen -> gen parensPos s = emit "(" <> s <> emit ")" --- | --- Generalize intercalate slightly for monoids --- -intercalate :: Monoid m => m -> [m] -> m +{- | +Generalize intercalate slightly for monoids +-} +intercalate :: (Monoid m) => m -> [m] -> m intercalate x xs = mconcat (intersperse x xs) class (Monoid gen) => Emit gen where @@ -35,27 +35,26 @@ class (Monoid gen) => Emit gen where data SMap = SMap Text SourcePos SourcePos --- | --- String with length and source-map entries --- +{- | +String with length and source-map entries +-} newtype StrPos = StrPos (SourcePos, Text, [SMap]) --- | --- Make a monoid where append consists of concatenating the string part, adding the lengths --- appropriately and advancing source mappings on the right hand side to account for --- the length of the left. --- +{- | +Make a monoid where append consists of concatenating the string part, adding the lengths +appropriately and advancing source mappings on the right hand side to account for +the length of the left. +-} instance Semigroup StrPos where - StrPos (a,b,c) <> StrPos (a',b',c') = StrPos (a `addPos` a', b <> b', c ++ (bumpPos a <$> c')) + StrPos (a, b, c) <> StrPos (a', b', c') = StrPos (a `addPos` a', b <> b', c ++ (bumpPos a <$> c')) instance Monoid StrPos where mempty = StrPos (SourcePos 0 0, "", []) mconcat ms = - let s' = foldMap (\(StrPos(_, s, _)) -> s) ms + let s' = foldMap (\(StrPos (_, s, _)) -> s) ms (p, maps) = foldl plus (SourcePos 0 0, []) ms - in - StrPos (p, s', concat $ reverse maps) + in StrPos (p, s', concat $ reverse maps) where plus :: (SourcePos, [[SMap]]) -> StrPos -> (SourcePos, [[SMap]]) plus (a, c) (StrPos (a', _, c')) = (a `addPos` a', (bumpPos a <$> c') : c) @@ -66,11 +65,10 @@ instance Emit StrPos where -- TODO(Christoph): get rid of T.unpack let newlines = elemIndices '\n' (T.unpack str) index = if null newlines then 0 else last newlines + 1 - in - StrPos (SourcePos { sourcePosLine = length newlines, sourcePosColumn = T.length str - index }, str, []) + in StrPos (SourcePos {sourcePosLine = length newlines, sourcePosColumn = T.length str - index}, str, []) -- Add a new mapping entry for given source position with initially zero generated position - addMapping ss@SourceSpan { spanName = file, spanStart = startPos } = StrPos (zeroPos, mempty, [ mapping | ss /= nullSourceSpan ]) + addMapping ss@SourceSpan {spanName = file, spanStart = startPos} = StrPos (zeroPos, mempty, [mapping | ss /= nullSourceSpan]) where mapping = SMap (T.pack file) startPos zeroPos zeroPos = SourcePos 0 0 @@ -95,28 +93,27 @@ addPos :: SourcePos -> SourcePos -> SourcePos addPos (SourcePos n m) (SourcePos 0 m') = SourcePos n (m + m') addPos (SourcePos n _) (SourcePos n' m') = SourcePos (n + n') m' +data PrinterState = PrinterState {indent :: Int} -data PrinterState = PrinterState { indent :: Int } - --- | --- Number of characters per indentation level --- +{- | +Number of characters per indentation level +-} blockIndent :: Int blockIndent = 4 --- | --- Pretty print with a new indentation level --- +{- | +Pretty print with a new indentation level +-} withIndent :: StateT PrinterState Maybe gen -> StateT PrinterState Maybe gen withIndent action = do - modify $ \st -> st { indent = indent st + blockIndent } + modify $ \st -> st {indent = indent st + blockIndent} result <- action - modify $ \st -> st { indent = indent st - blockIndent } + modify $ \st -> st {indent = indent st - blockIndent} return result --- | --- Get the current indentation level --- +{- | +Get the current indentation level +-} currentIndent :: (Emit gen) => StateT PrinterState Maybe gen currentIndent = do current <- get @@ -127,8 +124,9 @@ objectKeyRequiresQuoting = not . isUnquotedKey -- | Place a box before another, vertically when the first box takes up multiple lines. before :: Box -> Box -> Box -before b1 b2 | rows b1 > 1 = b1 // b2 - | otherwise = b1 Box.<> b2 +before b1 b2 + | rows b1 > 1 = b1 // b2 + | otherwise = b1 Box.<> b2 beforeWithSpace :: Box -> Box -> Box beforeWithSpace b1 = before (b1 Box.<> text " ") diff --git a/src/Language/PureScript/Pretty/Types.hs b/src/Language/PureScript/Pretty/Types.hs index 20de0ed9e..d58a7589d 100644 --- a/src/Language/PureScript/Pretty/Types.hs +++ b/src/Language/PureScript/Pretty/Types.hs @@ -1,40 +1,42 @@ --- | --- Pretty printer for Types --- -module Language.PureScript.Pretty.Types - ( PrettyPrintType(..) - , PrettyPrintConstraint - , convertPrettyPrintType - , typeAsBox - , typeDiffAsBox - , prettyPrintType - , prettyPrintTypeWithUnicode - , prettyPrintSuggestedType - , typeAtomAsBox - , prettyPrintTypeAtom - , prettyPrintLabel - , prettyPrintObjectKey - ) where +{- | +Pretty printer for Types +-} +module Language.PureScript.Pretty.Types ( + PrettyPrintType (..), + PrettyPrintConstraint, + convertPrettyPrintType, + typeAsBox, + typeDiffAsBox, + prettyPrintType, + prettyPrintTypeWithUnicode, + prettyPrintSuggestedType, + typeAtomAsBox, + prettyPrintTypeAtom, + prettyPrintLabel, + prettyPrintObjectKey, +) where import Prelude hiding ((<>)) +import Prelude qualified as P import Control.Arrow ((<+>)) -import Control.Lens (_2, (%~)) +import Control.Lens ((%~), _2) import Control.PatternArrows as PA -import Data.Maybe (fromMaybe, catMaybes) +import Data.Maybe (catMaybes, fromMaybe) import Data.Text (Text) import Data.Text qualified as T import Language.PureScript.Crash (internalError) import Language.PureScript.Environment (tyFunction, tyRecord) -import Language.PureScript.Names (OpName(..), OpNameType(..), ProperName(..), ProperNameType(..), Qualified, coerceProperName, disqualify, showQualified) +import Language.PureScript.Label (Label (..)) +import Language.PureScript.Names (OpName (..), OpNameType (..), ProperName (..), ProperNameType (..), Qualified, coerceProperName, disqualify, showQualified) +import Language.PureScript.PSString (PSString, decodeString, prettyPrintString) import Language.PureScript.Pretty.Common (before, objectKeyRequiresQuoting) -import Language.PureScript.Types (Constraint(..), pattern REmptyKinded, RowListItem(..), Type(..), TypeVarVisibility(..), WildcardData(..), eqType, rowToSortedList, typeVarVisibilityPrefix) -import Language.PureScript.PSString (PSString, prettyPrintString, decodeString) -import Language.PureScript.Label (Label(..)) +import Language.PureScript.Types (Constraint (..), RowListItem (..), Type (..), TypeVarVisibility (..), WildcardData (..), eqType, rowToSortedList, typeVarVisibilityPrefix, pattern REmptyKinded) -import Text.PrettyPrint.Boxes (Box(..), hcat, hsep, left, moveRight, nullBox, render, text, top, vcat, (<>)) +import Language.Purus.Pretty.Types (prettyTypeStr) +import Text.PrettyPrint.Boxes (Box (..), hcat, hsep, left, moveRight, nullBox, render, text, top, vcat, (<>)) data PrettyPrintType = PPTUnknown Int @@ -51,194 +53,196 @@ data PrettyPrintType | PPKindedType PrettyPrintType PrettyPrintType | PPBinaryNoParensType PrettyPrintType PrettyPrintType PrettyPrintType | PPParensInType PrettyPrintType - | PPForAll [(TypeVarVisibility, Text, Maybe PrettyPrintType)] PrettyPrintType + | PPForAll [(TypeVarVisibility, Text, PrettyPrintType)] PrettyPrintType | PPFunction PrettyPrintType PrettyPrintType | PPRecord [(Label, PrettyPrintType)] (Maybe PrettyPrintType) | PPRow [(Label, PrettyPrintType)] (Maybe PrettyPrintType) | PPTruncated + deriving (Show) type PrettyPrintConstraint = (Qualified (ProperName 'ClassName), [PrettyPrintType], [PrettyPrintType]) convertPrettyPrintType :: Int -> Type a -> PrettyPrintType convertPrettyPrintType = go where - go _ (TUnknown _ n) = PPTUnknown n - go _ (TypeVar _ t) = PPTypeVar t Nothing - go _ (TypeLevelString _ s) = PPTypeLevelString s - go _ (TypeLevelInt _ n) = PPTypeLevelInt n - go _ (TypeWildcard _ (HoleWildcard n)) = PPTypeWildcard (Just n) - go _ (TypeWildcard _ _) = PPTypeWildcard Nothing - go _ (TypeConstructor _ c) = PPTypeConstructor c - go _ (TypeOp _ o) = PPTypeOp o - go _ (Skolem _ t _ n _) = PPSkolem t n - go _ (REmpty _) = PPRow [] Nothing - -- Guard the remaining "complex" type atoms on the current depth value. The - -- prior constructors can all be printed simply so it's not really helpful to - -- truncate them. - go d _ | d < 0 = PPTruncated - go d (ConstrainedType _ (Constraint _ cls kargs args _) ty) = PPConstrainedType (cls, go (d-1) <$> kargs, go (d-1) <$> args) (go d ty) - go d (KindedType _ ty k) = PPKindedType (go (d-1) ty) (go (d-1) k) - go d (BinaryNoParensType _ ty1 ty2 ty3) = PPBinaryNoParensType (go (d-1) ty1) (go (d-1) ty2) (go (d-1) ty3) - go d (ParensInType _ ty) = PPParensInType (go (d-1) ty) - go d ty@RCons{} = uncurry PPRow (goRow d ty) - go d (ForAll _ vis v mbK ty _) = goForAll d [(vis, v, fmap (go (d-1)) mbK)] ty - go d (TypeApp _ a b) = goTypeApp d a b - go d (KindApp _ a b) = PPTypeApp (go (d-1) a) (PPKindArg (go (d-1) b)) - - goForAll d vs (ForAll _ vis v mbK ty _) = goForAll d ((vis, v, fmap (go (d-1)) mbK) : vs) ty - goForAll d vs ty = PPForAll (reverse vs) (go (d-1) ty) - - goRow d ty = - let (items, tail_) = rowToSortedList ty - in ( map (\item -> (rowListLabel item, go (d-1) (rowListType item))) items - , case tail_ of - REmptyKinded _ _ -> Nothing - _ -> Just (go (d-1) tail_) - ) - - goTypeApp d (TypeApp _ f a) b - | eqType f tyFunction = PPFunction (go (d-1) a) (go (d-1) b) - | otherwise = PPTypeApp (goTypeApp d f a) (go (d-1) b) - goTypeApp d o ty@RCons{} - | eqType o tyRecord = uncurry PPRecord (goRow d ty) - goTypeApp d a b = PPTypeApp (go (d-1) a) (go (d-1) b) + go _ (TUnknown _ n) = PPTUnknown n + go _ (TypeVar _ t _) = PPTypeVar t Nothing + go _ (TypeLevelString _ s) = PPTypeLevelString s + go _ (TypeLevelInt _ n) = PPTypeLevelInt n + go _ (TypeWildcard _ (HoleWildcard n)) = PPTypeWildcard (Just n) + go _ (TypeWildcard _ _) = PPTypeWildcard Nothing + go _ (TypeConstructor _ c) = PPTypeConstructor c + go _ (TypeOp _ o) = PPTypeOp o + go _ (Skolem _ t _ n _) = PPSkolem t n + go _ (REmpty _) = PPRow [] Nothing + -- Guard the remaining "complex" type atoms on the current depth value. The + -- prior constructors can all be printed simply so it's not really helpful to + -- truncate them. + -- go d _ | d < 0 = PPTruncated + go d (ConstrainedType _ (Constraint _ cls kargs args _) ty) = PPConstrainedType (cls, go (d - 1) <$> kargs, go (d - 1) <$> args) (go d ty) + go d (KindedType _ ty k) = PPKindedType (go (d - 1) ty) (go (d - 1) k) + go d (BinaryNoParensType _ ty1 ty2 ty3) = PPBinaryNoParensType (go (d - 1) ty1) (go (d - 1) ty2) (go (d - 1) ty3) + go d (ParensInType _ ty) = PPParensInType (go (d - 1) ty) + go d ty@RCons {} = uncurry PPRow (goRow d ty) + go d (ForAll _ vis v mbK ty _) = goForAll d [(vis, v, go (d - 1) mbK)] ty + go d (TypeApp _ a b) = goTypeApp d a b + go d (KindApp _ a b) = PPTypeApp (go (d - 1) a) (PPKindArg (go (d - 1) b)) + + goForAll d vs (ForAll _ vis v mbK ty _) = goForAll d ((vis, v, go (d - 1) mbK) : vs) ty + goForAll d vs ty = PPForAll (reverse vs) (go (d - 1) ty) + + goRow d ty = + let (items, tail_) = rowToSortedList ty + in ( map (\item -> (rowListLabel item, go (d - 1) (rowListType item))) items + , case tail_ of + REmptyKinded _ _ -> Nothing + _ -> Just (go (d - 1) tail_) + ) + + goTypeApp d (TypeApp _ f a) b + | eqType f tyFunction = PPFunction (go (d - 1) a) (go (d - 1) b) + | otherwise = PPTypeApp (goTypeApp d f a) (go (d - 1) b) + goTypeApp d o ty@RCons {} + | eqType o tyRecord = uncurry PPRecord (goRow d ty) + goTypeApp d a b = PPTypeApp (go (d - 1) a) (go (d - 1) b) -- TODO(Christoph): get rid of T.unpack s constraintsAsBox :: TypeRenderOptions -> PrettyPrintConstraint -> Box -> Box constraintsAsBox tro con ty = - constraintAsBox con `before` (" " <> text doubleRightArrow <> " " <> ty) + constraintAsBox con `before` (" " <> text doubleRightArrow <> " " <> ty) where doubleRightArrow = if troUnicode tro then "⇒" else "=>" constraintAsBox :: PrettyPrintConstraint -> Box constraintAsBox (pn, ks, tys) = typeAsBox' (foldl PPTypeApp (foldl (\a b -> PPTypeApp a (PPKindArg b)) (PPTypeConstructor (fmap coerceProperName pn)) ks) tys) --- | --- Generate a pretty-printed string representing a Row --- +{- | +Generate a pretty-printed string representing a Row +-} prettyPrintRowWith :: TypeRenderOptions -> Char -> Char -> [(Label, PrettyPrintType)] -> Maybe PrettyPrintType -> Box prettyPrintRowWith tro open close labels rest = case (labels, rest) of ([], Nothing) -> - if troRowAsDiff tro then text [ open, ' ' ] <> text "..." <> text [ ' ', close ] else text [ open, close ] + if troRowAsDiff tro then text [open, ' '] <> text "..." <> text [' ', close] else text [open, close] ([], Just _) -> - text [ open, ' ' ] <> tailToPs rest <> text [ ' ', close ] + text [open {-, ' ' -}] <> tailToPs rest <> text [' ' {-, close -}] _ -> vcat left $ - zipWith (\(nm, ty) i -> nameAndTypeToPs (if i == 0 then open else ',') nm ty) labels [0 :: Int ..] ++ - catMaybes [ rowDiff, pure $ tailToPs rest, pure $ text [close] ] - + zipWith (\(nm, ty) i -> nameAndTypeToPs (if i == 0 then open else ',') nm ty) labels [0 :: Int ..] + ++ catMaybes [rowDiff, pure $ tailToPs rest, pure $ text [close]] where - nameAndTypeToPs :: Char -> Label -> PrettyPrintType -> Box - nameAndTypeToPs start name ty = text (start : ' ' : T.unpack (prettyPrintLabel name) ++ " " ++ doubleColon ++ " ") <> typeAsBox' ty + nameAndTypeToPs :: Char -> Label -> PrettyPrintType -> Box + nameAndTypeToPs start name ty = text (start : ' ' : T.unpack (prettyPrintLabel name) ++ " " ++ doubleColon ++ " ") <> typeAsBox' ty - doubleColon = if troUnicode tro then "∷" else "::" + doubleColon = if troUnicode tro then "∷" else "::" - rowDiff = if troRowAsDiff tro then Just (text "...") else Nothing + rowDiff = if troRowAsDiff tro then Just (text "...") else Nothing - tailToPs :: Maybe PrettyPrintType -> Box - tailToPs Nothing = nullBox - tailToPs (Just other) = text "| " <> typeAsBox' other + tailToPs :: Maybe PrettyPrintType -> Box + tailToPs Nothing = nullBox + tailToPs (Just other) = text "| " <> typeAsBox' other typeApp :: Pattern () PrettyPrintType (PrettyPrintType, PrettyPrintType) typeApp = mkPattern match where - match (PPTypeApp f x) = Just (f, x) - match _ = Nothing + match (PPTypeApp f x) = Just (f, x) + match _ = Nothing kindArg :: Pattern () PrettyPrintType ((), PrettyPrintType) kindArg = mkPattern match where - match (PPKindArg ty) = Just ((), ty) - match _ = Nothing + match (PPKindArg ty) = Just ((), ty) + match _ = Nothing appliedFunction :: Pattern () PrettyPrintType (PrettyPrintType, PrettyPrintType) appliedFunction = mkPattern match where - match (PPFunction arg ret) = Just (arg, ret) - match _ = Nothing + match (PPFunction arg ret) = Just (arg, ret) + match _ = Nothing kinded :: Pattern () PrettyPrintType (PrettyPrintType, PrettyPrintType) kinded = mkPattern match where - match (PPKindedType t k) = Just (t, k) - match _ = Nothing + match (PPKindedType t k) = Just (t, k) + match _ = Nothing constrained :: Pattern () PrettyPrintType (PrettyPrintConstraint, PrettyPrintType) constrained = mkPattern match where - match (PPConstrainedType deps ty) = Just (deps, ty) - match _ = Nothing + match (PPConstrainedType deps ty) = Just (deps, ty) + match _ = Nothing explicitParens :: Pattern () PrettyPrintType ((), PrettyPrintType) explicitParens = mkPattern match where - match (PPParensInType ty) = Just ((), ty) - match _ = Nothing + match (PPParensInType ty) = Just ((), ty) + match _ = Nothing matchTypeAtom :: TypeRenderOptions -> Pattern () PrettyPrintType Box -matchTypeAtom tro@TypeRenderOptions{troSuggesting = suggesting} = - typeLiterals <+> fmap ((`before` text ")") . (text "(" <>)) (matchType tro) +matchTypeAtom tro@TypeRenderOptions {troSuggesting = suggesting} = + typeLiterals <+> fmap ((`before` text ")") . (text "(" <>)) (matchType tro) where typeLiterals :: Pattern () PrettyPrintType Box - typeLiterals = mkPattern match where - match (PPTypeWildcard name) = Just $ text $ maybe "_" (('?' :) . T.unpack) name - match (PPTypeVar var _) = Just $ text $ T.unpack var - match (PPTypeLevelString s) = Just $ text $ T.unpack $ prettyPrintString s - match (PPTypeLevelInt n) = Just $ text $ show n - match (PPTypeConstructor ctor) = Just $ text $ T.unpack $ runProperName $ disqualify ctor - match (PPTUnknown u) - | suggesting = Just $ text "_" - | otherwise = Just $ text $ 't' : show u - match (PPSkolem name s) - | suggesting = Just $ text $ T.unpack name - | otherwise = Just $ text $ T.unpack name ++ show s - match (PPRecord labels tail_) = Just $ prettyPrintRowWith tro '{' '}' labels tail_ - match (PPRow labels tail_) = Just $ prettyPrintRowWith tro '(' ')' labels tail_ - match (PPBinaryNoParensType op l r) = - Just $ typeAsBox' l <> text " " <> typeAsBox' op <> text " " <> typeAsBox' r - match (PPTypeOp op) = Just $ text $ T.unpack $ showQualified runOpName op - match PPTruncated = Just $ text "..." - match _ = Nothing + typeLiterals = mkPattern match + where + match (PPTypeWildcard name) = Just $ text $ maybe "_" (('?' :) . T.unpack) name + match (PPTypeVar var _) = Just $ text $ T.unpack var + match (PPTypeLevelString s) = Just $ text $ T.unpack $ prettyPrintString s + match (PPTypeLevelInt n) = Just $ text $ show n + match (PPTypeConstructor ctor) = Just $ text $ T.unpack $ runProperName $ disqualify ctor + match (PPTUnknown u) + | suggesting = Just $ text "_" + | otherwise = Just $ text $ 't' : show u + match (PPSkolem name s) + | suggesting = Just $ text $ "skolem[" P.<> show s P.<> "]=" P.<> T.unpack name + | otherwise = Just $ text $ T.unpack name ++ show s + match (PPRecord labels tail_) = Just $ prettyPrintRowWith tro '{' '}' labels tail_ + match (PPRow labels tail_) = Just $ prettyPrintRowWith tro '(' ')' labels tail_ + match (PPBinaryNoParensType op l r) = + Just $ typeAsBox' l <> text " " <> typeAsBox' op <> text " " <> typeAsBox' r + match (PPTypeOp op) = Just $ text $ T.unpack $ showQualified runOpName op + match PPTruncated = Just $ text "..." + match _ = Nothing matchType :: TypeRenderOptions -> Pattern () PrettyPrintType Box -matchType tro = buildPrettyPrinter operators (matchTypeAtom tro) where - operators :: OperatorTable () PrettyPrintType Box - operators = - OperatorTable [ [ Wrap kindArg $ \_ ty -> text "@" <> ty ] - , [ AssocL typeApp $ \f x -> keepSingleLinesOr (moveRight 2) f x ] - , [ AssocR appliedFunction $ \arg ret -> keepSingleLinesOr id arg (text rightArrow <> " " <> ret) ] - , [ Wrap constrained $ \deps ty -> constraintsAsBox tro deps ty ] - , [ Wrap forall_ $ \idents ty -> keepSingleLinesOr (moveRight 2) (hsep 1 top (text forall' : fmap printMbKindedType idents) <> text ".") ty ] - , [ Wrap kinded $ \ty k -> keepSingleLinesOr (moveRight 2) (typeAsBox' ty) (text (doubleColon ++ " ") <> k) ] - , [ Wrap explicitParens $ \_ ty -> ty ] - ] - - rightArrow = if troUnicode tro then "→" else "->" - forall' = if troUnicode tro then "∀" else "forall" - doubleColon = if troUnicode tro then "∷" else "::" - - printMbKindedType (vis, v, Nothing) = text (T.unpack $ typeVarVisibilityPrefix vis) <> text v - printMbKindedType (vis, v, Just k) = text ("(" ++ T.unpack (typeVarVisibilityPrefix vis) ++ v ++ " " ++ doubleColon ++ " ") <> typeAsBox' k <> text ")" - - -- If both boxes span a single line, keep them on the same line, or else - -- use the specified function to modify the second box, then combine vertically. - keepSingleLinesOr :: (Box -> Box) -> Box -> Box -> Box - keepSingleLinesOr f b1 b2 - | rows b1 > 1 || rows b2 > 1 = vcat left [ b1, f b2 ] - | otherwise = hcat top [ b1, text " ", b2] - -forall_ :: Pattern () PrettyPrintType ([(TypeVarVisibility, String, Maybe PrettyPrintType)], PrettyPrintType) +matchType tro = buildPrettyPrinter operators (matchTypeAtom tro) + where + operators :: OperatorTable () PrettyPrintType Box + operators = + OperatorTable + [ [Wrap kindArg $ \_ ty -> text "@" <> ty] + , [AssocL typeApp $ \f x -> keepSingleLinesOr (moveRight 2) f x] + , [AssocR appliedFunction $ \arg ret -> keepSingleLinesOr id arg (text rightArrow <> " " <> ret)] + , [Wrap constrained $ \deps ty -> constraintsAsBox tro deps ty] + , [Wrap forall_ $ \idents ty -> keepSingleLinesOr (moveRight 2) (hsep 1 top (text forall' : fmap printMbKindedType idents) <> text ".") ty] + , [Wrap kinded $ \ty k -> keepSingleLinesOr (moveRight 2) (typeAsBox' ty) (text (doubleColon ++ " ") <> k)] + , [Wrap explicitParens $ \_ ty -> ty] + ] + + rightArrow = if troUnicode tro then "→" else "->" + forall' = if troUnicode tro then "∀" else "forall" + doubleColon = if troUnicode tro then "∷" else "::" + + printMbKindedType (vis, v, k) = text ("(" ++ T.unpack (typeVarVisibilityPrefix vis) ++ v ++ " " ++ doubleColon ++ " ") <> typeAsBox' k <> text ")" + + -- If both boxes span a single line, keep them on the same line, or else + -- use the specified function to modify the second box, then combine vertically. + keepSingleLinesOr :: (Box -> Box) -> Box -> Box -> Box + keepSingleLinesOr f b1 b2 + | rows b1 > 1 || rows b2 > 1 = vcat left [b1, f b2] + | otherwise = hcat top [b1, text " ", b2] + +forall_ :: Pattern () PrettyPrintType ([(TypeVarVisibility, String, PrettyPrintType)], PrettyPrintType) forall_ = mkPattern match where - match (PPForAll idents ty) = Just ((_2 %~ T.unpack) <$> idents, ty) - match _ = Nothing + match (PPForAll idents ty) = Just ((_2 %~ T.unpack) <$> idents, ty) + match _ = Nothing typeAtomAsBox' :: PrettyPrintType -> Box -typeAtomAsBox' - = fromMaybe (internalError "Incomplete pattern") - . PA.pattern (matchTypeAtom defaultOptions) () +typeAtomAsBox' = + fromMaybe (internalError "Incomplete pattern") + . PA.pattern (matchTypeAtom defaultOptions) () typeAtomAsBox :: Int -> Type a -> Box typeAtomAsBox maxDepth = typeAtomAsBox' . convertPrettyPrintType maxDepth @@ -250,8 +254,8 @@ prettyPrintTypeAtom maxDepth = render . typeAtomAsBox maxDepth typeAsBox' :: PrettyPrintType -> Box typeAsBox' = typeAsBoxImpl defaultOptions -typeAsBox :: Int -> Type a -> Box -typeAsBox maxDepth = typeAsBox' . convertPrettyPrintType maxDepth +typeAsBox :: (Show a) => Int -> Type a -> Box +typeAsBox maxDepth = text . prettyTypeStr -- typeAsBox' . convertPrettyPrintType maxDepth typeDiffAsBox' :: PrettyPrintType -> Box typeDiffAsBox' = typeAsBoxImpl diffOptions @@ -278,16 +282,17 @@ unicodeOptions :: TypeRenderOptions unicodeOptions = TypeRenderOptions False True False typeAsBoxImpl :: TypeRenderOptions -> PrettyPrintType -> Box -typeAsBoxImpl tro - = fromMaybe (internalError "Incomplete pattern") - . PA.pattern (matchType tro) () +typeAsBoxImpl tro = + fromMaybe (internalError "Incomplete pattern") + . PA.pattern (matchType tro) () -- | Generate a pretty-printed string representing a 'Type' prettyPrintType :: Int -> Type a -> String prettyPrintType = flip prettyPrintType' defaultOptions --- | Generate a pretty-printed string representing a 'Type' using unicode --- symbols where applicable +{- | Generate a pretty-printed string representing a 'Type' using unicode +symbols where applicable +-} prettyPrintTypeWithUnicode :: Int -> Type a -> String prettyPrintTypeWithUnicode = flip prettyPrintType' unicodeOptions @@ -301,8 +306,9 @@ prettyPrintType' maxDepth tro = render . typeAsBoxImpl tro . convertPrettyPrintT prettyPrintLabel :: Label -> Text prettyPrintLabel (Label s) = case decodeString s of - Just s' | not (objectKeyRequiresQuoting s') -> - s' + Just s' + | not (objectKeyRequiresQuoting s') -> + s' _ -> prettyPrintString s diff --git a/src/Language/PureScript/Pretty/Values.hs b/src/Language/PureScript/Pretty/Values.hs index 4d5a5ec60..534027b33 100644 --- a/src/Language/PureScript/Pretty/Values.hs +++ b/src/Language/PureScript/Pretty/Values.hs @@ -1,30 +1,31 @@ --- | --- Pretty printer for values --- -module Language.PureScript.Pretty.Values - ( prettyPrintValue - , prettyPrintBinder - , prettyPrintBinderAtom - ) where +{- | +Pretty printer for values +-} +module Language.PureScript.Pretty.Values ( + prettyPrintValue, + prettyPrintBinder, + prettyPrintBinderAtom, + renderValue, +) where import Prelude hiding ((<>)) import Control.Arrow (second) -import Data.Text (Text) import Data.List.NonEmpty qualified as NEL import Data.Monoid qualified as Monoid ((<>)) +import Data.Text (Text) import Data.Text qualified as T -import Language.PureScript.AST (AssocList(..), Binder(..), CaseAlternative(..), Declaration(..), DoNotationElement(..), Expr(..), Guard(..), GuardedExpr(..), Literal(..), PathNode(..), PathTree(..), TypeDeclarationData(..), pattern ValueDecl, WhereProvenance(..)) +import Language.PureScript.AST (AssocList (..), Binder (..), CaseAlternative (..), Declaration (..), DoNotationElement (..), Expr (..), Guard (..), GuardedExpr (..), Literal (..), PathNode (..), PathTree (..), TypeDeclarationData (..), WhereProvenance (..), pattern ValueDecl) import Language.PureScript.Crash (internalError) -import Language.PureScript.Names (OpName(..), ProperName(..), Qualified(..), disqualify, runModuleName, showIdent) -import Language.PureScript.Pretty.Common (before, beforeWithSpace, parensT) -import Language.PureScript.Pretty.Types (typeAsBox, typeAtomAsBox, prettyPrintObjectKey) -import Language.PureScript.Types (Constraint(..)) +import Language.PureScript.Names (OpName (..), ProperName (..), Qualified (..), disqualify, runModuleName, showIdent) import Language.PureScript.PSString (PSString, prettyPrintString) +import Language.PureScript.Pretty.Common (before, beforeWithSpace, parensT) +import Language.PureScript.Pretty.Types (prettyPrintObjectKey, typeAsBox, typeAtomAsBox) +import Language.PureScript.Types (Constraint (..)) -import Text.PrettyPrint.Boxes (Box, left, moveRight, text, vcat, vsep, (//), (<>)) +import Text.PrettyPrint.Boxes (Box, left, moveRight, render, text, vcat, vsep, (//), (<>)) -- TODO(Christoph): remove T.unpack s @@ -34,9 +35,9 @@ textT = text . T.unpack -- | Render an aligned list of items separated with commas list :: Char -> Char -> (a -> Box) -> [a] -> Box list open close _ [] = text [open, close] -list open close f xs = vcat left (zipWith toLine [0 :: Int ..] xs ++ [ text [ close ] ]) +list open close f xs = vcat left (zipWith toLine [0 :: Int ..] xs ++ [text [close]]) where - toLine i a = text [ if i == 0 then open else ',', ' ' ] <> f a + toLine i a = text [if i == 0 then open else ',', ' '] <> f a ellipsis :: Box ellipsis = text "..." @@ -44,20 +45,28 @@ ellipsis = text "..." prettyPrintObject :: Int -> [(PSString, Maybe Expr)] -> Box prettyPrintObject d = list '{' '}' prettyPrintObjectProperty where - prettyPrintObjectProperty :: (PSString, Maybe Expr) -> Box - prettyPrintObjectProperty (key, value) = textT (prettyPrintObjectKey key Monoid.<> ": ") <> maybe (text "_") (prettyPrintValue (d - 1)) value + prettyPrintObjectProperty :: (PSString, Maybe Expr) -> Box + prettyPrintObjectProperty (key, value) = textT (prettyPrintObjectKey key Monoid.<> ": ") <> maybe (text "_") (prettyPrintValue (d - 1)) value prettyPrintUpdateEntry :: Int -> PSString -> Expr -> Box prettyPrintUpdateEntry d key val = textT (prettyPrintObjectKey key) <> text " = " <> prettyPrintValue (d - 1) val +renderValue :: Int -> Expr -> String +renderValue d e = render (prettyPrintValue d e) + -- | Pretty-print an expression prettyPrintValue :: Int -> Expr -> Box prettyPrintValue d _ | d < 0 = text "..." prettyPrintValue d (IfThenElse cond th el) = (text "if " <> prettyPrintValueAtom (d - 1) cond) - // moveRight 2 (vcat left [ text "then " <> prettyPrintValueAtom (d - 1) th - , text "else " <> prettyPrintValueAtom (d - 1) el - ]) + // moveRight + 2 + ( vcat + left + [ text "then " <> prettyPrintValueAtom (d - 1) th + , text "else " <> prettyPrintValueAtom (d - 1) el + ] + ) prettyPrintValue d (Accessor prop val) = prettyPrintValueAtom (d - 1) val `before` textT ("." Monoid.<> prettyPrintObjectKey prop) prettyPrintValue d (ObjectUpdate o ps) = prettyPrintValueAtom (d - 1) o `beforeWithSpace` list '{' '}' (uncurry (prettyPrintUpdateEntry d)) ps prettyPrintValue d (ObjectUpdateNested o ps) = prettyPrintValueAtom (d - 1) o `beforeWithSpace` prettyPrintUpdate ps @@ -70,21 +79,26 @@ prettyPrintValue d (VisibleTypeApp val _) = prettyPrintValueAtom (d - 1) val prettyPrintValue d (Unused val) = prettyPrintValue d val prettyPrintValue d (Abs arg val) = text ('\\' : T.unpack (prettyPrintBinder arg) ++ " -> ") // moveRight 2 (prettyPrintValue (d - 1) val) prettyPrintValue d (Case values binders) = - (text "case " <> foldr beforeWithSpace (text "of") (map (prettyPrintValueAtom (d - 1)) values)) // - moveRight 2 (vcat left (map (prettyPrintCaseAlternative (d - 1)) binders)) + (text "case " <> foldr beforeWithSpace (text "of") (map (prettyPrintValueAtom (d - 1)) values)) + // moveRight 2 (vcat left (map (prettyPrintCaseAlternative (d - 1)) binders)) prettyPrintValue d (Let FromWhere ds val) = - prettyPrintValue (d - 1) val // - moveRight 2 (text "where" // - vcat left (map (prettyPrintDeclaration (d - 1)) ds)) + prettyPrintValue (d - 1) val + // moveRight + 2 + ( text "where" + // vcat left (map (prettyPrintDeclaration (d - 1)) ds) + ) prettyPrintValue d (Let FromLet ds val) = - text "let" // - moveRight 2 (vcat left (map (prettyPrintDeclaration (d - 1)) ds)) // - (text "in " <> prettyPrintValue (d - 1) val) + text "let" + // moveRight 2 (vcat left (map (prettyPrintDeclaration (d - 1)) ds)) + // (text "in " <> prettyPrintValue (d - 1) val) prettyPrintValue d (Do m els) = textT (maybe "" ((Monoid.<> ".") . runModuleName) m) <> text "do " <> vcat left (map (prettyPrintDoNotationElement (d - 1)) els) prettyPrintValue d (Ado m els yield) = - textT (maybe "" ((Monoid.<> ".") . runModuleName) m) <> text "ado " <> vcat left (map (prettyPrintDoNotationElement (d - 1)) els) // - (text "in " <> prettyPrintValue (d - 1) yield) + textT (maybe "" ((Monoid.<> ".") . runModuleName) m) + <> text "ado " + <> vcat left (map (prettyPrintDoNotationElement (d - 1)) els) + // (text "in " <> prettyPrintValue (d - 1) yield) -- TODO: constraint kind args prettyPrintValue d (TypeClassDictionary (Constraint _ name _ tys _) _ _) = foldl1 beforeWithSpace $ text ("#dict " ++ T.unpack (runProperName (disqualify name))) : map (typeAtomAsBox d) tys prettyPrintValue _ (DeferredDictionary name _) = text $ "#dict " ++ T.unpack (runProperName (disqualify name)) @@ -93,13 +107,13 @@ prettyPrintValue d (TypedValue _ val _) = prettyPrintValue d val prettyPrintValue d (PositionedValue _ _ val) = prettyPrintValue d val prettyPrintValue d (Literal _ l) = prettyPrintLiteralValue d l prettyPrintValue _ (Hole name) = text "?" <> textT name -prettyPrintValue d expr@AnonymousArgument{} = prettyPrintValueAtom d expr -prettyPrintValue d expr@Constructor{} = prettyPrintValueAtom d expr -prettyPrintValue d expr@Var{} = prettyPrintValueAtom d expr -prettyPrintValue d expr@Op{} = prettyPrintValueAtom d expr -prettyPrintValue d expr@BinaryNoParens{} = prettyPrintValueAtom d expr -prettyPrintValue d expr@Parens{} = prettyPrintValueAtom d expr -prettyPrintValue d expr@UnaryMinus{} = prettyPrintValueAtom d expr +prettyPrintValue d expr@AnonymousArgument {} = prettyPrintValueAtom d expr +prettyPrintValue d expr@Constructor {} = prettyPrintValueAtom d expr +prettyPrintValue d expr@Var {} = prettyPrintValueAtom d expr +prettyPrintValue d expr@Op {} = prettyPrintValueAtom d expr +prettyPrintValue d expr@BinaryNoParens {} = prettyPrintValueAtom d expr +prettyPrintValue d expr@Parens {} = prettyPrintValueAtom d expr +prettyPrintValue d expr@UnaryMinus {} = prettyPrintValueAtom d expr -- | Pretty-print an atomic expression, adding parentheses if necessary. prettyPrintValueAtom :: Int -> Expr -> Box @@ -110,8 +124,8 @@ prettyPrintValueAtom _ (Var _ ident) = text $ T.unpack $ showIdent (disqualify i prettyPrintValueAtom d (BinaryNoParens op lhs rhs) = prettyPrintValue (d - 1) lhs `beforeWithSpace` printOp op `beforeWithSpace` prettyPrintValue (d - 1) rhs where - printOp (Op _ (Qualified _ name)) = text $ T.unpack $ runOpName name - printOp expr = text "`" <> prettyPrintValue (d - 1) expr `before` text "`" + printOp (Op _ (Qualified _ name)) = text $ T.unpack $ runOpName name + printOp expr = text "`" <> prettyPrintValue (d - 1) expr `before` text "`" prettyPrintValueAtom d (TypedValue _ val _) = prettyPrintValueAtom d val prettyPrintValueAtom d (PositionedValue _ _ val) = prettyPrintValueAtom d val prettyPrintValueAtom d (Parens expr) = (text "(" <> prettyPrintValue d expr) `before` text ")" @@ -124,7 +138,7 @@ prettyPrintLiteralValue _ (StringLiteral s) = text $ T.unpack $ prettyPrintStrin prettyPrintLiteralValue _ (CharLiteral c) = text $ show c prettyPrintLiteralValue _ (BooleanLiteral True) = text "true" prettyPrintLiteralValue _ (BooleanLiteral False) = text "false" -prettyPrintLiteralValue d (ArrayLiteral xs) = list '[' ']' (prettyPrintValue (d - 1)) xs +prettyPrintLiteralValue d (ListLiteral xs) = list '[' ']' (prettyPrintValue (d - 1)) xs prettyPrintLiteralValue d (ObjectLiteral ps) = prettyPrintObject (d - 1) $ second Just `map` ps prettyPrintDeclaration :: Int -> Declaration -> Box @@ -136,7 +150,7 @@ prettyPrintDeclaration d (ValueDecl _ ident _ [] [GuardedExpr [] val]) = prettyPrintDeclaration d (BindingGroupDeclaration ds) = vsep 1 left (NEL.toList (fmap (prettyPrintDeclaration (d - 1) . toDecl) ds)) where - toDecl ((sa, nm), t, e) = ValueDecl sa nm t [] [GuardedExpr [] e] + toDecl ((sa, nm), t, e) = ValueDecl sa nm t [] [GuardedExpr [] e] prettyPrintDeclaration _ _ = internalError "Invalid argument to prettyPrintDeclaration" prettyPrintCaseAlternative :: Int -> CaseAlternative -> Box @@ -144,37 +158,41 @@ prettyPrintCaseAlternative d _ | d < 0 = ellipsis prettyPrintCaseAlternative d (CaseAlternative binders result) = text (T.unpack (T.unwords (map prettyPrintBinderAtom binders))) <> prettyPrintResult result where - prettyPrintResult :: [GuardedExpr] -> Box - prettyPrintResult [GuardedExpr [] v] = text " -> " <> prettyPrintValue (d - 1) v - prettyPrintResult gs = - vcat left (map (prettyPrintGuardedValueSep (text " | ")) gs) - - prettyPrintGuardedValueSep :: Box -> GuardedExpr -> Box - prettyPrintGuardedValueSep _ (GuardedExpr [] val) = - text " -> " <> prettyPrintValue (d - 1) val - - prettyPrintGuardedValueSep sep (GuardedExpr [guard] val) = - foldl1 before [ sep - , prettyPrintGuard guard - , prettyPrintGuardedValueSep sep (GuardedExpr [] val) - ] - - prettyPrintGuardedValueSep sep (GuardedExpr (guard : guards) val) = - vcat left [ foldl1 before - [ sep - , prettyPrintGuard guard - ] - , prettyPrintGuardedValueSep (text " , ") (GuardedExpr guards val) - ] - - prettyPrintGuard (ConditionGuard cond) = - prettyPrintValue (d - 1) cond - prettyPrintGuard (PatternGuard binder val) = - foldl1 before - [ text (T.unpack (prettyPrintBinder binder)) - , text " <- " - , prettyPrintValue (d - 1) val - ] + prettyPrintResult :: [GuardedExpr] -> Box + prettyPrintResult [GuardedExpr [] v] = text " -> " <> prettyPrintValue (d - 1) v + prettyPrintResult gs = + vcat left (map (prettyPrintGuardedValueSep (text " | ")) gs) + + prettyPrintGuardedValueSep :: Box -> GuardedExpr -> Box + prettyPrintGuardedValueSep _ (GuardedExpr [] val) = + text " -> " <> prettyPrintValue (d - 1) val + prettyPrintGuardedValueSep sep (GuardedExpr [guard] val) = + foldl1 + before + [ sep + , prettyPrintGuard guard + , prettyPrintGuardedValueSep sep (GuardedExpr [] val) + ] + prettyPrintGuardedValueSep sep (GuardedExpr (guard : guards) val) = + vcat + left + [ foldl1 + before + [ sep + , prettyPrintGuard guard + ] + , prettyPrintGuardedValueSep (text " , ") (GuardedExpr guards val) + ] + + prettyPrintGuard (ConditionGuard cond) = + prettyPrintValue (d - 1) cond + prettyPrintGuard (PatternGuard binder val) = + foldl1 + before + [ text (T.unpack (prettyPrintBinder binder)) + , text " <- " + , prettyPrintValue (d - 1) val + ] prettyPrintDoNotationElement :: Int -> DoNotationElement -> Box prettyPrintDoNotationElement d _ | d < 0 = ellipsis @@ -183,8 +201,8 @@ prettyPrintDoNotationElement d (DoNotationValue val) = prettyPrintDoNotationElement d (DoNotationBind binder val) = textT (prettyPrintBinder binder Monoid.<> " <- ") <> prettyPrintValue d val prettyPrintDoNotationElement d (DoNotationLet ds) = - text "let" // - moveRight 2 (vcat left (map (prettyPrintDeclaration (d - 1)) ds)) + text "let" + // moveRight 2 (vcat left (map (prettyPrintDeclaration (d - 1)) ds)) prettyPrintDoNotationElement d (PositionedDoNotationElement _ _ el) = prettyPrintDoNotationElement d el prettyPrintBinderAtom :: Binder -> Text @@ -192,7 +210,7 @@ prettyPrintBinderAtom NullBinder = "_" prettyPrintBinderAtom (LiteralBinder _ l) = prettyPrintLiteralBinder l prettyPrintBinderAtom (VarBinder _ ident) = showIdent ident prettyPrintBinderAtom (ConstructorBinder _ ctor []) = runProperName (disqualify ctor) -prettyPrintBinderAtom b@ConstructorBinder{} = parensT (prettyPrintBinder b) +prettyPrintBinderAtom b@ConstructorBinder {} = parensT (prettyPrintBinder b) prettyPrintBinderAtom (NamedBinder _ ident binder) = showIdent ident Monoid.<> "@" Monoid.<> prettyPrintBinder binder prettyPrintBinderAtom (PositionedBinder _ _ binder) = prettyPrintBinderAtom binder prettyPrintBinderAtom (TypedBinder _ binder) = prettyPrintBinderAtom binder @@ -209,19 +227,19 @@ prettyPrintLiteralBinder (BooleanLiteral True) = "true" prettyPrintLiteralBinder (BooleanLiteral False) = "false" prettyPrintLiteralBinder (ObjectLiteral bs) = "{ " - Monoid.<> T.intercalate ", " (map prettyPrintObjectPropertyBinder bs) - Monoid.<> " }" + Monoid.<> T.intercalate ", " (map prettyPrintObjectPropertyBinder bs) + Monoid.<> " }" where - prettyPrintObjectPropertyBinder :: (PSString, Binder) -> Text - prettyPrintObjectPropertyBinder (key, binder) = prettyPrintObjectKey key Monoid.<> ": " Monoid.<> prettyPrintBinder binder -prettyPrintLiteralBinder (ArrayLiteral bs) = + prettyPrintObjectPropertyBinder :: (PSString, Binder) -> Text + prettyPrintObjectPropertyBinder (key, binder) = prettyPrintObjectKey key Monoid.<> ": " Monoid.<> prettyPrintBinder binder +prettyPrintLiteralBinder (ListLiteral bs) = "[ " - Monoid.<> T.intercalate ", " (map prettyPrintBinder bs) - Monoid.<> " ]" + Monoid.<> T.intercalate ", " (map prettyPrintBinder bs) + Monoid.<> " ]" --- | --- Generate a pretty-printed string representing a Binder --- +{- | +Generate a pretty-printed string representing a Binder +-} prettyPrintBinder :: Binder -> Text prettyPrintBinder (ConstructorBinder _ ctor []) = runProperName (disqualify ctor) prettyPrintBinder (ConstructorBinder _ ctor args) = runProperName (disqualify ctor) Monoid.<> " " Monoid.<> T.unwords (map prettyPrintBinderAtom args) diff --git a/src/Language/PureScript/Publish.hs b/src/Language/PureScript/Publish.hs index ed3dd4aba..dd60a711e 100644 --- a/src/Language/PureScript/Publish.hs +++ b/src/Language/PureScript/Publish.hs @@ -1,115 +1,120 @@ -module Language.PureScript.Publish - ( preparePackage - , preparePackage' - , unsafePreparePackage - , PrepareM() - , runPrepareM - , warn - , userError - , internalError - , otherError - , PublishOptions(..) - , defaultPublishOptions - , getGitWorkingTreeStatus - , checkCleanWorkingTree - , getVersionFromGitTag - , getManifestRepositoryInfo - , getModules - ) where - -import Protolude hiding (stdin, lines) +module Language.PureScript.Publish ( + preparePackage, + preparePackage', + unsafePreparePackage, + PrepareM (), + runPrepareM, + warn, + userError, + internalError, + otherError, + PublishOptions (..), + defaultPublishOptions, + getGitWorkingTreeStatus, + checkCleanWorkingTree, + getVersionFromGitTag, + getManifestRepositoryInfo, + getModules, +) where + +import Protolude hiding (lines, stdin) import Control.Arrow ((***)) import Control.Category ((>>>)) import Control.Monad.Writer.Strict (MonadWriter, WriterT, runWriterT, tell) import Data.ByteString.Lazy qualified as BL -import Data.String (String, lines) import Data.List (stripPrefix, (\\)) +import Data.String (String, lines) import Data.Text qualified as T import Data.Time.Clock (UTCTime) import Data.Time.Clock.POSIX (posixSecondsToUTCTime) import Data.Version (Version) -import Distribution.SPDX qualified as SPDX import Distribution.Parsec qualified as CabalParsec +import Distribution.SPDX qualified as SPDX import System.Directory (doesFileExist) import System.FilePath.Glob (globDir1) import System.Process (readProcess) -import Web.Bower.PackageMeta (PackageMeta(..), PackageName, Repository(..)) +import Web.Bower.PackageMeta (PackageMeta (..), PackageName, Repository (..)) import Web.Bower.PackageMeta qualified as Bower -import Language.PureScript.Publish.ErrorsWarnings (InternalError(..), OtherError(..), PackageError(..), PackageWarning(..), RepositoryFieldError(..), UserError(..), printError, printWarnings) -import Language.PureScript.Publish.Registry.Compat (asPursJson, toBowerPackage) -import Language.PureScript.Publish.Utils (globRelative, purescriptSourceFiles) -import Language.PureScript qualified as P (version, ModuleName) +import Data.Aeson.BetterErrors (Parse, asString, eachInObjectWithKey, key, keyMay, mapError, parse, withString) +import Language.PureScript qualified as P (ModuleName, version) import Language.PureScript.CoreFn.FromJSON qualified as P import Language.PureScript.Docs qualified as D -import Data.Aeson.BetterErrors (Parse, withString, eachInObjectWithKey, asString, key, keyMay, parse, mapError) -import Language.PureScript.Docs.Types (ManifestError(BowerManifest, PursManifest)) +import Language.PureScript.Docs.Types (ManifestError (BowerManifest, PursManifest)) +import Language.PureScript.Publish.ErrorsWarnings (InternalError (..), OtherError (..), PackageError (..), PackageWarning (..), RepositoryFieldError (..), UserError (..), printError, printWarnings) +import Language.PureScript.Publish.Registry.Compat (asPursJson, toBowerPackage) +import Language.PureScript.Publish.Utils (globRelative, purescriptSourceFiles) data PublishOptions = PublishOptions - { -- | How to obtain the version tag and version that the data being - -- generated will refer to. - publishGetVersion :: PrepareM (Text, Version) - -- | How to obtain at what time the version was committed + { publishGetVersion :: PrepareM (Text, Version) + -- ^ How to obtain the version tag and version that the data being + -- generated will refer to. , publishGetTagTime :: Text -> PrepareM UTCTime - , -- | What to do when the working tree is dirty - publishWorkingTreeDirty :: PrepareM () - , -- | Compiler output directory (which must include up-to-date docs.json - -- files for any modules we are producing docs for). - publishCompileOutputDir :: FilePath - , -- | Path to the manifest file; a JSON file including information about the - -- package, such as name, author, dependency version bounds. - publishManifestFile :: FilePath - , -- | Path to the resolutions file; a JSON file containing all of the - -- package's dependencies, their versions, and their paths on the disk. - publishResolutionsFile :: FilePath + -- ^ How to obtain at what time the version was committed + , publishWorkingTreeDirty :: PrepareM () + -- ^ What to do when the working tree is dirty + , publishCompileOutputDir :: FilePath + -- ^ Compiler output directory (which must include up-to-date docs.json + -- files for any modules we are producing docs for). + , publishManifestFile :: FilePath + -- ^ Path to the manifest file; a JSON file including information about the + -- package, such as name, author, dependency version bounds. + , publishResolutionsFile :: FilePath + -- ^ Path to the resolutions file; a JSON file containing all of the + -- package's dependencies, their versions, and their paths on the disk. } defaultPublishOptions :: PublishOptions -defaultPublishOptions = PublishOptions - { publishGetVersion = getVersionFromGitTag - , publishGetTagTime = getTagTime - , publishWorkingTreeDirty = userError DirtyWorkingTree - , publishCompileOutputDir = "output" - , publishManifestFile = "bower.json" - , publishResolutionsFile = "resolutions.json" - } - --- | Attempt to retrieve package metadata from the current directory. --- Calls exitFailure if no package metadata could be retrieved. +defaultPublishOptions = + PublishOptions + { publishGetVersion = getVersionFromGitTag + , publishGetTagTime = getTagTime + , publishWorkingTreeDirty = userError DirtyWorkingTree + , publishCompileOutputDir = "output" + , publishManifestFile = "bower.json" + , publishResolutionsFile = "resolutions.json" + } + +{- | Attempt to retrieve package metadata from the current directory. +Calls exitFailure if no package metadata could be retrieved. +-} unsafePreparePackage :: PublishOptions -> IO D.UploadedPackage unsafePreparePackage opts = either (\e -> printError e >> exitFailure) pure =<< preparePackage opts --- | Attempt to retrieve package metadata from the current directory. --- Returns a PackageError on failure +{- | Attempt to retrieve package metadata from the current directory. +Returns a PackageError on failure +-} preparePackage :: PublishOptions -> IO (Either PackageError D.UploadedPackage) preparePackage opts = runPrepareM (preparePackage' opts) >>= either (pure . Left) (fmap Right . handleWarnings) - where - handleWarnings (result, warns) = do - printWarnings warns - return result - -newtype PrepareM a = - PrepareM { unPrepareM :: WriterT [PackageWarning] (ExceptT PackageError IO) a } - deriving (Functor, Applicative, Monad, - MonadWriter [PackageWarning], - MonadError PackageError) + handleWarnings (result, warns) = do + printWarnings warns + return result + +newtype PrepareM a = PrepareM {unPrepareM :: WriterT [PackageWarning] (ExceptT PackageError IO) a} + deriving + ( Functor + , Applicative + , Monad + , MonadWriter [PackageWarning] + , MonadError PackageError + ) -- This MonadIO instance ensures that IO errors don't crash the program. instance MonadIO PrepareM where liftIO act = lift' (try act) >>= either (otherError . IOExceptionThrown) return where - lift' :: IO a -> PrepareM a - lift' = PrepareM . lift . lift + lift' :: IO a -> PrepareM a + lift' = PrepareM . lift . lift runPrepareM :: PrepareM a -> IO (Either PackageError (a, [PackageWarning])) runPrepareM = runExceptT . runWriterT . unPrepareM @@ -126,7 +131,7 @@ internalError = throwError . InternalError otherError :: OtherError -> PrepareM a otherError = throwError . OtherError -catchLeft :: Applicative f => Either a b -> (a -> f b) -> f b +catchLeft :: (Applicative f) => Either a b -> (a -> f b) -> f b catchLeft a f = either f pure a preparePackage' :: PublishOptions -> PrepareM D.UploadedPackage @@ -134,19 +139,20 @@ preparePackage' opts = do checkCleanWorkingTree opts let manifestPath = publishManifestFile opts - pkgMeta <- liftIO (try (BL.readFile manifestPath)) >>= \case - Left (_ :: IOException) -> - userError $ PackageManifestNotFound manifestPath - Right found -> do - -- We can determine the type of the manifest file based on the file path, - -- as both the PureScript and Bower registries require their manifest - -- files to have specific names. - let isPursJson = "purs.json" `T.isInfixOf` T.pack manifestPath - if isPursJson then do - pursJson <- catchLeft (parse (mapError PursManifest asPursJson) found) (userError . CouldntDecodePackageManifest) - catchLeft (toBowerPackage pursJson) (userError . CouldntConvertPackageManifest) - else - catchLeft (parse (mapError BowerManifest Bower.asPackageMeta) found) (userError . CouldntDecodePackageManifest) + pkgMeta <- + liftIO (try (BL.readFile manifestPath)) >>= \case + Left (_ :: IOException) -> + userError $ PackageManifestNotFound manifestPath + Right found -> do + -- We can determine the type of the manifest file based on the file path, + -- as both the PureScript and Bower registries require their manifest + -- files to have specific names. + let isPursJson = "purs.json" `T.isInfixOf` T.pack manifestPath + if isPursJson + then do + pursJson <- catchLeft (parse (mapError PursManifest asPursJson) found) (userError . CouldntDecodePackageManifest) + catchLeft (toBowerPackage pursJson) (userError . CouldntConvertPackageManifest) + else catchLeft (parse (mapError BowerManifest Bower.asPackageMeta) found) (userError . CouldntDecodePackageManifest) checkLicense pkgMeta @@ -156,7 +162,7 @@ preparePackage' opts = do resolvedDeps <- parseResolutionsFile (publishResolutionsFile opts) - (pkgModules, pkgModuleMap) <- getModules opts (map (second fst) resolvedDeps) + (pkgModules, pkgModuleMap) <- getModules opts (map (second fst) resolvedDeps) let declaredDeps = map fst $ Bower.bowerDependencies pkgMeta pkgResolvedDependencies <- handleDeps declaredDeps (map (second snd) resolvedDeps) @@ -164,18 +170,18 @@ preparePackage' opts = do let pkgUploader = D.NotYetKnown let pkgCompilerVersion = P.version - return D.Package{..} + return D.Package {..} -getModules - :: PublishOptions - -> [(PackageName, FilePath)] - -> PrepareM ([D.Module], Map P.ModuleName PackageName) +getModules :: + PublishOptions -> + [(PackageName, FilePath)] -> + PrepareM ([D.Module], Map P.ModuleName PackageName) getModules opts paths = do (inputFiles, depsFiles) <- liftIO (getInputAndDepsFiles paths) (modules, moduleMap) <- liftIO (runExceptT (D.collectDocs (publishCompileOutputDir opts) inputFiles depsFiles)) - >>= either (userError . CompileError) return + >>= either (userError . CompileError) return pure (map snd modules, moduleMap) @@ -207,15 +213,15 @@ getVersionFromGitTag = do out <- readProcess' "git" ["tag", "--list", "--points-at", "HEAD"] "" let vs = map trimWhitespace (lines out) case mapMaybe parseMay vs of - [] -> userError TagMustBeCheckedOut + [] -> userError TagMustBeCheckedOut [x] -> return (first T.pack x) - xs -> userError (AmbiguousVersions (map snd xs)) + xs -> userError (AmbiguousVersions (map snd xs)) where - trimWhitespace = - dropWhile isSpace >>> reverse >>> dropWhile isSpace >>> reverse - parseMay str = do - digits <- stripPrefix "v" str - (str,) <$> P.parseVersion' digits + trimWhitespace = + dropWhile isSpace >>> reverse >>> dropWhile isSpace >>> reverse + parseMay str = do + digits <- stripPrefix "v" str + (str,) <$> P.parseVersion' digits -- | Given a git tag, get the time it was created. getTagTime :: Text -> PrepareM UTCTime @@ -229,14 +235,16 @@ getManifestRepositoryInfo :: PackageMeta -> PrepareM (D.GithubUser, D.GithubRepo getManifestRepositoryInfo pkgMeta = case bowerRepository pkgMeta of Nothing -> do - giturl <- catchError (Just . T.strip . T.pack <$> readProcess' "git" ["config", "remote.origin.url"] "") - (const (return Nothing)) + giturl <- + catchError + (Just . T.strip . T.pack <$> readProcess' "git" ["config", "remote.origin.url"] "") + (const (return Nothing)) userError (BadRepositoryField (RepositoryFieldMissing (giturl >>= extractGithub <&> format))) - Just Repository{..} -> do - unless (repositoryType == "git") + Just Repository {..} -> do + unless + (repositoryType == "git") (userError (BadRepositoryField (BadRepositoryType repositoryType))) maybe (userError (BadRepositoryField NotOnGithub)) return (extractGithub repositoryUrl) - where format :: (D.GithubUser, D.GithubRepo) -> Text format (user, repo) = "https://github.com/" <> D.runGithubUser user <> "/" <> D.runGithubRepo repo <> ".git" @@ -247,60 +255,66 @@ checkLicense pkgMeta = [] -> userError NoLicenseSpecified ls -> - unless (any (isValidSPDX . T.unpack) ls) + unless + (any (isValidSPDX . T.unpack) ls) (userError InvalidLicense) --- | --- Check if a string is a valid SPDX license expression. --- +{- | +Check if a string is a valid SPDX license expression. +-} isValidSPDX :: String -> Bool isValidSPDX input = case CabalParsec.simpleParsec input of Nothing -> False Just SPDX.NONE -> False Just _ -> True - extractGithub :: Text -> Maybe (D.GithubUser, D.GithubRepo) -extractGithub = stripGitHubPrefixes - >>> fmap (T.splitOn "/") - >=> takeTwo - >>> fmap (D.GithubUser *** (D.GithubRepo . dropDotGit)) - +extractGithub = + stripGitHubPrefixes + >>> fmap (T.splitOn "/") + >=> takeTwo + >>> fmap (D.GithubUser *** (D.GithubRepo . dropDotGit)) where - takeTwo :: [a] -> Maybe (a, a) - takeTwo [x, y] = Just (x, y) - takeTwo _ = Nothing - - stripGitHubPrefixes :: Text -> Maybe Text - stripGitHubPrefixes = stripPrefixes [ "git://github.com/" - , "https://github.com/" - , "git@github.com:" - ] - - stripPrefixes :: [Text] -> Text -> Maybe Text - stripPrefixes prefixes str = msum $ (`T.stripPrefix` str) <$> prefixes - - dropDotGit :: Text -> Text - dropDotGit str - | ".git" `T.isSuffixOf` str = T.take (T.length str - 4) str - | otherwise = str + takeTwo :: [a] -> Maybe (a, a) + takeTwo [x, y] = Just (x, y) + takeTwo _ = Nothing + + stripGitHubPrefixes :: Text -> Maybe Text + stripGitHubPrefixes = + stripPrefixes + [ "git://github.com/" + , "https://github.com/" + , "git@github.com:" + ] + + stripPrefixes :: [Text] -> Text -> Maybe Text + stripPrefixes prefixes str = msum $ (`T.stripPrefix` str) <$> prefixes + + dropDotGit :: Text -> Text + dropDotGit str + | ".git" `T.isSuffixOf` str = T.take (T.length str - 4) str + | otherwise = str readProcess' :: String -> [String] -> String -> PrepareM String readProcess' prog args stdin = do - out <- liftIO (catch (Right <$> readProcess prog args stdin) - (return . Left)) + out <- + liftIO + ( catch + (Right <$> readProcess prog args stdin) + (return . Left) + ) either (otherError . ProcessFailed prog args) return out data DependencyStatus - = NoResolution - -- ^ In the resolutions file, there was no _resolution key. - | ResolvedOther Text - -- ^ Resolved, but to something other than a version. The Text argument + = -- | In the resolutions file, there was no _resolution key. + NoResolution + | -- | Resolved, but to something other than a version. The Text argument -- is the resolution type. The values it can take that I'm aware of are -- "commit" and "branch". Note: this constructor is deprecated, and is only -- used when parsing legacy resolutions files. - | ResolvedVersion Version - -- ^ Resolved to a version. + ResolvedOther Text + | -- | Resolved to a version. + ResolvedVersion Version deriving (Show, Eq) parseResolutionsFile :: FilePath -> PrepareM [(PackageName, (FilePath, DependencyStatus))] @@ -314,35 +328,37 @@ parseResolutionsFile resolutionsFile = do Left err -> userError $ ResolutionsFileError resolutionsFile err --- | Parser for resolutions files, which contain information about the packages --- which this package depends on. A resolutions file should look something like --- this: --- --- { --- "purescript-prelude": { --- "version": "4.0.0", --- "path": "bower_components/purescript-prelude" --- }, --- "purescript-lists": { --- "version": "6.0.0", --- "path": "bower_components/purescript-lists" --- }, --- ... --- } --- --- where the version is used for generating links between packages on Pursuit, --- and the path is used to obtain the source files while generating --- documentation: all files matching the glob "src/**/*.purs" relative to the --- `path` directory will be picked up. --- --- The "version" field is optional, but omitting it will mean that no links --- will be generated for any declarations from that package on Pursuit. The --- "path" field is required. +{- | Parser for resolutions files, which contain information about the packages +which this package depends on. A resolutions file should look something like +this: + +{ + "purescript-prelude": { + "version": "4.0.0", + "path": "bower_components/purescript-prelude" + }, + "purescript-lists": { + "version": "6.0.0", + "path": "bower_components/purescript-lists" + }, + ... +} + +where the version is used for generating links between packages on Pursuit, +and the path is used to obtain the source files while generating +documentation: all files matching the glob "src/**/*.purs" relative to the +`path` directory will be picked up. + +The "version" field is optional, but omitting it will mean that no links +will be generated for any declarations from that package on Pursuit. The +"path" field is required. +-} asResolutions :: Parse D.PackageError [(PackageName, (FilePath, DependencyStatus))] asResolutions = eachInObjectWithKey parsePackageName $ - (,) <$> key "path" asString - <*> (maybe NoResolution ResolvedVersion <$> keyMay "version" asVersion) + (,) + <$> key "path" asString + <*> (maybe NoResolution ResolvedVersion <$> keyMay "version" asVersion) asVersion :: Parse D.PackageError Version asVersion = @@ -351,18 +367,18 @@ asVersion = parsePackageName :: Text -> Either D.PackageError PackageName parsePackageName = first D.ErrorInPackageMeta . D.mapLeft BowerManifest . Bower.parsePackageName -handleDeps - :: [PackageName] - -- ^ dependencies declared in package manifest file; we should emit - -- warnings for any package name in this list which is not in the - -- resolutions file. - -> [(PackageName, DependencyStatus)] - -- ^ Contents of resolutions file - -> PrepareM [(PackageName, Version)] +handleDeps :: + -- | dependencies declared in package manifest file; we should emit + -- warnings for any package name in this list which is not in the + -- resolutions file. + [PackageName] -> + -- | Contents of resolutions file + [(PackageName, DependencyStatus)] -> + PrepareM [(PackageName, Version)] handleDeps declared resolutions = do let missing = declared \\ map fst resolutions case missing of - (x:xs) -> + (x : xs) -> userError (MissingDependencies (x :| xs)) [] -> do pkgs <- @@ -378,9 +394,9 @@ handleDeps declared resolutions = do pure (Just (pkgName, version)) pure (catMaybes pkgs) -getInputAndDepsFiles - :: [(PackageName, FilePath)] - -> IO ([FilePath], [(PackageName, FilePath)]) +getInputAndDepsFiles :: + [(PackageName, FilePath)] -> + IO ([FilePath], [(PackageName, FilePath)]) getInputAndDepsFiles depPaths = do inputFiles <- globRelative purescriptSourceFiles let handleDep (pkgName, path) = do diff --git a/src/Language/PureScript/Publish/BoxesHelpers.hs b/src/Language/PureScript/Publish/BoxesHelpers.hs index 36d9a180b..daae1d9c2 100644 --- a/src/Language/PureScript/Publish/BoxesHelpers.hs +++ b/src/Language/PureScript/Publish/BoxesHelpers.hs @@ -1,8 +1,8 @@ -module Language.PureScript.Publish.BoxesHelpers - ( Boxes.Box - , Boxes.nullBox - , module Language.PureScript.Publish.BoxesHelpers - ) where +module Language.PureScript.Publish.BoxesHelpers ( + Boxes.Box, + Boxes.nullBox, + module Language.PureScript.Publish.BoxesHelpers, +) where import Prelude @@ -27,7 +27,7 @@ indented b = Boxes.hcat Boxes.left [Boxes.emptyBox 1 indentWidth, b] successivelyIndented :: [String] -> Boxes.Box successivelyIndented [] = Boxes.nullBox -successivelyIndented (x:xs) = +successivelyIndented (x : xs) = Boxes.vcat Boxes.left [para x, indented (successivelyIndented xs)] vcat :: [Boxes.Box] -> Boxes.Box diff --git a/src/Language/PureScript/Publish/ErrorsWarnings.hs b/src/Language/PureScript/Publish/ErrorsWarnings.hs index b855f68a4..84ad1af1b 100644 --- a/src/Language/PureScript/Publish/ErrorsWarnings.hs +++ b/src/Language/PureScript/Publish/ErrorsWarnings.hs @@ -1,16 +1,16 @@ -module Language.PureScript.Publish.ErrorsWarnings - ( PackageError(..) - , PackageWarning(..) - , UserError(..) - , InternalError(..) - , OtherError(..) - , RepositoryFieldError(..) - , JSONSource(..) - , printError - , renderError - , printWarnings - , renderWarnings - ) where +module Language.PureScript.Publish.ErrorsWarnings ( + PackageError (..), + PackageWarning (..), + UserError (..), + InternalError (..), + OtherError (..), + RepositoryFieldError (..), + JSONSource (..), + printError, + renderError, + printWarnings, + renderWarnings, +) where import Prelude @@ -18,24 +18,25 @@ import Control.Exception (IOException) import Data.Aeson.BetterErrors (ParseError, displayError) import Data.List (intersperse) -import Data.List.NonEmpty (NonEmpty(..)) -import Data.Maybe (catMaybes, fromMaybe) -import Data.Monoid (Any(..)) -import Data.Version (Version, showVersion) +import Data.List.NonEmpty (NonEmpty (..)) import Data.List.NonEmpty qualified as NonEmpty +import Data.Maybe (catMaybes, fromMaybe) +import Data.Monoid (Any (..)) import Data.Text (Text) import Data.Text qualified as T +import Data.Version (Version, showVersion) -import Language.PureScript.Docs.Types qualified as D import Language.PureScript qualified as P +import Language.PureScript.Docs.Types qualified as D import Language.PureScript.Publish.BoxesHelpers (Box, bulletedList, bulletedListT, indented, nullBox, para, printToStderr, spacer, successivelyIndented, vcat) +import Language.PureScript.Docs.Types (showManifestError) import Web.Bower.PackageMeta (PackageName, runPackageName, showBowerError) import Web.Bower.PackageMeta qualified as Bower -import Language.PureScript.Docs.Types (showManifestError) --- | An error which meant that it was not possible to retrieve metadata for a --- package. +{- | An error which meant that it was not possible to retrieve metadata for a +package. +-} data PackageError = UserError UserError | InternalError InternalError @@ -94,10 +95,10 @@ renderError err = case err of UserError e -> vcat - [ para ( - "There is a problem with your package, which meant that " ++ - "it could not be published." - ) + [ para + ( "There is a problem with your package, which meant that " + ++ "it could not be published." + ) , para "Details:" , indented (displayUserError e) ] @@ -142,98 +143,115 @@ displayUserError e = case e of , para "Please ensure that your package manifest file is valid." ] TagMustBeCheckedOut -> - vcat - [ para (concat - [ "purs publish requires a tagged version to be checked out in " - , "order to build documentation, and no suitable tag was found. " - , "Please check out a previously tagged version, or tag a new " - , "version." - ]) - , spacer - , para "Note: tagged versions must be in the form" - , indented (para "v{MAJOR}.{MINOR}.{PATCH} (example: \"v1.6.2\")") - , spacer - , para (concat - [ "If the version you are publishing is not yet tagged, you might " - , "want to use the --dry-run flag instead, which removes this " - , "requirement. Run `purs publish --help` for more details." - ]) - ] + vcat + [ para + ( concat + [ "purs publish requires a tagged version to be checked out in " + , "order to build documentation, and no suitable tag was found. " + , "Please check out a previously tagged version, or tag a new " + , "version." + ] + ) + , spacer + , para "Note: tagged versions must be in the form" + , indented (para "v{MAJOR}.{MINOR}.{PATCH} (example: \"v1.6.2\")") + , spacer + , para + ( concat + [ "If the version you are publishing is not yet tagged, you might " + , "want to use the --dry-run flag instead, which removes this " + , "requirement. Run `purs publish --help` for more details." + ] + ) + ] AmbiguousVersions vs -> vcat $ - [ para (concat - [ "The currently checked out commit seems to have been tagged with " - , "more than 1 version, and I don't know which one should be used. " - , "Please either delete some of the tags, or create a new commit " - , "to tag the desired version with." - ]) + [ para + ( concat + [ "The currently checked out commit seems to have been tagged with " + , "more than 1 version, and I don't know which one should be used. " + , "Please either delete some of the tags, or create a new commit " + , "to tag the desired version with." + ] + ) , spacer , para "Tags for the currently checked out commit:" - ] ++ bulletedList showVersion vs + ] + ++ bulletedList showVersion vs BadRepositoryField err -> displayRepositoryError err NoLicenseSpecified -> vcat $ - [ para $ concat - [ "No license is specified in package manifest. Please add a " - , "\"license\" property with a SPDX license expression. For example, " - , "any of the following would be acceptable:" - ] - , spacer - ] ++ spdxExamples ++ - [ spacer - , para $ - "See https://spdx.org/licenses/ for a full list of licenses. For more " ++ - "information on SPDX license expressions, see https://spdx.org/ids-how" + [ para $ + concat + [ "No license is specified in package manifest. Please add a " + , "\"license\" property with a SPDX license expression. For example, " + , "any of the following would be acceptable:" + ] , spacer - , para $ - "Note that distributing code without a license means that nobody will " ++ - "(legally) be able to use it." - , spacer - , para $ - "It is also recommended to add a LICENSE file to the repository, " ++ - "including your name and the current year, although this is not necessary." ] + ++ spdxExamples + ++ [ spacer + , para $ + "See https://spdx.org/licenses/ for a full list of licenses. For more " + ++ "information on SPDX license expressions, see https://spdx.org/ids-how" + , spacer + , para $ + "Note that distributing code without a license means that nobody will " + ++ "(legally) be able to use it." + , spacer + , para $ + "It is also recommended to add a LICENSE file to the repository, " + ++ "including your name and the current year, although this is not necessary." + ] InvalidLicense -> vcat $ - [ para $ concat - [ "The license specified in package manifest is not a valid SPDX " - , "license expression. Please update the \"license\" property so that " - , "it is a valid SPDX license expression. For example, any of the " - , "following would be acceptable:" - ] + [ para $ + concat + [ "The license specified in package manifest is not a valid SPDX " + , "license expression. Please update the \"license\" property so that " + , "it is a valid SPDX license expression. For example, any of the " + , "following would be acceptable:" + ] , spacer - ] ++ - spdxExamples + ] + ++ spdxExamples MissingDependencies pkgs -> let singular = NonEmpty.length pkgs == 1 pl a b = if singular then b else a - do_ = pl "do" "does" + do_ = pl "do" "does" dependencies = pl "dependencies" "dependency" - in vcat $ - para (concat - [ "The following ", dependencies, " ", do_, " not appear to be " - , "installed:" - ]) : - bulletedListT runPackageName (NonEmpty.toList pkgs) + in vcat $ + para + ( concat + [ "The following " + , dependencies + , " " + , do_ + , " not appear to be " + , "installed:" + ] + ) + : bulletedListT runPackageName (NonEmpty.toList pkgs) CompileError err -> vcat [ para "Compile error:" , indented (vcat (P.prettyPrintMultipleErrorsBox P.defaultPPEOptions err)) ] DirtyWorkingTree -> - para ( - "Your git working tree is dirty. Please commit, discard, or stash " ++ - "your changes first." - ) + para + ( "Your git working tree is dirty. Please commit, discard, or stash " + ++ "your changes first." + ) ResolutionsFileError path err -> successivelyIndented $ - ("Error in resolutions file (" ++ path ++ "):") : - map T.unpack (displayError D.displayPackageError err) + ("Error in resolutions file (" ++ path ++ "):") + : map T.unpack (displayError D.displayPackageError err) spdxExamples :: [Box] spdxExamples = - map (indented . para) + map + (indented . para) [ "* \"MIT\"" , "* \"Apache-2.0\"" , "* \"BSD-2-Clause\"" @@ -245,50 +263,60 @@ displayRepositoryError :: RepositoryFieldError -> Box displayRepositoryError err = case err of RepositoryFieldMissing giturl -> vcat - [ para (concat - [ "The 'repository' or 'location' field is not present in your package manifest file. " - , "Without this information, Pursuit would not be able to generate " - , "source links in your package's documentation. Please add one - like " - , "this, if you are using the bower.json format:" - ]) + [ para + ( concat + [ "The 'repository' or 'location' field is not present in your package manifest file. " + , "Without this information, Pursuit would not be able to generate " + , "source links in your package's documentation. Please add one - like " + , "this, if you are using the bower.json format:" + ] + ) , spacer - , indented (vcat - [ para "\"repository\": {" - , indented (para "\"type\": \"git\",") - , indented (para ("\"url\": \"" ++ T.unpack (fromMaybe "https://github.com/USER/REPO.git" giturl) ++ "\"")) - , para "}" - ] - ) + , indented + ( vcat + [ para "\"repository\": {" + , indented (para "\"type\": \"git\",") + , indented (para ("\"url\": \"" ++ T.unpack (fromMaybe "https://github.com/USER/REPO.git" giturl) ++ "\"")) + , para "}" + ] + ) , para "or like this, if you are using the purs.json format:" , spacer - , indented (vcat - [ para "\"location\": {" - , indented (para "\"githubOwner\": \"USER\",") - , indented (para "\"githubRepo\": \"REPO\",") - , para "}" - ] - ) + , indented + ( vcat + [ para "\"location\": {" + , indented (para "\"githubOwner\": \"USER\",") + , indented (para "\"githubRepo\": \"REPO\",") + , para "}" + ] + ) ] BadRepositoryType ty -> - para (concat - [ "In your package manifest file, the repository type is currently listed as " - , "\"" ++ T.unpack ty ++ "\". Currently, only git repositories are supported. " - , "Please publish your code in a git repository, and then update the " - , "repository type in your package manifest file to \"git\"." - ]) + para + ( concat + [ "In your package manifest file, the repository type is currently listed as " + , "\"" ++ T.unpack ty ++ "\". Currently, only git repositories are supported. " + , "Please publish your code in a git repository, and then update the " + , "repository type in your package manifest file to \"git\"." + ] + ) NotOnGithub -> vcat - [ para (concat - [ "The repository url in your package manifest file does not point to a " - , "GitHub repository. Currently, Pursuit does not support packages " - , "which are not hosted on GitHub." - ]) + [ para + ( concat + [ "The repository url in your package manifest file does not point to a " + , "GitHub repository. Currently, Pursuit does not support packages " + , "which are not hosted on GitHub." + ] + ) , spacer - , para (concat - [ "Please update your package manifest file to point to a GitHub repository. " - , "Alternatively, if you would prefer not to host your package on " - , "GitHub, please open an issue:" - ]) + , para + ( concat + [ "Please update your package manifest file to point to a GitHub repository. " + , "Alternatively, if you would prefer not to host your package on " + , "GitHub, please open an issue:" + ] + ) , indented (para "https://github.com/purescript/purescript/issues/new") ] @@ -307,12 +335,12 @@ displayOtherError e = case e of ] IOExceptionThrown exc -> successivelyIndented - [ "An IO exception occurred:", show exc ] + ["An IO exception occurred:", show exc] data CollectedWarnings = CollectedWarnings - { noResolvedVersions :: [PackageName] - , unacceptableVersions :: [(PackageName, Text)] - , dirtyWorkingTree :: Any + { noResolvedVersions :: [PackageName] + , unacceptableVersions :: [(PackageName, Text)] + , dirtyWorkingTree :: Any } deriving (Show, Eq, Ord) @@ -326,86 +354,118 @@ instance Monoid CollectedWarnings where collectWarnings :: [PackageWarning] -> CollectedWarnings collectWarnings = foldMap singular where - singular w = case w of - NoResolvedVersion pn -> - mempty { noResolvedVersions = [pn] } - UnacceptableVersion t -> - mempty { unacceptableVersions = [t] } - DirtyWorkingTreeWarn -> - mempty { dirtyWorkingTree = Any True } + singular w = case w of + NoResolvedVersion pn -> + mempty {noResolvedVersions = [pn]} + UnacceptableVersion t -> + mempty {unacceptableVersions = [t]} + DirtyWorkingTreeWarn -> + mempty {dirtyWorkingTree = Any True} renderWarnings :: [PackageWarning] -> Box renderWarnings warns = - let CollectedWarnings{..} = collectWarnings warns + let CollectedWarnings {..} = collectWarnings warns go toBox warns' = toBox <$> NonEmpty.nonEmpty warns' - mboxes = [ go warnNoResolvedVersions noResolvedVersions - , go warnUnacceptableVersions unacceptableVersions - , if getAny dirtyWorkingTree - then Just warnDirtyWorkingTree - else Nothing - ] - in case catMaybes mboxes of - [] -> nullBox - boxes -> vcat [ para "Warnings:" - , indented (vcat (intersperse spacer boxes)) - ] + mboxes = + [ go warnNoResolvedVersions noResolvedVersions + , go warnUnacceptableVersions unacceptableVersions + , if getAny dirtyWorkingTree + then Just warnDirtyWorkingTree + else Nothing + ] + in case catMaybes mboxes of + [] -> nullBox + boxes -> + vcat + [ para "Warnings:" + , indented (vcat (intersperse spacer boxes)) + ] warnNoResolvedVersions :: NonEmpty PackageName -> Box warnNoResolvedVersions pkgNames = let singular = NonEmpty.length pkgNames == 1 pl a b = if singular then b else a - packages = pl "packages" "package" + packages = pl "packages" "package" anyOfThese = pl "any of these" "this" - these = pl "these" "this" - in vcat $ - [ para (concat - ["The following ", packages, " did not appear to have a resolved " - , "version:"]) - ] ++ - bulletedListT runPackageName (NonEmpty.toList pkgNames) - ++ - [ spacer - , para (concat - ["Links to types in ", anyOfThese, " ", packages, " will not work. In " - , "order to make links work, edit your package manifest to specify a version" - , " or a version range for ", these, " ", packages, "." - ]) - ] + these = pl "these" "this" + in vcat $ + [ para + ( concat + [ "The following " + , packages + , " did not appear to have a resolved " + , "version:" + ] + ) + ] + ++ bulletedListT runPackageName (NonEmpty.toList pkgNames) + ++ [ spacer + , para + ( concat + [ "Links to types in " + , anyOfThese + , " " + , packages + , " will not work. In " + , "order to make links work, edit your package manifest to specify a version" + , " or a version range for " + , these + , " " + , packages + , "." + ] + ) + ] warnUnacceptableVersions :: NonEmpty (PackageName, Text) -> Box warnUnacceptableVersions pkgs = let singular = NonEmpty.length pkgs == 1 pl a b = if singular then b else a - packages' = pl "packages'" "package's" - packages = pl "packages" "package" + packages' = pl "packages'" "package's" + packages = pl "packages" "package" anyOfThese = pl "any of these" "this" - these = pl "these" "this" - versions = pl "versions" "version" - in vcat $ - [ para (concat - [ "The following installed ", packages', " ", versions, " could " - , "not be parsed:" - ]) - ] ++ - bulletedListT showTuple (NonEmpty.toList pkgs) - ++ - [ spacer - , para (concat - ["Links to types in ", anyOfThese, " ", packages, " will not work. In " - , "order to make links work, edit your package manifest to specify an " - , "acceptable version or version range for ", these, " ", packages, "." - ]) - ] + these = pl "these" "this" + versions = pl "versions" "version" + in vcat $ + [ para + ( concat + [ "The following installed " + , packages' + , " " + , versions + , " could " + , "not be parsed:" + ] + ) + ] + ++ bulletedListT showTuple (NonEmpty.toList pkgs) + ++ [ spacer + , para + ( concat + [ "Links to types in " + , anyOfThese + , " " + , packages + , " will not work. In " + , "order to make links work, edit your package manifest to specify an " + , "acceptable version or version range for " + , these + , " " + , packages + , "." + ] + ) + ] where - showTuple (pkgName, tag) = runPackageName pkgName <> "#" <> tag + showTuple (pkgName, tag) = runPackageName pkgName <> "#" <> tag warnDirtyWorkingTree :: Box warnDirtyWorkingTree = - para ( - "Your working tree is dirty. (Note: this would be an error if it " - ++ "were not a dry run)" + para + ( "Your working tree is dirty. (Note: this would be an error if it " + ++ "were not a dry run)" ) printWarnings :: [PackageWarning] -> IO () diff --git a/src/Language/PureScript/Publish/Registry/Compat.hs b/src/Language/PureScript/Publish/Registry/Compat.hs index a1a01ed9a..d949f73e0 100644 --- a/src/Language/PureScript/Publish/Registry/Compat.hs +++ b/src/Language/PureScript/Publish/Registry/Compat.hs @@ -1,32 +1,33 @@ --- | A compatibility module that allows a restricted set of purs.json manifest --- | files to be used for publishing. The manifest must described a package --- | available on GitHub, and it must be convertable to a Bower manifest. --- | --- | Fully supporting the registry manifest format will require `purs publish` --- | and by extension Pursuit to relax the requirement that packages are hosted --- | on GitHub, because the registry does not have this requirement. +{- | A compatibility module that allows a restricted set of purs.json manifest +| files to be used for publishing. The manifest must described a package +| available on GitHub, and it must be convertable to a Bower manifest. +| +| Fully supporting the registry manifest format will require `purs publish` +| and by extension Pursuit to relax the requirement that packages are hosted +| on GitHub, because the registry does not have this requirement. +-} module Language.PureScript.Publish.Registry.Compat where -import Protolude +import Data.Aeson.BetterErrors (Parse, asText, eachInObject, key, keyMay, throwCustomError) +import Data.Bitraversable (Bitraversable (..)) import Data.Map qualified as Map +import Protolude import Web.Bower.PackageMeta qualified as Bower -import Data.Bitraversable (Bitraversable(..)) -import Data.Aeson.BetterErrors (key, asText, keyMay, eachInObject, Parse, throwCustomError) -- | Convert a valid purs.json manifest into a bower.json manifest toBowerPackage :: PursJson -> Either Bower.BowerError Bower.PackageMeta -toBowerPackage PursJson{..} = do +toBowerPackage PursJson {..} = do bowerName <- Bower.parsePackageName ("purescript-" <> pursJsonName) let bowerDescription = pursJsonDescription bowerMain = [] bowerModuleType = [] - bowerLicense = [ pursJsonLicense ] + bowerLicense = [pursJsonLicense] bowerIgnore = [] bowerKeywords = [] bowerAuthors = [] bowerHomepage = Just pursJsonLocation - bowerRepository = Just $ Bower.Repository { repositoryUrl = pursJsonLocation, repositoryType = "git" } + bowerRepository = Just $ Bower.Repository {repositoryUrl = pursJsonLocation, repositoryType = "git"} bowerDevDependencies = [] bowerResolutions = [] bowerPrivate = False @@ -35,27 +36,28 @@ toBowerPackage PursJson{..} = do bowerDependencies <- parseDependencies $ Map.toAscList pursJsonDependencies pure $ Bower.PackageMeta {..} --- | A partial representation of the purs.json manifest format, including only --- | the fields required for publishing. --- | --- | https://github.com/purescript/registry/blob/master/v1/Manifest.dhall --- --- This type is intended for compatibility with the Bower publishing pipeline, --- and does not accurately reflect all possible purs.json manifests. However, --- supporting purs.json manifests properly introduces breaking changes to the --- compiler and to Pursuit. +{- | A partial representation of the purs.json manifest format, including only +| the fields required for publishing. +| +| https://github.com/purescript/registry/blob/master/v1/Manifest.dhall + +This type is intended for compatibility with the Bower publishing pipeline, +and does not accurately reflect all possible purs.json manifests. However, +supporting purs.json manifests properly introduces breaking changes to the +compiler and to Pursuit. +-} data PursJson = PursJson - { -- | The name of the package - pursJsonName :: Text - -- | The SPDX identifier representing the package license + { pursJsonName :: Text + -- ^ The name of the package , pursJsonLicense :: Text - -- | The GitHub repository hosting the package + -- ^ The SPDX identifier representing the package license , pursJsonLocation :: Text - -- | An optional description of the package + -- ^ The GitHub repository hosting the package , pursJsonDescription :: Maybe Text - -- | A map of dependencies, where keys are package names and values are - -- | dependency ranges of the form '>=X.Y.Z =X.Y.Z catchError asGitUrl (\_ -> throwCustomError MalformedLocationField)) + asOwnerRepoOrGitUrl = + catchError asOwnerRepo (\_ -> catchError asGitUrl (\_ -> throwCustomError MalformedLocationField)) - asGitUrl = - key "gitUrl" asText + asGitUrl = + key "gitUrl" asText - asOwnerRepo = do - githubOwner <- key "githubOwner" asText - githubRepo <- key "githubRepo" asText - pure $ "https://github.com/" <> githubOwner <> "/" <> githubRepo <> ".git" + asOwnerRepo = do + githubOwner <- key "githubOwner" asText + githubRepo <- key "githubRepo" asText + pure $ "https://github.com/" <> githubOwner <> "/" <> githubRepo <> ".git" diff --git a/src/Language/PureScript/Publish/Utils.hs b/src/Language/PureScript/Publish/Utils.hs index 376072951..1d9de434a 100644 --- a/src/Language/PureScript/Publish/Utils.hs +++ b/src/Language/PureScript/Publish/Utils.hs @@ -1,14 +1,14 @@ module Language.PureScript.Publish.Utils where - + import Prelude - + import System.Directory (getCurrentDirectory) import System.FilePath.Glob (Pattern, compile, globDir1) - --- | Glob relative to the current directory, and produce relative pathnames. + +-- | Glob relative to the current directory, and produce relative pathnames. globRelative :: Pattern -> IO [FilePath] globRelative pat = getCurrentDirectory >>= globDir1 pat - --- | Glob pattern for PureScript source files. + +-- | Glob pattern for PureScript source files. purescriptSourceFiles :: Pattern purescriptSourceFiles = compile "src/**/*.purs" diff --git a/src/Language/PureScript/Renamer.hs b/src/Language/PureScript/Renamer.hs index a54e39f1e..9656fbe1d 100644 --- a/src/Language/PureScript/Renamer.hs +++ b/src/Language/PureScript/Renamer.hs @@ -1,35 +1,35 @@ --- | --- Renaming pass that prevents shadowing of local identifiers. --- +{- | +Renaming pass that prevents shadowing of local identifiers. +-} module Language.PureScript.Renamer (renameInModule) where import Prelude -import Control.Monad.State (MonadState(..), State, gets, modify, runState, (>=>)) +import Control.Monad.State (MonadState (..), State, gets, modify, runState, (>=>)) -import Data.Functor ((<&>)) import Data.List (find) -import Data.Maybe (fromJust, fromMaybe) import Data.Map qualified as M +import Data.Maybe (fromJust, fromMaybe) import Data.Set qualified as S import Data.Text qualified as T -import Language.PureScript.CoreFn (Ann, Bind(..), Binder(..), CaseAlternative(..), Expr(..), Literal(..), Module(..)) -import Language.PureScript.Names (Ident(..), Qualified(..), isBySourcePos, isPlainIdent, runIdent, showIdent) +import Control.Lens +import Data.Char (isUpper) +import Language.PureScript.CoreFn (Ann, Bind (..), Binder (..), CaseAlternative (..), Expr (..), Literal (..)) +import Language.PureScript.CoreFn.Module +import Language.PureScript.Names (Ident (..), Qualified (..), disqualify, isBySourcePos, isPlainIdent, runIdent, showIdent) import Language.PureScript.Traversals (eitherM, pairM, sndM) --- | --- The state object used in this module --- -data RenameState = RenameState { - -- | - -- A map from names bound (in the input) to their names (in the output) - -- - rsBoundNames :: M.Map Ident Ident - -- | - -- The set of names which have been used and are in scope in the output - -- +{- | +The state object used in this module +-} +data RenameState = RenameState + { rsBoundNames :: M.Map Ident Ident + -- ^ + -- A map from names bound (in the input) to their names (in the output) , rsUsedNames :: S.Set Ident + -- ^ + -- The set of names which have been used and are in scope in the output } type Rename = State RenameState @@ -37,16 +37,16 @@ type Rename = State RenameState initState :: [Ident] -> RenameState initState scope = RenameState (M.fromList (zip scope scope)) (S.fromList scope) --- | --- Runs renaming starting with a list of idents for the initial scope. --- +{- | +Runs renaming starting with a list of idents for the initial scope. +-} runRename :: [Ident] -> Rename a -> (a, RenameState) runRename scope = flip runState (initState scope) --- | --- Creates a new renaming scope using the current as a basis. Used to backtrack --- when leaving an Abs. --- +{- | +Creates a new renaming scope using the current as a basis. Used to backtrack +when leaving an Abs. +-} newScope :: Rename a -> Rename a newScope x = do scope <- get @@ -54,10 +54,10 @@ newScope x = do put scope return a --- | --- Adds a new scope entry for an ident. If the ident is already present, a new --- unique name is generated and stored. --- +{- | +Adds a new scope entry for an ident. If the ident is already present, a new +unique name is generated and stored. +-} updateScope :: Ident -> Rename Ident updateScope ident = case ident of @@ -65,27 +65,30 @@ updateScope ident = UnusedIdent -> return UnusedIdent _ -> go ident ident where - go :: Ident -> Ident -> Rename Ident - go keyName baseName = do - scope <- get - let usedNames = rsUsedNames scope - name' = - if baseName `S.member` usedNames - then getNewName usedNames baseName - else baseName - modify $ \s -> s { rsBoundNames = M.insert keyName name' (rsBoundNames s) - , rsUsedNames = S.insert name' (rsUsedNames s) - } - return name' - getNewName :: S.Set Ident -> Ident -> Ident - getNewName usedNames name = - fromJust $ find - (`S.notMember` usedNames) - [ Ident (runIdent name <> T.pack (show (i :: Int))) | i <- [1..] ] - --- | --- Finds the new name to use for an ident. --- + go :: Ident -> Ident -> Rename Ident + go keyName baseName = do + scope <- get + let usedNames = rsUsedNames scope + name' = + if baseName `S.member` usedNames + then getNewName usedNames baseName + else baseName + modify $ \s -> + s + { rsBoundNames = M.insert keyName name' (rsBoundNames s) + , rsUsedNames = S.insert name' (rsUsedNames s) + } + return name' + getNewName :: S.Set Ident -> Ident -> Ident + getNewName usedNames name = + fromJust $ + find + (`S.notMember` usedNames) + [Ident (runIdent name <> T.pack (show (i :: Int))) | i <- [1 ..]] + +{- | +Finds the new name to use for an ident. +-} lookupIdent :: Ident -> Rename Ident lookupIdent UnusedIdent = return UnusedIdent lookupIdent name = do @@ -94,121 +97,125 @@ lookupIdent name = do Just name'' -> return name'' Nothing -> error $ "Rename scope is missing ident '" ++ T.unpack (showIdent name) ++ "'" - --- | --- Renames within each declaration in a module. Returns the map of renamed --- identifiers in the top-level scope, so that they can be renamed in the --- externs files as well. --- -renameInModule :: Module Ann -> (M.Map Ident Ident, Module Ann) -renameInModule m@(Module _ _ _ _ _ exports _ foreigns decls) = (rsBoundNames, m { moduleExports, moduleDecls }) +{- | +Renames within each declaration in a module. Returns the map of renamed +identifiers in the top-level scope, so that they can be renamed in the +externs files as well. +-} +renameInModule :: Module (Bind Ann) k t Ann -> (M.Map Ident Ident, Module (Bind Ann) k t Ann) +renameInModule m@(Module mn _ _ _ _ exports _ foreigns decls datatypes) = (rsBoundNames, m {moduleExports, moduleDecls}) where - ((moduleDecls, moduleExports), RenameState{..}) = runRename foreigns $ - (,) <$> renameInDecls decls <*> traverse lookupIdent exports - --- | --- Renames within a list of declarations. The list is processed in three --- passes: --- --- 1) Declarations with user-provided names are added to the scope, renaming --- them only if necessary to prevent shadowing. --- 2) Declarations with compiler-provided names are added to the scope, --- renaming them to prevent shadowing or collision with a user-provided --- name. --- 3) The bodies of the declarations are processed recursively. --- --- The distinction between passes 1 and 2 is critical in the top-level module --- scope, where declarations can be exported and named declarations must not --- be renamed. Below the top level, this only matters for programmers looking --- at the generated code or using a debugger; we want them to see the names --- they used as much as possible. --- --- The distinction between the first two passes and pass 3 is important because --- a `GenIdent` can appear before its declaration in a depth-first traversal, --- and we need to visit the declaration first in order to rename all of its --- uses. Similarly, a plain `Ident` could shadow another declared in an outer --- scope but later in a depth-first traversal, and we need to visit the --- outer declaration first in order to know to rename the inner one. --- + ctorIdents = datatypes ^. ctorDict . to M.keys . to (map disqualify) + ((moduleDecls, moduleExports), RenameState {..}) = + runRename (foreigns <> ctorIdents) $ + (,) <$> renameInDecls decls <*> traverse lookupIdent exports + +{- | +Renames within a list of declarations. The list is processed in three +passes: + + 1) Declarations with user-provided names are added to the scope, renaming + them only if necessary to prevent shadowing. + 2) Declarations with compiler-provided names are added to the scope, + renaming them to prevent shadowing or collision with a user-provided + name. + 3) The bodies of the declarations are processed recursively. + +The distinction between passes 1 and 2 is critical in the top-level module +scope, where declarations can be exported and named declarations must not +be renamed. Below the top level, this only matters for programmers looking +at the generated code or using a debugger; we want them to see the names +they used as much as possible. + +The distinction between the first two passes and pass 3 is important because +a `GenIdent` can appear before its declaration in a depth-first traversal, +and we need to visit the declaration first in order to rename all of its +uses. Similarly, a plain `Ident` could shadow another declared in an outer +scope but later in a depth-first traversal, and we need to visit the +outer declaration first in order to know to rename the inner one. +-} renameInDecls :: [Bind Ann] -> Rename [Bind Ann] renameInDecls = - traverse (renameDecl False) - >=> traverse (renameDecl True) - >=> traverse renameValuesInDecl - + traverse (renameDecl False) + >=> traverse (renameDecl True) + >=> traverse renameValuesInDecl where - - renameDecl :: Bool -> Bind Ann -> Rename (Bind Ann) - renameDecl isSecondPass = \case - NonRec a name val -> updateName name <&> \name' -> NonRec a name' val - Rec ds -> Rec <$> traverse updateNames ds - where - updateName :: Ident -> Rename Ident - updateName name = (if isSecondPass == isPlainIdent name then pure else updateScope) name - - updateNames :: ((Ann, Ident), Expr Ann) -> Rename ((Ann, Ident), Expr Ann) - updateNames ((a, name), val) = updateName name <&> \name' -> ((a, name'), val) - - renameValuesInDecl :: Bind Ann -> Rename (Bind Ann) - renameValuesInDecl = \case - NonRec a name val -> NonRec a name <$> renameInValue val - Rec ds -> Rec <$> traverse updateValues ds - where - updateValues :: ((Ann, Ident), Expr Ann) -> Rename ((Ann, Ident), Expr Ann) - updateValues (aname, val) = (aname, ) <$> renameInValue val - --- | --- Renames within a value. --- + renameDecl :: Bool -> Bind Ann -> Rename (Bind Ann) + renameDecl isSecondPass = \case + NonRec a name val -> updateName name <&> \name' -> NonRec a name' val + Rec ds -> Rec <$> traverse updateNames ds + where + updateName :: Ident -> Rename Ident + updateName name = (if isSecondPass == isPlainIdent name then pure else updateScope) name + + updateNames :: ((Ann, Ident), Expr Ann) -> Rename ((Ann, Ident), Expr Ann) + updateNames ((a, name), val) = updateName name <&> \name' -> ((a, name'), val) + + renameValuesInDecl :: Bind Ann -> Rename (Bind Ann) + renameValuesInDecl = \case + NonRec a name val -> NonRec a name <$> renameInValue val + Rec ds -> Rec <$> traverse updateValues ds + where + updateValues :: ((Ann, Ident), Expr Ann) -> Rename ((Ann, Ident), Expr Ann) + updateValues (aname, val) = (aname,) <$> renameInValue val + +{- | +Renames within a value. +-} renameInValue :: Expr Ann -> Rename (Expr Ann) -renameInValue (Literal ann l) = - Literal ann <$> renameInLiteral renameInValue l -renameInValue c@Constructor{} = return c -renameInValue (Accessor ann prop v) = - Accessor ann prop <$> renameInValue v -renameInValue (ObjectUpdate ann obj copy vs) = - (\obj' -> ObjectUpdate ann obj' copy) <$> renameInValue obj <*> traverse (\(name, v) -> (name, ) <$> renameInValue v) vs -renameInValue (Abs ann name v) = - newScope $ Abs ann <$> updateScope name <*> renameInValue v +renameInValue (Literal ann t l) = + Literal ann t <$> renameInLiteral renameInValue l +renameInValue (Accessor ann t prop v) = + Accessor ann t prop <$> renameInValue v +renameInValue (ObjectUpdate ann t obj copy vs) = + (\obj' -> ObjectUpdate ann t obj' copy) <$> renameInValue obj <*> traverse (\(name, v) -> (name,) <$> renameInValue v) vs +renameInValue (Abs ann t name v) = + newScope $ Abs ann t <$> updateScope name <*> renameInValue v renameInValue (App ann v1 v2) = App ann <$> renameInValue v1 <*> renameInValue v2 -renameInValue (Var ann (Qualified qb name)) | isBySourcePos qb || not (isPlainIdent name) = - -- This should only rename identifiers local to the current module: either - -- they aren't qualified, or they are but they have a name that should not - -- have appeared in a module's externs, so they must be from this module's - -- top-level scope. - Var ann . Qualified qb <$> lookupIdent name -renameInValue v@Var{} = return v -renameInValue (Case ann vs alts) = - newScope $ Case ann <$> traverse renameInValue vs <*> traverse renameInCaseAlternative alts +renameInValue (Var ann t (Qualified qb name)) + | (isBySourcePos qb || not (isPlainIdent name)) && not (isConstructor name) = + -- This should only rename identifiers local to the current module: either + -- they aren't qualified, or they are but they have a name that should not + -- have appeared in a module's externs, so they must be from this module's + -- top-level scope. + Var ann t . Qualified qb <$> lookupIdent name + where + isConstructor (Ident idTxt) = isUpper (T.head idTxt) + isConstructor _ = False +renameInValue v@Var {} = return v +renameInValue (Case ann t vs alts) = + newScope $ Case ann t <$> traverse renameInValue vs <*> traverse renameInCaseAlternative alts renameInValue (Let ann ds v) = newScope $ Let ann <$> renameInDecls ds <*> renameInValue v --- | --- Renames within literals. --- +{- | +Renames within literals. +-} renameInLiteral :: (a -> Rename a) -> Literal a -> Rename (Literal a) -renameInLiteral rename (ArrayLiteral bs) = ArrayLiteral <$> traverse rename bs +renameInLiteral rename (ListLiteral bs) = ListLiteral <$> traverse rename bs renameInLiteral rename (ObjectLiteral bs) = ObjectLiteral <$> traverse (sndM rename) bs renameInLiteral _ l = return l --- | --- Renames within case alternatives. --- +{- | +Renames within case alternatives. +-} renameInCaseAlternative :: CaseAlternative Ann -> Rename (CaseAlternative Ann) -renameInCaseAlternative (CaseAlternative bs v) = newScope $ - CaseAlternative <$> traverse renameInBinder bs - <*> eitherM (traverse (pairM renameInValue renameInValue)) renameInValue v - --- | --- Renames within binders. --- +renameInCaseAlternative (CaseAlternative bs v) = + newScope $ + CaseAlternative + <$> traverse renameInBinder bs + <*> eitherM (traverse (pairM renameInValue renameInValue)) renameInValue v + +{- | +Renames within binders. +-} renameInBinder :: Binder a -> Rename (Binder a) -renameInBinder n@NullBinder{} = return n +renameInBinder n@NullBinder {} = return n renameInBinder (LiteralBinder ann b) = LiteralBinder ann <$> renameInLiteral renameInBinder b -renameInBinder (VarBinder ann name) = - VarBinder ann <$> updateScope name +renameInBinder (VarBinder ann name t) = + (\nn -> VarBinder ann nn t) <$> updateScope name renameInBinder (ConstructorBinder ann tctor dctor bs) = ConstructorBinder ann tctor dctor <$> traverse renameInBinder bs renameInBinder (NamedBinder ann name b) = diff --git a/src/Language/PureScript/Roles.hs b/src/Language/PureScript/Roles.hs index 7a7306299..c71ef1a79 100644 --- a/src/Language/PureScript/Roles.hs +++ b/src/Language/PureScript/Roles.hs @@ -1,12 +1,12 @@ {-# LANGUAGE TemplateHaskell #-} --- | --- Data types for roles. --- -module Language.PureScript.Roles - ( Role(..) - , displayRole - ) where +{- | +Data types for roles. +-} +module Language.PureScript.Roles ( + Role (..), + displayRole, +) where import Prelude @@ -17,18 +17,19 @@ import Data.Aeson.TH qualified as A import Data.Text (Text) import GHC.Generics (Generic) --- | --- The role of a type constructor's parameter. +{- | +The role of a type constructor's parameter. +-} data Role - = Nominal - -- ^ This parameter's identity affects the representation of the type it is - -- parameterising. - | Representational - -- ^ This parameter's representation affects the representation of the type it - -- is parameterising. - | Phantom - -- ^ This parameter has no effect on the representation of the type it is - -- parameterising. + = -- | This parameter's identity affects the representation of the type it is + -- parameterising. + Nominal + | -- | This parameter's representation affects the representation of the type it + -- is parameterising. + Representational + | -- | This parameter has no effect on the representation of the type it is + -- parameterising. + Phantom deriving (Show, Eq, Ord, Generic) instance NFData Role diff --git a/src/Language/PureScript/Sugar.hs b/src/Language/PureScript/Sugar.hs index 4d713d541..2de61e635 100644 --- a/src/Language/PureScript/Sugar.hs +++ b/src/Language/PureScript/Sugar.hs @@ -1,23 +1,23 @@ --- | --- Desugaring passes --- +{- | +Desugaring passes +-} module Language.PureScript.Sugar (desugar, module S) where import Control.Category ((>>>)) import Control.Monad ((>=>)) import Control.Monad.Error.Class (MonadError) -import Control.Monad.Supply.Class (MonadSupply) import Control.Monad.State.Class (MonadState) +import Control.Monad.Supply.Class (MonadSupply) import Control.Monad.Writer.Class (MonadWriter) import Language.PureScript.AST (Module) import Language.PureScript.Errors (MultipleErrors) import Language.PureScript.Externs (ExternsFile) import Language.PureScript.Linter.Imports (UsedImports) +import Language.PureScript.Sugar.AdoNotation as S import Language.PureScript.Sugar.BindingGroups as S import Language.PureScript.Sugar.CaseDeclarations as S import Language.PureScript.Sugar.DoNotation as S -import Language.PureScript.Sugar.AdoNotation as S import Language.PureScript.Sugar.LetPattern as S import Language.PureScript.Sugar.Names as S import Language.PureScript.Sugar.ObjectWildcards as S @@ -26,39 +26,39 @@ import Language.PureScript.Sugar.TypeClasses as S import Language.PureScript.Sugar.TypeClasses.Deriving as S import Language.PureScript.Sugar.TypeDeclarations as S --- | --- The desugaring pipeline proceeds as follows: --- --- * Remove signed literals in favour of `negate` applications --- --- * Desugar object literals with wildcards into lambdas --- --- * Desugar operator sections --- --- * Desugar do-notation --- --- * Desugar ado-notation --- --- * Desugar top-level case declarations into explicit case expressions --- --- * Desugar type declarations into value declarations with explicit type annotations --- --- * Qualify any unqualified names and types --- --- * Rebracket user-defined binary operators --- --- * Introduce newtypes for type class dictionaries and value declarations for instances --- --- * Group mutually recursive value and data declarations into binding groups. --- -desugar - :: MonadSupply m - => MonadError MultipleErrors m - => MonadWriter MultipleErrors m - => MonadState (Env, UsedImports) m - => [ExternsFile] - -> Module - -> m Module +{- | +The desugaring pipeline proceeds as follows: + + * Remove signed literals in favour of `negate` applications + + * Desugar object literals with wildcards into lambdas + + * Desugar operator sections + + * Desugar do-notation + + * Desugar ado-notation + + * Desugar top-level case declarations into explicit case expressions + + * Desugar type declarations into value declarations with explicit type annotations + + * Qualify any unqualified names and types + + * Rebracket user-defined binary operators + + * Introduce newtypes for type class dictionaries and value declarations for instances + + * Group mutually recursive value and data declarations into binding groups. +-} +desugar :: + (MonadSupply m) => + (MonadError MultipleErrors m) => + (MonadWriter MultipleErrors m) => + (MonadState (Env, UsedImports) m) => + [ExternsFile] -> + Module -> + m Module desugar externs = desugarSignedLiterals >>> desugarObjectConstructors diff --git a/src/Language/PureScript/Sugar/AdoNotation.hs b/src/Language/PureScript/Sugar/AdoNotation.hs index 3ac537362..cb7ef3555 100644 --- a/src/Language/PureScript/Sugar/AdoNotation.hs +++ b/src/Language/PureScript/Sugar/AdoNotation.hs @@ -1,22 +1,23 @@ --- | This module implements the desugaring pass which replaces ado-notation statements with --- appropriate calls to pure and apply. - +{- | This module implements the desugaring pass which replaces ado-notation statements with +appropriate calls to pure and apply. +-} module Language.PureScript.Sugar.AdoNotation (desugarAdoModule) where import Prelude hiding (abs) import Control.Monad (foldM) -import Control.Monad.Error.Class (MonadError(..)) +import Control.Monad.Error.Class (MonadError (..)) import Control.Monad.Supply.Class (MonadSupply) import Data.List (foldl') -import Language.PureScript.AST (Binder(..), CaseAlternative(..), Declaration, DoNotationElement(..), Expr(..), pattern MkUnguarded, Module(..), SourceSpan, WhereProvenance(..), declSourceSpan, everywhereOnValuesM) -import Language.PureScript.Errors (MultipleErrors, parU, rethrowWithPosition) -import Language.PureScript.Names (pattern ByNullSourcePos, Ident(..), ModuleName, Qualified(..), byMaybeModuleName, freshIdent') +import Language.PureScript.AST (Binder (..), CaseAlternative (..), Declaration, DoNotationElement (..), Expr (..), Module (..), SourceSpan, WhereProvenance (..), declSourceSpan, everywhereOnValuesM, pattern MkUnguarded) import Language.PureScript.Constants.Libs qualified as C +import Language.PureScript.Errors (MultipleErrors, parU, rethrowWithPosition) +import Language.PureScript.Names (Ident (..), ModuleName, Qualified (..), byMaybeModuleName, freshIdent', pattern ByNullSourcePos) --- | Replace all @AdoNotationBind@ and @AdoNotationValue@ constructors with --- applications of the pure and apply functions in scope, and all @AdoNotationLet@ --- constructors with let expressions. +{- | Replace all @AdoNotationBind@ and @AdoNotationValue@ constructors with +applications of the pure and apply functions in scope, and all @AdoNotationLet@ +constructors with let expressions. +-} desugarAdoModule :: forall m. (MonadSupply m, MonadError MultipleErrors m) => Module -> m Module desugarAdoModule (Module ss coms mn ds exts) = Module ss coms mn <$> parU ds desugarAdo <*> pure exts @@ -25,42 +26,46 @@ desugarAdo :: forall m. (MonadSupply m, MonadError MultipleErrors m) => Declarat desugarAdo d = let ss = declSourceSpan d (f, _, _) = everywhereOnValuesM return (replace ss) return - in rethrowWithPosition ss $ f d + in rethrowWithPosition ss $ f d where - pure' :: SourceSpan -> Maybe ModuleName -> Expr - pure' ss m = Var ss (Qualified (byMaybeModuleName m) (Ident C.S_pure)) + pure' :: SourceSpan -> Maybe ModuleName -> Expr + pure' ss m = Var ss (Qualified (byMaybeModuleName m) (Ident C.S_pure)) - map' :: SourceSpan -> Maybe ModuleName -> Expr - map' ss m = Var ss (Qualified (byMaybeModuleName m) (Ident C.S_map)) + map' :: SourceSpan -> Maybe ModuleName -> Expr + map' ss m = Var ss (Qualified (byMaybeModuleName m) (Ident C.S_map)) - apply :: SourceSpan -> Maybe ModuleName -> Expr - apply ss m = Var ss (Qualified (byMaybeModuleName m) (Ident C.S_apply)) + apply :: SourceSpan -> Maybe ModuleName -> Expr + apply ss m = Var ss (Qualified (byMaybeModuleName m) (Ident C.S_apply)) - replace :: SourceSpan -> Expr -> m Expr - replace pos (Ado m els yield) = do - (func, args) <- foldM (go pos) (yield, []) (reverse els) - return $ case args of - [] -> App (pure' pos m) func - hd : tl -> foldl' (\a b -> App (App (apply pos m) a) b) (App (App (map' pos m) func) hd) tl - replace _ (PositionedValue pos com v) = PositionedValue pos com <$> rethrowWithPosition pos (replace pos v) - replace _ other = return other - - go :: SourceSpan -> (Expr, [Expr]) -> DoNotationElement -> m (Expr, [Expr]) - go _ (yield, args) (DoNotationValue val) = - return (Abs NullBinder yield, val : args) - go _ (yield, args) (DoNotationBind (VarBinder ss ident) val) = - return (Abs (VarBinder ss ident) yield, val : args) - go ss (yield, args) (DoNotationBind binder val) = do - ident <- freshIdent' - let abs = Abs (VarBinder ss ident) - (Case [Var ss (Qualified ByNullSourcePos ident)] - [CaseAlternative [binder] [MkUnguarded yield]]) - return (abs, val : args) - go _ (yield, args) (DoNotationLet ds) = do - return (Let FromLet ds yield, args) - go _ acc (PositionedDoNotationElement pos com el) = - rethrowWithPosition pos $ do - (yield, args) <- go pos acc el + replace :: SourceSpan -> Expr -> m Expr + replace pos (Ado m els yield) = do + (func, args) <- foldM (go pos) (yield, []) (reverse els) return $ case args of - [] -> (PositionedValue pos com yield, args) - (a : as) -> (yield, PositionedValue pos com a : as) + [] -> App (pure' pos m) func + hd : tl -> foldl' (\a b -> App (App (apply pos m) a) b) (App (App (map' pos m) func) hd) tl + replace _ (PositionedValue pos com v) = PositionedValue pos com <$> rethrowWithPosition pos (replace pos v) + replace _ other = return other + + go :: SourceSpan -> (Expr, [Expr]) -> DoNotationElement -> m (Expr, [Expr]) + go _ (yield, args) (DoNotationValue val) = + return (Abs NullBinder yield, val : args) + go _ (yield, args) (DoNotationBind (VarBinder ss ident) val) = + return (Abs (VarBinder ss ident) yield, val : args) + go ss (yield, args) (DoNotationBind binder val) = do + ident <- freshIdent' + let abs = + Abs + (VarBinder ss ident) + ( Case + [Var ss (Qualified ByNullSourcePos ident)] + [CaseAlternative [binder] [MkUnguarded yield]] + ) + return (abs, val : args) + go _ (yield, args) (DoNotationLet ds) = do + return (Let FromLet ds yield, args) + go _ acc (PositionedDoNotationElement pos com el) = + rethrowWithPosition pos $ do + (yield, args) <- go pos acc el + return $ case args of + [] -> (PositionedValue pos com yield, args) + (a : as) -> (yield, PositionedValue pos com a : as) diff --git a/src/Language/PureScript/Sugar/BindingGroups.hs b/src/Language/PureScript/Sugar/BindingGroups.hs index d2f9aebf2..67e9a1130 100644 --- a/src/Language/PureScript/Sugar/BindingGroups.hs +++ b/src/Language/PureScript/Sugar/BindingGroups.hs @@ -1,35 +1,35 @@ --- | --- This module implements the desugaring pass which creates binding groups from sets of --- mutually-recursive value declarations and mutually-recursive type declarations. --- -module Language.PureScript.Sugar.BindingGroups - ( createBindingGroups - , createBindingGroupsModule - , collapseBindingGroups - ) where +{- | +This module implements the desugaring pass which creates binding groups from sets of +mutually-recursive value declarations and mutually-recursive type declarations. +-} +module Language.PureScript.Sugar.BindingGroups ( + createBindingGroups, + createBindingGroupsModule, + collapseBindingGroups, +) where -import Prelude import Protolude (ordNub, swap) +import Prelude -import Control.Monad ((<=<), guard) -import Control.Monad.Error.Class (MonadError(..)) +import Control.Monad (guard, (<=<)) +import Control.Monad.Error.Class (MonadError (..)) -import Data.Graph (SCC(..), stronglyConnComp, stronglyConnCompR) -import Data.List (intersect, (\\)) -import Data.List.NonEmpty (NonEmpty((:|)), nonEmpty) import Data.Foldable (find) import Data.Functor (($>)) -import Data.Maybe (isJust, mapMaybe) +import Data.Graph (SCC (..), stronglyConnComp, stronglyConnCompR) +import Data.List (intersect, (\\)) +import Data.List.NonEmpty (NonEmpty ((:|)), nonEmpty) import Data.List.NonEmpty qualified as NEL import Data.Map qualified as M +import Data.Maybe (isJust, mapMaybe) import Data.Set qualified as S import Language.PureScript.AST import Language.PureScript.Crash (internalError) import Language.PureScript.Environment (NameKind) -import Language.PureScript.Errors (ErrorMessage(..), MultipleErrors(..), SimpleErrorMessage(..), errorMessage', parU, positionedError) -import Language.PureScript.Names (pattern ByNullSourcePos, Ident, ModuleName, ProperName, ProperNameType(..), Qualified(..), QualifiedBy(..), coerceProperName) -import Language.PureScript.Types (Constraint(..), SourceConstraint, SourceType, Type(..), everythingOnTypes) +import Language.PureScript.Errors (ErrorMessage (..), MultipleErrors (..), SimpleErrorMessage (..), errorMessage', parU, positionedError) +import Language.PureScript.Names (Ident, ModuleName, ProperName, ProperNameType (..), Qualified (..), QualifiedBy (..), coerceProperName, pattern ByNullSourcePos) +import Language.PureScript.Types (Constraint (..), SourceConstraint, SourceType, Type (..), everythingOnTypes) data VertexType = VertexDefinition @@ -37,119 +37,119 @@ data VertexType | VertexRoleDeclaration deriving (Eq, Ord, Show) --- | --- Replace all sets of mutually-recursive declarations in a module with binding groups --- -createBindingGroupsModule - :: (MonadError MultipleErrors m) - => Module - -> m Module +{- | +Replace all sets of mutually-recursive declarations in a module with binding groups +-} +createBindingGroupsModule :: + (MonadError MultipleErrors m) => + Module -> + m Module createBindingGroupsModule (Module ss coms name ds exps) = Module ss coms name <$> createBindingGroups name ds <*> pure exps -createBindingGroups - :: forall m - . (MonadError MultipleErrors m) - => ModuleName - -> [Declaration] - -> m [Declaration] +createBindingGroups :: + forall m. + (MonadError MultipleErrors m) => + ModuleName -> + [Declaration] -> + m [Declaration] createBindingGroups moduleName = mapM f <=< handleDecls - where - (f, _, _) = everywhereOnValuesTopDownM return handleExprs return - - handleExprs :: Expr -> m Expr - handleExprs (Let w ds val) = (\ds' -> Let w ds' val) <$> handleDecls ds - handleExprs other = return other - - -- Replace all sets of mutually-recursive declarations with binding groups - handleDecls :: [Declaration] -> m [Declaration] - handleDecls ds = do - let values = mapMaybe (fmap (fmap extractGuardedExpr) . getValueDeclaration) ds - kindDecls = (,VertexKindSignature) <$> filter isKindDecl ds - dataDecls = (,VertexDefinition) <$> filter (\a -> isDataDecl a || isExternDataDecl a || isTypeSynonymDecl a || isTypeClassDecl a) ds - roleDecls = (,VertexRoleDeclaration) <$> filter isRoleDecl ds - roleAnns = declTypeName . fst <$> roleDecls - kindSigs = declTypeName . fst <$> kindDecls - typeSyns = declTypeName <$> filter isTypeSynonymDecl ds - nonTypeSynKindSigs = kindSigs \\ typeSyns - allDecls = kindDecls ++ dataDecls ++ roleDecls - allProperNames = declTypeName . fst <$> allDecls - mkVert (d, vty) = - let names = usedTypeNames moduleName d `intersect` allProperNames - name = declTypeName d - -- If a dependency of a kind signature has a kind signature, than that's all we need to - -- depend on, except in the case that we are using a type synonym. In order to expand - -- the type synonym, we must depend on the synonym declaration itself. - -- - -- Arguably, type declarations (as opposed to just kind signatures) could also depend - -- on kind signatures when present. Attempting this caused one known issue (#4038); the - -- type checker might not expect type declarations not to be preceded or grouped by - -- their actual dependencies in all cases. But in principle, if done carefully, this - -- approach could be used to reduce the number or size of data binding group cycles. - -- (It's critical that kind signatures not appear in groups, which is why they get - -- special treatment.) - vtype n - | vty == VertexKindSignature && n `elem` nonTypeSynKindSigs = VertexKindSignature - | otherwise = VertexDefinition - deps = fmap (\n -> (n, vtype n)) names - self - | vty == VertexDefinition = - (guard (name `elem` kindSigs) $> (name, VertexKindSignature)) - ++ (guard (name `elem` roleAnns && not (isExternDataDecl d)) $> (name, VertexRoleDeclaration)) - | vty == VertexRoleDeclaration = [(name, VertexDefinition)] - | otherwise = [] - in (d, (name, vty), self ++ deps) - dataVerts = fmap mkVert allDecls - dataBindingGroupDecls <- parU (stronglyConnCompR dataVerts) toDataBindingGroup - let - -- #4437 - -- - -- The idea here is to create a `Graph` whose `key` is a tuple: `(Bool, Ident)`, - -- where the `Bool` encodes the absence of a type hole. This relies on an implementation - -- detail for `stronglyConnComp` which allows identifiers with no type holes to "float" - -- and get checked before those that do, while preserving reverse topological sorting. - makeValueDeclarationKey = (,) <$> exprHasNoTypeHole . valdeclExpression <*> valdeclIdent - valueDeclarationKeys = makeValueDeclarationKey <$> values - - valueDeclarationInfo = M.fromList $ swap <$> valueDeclarationKeys - findDeclarationInfo i = (M.findWithDefault False i valueDeclarationInfo, i) - computeValueDependencies = (`intersect` valueDeclarationKeys) . fmap findDeclarationInfo . usedIdents moduleName - - makeValueDeclarationVert = (,,) <$> id <*> makeValueDeclarationKey <*> computeValueDependencies - valueDeclarationVerts = makeValueDeclarationVert <$> values - - bindingGroupDecls <- parU (stronglyConnComp valueDeclarationVerts) (toBindingGroup moduleName) - return $ filter isImportDecl ds ++ - dataBindingGroupDecls ++ - filter isTypeClassInstanceDecl ds ++ - filter isFixityDecl ds ++ - filter isExternDecl ds ++ - bindingGroupDecls - where - extractGuardedExpr [MkUnguarded expr] = expr - extractGuardedExpr _ = internalError "Expected Guards to have been desugared in handleDecls." - - exprHasNoTypeHole :: Expr -> Bool - exprHasNoTypeHole = not . exprHasTypeHole - where - exprHasTypeHole :: Expr -> Bool - (_, exprHasTypeHole, _, _, _) = everythingOnValues (||) goDefault goExpr goDefault goDefault goDefault + (f, _, _) = everywhereOnValuesTopDownM return handleExprs return + + handleExprs :: Expr -> m Expr + handleExprs (Let w ds val) = (\ds' -> Let w ds' val) <$> handleDecls ds + handleExprs other = return other + + -- Replace all sets of mutually-recursive declarations with binding groups + handleDecls :: [Declaration] -> m [Declaration] + handleDecls ds = do + let values = mapMaybe (fmap (fmap extractGuardedExpr) . getValueDeclaration) ds + kindDecls = (,VertexKindSignature) <$> filter isKindDecl ds + dataDecls = (,VertexDefinition) <$> filter (\a -> isDataDecl a || isExternDataDecl a || isTypeSynonymDecl a || isTypeClassDecl a) ds + roleDecls = (,VertexRoleDeclaration) <$> filter isRoleDecl ds + roleAnns = declTypeName . fst <$> roleDecls + kindSigs = declTypeName . fst <$> kindDecls + typeSyns = declTypeName <$> filter isTypeSynonymDecl ds + nonTypeSynKindSigs = kindSigs \\ typeSyns + allDecls = kindDecls ++ dataDecls ++ roleDecls + allProperNames = declTypeName . fst <$> allDecls + mkVert (d, vty) = + let names = usedTypeNames moduleName d `intersect` allProperNames + name = declTypeName d + -- If a dependency of a kind signature has a kind signature, than that's all we need to + -- depend on, except in the case that we are using a type synonym. In order to expand + -- the type synonym, we must depend on the synonym declaration itself. + -- + -- Arguably, type declarations (as opposed to just kind signatures) could also depend + -- on kind signatures when present. Attempting this caused one known issue (#4038); the + -- type checker might not expect type declarations not to be preceded or grouped by + -- their actual dependencies in all cases. But in principle, if done carefully, this + -- approach could be used to reduce the number or size of data binding group cycles. + -- (It's critical that kind signatures not appear in groups, which is why they get + -- special treatment.) + vtype n + | vty == VertexKindSignature && n `elem` nonTypeSynKindSigs = VertexKindSignature + | otherwise = VertexDefinition + deps = fmap (\n -> (n, vtype n)) names + self + | vty == VertexDefinition = + (guard (name `elem` kindSigs) $> (name, VertexKindSignature)) + ++ (guard (name `elem` roleAnns && not (isExternDataDecl d)) $> (name, VertexRoleDeclaration)) + | vty == VertexRoleDeclaration = [(name, VertexDefinition)] + | otherwise = [] + in (d, (name, vty), self ++ deps) + dataVerts = fmap mkVert allDecls + dataBindingGroupDecls <- parU (stronglyConnCompR dataVerts) toDataBindingGroup + let + -- #4437 + -- + -- The idea here is to create a `Graph` whose `key` is a tuple: `(Bool, Ident)`, + -- where the `Bool` encodes the absence of a type hole. This relies on an implementation + -- detail for `stronglyConnComp` which allows identifiers with no type holes to "float" + -- and get checked before those that do, while preserving reverse topological sorting. + makeValueDeclarationKey = (,) <$> exprHasNoTypeHole . valdeclExpression <*> valdeclIdent + valueDeclarationKeys = makeValueDeclarationKey <$> values + + valueDeclarationInfo = M.fromList $ swap <$> valueDeclarationKeys + findDeclarationInfo i = (M.findWithDefault False i valueDeclarationInfo, i) + computeValueDependencies = (`intersect` valueDeclarationKeys) . fmap findDeclarationInfo . usedIdents moduleName + + makeValueDeclarationVert = (,,) <$> id <*> makeValueDeclarationKey <*> computeValueDependencies + valueDeclarationVerts = makeValueDeclarationVert <$> values + + bindingGroupDecls <- parU (stronglyConnComp valueDeclarationVerts) (toBindingGroup moduleName) + return $ + filter isImportDecl ds + ++ dataBindingGroupDecls + ++ filter isTypeClassInstanceDecl ds + ++ filter isFixityDecl ds + ++ filter isExternDecl ds + ++ bindingGroupDecls + where + extractGuardedExpr [MkUnguarded expr] = expr + extractGuardedExpr _ = internalError "Expected Guards to have been desugared in handleDecls." + + exprHasNoTypeHole :: Expr -> Bool + exprHasNoTypeHole = not . exprHasTypeHole where - goExpr :: Expr -> Bool - goExpr (Hole _) = True - goExpr _ = False - - goDefault :: forall a. a -> Bool - goDefault = const False - --- | --- Collapse all binding groups to individual declarations --- + exprHasTypeHole :: Expr -> Bool + (_, exprHasTypeHole, _, _, _) = everythingOnValues (||) goDefault goExpr goDefault goDefault goDefault + where + goExpr :: Expr -> Bool + goExpr (Hole _) = True + goExpr _ = False + + goDefault :: forall a. a -> Bool + goDefault = const False + +{- | +Collapse all binding groups to individual declarations +-} collapseBindingGroups :: [Declaration] -> [Declaration] collapseBindingGroups = let (f, _, _) = everywhereOnValues id flattenBindingGroupsForValue id - in fmap f . flattenBindingGroups + in fmap f . flattenBindingGroups flattenBindingGroupsForValue :: Expr -> Expr flattenBindingGroupsForValue (Let w ds val) = Let w (flattenBindingGroups ds) val @@ -158,62 +158,66 @@ flattenBindingGroupsForValue other = other flattenBindingGroups :: [Declaration] -> [Declaration] flattenBindingGroups = concatMap go where - go (DataBindingGroupDeclaration ds) = NEL.toList ds - go (BindingGroupDeclaration ds) = - NEL.toList $ fmap (\((sa, ident), nameKind, val) -> - ValueDecl sa ident nameKind [] [MkUnguarded val]) ds - go other = [other] + go (DataBindingGroupDeclaration ds) = NEL.toList ds + go (BindingGroupDeclaration ds) = + NEL.toList $ + fmap + ( \((sa, ident), nameKind, val) -> + ValueDecl sa ident nameKind [] [MkUnguarded val] + ) + ds + go other = [other] usedIdents :: ModuleName -> ValueDeclarationData Expr -> [Ident] usedIdents moduleName = ordNub . usedIdents' S.empty . valdeclExpression where - def _ _ = [] + def _ _ = [] - (_, usedIdents', _, _, _) = everythingWithScope def usedNamesE def def def + (_, usedIdents', _, _, _) = everythingWithScope def usedNamesE def def def - usedNamesE :: S.Set ScopedIdent -> Expr -> [Ident] - usedNamesE scope (Var _ (Qualified (BySourcePos _) name)) - | LocalIdent name `S.notMember` scope = [name] - usedNamesE scope (Var _ (Qualified (ByModuleName moduleName') name)) - | moduleName == moduleName' && ToplevelIdent name `S.notMember` scope = [name] - usedNamesE _ _ = [] + usedNamesE :: S.Set ScopedIdent -> Expr -> [Ident] + usedNamesE scope (Var _ (Qualified (BySourcePos _) name)) + | LocalIdent name `S.notMember` scope = [name] + usedNamesE scope (Var _ (Qualified (ByModuleName moduleName') name)) + | moduleName == moduleName' && ToplevelIdent name `S.notMember` scope = [name] + usedNamesE _ _ = [] usedImmediateIdents :: ModuleName -> Declaration -> [Ident] usedImmediateIdents moduleName = let (f, _, _, _, _) = everythingWithContextOnValues True [] (++) def usedNamesE def def def - in ordNub . f + in ordNub . f where - def s _ = (s, []) + def s _ = (s, []) - usedNamesE :: Bool -> Expr -> (Bool, [Ident]) - usedNamesE True (Var _ (Qualified (BySourcePos _) name)) = (True, [name]) - usedNamesE True (Var _ (Qualified (ByModuleName moduleName') name)) - | moduleName == moduleName' = (True, [name]) - usedNamesE True (Abs _ _) = (False, []) - usedNamesE scope _ = (scope, []) + usedNamesE :: Bool -> Expr -> (Bool, [Ident]) + usedNamesE True (Var _ (Qualified (BySourcePos _) name)) = (True, [name]) + usedNamesE True (Var _ (Qualified (ByModuleName moduleName') name)) + | moduleName == moduleName' = (True, [name]) + usedNamesE True (Abs _ _) = (False, []) + usedNamesE scope _ = (scope, []) usedTypeNames :: ModuleName -> Declaration -> [ProperName 'TypeName] usedTypeNames moduleName = go where - (f, _, _, _, _) = accumTypes (everythingOnTypes (++) usedNames) + (f, _, _, _, _) = accumTypes (everythingOnTypes (++) usedNames) - go :: Declaration -> [ProperName 'TypeName] - go decl = ordNub (f decl <> usedNamesForTypeClassDeps decl) + go :: Declaration -> [ProperName 'TypeName] + go decl = ordNub (f decl <> usedNamesForTypeClassDeps decl) - usedNames :: SourceType -> [ProperName 'TypeName] - usedNames (ConstrainedType _ con _) = usedConstraint con - usedNames (TypeConstructor _ (Qualified (ByModuleName moduleName') name)) - | moduleName == moduleName' = [name] - usedNames _ = [] + usedNames :: SourceType -> [ProperName 'TypeName] + usedNames (ConstrainedType _ con _) = usedConstraint con + usedNames (TypeConstructor _ (Qualified (ByModuleName moduleName') name)) + | moduleName == moduleName' = [name] + usedNames _ = [] - usedConstraint :: SourceConstraint -> [ProperName 'TypeName] - usedConstraint (Constraint _ (Qualified (ByModuleName moduleName') name) _ _ _) - | moduleName == moduleName' = [coerceProperName name] - usedConstraint _ = [] + usedConstraint :: SourceConstraint -> [ProperName 'TypeName] + usedConstraint (Constraint _ (Qualified (ByModuleName moduleName') name) _ _ _) + | moduleName == moduleName' = [coerceProperName name] + usedConstraint _ = [] - usedNamesForTypeClassDeps :: Declaration -> [ProperName 'TypeName] - usedNamesForTypeClassDeps (TypeClassDeclaration _ _ _ deps _ _) = foldMap usedConstraint deps - usedNamesForTypeClassDeps _ = [] + usedNamesForTypeClassDeps :: Declaration -> [ProperName 'TypeName] + usedNamesForTypeClassDeps (TypeClassDeclaration _ _ _ deps _ _) = foldMap usedConstraint deps + usedNamesForTypeClassDeps _ = [] declTypeName :: Declaration -> ProperName 'TypeName declTypeName (DataDeclaration _ _ pn _ _) = pn @@ -224,16 +228,15 @@ declTypeName (KindDeclaration _ _ pn _) = pn declTypeName (RoleDeclaration (RoleDeclarationData _ pn _)) = pn declTypeName _ = internalError "Expected DataDeclaration" --- | --- Convert a group of mutually-recursive dependencies into a BindingGroupDeclaration (or simple ValueDeclaration). --- --- -toBindingGroup - :: forall m - . (MonadError MultipleErrors m) - => ModuleName - -> SCC (ValueDeclarationData Expr) - -> m Declaration +{- | +Convert a group of mutually-recursive dependencies into a BindingGroupDeclaration (or simple ValueDeclaration). +-} +toBindingGroup :: + forall m. + (MonadError MultipleErrors m) => + ModuleName -> + SCC (ValueDeclarationData Expr) -> + m Declaration toBindingGroup _ (AcyclicSCC d) = return (mkDeclaration d) toBindingGroup moduleName (CyclicSCC ds') = do -- Once we have a mutually-recursive group of declarations, we need to sort @@ -247,27 +250,27 @@ toBindingGroup moduleName (CyclicSCC ds') = do -- runtime, so treat this as an error. See also github issue #365. BindingGroupDeclaration . NEL.fromList <$> mapM toBinding (stronglyConnComp valueVerts) where - idents :: [Ident] - idents = fmap (\(_, i, _) -> i) valueVerts + idents :: [Ident] + idents = fmap (\(_, i, _) -> i) valueVerts - valueVerts :: [(ValueDeclarationData Expr, Ident, [Ident])] - valueVerts = fmap (\d -> (d, valdeclIdent d, usedImmediateIdents moduleName (mkDeclaration d) `intersect` idents)) ds' + valueVerts :: [(ValueDeclarationData Expr, Ident, [Ident])] + valueVerts = fmap (\d -> (d, valdeclIdent d, usedImmediateIdents moduleName (mkDeclaration d) `intersect` idents)) ds' - toBinding :: SCC (ValueDeclarationData Expr) -> m ((SourceAnn, Ident), NameKind, Expr) - toBinding (AcyclicSCC d) = return $ fromValueDecl d - toBinding (CyclicSCC ds) = throwError $ foldMap cycleError ds + toBinding :: SCC (ValueDeclarationData Expr) -> m ((SourceAnn, Ident), NameKind, Expr) + toBinding (AcyclicSCC d) = return $ fromValueDecl d + toBinding (CyclicSCC ds) = throwError $ foldMap cycleError ds - cycleError :: ValueDeclarationData Expr -> MultipleErrors - cycleError (ValueDeclarationData (ss, _) n _ _ _) = errorMessage' ss $ CycleInDeclaration n + cycleError :: ValueDeclarationData Expr -> MultipleErrors + cycleError (ValueDeclarationData (ss, _) n _ _ _) = errorMessage' ss $ CycleInDeclaration n -toDataBindingGroup - :: MonadError MultipleErrors m - => Ord a - => SCC (Declaration, (ProperName 'TypeName, a), [(ProperName 'TypeName, a)]) - -> m Declaration +toDataBindingGroup :: + (MonadError MultipleErrors m) => + (Ord a) => + SCC (Declaration, (ProperName 'TypeName, a), [(ProperName 'TypeName, a)]) -> + m Declaration toDataBindingGroup (AcyclicSCC (d, _, _)) = return d toDataBindingGroup (CyclicSCC ds') - | Just kds@((ss, _):|_) <- nonEmpty $ concatMap (kindDecl . getDecl) ds' = throwError . errorMessage' ss . CycleInKindDeclaration $ fmap snd kds + | Just kds@((ss, _) :| _) <- nonEmpty $ concatMap (kindDecl . getDecl) ds' = throwError . errorMessage' ss . CycleInKindDeclaration $ fmap snd kds | not (null typeSynonymCycles) = throwError . MultipleErrors @@ -275,23 +278,23 @@ toDataBindingGroup (CyclicSCC ds') $ typeSynonymCycles | otherwise = return . DataBindingGroupDeclaration . NEL.fromList $ getDecl <$> ds' where - kindDecl (KindDeclaration sa _ pn _) = [(fst sa, Qualified ByNullSourcePos pn)] - kindDecl (ExternDataDeclaration sa pn _) = [(fst sa, Qualified ByNullSourcePos pn)] - kindDecl _ = [] + kindDecl (KindDeclaration sa _ pn _) = [(fst sa, Qualified ByNullSourcePos pn)] + kindDecl (ExternDataDeclaration sa pn _) = [(fst sa, Qualified ByNullSourcePos pn)] + kindDecl _ = [] - getDecl (decl, _, _) = decl - getName (_, name, _) = name - lookupVert name = find ((==) name . getName) ds' + getDecl (decl, _, _) = decl + getName (_, name, _) = name + lookupVert name = find ((==) name . getName) ds' - onlySynonyms (decl, name, deps) = do - guard . isJust $ isTypeSynonym decl - pure (decl, name, filter (maybe False (isJust . isTypeSynonym . getDecl) . lookupVert) deps) + onlySynonyms (decl, name, deps) = do + guard . isJust $ isTypeSynonym decl + pure (decl, name, filter (maybe False (isJust . isTypeSynonym . getDecl) . lookupVert) deps) - isCycle (CyclicSCC c) = nonEmpty c - isCycle _ = Nothing + isCycle (CyclicSCC c) = nonEmpty c + isCycle _ = Nothing - typeSynonymCycles = - mapMaybe isCycle . stronglyConnCompR . mapMaybe onlySynonyms $ ds' + typeSynonymCycles = + mapMaybe isCycle . stronglyConnCompR . mapMaybe onlySynonyms $ ds' isTypeSynonym :: Declaration -> Maybe (ProperName 'TypeName) isTypeSynonym (TypeSynonymDeclaration _ pn _ _) = Just pn @@ -302,4 +305,4 @@ mkDeclaration = ValueDeclaration . fmap (pure . MkUnguarded) fromValueDecl :: ValueDeclarationData Expr -> ((SourceAnn, Ident), NameKind, Expr) fromValueDecl (ValueDeclarationData sa ident nameKind [] val) = ((sa, ident), nameKind, val) -fromValueDecl ValueDeclarationData{} = internalError "Binders should have been desugared" +fromValueDecl ValueDeclarationData {} = internalError "Binders should have been desugared" diff --git a/src/Language/PureScript/Sugar/CaseDeclarations.hs b/src/Language/PureScript/Sugar/CaseDeclarations.hs index bcae76771..e186f4649 100644 --- a/src/Language/PureScript/Sugar/CaseDeclarations.hs +++ b/src/Language/PureScript/Sugar/CaseDeclarations.hs @@ -1,74 +1,86 @@ --- | --- This module implements the desugaring pass which replaces top-level binders with --- case expressions. --- -module Language.PureScript.Sugar.CaseDeclarations - ( desugarCases - , desugarCasesModule - , desugarCaseGuards - ) where +{- | +This module implements the desugaring pass which replaces top-level binders with +case expressions. +-} +module Language.PureScript.Sugar.CaseDeclarations ( + desugarCases, + desugarCasesModule, + desugarCaseGuards, + desugarGuardedExprs, +) where -import Prelude import Protolude (ordNub) +import Prelude -import Data.List (groupBy, foldl1') +import Data.List (foldl1', groupBy) import Data.Maybe (catMaybes, mapMaybe) -import Control.Monad ((<=<), forM, replicateM, join, unless) -import Control.Monad.Error.Class (MonadError(..)) -import Control.Monad.Supply.Class (MonadSupply) +import Control.Monad (forM, join, replicateM, unless, (<=<)) +import Control.Monad.Error.Class (MonadError (..)) +import Control.Monad.Supply.Class (MonadSupply, freshName) import Language.PureScript.AST import Language.PureScript.Crash (internalError) -import Language.PureScript.Environment (NameKind(..)) -import Language.PureScript.Errors (ErrorMessage(..), MultipleErrors(..), SimpleErrorMessage(..), addHint, errorMessage', parU, rethrow, withPosition) -import Language.PureScript.Names (pattern ByNullSourcePos, Ident, Qualified(..), freshIdent') +import Language.PureScript.Environment (NameKind (..), function, kindType) +import Language.PureScript.Errors (ErrorMessage (..), MultipleErrors (..), SimpleErrorMessage (..), addHint, errorMessage', parU, rethrow, withPosition) +import Language.PureScript.Names (Ident (..), Qualified (..), freshIdent', pattern ByNullSourcePos) import Language.PureScript.TypeChecker.Monad (guardWith) --- | --- Replace all top-level binders in a module with case expressions. --- -desugarCasesModule - :: (MonadSupply m, MonadError MultipleErrors m) - => Module - -> m Module +import Debug.Trace +import Language.PureScript.Types (SourceType, Type (TypeVar), quantify) + +{- | +Replace all top-level binders in a module with case expressions. +-} +desugarCasesModule :: + (MonadSupply m, MonadError MultipleErrors m) => + Module -> + m Module desugarCasesModule (Module ss coms name ds exps) = rethrow (addHint (ErrorInModule name)) $ Module ss coms name <$> (desugarCases <=< desugarAbs <=< validateCases $ ds) <*> pure exps -desugarCaseGuards - :: forall m. (MonadSupply m, MonadError MultipleErrors m) - => [Declaration] - -> m [Declaration] +desugarCaseGuards :: + forall m. + (MonadSupply m, MonadError MultipleErrors m) => + [Declaration] -> + m [Declaration] desugarCaseGuards declarations = parU declarations go where go d = let (f, _, _) = everywhereOnValuesM return (desugarGuardedExprs (declSourceSpan d)) return - in f d - --- | --- Desugar case with pattern guards and pattern clauses to a --- series of nested case expressions. --- -desugarGuardedExprs - :: forall m. (MonadSupply m) - => SourceSpan - -> Expr - -> m Expr + in f d + +{- | +Desugar case with pattern guards and pattern clauses to a +series of nested case expressions. +-} +desugarGuardedExprs :: + forall m. + (MonadSupply m) => + SourceSpan -> + Expr -> + m Expr desugarGuardedExprs ss (Case scrut alternatives) | not $ all isTrivialExpr scrut = do - -- in case the scrutinee is non trivial (e.g. not a Var or Literal) - -- we may evaluate the scrutinee more than once when a guard occurs. - -- We bind the scrutinee to Vars here to mitigate this case. - (scrut', scrut_decls) <- unzip <$> forM scrut (\e -> do - scrut_id <- freshIdent' - pure ( Var ss (Qualified ByNullSourcePos scrut_id) - , ValueDecl (ss, []) scrut_id Private [] [MkUnguarded e] - ) - ) - Let FromLet scrut_decls <$> desugarGuardedExprs ss (Case scrut' alternatives) + -- in case the scrutinee is non trivial (e.g. not a Var or Literal) + -- we may evaluate the scrutinee more than once when a guard occurs. + -- We bind the scrutinee to Vars here to mitigate this case. + (scrut', scrut_decls) <- + unzip + <$> forM + scrut + ( \e -> do + let mkTyped ex = TypedValue False ex (unsafeExprType e) + scrut_id <- freshIdent' + pure + ( mkTyped $ Var ss (Qualified ByNullSourcePos scrut_id) + , ValueDecl (ss, []) scrut_id Private [] [MkUnguarded e] + ) + ) + Let FromLet scrut_decls <$> desugarGuardedExprs ss (Case scrut' alternatives) where isTrivialExpr (Var _ _) = True isTrivialExpr (Literal _ _) = True @@ -77,7 +89,6 @@ desugarGuardedExprs ss (Case scrut alternatives) isTrivialExpr (PositionedValue _ _ e) = isTrivialExpr e isTrivialExpr (TypedValue _ e _) = isTrivialExpr e isTrivialExpr _ = False - desugarGuardedExprs ss (Case scrut alternatives) = let -- Alternatives which do not have guards are @@ -137,20 +148,21 @@ desugarGuardedExprs ss (Case scrut alternatives) = -- -- This might look strange but simplifies the algorithm a lot. -- - desugarAlternatives :: [CaseAlternative] - -> m [CaseAlternative] - desugarAlternatives [] = pure [] - + desugarAlternatives :: + [CaseAlternative] -> + m [CaseAlternative] + desugarAlternatives [] = pure [] -- the trivial case: no guards desugarAlternatives (a@(CaseAlternative _ [MkUnguarded _]) : as) = (a :) <$> desugarAlternatives as - -- Special case: CoreFn understands single condition guards on -- binders right hand side. desugarAlternatives (CaseAlternative ab ge : as) - | not (null cond_guards) = - (CaseAlternative ab cond_guards :) - <$> desugarGuardedAlternative ab rest as + -- NOTE/REVIEW: Not sure about removing this + -- \| not (null cond_guards) = + -- (CaseAlternative ab cond_guards :) + -- <$> desugarGuardedAlternative ab rest as + -- | otherwise = desugarGuardedAlternative ab ge as where (cond_guards, rest) = span isSingleCondGuard ge @@ -158,23 +170,27 @@ desugarGuardedExprs ss (Case scrut alternatives) = isSingleCondGuard (GuardedExpr [ConditionGuard _] _) = True isSingleCondGuard _ = False - desugarGuardedAlternative :: [Binder] - -> [GuardedExpr] - -> [CaseAlternative] - -> m [CaseAlternative] + desugarGuardedAlternative :: + [Binder] -> + [GuardedExpr] -> + [CaseAlternative] -> + m [CaseAlternative] desugarGuardedAlternative _vb [] rem_alts = desugarAlternatives rem_alts - desugarGuardedAlternative vb (GuardedExpr gs e : ge) rem_alts = do rhs <- desugarAltOutOfLine vb ge rem_alts $ \alt_fail -> let -- if the binder is a var binder we must not add -- the fail case as it results in unreachable -- alternative - alt_fail' n | all isIrrefutable vb = [] - | otherwise = alt_fail n + alt_fail' n + | all isIrrefutable vb = [] + | otherwise = alt_fail n + eTy = unsafeExprType e + mkType ex = TypedValue False ex eTy + in -- we are here: -- -- case scrut of @@ -184,68 +200,89 @@ desugarGuardedExprs ss (Case scrut alternatives) = -- in case scrut of -- we are here -- ... -- - in Case scrut - (CaseAlternative vb [MkUnguarded (desugarGuard gs e alt_fail)] - : alt_fail' (length scrut)) + mkType $ + Case + scrut + ( CaseAlternative vb [MkUnguarded (desugarGuard gs e alt_fail)] + : alt_fail' (length scrut) + ) - return [ CaseAlternative scrut_nullbinder [MkUnguarded rhs]] + return [CaseAlternative scrut_nullbinder [MkUnguarded rhs]] - desugarGuard :: [Guard] -> Expr -> (Int ->[CaseAlternative]) -> Expr + desugarGuard :: [Guard] -> Expr -> (Int -> [CaseAlternative]) -> Expr desugarGuard [] e _ = e desugarGuard (ConditionGuard c : gs) e match_failed | isTrueExpr c = desugarGuard gs e match_failed | otherwise = - Case [c] - (CaseAlternative [LiteralBinder ss (BooleanLiteral True)] - [MkUnguarded (desugarGuard gs e match_failed)] : match_failed 1) - + Case + [c] + ( CaseAlternative + [LiteralBinder ss (BooleanLiteral True)] + [MkUnguarded (desugarGuard gs e match_failed)] + : match_failed 1 + ) desugarGuard (PatternGuard vb g : gs) e match_failed = - Case [g] - (CaseAlternative [vb] [MkUnguarded (desugarGuard gs e match_failed)] - : match_failed') + Case + [g] + ( CaseAlternative [vb] [MkUnguarded (desugarGuard gs e match_failed)] + : match_failed' + ) where -- don't consider match_failed case if the binder is irrefutable - match_failed' | isIrrefutable vb = [] - | otherwise = match_failed 1 + match_failed' + | isIrrefutable vb = [] + | otherwise = match_failed 1 -- we generate a let-binding for the remaining guards -- and alternatives. A CaseAlternative is passed (or in -- fact the original case is partial non is passed) to -- mk_body which branches to the generated let-binding. - desugarAltOutOfLine :: [Binder] - -> [GuardedExpr] - -> [CaseAlternative] - -> ((Int -> [CaseAlternative]) -> Expr) - -> m Expr + desugarAltOutOfLine :: + [Binder] -> + [GuardedExpr] -> + [CaseAlternative] -> + ((Int -> [CaseAlternative]) -> Expr) -> + m Expr desugarAltOutOfLine alt_binder rem_guarded rem_alts mk_body | Just rem_case <- mkCaseOfRemainingGuardsAndAlts = do - - desugared <- desugarGuardedExprs ss rem_case - rem_case_id <- freshIdent' - unused_binder <- freshIdent' - - let - goto_rem_case :: Expr - goto_rem_case = Var ss (Qualified ByNullSourcePos rem_case_id) - `App` Literal ss (BooleanLiteral True) - alt_fail :: Int -> [CaseAlternative] - alt_fail n = [CaseAlternative (replicate n NullBinder) [MkUnguarded goto_rem_case]] - - pure $ Let FromLet [ - ValueDecl (ss, []) rem_case_id Private [] - [MkUnguarded (Abs (VarBinder ss unused_binder) desugared)] - ] (mk_body alt_fail) - - | otherwise - = pure $ mk_body (const []) + desugared <- desugarGuardedExprs ss rem_case + rem_case_id <- freshIdent' + unused_binder <- freshIdent' + + freshTyVar <- freshName + + let + remTy = quantify $ function (TypeVar (ss, []) freshTyVar kindType) (unsafeExprType desugared) + mkType e = TypedValue False e remTy + + goto_rem_case :: Expr + goto_rem_case = + mkType (Var ss (Qualified ByNullSourcePos rem_case_id)) + `App` Literal ss (BooleanLiteral True) + alt_fail :: Int -> [CaseAlternative] + alt_fail n = [CaseAlternative (replicate n NullBinder) [MkUnguarded goto_rem_case]] + + pure $ + Let + FromLet + [ ValueDecl + (ss, []) + rem_case_id + Private + [] + [MkUnguarded $ mkType (Abs (VarBinder ss unused_binder) desugared)] + ] + (mk_body alt_fail) + | otherwise = + pure $ mk_body (const []) where mkCaseOfRemainingGuardsAndAlts - | not (null rem_guarded) - = Just $ Case scrut (CaseAlternative alt_binder rem_guarded : rem_alts) - | not (null rem_alts) - = Just $ Case scrut rem_alts - | otherwise - = Nothing + | not (null rem_guarded) = + Just $ Case scrut (CaseAlternative alt_binder rem_guarded : rem_alts) + | not (null rem_alts) = + Just $ Case scrut rem_alts + | otherwise = + Nothing scrut_nullbinder :: [Binder] scrut_nullbinder = replicate (length scrut) NullBinder @@ -263,66 +300,65 @@ desugarGuardedExprs ss (Case scrut alternatives) = isNullBinder (TypedBinder _ b) = isNullBinder b isNullBinder _ = False optimize e = e - in do - alts' <- desugarAlternatives alternatives - return $ optimize (Case scrut alts') - + in + do + alts' <- desugarAlternatives alternatives + return $ optimize (Case scrut alts') desugarGuardedExprs ss (TypedValue inferred e ty) = TypedValue inferred <$> desugarGuardedExprs ss e <*> pure ty - desugarGuardedExprs _ (PositionedValue ss comms e) = PositionedValue ss comms <$> desugarGuardedExprs ss e - desugarGuardedExprs _ v = pure v --- | --- Validates that case head and binder lengths match. --- +{- | +Validates that case head and binder lengths match. +-} validateCases :: forall m. (MonadSupply m, MonadError MultipleErrors m) => [Declaration] -> m [Declaration] validateCases = flip parU f where - (f, _, _) = everywhereOnValuesM return validate return - - validate :: Expr -> m Expr - validate c@(Case vs alts) = do - let l = length vs - alts' = filter ((l /=) . length . caseAlternativeBinders) alts - unless (null alts') $ - throwError . MultipleErrors $ fmap (altError l) (caseAlternativeBinders <$> alts') - return c - validate other = return other - - altError :: Int -> [Binder] -> ErrorMessage - altError l bs = withPosition pos $ ErrorMessage [] $ CaseBinderLengthDiffers l bs - where - pos = foldl1' widenSpan (mapMaybe positionedBinder bs) + (f, _, _) = everywhereOnValuesM return validate return + + validate :: Expr -> m Expr + validate c@(Case vs alts) = do + let l = length vs + alts' = filter ((l /=) . length . caseAlternativeBinders) alts + unless (null alts') $ + throwError . MultipleErrors $ + fmap (altError l) (caseAlternativeBinders <$> alts') + return c + validate other = return other + + altError :: Int -> [Binder] -> ErrorMessage + altError l bs = withPosition pos $ ErrorMessage [] $ CaseBinderLengthDiffers l bs + where + pos = foldl1' widenSpan (mapMaybe positionedBinder bs) - widenSpan (SourceSpan n start end) (SourceSpan _ start' end') = - SourceSpan n (min start start') (max end end') + widenSpan (SourceSpan n start end) (SourceSpan _ start' end') = + SourceSpan n (min start start') (max end end') - positionedBinder (PositionedBinder p _ _) = Just p - positionedBinder _ = Nothing + positionedBinder (PositionedBinder p _ _) = Just p + positionedBinder _ = Nothing desugarAbs :: forall m. (MonadSupply m, MonadError MultipleErrors m) => [Declaration] -> m [Declaration] desugarAbs = flip parU f where - (f, _, _) = everywhereOnValuesM return replace return + (f, _, _) = everywhereOnValuesM return replace return - replace :: Expr -> m Expr - replace (Abs (stripPositioned -> (VarBinder ss i)) val) = - pure (Abs (VarBinder ss i) val) - replace (Abs binder val) = do - ident <- freshIdent' - return $ Abs (VarBinder nullSourceSpan ident) $ Case [Var nullSourceSpan (Qualified ByNullSourcePos ident)] [CaseAlternative [binder] [MkUnguarded val]] - replace other = return other + replace :: Expr -> m Expr + replace (Abs (stripPositioned -> (VarBinder ss i)) val) = + pure (Abs (VarBinder ss i) val) + replace (Abs binder val) = do + ident <- freshIdent' + return $ Abs (VarBinder nullSourceSpan ident) $ Case [Var nullSourceSpan (Qualified ByNullSourcePos ident)] [CaseAlternative [binder] [MkUnguarded val]] + replace other = return other stripPositioned :: Binder -> Binder stripPositioned (PositionedBinder _ _ binder) = stripPositioned binder stripPositioned binder = binder --- | --- Replace all top-level binders with case expressions. --- +{- | +Replace all top-level binders with case expressions. +-} desugarCases :: forall m. (MonadSupply m, MonadError MultipleErrors m) => [Declaration] -> m [Declaration] desugarCases = desugarRest <=< fmap join . flip parU toDecls . groupBy inSameGroup where @@ -332,10 +368,10 @@ desugarCases = desugarRest <=< fmap join . flip parU toDecls . groupBy inSameGro desugarRest (ValueDecl sa name nameKind bs result : rest) = let (_, f, _) = everywhereOnValuesTopDownM return go return f' = mapM (\(GuardedExpr gs e) -> GuardedExpr gs <$> f e) - in (:) <$> (ValueDecl sa name nameKind bs <$> f' result) <*> desugarRest rest + in (:) <$> (ValueDecl sa name nameKind bs <$> f' result) <*> desugarRest rest where - go (Let w ds val') = Let w <$> desugarCases ds <*> pure val' - go other = return other + go (Let w ds val') = Let w <$> desugarCases ds <*> pure val' + go other = return other desugarRest (d : ds) = (:) d <$> desugarRest ds desugarRest [] = pure [] @@ -350,22 +386,26 @@ toDecls [ValueDecl sa@(ss, _) ident nameKind bs [MkUnguarded val]] | all isIrref guardWith (errorMessage' ss (OverlappingArgNames (Just ident))) $ length (ordNub args) == length args return [ValueDecl sa ident nameKind [] [MkUnguarded body]] where - fromVarBinder :: Binder -> m Ident - fromVarBinder NullBinder = freshIdent' - fromVarBinder (VarBinder _ name) = return name - fromVarBinder (PositionedBinder _ _ b) = fromVarBinder b - fromVarBinder (TypedBinder _ b) = fromVarBinder b - fromVarBinder _ = internalError "fromVarBinder: Invalid argument" + fromVarBinder :: Binder -> m Ident + fromVarBinder NullBinder = freshIdent' + fromVarBinder (VarBinder _ name) = return name + fromVarBinder (PositionedBinder _ _ b) = fromVarBinder b + fromVarBinder (TypedBinder _ b) = fromVarBinder b + fromVarBinder _ = internalError "fromVarBinder: Invalid argument" toDecls ds@(ValueDecl (ss, _) ident _ bs (result : _) : _) = do let tuples = map toTuple ds isGuarded (MkUnguarded _) = False - isGuarded _ = True - - unless (all ((== length bs) . length . fst) tuples) . - throwError . errorMessage' ss $ ArgListLengthsDiffer ident - unless (not (null bs) || isGuarded result) . - throwError . errorMessage' ss $ DuplicateValueDeclaration ident + isGuarded _ = True + + unless (all ((== length bs) . length . fst) tuples) + . throwError + . errorMessage' ss + $ ArgListLengthsDiffer ident + unless (not (null bs) || isGuarded result) + . throwError + . errorMessage' ss + $ DuplicateValueDeclaration ident caseDecl <- makeCaseDeclaration ss ident tuples return [caseDecl] toDecls ds = return ds @@ -378,42 +418,47 @@ makeCaseDeclaration :: forall m. (MonadSupply m) => SourceSpan -> Ident -> [([Bi makeCaseDeclaration ss ident alternatives = do let namedArgs = map findName . fst <$> alternatives argNames = foldl1 resolveNames namedArgs - args <- if allUnique (catMaybes argNames) - then mapM argName argNames - else replicateM (length argNames) ((nullSourceSpan, ) <$> freshIdent') + args <- + if allUnique (catMaybes argNames) + then mapM argName argNames + else replicateM (length argNames) ((nullSourceSpan,) <$> freshIdent') let vars = map (Var ss . Qualified ByNullSourcePos . snd) args - binders = [ CaseAlternative bs result | (bs, result) <- alternatives ] + binders = [CaseAlternative bs result | (bs, result) <- alternatives] let value = foldr (Abs . uncurry VarBinder) (Case vars binders) args return $ ValueDecl (ss, []) ident Public [] [MkUnguarded value] where - -- We will construct a table of potential names. - -- VarBinders will become Just _ which is a potential name. - -- Everything else becomes Nothing, which indicates that we - -- have to generate a name. - findName :: Binder -> Maybe (SourceSpan, Ident) - findName (VarBinder ss' name) = Just (ss', name) - findName (PositionedBinder _ _ binder) = findName binder - findName _ = Nothing - - -- We still have to make sure the generated names are unique, or else - -- we will end up constructing an invalid function. - allUnique :: (Ord a) => [a] -> Bool - allUnique xs = length xs == length (ordNub xs) - - argName :: Maybe (SourceSpan, Ident) -> m (SourceSpan, Ident) - argName (Just (ss', name)) = return (ss', name) - argName _ = (nullSourceSpan, ) <$> freshIdent' - - -- Combine two lists of potential names from two case alternatives - -- by zipping corresponding columns. - resolveNames :: [Maybe (SourceSpan, Ident)] -> [Maybe (SourceSpan, Ident)] -> [Maybe (SourceSpan, Ident)] - resolveNames = zipWith resolveName - - -- Resolve a pair of names. VarBinder beats NullBinder, and everything - -- else results in Nothing. - resolveName :: Maybe (SourceSpan, Ident) -> Maybe (SourceSpan, Ident) -> Maybe (SourceSpan, Ident) - resolveName (Just a) (Just b) - | a == b = Just a - | otherwise = Nothing - resolveName _ _ = Nothing + -- We will construct a table of potential names. + -- VarBinders will become Just _ which is a potential name. + -- Everything else becomes Nothing, which indicates that we + -- have to generate a name. + findName :: Binder -> Maybe (SourceSpan, Ident) + findName (VarBinder ss' name) = Just (ss', name) + findName (PositionedBinder _ _ binder) = findName binder + findName _ = Nothing + + -- We still have to make sure the generated names are unique, or else + -- we will end up constructing an invalid function. + allUnique :: (Ord a) => [a] -> Bool + allUnique xs = length xs == length (ordNub xs) + + argName :: Maybe (SourceSpan, Ident) -> m (SourceSpan, Ident) + argName (Just (ss', name)) = return (ss', name) + argName _ = (nullSourceSpan,) <$> freshIdent' + + -- Combine two lists of potential names from two case alternatives + -- by zipping corresponding columns. + resolveNames :: [Maybe (SourceSpan, Ident)] -> [Maybe (SourceSpan, Ident)] -> [Maybe (SourceSpan, Ident)] + resolveNames = zipWith resolveName + + -- Resolve a pair of names. VarBinder beats NullBinder, and everything + -- else results in Nothing. + resolveName :: Maybe (SourceSpan, Ident) -> Maybe (SourceSpan, Ident) -> Maybe (SourceSpan, Ident) + resolveName (Just a) (Just b) + | a == b = Just a + | otherwise = Nothing + resolveName _ _ = Nothing + +unsafeExprType :: Expr -> SourceType +unsafeExprType (TypedValue _ _ t) = t +unsafeExprType other = error $ "INTERNAL ERROR: Expected a TypedValue during case desugaring but got: " <> show other diff --git a/src/Language/PureScript/Sugar/DoNotation.hs b/src/Language/PureScript/Sugar/DoNotation.hs index 8542a5a79..f6e79f63c 100644 --- a/src/Language/PureScript/Sugar/DoNotation.hs +++ b/src/Language/PureScript/Sugar/DoNotation.hs @@ -1,24 +1,25 @@ --- | This module implements the desugaring pass which replaces do-notation statements with --- appropriate calls to bind. - +{- | This module implements the desugaring pass which replaces do-notation statements with +appropriate calls to bind. +-} module Language.PureScript.Sugar.DoNotation (desugarDoModule) where import Prelude import Control.Applicative ((<|>)) -import Control.Monad.Error.Class (MonadError(..)) +import Control.Monad.Error.Class (MonadError (..)) import Control.Monad.Supply.Class (MonadSupply) import Data.Maybe (fromMaybe) -import Data.Monoid (First(..)) -import Language.PureScript.AST (Binder(..), CaseAlternative(..), Declaration, DoNotationElement(..), Expr(..), pattern MkUnguarded, Module(..), SourceSpan, pattern ValueDecl, WhereProvenance(..), binderNames, declSourceSpan, everywhereOnValuesM) -import Language.PureScript.Crash (internalError) -import Language.PureScript.Errors (MultipleErrors, SimpleErrorMessage(..), errorMessage, errorMessage', parU, rethrowWithPosition) -import Language.PureScript.Names (pattern ByNullSourcePos, Ident(..), ModuleName, Qualified(..), byMaybeModuleName, freshIdent') +import Data.Monoid (First (..)) +import Language.PureScript.AST (Binder (..), CaseAlternative (..), Declaration, DoNotationElement (..), Expr (..), Module (..), SourceSpan, WhereProvenance (..), binderNames, declSourceSpan, everywhereOnValuesM, pattern MkUnguarded, pattern ValueDecl) import Language.PureScript.Constants.Libs qualified as C +import Language.PureScript.Crash (internalError) +import Language.PureScript.Errors (MultipleErrors, SimpleErrorMessage (..), errorMessage, errorMessage', parU, rethrowWithPosition) +import Language.PureScript.Names (Ident (..), ModuleName, Qualified (..), byMaybeModuleName, freshIdent', pattern ByNullSourcePos) --- | Replace all @DoNotationBind@ and @DoNotationValue@ constructors with --- applications of the bind function in scope, and all @DoNotationLet@ --- constructors with let expressions. +{- | Replace all @DoNotationBind@ and @DoNotationValue@ constructors with +applications of the bind function in scope, and all @DoNotationLet@ +constructors with let expressions. +-} desugarDoModule :: forall m. (MonadSupply m, MonadError MultipleErrors m) => Module -> m Module desugarDoModule (Module ss coms mn ds exts) = Module ss coms mn <$> parU ds desugarDo <*> pure exts @@ -27,57 +28,58 @@ desugarDo :: forall m. (MonadSupply m, MonadError MultipleErrors m) => Declarati desugarDo d = let ss = declSourceSpan d (f, _, _) = everywhereOnValuesM return (replace ss) return - in rethrowWithPosition ss $ f d + in rethrowWithPosition ss $ f d where - bind :: SourceSpan -> Maybe ModuleName -> Expr - bind ss m = Var ss (Qualified (byMaybeModuleName m) (Ident C.S_bind)) + bind :: SourceSpan -> Maybe ModuleName -> Expr + bind ss m = Var ss (Qualified (byMaybeModuleName m) (Ident C.S_bind)) - discard :: SourceSpan -> Maybe ModuleName -> Expr - discard ss m = Var ss (Qualified (byMaybeModuleName m) (Ident C.S_discard)) + discard :: SourceSpan -> Maybe ModuleName -> Expr + discard ss m = Var ss (Qualified (byMaybeModuleName m) (Ident C.S_discard)) - replace :: SourceSpan -> Expr -> m Expr - replace pos (Do m els) = go pos m els - replace _ (PositionedValue pos com v) = PositionedValue pos com <$> rethrowWithPosition pos (replace pos v) - replace _ other = return other + replace :: SourceSpan -> Expr -> m Expr + replace pos (Do m els) = go pos m els + replace _ (PositionedValue pos com v) = PositionedValue pos com <$> rethrowWithPosition pos (replace pos v) + replace _ other = return other - stripPositionedBinder :: Binder -> (Maybe SourceSpan, Binder) - stripPositionedBinder (PositionedBinder ss _ b) = - let (ss', b') = stripPositionedBinder b - in (ss' <|> Just ss, b') - stripPositionedBinder b = - (Nothing, b) + stripPositionedBinder :: Binder -> (Maybe SourceSpan, Binder) + stripPositionedBinder (PositionedBinder ss _ b) = + let (ss', b') = stripPositionedBinder b + in (ss' <|> Just ss, b') + stripPositionedBinder b = + (Nothing, b) - go :: SourceSpan -> Maybe ModuleName -> [DoNotationElement] -> m Expr - go _ _ [] = internalError "The impossible happened in desugarDo" - go _ _ [DoNotationValue val] = return val - go pos m (DoNotationValue val : rest) = do - rest' <- go pos m rest - return $ App (App (discard pos m) val) (Abs (VarBinder pos UnusedIdent) rest') - go _ _ [DoNotationBind _ _] = throwError . errorMessage $ InvalidDoBind - go _ _ (DoNotationBind b _ : _) | First (Just ident) <- foldMap fromIdent (binderNames b) = - throwError . errorMessage $ CannotUseBindWithDo (Ident ident) - where - fromIdent (Ident i) | i `elem` [ C.S_bind, C.S_discard ] = First (Just i) - fromIdent _ = mempty - go pos m (DoNotationBind binder val : rest) = do - rest' <- go pos m rest - let (mss, binder') = stripPositionedBinder binder - let ss = fromMaybe pos mss - case binder' of - NullBinder -> - return $ App (App (bind pos m) val) (Abs (VarBinder ss UnusedIdent) rest') - VarBinder _ ident -> - return $ App (App (bind pos m) val) (Abs (VarBinder ss ident) rest') - _ -> do - ident <- freshIdent' - return $ App (App (bind pos m) val) (Abs (VarBinder pos ident) (Case [Var pos (Qualified ByNullSourcePos ident)] [CaseAlternative [binder] [MkUnguarded rest']])) - go _ _ [DoNotationLet _] = throwError . errorMessage $ InvalidDoLet - go pos m (DoNotationLet ds : rest) = do - let checkBind :: Declaration -> m () - checkBind (ValueDecl (ss, _) i@(Ident name) _ _ _) - | name `elem` [ C.S_bind, C.S_discard ] = throwError . errorMessage' ss $ CannotUseBindWithDo i - checkBind _ = pure () - mapM_ checkBind ds - rest' <- go pos m rest - return $ Let FromLet ds rest' - go _ m (PositionedDoNotationElement pos com el : rest) = rethrowWithPosition pos $ PositionedValue pos com <$> go pos m (el : rest) + go :: SourceSpan -> Maybe ModuleName -> [DoNotationElement] -> m Expr + go _ _ [] = internalError "The impossible happened in desugarDo" + go _ _ [DoNotationValue val] = return val + go pos m (DoNotationValue val : rest) = do + rest' <- go pos m rest + return $ App (App (discard pos m) val) (Abs (VarBinder pos UnusedIdent) rest') + go _ _ [DoNotationBind _ _] = throwError . errorMessage $ InvalidDoBind + go _ _ (DoNotationBind b _ : _) + | First (Just ident) <- foldMap fromIdent (binderNames b) = + throwError . errorMessage $ CannotUseBindWithDo (Ident ident) + where + fromIdent (Ident i) | i `elem` [C.S_bind, C.S_discard] = First (Just i) + fromIdent _ = mempty + go pos m (DoNotationBind binder val : rest) = do + rest' <- go pos m rest + let (mss, binder') = stripPositionedBinder binder + let ss = fromMaybe pos mss + case binder' of + NullBinder -> + return $ App (App (bind pos m) val) (Abs (VarBinder ss UnusedIdent) rest') + VarBinder _ ident -> + return $ App (App (bind pos m) val) (Abs (VarBinder ss ident) rest') + _ -> do + ident <- freshIdent' + return $ App (App (bind pos m) val) (Abs (VarBinder pos ident) (Case [Var pos (Qualified ByNullSourcePos ident)] [CaseAlternative [binder] [MkUnguarded rest']])) + go _ _ [DoNotationLet _] = throwError . errorMessage $ InvalidDoLet + go pos m (DoNotationLet ds : rest) = do + let checkBind :: Declaration -> m () + checkBind (ValueDecl (ss, _) i@(Ident name) _ _ _) + | name `elem` [C.S_bind, C.S_discard] = throwError . errorMessage' ss $ CannotUseBindWithDo i + checkBind _ = pure () + mapM_ checkBind ds + rest' <- go pos m rest + return $ Let FromLet ds rest' + go _ m (PositionedDoNotationElement pos com el : rest) = rethrowWithPosition pos $ PositionedValue pos com <$> go pos m (el : rest) diff --git a/src/Language/PureScript/Sugar/LetPattern.hs b/src/Language/PureScript/Sugar/LetPattern.hs index 519487d91..6df7bdc3d 100644 --- a/src/Language/PureScript/Sugar/LetPattern.hs +++ b/src/Language/PureScript/Sugar/LetPattern.hs @@ -1,19 +1,20 @@ --- | --- This module implements the desugaring pass which replaces patterns in let-in --- expressions with appropriate case expressions. --- +{- | +This module implements the desugaring pass which replaces patterns in let-in +expressions with appropriate case expressions. +-} module Language.PureScript.Sugar.LetPattern (desugarLetPatternModule) where import Prelude -import Data.List (groupBy) import Data.Function (on) +import Data.List (groupBy) -import Language.PureScript.AST (Binder, CaseAlternative(..), Declaration(..), Expr(..), pattern MkUnguarded, Module(..), SourceAnn, WhereProvenance, everywhereOnValues) +import Language.PureScript.AST (Binder, CaseAlternative (..), Declaration (..), Expr (..), Module (..), SourceAnn, WhereProvenance, everywhereOnValues, pattern MkUnguarded) import Language.PureScript.Crash (internalError) --- | Replace every @BoundValueDeclaration@ in @Let@ expressions with @Case@ --- expressions. +{- | Replace every @BoundValueDeclaration@ in @Let@ expressions with @Case@ +expressions. +-} desugarLetPatternModule :: Module -> Module desugarLetPatternModule (Module ss coms mn ds exts) = Module ss coms mn (map desugarLetPattern ds) exts @@ -21,28 +22,29 @@ desugarLetPatternModule (Module ss coms mn ds exts) = Module ss coms mn (map des desugarLetPattern :: Declaration -> Declaration desugarLetPattern decl = let (f, _, _) = everywhereOnValues id replace id - in f decl + in f decl where - replace :: Expr -> Expr - replace (Let w ds e) = go w (partitionDecls ds) e - replace other = other - - go :: WhereProvenance - -- Metadata about whether the let-in was a where clause - -> [Either [Declaration] (SourceAnn, Binder, Expr)] - -- Declarations to desugar - -> Expr - -- The original let-in result expression - -> Expr - go _ [] e = e - go w (Right ((pos, com), binder, boundE) : ds) e = - PositionedValue pos com $ Case [boundE] [CaseAlternative [binder] [MkUnguarded $ go w ds e]] - go w (Left ds:dss) e = Let w ds (go w dss e) + replace :: Expr -> Expr + replace (Let w ds e) = go w (partitionDecls ds) e + replace other = other + + go :: + WhereProvenance -> + -- Metadata about whether the let-in was a where clause + [Either [Declaration] (SourceAnn, Binder, Expr)] -> + -- Declarations to desugar + Expr -> + -- The original let-in result expression + Expr + go _ [] e = e + go w (Right ((pos, com), binder, boundE) : ds) e = + PositionedValue pos com $ Case [boundE] [CaseAlternative [binder] [MkUnguarded $ go w ds e]] + go w (Left ds : dss) e = Let w ds (go w dss e) partitionDecls :: [Declaration] -> [Either [Declaration] (SourceAnn, Binder, Expr)] partitionDecls = concatMap f . groupBy ((==) `on` isBoundValueDeclaration) where - f ds@(d:_) + f ds@(d : _) | isBoundValueDeclaration d = map (Right . g) ds f ds = [Left ds] @@ -50,5 +52,5 @@ partitionDecls = concatMap f . groupBy ((==) `on` isBoundValueDeclaration) g _ = internalError "partitionDecls: the impossible happened." isBoundValueDeclaration :: Declaration -> Bool -isBoundValueDeclaration BoundValueDeclaration{} = True +isBoundValueDeclaration BoundValueDeclaration {} = True isBoundValueDeclaration _ = False diff --git a/src/Language/PureScript/Sugar/Names.hs b/src/Language/PureScript/Sugar/Names.hs index d081764d7..d57670e6e 100644 --- a/src/Language/PureScript/Sugar/Names.hs +++ b/src/Language/PureScript/Sugar/Names.hs @@ -1,443 +1,480 @@ -module Language.PureScript.Sugar.Names - ( desugarImports - , Env - , externsEnv - , primEnv - , ImportRecord(..) - , ImportProvenance(..) - , Imports(..) - , Exports(..) - ) where - +module Language.PureScript.Sugar.Names ( + desugarImports, + Env, + externsEnv, + primEnv, + ImportRecord (..), + ImportProvenance (..), + Imports (..), + Exports (..), +) where + +import Protolude (foldl', sortOn, swap) import Prelude -import Protolude (sortOn, swap, foldl') import Control.Arrow (first, second, (&&&)) import Control.Monad (foldM, when, (>=>)) -import Control.Monad.Error.Class (MonadError(..)) -import Control.Monad.State.Lazy (MonadState, StateT(..), gets, modify) -import Control.Monad.Writer (MonadWriter(..)) +import Control.Monad.Error.Class (MonadError (..)) +import Control.Monad.State.Lazy (MonadState, StateT (..), gets, modify) +import Control.Monad.Writer (MonadWriter (..)) import Data.List.NonEmpty qualified as NEL -import Data.Maybe (fromMaybe, mapMaybe) import Data.Map qualified as M +import Data.Maybe (fromMaybe, mapMaybe) import Data.Set qualified as S import Language.PureScript.AST import Language.PureScript.Crash (internalError) -import Language.PureScript.Errors (MultipleErrors, SimpleErrorMessage(..), addHint, errorMessage, errorMessage'', nonEmpty, parU, warnAndRethrow, warnAndRethrowWithPosition) -import Language.PureScript.Externs (ExternsDeclaration(..), ExternsFile(..), ExternsImport(..)) -import Language.PureScript.Linter.Imports (Name(..), UsedImports) -import Language.PureScript.Names (pattern ByNullSourcePos, Ident, OpName, OpNameType(..), ProperName, ProperNameType(..), Qualified(..), QualifiedBy(..)) -import Language.PureScript.Sugar.Names.Env (Env, Exports(..), ImportProvenance(..), ImportRecord(..), Imports(..), checkImportConflicts, nullImports, primEnv) +import Language.PureScript.Errors (MultipleErrors, SimpleErrorMessage (..), addHint, errorMessage, errorMessage'', nonEmpty, parU, warnAndRethrow, warnAndRethrowWithPosition) +import Language.PureScript.Externs (ExternsDeclaration (..), ExternsFile (..), ExternsImport (..)) +import Language.PureScript.Linter.Imports (Name (..), UsedImports) +import Language.PureScript.Names (Ident, OpName, OpNameType (..), ProperName, ProperNameType (..), Qualified (..), QualifiedBy (..), pattern ByNullSourcePos) +import Language.PureScript.Sugar.Names.Env (Env, Exports (..), ImportProvenance (..), ImportRecord (..), Imports (..), checkImportConflicts, nullImports, primEnv) import Language.PureScript.Sugar.Names.Exports (findExportable, resolveExports) import Language.PureScript.Sugar.Names.Imports (resolveImports, resolveModuleImport) import Language.PureScript.Traversals (defS, sndM) -import Language.PureScript.Types (Constraint(..), SourceConstraint, SourceType, Type(..), everywhereOnTypesM) - --- | --- Replaces all local names with qualified names. --- -desugarImports - :: forall m - . (MonadError MultipleErrors m, MonadWriter MultipleErrors m, MonadState (Env, UsedImports) m) - => Module - -> m Module +import Language.PureScript.Types (Constraint (..), SourceConstraint, SourceType, Type (..), everywhereOnTypesM) + +{- | +Replaces all local names with qualified names. +-} +desugarImports :: + forall m. + (MonadError MultipleErrors m, MonadWriter MultipleErrors m, MonadState (Env, UsedImports) m) => + Module -> + m Module desugarImports = updateEnv >=> renameInModule' where - updateEnv :: Module -> m Module - updateEnv m@(Module ss _ mn _ refs) = do - members <- findExportable m - env' <- gets $ M.insert mn (ss, nullImports, members) . fst - (m', imps) <- resolveImports env' m - exps <- maybe (return members) (resolveExports env' ss mn imps members) refs - modify . first $ M.insert mn (ss, imps, exps) - return m' - - renameInModule' :: Module -> m Module - renameInModule' m@(Module _ _ mn _ _) = - warnAndRethrow (addHint (ErrorInModule mn)) $ do - env <- gets fst - let (_, imps, exps) = fromMaybe (internalError "Module is missing in renameInModule'") $ M.lookup mn env - (m', used) <- flip runStateT M.empty $ renameInModule imps m - modify . second $ M.unionWith (<>) used - return $ elaborateExports exps m' + updateEnv :: Module -> m Module + updateEnv m@(Module ss _ mn _ refs) = do + members <- findExportable m + env' <- gets $ M.insert mn (ss, nullImports, members) . fst + (m', imps) <- resolveImports env' m + exps <- maybe (return members) (resolveExports env' ss mn imps members) refs + modify . first $ M.insert mn (ss, imps, exps) + return m' + + renameInModule' :: Module -> m Module + renameInModule' m@(Module _ _ mn _ _) = + warnAndRethrow (addHint (ErrorInModule mn)) $ do + env <- gets fst + let (_, imps, exps) = fromMaybe (internalError "Module is missing in renameInModule'") $ M.lookup mn env + (m', used) <- flip runStateT M.empty $ renameInModule imps m + modify . second $ M.unionWith (<>) used + return $ elaborateExports exps m' -- | Create an environment from a collection of externs files -externsEnv - :: forall m - . (MonadError MultipleErrors m, MonadWriter MultipleErrors m) - => Env - -> ExternsFile - -> m Env -externsEnv env ExternsFile{..} = do - let members = Exports{..} +externsEnv :: + forall m. + (MonadError MultipleErrors m, MonadWriter MultipleErrors m) => + Env -> + ExternsFile -> + m Env +externsEnv env ExternsFile {..} = do + let members = Exports {..} env' = M.insert efModuleName (efSourceSpan, nullImports, members) env fromEFImport (ExternsImport mn mt qmn) = (mn, [(efSourceSpan, Just mt, qmn)]) imps <- foldM (resolveModuleImport env') nullImports (map fromEFImport efImports) exps <- resolveExports env' efSourceSpan efModuleName imps members efExports return $ M.insert efModuleName (efSourceSpan, imps, exps) env where - - -- An ExportSource for declarations local to the module which the given - -- ExternsFile corresponds to. - localExportSource = - ExportSource { exportSourceDefinedIn = efModuleName - , exportSourceImportedFrom = Nothing - } - - exportedTypes :: M.Map (ProperName 'TypeName) ([ProperName 'ConstructorName], ExportSource) - exportedTypes = M.fromList $ mapMaybe toExportedType efExports - where - toExportedType (TypeRef _ tyCon dctors) = Just (tyCon, (fromMaybe (mapMaybe forTyCon efDeclarations) dctors, localExportSource)) + -- An ExportSource for declarations local to the module which the given + -- ExternsFile corresponds to. + localExportSource = + ExportSource + { exportSourceDefinedIn = efModuleName + , exportSourceImportedFrom = Nothing + } + + exportedTypes :: M.Map (ProperName 'TypeName) ([ProperName 'ConstructorName], ExportSource) + exportedTypes = M.fromList $ mapMaybe toExportedType efExports where - forTyCon :: ExternsDeclaration -> Maybe (ProperName 'ConstructorName) - forTyCon (EDDataConstructor pn _ tNm _ _) | tNm == tyCon = Just pn - forTyCon _ = Nothing - toExportedType _ = Nothing - - exportedTypeOps :: M.Map (OpName 'TypeOpName) ExportSource - exportedTypeOps = exportedRefs getTypeOpRef - - exportedTypeClasses :: M.Map (ProperName 'ClassName) ExportSource - exportedTypeClasses = exportedRefs getTypeClassRef - - exportedValues :: M.Map Ident ExportSource - exportedValues = exportedRefs getValueRef - - exportedValueOps :: M.Map (OpName 'ValueOpName) ExportSource - exportedValueOps = exportedRefs getValueOpRef - - exportedRefs :: Ord a => (DeclarationRef -> Maybe a) -> M.Map a ExportSource - exportedRefs f = - M.fromList $ (, localExportSource) <$> mapMaybe f efExports - --- | --- Make all exports for a module explicit. This may still affect modules that --- have an exports list, as it will also make all data constructor exports --- explicit. --- --- The exports will appear in the same order as they do in the existing exports --- list, or if there is no export list, declarations are order based on their --- order of appearance in the module. --- + toExportedType (TypeRef _ tyCon dctors) = Just (tyCon, (fromMaybe (mapMaybe forTyCon efDeclarations) dctors, localExportSource)) + where + forTyCon :: ExternsDeclaration -> Maybe (ProperName 'ConstructorName) + forTyCon (EDDataConstructor pn _ tNm _ _) | tNm == tyCon = Just pn + forTyCon _ = Nothing + toExportedType _ = Nothing + + exportedTypeOps :: M.Map (OpName 'TypeOpName) ExportSource + exportedTypeOps = exportedRefs getTypeOpRef + + exportedTypeClasses :: M.Map (ProperName 'ClassName) ExportSource + exportedTypeClasses = exportedRefs getTypeClassRef + + exportedValues :: M.Map Ident ExportSource + exportedValues = exportedRefs getValueRef + + exportedValueOps :: M.Map (OpName 'ValueOpName) ExportSource + exportedValueOps = exportedRefs getValueOpRef + + exportedRefs :: (Ord a) => (DeclarationRef -> Maybe a) -> M.Map a ExportSource + exportedRefs f = + M.fromList $ (,localExportSource) <$> mapMaybe f efExports + +{- | +Make all exports for a module explicit. This may still affect modules that +have an exports list, as it will also make all data constructor exports +explicit. + +The exports will appear in the same order as they do in the existing exports +list, or if there is no export list, declarations are order based on their +order of appearance in the module. +-} elaborateExports :: Exports -> Module -> Module elaborateExports exps (Module ss coms mn decls refs) = - Module ss coms mn decls $ Just $ reorderExports decls refs - $ elaboratedTypeRefs - ++ go (TypeOpRef ss) exportedTypeOps - ++ go (TypeClassRef ss) exportedTypeClasses - ++ go (ValueRef ss) exportedValues - ++ go (ValueOpRef ss) exportedValueOps - ++ maybe [] (filter isModuleRef) refs + Module ss coms mn decls $ + Just $ + reorderExports decls refs $ + elaboratedTypeRefs + ++ go (TypeOpRef ss) exportedTypeOps + ++ go (TypeClassRef ss) exportedTypeClasses + ++ go (ValueRef ss) exportedValues + ++ go (ValueOpRef ss) exportedValueOps + ++ maybe [] (filter isModuleRef) refs where - - elaboratedTypeRefs :: [DeclarationRef] - elaboratedTypeRefs = - flip map (M.toList (exportedTypes exps)) $ \(tctor, (dctors, src)) -> - let ref = TypeRef ss tctor (Just dctors) - in if mn == exportSourceDefinedIn src then ref else ReExportRef ss src ref - - go :: (a -> DeclarationRef) -> (Exports -> M.Map a ExportSource) -> [DeclarationRef] - go toRef select = - flip map (M.toList (select exps)) $ \(export, src) -> - if mn == exportSourceDefinedIn src then toRef export else ReExportRef ss src (toRef export) - --- | --- Given a list of declarations, an original exports list, and an elaborated --- exports list, reorder the elaborated list so that it matches the original --- order. If there is no original exports list, reorder declarations based on --- their order in the source file. + elaboratedTypeRefs :: [DeclarationRef] + elaboratedTypeRefs = + flip map (M.toList (exportedTypes exps)) $ \(tctor, (dctors, src)) -> + let ref = TypeRef ss tctor (Just dctors) + in if mn == exportSourceDefinedIn src then ref else ReExportRef ss src ref + + go :: (a -> DeclarationRef) -> (Exports -> M.Map a ExportSource) -> [DeclarationRef] + go toRef select = + flip map (M.toList (select exps)) $ \(export, src) -> + if mn == exportSourceDefinedIn src then toRef export else ReExportRef ss src (toRef export) + +{- | +Given a list of declarations, an original exports list, and an elaborated +exports list, reorder the elaborated list so that it matches the original +order. If there is no original exports list, reorder declarations based on +their order in the source file. +-} reorderExports :: [Declaration] -> Maybe [DeclarationRef] -> [DeclarationRef] -> [DeclarationRef] reorderExports decls originalRefs = sortOn originalIndex where - names = - maybe (mapMaybe declName decls) (map declRefName) originalRefs - namesMap = - M.fromList $ zip names [(0::Int)..] - originalIndex ref = - M.lookup (declRefName ref) namesMap - --- | --- Replaces all local names with qualified names within a module and checks that all existing --- qualified names are valid. --- -renameInModule - :: forall m - . (MonadError MultipleErrors m, MonadWriter MultipleErrors m, MonadState UsedImports m) - => Imports - -> Module - -> m Module + names = + maybe (mapMaybe declName decls) (map declRefName) originalRefs + namesMap = + M.fromList $ zip names [(0 :: Int) ..] + originalIndex ref = + M.lookup (declRefName ref) namesMap + +{- | +Replaces all local names with qualified names within a module and checks that all existing +qualified names are valid. +-} +renameInModule :: + forall m. + (MonadError MultipleErrors m, MonadWriter MultipleErrors m, MonadState UsedImports m) => + Imports -> + Module -> + m Module renameInModule imports (Module modSS coms mn decls exps) = Module modSS coms mn <$> parU decls go <*> pure exps where - - (go, _, _, _, _, _) = - everywhereWithContextOnValuesM - (modSS, M.empty) - (\(_, bound) d -> (\(bound', d') -> ((declSourceSpan d', bound'), d')) <$> updateDecl bound d) - updateValue - updateBinder - updateCase - defS - updateGuard - - updateDecl - :: M.Map Ident SourcePos - -> Declaration - -> m (M.Map Ident SourcePos, Declaration) - updateDecl bound (DataDeclaration sa dtype name args dctors) = - fmap (bound,) $ - DataDeclaration sa dtype name - <$> updateTypeArguments args - <*> traverse (traverseDataCtorFields (traverse (sndM updateTypesEverywhere))) dctors - updateDecl bound (TypeSynonymDeclaration sa name ps ty) = - fmap (bound,) $ - TypeSynonymDeclaration sa name - <$> updateTypeArguments ps - <*> updateTypesEverywhere ty - updateDecl bound (TypeClassDeclaration sa className args implies deps ds) = - fmap (bound,) $ - TypeClassDeclaration sa className - <$> updateTypeArguments args - <*> updateConstraints implies - <*> pure deps - <*> pure ds - updateDecl bound (TypeInstanceDeclaration sa na@(ss, _) ch idx name cs cn ts ds) = - fmap (bound,) $ - TypeInstanceDeclaration sa na ch idx name - <$> updateConstraints cs - <*> updateClassName cn ss + (go, _, _, _, _, _) = + everywhereWithContextOnValuesM + (modSS, M.empty) + (\(_, bound) d -> (\(bound', d') -> ((declSourceSpan d', bound'), d')) <$> updateDecl bound d) + updateValue + updateBinder + updateCase + defS + updateGuard + + updateDecl :: + M.Map Ident SourcePos -> + Declaration -> + m (M.Map Ident SourcePos, Declaration) + updateDecl bound (DataDeclaration sa dtype name args dctors) = + fmap (bound,) $ + DataDeclaration sa dtype name + <$> updateTypeArguments args + <*> traverse (traverseDataCtorFields (traverse (sndM updateTypesEverywhere))) dctors + updateDecl bound (TypeSynonymDeclaration sa name ps ty) = + fmap (bound,) $ + TypeSynonymDeclaration sa name + <$> updateTypeArguments ps + <*> updateTypesEverywhere ty + updateDecl bound (TypeClassDeclaration sa className args implies deps ds) = + fmap (bound,) $ + TypeClassDeclaration sa className + <$> updateTypeArguments args + <*> updateConstraints implies + <*> pure deps + <*> pure ds + updateDecl bound (TypeInstanceDeclaration sa na@(ss, _) ch idx name cs cn ts ds) = + fmap (bound,) $ + TypeInstanceDeclaration sa na ch idx name + <$> updateConstraints cs + <*> updateClassName cn ss + <*> traverse updateTypesEverywhere ts + <*> pure ds + updateDecl bound (KindDeclaration sa kindFor name ty) = + fmap (bound,) $ + KindDeclaration sa kindFor name + <$> updateTypesEverywhere ty + updateDecl bound (TypeDeclaration (TypeDeclarationData sa name ty)) = + fmap (bound,) $ + TypeDeclaration . TypeDeclarationData sa name + <$> updateTypesEverywhere ty + updateDecl bound (ExternDeclaration sa name ty) = + fmap (M.insert name (spanStart $ fst sa) bound,) $ + ExternDeclaration sa name + <$> updateTypesEverywhere ty + updateDecl bound (ExternDataDeclaration sa name ki) = + fmap (bound,) $ + ExternDataDeclaration sa name + <$> updateTypesEverywhere ki + updateDecl bound (TypeFixityDeclaration sa@(ss, _) fixity alias op) = + fmap (bound,) $ + TypeFixityDeclaration sa fixity + <$> updateTypeName alias ss + <*> pure op + updateDecl bound (ValueFixityDeclaration sa@(ss, _) fixity (Qualified mn' (Left alias)) op) = + fmap (bound,) $ + ValueFixityDeclaration sa fixity . fmap Left + <$> updateValueName (Qualified mn' alias) ss + <*> pure op + updateDecl bound (ValueFixityDeclaration sa@(ss, _) fixity (Qualified mn' (Right alias)) op) = + fmap (bound,) $ + ValueFixityDeclaration sa fixity . fmap Right + <$> updateDataConstructorName (Qualified mn' alias) ss + <*> pure op + updateDecl b d = + return (b, d) + + updateValue :: + (SourceSpan, M.Map Ident SourcePos) -> + Expr -> + m ((SourceSpan, M.Map Ident SourcePos), Expr) + updateValue (_, bound) v@(PositionedValue pos' _ _) = + return ((pos', bound), v) + updateValue (pos, bound) (Abs (VarBinder ss arg) val') = + return ((pos, M.insert arg (spanStart ss) bound), Abs (VarBinder ss arg) val') + updateValue (pos, bound) (Let w ds val') = do + let + args = mapMaybe letBoundVariable ds + groupByFst = map (\ts -> (fst (NEL.head ts), snd <$> ts)) . NEL.groupAllWith fst + duplicateArgsErrs = foldMap mkArgError $ groupByFst args + mkArgError (ident, poses) + | NEL.length poses < 2 = mempty + | otherwise = errorMessage'' (NEL.reverse poses) (OverlappingNamesInLet ident) + when (nonEmpty duplicateArgsErrs) $ + throwError duplicateArgsErrs + return ((pos, declarationsToMap ds `M.union` bound), Let w ds val') + updateValue (_, bound) (Var ss name'@(Qualified qualifiedBy ident)) = + ((ss, bound),) <$> case (M.lookup ident bound, qualifiedBy) of + -- bound idents that have yet to be locally qualified. + (Just sourcePos, ByNullSourcePos) -> + pure $ Var ss (Qualified (BySourcePos sourcePos) ident) + -- unbound idents are likely import unqualified imports, so we + -- handle them through updateValueName if they don't exist as a + -- local binding. + (Nothing, ByNullSourcePos) -> + Var ss <$> updateValueName name' ss + -- bound/unbound idents with explicit qualification is still + -- handled through updateValueName, as it fully resolves the + -- ModuleName. + (_, ByModuleName _) -> + Var ss <$> updateValueName name' ss + -- encountering non-null source spans may be a bug in previous + -- desugaring steps or with the AST traversals. + (_, BySourcePos _) -> + internalError "updateValue: ident is locally-qualified by a non-null source position" + updateValue (_, bound) (Op ss op) = + ((ss, bound),) <$> (Op ss <$> updateValueOpName op ss) + updateValue (_, bound) (Constructor ss name) = + ((ss, bound),) <$> (Constructor ss <$> updateDataConstructorName name ss) + updateValue s (TypedValue check val ty) = + (s,) <$> (TypedValue check val <$> updateTypesEverywhere ty) + updateValue s (VisibleTypeApp val ty) = + (s,) <$> VisibleTypeApp val <$> updateTypesEverywhere ty + updateValue s v = return (s, v) + + updateBinder :: + (SourceSpan, M.Map Ident SourcePos) -> + Binder -> + m ((SourceSpan, M.Map Ident SourcePos), Binder) + updateBinder (_, bound) v@(PositionedBinder pos _ _) = + return ((pos, bound), v) + updateBinder (_, bound) (ConstructorBinder ss name b) = + ((ss, bound),) <$> (ConstructorBinder ss <$> updateDataConstructorName name ss <*> pure b) + updateBinder (_, bound) (OpBinder ss op) = + ((ss, bound),) <$> (OpBinder ss <$> updateValueOpName op ss) + updateBinder s (TypedBinder t b) = do + t' <- updateTypesEverywhere t + return (s, TypedBinder t' b) + updateBinder s v = + return (s, v) + + updateCase :: + (SourceSpan, M.Map Ident SourcePos) -> + CaseAlternative -> + m ((SourceSpan, M.Map Ident SourcePos), CaseAlternative) + updateCase (pos, bound) c@(CaseAlternative bs _) = + return ((pos, rUnionMap binderNamesWithSpans' bs `M.union` bound), c) + where + rUnionMap f = foldl' (flip (M.union . f)) M.empty + + updateGuard :: + (SourceSpan, M.Map Ident SourcePos) -> + Guard -> + m ((SourceSpan, M.Map Ident SourcePos), Guard) + updateGuard (pos, bound) g@(ConditionGuard _) = + return ((pos, bound), g) + updateGuard (pos, bound) g@(PatternGuard b _) = + return ((pos, binderNamesWithSpans' b `M.union` bound), g) + + binderNamesWithSpans' :: Binder -> M.Map Ident SourcePos + binderNamesWithSpans' = + M.fromList + . fmap (second spanStart . swap) + . binderNamesWithSpans + + letBoundVariable :: Declaration -> Maybe (Ident, SourceSpan) + letBoundVariable = fmap (valdeclIdent &&& (fst . valdeclSourceAnn)) . getValueDeclaration + + declarationsToMap :: [Declaration] -> M.Map Ident SourcePos + declarationsToMap = foldl goDTM M.empty + where + goDTM a (ValueDeclaration ValueDeclarationData {..}) = + M.insert valdeclIdent (spanStart $ fst valdeclSourceAnn) a + goDTM a _ = + a + + updateTypeArguments :: + (Traversable f) => + f (a, SourceType) -> + m (f (a, SourceType)) + updateTypeArguments = traverse (traverse updateTypesEverywhere) + + updateTypesEverywhere :: SourceType -> m SourceType + updateTypesEverywhere = everywhereOnTypesM updateType + where + updateType :: SourceType -> m SourceType + updateType (TypeOp ann@(ss, _) name) = TypeOp ann <$> updateTypeOpName name ss + updateType (TypeConstructor ann@(ss, _) name) = TypeConstructor ann <$> updateTypeName name ss + updateType (ConstrainedType ann c t) = ConstrainedType ann <$> updateInConstraint c <*> pure t + updateType (TypeVar ann nm ki) = TypeVar ann nm <$> updateType' ki + updateType t = return t + updateInConstraint :: SourceConstraint -> m SourceConstraint + updateInConstraint (Constraint ann@(ss, _) name ks ts info) = + Constraint ann <$> updateClassName name ss <*> pure ks <*> pure ts <*> pure info + + {- NOTE/REVIEW/HACK: + + Before our 'mandatory kinds' changes, `updateType` ignored TypeApps. + + Our changes add mandatory kind annotations to Type variables. If those annotations mention + unqualified type constructors (kind constructors) from `Prim`, we need to qualify them to + avoid typechecking errors. + + For example, if we have: + + ``` + aFunction4 :: forall (r :: Row Type). {a :: Int | r} -> Int + ``` + + Then `updateType` will ignore the `Row Type` annotation because there isn't a case branch + for TypeApps. + + Adding a TypeApp case above breaks everything - afaict it qualifies local names + that shouldn't need to be qualified such that they're qualified by the module + in which they occur. (Didn't look too closely into why because it broke every single test + module). + + We need this helper function to ensure that the above example does not have to be explicitly + annotated as + + ``` + aFunction4 :: forall (r :: Prim.Row Prim.Type). {a :: Int | r} -> Int + ``` + + THIS MIGHT BREAK SOMETHING. It appears to work with our existing tests, but those + are not comprehensive. + -} + updateType' :: SourceType -> m SourceType + updateType' = \case + TypeApp ann t1 t2 -> TypeApp ann <$> updateType' t1 <*> updateType' t2 + other -> updateType other + + updateConstraints :: [SourceConstraint] -> m [SourceConstraint] + updateConstraints = traverse $ \(Constraint ann@(pos, _) name ks ts info) -> + Constraint ann + <$> updateClassName name pos + <*> traverse updateTypesEverywhere ks <*> traverse updateTypesEverywhere ts - <*> pure ds - updateDecl bound (KindDeclaration sa kindFor name ty) = - fmap (bound,) $ - KindDeclaration sa kindFor name - <$> updateTypesEverywhere ty - updateDecl bound (TypeDeclaration (TypeDeclarationData sa name ty)) = - fmap (bound,) $ - TypeDeclaration . TypeDeclarationData sa name - <$> updateTypesEverywhere ty - updateDecl bound (ExternDeclaration sa name ty) = - fmap (M.insert name (spanStart $ fst sa) bound,) $ - ExternDeclaration sa name - <$> updateTypesEverywhere ty - updateDecl bound (ExternDataDeclaration sa name ki) = - fmap (bound,) $ - ExternDataDeclaration sa name - <$> updateTypesEverywhere ki - updateDecl bound (TypeFixityDeclaration sa@(ss, _) fixity alias op) = - fmap (bound,) $ - TypeFixityDeclaration sa fixity - <$> updateTypeName alias ss - <*> pure op - updateDecl bound (ValueFixityDeclaration sa@(ss, _) fixity (Qualified mn' (Left alias)) op) = - fmap (bound,) $ - ValueFixityDeclaration sa fixity . fmap Left - <$> updateValueName (Qualified mn' alias) ss - <*> pure op - updateDecl bound (ValueFixityDeclaration sa@(ss, _) fixity (Qualified mn' (Right alias)) op) = - fmap (bound,) $ - ValueFixityDeclaration sa fixity . fmap Right - <$> updateDataConstructorName (Qualified mn' alias) ss - <*> pure op - updateDecl b d = - return (b, d) - - updateValue - :: (SourceSpan, M.Map Ident SourcePos) - -> Expr - -> m ((SourceSpan, M.Map Ident SourcePos), Expr) - updateValue (_, bound) v@(PositionedValue pos' _ _) = - return ((pos', bound), v) - updateValue (pos, bound) (Abs (VarBinder ss arg) val') = - return ((pos, M.insert arg (spanStart ss) bound), Abs (VarBinder ss arg) val') - updateValue (pos, bound) (Let w ds val') = do - let - args = mapMaybe letBoundVariable ds - groupByFst = map (\ts -> (fst (NEL.head ts), snd <$> ts)) . NEL.groupAllWith fst - duplicateArgsErrs = foldMap mkArgError $ groupByFst args - mkArgError (ident, poses) - | NEL.length poses < 2 = mempty - | otherwise = errorMessage'' (NEL.reverse poses) (OverlappingNamesInLet ident) - when (nonEmpty duplicateArgsErrs) $ - throwError duplicateArgsErrs - return ((pos, declarationsToMap ds `M.union` bound), Let w ds val') - updateValue (_, bound) (Var ss name'@(Qualified qualifiedBy ident)) = - ((ss, bound), ) <$> case (M.lookup ident bound, qualifiedBy) of - -- bound idents that have yet to be locally qualified. - (Just sourcePos, ByNullSourcePos) -> - pure $ Var ss (Qualified (BySourcePos sourcePos) ident) - -- unbound idents are likely import unqualified imports, so we - -- handle them through updateValueName if they don't exist as a - -- local binding. - (Nothing, ByNullSourcePos) -> - Var ss <$> updateValueName name' ss - -- bound/unbound idents with explicit qualification is still - -- handled through updateValueName, as it fully resolves the - -- ModuleName. - (_, ByModuleName _) -> - Var ss <$> updateValueName name' ss - -- encountering non-null source spans may be a bug in previous - -- desugaring steps or with the AST traversals. - (_, BySourcePos _) -> - internalError "updateValue: ident is locally-qualified by a non-null source position" - updateValue (_, bound) (Op ss op) = - ((ss, bound), ) <$> (Op ss <$> updateValueOpName op ss) - updateValue (_, bound) (Constructor ss name) = - ((ss, bound), ) <$> (Constructor ss <$> updateDataConstructorName name ss) - updateValue s (TypedValue check val ty) = - (s, ) <$> (TypedValue check val <$> updateTypesEverywhere ty) - updateValue s (VisibleTypeApp val ty) = - (s, ) <$> VisibleTypeApp val <$> updateTypesEverywhere ty - updateValue s v = return (s, v) - - updateBinder - :: (SourceSpan, M.Map Ident SourcePos) - -> Binder - -> m ((SourceSpan, M.Map Ident SourcePos), Binder) - updateBinder (_, bound) v@(PositionedBinder pos _ _) = - return ((pos, bound), v) - updateBinder (_, bound) (ConstructorBinder ss name b) = - ((ss, bound), ) <$> (ConstructorBinder ss <$> updateDataConstructorName name ss <*> pure b) - updateBinder (_, bound) (OpBinder ss op) = - ((ss, bound), ) <$> (OpBinder ss <$> updateValueOpName op ss) - updateBinder s (TypedBinder t b) = do - t' <- updateTypesEverywhere t - return (s, TypedBinder t' b) - updateBinder s v = - return (s, v) - - updateCase - :: (SourceSpan, M.Map Ident SourcePos) - -> CaseAlternative - -> m ((SourceSpan, M.Map Ident SourcePos), CaseAlternative) - updateCase (pos, bound) c@(CaseAlternative bs _) = - return ((pos, rUnionMap binderNamesWithSpans' bs `M.union` bound), c) - where - rUnionMap f = foldl' (flip (M.union . f)) M.empty - - updateGuard - :: (SourceSpan, M.Map Ident SourcePos) - -> Guard - -> m ((SourceSpan, M.Map Ident SourcePos), Guard) - updateGuard (pos, bound) g@(ConditionGuard _) = - return ((pos, bound), g) - updateGuard (pos, bound) g@(PatternGuard b _) = - return ((pos, binderNamesWithSpans' b `M.union` bound), g) - - binderNamesWithSpans' :: Binder -> M.Map Ident SourcePos - binderNamesWithSpans' - = M.fromList - . fmap (second spanStart . swap) - . binderNamesWithSpans - - letBoundVariable :: Declaration -> Maybe (Ident, SourceSpan) - letBoundVariable = fmap (valdeclIdent &&& (fst . valdeclSourceAnn)) . getValueDeclaration - - declarationsToMap :: [Declaration] -> M.Map Ident SourcePos - declarationsToMap = foldl goDTM M.empty - where - goDTM a (ValueDeclaration ValueDeclarationData {..}) = - M.insert valdeclIdent (spanStart $ fst valdeclSourceAnn) a - goDTM a _ = - a - - updateTypeArguments - :: (Traversable f, Traversable g) - => f (a, g SourceType) -> m (f (a, g SourceType)) - updateTypeArguments = traverse (sndM (traverse updateTypesEverywhere)) - - updateTypesEverywhere :: SourceType -> m SourceType - updateTypesEverywhere = everywhereOnTypesM updateType - where - updateType :: SourceType -> m SourceType - updateType (TypeOp ann@(ss, _) name) = TypeOp ann <$> updateTypeOpName name ss - updateType (TypeConstructor ann@(ss, _) name) = TypeConstructor ann <$> updateTypeName name ss - updateType (ConstrainedType ann c t) = ConstrainedType ann <$> updateInConstraint c <*> pure t - updateType t = return t - updateInConstraint :: SourceConstraint -> m SourceConstraint - updateInConstraint (Constraint ann@(ss, _) name ks ts info) = - Constraint ann <$> updateClassName name ss <*> pure ks <*> pure ts <*> pure info - - updateConstraints :: [SourceConstraint] -> m [SourceConstraint] - updateConstraints = traverse $ \(Constraint ann@(pos, _) name ks ts info) -> - Constraint ann - <$> updateClassName name pos - <*> traverse updateTypesEverywhere ks - <*> traverse updateTypesEverywhere ts - <*> pure info - - updateTypeName - :: Qualified (ProperName 'TypeName) - -> SourceSpan - -> m (Qualified (ProperName 'TypeName)) - updateTypeName = update (importedTypes imports) TyName - - updateTypeOpName - :: Qualified (OpName 'TypeOpName) - -> SourceSpan - -> m (Qualified (OpName 'TypeOpName)) - updateTypeOpName = update (importedTypeOps imports) TyOpName - - updateDataConstructorName - :: Qualified (ProperName 'ConstructorName) - -> SourceSpan - -> m (Qualified (ProperName 'ConstructorName)) - updateDataConstructorName = update (importedDataConstructors imports) DctorName - - updateClassName - :: Qualified (ProperName 'ClassName) - -> SourceSpan - -> m (Qualified (ProperName 'ClassName)) - updateClassName = update (importedTypeClasses imports) TyClassName - - updateValueName :: Qualified Ident -> SourceSpan -> m (Qualified Ident) - updateValueName = update (importedValues imports) IdentName - - updateValueOpName - :: Qualified (OpName 'ValueOpName) - -> SourceSpan - -> m (Qualified (OpName 'ValueOpName)) - updateValueOpName = update (importedValueOps imports) ValOpName - - -- Update names so unqualified references become qualified, and locally - -- qualified references are replaced with their canonical qualified names - -- (e.g. M.Map -> Data.Map.Map). - update - :: (Ord a) - => M.Map (Qualified a) [ImportRecord a] - -> (a -> Name) - -> Qualified a - -> SourceSpan - -> m (Qualified a) - update imps toName qname@(Qualified mn' name) pos = warnAndRethrowWithPosition pos $ - case (M.lookup qname imps, mn') of - - -- We found the name in our imports, so we return the name for it, - -- qualifying with the name of the module it was originally defined in - -- rather than the module we're importing from, to handle the case of - -- re-exports. If there are multiple options for the name to resolve to - -- in scope, we throw an error. - (Just options, _) -> do - (mnNew, mnOrig) <- checkImportConflicts pos mn toName options - modify $ \usedImports -> - M.insertWith (++) mnNew [fmap toName qname] usedImports - return $ Qualified (ByModuleName mnOrig) name - - -- If the name wasn't found in our imports but was qualified then we need - -- to check whether it's a failed import from a "pseudo" module (created - -- by qualified importing). If that's not the case, then we just need to - -- check it refers to a symbol in another module. - (Nothing, ByModuleName mn'') -> - if mn'' `S.member` importedQualModules imports || mn'' `S.member` importedModules imports - then throwUnknown - else throwError . errorMessage . UnknownName . Qualified ByNullSourcePos $ ModName mn'' - - -- If neither of the above cases are true then it's an undefined or - -- unimported symbol. - _ -> throwUnknown - - where - throwUnknown = throwError . errorMessage . UnknownName . fmap toName $ qname + <*> pure info + + updateTypeName :: + Qualified (ProperName 'TypeName) -> + SourceSpan -> + m (Qualified (ProperName 'TypeName)) + updateTypeName = update (importedTypes imports) TyName + + updateTypeOpName :: + Qualified (OpName 'TypeOpName) -> + SourceSpan -> + m (Qualified (OpName 'TypeOpName)) + updateTypeOpName = update (importedTypeOps imports) TyOpName + + updateDataConstructorName :: + Qualified (ProperName 'ConstructorName) -> + SourceSpan -> + m (Qualified (ProperName 'ConstructorName)) + updateDataConstructorName = update (importedDataConstructors imports) DctorName + + updateClassName :: + Qualified (ProperName 'ClassName) -> + SourceSpan -> + m (Qualified (ProperName 'ClassName)) + updateClassName = update (importedTypeClasses imports) TyClassName + + updateValueName :: Qualified Ident -> SourceSpan -> m (Qualified Ident) + updateValueName = update (importedValues imports) IdentName + + updateValueOpName :: + Qualified (OpName 'ValueOpName) -> + SourceSpan -> + m (Qualified (OpName 'ValueOpName)) + updateValueOpName = update (importedValueOps imports) ValOpName + + -- Update names so unqualified references become qualified, and locally + -- qualified references are replaced with their canonical qualified names + -- (e.g. M.Map -> Data.Map.Map). + update :: + (Ord a) => + M.Map (Qualified a) [ImportRecord a] -> + (a -> Name) -> + Qualified a -> + SourceSpan -> + m (Qualified a) + update imps toName qname@(Qualified mn' name) pos = warnAndRethrowWithPosition pos $ + case (M.lookup qname imps, mn') of + -- We found the name in our imports, so we return the name for it, + -- qualifying with the name of the module it was originally defined in + -- rather than the module we're importing from, to handle the case of + -- re-exports. If there are multiple options for the name to resolve to + -- in scope, we throw an error. + (Just options, _) -> do + (mnNew, mnOrig) <- checkImportConflicts pos mn toName options + modify $ \usedImports -> + M.insertWith (++) mnNew [fmap toName qname] usedImports + return $ Qualified (ByModuleName mnOrig) name + + -- If the name wasn't found in our imports but was qualified then we need + -- to check whether it's a failed import from a "pseudo" module (created + -- by qualified importing). If that's not the case, then we just need to + -- check it refers to a symbol in another module. + (Nothing, ByModuleName mn'') -> + if mn'' `S.member` importedQualModules imports || mn'' `S.member` importedModules imports + then throwUnknown + else throwError . errorMessage . UnknownName . Qualified ByNullSourcePos $ ModName mn'' + -- If neither of the above cases are true then it's an undefined or + -- unimported symbol. + _ -> throwUnknown + where + throwUnknown = throwError . errorMessage . UnknownName . fmap toName $ qname diff --git a/src/Language/PureScript/Sugar/Names/Common.hs b/src/Language/PureScript/Sugar/Names/Common.hs index 572d35eb2..8acf3a72e 100644 --- a/src/Language/PureScript/Sugar/Names/Common.hs +++ b/src/Language/PureScript/Sugar/Names/Common.hs @@ -1,27 +1,27 @@ module Language.PureScript.Sugar.Names.Common (warnDuplicateRefs) where -import Prelude import Protolude (ordNub) +import Prelude -import Control.Monad.Writer (MonadWriter(..)) +import Control.Monad.Writer (MonadWriter (..)) import Data.Foldable (for_) import Data.List (group, sort, (\\)) import Data.Maybe (mapMaybe) -import Language.PureScript.AST (DeclarationRef(..), SourceSpan) +import Language.PureScript.AST (DeclarationRef (..), SourceSpan) import Language.PureScript.Errors (MultipleErrors, SimpleErrorMessage, errorMessage, warnWithPosition) -import Language.PureScript.Names (Name(..)) +import Language.PureScript.Names (Name (..)) --- | --- Warns about duplicate values in a list of declaration refs. --- -warnDuplicateRefs - :: MonadWriter MultipleErrors m - => SourceSpan - -> (Name -> SimpleErrorMessage) - -> [DeclarationRef] - -> m () +{- | +Warns about duplicate values in a list of declaration refs. +-} +warnDuplicateRefs :: + (MonadWriter MultipleErrors m) => + SourceSpan -> + (Name -> SimpleErrorMessage) -> + [DeclarationRef] -> + m () warnDuplicateRefs pos toError refs = do let withoutCtors = deleteCtors `map` refs dupeRefs = mapMaybe (refToName pos) $ removeUnique withoutCtors @@ -29,40 +29,38 @@ warnDuplicateRefs pos toError refs = do for_ (dupeRefs ++ dupeCtors) $ \(pos', name) -> warnWithPosition pos' . tell . errorMessage $ toError name - where + -- Removes all unique elements from list + -- as well as one of each duplicate. + -- Example: + -- removeUnique [1,2,2,3,3,3,4] == [2,3,3] + -- Note that it may be more correct to keep ALL duplicates, + -- but that requires additional changes in how warnings are printed. + -- Example of keeping all duplicates (not what this code currently does): + -- removeUnique [1,2,2,3,3,3,4] == [2,2,3,3,3] + removeUnique :: (Ord a) => [a] -> [a] + removeUnique = concatMap (drop 1) . group . sort - -- Removes all unique elements from list - -- as well as one of each duplicate. - -- Example: - -- removeUnique [1,2,2,3,3,3,4] == [2,3,3] - -- Note that it may be more correct to keep ALL duplicates, - -- but that requires additional changes in how warnings are printed. - -- Example of keeping all duplicates (not what this code currently does): - -- removeUnique [1,2,2,3,3,3,4] == [2,2,3,3,3] - removeUnique :: Ord a => [a] -> [a] - removeUnique = concatMap (drop 1) . group . sort - - -- Deletes the constructor information from TypeRefs so that only the - -- referenced type is used in the duplicate check - constructors are handled - -- separately - deleteCtors :: DeclarationRef -> DeclarationRef - deleteCtors (TypeRef sa pn _) = TypeRef sa pn Nothing - deleteCtors other = other + -- Deletes the constructor information from TypeRefs so that only the + -- referenced type is used in the duplicate check - constructors are handled + -- separately + deleteCtors :: DeclarationRef -> DeclarationRef + deleteCtors (TypeRef sa pn _) = TypeRef sa pn Nothing + deleteCtors other = other - -- Extracts the names of duplicate constructor references from TypeRefs. - extractCtors :: SourceSpan -> DeclarationRef -> Maybe [(SourceSpan, Name)] - extractCtors pos' (TypeRef _ _ (Just dctors)) = - let dupes = dctors \\ ordNub dctors - in if null dupes then Nothing else Just $ (pos',) . DctorName <$> dupes - extractCtors _ _ = Nothing + -- Extracts the names of duplicate constructor references from TypeRefs. + extractCtors :: SourceSpan -> DeclarationRef -> Maybe [(SourceSpan, Name)] + extractCtors pos' (TypeRef _ _ (Just dctors)) = + let dupes = dctors \\ ordNub dctors + in if null dupes then Nothing else Just $ (pos',) . DctorName <$> dupes + extractCtors _ _ = Nothing - -- Converts a DeclarationRef into a name for an error message. - refToName :: SourceSpan -> DeclarationRef -> Maybe (SourceSpan, Name) - refToName pos' (TypeRef _ name _) = Just (pos', TyName name) - refToName pos' (TypeOpRef _ op) = Just (pos', TyOpName op) - refToName pos' (ValueRef _ name) = Just (pos', IdentName name) - refToName pos' (ValueOpRef _ op) = Just (pos', ValOpName op) - refToName pos' (TypeClassRef _ name) = Just (pos', TyClassName name) - refToName pos' (ModuleRef _ name) = Just (pos', ModName name) - refToName _ _ = Nothing + -- Converts a DeclarationRef into a name for an error message. + refToName :: SourceSpan -> DeclarationRef -> Maybe (SourceSpan, Name) + refToName pos' (TypeRef _ name _) = Just (pos', TyName name) + refToName pos' (TypeOpRef _ op) = Just (pos', TyOpName op) + refToName pos' (ValueRef _ name) = Just (pos', IdentName name) + refToName pos' (ValueOpRef _ op) = Just (pos', ValOpName op) + refToName pos' (TypeClassRef _ name) = Just (pos', TyClassName name) + refToName pos' (ModuleRef _ name) = Just (pos', ModName name) + refToName _ _ = Nothing diff --git a/src/Language/PureScript/Sugar/Names/Env.hs b/src/Language/PureScript/Sugar/Names/Env.hs index 2ab8b00d5..e508a399a 100644 --- a/src/Language/PureScript/Sugar/Names/Env.hs +++ b/src/Language/PureScript/Sugar/Names/Env.hs @@ -1,63 +1,66 @@ -module Language.PureScript.Sugar.Names.Env - ( ImportRecord(..) - , ImportProvenance(..) - , Imports(..) - , nullImports - , Exports(..) - , nullExports - , Env - , primEnv - , primExports - , envModuleExports - , ExportMode(..) - , exportType - , exportTypeOp - , exportTypeClass - , exportValue - , exportValueOp - , checkImportConflicts - ) where +module Language.PureScript.Sugar.Names.Env ( + ImportRecord (..), + ImportProvenance (..), + Imports (..), + nullImports, + Exports (..), + nullExports, + Env, + primEnv, + primExports, + envModuleExports, + ExportMode (..), + exportType, + exportTypeOp, + exportTypeClass, + exportValue, + exportValueOp, + checkImportConflicts, +) where import Prelude import Control.Monad (forM_, when) -import Control.Monad.Error.Class (MonadError(..)) -import Control.Monad.Writer.Class (MonadWriter(..)) +import Control.Monad.Error.Class (MonadError (..)) +import Control.Monad.Writer.Class (MonadWriter (..)) -import Data.Function (on) import Data.Foldable (find) -import Data.List (groupBy, sortOn, delete) -import Data.Maybe (mapMaybe) -import Safe (headMay) +import Data.Function (on) +import Data.List (delete, groupBy, sortOn) import Data.Map qualified as M +import Data.Maybe (mapMaybe) import Data.Set qualified as S +import Safe (headMay) +import Language.PureScript.AST (ExportSource (..), SourceSpan, internalModuleSourceSpan, nullSourceSpan) import Language.PureScript.Constants.Prim qualified as C -import Language.PureScript.AST (ExportSource(..), SourceSpan, internalModuleSourceSpan, nullSourceSpan) +import Language.PureScript.Constants.Purus qualified as PLC import Language.PureScript.Crash (internalError) import Language.PureScript.Environment -import Language.PureScript.Errors (MultipleErrors, SimpleErrorMessage(..), errorMessage, errorMessage') -import Language.PureScript.Names (Ident, ModuleName, Name(..), OpName, OpNameType(..), ProperName, ProperNameType(..), Qualified(..), QualifiedBy(..), coerceProperName, disqualify, getQual) - --- | --- The details for an import: the name of the thing that is being imported --- (`A.x` if importing from `A`), the module that the thing was originally --- defined in (for re-export resolution), and the import provenance (see below). --- -data ImportRecord a = - ImportRecord - { importName :: Qualified a - , importSourceModule :: ModuleName - , importSourceSpan :: SourceSpan - , importProvenance :: ImportProvenance - } - deriving (Eq, Ord, Show) +import Language.PureScript.Errors (MultipleErrors, SimpleErrorMessage (..), errorMessage, errorMessage') +import Language.PureScript.Names (Ident, ModuleName, Name (..), OpName, OpNameType (..), ProperName, ProperNameType (..), Qualified (..), QualifiedBy (..), coerceProperName, disqualify, getQual) +import Language.PureScript.Types (SourceType) + +import Language.Purus.Prim.Ledger + +{- | +The details for an import: the name of the thing that is being imported +(`A.x` if importing from `A`), the module that the thing was originally +defined in (for re-export resolution), and the import provenance (see below). +-} +data ImportRecord a = ImportRecord + { importName :: Qualified a + , importSourceModule :: ModuleName + , importSourceSpan :: SourceSpan + , importProvenance :: ImportProvenance + } + deriving (Eq, Ord, Show) --- | --- Used to track how an import was introduced into scope. This allows us to --- handle the one-open-import special case that allows a name conflict to become --- a warning rather than being an unresolvable situation. --- +{- | +Used to track how an import was introduced into scope. This allows us to +handle the one-open-import special case that allows a name conflict to become +a warning rather than being an unresolvable situation. +-} data ImportProvenance = FromImplicit | FromExplicit @@ -67,236 +70,262 @@ data ImportProvenance type ImportMap a = M.Map (Qualified a) [ImportRecord a] --- | --- The imported declarations for a module, including the module's own members. --- +{- | +The imported declarations for a module, including the module's own members. +-} data Imports = Imports - { - -- | + { importedTypes :: ImportMap (ProperName 'TypeName) + -- ^ -- Local names for types within a module mapped to their qualified names - -- - importedTypes :: ImportMap (ProperName 'TypeName) - -- | - -- Local names for type operators within a module mapped to their qualified names - -- , importedTypeOps :: ImportMap (OpName 'TypeOpName) - -- | - -- Local names for data constructors within a module mapped to their qualified names - -- + -- ^ + -- Local names for type operators within a module mapped to their qualified names , importedDataConstructors :: ImportMap (ProperName 'ConstructorName) - -- | - -- Local names for classes within a module mapped to their qualified names - -- + -- ^ + -- Local names for data constructors within a module mapped to their qualified names , importedTypeClasses :: ImportMap (ProperName 'ClassName) - -- | - -- Local names for values within a module mapped to their qualified names - -- + -- ^ + -- Local names for classes within a module mapped to their qualified names , importedValues :: ImportMap Ident - -- | - -- Local names for value operators within a module mapped to their qualified names - -- + -- ^ + -- Local names for values within a module mapped to their qualified names , importedValueOps :: ImportMap (OpName 'ValueOpName) - -- | + -- ^ + -- Local names for value operators within a module mapped to their qualified names + , importedModules :: S.Set ModuleName + -- ^ -- The name of modules that have been imported into the current scope that -- can be re-exported. If a module is imported with `as` qualification, the -- `as` name appears here, otherwise the original name. - -- - , importedModules :: S.Set ModuleName - -- | - -- The "as" names of modules that have been imported qualified. - -- , importedQualModules :: S.Set ModuleName - -- | - -- Local names for kinds within a module mapped to their qualified names - -- + -- ^ + -- The "as" names of modules that have been imported qualified. , importedKinds :: ImportMap (ProperName 'TypeName) - } deriving (Show) + -- ^ + -- Local names for kinds within a module mapped to their qualified names + } + deriving (Show) nullImports :: Imports nullImports = Imports M.empty M.empty M.empty M.empty M.empty M.empty S.empty S.empty M.empty --- | --- The exported declarations from a module. --- +{- | +The exported declarations from a module. +-} data Exports = Exports - { - -- | + { exportedTypes :: M.Map (ProperName 'TypeName) ([ProperName 'ConstructorName], ExportSource) + -- ^ -- The exported types along with the module they originally came from. - -- - exportedTypes :: M.Map (ProperName 'TypeName) ([ProperName 'ConstructorName], ExportSource) - -- | + , exportedTypeOps :: M.Map (OpName 'TypeOpName) ExportSource + -- ^ -- The exported type operators along with the module they originally came -- from. - -- - , exportedTypeOps :: M.Map (OpName 'TypeOpName) ExportSource - -- | - -- The exported classes along with the module they originally came from. - -- , exportedTypeClasses :: M.Map (ProperName 'ClassName) ExportSource - -- | - -- The exported values along with the module they originally came from. - -- + -- ^ + -- The exported classes along with the module they originally came from. , exportedValues :: M.Map Ident ExportSource - -- | + -- ^ + -- The exported values along with the module they originally came from. + , exportedValueOps :: M.Map (OpName 'ValueOpName) ExportSource + -- ^ -- The exported value operators along with the module they originally came -- from. - -- - , exportedValueOps :: M.Map (OpName 'ValueOpName) ExportSource - } deriving (Show) + } + deriving (Show) --- | --- An empty 'Exports' value. --- +{- | +An empty 'Exports' value. +-} nullExports :: Exports nullExports = Exports M.empty M.empty M.empty M.empty M.empty --- | --- The imports and exports for a collection of modules. The 'SourceSpan' is used --- to store the source location of the module with a given name, used to provide --- useful information when there is a duplicate module definition. --- +{- | +The imports and exports for a collection of modules. The 'SourceSpan' is used +to store the source location of the module with a given name, used to provide +useful information when there is a duplicate module definition. +-} type Env = M.Map ModuleName (SourceSpan, Imports, Exports) --- | --- Extracts the 'Exports' from an 'Env' value. --- +{- | +The exported types and primitive values from the Builtin module +-} +builtinExports :: Exports +builtinExports = mkBuiltinExports builtinTypes builtinFunctions + +{- | +Extracts the 'Exports' from an 'Env' value. +-} envModuleExports :: (a, b, Exports) -> Exports envModuleExports (_, _, exps) = exps --- | --- The exported types from the @Prim@ module --- +{- | +The exported types from the @Prim@ module +-} primExports :: Exports -primExports = mkPrimExports primTypes primClasses +primExports = mkPrimExports (primTypes <> M.fromList ledgerTypes) primClasses --- | --- The exported types from the @Prim.Boolean@ module --- +{- | +The exported types from the @Prim.Boolean@ module +-} primBooleanExports :: Exports primBooleanExports = mkPrimExports primBooleanTypes mempty --- | --- The exported types from the @Prim.Coerce@ module --- +{- | +The exported types from the @Prim.Coerce@ module +-} primCoerceExports :: Exports primCoerceExports = mkPrimExports primCoerceTypes primCoerceClasses --- | --- The exported types from the @Prim.Ordering@ module --- +{- | +The exported types from the @Prim.Ordering@ module +-} primOrderingExports :: Exports primOrderingExports = mkPrimExports primOrderingTypes mempty --- | --- The exported types from the @Prim.Row@ module --- +{- | +The exported types from the @Prim.Row@ module +-} primRowExports :: Exports primRowExports = mkPrimExports primRowTypes primRowClasses --- | --- The exported types from the @Prim.RowList@ module --- +{- | +The exported types from the @Prim.RowList@ module +-} primRowListExports :: Exports primRowListExports = mkPrimExports primRowListTypes primRowListClasses --- | --- The exported types from the @Prim.Symbol@ module --- +{- | +The exported types from the @Prim.Symbol@ module +-} primSymbolExports :: Exports primSymbolExports = mkPrimExports primSymbolTypes primSymbolClasses --- | --- The exported types from the @Prim.Int@ module +{- | +The exported types from the @Prim.Int@ module +-} primIntExports :: Exports primIntExports = mkPrimExports primIntTypes primIntClasses --- | --- The exported types from the @Prim.TypeError@ module --- +{- | +The exported types from the @Prim.TypeError@ module +-} primTypeErrorExports :: Exports primTypeErrorExports = mkPrimExports primTypeErrorTypes primTypeErrorClasses --- | --- Create a set of exports for a Prim module. --- -mkPrimExports - :: M.Map (Qualified (ProperName 'TypeName)) a - -> M.Map (Qualified (ProperName 'ClassName)) b - -> Exports +{- | +Create a set of exports for a Purus Builtins module +-} +mkBuiltinExports :: + M.Map (Qualified (ProperName 'TypeName)) (SourceType, TypeKind) -> + M.Map (Qualified Ident) b -> + Exports +mkBuiltinExports ts vs = + nullExports + { exportedTypes = M.fromList $ uncurry mkTypeEntry <$> M.toList ts + , exportedValues = M.fromList $ mkValueEntry <$> M.keys vs + } + +{- | +Create a set of exports for a Prim module. +-} +mkPrimExports :: + M.Map (Qualified (ProperName 'TypeName)) (SourceType, TypeKind) -> + M.Map (Qualified (ProperName 'ClassName)) b -> + Exports mkPrimExports ts cs = nullExports - { exportedTypes = M.fromList $ mkTypeEntry `map` M.keys ts + { exportedTypes = M.fromList $ uncurry mkTypeEntry `map` M.toList ts , exportedTypeClasses = M.fromList $ mkClassEntry `map` M.keys cs + , exportedValues = M.fromList $ mkValueEntry <$> M.keys primFunctions } - where - mkTypeEntry (Qualified (ByModuleName mn) name) = (name, ([], primExportSource mn)) - mkTypeEntry _ = internalError + +mkTypeEntry (Qualified (ByModuleName mn) name) (_, DataType _ _ (map fst -> ctors)) = (name, (ctors, primExportSource mn)) +mkTypeEntry (Qualified (ByModuleName mn) name) _ = (name, ([], primExportSource mn)) +mkTypeEntry _ _ = + internalError "mkPrimExports.mkTypeEntry: a name is qualified BySourcePos instead of ByModuleName" - mkClassEntry (Qualified (ByModuleName mn) name) = (name, primExportSource mn) - mkClassEntry _ = internalError +mkClassEntry (Qualified (ByModuleName mn) name) = (name, primExportSource mn) +mkClassEntry _ = + internalError "mkPrimExports.mkClassEntry: a name is qualified BySourcePos instead of ByModuleName" - primExportSource mn = - ExportSource - { exportSourceImportedFrom = Nothing - , exportSourceDefinedIn = mn - } +mkValueEntry (Qualified (ByModuleName mn) name) = (name, primExportSource mn) + +primExportSource mn = + ExportSource + { exportSourceImportedFrom = Nothing + , exportSourceDefinedIn = mn + } -- | Environment which only contains the Prim modules. primEnv :: Env -primEnv = M.fromList - [ ( C.M_Prim - , (internalModuleSourceSpan "", nullImports, primExports) - ) - , ( C.M_Prim_Boolean - , (internalModuleSourceSpan "", nullImports, primBooleanExports) - ) - , ( C.M_Prim_Coerce - , (internalModuleSourceSpan "", nullImports, primCoerceExports) - ) - , ( C.M_Prim_Ordering - , (internalModuleSourceSpan "", nullImports, primOrderingExports) - ) - , ( C.M_Prim_Row - , (internalModuleSourceSpan "", nullImports, primRowExports) - ) - , ( C.M_Prim_RowList - , (internalModuleSourceSpan "", nullImports, primRowListExports) - ) - , ( C.M_Prim_Symbol - , (internalModuleSourceSpan "", nullImports, primSymbolExports) - ) - , ( C.M_Prim_Int - , (internalModuleSourceSpan "", nullImports, primIntExports) - ) - , ( C.M_Prim_TypeError - , (internalModuleSourceSpan "", nullImports, primTypeErrorExports) - ) - ] - --- | --- When updating the `Exports` the behaviour is slightly different depending --- on whether we are exporting values defined within the module or elaborating --- re-exported values. This type is used to indicate which behaviour should be --- used. --- +primEnv = + M.fromList + [ + ( PLC.M_Builtin + , (internalModuleSourceSpan "", nullImports, builtinExports) + ) + , + ( C.M_Prim + , (internalModuleSourceSpan "", nullImports, primExports) + ) + , + ( C.M_Prim_Boolean + , (internalModuleSourceSpan "", nullImports, primBooleanExports) + ) + , + ( C.M_Prim_Coerce + , (internalModuleSourceSpan "", nullImports, primCoerceExports) + ) + , + ( C.M_Prim_Ordering + , (internalModuleSourceSpan "", nullImports, primOrderingExports) + ) + , + ( C.M_Prim_Row + , (internalModuleSourceSpan "", nullImports, primRowExports) + ) + , + ( C.M_Prim_RowList + , (internalModuleSourceSpan "", nullImports, primRowListExports) + ) + , + ( C.M_Prim_Symbol + , (internalModuleSourceSpan "", nullImports, primSymbolExports) + ) + , + ( C.M_Prim_Int + , (internalModuleSourceSpan "", nullImports, primIntExports) + ) + , + ( C.M_Prim_TypeError + , (internalModuleSourceSpan "", nullImports, primTypeErrorExports) + ) + ] + +{- | +When updating the `Exports` the behaviour is slightly different depending +on whether we are exporting values defined within the module or elaborating +re-exported values. This type is used to indicate which behaviour should be +used. +-} data ExportMode = Internal | ReExport deriving (Eq, Show) --- | --- Safely adds a type and its data constructors to some exports, returning an --- error if a conflict occurs. --- -exportType - :: MonadError MultipleErrors m - => SourceSpan - -> ExportMode - -> Exports - -> ProperName 'TypeName - -> [ProperName 'ConstructorName] - -> ExportSource - -> m Exports +{- | +Safely adds a type and its data constructors to some exports, returning an +error if a conflict occurs. +-} +exportType :: + (MonadError MultipleErrors m) => + SourceSpan -> + ExportMode -> + Exports -> + ProperName 'TypeName -> + [ProperName 'ConstructorName] -> + ExportSource -> + m Exports exportType ss exportMode exps name dctors src = do let exTypes = exportedTypes exps exClasses = exportedTypeClasses exps @@ -319,48 +348,48 @@ exportType ss exportMode exps name dctors src = do ReExport -> do let mn = exportSourceDefinedIn src forM_ (coerceProperName name `M.lookup` exClasses) $ \src' -> - let mn' = exportSourceDefinedIn src' in - throwExportConflict' ss mn mn' (TyName name) (TyClassName (coerceProperName name)) + let mn' = exportSourceDefinedIn src' + in throwExportConflict' ss mn mn' (TyName name) (TyClassName (coerceProperName name)) forM_ (name `M.lookup` exTypes) $ \(_, src') -> - let mn' = exportSourceDefinedIn src' in - when (mn /= mn') $ - throwExportConflict ss mn mn' (TyName name) + let mn' = exportSourceDefinedIn src' + in when (mn /= mn') $ + throwExportConflict ss mn mn' (TyName name) forM_ dctors $ \dctor -> forM_ ((elem dctor . fst) `find` exTypes) $ \(_, src') -> - let mn' = exportSourceDefinedIn src' in - when (mn /= mn') $ - throwExportConflict ss mn mn' (DctorName dctor) - return $ exps { exportedTypes = M.alter updateOrInsert name exTypes } + let mn' = exportSourceDefinedIn src' + in when (mn /= mn') $ + throwExportConflict ss mn mn' (DctorName dctor) + return $ exps {exportedTypes = M.alter updateOrInsert name exTypes} where - updateOrInsert Nothing = Just (dctors, src) - updateOrInsert (Just (dctors', _)) = Just (dctors ++ dctors', src) - --- | --- Safely adds a type operator to some exports, returning an error if a --- conflict occurs. --- -exportTypeOp - :: MonadError MultipleErrors m - => SourceSpan - -> Exports - -> OpName 'TypeOpName - -> ExportSource - -> m Exports + updateOrInsert Nothing = Just (dctors, src) + updateOrInsert (Just (dctors', _)) = Just (dctors ++ dctors', src) + +{- | +Safely adds a type operator to some exports, returning an error if a +conflict occurs. +-} +exportTypeOp :: + (MonadError MultipleErrors m) => + SourceSpan -> + Exports -> + OpName 'TypeOpName -> + ExportSource -> + m Exports exportTypeOp ss exps op src = do typeOps <- addExport ss TyOpName op src (exportedTypeOps exps) - return $ exps { exportedTypeOps = typeOps } - --- | --- Safely adds a class to some exports, returning an error if a conflict occurs. --- -exportTypeClass - :: MonadError MultipleErrors m - => SourceSpan - -> ExportMode - -> Exports - -> ProperName 'ClassName - -> ExportSource - -> m Exports + return $ exps {exportedTypeOps = typeOps} + +{- | +Safely adds a class to some exports, returning an error if a conflict occurs. +-} +exportTypeClass :: + (MonadError MultipleErrors m) => + SourceSpan -> + ExportMode -> + Exports -> + ProperName 'ClassName -> + ExportSource -> + m Exports exportTypeClass ss exportMode exps name src = do let exTypes = exportedTypes exps when (exportMode == Internal) $ do @@ -369,114 +398,114 @@ exportTypeClass ss exportMode exps name src = do when ((elem (coerceProperName name) . fst) `any` exTypes) $ throwDeclConflict (TyClassName name) (DctorName (coerceProperName name)) classes <- addExport ss TyClassName name src (exportedTypeClasses exps) - return $ exps { exportedTypeClasses = classes } - --- | --- Safely adds a value to some exports, returning an error if a conflict occurs. --- -exportValue - :: MonadError MultipleErrors m - => SourceSpan - -> Exports - -> Ident - -> ExportSource - -> m Exports + return $ exps {exportedTypeClasses = classes} + +{- | +Safely adds a value to some exports, returning an error if a conflict occurs. +-} +exportValue :: + (MonadError MultipleErrors m) => + SourceSpan -> + Exports -> + Ident -> + ExportSource -> + m Exports exportValue ss exps name src = do values <- addExport ss IdentName name src (exportedValues exps) - return $ exps { exportedValues = values } - --- | --- Safely adds a value operator to some exports, returning an error if a --- conflict occurs. --- -exportValueOp - :: MonadError MultipleErrors m - => SourceSpan - -> Exports - -> OpName 'ValueOpName - -> ExportSource - -> m Exports + return $ exps {exportedValues = values} + +{- | +Safely adds a value operator to some exports, returning an error if a +conflict occurs. +-} +exportValueOp :: + (MonadError MultipleErrors m) => + SourceSpan -> + Exports -> + OpName 'ValueOpName -> + ExportSource -> + m Exports exportValueOp ss exps op src = do valueOps <- addExport ss ValOpName op src (exportedValueOps exps) - return $ exps { exportedValueOps = valueOps } - --- | --- Adds an entry to a list of exports unless it is already present, in which --- case an error is returned. --- -addExport - :: (MonadError MultipleErrors m, Ord a) - => SourceSpan - -> (a -> Name) - -> a - -> ExportSource - -> M.Map a ExportSource - -> m (M.Map a ExportSource) + return $ exps {exportedValueOps = valueOps} + +{- | +Adds an entry to a list of exports unless it is already present, in which +case an error is returned. +-} +addExport :: + (MonadError MultipleErrors m, Ord a) => + SourceSpan -> + (a -> Name) -> + a -> + ExportSource -> + M.Map a ExportSource -> + m (M.Map a ExportSource) addExport ss toName name src exports = case M.lookup name exports of Just src' -> let mn = exportSourceDefinedIn src mn' = exportSourceDefinedIn src' - in + in if mn == mn' then return exports else throwExportConflict ss mn mn' (toName name) Nothing -> return $ M.insert name src exports --- | --- Raises an error for when there is more than one definition for something. --- -throwDeclConflict - :: MonadError MultipleErrors m - => Name - -> Name - -> m a +{- | +Raises an error for when there is more than one definition for something. +-} +throwDeclConflict :: + (MonadError MultipleErrors m) => + Name -> + Name -> + m a throwDeclConflict new existing = throwError . errorMessage $ DeclConflict new existing --- | --- Raises an error for when there are conflicting names in the exports. --- -throwExportConflict - :: MonadError MultipleErrors m - => SourceSpan - -> ModuleName - -> ModuleName - -> Name - -> m a +{- | +Raises an error for when there are conflicting names in the exports. +-} +throwExportConflict :: + (MonadError MultipleErrors m) => + SourceSpan -> + ModuleName -> + ModuleName -> + Name -> + m a throwExportConflict ss new existing name = throwExportConflict' ss new existing name name --- | --- Raises an error for when there are conflicting names in the exports. Allows --- different categories of names. E.g. class and type names conflicting. --- -throwExportConflict' - :: MonadError MultipleErrors m - => SourceSpan - -> ModuleName - -> ModuleName - -> Name - -> Name - -> m a +{- | +Raises an error for when there are conflicting names in the exports. Allows +different categories of names. E.g. class and type names conflicting. +-} +throwExportConflict' :: + (MonadError MultipleErrors m) => + SourceSpan -> + ModuleName -> + ModuleName -> + Name -> + Name -> + m a throwExportConflict' ss new existing newName existingName = throwError . errorMessage' ss $ ExportConflict (Qualified (ByModuleName new) newName) (Qualified (ByModuleName existing) existingName) --- | --- When reading a value from the imports, check that there are no conflicts in --- scope. --- -checkImportConflicts - :: forall m a - . (MonadError MultipleErrors m, MonadWriter MultipleErrors m) - => SourceSpan - -> ModuleName - -> (a -> Name) - -> [ImportRecord a] - -> m (ModuleName, ModuleName) +{- | +When reading a value from the imports, check that there are no conflicts in +scope. +-} +checkImportConflicts :: + forall m a. + (MonadError MultipleErrors m, MonadWriter MultipleErrors m) => + SourceSpan -> + ModuleName -> + (a -> Name) -> + [ImportRecord a] -> + m (ModuleName, ModuleName) checkImportConflicts ss currentModule toName xs = let byOrig = sortOn importSourceModule xs @@ -484,17 +513,16 @@ checkImportConflicts ss currentModule toName xs = nonImplicit = filter ((/= FromImplicit) . importProvenance) xs name = toName . disqualify . importName $ head xs conflictModules = mapMaybe (getQual . importName . head) groups - in + in if length groups > 1 - then case nonImplicit of - [ImportRecord (Qualified (ByModuleName mnNew) _) mnOrig _ _] -> do - let warningModule = if mnNew == currentModule then Nothing else Just mnNew - ss' = maybe nullSourceSpan importSourceSpan . headMay . filter ((== FromImplicit) . importProvenance) $ xs - tell . errorMessage' ss' $ ScopeShadowing name warningModule $ delete mnNew conflictModules - return (mnNew, mnOrig) - _ -> throwError . errorMessage' ss $ ScopeConflict name conflictModules - else - case head byOrig of + then case nonImplicit of + [ImportRecord (Qualified (ByModuleName mnNew) _) mnOrig _ _] -> do + let warningModule = if mnNew == currentModule then Nothing else Just mnNew + ss' = maybe nullSourceSpan importSourceSpan . headMay . filter ((== FromImplicit) . importProvenance) $ xs + tell . errorMessage' ss' $ ScopeShadowing name warningModule $ delete mnNew conflictModules + return (mnNew, mnOrig) + _ -> throwError . errorMessage' ss $ ScopeConflict name conflictModules + else case head byOrig of ImportRecord (Qualified (ByModuleName mnNew) _) mnOrig _ _ -> return (mnNew, mnOrig) _ -> diff --git a/src/Language/PureScript/Sugar/Names/Exports.hs b/src/Language/PureScript/Sugar/Names/Exports.hs index cbe273f82..4109df295 100644 --- a/src/Language/PureScript/Sugar/Names/Exports.hs +++ b/src/Language/PureScript/Sugar/Names/Exports.hs @@ -1,304 +1,309 @@ -module Language.PureScript.Sugar.Names.Exports - ( findExportable - , resolveExports - ) where +module Language.PureScript.Sugar.Names.Exports ( + findExportable, + resolveExports, +) where import Prelude import Control.Monad (filterM, foldM, liftM2, unless, void, when) -import Control.Monad.Writer.Class (MonadWriter(..)) -import Control.Monad.Error.Class (MonadError(..)) +import Control.Monad.Error.Class (MonadError (..)) +import Control.Monad.Writer.Class (MonadWriter (..)) -import Data.Function (on) import Data.Foldable (traverse_) -import Data.List (intersect, groupBy, sortOn) -import Data.Maybe (fromMaybe, mapMaybe) +import Data.Function (on) +import Data.List (groupBy, intersect, sortOn) import Data.Map qualified as M +import Data.Maybe (fromMaybe, mapMaybe) import Language.PureScript.AST import Language.PureScript.Crash (internalError) -import Language.PureScript.Errors (MultipleErrors, SimpleErrorMessage(..), addHint, errorMessage', rethrow, rethrowWithPosition, warnAndRethrow) -import Language.PureScript.Names (Ident, ModuleName, Name(..), OpName, OpNameType(..), ProperName, ProperNameType(..), Qualified(..), QualifiedBy(..), disqualifyFor, isQualifiedWith, isUnqualified) -import Language.PureScript.Sugar.Names.Env (Env, ExportMode(..), Exports(..), ImportRecord(..), Imports(..), checkImportConflicts, envModuleExports, exportType, exportTypeClass, exportTypeOp, exportValue, exportValueOp, nullExports) +import Language.PureScript.Errors (MultipleErrors, SimpleErrorMessage (..), addHint, errorMessage', rethrow, rethrowWithPosition, warnAndRethrow) +import Language.PureScript.Names (Ident, ModuleName, Name (..), OpName, OpNameType (..), ProperName, ProperNameType (..), Qualified (..), QualifiedBy (..), disqualifyFor, isQualifiedWith, isUnqualified) import Language.PureScript.Sugar.Names.Common (warnDuplicateRefs) +import Language.PureScript.Sugar.Names.Env (Env, ExportMode (..), Exports (..), ImportRecord (..), Imports (..), checkImportConflicts, envModuleExports, exportType, exportTypeClass, exportTypeOp, exportValue, exportValueOp, nullExports) --- | --- Finds all exportable members of a module, disregarding any explicit exports. --- +{- | +Finds all exportable members of a module, disregarding any explicit exports. +-} findExportable :: forall m. (MonadError MultipleErrors m) => Module -> m Exports findExportable (Module _ _ mn ds _) = rethrow (addHint (ErrorInModule mn)) $ foldM updateExports' nullExports ds where - updateExports' :: Exports -> Declaration -> m Exports - updateExports' exps decl = rethrowWithPosition (declSourceSpan decl) $ updateExports exps decl + updateExports' :: Exports -> Declaration -> m Exports + updateExports' exps decl = rethrowWithPosition (declSourceSpan decl) $ updateExports exps decl - source = - ExportSource - { exportSourceDefinedIn = mn - , exportSourceImportedFrom = Nothing - } + source = + ExportSource + { exportSourceDefinedIn = mn + , exportSourceImportedFrom = Nothing + } - updateExports :: Exports -> Declaration -> m Exports - updateExports exps (TypeClassDeclaration (ss, _) tcn _ _ _ ds') = do - exps' <- rethrowWithPosition ss $ exportTypeClass ss Internal exps tcn source - foldM go exps' ds' - where - go exps'' (TypeDeclaration (TypeDeclarationData (ss', _) name _)) = exportValue ss' exps'' name source - go _ _ = internalError "Invalid declaration in TypeClassDeclaration" - updateExports exps (DataDeclaration (ss, _) _ tn _ dcs) = - exportType ss Internal exps tn (map dataCtorName dcs) source - updateExports exps (TypeSynonymDeclaration (ss, _) tn _ _) = - exportType ss Internal exps tn [] source - updateExports exps (ExternDataDeclaration (ss, _) tn _) = - exportType ss Internal exps tn [] source - updateExports exps (ValueDeclaration vd) = - exportValue (fst (valdeclSourceAnn vd)) exps (valdeclIdent vd) source - updateExports exps (ValueFixityDeclaration (ss, _) _ _ op) = - exportValueOp ss exps op source - updateExports exps (TypeFixityDeclaration (ss, _) _ _ op) = - exportTypeOp ss exps op source - updateExports exps (ExternDeclaration (ss, _) name _) = - exportValue ss exps name source - updateExports exps _ = return exps + updateExports :: Exports -> Declaration -> m Exports + updateExports exps (TypeClassDeclaration (ss, _) tcn _ _ _ ds') = do + exps' <- rethrowWithPosition ss $ exportTypeClass ss Internal exps tcn source + foldM go exps' ds' + where + go exps'' (TypeDeclaration (TypeDeclarationData (ss', _) name _)) = exportValue ss' exps'' name source + go _ _ = internalError "Invalid declaration in TypeClassDeclaration" + updateExports exps (DataDeclaration (ss, _) _ tn _ dcs) = + exportType ss Internal exps tn (map dataCtorName dcs) source + updateExports exps (TypeSynonymDeclaration (ss, _) tn _ _) = + exportType ss Internal exps tn [] source + updateExports exps (ExternDataDeclaration (ss, _) tn _) = + exportType ss Internal exps tn [] source + updateExports exps (ValueDeclaration vd) = + exportValue (fst (valdeclSourceAnn vd)) exps (valdeclIdent vd) source + updateExports exps (ValueFixityDeclaration (ss, _) _ _ op) = + exportValueOp ss exps op source + updateExports exps (TypeFixityDeclaration (ss, _) _ _ op) = + exportTypeOp ss exps op source + updateExports exps (ExternDeclaration (ss, _) name _) = + exportValue ss exps name source + updateExports exps _ = return exps --- | --- Resolves the exports for a module, filtering out members that have not been --- exported and elaborating re-exports of other modules. --- -resolveExports - :: forall m - . (MonadError MultipleErrors m, MonadWriter MultipleErrors m) - => Env - -> SourceSpan - -> ModuleName - -> Imports - -> Exports - -> [DeclarationRef] - -> m Exports +{- | +Resolves the exports for a module, filtering out members that have not been +exported and elaborating re-exports of other modules. +-} +resolveExports :: + forall m. + (MonadError MultipleErrors m, MonadWriter MultipleErrors m) => + Env -> + SourceSpan -> + ModuleName -> + Imports -> + Exports -> + [DeclarationRef] -> + m Exports resolveExports env ss mn imps exps refs = warnAndRethrow (addHint (ErrorInModule mn)) $ do filtered <- filterModule mn exps refs exps' <- foldM elaborateModuleExports filtered refs warnDuplicateRefs ss DuplicateExportRef refs return exps' - where + -- Takes the current module's imports, the accumulated list of exports, and a + -- `DeclarationRef` for an explicit export. When the ref refers to another + -- module, export anything from the imports that matches for that module. + elaborateModuleExports :: Exports -> DeclarationRef -> m Exports + elaborateModuleExports result (ModuleRef _ name) | name == mn = do + let types' = exportedTypes result `M.union` exportedTypes exps + let typeOps' = exportedTypeOps result `M.union` exportedTypeOps exps + let classes' = exportedTypeClasses result `M.union` exportedTypeClasses exps + let values' = exportedValues result `M.union` exportedValues exps + let valueOps' = exportedValueOps result `M.union` exportedValueOps exps + return + result + { exportedTypes = types' + , exportedTypeOps = typeOps' + , exportedTypeClasses = classes' + , exportedValues = values' + , exportedValueOps = valueOps' + } + elaborateModuleExports result (ModuleRef ss' name) = do + let isPseudo = isPseudoModule name + when (not isPseudo && not (isImportedModule name)) + . throwError + . errorMessage' ss' + . UnknownExport + $ ModName name + reTypes <- extract ss' isPseudo name TyName (importedTypes imps) + reTypeOps <- extract ss' isPseudo name TyOpName (importedTypeOps imps) + reDctors <- extract ss' isPseudo name DctorName (importedDataConstructors imps) + reClasses <- extract ss' isPseudo name TyClassName (importedTypeClasses imps) + reValues <- extract ss' isPseudo name IdentName (importedValues imps) + reValueOps <- extract ss' isPseudo name ValOpName (importedValueOps imps) + foldM (\exps' ((tctor, dctors), src) -> exportType ss' ReExport exps' tctor dctors src) result (resolveTypeExports reTypes reDctors) + >>= flip (foldM (uncurry . exportTypeOp ss')) (map resolveTypeOp reTypeOps) + >>= flip (foldM (uncurry . exportTypeClass ss' ReExport)) (map resolveClass reClasses) + >>= flip (foldM (uncurry . exportValue ss')) (map resolveValue reValues) + >>= flip (foldM (uncurry . exportValueOp ss')) (map resolveValueOp reValueOps) + elaborateModuleExports result _ = return result - -- Takes the current module's imports, the accumulated list of exports, and a - -- `DeclarationRef` for an explicit export. When the ref refers to another - -- module, export anything from the imports that matches for that module. - elaborateModuleExports :: Exports -> DeclarationRef -> m Exports - elaborateModuleExports result (ModuleRef _ name) | name == mn = do - let types' = exportedTypes result `M.union` exportedTypes exps - let typeOps' = exportedTypeOps result `M.union` exportedTypeOps exps - let classes' = exportedTypeClasses result `M.union` exportedTypeClasses exps - let values' = exportedValues result `M.union` exportedValues exps - let valueOps' = exportedValueOps result `M.union` exportedValueOps exps - return result - { exportedTypes = types' - , exportedTypeOps = typeOps' - , exportedTypeClasses = classes' - , exportedValues = values' - , exportedValueOps = valueOps' - } - elaborateModuleExports result (ModuleRef ss' name) = do - let isPseudo = isPseudoModule name - when (not isPseudo && not (isImportedModule name)) - . throwError . errorMessage' ss' . UnknownExport $ ModName name - reTypes <- extract ss' isPseudo name TyName (importedTypes imps) - reTypeOps <- extract ss' isPseudo name TyOpName (importedTypeOps imps) - reDctors <- extract ss' isPseudo name DctorName (importedDataConstructors imps) - reClasses <- extract ss' isPseudo name TyClassName (importedTypeClasses imps) - reValues <- extract ss' isPseudo name IdentName (importedValues imps) - reValueOps <- extract ss' isPseudo name ValOpName (importedValueOps imps) - foldM (\exps' ((tctor, dctors), src) -> exportType ss' ReExport exps' tctor dctors src) result (resolveTypeExports reTypes reDctors) - >>= flip (foldM (uncurry . exportTypeOp ss')) (map resolveTypeOp reTypeOps) - >>= flip (foldM (uncurry . exportTypeClass ss' ReExport)) (map resolveClass reClasses) - >>= flip (foldM (uncurry . exportValue ss')) (map resolveValue reValues) - >>= flip (foldM (uncurry . exportValueOp ss')) (map resolveValueOp reValueOps) - elaborateModuleExports result _ = return result - - -- Extracts a list of values for a module based on a lookup table. If the - -- boolean is true the values are filtered by the qualification - extract - :: SourceSpan - -> Bool - -> ModuleName - -> (a -> Name) - -> M.Map (Qualified a) [ImportRecord a] - -> m [Qualified a] - extract ss' useQual name toName = fmap (map (importName . head . snd)) . go . M.toList - where - go = filterM $ \(name', options) -> do - let isMatch = if useQual then isQualifiedWith name name' else any (checkUnqual name') options - when (isMatch && length options > 1) $ void $ checkImportConflicts ss' mn toName options - return isMatch - checkUnqual name' ir = isUnqualified name' && isQualifiedWith name (importName ir) + -- Extracts a list of values for a module based on a lookup table. If the + -- boolean is true the values are filtered by the qualification + extract :: + SourceSpan -> + Bool -> + ModuleName -> + (a -> Name) -> + M.Map (Qualified a) [ImportRecord a] -> + m [Qualified a] + extract ss' useQual name toName = fmap (map (importName . head . snd)) . go . M.toList + where + go = filterM $ \(name', options) -> do + let isMatch = if useQual then isQualifiedWith name name' else any (checkUnqual name') options + when (isMatch && length options > 1) $ void $ checkImportConflicts ss' mn toName options + return isMatch + checkUnqual name' ir = isUnqualified name' && isQualifiedWith name (importName ir) - -- Check whether a module name refers to a "pseudo module" that came into - -- existence in an import scope due to importing one or more modules as - -- qualified. - isPseudoModule :: ModuleName -> Bool - isPseudoModule = testQuals M.keys - where - -- Test for the presence of a `ModuleName` in a set of imports, using a - -- function to either extract the keys or values. We test the keys to see if a - -- value being re-exported belongs to a qualified module, and we test the - -- values if that fails to see whether the value has been imported at all. - testQuals :: (forall a b. M.Map (Qualified a) b -> [Qualified a]) -> ModuleName -> Bool - testQuals f mn' = any (isQualifiedWith mn') (f (importedTypes imps)) - || any (isQualifiedWith mn') (f (importedTypeOps imps)) - || any (isQualifiedWith mn') (f (importedDataConstructors imps)) - || any (isQualifiedWith mn') (f (importedTypeClasses imps)) - || any (isQualifiedWith mn') (f (importedValues imps)) - || any (isQualifiedWith mn') (f (importedValueOps imps)) - || any (isQualifiedWith mn') (f (importedKinds imps)) + -- Check whether a module name refers to a "pseudo module" that came into + -- existence in an import scope due to importing one or more modules as + -- qualified. + isPseudoModule :: ModuleName -> Bool + isPseudoModule = testQuals M.keys + where + -- Test for the presence of a `ModuleName` in a set of imports, using a + -- function to either extract the keys or values. We test the keys to see if a + -- value being re-exported belongs to a qualified module, and we test the + -- values if that fails to see whether the value has been imported at all. + testQuals :: (forall a b. M.Map (Qualified a) b -> [Qualified a]) -> ModuleName -> Bool + testQuals f mn' = + any (isQualifiedWith mn') (f (importedTypes imps)) + || any (isQualifiedWith mn') (f (importedTypeOps imps)) + || any (isQualifiedWith mn') (f (importedDataConstructors imps)) + || any (isQualifiedWith mn') (f (importedTypeClasses imps)) + || any (isQualifiedWith mn') (f (importedValues imps)) + || any (isQualifiedWith mn') (f (importedValueOps imps)) + || any (isQualifiedWith mn') (f (importedKinds imps)) - -- Check whether a module name refers to a module that has been imported - -- without qualification into an import scope. - isImportedModule :: ModuleName -> Bool - isImportedModule = flip elem (importedModules imps) + -- Check whether a module name refers to a module that has been imported + -- without qualification into an import scope. + isImportedModule :: ModuleName -> Bool + isImportedModule = flip elem (importedModules imps) - -- Constructs a list of types with their data constructors and the original - -- module they were defined in from a list of type and data constructor names. - resolveTypeExports - :: [Qualified (ProperName 'TypeName)] - -> [Qualified (ProperName 'ConstructorName)] - -> [((ProperName 'TypeName, [ProperName 'ConstructorName]), ExportSource)] - resolveTypeExports tctors dctors = map go tctors - where - go - :: Qualified (ProperName 'TypeName) - -> ((ProperName 'TypeName, [ProperName 'ConstructorName]), ExportSource) - go (Qualified (ByModuleName mn'') name) = - fromMaybe (internalError "Missing value in resolveTypeExports") $ do - exps' <- envModuleExports <$> mn'' `M.lookup` env - (dctors', src) <- name `M.lookup` exportedTypes exps' - let relevantDctors = mapMaybe (disqualifyFor (Just mn'')) dctors - return - ( (name, relevantDctors `intersect` dctors') - , src { exportSourceImportedFrom = Just mn'' } - ) - go (Qualified _ _) = internalError "Unqualified value in resolveTypeExports" + -- Constructs a list of types with their data constructors and the original + -- module they were defined in from a list of type and data constructor names. + resolveTypeExports :: + [Qualified (ProperName 'TypeName)] -> + [Qualified (ProperName 'ConstructorName)] -> + [((ProperName 'TypeName, [ProperName 'ConstructorName]), ExportSource)] + resolveTypeExports tctors dctors = map go tctors + where + go :: + Qualified (ProperName 'TypeName) -> + ((ProperName 'TypeName, [ProperName 'ConstructorName]), ExportSource) + go (Qualified (ByModuleName mn'') name) = + fromMaybe (internalError "Missing value in resolveTypeExports") $ do + exps' <- envModuleExports <$> mn'' `M.lookup` env + (dctors', src) <- name `M.lookup` exportedTypes exps' + let relevantDctors = mapMaybe (disqualifyFor (Just mn'')) dctors + return + ( (name, relevantDctors `intersect` dctors') + , src {exportSourceImportedFrom = Just mn''} + ) + go (Qualified _ _) = internalError "Unqualified value in resolveTypeExports" - -- Looks up an imported type operator and re-qualifies it with the original - -- module it came from. - resolveTypeOp :: Qualified (OpName 'TypeOpName) -> (OpName 'TypeOpName, ExportSource) - resolveTypeOp op - = fromMaybe (internalError "Missing value in resolveValue") - $ resolve exportedTypeOps op + -- Looks up an imported type operator and re-qualifies it with the original + -- module it came from. + resolveTypeOp :: Qualified (OpName 'TypeOpName) -> (OpName 'TypeOpName, ExportSource) + resolveTypeOp op = + fromMaybe (internalError "Missing value in resolveValue") $ + resolve exportedTypeOps op - -- Looks up an imported class and re-qualifies it with the original module it - -- came from. - resolveClass :: Qualified (ProperName 'ClassName) -> (ProperName 'ClassName, ExportSource) - resolveClass className - = fromMaybe (internalError "Missing value in resolveClass") - $ resolve exportedTypeClasses className + -- Looks up an imported class and re-qualifies it with the original module it + -- came from. + resolveClass :: Qualified (ProperName 'ClassName) -> (ProperName 'ClassName, ExportSource) + resolveClass className = + fromMaybe (internalError "Missing value in resolveClass") $ + resolve exportedTypeClasses className - -- Looks up an imported value and re-qualifies it with the original module it - -- came from. - resolveValue :: Qualified Ident -> (Ident, ExportSource) - resolveValue ident - = fromMaybe (internalError "Missing value in resolveValue") - $ resolve exportedValues ident + -- Looks up an imported value and re-qualifies it with the original module it + -- came from. + resolveValue :: Qualified Ident -> (Ident, ExportSource) + resolveValue ident = + fromMaybe (internalError "Missing value in resolveValue") $ + resolve exportedValues ident - -- Looks up an imported operator and re-qualifies it with the original - -- module it came from. - resolveValueOp :: Qualified (OpName 'ValueOpName) -> (OpName 'ValueOpName, ExportSource) - resolveValueOp op - = fromMaybe (internalError "Missing value in resolveValueOp") - $ resolve exportedValueOps op + -- Looks up an imported operator and re-qualifies it with the original + -- module it came from. + resolveValueOp :: Qualified (OpName 'ValueOpName) -> (OpName 'ValueOpName, ExportSource) + resolveValueOp op = + fromMaybe (internalError "Missing value in resolveValueOp") $ + resolve exportedValueOps op - resolve - :: Ord a - => (Exports -> M.Map a ExportSource) - -> Qualified a - -> Maybe (a, ExportSource) - resolve f (Qualified (ByModuleName mn'') a) = do - exps' <- envModuleExports <$> mn'' `M.lookup` env - src <- a `M.lookup` f exps' - return (a, src { exportSourceImportedFrom = Just mn'' }) - resolve _ _ = internalError "Unqualified value in resolve" + resolve :: + (Ord a) => + (Exports -> M.Map a ExportSource) -> + Qualified a -> + Maybe (a, ExportSource) + resolve f (Qualified (ByModuleName mn'') a) = do + exps' <- envModuleExports <$> mn'' `M.lookup` env + src <- a `M.lookup` f exps' + return (a, src {exportSourceImportedFrom = Just mn''}) + resolve _ _ = internalError "Unqualified value in resolve" --- | --- Filters the full list of exportable values, types, and classes for a module --- based on a list of export declaration references. --- -filterModule - :: forall m - . MonadError MultipleErrors m - => ModuleName - -> Exports - -> [DeclarationRef] - -> m Exports +{- | +Filters the full list of exportable values, types, and classes for a module +based on a list of export declaration references. +-} +filterModule :: + forall m. + (MonadError MultipleErrors m) => + ModuleName -> + Exports -> + [DeclarationRef] -> + m Exports filterModule mn exps refs = do types <- foldM filterTypes M.empty (combineTypeRefs refs) typeOps <- foldM (filterExport TyOpName getTypeOpRef exportedTypeOps) M.empty refs classes <- foldM (filterExport TyClassName getTypeClassRef exportedTypeClasses) M.empty refs values <- foldM (filterExport IdentName getValueRef exportedValues) M.empty refs valueOps <- foldM (filterExport ValOpName getValueOpRef exportedValueOps) M.empty refs - return Exports - { exportedTypes = types - , exportedTypeOps = typeOps - , exportedTypeClasses = classes - , exportedValues = values - , exportedValueOps = valueOps - } - + return + Exports + { exportedTypes = types + , exportedTypeOps = typeOps + , exportedTypeClasses = classes + , exportedValues = values + , exportedValueOps = valueOps + } where + -- Takes the list of exported refs, filters out any non-TypeRefs, then + -- combines any duplicate type exports to ensure that all constructors + -- listed for the type are covered. Without this, only the data constructor + -- listing for the last ref would be used. + combineTypeRefs :: [DeclarationRef] -> [DeclarationRef] + combineTypeRefs = + fmap (\(ss', (tc, dcs)) -> TypeRef ss' tc dcs) + . fmap (foldr1 $ \(ss, (tc, dcs1)) (_, (_, dcs2)) -> (ss, (tc, liftM2 (++) dcs1 dcs2))) + . groupBy ((==) `on` (fst . snd)) + . sortOn (fst . snd) + . mapMaybe (\ref -> (declRefSourceSpan ref,) <$> getTypeRef ref) - -- Takes the list of exported refs, filters out any non-TypeRefs, then - -- combines any duplicate type exports to ensure that all constructors - -- listed for the type are covered. Without this, only the data constructor - -- listing for the last ref would be used. - combineTypeRefs :: [DeclarationRef] -> [DeclarationRef] - combineTypeRefs - = fmap (\(ss', (tc, dcs)) -> TypeRef ss' tc dcs) - . fmap (foldr1 $ \(ss, (tc, dcs1)) (_, (_, dcs2)) -> (ss, (tc, liftM2 (++) dcs1 dcs2))) - . groupBy ((==) `on` (fst . snd)) - . sortOn (fst . snd) - . mapMaybe (\ref -> (declRefSourceSpan ref,) <$> getTypeRef ref) - - filterTypes - :: M.Map (ProperName 'TypeName) ([ProperName 'ConstructorName], ExportSource) - -> DeclarationRef - -> m (M.Map (ProperName 'TypeName) ([ProperName 'ConstructorName], ExportSource)) - filterTypes result (TypeRef ss name expDcons) = - case name `M.lookup` exportedTypes exps of - Nothing -> throwError . errorMessage' ss . UnknownExport $ TyName name - Just (dcons, src) -> do - let expDcons' = fromMaybe dcons expDcons - traverse_ (checkDcon name dcons) expDcons' - return $ M.insert name (expDcons', src) result - where - -- Ensures a data constructor is exportable for a given type. Takes a type - -- name, a list of exportable data constructors for the type, and the name of - -- the data constructor to check. - checkDcon - :: ProperName 'TypeName - -> [ProperName 'ConstructorName] - -> ProperName 'ConstructorName - -> m () - checkDcon tcon dcons dcon = - unless (dcon `elem` dcons) . - throwError . errorMessage' ss $ UnknownExportDataConstructor tcon dcon - filterTypes result _ = return result + filterTypes :: + M.Map (ProperName 'TypeName) ([ProperName 'ConstructorName], ExportSource) -> + DeclarationRef -> + m (M.Map (ProperName 'TypeName) ([ProperName 'ConstructorName], ExportSource)) + filterTypes result (TypeRef ss name expDcons) = + case name `M.lookup` exportedTypes exps of + Nothing -> throwError . errorMessage' ss . UnknownExport $ TyName name + Just (dcons, src) -> do + let expDcons' = fromMaybe dcons expDcons + traverse_ (checkDcon name dcons) expDcons' + return $ M.insert name (expDcons', src) result + where + -- Ensures a data constructor is exportable for a given type. Takes a type + -- name, a list of exportable data constructors for the type, and the name of + -- the data constructor to check. + checkDcon :: + ProperName 'TypeName -> + [ProperName 'ConstructorName] -> + ProperName 'ConstructorName -> + m () + checkDcon tcon dcons dcon = + unless (dcon `elem` dcons) + . throwError + . errorMessage' ss + $ UnknownExportDataConstructor tcon dcon + filterTypes result _ = return result - filterExport - :: Ord a - => (a -> Name) - -> (DeclarationRef -> Maybe a) - -> (Exports -> M.Map a ExportSource) - -> M.Map a ExportSource - -> DeclarationRef - -> m (M.Map a ExportSource) - filterExport toName get fromExps result ref - | Just name <- get ref = - case name `M.lookup` fromExps exps of - -- TODO: I'm not sure if we actually need to check that these modules - -- are the same here -gb - Just source' | mn == exportSourceDefinedIn source' -> - return $ M.insert name source' result - _ -> - throwError . errorMessage' (declRefSourceSpan ref) . UnknownExport $ toName name - filterExport _ _ _ result _ = return result + filterExport :: + (Ord a) => + (a -> Name) -> + (DeclarationRef -> Maybe a) -> + (Exports -> M.Map a ExportSource) -> + M.Map a ExportSource -> + DeclarationRef -> + m (M.Map a ExportSource) + filterExport toName get fromExps result ref + | Just name <- get ref = + case name `M.lookup` fromExps exps of + -- TODO: I'm not sure if we actually need to check that these modules + -- are the same here -gb + Just source' + | mn == exportSourceDefinedIn source' -> + return $ M.insert name source' result + _ -> + throwError . errorMessage' (declRefSourceSpan ref) . UnknownExport $ toName name + filterExport _ _ _ result _ = return result diff --git a/src/Language/PureScript/Sugar/Names/Imports.hs b/src/Language/PureScript/Sugar/Names/Imports.hs index 3a43faf7f..8204df4e4 100644 --- a/src/Language/PureScript/Sugar/Names/Imports.hs +++ b/src/Language/PureScript/Sugar/Names/Imports.hs @@ -1,229 +1,235 @@ -module Language.PureScript.Sugar.Names.Imports - ( ImportDef - , resolveImports - , resolveModuleImport - , findImports - ) where +module Language.PureScript.Sugar.Names.Imports ( + ImportDef, + resolveImports, + resolveModuleImport, + findImports, +) where import Prelude import Control.Monad (foldM, when) -import Control.Monad.Error.Class (MonadError(..)) +import Control.Monad.Error.Class (MonadError (..)) import Data.Foldable (for_, traverse_) -import Data.Maybe (fromMaybe) import Data.Map qualified as M +import Data.Maybe (fromMaybe) import Data.Set qualified as S -import Language.PureScript.AST (Declaration(..), DeclarationRef(..), ErrorMessageHint(..), ExportSource(..), ImportDeclarationType(..), Module(..), SourceSpan, internalModuleSourceSpan) +import Language.PureScript.AST (Declaration (..), DeclarationRef (..), ErrorMessageHint (..), ExportSource (..), ImportDeclarationType (..), Module (..), SourceSpan, internalModuleSourceSpan) import Language.PureScript.Crash (internalError) -import Language.PureScript.Errors (MultipleErrors, SimpleErrorMessage(..), addHint, errorMessage', rethrow) -import Language.PureScript.Names (pattern ByNullSourcePos, ModuleName, Name(..), ProperName, ProperNameType(..), Qualified(..), QualifiedBy(..), byMaybeModuleName) -import Language.PureScript.Sugar.Names.Env (Env, Exports(..), ImportProvenance(..), ImportRecord(..), Imports(..), envModuleExports, nullImports) +import Language.PureScript.Errors (MultipleErrors, SimpleErrorMessage (..), addHint, errorMessage', rethrow) +import Language.PureScript.Names (ModuleName, Name (..), ProperName, ProperNameType (..), Qualified (..), QualifiedBy (..), byMaybeModuleName, pattern ByNullSourcePos) +import Language.PureScript.Sugar.Names.Env (Env, Exports (..), ImportProvenance (..), ImportRecord (..), Imports (..), envModuleExports, nullImports) type ImportDef = (SourceSpan, ImportDeclarationType, Maybe ModuleName) --- | --- Finds the imports within a module, mapping the imported module name to an optional set of --- explicitly imported declarations. --- -findImports - :: [Declaration] - -> M.Map ModuleName [ImportDef] +{- | +Finds the imports within a module, mapping the imported module name to an optional set of +explicitly imported declarations. +-} +findImports :: + [Declaration] -> + M.Map ModuleName [ImportDef] findImports = foldr go M.empty where - go (ImportDeclaration (pos, _) mn typ qual) = - M.alter (return . ((pos, typ, qual) :) . fromMaybe []) mn - go _ = id - --- | --- Constructs a set of imports for a module. --- -resolveImports - :: forall m - . MonadError MultipleErrors m - => Env - -> Module - -> m (Module, Imports) + go (ImportDeclaration (pos, _) mn typ qual) = + M.alter (return . ((pos, typ, qual) :) . fromMaybe []) mn + go _ = id + +{- | +Constructs a set of imports for a module. +-} +resolveImports :: + forall m. + (MonadError MultipleErrors m) => + Env -> + Module -> + m (Module, Imports) resolveImports env (Module ss coms currentModule decls exps) = rethrow (addHint (ErrorInModule currentModule)) $ do let imports = findImports decls imports' = M.map (map (\(ss', dt, mmn) -> (ss', Just dt, mmn))) imports scope = M.insert currentModule [(internalModuleSourceSpan "", Nothing, Nothing)] imports' - (Module ss coms currentModule decls exps,) <$> - foldM (resolveModuleImport env) nullImports (M.toList scope) + (Module ss coms currentModule decls exps,) + <$> foldM (resolveModuleImport env) nullImports (M.toList scope) -- | Constructs a set of imports for a single module import. -resolveModuleImport - :: forall m - . MonadError MultipleErrors m - => Env - -> Imports - -> (ModuleName, [(SourceSpan, Maybe ImportDeclarationType, Maybe ModuleName)]) - -> m Imports +resolveModuleImport :: + forall m. + (MonadError MultipleErrors m) => + Env -> + Imports -> + (ModuleName, [(SourceSpan, Maybe ImportDeclarationType, Maybe ModuleName)]) -> + m Imports resolveModuleImport env ie (mn, imps) = foldM go ie imps where - go :: Imports - -> (SourceSpan, Maybe ImportDeclarationType, Maybe ModuleName) - -> m Imports - go ie' (ss, typ, impQual) = do - modExports <- - maybe - (throwError . errorMessage' ss . UnknownName . Qualified ByNullSourcePos $ ModName mn) - (return . envModuleExports) - (mn `M.lookup` env) - let impModules = importedModules ie' - qualModules = importedQualModules ie' - ie'' = ie' { importedModules = maybe (S.insert mn impModules) (const impModules) impQual - , importedQualModules = maybe qualModules (`S.insert` qualModules) impQual - } - resolveImport mn modExports ie'' impQual ss typ - --- | --- Extends the local environment for a module by resolving an import of another module. --- -resolveImport - :: forall m - . MonadError MultipleErrors m - => ModuleName - -> Exports - -> Imports - -> Maybe ModuleName - -> SourceSpan - -> Maybe ImportDeclarationType - -> m Imports + go :: + Imports -> + (SourceSpan, Maybe ImportDeclarationType, Maybe ModuleName) -> + m Imports + go ie' (ss, typ, impQual) = do + modExports <- + maybe + (throwError . errorMessage' ss . UnknownName . Qualified ByNullSourcePos $ ModName mn) + (return . envModuleExports) + (mn `M.lookup` env) + let impModules = importedModules ie' + qualModules = importedQualModules ie' + ie'' = + ie' + { importedModules = maybe (S.insert mn impModules) (const impModules) impQual + , importedQualModules = maybe qualModules (`S.insert` qualModules) impQual + } + resolveImport mn modExports ie'' impQual ss typ + +{- | +Extends the local environment for a module by resolving an import of another module. +-} +resolveImport :: + forall m. + (MonadError MultipleErrors m) => + ModuleName -> + Exports -> + Imports -> + Maybe ModuleName -> + SourceSpan -> + Maybe ImportDeclarationType -> + m Imports resolveImport importModule exps imps impQual = resolveByType where - - resolveByType :: SourceSpan -> Maybe ImportDeclarationType -> m Imports - resolveByType ss Nothing = - importAll ss (importRef Local) - resolveByType ss (Just Implicit) = - importAll ss (importRef FromImplicit) - resolveByType _ (Just (Explicit refs)) = - checkRefs False refs >> foldM (importRef FromExplicit) imps refs - resolveByType ss (Just (Hiding refs)) = - checkRefs True refs >> importAll ss (importNonHidden refs) - - -- Check that a 'DeclarationRef' refers to an importable symbol - checkRefs :: Bool -> [DeclarationRef] -> m () - checkRefs isHiding = traverse_ check - where - check (ValueRef ss name) = - checkImportExists ss IdentName (exportedValues exps) name - check (ValueOpRef ss op) = - checkImportExists ss ValOpName (exportedValueOps exps) op - check (TypeRef ss name dctors) = do - checkImportExists ss TyName (exportedTypes exps) name - let (allDctors, _) = allExportedDataConstructors name - for_ dctors $ traverse_ (checkDctorExists ss name allDctors) - check (TypeOpRef ss name) = - checkImportExists ss TyOpName (exportedTypeOps exps) name - check (TypeClassRef ss name) = - checkImportExists ss TyClassName (exportedTypeClasses exps) name - check (ModuleRef ss name) | isHiding = - throwError . errorMessage' ss $ ImportHidingModule name - check r = internalError $ "Invalid argument to checkRefs: " ++ show r - - -- Check that an explicitly imported item exists in the module it is being imported from - checkImportExists - :: Ord a - => SourceSpan - -> (a -> Name) - -> M.Map a b - -> a - -> m () - checkImportExists ss toName exports item - = when (item `M.notMember` exports) - . throwError . errorMessage' ss - $ UnknownImport importModule (toName item) - - -- Ensure that an explicitly imported data constructor exists for the type it is being imported - -- from - checkDctorExists - :: SourceSpan - -> ProperName 'TypeName - -> [ProperName 'ConstructorName] - -> ProperName 'ConstructorName - -> m () - checkDctorExists ss tcon exports dctor - = when (dctor `notElem` exports) - . throwError . errorMessage' ss - $ UnknownImportDataConstructor importModule tcon dctor - - importNonHidden :: [DeclarationRef] -> Imports -> DeclarationRef -> m Imports - importNonHidden hidden m ref | isHidden ref = return m - | otherwise = importRef FromImplicit m ref - where - -- TODO: rework this to be not confusing - isHidden :: DeclarationRef -> Bool - isHidden ref'@TypeRef{} = foldl (checkTypeRef ref') False hidden - isHidden ref' = ref' `elem` hidden - checkTypeRef :: DeclarationRef -> Bool -> DeclarationRef -> Bool - checkTypeRef _ True _ = True - checkTypeRef (TypeRef _ _ Nothing) acc (TypeRef _ _ (Just _)) = acc - checkTypeRef (TypeRef _ name (Just dctor)) _ (TypeRef _ name' (Just dctor')) = name == name' && dctor == dctor' - checkTypeRef (TypeRef _ name _) _ (TypeRef _ name' Nothing) = name == name' - checkTypeRef _ acc _ = acc - - -- Import all symbols - importAll :: SourceSpan -> (Imports -> DeclarationRef -> m Imports) -> m Imports - importAll ss importer = - foldM (\m (name, (dctors, _)) -> importer m (TypeRef ss name (Just dctors))) imps (M.toList (exportedTypes exps)) - >>= flip (foldM (\m (name, _) -> importer m (TypeOpRef ss name))) (M.toList (exportedTypeOps exps)) - >>= flip (foldM (\m (name, _) -> importer m (ValueRef ss name))) (M.toList (exportedValues exps)) - >>= flip (foldM (\m (name, _) -> importer m (ValueOpRef ss name))) (M.toList (exportedValueOps exps)) - >>= flip (foldM (\m (name, _) -> importer m (TypeClassRef ss name))) (M.toList (exportedTypeClasses exps)) - - importRef :: ImportProvenance -> Imports -> DeclarationRef -> m Imports - importRef prov imp (ValueRef ss name) = do - let values' = updateImports (importedValues imp) (exportedValues exps) id name ss prov - return $ imp { importedValues = values' } - importRef prov imp (ValueOpRef ss name) = do - let valueOps' = updateImports (importedValueOps imp) (exportedValueOps exps) id name ss prov - return $ imp { importedValueOps = valueOps' } - importRef prov imp (TypeRef ss name dctors) = do - let types' = updateImports (importedTypes imp) (exportedTypes exps) snd name ss prov - let (dctorNames, src) = allExportedDataConstructors name - dctorLookup :: M.Map (ProperName 'ConstructorName) ExportSource - dctorLookup = M.fromList $ map (, src) dctorNames - traverse_ (traverse_ $ checkDctorExists ss name dctorNames) dctors - let dctors' = foldl (\m d -> updateImports m dctorLookup id d ss prov) (importedDataConstructors imp) (fromMaybe dctorNames dctors) - return $ imp { importedTypes = types', importedDataConstructors = dctors' } - importRef prov imp (TypeOpRef ss name) = do - let ops' = updateImports (importedTypeOps imp) (exportedTypeOps exps) id name ss prov - return $ imp { importedTypeOps = ops' } - importRef prov imp (TypeClassRef ss name) = do - let typeClasses' = updateImports (importedTypeClasses imp) (exportedTypeClasses exps) id name ss prov - return $ imp { importedTypeClasses = typeClasses' } - importRef _ _ TypeInstanceRef{} = internalError "TypeInstanceRef in importRef" - importRef _ _ ModuleRef{} = internalError "ModuleRef in importRef" - importRef _ _ ReExportRef{} = internalError "ReExportRef in importRef" - - -- Find all exported data constructors for a given type - allExportedDataConstructors - :: ProperName 'TypeName - -> ([ProperName 'ConstructorName], ExportSource) - allExportedDataConstructors name = - fromMaybe (internalError "Invalid state in allExportedDataConstructors") - $ name `M.lookup` exportedTypes exps - - -- Add something to an import resolution list - updateImports - :: Ord a - => M.Map (Qualified a) [ImportRecord a] - -> M.Map a b - -> (b -> ExportSource) - -> a - -> SourceSpan - -> ImportProvenance - -> M.Map (Qualified a) [ImportRecord a] - updateImports imps' exps' expName name ss prov = - let - src = maybe (internalError "Invalid state in updateImports") expName (name `M.lookup` exps') - rec = ImportRecord (Qualified (ByModuleName importModule) name) (exportSourceDefinedIn src) ss prov - in - M.alter - (\currNames -> Just $ rec : fromMaybe [] currNames) - (Qualified (byMaybeModuleName impQual) name) - imps' + resolveByType :: SourceSpan -> Maybe ImportDeclarationType -> m Imports + resolveByType ss Nothing = + importAll ss (importRef Local) + resolveByType ss (Just Implicit) = + importAll ss (importRef FromImplicit) + resolveByType _ (Just (Explicit refs)) = + checkRefs False refs >> foldM (importRef FromExplicit) imps refs + resolveByType ss (Just (Hiding refs)) = + checkRefs True refs >> importAll ss (importNonHidden refs) + + -- Check that a 'DeclarationRef' refers to an importable symbol + checkRefs :: Bool -> [DeclarationRef] -> m () + checkRefs isHiding = traverse_ check + where + check (ValueRef ss name) = + checkImportExists ss IdentName (exportedValues exps) name + check (ValueOpRef ss op) = + checkImportExists ss ValOpName (exportedValueOps exps) op + check (TypeRef ss name dctors) = do + checkImportExists ss TyName (exportedTypes exps) name + let (allDctors, _) = allExportedDataConstructors name + for_ dctors $ traverse_ (checkDctorExists ss name allDctors) + check (TypeOpRef ss name) = + checkImportExists ss TyOpName (exportedTypeOps exps) name + check (TypeClassRef ss name) = + checkImportExists ss TyClassName (exportedTypeClasses exps) name + check (ModuleRef ss name) + | isHiding = + throwError . errorMessage' ss $ ImportHidingModule name + check r = internalError $ "Invalid argument to checkRefs: " ++ show r + + -- Check that an explicitly imported item exists in the module it is being imported from + checkImportExists :: + (Ord a) => + SourceSpan -> + (a -> Name) -> + M.Map a b -> + a -> + m () + checkImportExists ss toName exports item = + when (item `M.notMember` exports) + . throwError + . errorMessage' ss + $ UnknownImport importModule (toName item) + + -- Ensure that an explicitly imported data constructor exists for the type it is being imported + -- from + checkDctorExists :: + SourceSpan -> + ProperName 'TypeName -> + [ProperName 'ConstructorName] -> + ProperName 'ConstructorName -> + m () + checkDctorExists ss tcon exports dctor = + when (dctor `notElem` exports) + . throwError + . errorMessage' ss + $ UnknownImportDataConstructor importModule tcon dctor + + importNonHidden :: [DeclarationRef] -> Imports -> DeclarationRef -> m Imports + importNonHidden hidden m ref + | isHidden ref = return m + | otherwise = importRef FromImplicit m ref + where + -- TODO: rework this to be not confusing + isHidden :: DeclarationRef -> Bool + isHidden ref'@TypeRef {} = foldl (checkTypeRef ref') False hidden + isHidden ref' = ref' `elem` hidden + checkTypeRef :: DeclarationRef -> Bool -> DeclarationRef -> Bool + checkTypeRef _ True _ = True + checkTypeRef (TypeRef _ _ Nothing) acc (TypeRef _ _ (Just _)) = acc + checkTypeRef (TypeRef _ name (Just dctor)) _ (TypeRef _ name' (Just dctor')) = name == name' && dctor == dctor' + checkTypeRef (TypeRef _ name _) _ (TypeRef _ name' Nothing) = name == name' + checkTypeRef _ acc _ = acc + + -- Import all symbols + importAll :: SourceSpan -> (Imports -> DeclarationRef -> m Imports) -> m Imports + importAll ss importer = + foldM (\m (name, (dctors, _)) -> importer m (TypeRef ss name (Just dctors))) imps (M.toList (exportedTypes exps)) + >>= flip (foldM (\m (name, _) -> importer m (TypeOpRef ss name))) (M.toList (exportedTypeOps exps)) + >>= flip (foldM (\m (name, _) -> importer m (ValueRef ss name))) (M.toList (exportedValues exps)) + >>= flip (foldM (\m (name, _) -> importer m (ValueOpRef ss name))) (M.toList (exportedValueOps exps)) + >>= flip (foldM (\m (name, _) -> importer m (TypeClassRef ss name))) (M.toList (exportedTypeClasses exps)) + + importRef :: ImportProvenance -> Imports -> DeclarationRef -> m Imports + importRef prov imp (ValueRef ss name) = do + let values' = updateImports (importedValues imp) (exportedValues exps) id name ss prov + return $ imp {importedValues = values'} + importRef prov imp (ValueOpRef ss name) = do + let valueOps' = updateImports (importedValueOps imp) (exportedValueOps exps) id name ss prov + return $ imp {importedValueOps = valueOps'} + importRef prov imp (TypeRef ss name dctors) = do + let types' = updateImports (importedTypes imp) (exportedTypes exps) snd name ss prov + let (dctorNames, src) = allExportedDataConstructors name + dctorLookup :: M.Map (ProperName 'ConstructorName) ExportSource + dctorLookup = M.fromList $ map (,src) dctorNames + traverse_ (traverse_ $ checkDctorExists ss name dctorNames) dctors + let dctors' = foldl (\m d -> updateImports m dctorLookup id d ss prov) (importedDataConstructors imp) (fromMaybe dctorNames dctors) + return $ imp {importedTypes = types', importedDataConstructors = dctors'} + importRef prov imp (TypeOpRef ss name) = do + let ops' = updateImports (importedTypeOps imp) (exportedTypeOps exps) id name ss prov + return $ imp {importedTypeOps = ops'} + importRef prov imp (TypeClassRef ss name) = do + let typeClasses' = updateImports (importedTypeClasses imp) (exportedTypeClasses exps) id name ss prov + return $ imp {importedTypeClasses = typeClasses'} + importRef _ _ TypeInstanceRef {} = internalError "TypeInstanceRef in importRef" + importRef _ _ ModuleRef {} = internalError "ModuleRef in importRef" + importRef _ _ ReExportRef {} = internalError "ReExportRef in importRef" + + -- Find all exported data constructors for a given type + allExportedDataConstructors :: + ProperName 'TypeName -> + ([ProperName 'ConstructorName], ExportSource) + allExportedDataConstructors name = + fromMaybe (internalError "Invalid state in allExportedDataConstructors") $ + name `M.lookup` exportedTypes exps + + -- Add something to an import resolution list + updateImports :: + (Ord a) => + M.Map (Qualified a) [ImportRecord a] -> + M.Map a b -> + (b -> ExportSource) -> + a -> + SourceSpan -> + ImportProvenance -> + M.Map (Qualified a) [ImportRecord a] + updateImports imps' exps' expName name ss prov = + let + src = maybe (internalError "Invalid state in updateImports") expName (name `M.lookup` exps') + rec = ImportRecord (Qualified (ByModuleName importModule) name) (exportSourceDefinedIn src) ss prov + in + M.alter + (\currNames -> Just $ rec : fromMaybe [] currNames) + (Qualified (byMaybeModuleName impQual) name) + imps' diff --git a/src/Language/PureScript/Sugar/ObjectWildcards.hs b/src/Language/PureScript/Sugar/ObjectWildcards.hs index 88b93b899..b1deb30e6 100644 --- a/src/Language/PureScript/Sugar/ObjectWildcards.hs +++ b/src/Language/PureScript/Sugar/ObjectWildcards.hs @@ -1,101 +1,101 @@ -module Language.PureScript.Sugar.ObjectWildcards - ( desugarObjectConstructors - , desugarDecl - ) where +module Language.PureScript.Sugar.ObjectWildcards ( + desugarObjectConstructors, + desugarDecl, +) where import Prelude import Control.Monad (forM) -import Control.Monad.Error.Class (MonadError(..)) +import Control.Monad.Error.Class (MonadError (..)) import Control.Monad.Supply.Class (MonadSupply) import Data.Foldable (toList) import Data.List (foldl') import Data.Maybe (catMaybes) import Language.PureScript.AST -import Language.PureScript.Environment (NameKind(..)) +import Language.PureScript.Environment (NameKind (..)) import Language.PureScript.Errors (MultipleErrors, rethrowWithPosition) -import Language.PureScript.Names (pattern ByNullSourcePos, Ident, Qualified(..), freshIdent') +import Language.PureScript.Names (Ident, Qualified (..), freshIdent', pattern ByNullSourcePos) import Language.PureScript.PSString (PSString) - -desugarObjectConstructors - :: forall m - . (MonadSupply m, MonadError MultipleErrors m) - => Module - -> m Module +desugarObjectConstructors :: + forall m. + (MonadSupply m, MonadError MultipleErrors m) => + Module -> + m Module desugarObjectConstructors (Module ss coms mn ds exts) = Module ss coms mn <$> mapM desugarDecl ds <*> pure exts desugarDecl :: forall m. (MonadSupply m, MonadError MultipleErrors m) => Declaration -> m Declaration desugarDecl d = rethrowWithPosition (declSourceSpan d) $ fn d where - (fn, _, _) = everywhereOnValuesTopDownM return desugarExpr return + (fn, _, _) = everywhereOnValuesTopDownM return desugarExpr return - desugarExpr :: Expr -> m Expr - desugarExpr (Literal ss (ObjectLiteral ps)) = wrapLambdaAssoc (Literal ss . ObjectLiteral) ps - desugarExpr (ObjectUpdateNested obj ps) = transformNestedUpdate obj ps - desugarExpr (Accessor prop u) - | Just props <- peelAnonAccessorChain u = do - arg <- freshIdent' - return $ Abs (VarBinder nullSourceSpan arg) $ foldr Accessor (argToExpr arg) (prop:props) - desugarExpr (Case args cas) | any isAnonymousArgument args = do - argIdents <- forM args freshIfAnon - let args' = zipWith (`maybe` argToExpr) args argIdents - return $ foldr (Abs . VarBinder nullSourceSpan) (Case args' cas) (catMaybes argIdents) - desugarExpr (IfThenElse u t f) | any isAnonymousArgument [u, t, f] = do - u' <- freshIfAnon u - t' <- freshIfAnon t - f' <- freshIfAnon f - let if_ = IfThenElse (maybe u argToExpr u') (maybe t argToExpr t') (maybe f argToExpr f') - return $ foldr (Abs . VarBinder nullSourceSpan) if_ (catMaybes [u', t', f']) - desugarExpr e = return e + desugarExpr :: Expr -> m Expr + desugarExpr (Literal ss (ObjectLiteral ps)) = wrapLambdaAssoc (Literal ss . ObjectLiteral) ps + desugarExpr (ObjectUpdateNested obj ps) = transformNestedUpdate obj ps + desugarExpr (Accessor prop u) + | Just props <- peelAnonAccessorChain u = do + arg <- freshIdent' + return $ Abs (VarBinder nullSourceSpan arg) $ foldr Accessor (argToExpr arg) (prop : props) + desugarExpr (Case args cas) | any isAnonymousArgument args = do + argIdents <- forM args freshIfAnon + let args' = zipWith (`maybe` argToExpr) args argIdents + return $ foldr (Abs . VarBinder nullSourceSpan) (Case args' cas) (catMaybes argIdents) + desugarExpr (IfThenElse u t f) | any isAnonymousArgument [u, t, f] = do + u' <- freshIfAnon u + t' <- freshIfAnon t + f' <- freshIfAnon f + let if_ = IfThenElse (maybe u argToExpr u') (maybe t argToExpr t') (maybe f argToExpr f') + return $ foldr (Abs . VarBinder nullSourceSpan) if_ (catMaybes [u', t', f']) + desugarExpr e = return e - transformNestedUpdate :: Expr -> PathTree Expr -> m Expr - transformNestedUpdate obj ps = do - -- If we don't have an anonymous argument then we need to generate a let wrapper - -- so that the object expression isn't re-evaluated for each nested update. - val <- freshIdent' - let valExpr = argToExpr val - if isAnonymousArgument obj - then Abs (VarBinder nullSourceSpan val) <$> wrapLambda (buildUpdates valExpr) ps - else wrapLambda (buildLet val . buildUpdates valExpr) ps - where - buildLet val = Let FromLet [ValueDecl (declSourceSpan d, []) val Public [] [MkUnguarded obj]] + transformNestedUpdate :: Expr -> PathTree Expr -> m Expr + transformNestedUpdate obj ps = do + -- If we don't have an anonymous argument then we need to generate a let wrapper + -- so that the object expression isn't re-evaluated for each nested update. + val <- freshIdent' + let valExpr = argToExpr val + if isAnonymousArgument obj + then Abs (VarBinder nullSourceSpan val) <$> wrapLambda (buildUpdates valExpr) ps + else wrapLambda (buildLet val . buildUpdates valExpr) ps + where + buildLet val = Let FromLet [ValueDecl (declSourceSpan d, []) val Public [] [MkUnguarded obj]] - -- recursively build up the nested `ObjectUpdate` expressions - buildUpdates :: Expr -> PathTree Expr -> Expr - buildUpdates val (PathTree vs) = ObjectUpdate val (goLayer [] <$> runAssocList vs) where - goLayer :: [PSString] -> (PSString, PathNode Expr) -> (PSString, Expr) - goLayer _ (key, Leaf expr) = (key, expr) - goLayer path (key, Branch (PathTree branch)) = - let path' = path ++ [key] - updates = goLayer path' <$> runAssocList branch - accessor = foldl' (flip Accessor) val path' - objectUpdate = ObjectUpdate accessor updates - in (key, objectUpdate) + -- recursively build up the nested `ObjectUpdate` expressions + buildUpdates :: Expr -> PathTree Expr -> Expr + buildUpdates val (PathTree vs) = ObjectUpdate val (goLayer [] <$> runAssocList vs) + where + goLayer :: [PSString] -> (PSString, PathNode Expr) -> (PSString, Expr) + goLayer _ (key, Leaf expr) = (key, expr) + goLayer path (key, Branch (PathTree branch)) = + let path' = path ++ [key] + updates = goLayer path' <$> runAssocList branch + accessor = foldl' (flip Accessor) val path' + objectUpdate = ObjectUpdate accessor updates + in (key, objectUpdate) - wrapLambda :: forall t. Traversable t => (t Expr -> Expr) -> t Expr -> m Expr - wrapLambda mkVal ps = do - args <- traverse processExpr ps - return $ foldr (Abs . VarBinder nullSourceSpan) (mkVal (snd <$> args)) (catMaybes $ toList (fst <$> args)) - where - processExpr :: Expr -> m (Maybe Ident, Expr) - processExpr e = do - arg <- freshIfAnon e - return (arg, maybe e argToExpr arg) + wrapLambda :: forall t. (Traversable t) => (t Expr -> Expr) -> t Expr -> m Expr + wrapLambda mkVal ps = do + args <- traverse processExpr ps + return $ foldr (Abs . VarBinder nullSourceSpan) (mkVal (snd <$> args)) (catMaybes $ toList (fst <$> args)) + where + processExpr :: Expr -> m (Maybe Ident, Expr) + processExpr e = do + arg <- freshIfAnon e + return (arg, maybe e argToExpr arg) - wrapLambdaAssoc :: ([(PSString, Expr)] -> Expr) -> [(PSString, Expr)] -> m Expr - wrapLambdaAssoc mkVal = wrapLambda (mkVal . runAssocList) . AssocList + wrapLambdaAssoc :: ([(PSString, Expr)] -> Expr) -> [(PSString, Expr)] -> m Expr + wrapLambdaAssoc mkVal = wrapLambda (mkVal . runAssocList) . AssocList - peelAnonAccessorChain :: Expr -> Maybe [PSString] - peelAnonAccessorChain (Accessor p e) = (p :) <$> peelAnonAccessorChain e - peelAnonAccessorChain (PositionedValue _ _ e) = peelAnonAccessorChain e - peelAnonAccessorChain AnonymousArgument = Just [] - peelAnonAccessorChain _ = Nothing + peelAnonAccessorChain :: Expr -> Maybe [PSString] + peelAnonAccessorChain (Accessor p e) = (p :) <$> peelAnonAccessorChain e + peelAnonAccessorChain (PositionedValue _ _ e) = peelAnonAccessorChain e + peelAnonAccessorChain AnonymousArgument = Just [] + peelAnonAccessorChain _ = Nothing - freshIfAnon :: Expr -> m (Maybe Ident) - freshIfAnon u - | isAnonymousArgument u = Just <$> freshIdent' - | otherwise = return Nothing + freshIfAnon :: Expr -> m (Maybe Ident) + freshIfAnon u + | isAnonymousArgument u = Just <$> freshIdent' + | otherwise = return Nothing - argToExpr :: Ident -> Expr - argToExpr = Var nullSourceSpan . Qualified ByNullSourcePos + argToExpr :: Ident -> Expr + argToExpr = Var nullSourceSpan . Qualified ByNullSourcePos diff --git a/src/Language/PureScript/Sugar/Operators.hs b/src/Language/PureScript/Sugar/Operators.hs index bb06486e8..926dfc1a0 100644 --- a/src/Language/PureScript/Sugar/Operators.hs +++ b/src/Language/PureScript/Sugar/Operators.hs @@ -1,102 +1,103 @@ --- | --- This module implements the desugaring pass which reapplies binary operators based --- on their fixity data and removes explicit parentheses. --- --- The value parser ignores fixity data when parsing binary operator applications, so --- it is necessary to reorder them here. --- -module Language.PureScript.Sugar.Operators - ( desugarSignedLiterals - , RebracketCaller(..) - , rebracket - , rebracketFiltered - , checkFixityExports - ) where +{- | +This module implements the desugaring pass which reapplies binary operators based +on their fixity data and removes explicit parentheses. + +The value parser ignores fixity data when parsing binary operator applications, so +it is necessary to reorder them here. +-} +module Language.PureScript.Sugar.Operators ( + desugarSignedLiterals, + RebracketCaller (..), + rebracket, + rebracketFiltered, + checkFixityExports, +) where import Prelude import Language.PureScript.AST import Language.PureScript.Crash (internalError) -import Language.PureScript.Errors (MultipleErrors, SimpleErrorMessage(..), addHint, errorMessage, errorMessage', parU, rethrow, rethrowWithPosition) -import Language.PureScript.Externs (ExternsFile(..), ExternsFixity(..), ExternsTypeFixity(..)) -import Language.PureScript.Names (pattern ByNullSourcePos, Ident(..), Name(..), OpName, OpNameType(..), ProperName, ProperNameType(..), Qualified(..), QualifiedBy(..), freshIdent') +import Language.PureScript.Errors (MultipleErrors, SimpleErrorMessage (..), addHint, errorMessage, errorMessage', parU, rethrow, rethrowWithPosition) +import Language.PureScript.Externs (ExternsFile (..), ExternsFixity (..), ExternsTypeFixity (..)) +import Language.PureScript.Names (Ident (..), Name (..), OpName, OpNameType (..), ProperName, ProperNameType (..), Qualified (..), QualifiedBy (..), freshIdent', pattern ByNullSourcePos) import Language.PureScript.Sugar.Operators.Binders (matchBinderOperators) import Language.PureScript.Sugar.Operators.Expr (matchExprOperators) import Language.PureScript.Sugar.Operators.Types (matchTypeOperators) import Language.PureScript.Traversals (defS, sndM) -import Language.PureScript.Types (Constraint(..), SourceType, Type(..), everywhereOnTypesTopDownM, overConstraintArgs) +import Language.PureScript.Types (Constraint (..), SourceType, Type (..), everywhereOnTypesTopDownM, overConstraintArgs) import Control.Monad (unless, (<=<)) -import Control.Monad.Error.Class (MonadError(..)) +import Control.Monad.Error.Class (MonadError (..)) import Control.Monad.Supply.Class (MonadSupply) import Data.Either (partitionEithers) import Data.Foldable (for_, traverse_) import Data.Function (on) import Data.Functor (($>)) -import Data.Functor.Identity (Identity(..), runIdentity) +import Data.Functor.Identity (Identity (..), runIdentity) import Data.List (groupBy, sortOn) -import Data.Maybe (mapMaybe, listToMaybe) import Data.Map qualified as M -import Data.Ord (Down(..)) +import Data.Maybe (listToMaybe, mapMaybe) +import Data.Ord (Down (..)) import Language.PureScript.Constants.Libs qualified as C --- | --- Removes unary negation operators and replaces them with calls to `negate`. --- +{- | +Removes unary negation operators and replaces them with calls to `negate`. +-} desugarSignedLiterals :: Module -> Module desugarSignedLiterals (Module ss coms mn ds exts) = Module ss coms mn (map f' ds) exts where - (f', _, _) = everywhereOnValues id go id - go (UnaryMinus ss' val) = App (Var ss' (Qualified ByNullSourcePos (Ident C.S_negate))) val - go other = other - --- | --- An operator associated with its declaration position, fixity, and the name --- of the function or data constructor it is an alias for. --- + (f', _, _) = everywhereOnValues id go id + go (UnaryMinus ss' val) = App (Var ss' (Qualified ByNullSourcePos (Ident C.S_negate))) val + go other = other + +{- | +An operator associated with its declaration position, fixity, and the name +of the function or data constructor it is an alias for. +-} type FixityRecord op alias = (Qualified op, SourceSpan, Fixity, Qualified alias) + type ValueFixityRecord = FixityRecord (OpName 'ValueOpName) (Either Ident (ProperName 'ConstructorName)) type TypeFixityRecord = FixityRecord (OpName 'TypeOpName) (ProperName 'TypeName) --- | --- Remove explicit parentheses and reorder binary operator applications. --- --- This pass requires name desugaring and export elaboration to have run first. --- -rebracket - :: forall m - . MonadError MultipleErrors m - => MonadSupply m - => [ExternsFile] - -> Module - -> m Module +{- | +Remove explicit parentheses and reorder binary operator applications. + +This pass requires name desugaring and export elaboration to have run first. +-} +rebracket :: + forall m. + (MonadError MultipleErrors m) => + (MonadSupply m) => + [ExternsFile] -> + Module -> + m Module rebracket = rebracketFiltered CalledByCompile (const True) --- | --- A version of `rebracket` which allows you to choose which declarations --- should be affected. This is used in docs generation, where we want to --- desugar type operators in instance declarations to ensure that instances are --- paired up with their types correctly, but we don't want to desugar type --- operators in value declarations. --- -rebracketFiltered - :: forall m - . MonadError MultipleErrors m - => MonadSupply m - => RebracketCaller - -> (Declaration -> Bool) - -> [ExternsFile] - -> Module - -> m Module +{- | +A version of `rebracket` which allows you to choose which declarations +should be affected. This is used in docs generation, where we want to +desugar type operators in instance declarations to ensure that instances are +paired up with their types correctly, but we don't want to desugar type +operators in value declarations. +-} +rebracketFiltered :: + forall m. + (MonadError MultipleErrors m) => + (MonadSupply m) => + RebracketCaller -> + (Declaration -> Bool) -> + [ExternsFile] -> + Module -> + m Module rebracketFiltered !caller pred_ externs m = do let (valueFixities, typeFixities) = - partitionEithers - $ concatMap externsFixities externs - ++ collectFixities m + partitionEithers $ + concatMap externsFixities externs + ++ collectFixities m ensureNoDuplicates' MultipleValueOpFixities valueFixities ensureNoDuplicates' MultipleTypeOpFixities typeFixities @@ -106,127 +107,126 @@ rebracketFiltered !caller pred_ externs m = do let typeOpTable = customOperatorTable' typeFixities let typeAliased = M.fromList (map makeLookupEntry typeFixities) - rebracketModule caller pred_ valueOpTable typeOpTable m >>= - renameAliasedOperators valueAliased typeAliased - + rebracketModule caller pred_ valueOpTable typeOpTable m + >>= renameAliasedOperators valueAliased typeAliased where - - ensureNoDuplicates' - :: Ord op - => (op -> SimpleErrorMessage) - -> [FixityRecord op alias] - -> m () - ensureNoDuplicates' toError = - ensureNoDuplicates toError . map (\(i, pos, _, _) -> (i, pos)) - - customOperatorTable' - :: [FixityRecord op alias] - -> [[(Qualified op, Associativity)]] - customOperatorTable' = customOperatorTable . map (\(i, _, f, _) -> (i, f)) - - makeLookupEntry :: FixityRecord op alias -> (Qualified op, Qualified alias) - makeLookupEntry (qname, _, _, alias) = (qname, alias) - - renameAliasedOperators - :: M.Map (Qualified (OpName 'ValueOpName)) (Qualified (Either Ident (ProperName 'ConstructorName))) - -> M.Map (Qualified (OpName 'TypeOpName)) (Qualified (ProperName 'TypeName)) - -> Module - -> m Module - renameAliasedOperators valueAliased typeAliased (Module ss coms mn ds exts) = - Module ss coms mn <$> mapM (usingPredicate pred_ f') ds <*> pure exts - where - (goDecl', goExpr', goBinder') = updateTypes goType - (f', _, _, _, _, _) = - everywhereWithContextOnValuesM - ss - (\_ d -> (declSourceSpan d,) <$> goDecl' d) - (\pos -> uncurry goExpr <=< goExpr' pos) - (\pos -> uncurry goBinder <=< goBinder' pos) - defS - defS - defS - - goExpr :: SourceSpan -> Expr -> m (SourceSpan, Expr) - goExpr _ e@(PositionedValue pos _ _) = return (pos, e) - goExpr _ (Op pos op) = - (pos,) <$> case op `M.lookup` valueAliased of - Just (Qualified mn' (Left alias)) -> - return $ Var pos (Qualified mn' alias) - Just (Qualified mn' (Right alias)) -> - return $ Constructor pos (Qualified mn' alias) - Nothing -> - throwError . errorMessage' pos . UnknownName $ fmap ValOpName op - goExpr pos other = return (pos, other) - - goBinder :: SourceSpan -> Binder -> m (SourceSpan, Binder) - goBinder _ b@(PositionedBinder pos _ _) = return (pos, b) - goBinder _ (BinaryNoParensBinder (OpBinder pos op) lhs rhs) = - case op `M.lookup` valueAliased of - Just (Qualified mn' (Left alias)) -> - throwError . errorMessage' pos $ InvalidOperatorInBinder op (Qualified mn' alias) - Just (Qualified mn' (Right alias)) -> - return (pos, ConstructorBinder pos (Qualified mn' alias) [lhs, rhs]) - Nothing -> - throwError . errorMessage' pos . UnknownName $ fmap ValOpName op - goBinder _ BinaryNoParensBinder{} = - internalError "BinaryNoParensBinder has no OpBinder" - goBinder pos other = return (pos, other) - - goType :: SourceSpan -> SourceType -> m SourceType - goType pos (TypeOp ann2 op) = - case op `M.lookup` typeAliased of - Just alias -> - return $ TypeConstructor ann2 alias - Nothing -> - throwError . errorMessage' pos $ UnknownName $ fmap TyOpName op - goType _ other = return other - --- | Indicates whether the `rebracketModule` --- is being called with the full desugar pass --- run via `purs compile` or whether --- only the partial desugar pass is run --- via `purs docs`. --- This indication is needed to prevent --- a `purs docs` error when using --- `case _ of` syntax in a type class instance. + ensureNoDuplicates' :: + (Ord op) => + (op -> SimpleErrorMessage) -> + [FixityRecord op alias] -> + m () + ensureNoDuplicates' toError = + ensureNoDuplicates toError . map (\(i, pos, _, _) -> (i, pos)) + + customOperatorTable' :: + [FixityRecord op alias] -> + [[(Qualified op, Associativity)]] + customOperatorTable' = customOperatorTable . map (\(i, _, f, _) -> (i, f)) + + makeLookupEntry :: FixityRecord op alias -> (Qualified op, Qualified alias) + makeLookupEntry (qname, _, _, alias) = (qname, alias) + + renameAliasedOperators :: + M.Map (Qualified (OpName 'ValueOpName)) (Qualified (Either Ident (ProperName 'ConstructorName))) -> + M.Map (Qualified (OpName 'TypeOpName)) (Qualified (ProperName 'TypeName)) -> + Module -> + m Module + renameAliasedOperators valueAliased typeAliased (Module ss coms mn ds exts) = + Module ss coms mn <$> mapM (usingPredicate pred_ f') ds <*> pure exts + where + (goDecl', goExpr', goBinder') = updateTypes goType + (f', _, _, _, _, _) = + everywhereWithContextOnValuesM + ss + (\_ d -> (declSourceSpan d,) <$> goDecl' d) + (\pos -> uncurry goExpr <=< goExpr' pos) + (\pos -> uncurry goBinder <=< goBinder' pos) + defS + defS + defS + + goExpr :: SourceSpan -> Expr -> m (SourceSpan, Expr) + goExpr _ e@(PositionedValue pos _ _) = return (pos, e) + goExpr _ (Op pos op) = + (pos,) <$> case op `M.lookup` valueAliased of + Just (Qualified mn' (Left alias)) -> + return $ Var pos (Qualified mn' alias) + Just (Qualified mn' (Right alias)) -> + return $ Constructor pos (Qualified mn' alias) + Nothing -> + throwError . errorMessage' pos . UnknownName $ fmap ValOpName op + goExpr pos other = return (pos, other) + + goBinder :: SourceSpan -> Binder -> m (SourceSpan, Binder) + goBinder _ b@(PositionedBinder pos _ _) = return (pos, b) + goBinder _ (BinaryNoParensBinder (OpBinder pos op) lhs rhs) = + case op `M.lookup` valueAliased of + Just (Qualified mn' (Left alias)) -> + throwError . errorMessage' pos $ InvalidOperatorInBinder op (Qualified mn' alias) + Just (Qualified mn' (Right alias)) -> + return (pos, ConstructorBinder pos (Qualified mn' alias) [lhs, rhs]) + Nothing -> + throwError . errorMessage' pos . UnknownName $ fmap ValOpName op + goBinder _ BinaryNoParensBinder {} = + internalError "BinaryNoParensBinder has no OpBinder" + goBinder pos other = return (pos, other) + + goType :: SourceSpan -> SourceType -> m SourceType + goType pos (TypeOp ann2 op) = + case op `M.lookup` typeAliased of + Just alias -> + return $ TypeConstructor ann2 alias + Nothing -> + throwError . errorMessage' pos $ UnknownName $ fmap TyOpName op + goType _ other = return other + +{- | Indicates whether the `rebracketModule` +is being called with the full desugar pass +run via `purs compile` or whether +only the partial desugar pass is run +via `purs docs`. +This indication is needed to prevent +a `purs docs` error when using +`case _ of` syntax in a type class instance. +-} data RebracketCaller = CalledByCompile | CalledByDocs deriving (Eq, Show) -rebracketModule - :: forall m - . (MonadError MultipleErrors m) - => MonadSupply m - => RebracketCaller - -> (Declaration -> Bool) - -> [[(Qualified (OpName 'ValueOpName), Associativity)]] - -> [[(Qualified (OpName 'TypeOpName), Associativity)]] - -> Module - -> m Module +rebracketModule :: + forall m. + (MonadError MultipleErrors m) => + (MonadSupply m) => + RebracketCaller -> + (Declaration -> Bool) -> + [[(Qualified (OpName 'ValueOpName), Associativity)]] -> + [[(Qualified (OpName 'TypeOpName), Associativity)]] -> + Module -> + m Module rebracketModule !caller pred_ valueOpTable typeOpTable (Module ss coms mn ds exts) = Module ss coms mn <$> f' ds <*> pure exts where - f' :: [Declaration] -> m [Declaration] - f' = - fmap (map (\d -> if pred_ d then removeParens d else d)) . - flip parU (usingPredicate pred_ h) - - -- The AST will run through all the desugar passes when compiling - -- and only some of the desugar passes when generating docs. - -- When generating docs, `case _ of` syntax used in an instance declaration - -- can trigger the `IncorrectAnonymousArgument` error because it does not - -- run the same passes that the compile desugaring does. Since `purs docs` - -- will only succeed once `purs compile` succeeds, we can ignore this check - -- when running `purs docs`. - -- See https://github.com/purescript/purescript/issues/4274#issuecomment-1087730651= - -- for more info. - h :: Declaration -> m Declaration - h = case caller of - CalledByDocs -> f - CalledByCompile -> g <=< f - - (f, _, _, _, _, _) = + f' :: [Declaration] -> m [Declaration] + f' = + fmap (map (\d -> if pred_ d then removeParens d else d)) + . flip parU (usingPredicate pred_ h) + + -- The AST will run through all the desugar passes when compiling + -- and only some of the desugar passes when generating docs. + -- When generating docs, `case _ of` syntax used in an instance declaration + -- can trigger the `IncorrectAnonymousArgument` error because it does not + -- run the same passes that the compile desugaring does. Since `purs docs` + -- will only succeed once `purs compile` succeeds, we can ignore this check + -- when running `purs docs`. + -- See https://github.com/purescript/purescript/issues/4274#issuecomment-1087730651= + -- for more info. + h :: Declaration -> m Declaration + h = case caller of + CalledByDocs -> f + CalledByCompile -> g <=< f + + (f, _, _, _, _, _) = everywhereWithContextOnValuesM ss (\_ d -> (declSourceSpan d,) <$> goDecl d) @@ -236,27 +236,30 @@ rebracketModule !caller pred_ valueOpTable typeOpTable (Module ss coms mn ds ext defS defS - (g, _, _) = everywhereOnValuesTopDownM pure removeBinaryNoParens pure + (g, _, _) = everywhereOnValuesTopDownM pure removeBinaryNoParens pure - (goDecl, goExpr', goBinder') = updateTypes goType + (goDecl, goExpr', goBinder') = updateTypes goType - goType :: SourceSpan -> SourceType -> m SourceType - goType = flip matchTypeOperators typeOpTable + goType :: SourceSpan -> SourceType -> m SourceType + goType = flip matchTypeOperators typeOpTable - wrap :: (a -> m a) -> (SourceSpan, a) -> m (SourceSpan, a) - wrap go (ss', a) = (ss',) <$> go a + wrap :: (a -> m a) -> (SourceSpan, a) -> m (SourceSpan, a) + wrap go (ss', a) = (ss',) <$> go a removeBinaryNoParens :: (MonadError MultipleErrors m, MonadSupply m) => Expr -> m Expr removeBinaryNoParens u | isAnonymousArgument u = case u of - PositionedValue p _ _ -> rethrowWithPosition p err - _ -> err - where err = throwError . errorMessage $ IncorrectAnonymousArgument + PositionedValue p _ _ -> rethrowWithPosition p err + _ -> err + where + err = throwError . errorMessage $ IncorrectAnonymousArgument removeBinaryNoParens (Parens (stripPositionInfo -> BinaryNoParens op l r)) - | isAnonymousArgument r = do arg <- freshIdent' - return $ Abs (VarBinder nullSourceSpan arg) $ App (App op l) (Var nullSourceSpan (Qualified ByNullSourcePos arg)) - | isAnonymousArgument l = do arg <- freshIdent' - return $ Abs (VarBinder nullSourceSpan arg) $ App (App op (Var nullSourceSpan (Qualified ByNullSourcePos arg))) r + | isAnonymousArgument r = do + arg <- freshIdent' + return $ Abs (VarBinder nullSourceSpan arg) $ App (App op l) (Var nullSourceSpan (Qualified ByNullSourcePos arg)) + | isAnonymousArgument l = do + arg <- freshIdent' + return $ Abs (VarBinder nullSourceSpan arg) $ App (App op (Var nullSourceSpan (Qualified ByNullSourcePos arg))) r removeBinaryNoParens (BinaryNoParens op l r) = return $ App (App op l) r removeBinaryNoParens e = return e @@ -267,227 +270,230 @@ stripPositionInfo e = e removeParens :: Declaration -> Declaration removeParens = f where - (f, _, _) = + (f, _, _) = everywhereOnValues (runIdentity . goDecl) (goExpr . decontextify goExpr') (goBinder . decontextify goBinder') - (goDecl, goExpr', goBinder') = updateTypes (\_ -> return . goType) + (goDecl, goExpr', goBinder') = updateTypes (\_ -> return . goType) - goExpr :: Expr -> Expr - goExpr (Parens val) = goExpr val - goExpr val = val + goExpr :: Expr -> Expr + goExpr (Parens val) = goExpr val + goExpr val = val - goBinder :: Binder -> Binder - goBinder (ParensInBinder b) = goBinder b - goBinder b = b + goBinder :: Binder -> Binder + goBinder (ParensInBinder b) = goBinder b + goBinder b = b - goType :: Type a -> Type a - goType (ParensInType _ t) = goType t - goType t = t + goType :: Type a -> Type a + goType (ParensInType _ t) = goType t + goType t = t - decontextify - :: (SourceSpan -> a -> Identity (SourceSpan, a)) - -> a - -> a - decontextify ctxf = snd . runIdentity . ctxf (internalError "attempted to use SourceSpan in removeParens") + decontextify :: + (SourceSpan -> a -> Identity (SourceSpan, a)) -> + a -> + a + decontextify ctxf = snd . runIdentity . ctxf (internalError "attempted to use SourceSpan in removeParens") externsFixities :: ExternsFile -> [Either ValueFixityRecord TypeFixityRecord] -externsFixities ExternsFile{..} = +externsFixities ExternsFile {..} = map fromFixity efFixities ++ map fromTypeFixity efTypeFixities where - - fromFixity - :: ExternsFixity - -> Either ValueFixityRecord TypeFixityRecord - fromFixity (ExternsFixity assoc prec op name) = - Left - ( Qualified (ByModuleName efModuleName) op - , internalModuleSourceSpan "" - , Fixity assoc prec - , name - ) - - fromTypeFixity - :: ExternsTypeFixity - -> Either ValueFixityRecord TypeFixityRecord - fromTypeFixity (ExternsTypeFixity assoc prec op name) = - Right - ( Qualified (ByModuleName efModuleName) op - , internalModuleSourceSpan "" - , Fixity assoc prec - , name - ) + fromFixity :: + ExternsFixity -> + Either ValueFixityRecord TypeFixityRecord + fromFixity (ExternsFixity assoc prec op name) = + Left + ( Qualified (ByModuleName efModuleName) op + , internalModuleSourceSpan "" + , Fixity assoc prec + , name + ) + + fromTypeFixity :: + ExternsTypeFixity -> + Either ValueFixityRecord TypeFixityRecord + fromTypeFixity (ExternsTypeFixity assoc prec op name) = + Right + ( Qualified (ByModuleName efModuleName) op + , internalModuleSourceSpan "" + , Fixity assoc prec + , name + ) collectFixities :: Module -> [Either ValueFixityRecord TypeFixityRecord] collectFixities (Module _ _ moduleName ds _) = concatMap collect ds where - collect :: Declaration -> [Either ValueFixityRecord TypeFixityRecord] - collect (ValueFixityDeclaration (ss, _) fixity name op) = - [Left (Qualified (ByModuleName moduleName) op, ss, fixity, name)] - collect (TypeFixityDeclaration (ss, _) fixity name op) = - [Right (Qualified (ByModuleName moduleName) op, ss, fixity, name)] - collect _ = [] - -ensureNoDuplicates - :: (Ord a, MonadError MultipleErrors m) - => (a -> SimpleErrorMessage) - -> [(Qualified a, SourceSpan)] - -> m () + collect :: Declaration -> [Either ValueFixityRecord TypeFixityRecord] + collect (ValueFixityDeclaration (ss, _) fixity name op) = + [Left (Qualified (ByModuleName moduleName) op, ss, fixity, name)] + collect (TypeFixityDeclaration (ss, _) fixity name op) = + [Right (Qualified (ByModuleName moduleName) op, ss, fixity, name)] + collect _ = [] + +ensureNoDuplicates :: + (Ord a, MonadError MultipleErrors m) => + (a -> SimpleErrorMessage) -> + [(Qualified a, SourceSpan)] -> + m () ensureNoDuplicates toError m = go $ sortOn fst m where - go [] = return () - go [_] = return () - go ((x@(Qualified (ByModuleName mn) op), _) : (y, pos) : _) | x == y = - rethrow (addHint (ErrorInModule mn)) $ - rethrowWithPosition pos $ throwError . errorMessage $ toError op - go (_ : rest) = go rest - -customOperatorTable - :: [(Qualified op, Fixity)] - -> [[(Qualified op, Associativity)]] + go [] = return () + go [_] = return () + go ((x@(Qualified (ByModuleName mn) op), _) : (y, pos) : _) + | x == y = + rethrow (addHint (ErrorInModule mn)) $ + rethrowWithPosition pos $ + throwError . errorMessage $ + toError op + go (_ : rest) = go rest + +customOperatorTable :: + [(Qualified op, Fixity)] -> + [[(Qualified op, Associativity)]] customOperatorTable fixities = let userOps = map (\(name, Fixity a p) -> (name, p, a)) fixities sorted = sortOn (Down . (\(_, p, _) -> p)) userOps groups = groupBy ((==) `on` (\(_, p, _) -> p)) sorted - in + in map (map (\(name, _, a) -> (name, a))) groups -updateTypes - :: forall m - . Monad m - => (SourceSpan -> SourceType -> m SourceType) - -> ( Declaration -> m Declaration - , SourceSpan -> Expr -> m (SourceSpan, Expr) - , SourceSpan -> Binder -> m (SourceSpan, Binder) - ) +updateTypes :: + forall m. + (Monad m) => + (SourceSpan -> SourceType -> m SourceType) -> + ( Declaration -> m Declaration + , SourceSpan -> Expr -> m (SourceSpan, Expr) + , SourceSpan -> Binder -> m (SourceSpan, Binder) + ) updateTypes goType = (goDecl, goExpr, goBinder) where + goType' :: SourceSpan -> SourceType -> m SourceType + goType' = everywhereOnTypesTopDownM . goType + + goDecl :: Declaration -> m Declaration + goDecl (DataDeclaration sa@(ss, _) ddt name args dctors) = + DataDeclaration sa ddt name + <$> traverse (traverse (goType' ss)) args + <*> traverse (traverseDataCtorFields (traverse (sndM (goType' ss)))) dctors + goDecl (ExternDeclaration sa@(ss, _) name ty) = + ExternDeclaration sa name <$> goType' ss ty + goDecl (TypeClassDeclaration sa@(ss, _) name args implies deps decls) = do + implies' <- traverse (overConstraintArgs (traverse (goType' ss))) implies + args' <- traverse (traverse (goType' ss)) args + return $ TypeClassDeclaration sa name args' implies' deps decls + goDecl (TypeInstanceDeclaration sa@(ss, _) na ch idx name cs className tys impls) = do + cs' <- traverse (overConstraintArgs (traverse (goType' ss))) cs + tys' <- traverse (goType' ss) tys + return $ TypeInstanceDeclaration sa na ch idx name cs' className tys' impls + goDecl (TypeSynonymDeclaration sa@(ss, _) name args ty) = + TypeSynonymDeclaration sa name + <$> traverse (traverse (goType' ss)) args + <*> goType' ss ty + goDecl (TypeDeclaration (TypeDeclarationData sa@(ss, _) expr ty)) = + TypeDeclaration . TypeDeclarationData sa expr <$> goType' ss ty + goDecl (KindDeclaration sa@(ss, _) sigFor name ty) = + KindDeclaration sa sigFor name <$> goType' ss ty + goDecl (ExternDataDeclaration sa@(ss, _) name ty) = + ExternDataDeclaration sa name <$> goType' ss ty + goDecl other = + return other + + goExpr :: SourceSpan -> Expr -> m (SourceSpan, Expr) + goExpr _ e@(PositionedValue pos _ _) = return (pos, e) + goExpr pos (TypeClassDictionary (Constraint ann name kinds tys info) dicts hints) = do + kinds' <- traverse (goType' pos) kinds + tys' <- traverse (goType' pos) tys + return (pos, TypeClassDictionary (Constraint ann name kinds' tys' info) dicts hints) + goExpr pos (DeferredDictionary cls tys) = do + tys' <- traverse (goType' pos) tys + return (pos, DeferredDictionary cls tys') + goExpr pos (TypedValue check v ty) = do + ty' <- goType' pos ty + return (pos, TypedValue check v ty') + goExpr pos other = return (pos, other) - goType' :: SourceSpan -> SourceType -> m SourceType - goType' = everywhereOnTypesTopDownM . goType - - goDecl :: Declaration -> m Declaration - goDecl (DataDeclaration sa@(ss, _) ddt name args dctors) = - DataDeclaration sa ddt name - <$> traverse (traverse (traverse (goType' ss))) args - <*> traverse (traverseDataCtorFields (traverse (sndM (goType' ss)))) dctors - goDecl (ExternDeclaration sa@(ss, _) name ty) = - ExternDeclaration sa name <$> goType' ss ty - goDecl (TypeClassDeclaration sa@(ss, _) name args implies deps decls) = do - implies' <- traverse (overConstraintArgs (traverse (goType' ss))) implies - args' <- traverse (traverse (traverse (goType' ss))) args - return $ TypeClassDeclaration sa name args' implies' deps decls - goDecl (TypeInstanceDeclaration sa@(ss, _) na ch idx name cs className tys impls) = do - cs' <- traverse (overConstraintArgs (traverse (goType' ss))) cs - tys' <- traverse (goType' ss) tys - return $ TypeInstanceDeclaration sa na ch idx name cs' className tys' impls - goDecl (TypeSynonymDeclaration sa@(ss, _) name args ty) = - TypeSynonymDeclaration sa name - <$> traverse (traverse (traverse (goType' ss))) args - <*> goType' ss ty - goDecl (TypeDeclaration (TypeDeclarationData sa@(ss, _) expr ty)) = - TypeDeclaration . TypeDeclarationData sa expr <$> goType' ss ty - goDecl (KindDeclaration sa@(ss, _) sigFor name ty) = - KindDeclaration sa sigFor name <$> goType' ss ty - goDecl (ExternDataDeclaration sa@(ss, _) name ty) = - ExternDataDeclaration sa name <$> goType' ss ty - goDecl other = - return other - - goExpr :: SourceSpan -> Expr -> m (SourceSpan, Expr) - goExpr _ e@(PositionedValue pos _ _) = return (pos, e) - goExpr pos (TypeClassDictionary (Constraint ann name kinds tys info) dicts hints) = do - kinds' <- traverse (goType' pos) kinds - tys' <- traverse (goType' pos) tys - return (pos, TypeClassDictionary (Constraint ann name kinds' tys' info) dicts hints) - goExpr pos (DeferredDictionary cls tys) = do - tys' <- traverse (goType' pos) tys - return (pos, DeferredDictionary cls tys') - goExpr pos (TypedValue check v ty) = do - ty' <- goType' pos ty - return (pos, TypedValue check v ty') - goExpr pos other = return (pos, other) - - goBinder :: SourceSpan -> Binder -> m (SourceSpan, Binder) - goBinder _ e@(PositionedBinder pos _ _) = return (pos, e) - goBinder pos (TypedBinder ty b) = do - ty' <- goType' pos ty - return (pos, TypedBinder ty' b) - goBinder pos other = return (pos, other) - --- | --- Checks all the fixity exports within a module to ensure that members aliased --- by the operators are also exported from the module. --- --- This pass requires name desugaring and export elaboration to have run first. --- -checkFixityExports - :: forall m - . MonadError MultipleErrors m - => Module - -> m Module + goBinder :: SourceSpan -> Binder -> m (SourceSpan, Binder) + goBinder _ e@(PositionedBinder pos _ _) = return (pos, e) + goBinder pos (TypedBinder ty b) = do + ty' <- goType' pos ty + return (pos, TypedBinder ty' b) + goBinder pos other = return (pos, other) + +{- | +Checks all the fixity exports within a module to ensure that members aliased +by the operators are also exported from the module. + +This pass requires name desugaring and export elaboration to have run first. +-} +checkFixityExports :: + forall m. + (MonadError MultipleErrors m) => + Module -> + m Module checkFixityExports (Module _ _ _ _ Nothing) = internalError "exports should have been elaborated before checkFixityExports" checkFixityExports m@(Module ss _ mn ds (Just exps)) = - rethrow (addHint (ErrorInModule mn)) - $ rethrowWithPosition ss (traverse_ checkRef exps) - $> m + rethrow (addHint (ErrorInModule mn)) $ + rethrowWithPosition ss (traverse_ checkRef exps) + $> m where - - checkRef :: DeclarationRef -> m () - checkRef dr@(ValueOpRef ss' op) = - for_ (getValueOpAlias op) $ \case - Left ident -> - unless (ValueRef ss' ident `elem` exps) - . throwError . errorMessage' ss' - $ TransitiveExportError dr [ValueRef ss' ident] - Right ctor -> - unless (anyTypeRef (maybe False (elem ctor) . snd)) - . throwError . errorMessage' ss - $ TransitiveDctorExportError dr [ctor] - checkRef dr@(TypeOpRef ss' op) = - for_ (getTypeOpAlias op) $ \ty -> - unless (anyTypeRef ((== ty) . fst)) - . throwError . errorMessage' ss' - $ TransitiveExportError dr [TypeRef ss' ty Nothing] - checkRef _ = return () - - -- Finds the name associated with a type operator when that type is also - -- defined in the current module. - getTypeOpAlias :: OpName 'TypeOpName -> Maybe (ProperName 'TypeName) - getTypeOpAlias op = - listToMaybe (mapMaybe (either (const Nothing) go <=< getFixityDecl) ds) - where - go (TypeFixity _ (Qualified (ByModuleName mn') ident) op') - | mn == mn' && op == op' = Just ident - go _ = Nothing - - -- Finds the value or data constructor associated with an operator when that - -- declaration is also in the current module. - getValueOpAlias - :: OpName 'ValueOpName - -> Maybe (Either Ident (ProperName 'ConstructorName)) - getValueOpAlias op = - listToMaybe (mapMaybe (either go (const Nothing) <=< getFixityDecl) ds) - where - go (ValueFixity _ (Qualified (ByModuleName mn') ident) op') - | mn == mn' && op == op' = Just ident - go _ = Nothing - - -- Tests the exported `TypeRef` entries with a predicate. - anyTypeRef - :: ((ProperName 'TypeName, Maybe [ProperName 'ConstructorName]) -> Bool) - -> Bool - anyTypeRef f = any (maybe False f . getTypeRef) exps - -usingPredicate - :: forall f a - . Applicative f - => (a -> Bool) - -> (a -> f a) - -> (a -> f a) + checkRef :: DeclarationRef -> m () + checkRef dr@(ValueOpRef ss' op) = + for_ (getValueOpAlias op) $ \case + Left ident -> + unless (ValueRef ss' ident `elem` exps) + . throwError + . errorMessage' ss' + $ TransitiveExportError dr [ValueRef ss' ident] + Right ctor -> + unless (anyTypeRef (maybe False (elem ctor) . snd)) + . throwError + . errorMessage' ss + $ TransitiveDctorExportError dr [ctor] + checkRef dr@(TypeOpRef ss' op) = + for_ (getTypeOpAlias op) $ \ty -> + unless (anyTypeRef ((== ty) . fst)) + . throwError + . errorMessage' ss' + $ TransitiveExportError dr [TypeRef ss' ty Nothing] + checkRef _ = return () + + -- Finds the name associated with a type operator when that type is also + -- defined in the current module. + getTypeOpAlias :: OpName 'TypeOpName -> Maybe (ProperName 'TypeName) + getTypeOpAlias op = + listToMaybe (mapMaybe (either (const Nothing) go <=< getFixityDecl) ds) + where + go (TypeFixity _ (Qualified (ByModuleName mn') ident) op') + | mn == mn' && op == op' = Just ident + go _ = Nothing + + -- Finds the value or data constructor associated with an operator when that + -- declaration is also in the current module. + getValueOpAlias :: + OpName 'ValueOpName -> + Maybe (Either Ident (ProperName 'ConstructorName)) + getValueOpAlias op = + listToMaybe (mapMaybe (either go (const Nothing) <=< getFixityDecl) ds) + where + go (ValueFixity _ (Qualified (ByModuleName mn') ident) op') + | mn == mn' && op == op' = Just ident + go _ = Nothing + + -- Tests the exported `TypeRef` entries with a predicate. + anyTypeRef :: + ((ProperName 'TypeName, Maybe [ProperName 'ConstructorName]) -> Bool) -> + Bool + anyTypeRef f = any (maybe False f . getTypeRef) exps + +usingPredicate :: + forall f a. + (Applicative f) => + (a -> Bool) -> + (a -> f a) -> + (a -> f a) usingPredicate p f x = if p x then f x else pure x diff --git a/src/Language/PureScript/Sugar/Operators/Binders.hs b/src/Language/PureScript/Sugar/Operators/Binders.hs index 29725c711..ef0dfcc81 100644 --- a/src/Language/PureScript/Sugar/Operators/Binders.hs +++ b/src/Language/PureScript/Sugar/Operators/Binders.hs @@ -4,30 +4,29 @@ import Prelude import Control.Monad.Except (MonadError) -import Language.PureScript.AST (Associativity, Binder(..), SourceSpan) +import Language.PureScript.AST (Associativity, Binder (..), SourceSpan) import Language.PureScript.Errors (MultipleErrors) -import Language.PureScript.Names (OpName(..), OpNameType(..), Qualified(..)) +import Language.PureScript.Names (OpName (..), OpNameType (..), Qualified (..)) import Language.PureScript.Sugar.Operators.Common (matchOperators) -matchBinderOperators - :: MonadError MultipleErrors m - => [[(Qualified (OpName 'ValueOpName), Associativity)]] - -> Binder - -> m Binder +matchBinderOperators :: + (MonadError MultipleErrors m) => + [[(Qualified (OpName 'ValueOpName), Associativity)]] -> + Binder -> + m Binder matchBinderOperators = matchOperators isBinOp extractOp fromOp reapply id where + isBinOp :: Binder -> Bool + isBinOp BinaryNoParensBinder {} = True + isBinOp _ = False - isBinOp :: Binder -> Bool - isBinOp BinaryNoParensBinder{} = True - isBinOp _ = False + extractOp :: Binder -> Maybe (Binder, Binder, Binder) + extractOp (BinaryNoParensBinder op l r) = Just (op, l, r) + extractOp _ = Nothing - extractOp :: Binder -> Maybe (Binder, Binder, Binder) - extractOp (BinaryNoParensBinder op l r) = Just (op, l, r) - extractOp _ = Nothing + fromOp :: Binder -> Maybe (SourceSpan, Qualified (OpName 'ValueOpName)) + fromOp (OpBinder ss q@(Qualified _ (OpName _))) = Just (ss, q) + fromOp _ = Nothing - fromOp :: Binder -> Maybe (SourceSpan, Qualified (OpName 'ValueOpName)) - fromOp (OpBinder ss q@(Qualified _ (OpName _))) = Just (ss, q) - fromOp _ = Nothing - - reapply :: SourceSpan -> Qualified (OpName 'ValueOpName) -> Binder -> Binder -> Binder - reapply ss = BinaryNoParensBinder . OpBinder ss + reapply :: SourceSpan -> Qualified (OpName 'ValueOpName) -> Binder -> Binder -> Binder + reapply ss = BinaryNoParensBinder . OpBinder ss diff --git a/src/Language/PureScript/Sugar/Operators/Common.hs b/src/Language/PureScript/Sugar/Operators/Common.hs index 1a18f8801..40b814c62 100644 --- a/src/Language/PureScript/Sugar/Operators/Common.hs +++ b/src/Language/PureScript/Sugar/Operators/Common.hs @@ -2,23 +2,23 @@ module Language.PureScript.Sugar.Operators.Common where import Prelude +import Control.Monad.Except (MonadError (..)) import Control.Monad.State (guard, join) -import Control.Monad.Except (MonadError(..)) import Data.Either (rights) import Data.Functor.Identity (Identity) import Data.List (sortOn) -import Data.Maybe (mapMaybe, fromJust) import Data.List.NonEmpty qualified as NEL import Data.Map qualified as M +import Data.Maybe (fromJust, mapMaybe) import Text.Parsec qualified as P -import Text.Parsec.Pos qualified as P import Text.Parsec.Expr qualified as P +import Text.Parsec.Pos qualified as P -import Language.PureScript.AST (Associativity(..), ErrorMessageHint(..), SourceSpan) +import Language.PureScript.AST (Associativity (..), ErrorMessageHint (..), SourceSpan) import Language.PureScript.Crash (internalError) -import Language.PureScript.Errors (ErrorMessage(..), MultipleErrors(..), SimpleErrorMessage(..)) +import Language.PureScript.Errors (ErrorMessage (..), MultipleErrors (..), SimpleErrorMessage (..)) import Language.PureScript.Names (OpName, Qualified, eraseOpName) type Chain a = [Either a a] @@ -29,7 +29,7 @@ type Reapply nameType a = SourceSpan -> Qualified (OpName nameType) -> a -> a -> toAssoc :: Associativity -> P.Assoc toAssoc Infixl = P.AssocLeft toAssoc Infixr = P.AssocRight -toAssoc Infix = P.AssocNone +toAssoc Infix = P.AssocNone token :: (P.Stream s Identity t) => (t -> Maybe a) -> P.Parsec s u a token = P.token (const "") (const (P.initialPos "")) @@ -37,108 +37,114 @@ token = P.token (const "") (const (P.initialPos "")) parseValue :: P.Parsec (Chain a) () a parseValue = token (either Just (const Nothing)) P. "expression" -parseOp - :: FromOp nameType a - -> P.Parsec (Chain a) () (SourceSpan, Qualified (OpName nameType)) +parseOp :: + FromOp nameType a -> + P.Parsec (Chain a) () (SourceSpan, Qualified (OpName nameType)) parseOp fromOp = token (either (const Nothing) fromOp) P. "operator" -matchOp - :: FromOp nameType a - -> Qualified (OpName nameType) - -> P.Parsec (Chain a) () SourceSpan +matchOp :: + FromOp nameType a -> + Qualified (OpName nameType) -> + P.Parsec (Chain a) () SourceSpan matchOp fromOp op = do (ss, ident) <- parseOp fromOp guard $ ident == op pure ss -opTable - :: [[(Qualified (OpName nameType), Associativity)]] - -> FromOp nameType a - -> Reapply nameType a - -> [[P.Operator (Chain a) () Identity a]] +opTable :: + [[(Qualified (OpName nameType), Associativity)]] -> + FromOp nameType a -> + Reapply nameType a -> + [[P.Operator (Chain a) () Identity a]] opTable ops fromOp reapply = map (map (\(name, a) -> P.Infix (P.try (matchOp fromOp name) >>= \ss -> return (reapply ss name)) (toAssoc a))) ops -matchOperators - :: forall m a nameType - . Show a - => MonadError MultipleErrors m - => (a -> Bool) - -> (a -> Maybe (a, a, a)) - -> FromOp nameType a - -> Reapply nameType a - -> ([[P.Operator (Chain a) () Identity a]] -> P.OperatorTable (Chain a) () Identity a) - -> [[(Qualified (OpName nameType), Associativity)]] - -> a - -> m a +matchOperators :: + forall m a nameType. + (Show a) => + (MonadError MultipleErrors m) => + (a -> Bool) -> + (a -> Maybe (a, a, a)) -> + FromOp nameType a -> + Reapply nameType a -> + ([[P.Operator (Chain a) () Identity a]] -> P.OperatorTable (Chain a) () Identity a) -> + [[(Qualified (OpName nameType), Associativity)]] -> + a -> + m a matchOperators isBinOp extractOp fromOp reapply modOpTable ops = parseChains where - parseChains :: a -> m a - parseChains ty - | True <- isBinOp ty = bracketChain (extendChain ty) - | otherwise = pure ty - extendChain :: a -> Chain a - extendChain ty - | Just (op, l, r) <- extractOp ty = Left l : Right op : extendChain r - | otherwise = [Left ty] - bracketChain :: Chain a -> m a - bracketChain chain = - case P.parse opParser "operator expression" chain of - Right a -> pure a - Left _ -> throwError . MultipleErrors $ mkErrors chain - opParser :: P.Parsec (Chain a) () a - opParser = P.buildExpressionParser (modOpTable (opTable ops fromOp reapply)) parseValue <* P.eof - - -- Generating a good error message involves a bit of work here, as the parser - -- can't provide one for us. - -- - -- We examine the expression chain, plucking out the operators and then - -- grouping them by shared precedence, then if any of the following conditions - -- are met, we have something to report: - -- 1. any of the groups have mixed associativity - -- 2. there is more than one occurrence of a non-associative operator in a - -- precedence group - mkErrors :: Chain a -> [ErrorMessage] - mkErrors chain = - let - opInfo :: M.Map (Qualified (OpName nameType)) (Integer, Associativity) - opInfo = M.fromList $ concatMap (\(n, o) -> map (\(name, assoc) -> (name, (n, assoc))) o) (zip [0..] ops) - opPrec :: Qualified (OpName nameType) -> Integer - opPrec = fst . fromJust . flip M.lookup opInfo - opAssoc :: Qualified (OpName nameType) -> Associativity - opAssoc = snd . fromJust . flip M.lookup opInfo - chainOpSpans :: M.Map (Qualified (OpName nameType)) (NEL.NonEmpty SourceSpan) - chainOpSpans = foldr (\(ss, name) -> M.alter (Just . maybe (pure ss) (NEL.cons ss)) name) M.empty . mapMaybe fromOp $ rights chain - opUsages :: Qualified (OpName nameType) -> Int - opUsages = maybe 0 NEL.length . flip M.lookup chainOpSpans - precGrouped :: [NEL.NonEmpty (Qualified (OpName nameType))] - precGrouped = NEL.groupWith opPrec . sortOn opPrec $ M.keys chainOpSpans - assocGrouped :: [NEL.NonEmpty (NEL.NonEmpty (Qualified (OpName nameType)))] - assocGrouped = fmap (NEL.groupWith1 opAssoc . NEL.sortWith opAssoc) precGrouped - mixedAssoc :: [NEL.NonEmpty (Qualified (OpName nameType))] - mixedAssoc = fmap join . filter (\precGroup -> NEL.length precGroup > 1) $ assocGrouped - nonAssoc :: [NEL.NonEmpty (Qualified (OpName nameType))] - nonAssoc = NEL.filter (\assocGroup -> opAssoc (NEL.head assocGroup) == Infix && sum (fmap opUsages assocGroup) > 1) =<< assocGrouped - in - if null (nonAssoc ++ mixedAssoc) - then internalError "matchOperators: cannot reorder operators" - else - map - (\grp -> - mkPositionedError chainOpSpans grp - (MixedAssociativityError (fmap (\name -> (eraseOpName <$> name, opAssoc name)) grp))) - mixedAssoc - ++ map - (\grp -> - mkPositionedError chainOpSpans grp - (NonAssociativeError (fmap (fmap eraseOpName) grp))) - nonAssoc - - mkPositionedError - :: M.Map (Qualified (OpName nameType)) (NEL.NonEmpty SourceSpan) - -> NEL.NonEmpty (Qualified (OpName nameType)) - -> SimpleErrorMessage - -> ErrorMessage - mkPositionedError chainOpSpans grp = - ErrorMessage - [PositionedError (fromJust . flip M.lookup chainOpSpans =<< grp)] + parseChains :: a -> m a + parseChains ty + | True <- isBinOp ty = bracketChain (extendChain ty) + | otherwise = pure ty + extendChain :: a -> Chain a + extendChain ty + | Just (op, l, r) <- extractOp ty = Left l : Right op : extendChain r + | otherwise = [Left ty] + bracketChain :: Chain a -> m a + bracketChain chain = + case P.parse opParser "operator expression" chain of + Right a -> pure a + Left _ -> throwError . MultipleErrors $ mkErrors chain + opParser :: P.Parsec (Chain a) () a + opParser = P.buildExpressionParser (modOpTable (opTable ops fromOp reapply)) parseValue <* P.eof + + -- Generating a good error message involves a bit of work here, as the parser + -- can't provide one for us. + -- + -- We examine the expression chain, plucking out the operators and then + -- grouping them by shared precedence, then if any of the following conditions + -- are met, we have something to report: + -- 1. any of the groups have mixed associativity + -- 2. there is more than one occurrence of a non-associative operator in a + -- precedence group + mkErrors :: Chain a -> [ErrorMessage] + mkErrors chain = + let + opInfo :: M.Map (Qualified (OpName nameType)) (Integer, Associativity) + opInfo = M.fromList $ concatMap (\(n, o) -> map (\(name, assoc) -> (name, (n, assoc))) o) (zip [0 ..] ops) + opPrec :: Qualified (OpName nameType) -> Integer + opPrec = fst . fromJust . flip M.lookup opInfo + opAssoc :: Qualified (OpName nameType) -> Associativity + opAssoc = snd . fromJust . flip M.lookup opInfo + chainOpSpans :: M.Map (Qualified (OpName nameType)) (NEL.NonEmpty SourceSpan) + chainOpSpans = foldr (\(ss, name) -> M.alter (Just . maybe (pure ss) (NEL.cons ss)) name) M.empty . mapMaybe fromOp $ rights chain + opUsages :: Qualified (OpName nameType) -> Int + opUsages = maybe 0 NEL.length . flip M.lookup chainOpSpans + precGrouped :: [NEL.NonEmpty (Qualified (OpName nameType))] + precGrouped = NEL.groupWith opPrec . sortOn opPrec $ M.keys chainOpSpans + assocGrouped :: [NEL.NonEmpty (NEL.NonEmpty (Qualified (OpName nameType)))] + assocGrouped = fmap (NEL.groupWith1 opAssoc . NEL.sortWith opAssoc) precGrouped + mixedAssoc :: [NEL.NonEmpty (Qualified (OpName nameType))] + mixedAssoc = fmap join . filter (\precGroup -> NEL.length precGroup > 1) $ assocGrouped + nonAssoc :: [NEL.NonEmpty (Qualified (OpName nameType))] + nonAssoc = NEL.filter (\assocGroup -> opAssoc (NEL.head assocGroup) == Infix && sum (fmap opUsages assocGroup) > 1) =<< assocGrouped + in + if null (nonAssoc ++ mixedAssoc) + then internalError "matchOperators: cannot reorder operators" + else + map + ( \grp -> + mkPositionedError + chainOpSpans + grp + (MixedAssociativityError (fmap (\name -> (eraseOpName <$> name, opAssoc name)) grp)) + ) + mixedAssoc + ++ map + ( \grp -> + mkPositionedError + chainOpSpans + grp + (NonAssociativeError (fmap (fmap eraseOpName) grp)) + ) + nonAssoc + + mkPositionedError :: + M.Map (Qualified (OpName nameType)) (NEL.NonEmpty SourceSpan) -> + NEL.NonEmpty (Qualified (OpName nameType)) -> + SimpleErrorMessage -> + ErrorMessage + mkPositionedError chainOpSpans grp = + ErrorMessage + [PositionedError (fromJust . flip M.lookup chainOpSpans =<< grp)] diff --git a/src/Language/PureScript/Sugar/Operators/Expr.hs b/src/Language/PureScript/Sugar/Operators/Expr.hs index 0815eb161..ae25d11d0 100644 --- a/src/Language/PureScript/Sugar/Operators/Expr.hs +++ b/src/Language/PureScript/Sugar/Operators/Expr.hs @@ -8,45 +8,44 @@ import Data.Functor.Identity (Identity) import Text.Parsec qualified as P import Text.Parsec.Expr qualified as P -import Language.PureScript.AST (Associativity, Expr(..), SourceSpan) -import Language.PureScript.Names (OpName(..), OpNameType(..), Qualified(..)) -import Language.PureScript.Sugar.Operators.Common (Chain, matchOperators, token) +import Language.PureScript.AST (Associativity, Expr (..), SourceSpan) import Language.PureScript.Errors (MultipleErrors) +import Language.PureScript.Names (OpName (..), OpNameType (..), Qualified (..)) +import Language.PureScript.Sugar.Operators.Common (Chain, matchOperators, token) -matchExprOperators - :: MonadError MultipleErrors m - => [[(Qualified (OpName 'ValueOpName), Associativity)]] - -> Expr - -> m Expr +matchExprOperators :: + (MonadError MultipleErrors m) => + [[(Qualified (OpName 'ValueOpName), Associativity)]] -> + Expr -> + m Expr matchExprOperators = matchOperators isBinOp extractOp fromOp reapply modOpTable where - - isBinOp :: Expr -> Bool - isBinOp BinaryNoParens{} = True - isBinOp _ = False - - extractOp :: Expr -> Maybe (Expr, Expr, Expr) - extractOp (BinaryNoParens op l r) - | PositionedValue _ _ op' <- op = Just (op', l, r) - | otherwise = Just (op, l, r) - extractOp _ = Nothing - - fromOp :: Expr -> Maybe (SourceSpan, Qualified (OpName 'ValueOpName)) - fromOp (Op ss q@(Qualified _ (OpName _))) = Just (ss, q) - fromOp _ = Nothing - - reapply :: SourceSpan -> Qualified (OpName 'ValueOpName) -> Expr -> Expr -> Expr - reapply ss = BinaryNoParens . Op ss - - modOpTable - :: [[P.Operator (Chain Expr) () Identity Expr]] - -> [[P.Operator (Chain Expr) () Identity Expr]] - modOpTable table = - [ P.Infix (P.try (BinaryNoParens <$> parseTicks)) P.AssocLeft ] - : table - - parseTicks :: P.Parsec (Chain Expr) () Expr - parseTicks = token (either (const Nothing) fromOther) P. "infix function" - where - fromOther (Op _ _) = Nothing - fromOther v = Just v + isBinOp :: Expr -> Bool + isBinOp BinaryNoParens {} = True + isBinOp _ = False + + extractOp :: Expr -> Maybe (Expr, Expr, Expr) + extractOp (BinaryNoParens op l r) + | PositionedValue _ _ op' <- op = Just (op', l, r) + | otherwise = Just (op, l, r) + extractOp _ = Nothing + + fromOp :: Expr -> Maybe (SourceSpan, Qualified (OpName 'ValueOpName)) + fromOp (Op ss q@(Qualified _ (OpName _))) = Just (ss, q) + fromOp _ = Nothing + + reapply :: SourceSpan -> Qualified (OpName 'ValueOpName) -> Expr -> Expr -> Expr + reapply ss = BinaryNoParens . Op ss + + modOpTable :: + [[P.Operator (Chain Expr) () Identity Expr]] -> + [[P.Operator (Chain Expr) () Identity Expr]] + modOpTable table = + [P.Infix (P.try (BinaryNoParens <$> parseTicks)) P.AssocLeft] + : table + + parseTicks :: P.Parsec (Chain Expr) () Expr + parseTicks = token (either (const Nothing) fromOther) P. "infix function" + where + fromOther (Op _ _) = Nothing + fromOther v = Just v diff --git a/src/Language/PureScript/Sugar/Operators/Types.hs b/src/Language/PureScript/Sugar/Operators/Types.hs index 81001511c..98498d166 100644 --- a/src/Language/PureScript/Sugar/Operators/Types.hs +++ b/src/Language/PureScript/Sugar/Operators/Types.hs @@ -5,30 +5,29 @@ import Prelude import Control.Monad.Except (MonadError) import Language.PureScript.AST (Associativity, SourceSpan) import Language.PureScript.Errors (MultipleErrors) -import Language.PureScript.Names (OpName(..), OpNameType(..), Qualified(..)) +import Language.PureScript.Names (OpName (..), OpNameType (..), Qualified (..)) import Language.PureScript.Sugar.Operators.Common (matchOperators) -import Language.PureScript.Types (SourceType, Type(..), srcTypeApp) +import Language.PureScript.Types (SourceType, Type (..), srcTypeApp) -matchTypeOperators - :: MonadError MultipleErrors m - => SourceSpan - -> [[(Qualified (OpName 'TypeOpName), Associativity)]] - -> SourceType - -> m SourceType +matchTypeOperators :: + (MonadError MultipleErrors m) => + SourceSpan -> + [[(Qualified (OpName 'TypeOpName), Associativity)]] -> + SourceType -> + m SourceType matchTypeOperators ss = matchOperators isBinOp extractOp fromOp reapply id where + isBinOp :: SourceType -> Bool + isBinOp BinaryNoParensType {} = True + isBinOp _ = False - isBinOp :: SourceType -> Bool - isBinOp BinaryNoParensType{} = True - isBinOp _ = False + extractOp :: SourceType -> Maybe (SourceType, SourceType, SourceType) + extractOp (BinaryNoParensType _ op l r) = Just (op, l, r) + extractOp _ = Nothing - extractOp :: SourceType -> Maybe (SourceType, SourceType, SourceType) - extractOp (BinaryNoParensType _ op l r) = Just (op, l, r) - extractOp _ = Nothing + fromOp :: SourceType -> Maybe (SourceSpan, Qualified (OpName 'TypeOpName)) + fromOp (TypeOp _ q@(Qualified _ (OpName _))) = Just (ss, q) + fromOp _ = Nothing - fromOp :: SourceType -> Maybe (SourceSpan, Qualified (OpName 'TypeOpName)) - fromOp (TypeOp _ q@(Qualified _ (OpName _))) = Just (ss, q) - fromOp _ = Nothing - - reapply :: a -> Qualified (OpName 'TypeOpName) -> SourceType -> SourceType -> SourceType - reapply _ op = srcTypeApp . srcTypeApp (TypeOp (ss, []) op) + reapply :: a -> Qualified (OpName 'TypeOpName) -> SourceType -> SourceType -> SourceType + reapply _ op = srcTypeApp . srcTypeApp (TypeOp (ss, []) op) diff --git a/src/Language/PureScript/Sugar/TypeClasses.hs b/src/Language/PureScript/Sugar/TypeClasses.hs index 4f3129baf..cdff51f3c 100644 --- a/src/Language/PureScript/Sugar/TypeClasses.hs +++ b/src/Language/PureScript/Sugar/TypeClasses.hs @@ -1,36 +1,36 @@ --- | --- This module implements the desugaring pass which creates newtypes for type class dictionaries --- and value declarations for type class instances. --- -module Language.PureScript.Sugar.TypeClasses - ( desugarTypeClasses - , typeClassMemberName - , superClassDictionaryNames - ) where +{- | +This module implements the desugaring pass which creates newtypes for type class dictionaries +and value declarations for type class instances. +-} +module Language.PureScript.Sugar.TypeClasses ( + desugarTypeClasses, + typeClassMemberName, + superClassDictionaryNames, +) where import Prelude import Control.Arrow (first, second) import Control.Monad (unless) -import Control.Monad.Error.Class (MonadError(..)) -import Control.Monad.State (MonadState(..), StateT, evalStateT, modify) +import Control.Monad.Error.Class (MonadError (..)) +import Control.Monad.State (MonadState (..), StateT, evalStateT, modify) import Control.Monad.Supply.Class (MonadSupply) -import Data.Graph (SCC(..), stronglyConnComp) +import Data.Graph (SCC (..), stronglyConnComp) import Data.List (find, partition) import Data.List.NonEmpty (nonEmpty) -import Data.Map qualified as M -import Data.Maybe (catMaybes, mapMaybe, isJust) import Data.List.NonEmpty qualified as NEL +import Data.Map qualified as M +import Data.Maybe (catMaybes, isJust, mapMaybe) import Data.Set qualified as S import Data.Text (Text) import Data.Traversable (for) import Language.PureScript.Constants.Prim qualified as C import Language.PureScript.Crash (internalError) -import Language.PureScript.Environment (DataDeclType(..), NameKind(..), TypeClassData(..), dictTypeName, function, makeTypeClassData, primClasses, primCoerceClasses, primIntClasses, primRowClasses, primRowListClasses, primSymbolClasses, primTypeErrorClasses, tyRecord) +import Language.PureScript.Environment (DataDeclType (..), NameKind (..), TypeClassData (..), dictTypeName, function, makeTypeClassData, primClasses, primCoerceClasses, primIntClasses, primRowClasses, primRowListClasses, primSymbolClasses, primTypeErrorClasses, tyRecord) import Language.PureScript.Errors hiding (isExported, nonEmpty) -import Language.PureScript.Externs (ExternsDeclaration(..), ExternsFile(..)) -import Language.PureScript.Label (Label(..)) -import Language.PureScript.Names (pattern ByNullSourcePos, Ident(..), ModuleName, Name(..), ProperName, ProperNameType(..), Qualified(..), QualifiedBy(..), coerceProperName, freshIdent, qualify, runIdent) +import Language.PureScript.Externs (ExternsDeclaration (..), ExternsFile (..)) +import Language.PureScript.Label (Label (..)) +import Language.PureScript.Names (Ident (..), ModuleName, Name (..), ProperName, ProperNameType (..), Qualified (..), QualifiedBy (..), coerceProperName, freshIdent, qualify, runIdent, pattern ByNullSourcePos) import Language.PureScript.PSString (mkString) import Language.PureScript.Sugar.CaseDeclarations (desugarCases) import Language.PureScript.TypeClassDictionaries (superclassName) @@ -40,42 +40,43 @@ type MemberMap = M.Map (ModuleName, ProperName 'ClassName) TypeClassData type Desugar = StateT MemberMap --- | --- Add type synonym declarations for type class dictionary types, and value declarations for type class --- instance dictionary expressions. --- -desugarTypeClasses - :: (MonadSupply m, MonadError MultipleErrors m) - => [ExternsFile] - -> Module - -> m Module +{- | +Add type synonym declarations for type class dictionary types, and value declarations for type class +instance dictionary expressions. +-} +desugarTypeClasses :: + (MonadSupply m, MonadError MultipleErrors m) => + [ExternsFile] -> + Module -> + m Module desugarTypeClasses externs = flip evalStateT initialState . desugarModule where - initialState :: MemberMap - initialState = - mconcat - [ M.mapKeys (qualify C.M_Prim) primClasses - , M.mapKeys (qualify C.M_Prim_Coerce) primCoerceClasses - , M.mapKeys (qualify C.M_Prim_Row) primRowClasses - , M.mapKeys (qualify C.M_Prim_RowList) primRowListClasses - , M.mapKeys (qualify C.M_Prim_Symbol) primSymbolClasses - , M.mapKeys (qualify C.M_Prim_Int) primIntClasses - , M.mapKeys (qualify C.M_Prim_TypeError) primTypeErrorClasses - , M.fromList (externs >>= \ExternsFile{..} -> mapMaybe (fromExternsDecl efModuleName) efDeclarations) - ] - - fromExternsDecl - :: ModuleName - -> ExternsDeclaration - -> Maybe ((ModuleName, ProperName 'ClassName), TypeClassData) - fromExternsDecl mn (EDClass name args members implies deps tcIsEmpty) = Just ((mn, name), typeClass) where - typeClass = makeTypeClassData args members implies deps tcIsEmpty - fromExternsDecl _ _ = Nothing - -desugarModule - :: (MonadSupply m, MonadError MultipleErrors m) - => Module - -> Desugar m Module + initialState :: MemberMap + initialState = + mconcat + [ M.mapKeys (qualify C.M_Prim) primClasses + , M.mapKeys (qualify C.M_Prim_Coerce) primCoerceClasses + , M.mapKeys (qualify C.M_Prim_Row) primRowClasses + , M.mapKeys (qualify C.M_Prim_RowList) primRowListClasses + , M.mapKeys (qualify C.M_Prim_Symbol) primSymbolClasses + , M.mapKeys (qualify C.M_Prim_Int) primIntClasses + , M.mapKeys (qualify C.M_Prim_TypeError) primTypeErrorClasses + , M.fromList (externs >>= \ExternsFile {..} -> mapMaybe (fromExternsDecl efModuleName) efDeclarations) + ] + + fromExternsDecl :: + ModuleName -> + ExternsDeclaration -> + Maybe ((ModuleName, ProperName 'ClassName), TypeClassData) + fromExternsDecl mn (EDClass name args members implies deps tcIsEmpty) = Just ((mn, name), typeClass) + where + typeClass = makeTypeClassData args members implies deps tcIsEmpty + fromExternsDecl _ _ = Nothing + +desugarModule :: + (MonadSupply m, MonadError MultipleErrors m) => + Module -> + Desugar m Module desugarModule (Module ss coms name decls (Just exps)) = do let (classDecls, restDecls) = partition isTypeClassDecl decls classVerts = fmap (\d -> (d, classDeclName d, superClassesNames d)) classDecls @@ -83,27 +84,27 @@ desugarModule (Module ss coms name decls (Just exps)) = do (restNewExpss, restDeclss) <- unzip <$> parU restDecls (desugarDecl name exps) return $ Module ss coms name (concat restDeclss ++ concat classDeclss) $ Just (exps ++ catMaybes restNewExpss ++ catMaybes classNewExpss) where - desugarClassDecl :: (MonadSupply m, MonadError MultipleErrors m) - => ModuleName - -> [DeclarationRef] - -> SCC Declaration - -> Desugar m (Maybe DeclarationRef, [Declaration]) - desugarClassDecl name' exps' (AcyclicSCC d) = desugarDecl name' exps' d - desugarClassDecl _ _ (CyclicSCC ds') - | Just ds'' <- nonEmpty ds' = throwError . errorMessage' (declSourceSpan (NEL.head ds'')) $ CycleInTypeClassDeclaration (NEL.map classDeclName ds'') - | otherwise = internalError "desugarClassDecl: empty CyclicSCC" - - superClassesNames :: Declaration -> [Qualified (ProperName 'ClassName)] - superClassesNames (TypeClassDeclaration _ _ _ implies _ _) = fmap constraintName implies - superClassesNames _ = [] - - constraintName :: SourceConstraint -> Qualified (ProperName 'ClassName) - constraintName (Constraint _ cName _ _ _) = cName - - classDeclName :: Declaration -> Qualified (ProperName 'ClassName) - classDeclName (TypeClassDeclaration _ pn _ _ _ _) = Qualified (ByModuleName name) pn - classDeclName _ = internalError "Expected TypeClassDeclaration" - + desugarClassDecl :: + (MonadSupply m, MonadError MultipleErrors m) => + ModuleName -> + [DeclarationRef] -> + SCC Declaration -> + Desugar m (Maybe DeclarationRef, [Declaration]) + desugarClassDecl name' exps' (AcyclicSCC d) = desugarDecl name' exps' d + desugarClassDecl _ _ (CyclicSCC ds') + | Just ds'' <- nonEmpty ds' = throwError . errorMessage' (declSourceSpan (NEL.head ds'')) $ CycleInTypeClassDeclaration (NEL.map classDeclName ds'') + | otherwise = internalError "desugarClassDecl: empty CyclicSCC" + + superClassesNames :: Declaration -> [Qualified (ProperName 'ClassName)] + superClassesNames (TypeClassDeclaration _ _ _ implies _ _) = fmap constraintName implies + superClassesNames _ = [] + + constraintName :: SourceConstraint -> Qualified (ProperName 'ClassName) + constraintName (Constraint _ cName _ _ _) = cName + + classDeclName :: Declaration -> Qualified (ProperName 'ClassName) + classDeclName (TypeClassDeclaration _ pn _ _ _ _) = Qualified (ByModuleName name) pn + classDeclName _ = internalError "Expected TypeClassDeclaration" desugarModule _ = internalError "Exports should have been elaborated in name desugaring" {- Desugar type class and type class instance declarations @@ -196,182 +197,190 @@ desugarModule _ = internalError "Exports should have been elaborated in name des -- } -- }; -} -desugarDecl - :: (MonadSupply m, MonadError MultipleErrors m) - => ModuleName - -> [DeclarationRef] - -> Declaration - -> Desugar m (Maybe DeclarationRef, [Declaration]) +desugarDecl :: + (MonadSupply m, MonadError MultipleErrors m) => + ModuleName -> + [DeclarationRef] -> + Declaration -> + Desugar m (Maybe DeclarationRef, [Declaration]) desugarDecl mn exps = go where - go d@(TypeClassDeclaration sa name args implies deps members) = do - modify (M.insert (mn, name) (makeTypeClassData args (map memberToNameAndType members) implies deps False)) - return (Nothing, d : typeClassDictionaryDeclaration sa name args implies members : map (typeClassMemberToDictionaryAccessor mn name args) members) - go (TypeInstanceDeclaration sa na chainId idx name deps className tys body) = do - name' <- desugarInstName name - let d = TypeInstanceDeclaration sa na chainId idx (Right name') deps className tys body - let explicitOrNot = case body of - DerivedInstance -> Left $ DerivedInstancePlaceholder className KnownClassStrategy - NewtypeInstance -> Left $ DerivedInstancePlaceholder className NewtypeStrategy - ExplicitInstance members -> Right members - dictDecl <- case explicitOrNot of - Right members - | className == C.Coercible -> - throwError . errorMessage' (fst sa) $ InvalidCoercibleInstanceDeclaration tys - | otherwise -> do - desugared <- desugarCases members - typeInstanceDictionaryDeclaration sa name' mn deps className tys desugared - Left dict -> - let - dictTy = foldl srcTypeApp (srcTypeConstructor (fmap (coerceProperName . dictTypeName) className)) tys - constrainedTy = quantify (foldr srcConstrainedType dictTy deps) - in - return $ ValueDecl sa name' Private [] [MkUnguarded (TypedValue True dict constrainedTy)] - return (expRef name' className tys, [d, dictDecl]) - go other = return (Nothing, [other]) - - -- Completes the name generation for type class instances that do not have - -- a unique name defined in source code. - desugarInstName :: MonadSupply m => Either Text Ident -> Desugar m Ident - desugarInstName = either freshIdent pure - - expRef :: Ident -> Qualified (ProperName 'ClassName) -> [SourceType] -> Maybe DeclarationRef - expRef name className tys - | isExportedClass className && all isExportedType (getConstructors `concatMap` tys) = Just $ TypeInstanceRef genSpan name UserNamed - | otherwise = Nothing - - isExportedClass :: Qualified (ProperName 'ClassName) -> Bool - isExportedClass = isExported (elem . TypeClassRef genSpan) - - isExportedType :: Qualified (ProperName 'TypeName) -> Bool - isExportedType = isExported $ \pn -> isJust . find (matchesTypeRef pn) - - isExported - :: (ProperName a -> [DeclarationRef] -> Bool) - -> Qualified (ProperName a) - -> Bool - isExported test (Qualified (ByModuleName mn') pn) = mn /= mn' || test pn exps - isExported _ _ = internalError "Names should have been qualified in name desugaring" - - matchesTypeRef :: ProperName 'TypeName -> DeclarationRef -> Bool - matchesTypeRef pn (TypeRef _ pn' _) = pn == pn' - matchesTypeRef _ _ = False - - getConstructors :: SourceType -> [Qualified (ProperName 'TypeName)] - getConstructors = everythingOnTypes (++) getConstructor - where - getConstructor (TypeConstructor _ tcname) = [tcname] - getConstructor _ = [] - - genSpan :: SourceSpan - genSpan = internalModuleSourceSpan "" + go d@(TypeClassDeclaration sa name args implies deps members) = do + modify (M.insert (mn, name) (makeTypeClassData args (map memberToNameAndType members) implies deps False)) + return (Nothing, d : typeClassDictionaryDeclaration sa name args implies members : map (typeClassMemberToDictionaryAccessor mn name args) members) + go (TypeInstanceDeclaration sa na chainId idx name deps className tys body) = do + name' <- desugarInstName name + let d = TypeInstanceDeclaration sa na chainId idx (Right name') deps className tys body + let explicitOrNot = case body of + DerivedInstance -> Left $ DerivedInstancePlaceholder className KnownClassStrategy + NewtypeInstance -> Left $ DerivedInstancePlaceholder className NewtypeStrategy + ExplicitInstance members -> Right members + dictDecl <- case explicitOrNot of + Right members + | className == C.Coercible -> + throwError . errorMessage' (fst sa) $ InvalidCoercibleInstanceDeclaration tys + | otherwise -> do + desugared <- desugarCases members + typeInstanceDictionaryDeclaration sa name' mn deps className tys desugared + Left dict -> + let + dictTy = foldl srcTypeApp (srcTypeConstructor (fmap (coerceProperName . dictTypeName) className)) tys + constrainedTy = quantify (foldr srcConstrainedType dictTy deps) + in + return $ ValueDecl sa name' Public [] [MkUnguarded (TypedValue True dict constrainedTy)] + return (expRef name' className tys, [d, dictDecl]) + go other = return (Nothing, [other]) + + -- Completes the name generation for type class instances that do not have + -- a unique name defined in source code. + desugarInstName :: (MonadSupply m) => Either Text Ident -> Desugar m Ident + desugarInstName = either freshIdent pure + + expRef :: Ident -> Qualified (ProperName 'ClassName) -> [SourceType] -> Maybe DeclarationRef + expRef name className tys + | isExportedClass className && all isExportedType (getConstructors `concatMap` tys) = Just $ TypeInstanceRef genSpan name UserNamed + | otherwise = Nothing + + isExportedClass :: Qualified (ProperName 'ClassName) -> Bool + isExportedClass = isExported (elem . TypeClassRef genSpan) + + isExportedType :: Qualified (ProperName 'TypeName) -> Bool + isExportedType = isExported $ \pn -> isJust . find (matchesTypeRef pn) + + isExported :: + (ProperName a -> [DeclarationRef] -> Bool) -> + Qualified (ProperName a) -> + Bool + isExported test (Qualified (ByModuleName mn') pn) = mn /= mn' || test pn exps + isExported _ _ = internalError "Names should have been qualified in name desugaring" + + matchesTypeRef :: ProperName 'TypeName -> DeclarationRef -> Bool + matchesTypeRef pn (TypeRef _ pn' _) = pn == pn' + matchesTypeRef _ _ = False + + getConstructors :: SourceType -> [Qualified (ProperName 'TypeName)] + getConstructors = everythingOnTypes (++) getConstructor + where + getConstructor (TypeConstructor _ tcname) = [tcname] + getConstructor _ = [] + + genSpan :: SourceSpan + genSpan = internalModuleSourceSpan "" memberToNameAndType :: Declaration -> (Ident, SourceType) memberToNameAndType (TypeDeclaration td) = unwrapTypeDeclaration td memberToNameAndType _ = internalError "Invalid declaration in type class definition" -typeClassDictionaryDeclaration - :: SourceAnn - -> ProperName 'ClassName - -> [(Text, Maybe SourceType)] - -> [SourceConstraint] - -> [Declaration] - -> Declaration +typeClassDictionaryDeclaration :: + SourceAnn -> + ProperName 'ClassName -> + [(Text, SourceType)] -> + [SourceConstraint] -> + [Declaration] -> + Declaration typeClassDictionaryDeclaration sa name args implies members = - let superclassTypes = superClassDictionaryNames implies `zip` - [ function unit (foldl srcTypeApp (srcTypeConstructor (fmap (coerceProperName . dictTypeName) superclass)) tyArgs) - | (Constraint _ superclass _ tyArgs _) <- implies - ] + let superclassTypes = + superClassDictionaryNames implies + `zip` [ function unit (foldl srcTypeApp (srcTypeConstructor (fmap (coerceProperName . dictTypeName) superclass)) tyArgs) + | (Constraint _ superclass _ tyArgs _) <- implies + ] members' = map (first runIdent . memberToNameAndType) members mtys = members' ++ superclassTypes toRowListItem (l, t) = srcRowListItem (Label $ mkString l) t - ctor = DataConstructorDeclaration sa (coerceProperName $ dictTypeName name) - [(Ident "dict", srcTypeApp tyRecord $ rowFromList (map toRowListItem mtys, srcREmpty))] - in DataDeclaration sa Newtype (coerceProperName $ dictTypeName name) args [ctor] - -typeClassMemberToDictionaryAccessor - :: ModuleName - -> ProperName 'ClassName - -> [(Text, Maybe SourceType)] - -> Declaration - -> Declaration + ctor = + DataConstructorDeclaration + sa + (coerceProperName $ dictTypeName name) + [(Ident "dict", srcTypeApp tyRecord $ rowFromList (map toRowListItem mtys, srcREmpty))] + in DataDeclaration sa Newtype (coerceProperName $ dictTypeName name) args [ctor] + +typeClassMemberToDictionaryAccessor :: + ModuleName -> + ProperName 'ClassName -> + [(Text, SourceType)] -> + Declaration -> + Declaration typeClassMemberToDictionaryAccessor mn name args (TypeDeclaration (TypeDeclarationData sa@(ss, _) ident ty)) = let className = Qualified (ByModuleName mn) name dictIdent = Ident "dict" dictObjIdent = Ident "v" ctor = ConstructorBinder ss (coerceProperName . dictTypeName <$> className) [VarBinder ss dictObjIdent] - acsr = Accessor (mkString $ runIdent ident) (Var ss (Qualified ByNullSourcePos dictObjIdent)) + -- NOTE: changing this from ByNullSourcePos to the real source pos to hopefully make conversion to typed CoreFn AST work + acsr = Accessor (mkString $ runIdent ident) (Var ss (Qualified {- -ByNullSourcePos -} (BySourcePos $ spanStart ss) dictObjIdent)) visibility = second (const TypeVarVisible) <$> args - in ValueDecl sa ident Private [] - [MkUnguarded ( - TypedValue False (Abs (VarBinder ss dictIdent) (Case [Var ss $ Qualified ByNullSourcePos dictIdent] [CaseAlternative [ctor] [MkUnguarded acsr]])) $ - addVisibility visibility (moveQuantifiersToFront NullSourceAnn (quantify (srcConstrainedType (srcConstraint className [] (map (srcTypeVar . fst) args) Nothing) ty))) - )] + in ValueDecl + sa + ident + Public + [] + [ MkUnguarded + ( TypedValue False (Abs (VarBinder ss dictIdent) (Case [Var ss $ Qualified ByNullSourcePos dictIdent] [CaseAlternative [ctor] [MkUnguarded acsr]])) $ + addVisibility visibility (moveQuantifiersToFront NullSourceAnn (quantify (srcConstrainedType (srcConstraint className [] (map (uncurry srcTypeVar) args) Nothing) ty))) + ) + ] typeClassMemberToDictionaryAccessor _ _ _ _ = internalError "Invalid declaration in type class definition" unit :: SourceType unit = srcTypeApp tyRecord srcREmpty -typeInstanceDictionaryDeclaration - :: forall m - . MonadError MultipleErrors m - => SourceAnn - -> Ident - -> ModuleName - -> [SourceConstraint] - -> Qualified (ProperName 'ClassName) - -> [SourceType] - -> [Declaration] - -> Desugar m Declaration +typeInstanceDictionaryDeclaration :: + forall m. + (MonadError MultipleErrors m) => + SourceAnn -> + Ident -> + ModuleName -> + [SourceConstraint] -> + Qualified (ProperName 'ClassName) -> + [SourceType] -> + [Declaration] -> + Desugar m Declaration typeInstanceDictionaryDeclaration sa@(ss, _) name mn deps className tys decls = rethrow (addHint (ErrorInInstance className tys)) $ do - m <- get - - -- Lookup the type arguments and member types for the type class - TypeClassData{..} <- - maybe (throwError . errorMessage' ss . UnknownName $ fmap TyClassName className) return $ - M.lookup (qualify mn className) m - - -- Replace the type arguments with the appropriate types in the member types - let memberTypes = map (second (replaceAllTypeVars (zip (map fst typeClassArguments) tys)) . tuple3To2) typeClassMembers - - let declaredMembers = S.fromList $ mapMaybe declIdent decls - - -- Instance declarations with a Fail constraint are unreachable code, so - -- we allow them to be empty. - let unreachable = any ((C.Fail ==) . constraintClass) deps && null decls - - unless unreachable $ - case filter (\(ident, _) -> not $ S.member ident declaredMembers) memberTypes of - hd : tl -> throwError . errorMessage' ss $ MissingClassMember (hd NEL.:| tl) - [] -> pure () - - -- Create values for the type instance members - members <- zip (map typeClassMemberName decls) <$> traverse (memberToValue memberTypes) decls - - -- Create the type of the dictionary - -- The type is a record type, but depending on type instance dependencies, may be constrained. - -- The dictionary itself is a record literal (unless unreachable, in which case it's undefined). - superclassesDicts <- for typeClassSuperclasses $ \(Constraint _ superclass _ suTyArgs _) -> do - let tyArgs = map (replaceAllTypeVars (zip (map fst typeClassArguments) tys)) suTyArgs - pure $ Abs (VarBinder ss UnusedIdent) (DeferredDictionary superclass tyArgs) - let superclasses = superClassDictionaryNames typeClassSuperclasses `zip` superclassesDicts - - let props = Literal ss $ ObjectLiteral $ map (first mkString) (members ++ superclasses) - dictTy = foldl srcTypeApp (srcTypeConstructor (fmap (coerceProperName . dictTypeName) className)) tys - constrainedTy = quantify (foldr srcConstrainedType dictTy deps) - dict = App (Constructor ss (fmap (coerceProperName . dictTypeName) className)) props - mkTV = if unreachable then TypedValue False (Var nullSourceSpan C.I_undefined) else TypedValue True dict - result = ValueDecl sa name Private [] [MkUnguarded (mkTV constrainedTy)] - return result - + m <- get + + -- Lookup the type arguments and member types for the type class + TypeClassData {..} <- + maybe (throwError . errorMessage' ss . UnknownName $ fmap TyClassName className) return $ + M.lookup (qualify mn className) m + + -- Replace the type arguments with the appropriate types in the member types + let memberTypes = map (second (replaceAllTypeVars (zip (map fst typeClassArguments) tys)) . tuple3To2) typeClassMembers + + let declaredMembers = S.fromList $ mapMaybe declIdent decls + + -- Instance declarations with a Fail constraint are unreachable code, so + -- we allow them to be empty. + let unreachable = any ((C.Fail ==) . constraintClass) deps && null decls + + unless unreachable $ + case filter (\(ident, _) -> not $ S.member ident declaredMembers) memberTypes of + hd : tl -> throwError . errorMessage' ss $ MissingClassMember (hd NEL.:| tl) + [] -> pure () + + -- Create values for the type instance members + members <- zip (map typeClassMemberName decls) <$> traverse (memberToValue memberTypes) decls + + -- Create the type of the dictionary + -- The type is a record type, but depending on type instance dependencies, may be constrained. + -- The dictionary itself is a record literal (unless unreachable, in which case it's undefined). + superclassesDicts <- for typeClassSuperclasses $ \(Constraint _ superclass _ suTyArgs _) -> do + let tyArgs = map (replaceAllTypeVars (zip (map fst typeClassArguments) tys)) suTyArgs + pure $ Abs (VarBinder ss UnusedIdent) (DeferredDictionary superclass tyArgs) + let superclasses = superClassDictionaryNames typeClassSuperclasses `zip` superclassesDicts + + let props = Literal ss $ ObjectLiteral $ map (first mkString) (members ++ superclasses) + dictTy = foldl srcTypeApp (srcTypeConstructor (fmap (coerceProperName . dictTypeName) className)) tys + constrainedTy = quantify (foldr srcConstrainedType dictTy deps) + dict = App (Constructor ss (fmap (coerceProperName . dictTypeName) className)) props + mkTV = if unreachable then TypedValue False (Var nullSourceSpan C.I_undefined) else TypedValue True dict + result = ValueDecl sa name Public [] [MkUnguarded (mkTV constrainedTy)] + return result where - - memberToValue :: [(Ident, SourceType)] -> Declaration -> Desugar m Expr - memberToValue tys' (ValueDecl (ss', _) ident _ [] [MkUnguarded val]) = do - _ <- maybe (throwError . errorMessage' ss' $ ExtraneousClassMember ident className) return $ lookup ident tys' - return val - memberToValue _ _ = internalError "Invalid declaration in type instance definition" + memberToValue :: [(Ident, SourceType)] -> Declaration -> Desugar m Expr + memberToValue tys' (ValueDecl (ss', _) ident _ [] [MkUnguarded val]) = do + _ <- maybe (throwError . errorMessage' ss' $ ExtraneousClassMember ident className) return $ lookup ident tys' + return val + memberToValue _ _ = internalError "Invalid declaration in type instance definition" declIdent :: Declaration -> Maybe Ident declIdent (ValueDeclaration vd) = Just (valdeclIdent vd) @@ -384,7 +393,7 @@ typeClassMemberName = maybe (internalError "typeClassMemberName: Invalid declara superClassDictionaryNames :: [Constraint a] -> [Text] superClassDictionaryNames supers = [ superclassName pn index - | (index, Constraint _ pn _ _ _) <- zip [0..] supers + | (index, Constraint _ pn _ _ _) <- zip [0 ..] supers ] tuple3To2 :: (a, b, c) -> (a, b) diff --git a/src/Language/PureScript/Sugar/TypeClasses/Deriving.hs b/src/Language/PureScript/Sugar/TypeClasses/Deriving.hs index 3b4c01952..54e7b436d 100755 --- a/src/Language/PureScript/Sugar/TypeClasses/Deriving.hs +++ b/src/Language/PureScript/Sugar/TypeClasses/Deriving.hs @@ -1,165 +1,183 @@ -- | This module implements the generic deriving elaboration that takes place during desugaring. module Language.PureScript.Sugar.TypeClasses.Deriving (deriveInstances) where -import Prelude import Protolude (note) +import Prelude -import Control.Monad.Error.Class (MonadError(..)) +import Control.Monad.Error.Class (MonadError (..)) import Control.Monad.Supply.Class (MonadSupply) -import Data.List (foldl', find, unzip5) -import Language.PureScript.AST (Binder(..), CaseAlternative(..), DataConstructorDeclaration(..), Declaration(..), Expr(..), pattern MkUnguarded, Module(..), SourceSpan(..), TypeInstanceBody(..), pattern ValueDecl) -import Language.PureScript.AST.Utils (UnwrappedTypeConstructor(..), lamCase, unguarded, unwrapTypeConstructor) +import Data.List (find, foldl', unzip5) +import Language.PureScript.AST (Binder (..), CaseAlternative (..), DataConstructorDeclaration (..), Declaration (..), Expr (..), Module (..), SourceSpan (..), TypeInstanceBody (..), pattern MkUnguarded, pattern ValueDecl) +import Language.PureScript.AST.Utils (UnwrappedTypeConstructor (..), lamCase, unguarded, unwrapTypeConstructor) import Language.PureScript.Constants.Libs qualified as Libs import Language.PureScript.Crash (internalError) -import Language.PureScript.Environment (DataDeclType(..), NameKind(..)) -import Language.PureScript.Errors (MultipleErrors, SimpleErrorMessage(..), errorMessage') -import Language.PureScript.Names (pattern ByNullSourcePos, Ident(..), ModuleName, ProperName(..), ProperNameType(..), Qualified(..), QualifiedBy(..), freshIdent) +import Language.PureScript.Environment (DataDeclType (..), NameKind (..)) +import Language.PureScript.Errors (MultipleErrors, SimpleErrorMessage (..), errorMessage') +import Language.PureScript.Names (Ident (..), ModuleName, ProperName (..), ProperNameType (..), Qualified (..), QualifiedBy (..), freshIdent, pattern ByNullSourcePos) import Language.PureScript.PSString (mkString) -import Language.PureScript.Types (SourceType, Type(..), WildcardData(..), replaceAllTypeVars, srcTypeApp, srcTypeConstructor, srcTypeLevelString) import Language.PureScript.TypeChecker (checkNewtype) +import Language.PureScript.Types (SourceType, Type (..), WildcardData (..), replaceAllTypeVars, srcTypeApp, srcTypeConstructor, srcTypeLevelString) -- | Elaborates deriving instance declarations by code generation. -deriveInstances - :: forall m - . (MonadError MultipleErrors m, MonadSupply m) - => Module - -> m Module +deriveInstances :: + forall m. + (MonadError MultipleErrors m, MonadSupply m) => + Module -> + m Module deriveInstances (Module ss coms mn ds exts) = - Module ss coms mn <$> mapM (deriveInstance mn ds) ds <*> pure exts - --- | Takes a declaration, and if the declaration is a deriving TypeInstanceDeclaration, --- elaborates that into an instance declaration via code generation. --- --- More instance deriving happens during type checking. The instances --- derived here are special for two reasons: --- * they depend only on the structure of the data, not types; and --- * they expect wildcard types from the user and generate type expressions --- to replace them. --- -deriveInstance - :: forall m - . (MonadError MultipleErrors m, MonadSupply m) - => ModuleName - -> [Declaration] - -> Declaration - -> m Declaration + Module ss coms mn <$> mapM (deriveInstance mn ds) ds <*> pure exts + +{- | Takes a declaration, and if the declaration is a deriving TypeInstanceDeclaration, +elaborates that into an instance declaration via code generation. + +More instance deriving happens during type checking. The instances +derived here are special for two reasons: +* they depend only on the structure of the data, not types; and +* they expect wildcard types from the user and generate type expressions + to replace them. +-} +deriveInstance :: + forall m. + (MonadError MultipleErrors m, MonadSupply m) => + ModuleName -> + [Declaration] -> + Declaration -> + m Declaration deriveInstance mn ds decl = case decl of - TypeInstanceDeclaration sa@(ss, _) na ch idx nm deps className tys DerivedInstance -> let - binaryWildcardClass :: (Declaration -> [SourceType] -> m ([Declaration], SourceType)) -> m Declaration - binaryWildcardClass f = case tys of - [ty1, ty2] -> case unwrapTypeConstructor ty1 of - Just UnwrappedTypeConstructor{..} | mn == utcModuleName -> do - checkIsWildcard ss utcTyCon ty2 - tyConDecl <- findTypeDecl ss utcTyCon ds - (members, ty2') <- f tyConDecl utcArgs - pure $ TypeInstanceDeclaration sa na ch idx nm deps className [ty1, ty2'] (ExplicitInstance members) - _ -> throwError . errorMessage' ss $ ExpectedTypeConstructor className tys ty1 - _ -> throwError . errorMessage' ss $ InvalidDerivedInstance className tys 2 - - in case className of - Libs.Generic -> binaryWildcardClass (deriveGenericRep ss mn) - Libs.Newtype -> binaryWildcardClass deriveNewtype - _ -> pure decl + TypeInstanceDeclaration sa@(ss, _) na ch idx nm deps className tys DerivedInstance -> + let + binaryWildcardClass :: (Declaration -> [SourceType] -> m ([Declaration], SourceType)) -> m Declaration + binaryWildcardClass f = case tys of + [ty1, ty2] -> case unwrapTypeConstructor ty1 of + Just UnwrappedTypeConstructor {..} | mn == utcModuleName -> do + checkIsWildcard ss utcTyCon ty2 + tyConDecl <- findTypeDecl ss utcTyCon ds + (members, ty2') <- f tyConDecl utcArgs + pure $ TypeInstanceDeclaration sa na ch idx nm deps className [ty1, ty2'] (ExplicitInstance members) + _ -> throwError . errorMessage' ss $ ExpectedTypeConstructor className tys ty1 + _ -> throwError . errorMessage' ss $ InvalidDerivedInstance className tys 2 + in + case className of + Libs.Generic -> binaryWildcardClass (deriveGenericRep ss mn) + Libs.Newtype -> binaryWildcardClass deriveNewtype + _ -> pure decl _ -> pure decl -deriveGenericRep - :: forall m - . (MonadError MultipleErrors m, MonadSupply m) - => SourceSpan - -> ModuleName - -> Declaration - -> [SourceType] - -> m ([Declaration], SourceType) +deriveGenericRep :: + forall m. + (MonadError MultipleErrors m, MonadSupply m) => + SourceSpan -> + ModuleName -> + Declaration -> + [SourceType] -> + m ([Declaration], SourceType) deriveGenericRep ss mn tyCon tyConArgs = case tyCon of DataDeclaration (ss', _) _ _ args dctors -> do x <- freshIdent "x" (reps, to, from) <- unzip3 <$> traverse makeInst dctors let rep = toRepTy reps - inst | null reps = - -- If there are no cases, spin - [ ValueDecl (ss', []) (Ident "to") Public [] $ unguarded $ - lamCase x + inst + | null reps = + -- If there are no cases, spin + [ ValueDecl (ss', []) (Ident "to") Public [] $ + unguarded $ + lamCase + x [ CaseAlternative [NullBinder] (unguarded (App (Var ss Libs.I_to) (Var ss' (Qualified ByNullSourcePos x)))) ] - , ValueDecl (ss', []) (Ident "from") Public [] $ unguarded $ - lamCase x + , ValueDecl (ss', []) (Ident "from") Public [] $ + unguarded $ + lamCase + x [ CaseAlternative [NullBinder] (unguarded (App (Var ss Libs.I_from) (Var ss' (Qualified ByNullSourcePos x)))) ] - ] - | otherwise = - [ ValueDecl (ss', []) (Ident "to") Public [] $ unguarded $ - lamCase x (zipWith ($) (map underBinder (sumBinders (length dctors))) to) - , ValueDecl (ss', []) (Ident "from") Public [] $ unguarded $ - lamCase x (zipWith ($) (map underExpr (sumExprs (length dctors))) from) - ] + ] + | otherwise = + [ ValueDecl (ss', []) (Ident "to") Public [] $ + unguarded $ + lamCase x (zipWith ($) (map underBinder (sumBinders (length dctors))) to) + , ValueDecl (ss', []) (Ident "from") Public [] $ + unguarded $ + lamCase x (zipWith ($) (map underExpr (sumExprs (length dctors))) from) + ] subst = zipWith ((,) . fst) args tyConArgs return (inst, replaceAllTypeVars subst rep) _ -> internalError "deriveGenericRep: expected DataDeclaration" - - where - + where select :: (a -> a) -> (a -> a) -> Int -> [a -> a] select _ _ 0 = [] select _ _ 1 = [id] select l r n = take (n - 1) (iterate (r .) l) ++ [compN (n - 1) r] sumBinders :: Int -> [Binder -> Binder] - sumBinders = select (ConstructorBinder ss Libs.C_Inl . pure) - (ConstructorBinder ss Libs.C_Inr . pure) + sumBinders = + select + (ConstructorBinder ss Libs.C_Inl . pure) + (ConstructorBinder ss Libs.C_Inr . pure) sumExprs :: Int -> [Expr -> Expr] - sumExprs = select (App (Constructor ss Libs.C_Inl)) - (App (Constructor ss Libs.C_Inr)) + sumExprs = + select + (App (Constructor ss Libs.C_Inl)) + (App (Constructor ss Libs.C_Inr)) compN :: Int -> (a -> a) -> a -> a compN 0 _ = id compN n f = f . compN (n - 1) f - makeInst - :: DataConstructorDeclaration - -> m (SourceType, CaseAlternative, CaseAlternative) + makeInst :: + DataConstructorDeclaration -> + m (SourceType, CaseAlternative, CaseAlternative) makeInst (DataConstructorDeclaration _ ctorName args) = do - let args' = map snd args - (ctorTy, matchProduct, ctorArgs, matchCtor, mkProduct) <- makeProduct args' - return ( srcTypeApp (srcTypeApp (srcTypeConstructor Libs.Constructor) - (srcTypeLevelString $ mkString (runProperName ctorName))) - ctorTy - , CaseAlternative [ ConstructorBinder ss Libs.C_Constructor [matchProduct] ] - (unguarded (foldl' App (Constructor ss (Qualified (ByModuleName mn) ctorName)) ctorArgs)) - , CaseAlternative [ ConstructorBinder ss (Qualified (ByModuleName mn) ctorName) matchCtor ] - (unguarded (App (Constructor ss Libs.C_Constructor) mkProduct)) - ) - - makeProduct - :: [SourceType] - -> m (SourceType, Binder, [Expr], [Binder], Expr) + let args' = map snd args + (ctorTy, matchProduct, ctorArgs, matchCtor, mkProduct) <- makeProduct args' + return + ( srcTypeApp + ( srcTypeApp + (srcTypeConstructor Libs.Constructor) + (srcTypeLevelString $ mkString (runProperName ctorName)) + ) + ctorTy + , CaseAlternative + [ConstructorBinder ss Libs.C_Constructor [matchProduct]] + (unguarded (foldl' App (Constructor ss (Qualified (ByModuleName mn) ctorName)) ctorArgs)) + , CaseAlternative + [ConstructorBinder ss (Qualified (ByModuleName mn) ctorName) matchCtor] + (unguarded (App (Constructor ss Libs.C_Constructor) mkProduct)) + ) + + makeProduct :: + [SourceType] -> + m (SourceType, Binder, [Expr], [Binder], Expr) makeProduct [] = pure (srcTypeConstructor Libs.NoArguments, NullBinder, [], [], Constructor ss Libs.C_NoArguments) makeProduct args = do (tys, bs1, es1, bs2, es2) <- unzip5 <$> traverse makeArg args - pure ( foldr1 (\f -> srcTypeApp (srcTypeApp (srcTypeConstructor Libs.Product) f)) tys - , foldr1 (\b1 b2 -> ConstructorBinder ss Libs.C_Product [b1, b2]) bs1 - , es1 - , bs2 - , foldr1 (\e1 -> App (App (Constructor ss Libs.C_Product) e1)) es2 - ) + pure + ( foldr1 (\f -> srcTypeApp (srcTypeApp (srcTypeConstructor Libs.Product) f)) tys + , foldr1 (\b1 b2 -> ConstructorBinder ss Libs.C_Product [b1, b2]) bs1 + , es1 + , bs2 + , foldr1 (\e1 -> App (App (Constructor ss Libs.C_Product) e1)) es2 + ) makeArg :: SourceType -> m (SourceType, Binder, Expr, Binder, Expr) makeArg arg = do argName <- freshIdent "arg" - pure ( srcTypeApp (srcTypeConstructor Libs.Argument) arg - , ConstructorBinder ss Libs.C_Argument [ VarBinder ss argName ] - , Var ss (Qualified (BySourcePos $ spanStart ss) argName) - , VarBinder ss argName - , App (Constructor ss Libs.C_Argument) (Var ss (Qualified (BySourcePos $ spanStart ss) argName)) - ) + pure + ( srcTypeApp (srcTypeConstructor Libs.Argument) arg + , ConstructorBinder ss Libs.C_Argument [VarBinder ss argName] + , Var ss (Qualified (BySourcePos $ spanStart ss) argName) + , VarBinder ss argName + , App (Constructor ss Libs.C_Argument) (Var ss (Qualified (BySourcePos $ spanStart ss) argName)) + ) underBinder :: (Binder -> Binder) -> CaseAlternative -> CaseAlternative underBinder f (CaseAlternative bs e) = CaseAlternative (map f bs) e @@ -173,17 +191,17 @@ deriveGenericRep ss mn tyCon tyConArgs = toRepTy [only] = only toRepTy ctors = foldr1 (\f -> srcTypeApp (srcTypeApp (srcTypeConstructor Libs.Sum) f)) ctors -checkIsWildcard :: MonadError MultipleErrors m => SourceSpan -> ProperName 'TypeName -> SourceType -> m () +checkIsWildcard :: (MonadError MultipleErrors m) => SourceSpan -> ProperName 'TypeName -> SourceType -> m () checkIsWildcard _ _ (TypeWildcard _ UnnamedWildcard) = return () checkIsWildcard ss tyConNm _ = throwError . errorMessage' ss $ ExpectedWildcard tyConNm -deriveNewtype - :: forall m - . MonadError MultipleErrors m - => Declaration - -> [SourceType] - -> m ([Declaration], SourceType) +deriveNewtype :: + forall m. + (MonadError MultipleErrors m) => + Declaration -> + [SourceType] -> + m ([Declaration], SourceType) deriveNewtype tyCon tyConArgs = case tyCon of DataDeclaration (ss', _) Data name _ _ -> @@ -194,14 +212,14 @@ deriveNewtype tyCon tyConArgs = return ([], replaceAllTypeVars subst ty) _ -> internalError "deriveNewtype: expected DataDeclaration" -findTypeDecl - :: (MonadError MultipleErrors m) - => SourceSpan - -> ProperName 'TypeName - -> [Declaration] - -> m Declaration +findTypeDecl :: + (MonadError MultipleErrors m) => + SourceSpan -> + ProperName 'TypeName -> + [Declaration] -> + m Declaration findTypeDecl ss tyConNm = note (errorMessage' ss $ CannotFindDerivingType tyConNm) . find isTypeDecl where - isTypeDecl :: Declaration -> Bool - isTypeDecl (DataDeclaration _ _ nm _ _) = nm == tyConNm - isTypeDecl _ = False + isTypeDecl :: Declaration -> Bool + isTypeDecl (DataDeclaration _ _ nm _ _) = nm == tyConNm + isTypeDecl _ = False diff --git a/src/Language/PureScript/Sugar/TypeDeclarations.hs b/src/Language/PureScript/Sugar/TypeDeclarations.hs index ef00748d6..5e487afef 100644 --- a/src/Language/PureScript/Sugar/TypeDeclarations.hs +++ b/src/Language/PureScript/Sugar/TypeDeclarations.hs @@ -1,97 +1,99 @@ --- | --- This module implements the desugaring pass which replaces top-level type --- declarations with type annotations on the corresponding expression. --- -module Language.PureScript.Sugar.TypeDeclarations - ( desugarTypeDeclarationsModule - ) where +{- | +This module implements the desugaring pass which replaces top-level type +declarations with type annotations on the corresponding expression. +-} +module Language.PureScript.Sugar.TypeDeclarations ( + desugarTypeDeclarationsModule, +) where import Prelude import Control.Monad (unless) -import Control.Monad.Error.Class (MonadError(..)) +import Control.Monad.Error.Class (MonadError (..)) -import Language.PureScript.AST (Declaration(..), ErrorMessageHint(..), Expr(..), GuardedExpr(..), KindSignatureFor(..), pattern MkUnguarded, Module(..), RoleDeclarationData(..), TypeDeclarationData(..), TypeInstanceBody(..), pattern ValueDecl, declSourceSpan, everywhereOnValuesTopDownM) +import Language.PureScript.AST (Declaration (..), ErrorMessageHint (..), Expr (..), GuardedExpr (..), KindSignatureFor (..), Module (..), RoleDeclarationData (..), TypeDeclarationData (..), TypeInstanceBody (..), declSourceSpan, everywhereOnValuesTopDownM, pattern MkUnguarded, pattern ValueDecl) +import Language.PureScript.Environment (DataDeclType (..), NameKind) +import Language.PureScript.Errors (MultipleErrors, SimpleErrorMessage (..), addHint, errorMessage', rethrow) import Language.PureScript.Names (Ident, coerceProperName) -import Language.PureScript.Environment (DataDeclType(..), NameKind) -import Language.PureScript.Errors (MultipleErrors, SimpleErrorMessage(..), addHint, errorMessage', rethrow) --- | --- Replace all top level type declarations in a module with type annotations --- -desugarTypeDeclarationsModule - :: forall m - . MonadError MultipleErrors m - => Module - -> m Module +{- | +Replace all top level type declarations in a module with type annotations +-} +desugarTypeDeclarationsModule :: + forall m. + (MonadError MultipleErrors m) => + Module -> + m Module desugarTypeDeclarationsModule (Module modSS coms name ds exps) = rethrow (addHint (ErrorInModule name)) $ do checkKindDeclarations ds checkRoleDeclarations Nothing ds Module modSS coms name <$> desugarTypeDeclarations ds <*> pure exps where - - desugarTypeDeclarations :: [Declaration] -> m [Declaration] - desugarTypeDeclarations (TypeDeclaration (TypeDeclarationData sa name' ty) : d : rest) = do - (_, nameKind, val) <- fromValueDeclaration d - desugarTypeDeclarations (ValueDecl sa name' nameKind [] [MkUnguarded (TypedValue True val ty)] : rest) - where - fromValueDeclaration :: Declaration -> m (Ident, NameKind, Expr) - fromValueDeclaration (ValueDecl _ name'' nameKind [] [MkUnguarded val]) - | name' == name'' = return (name'', nameKind, val) - fromValueDeclaration d' = - throwError . errorMessage' (declSourceSpan d') $ OrphanTypeDeclaration name' - desugarTypeDeclarations [TypeDeclaration (TypeDeclarationData (ss, _) name' _)] = - throwError . errorMessage' ss $ OrphanTypeDeclaration name' - desugarTypeDeclarations (ValueDecl sa name' nameKind bs val : rest) = do - let (_, f, _) = everywhereOnValuesTopDownM return go return - f' = mapM (\(GuardedExpr g e) -> GuardedExpr g <$> f e) - (:) <$> (ValueDecl sa name' nameKind bs <$> f' val) + desugarTypeDeclarations :: [Declaration] -> m [Declaration] + desugarTypeDeclarations (TypeDeclaration (TypeDeclarationData sa name' ty) : d : rest) = do + (_, nameKind, val) <- fromValueDeclaration d + desugarTypeDeclarations (ValueDecl sa name' nameKind [] [MkUnguarded (TypedValue True val ty)] : rest) + where + fromValueDeclaration :: Declaration -> m (Ident, NameKind, Expr) + fromValueDeclaration (ValueDecl _ name'' nameKind [] [MkUnguarded val]) + | name' == name'' = return (name'', nameKind, val) + fromValueDeclaration d' = + throwError . errorMessage' (declSourceSpan d') $ OrphanTypeDeclaration name' + desugarTypeDeclarations [TypeDeclaration (TypeDeclarationData (ss, _) name' _)] = + throwError . errorMessage' ss $ OrphanTypeDeclaration name' + desugarTypeDeclarations (ValueDecl sa name' nameKind bs val : rest) = do + let (_, f, _) = everywhereOnValuesTopDownM return go return + f' = mapM (\(GuardedExpr g e) -> GuardedExpr g <$> f e) + (:) + <$> (ValueDecl sa name' nameKind bs <$> f' val) <*> desugarTypeDeclarations rest - where - go (Let w ds' val') = Let w <$> desugarTypeDeclarations ds' <*> pure val' - go other = return other - desugarTypeDeclarations (TypeInstanceDeclaration sa na ch idx nm deps cls args (ExplicitInstance ds') : rest) = - (:) <$> (TypeInstanceDeclaration sa na ch idx nm deps cls args . ExplicitInstance <$> desugarTypeDeclarations ds') + where + go (Let w ds' val') = Let w <$> desugarTypeDeclarations ds' <*> pure val' + go other = return other + desugarTypeDeclarations (TypeInstanceDeclaration sa na ch idx nm deps cls args (ExplicitInstance ds') : rest) = + (:) + <$> (TypeInstanceDeclaration sa na ch idx nm deps cls args . ExplicitInstance <$> desugarTypeDeclarations ds') <*> desugarTypeDeclarations rest - desugarTypeDeclarations (d:rest) = (:) d <$> desugarTypeDeclarations rest - desugarTypeDeclarations [] = return [] + desugarTypeDeclarations (d : rest) = (:) d <$> desugarTypeDeclarations rest + desugarTypeDeclarations [] = return [] - checkKindDeclarations :: [Declaration] -> m () - checkKindDeclarations (KindDeclaration sa kindFor name' _ : d : rest) = do - unless (matchesDeclaration d) . throwError . errorMessage' (fst sa) $ OrphanKindDeclaration name' - checkKindDeclarations rest - where - matchesDeclaration :: Declaration -> Bool - matchesDeclaration (DataDeclaration _ Data name'' _ _) = kindFor == DataSig && name' == name'' - matchesDeclaration (DataDeclaration _ Newtype name'' _ _) = kindFor == NewtypeSig && name' == name'' - matchesDeclaration (TypeSynonymDeclaration _ name'' _ _) = kindFor == TypeSynonymSig && name' == name'' - matchesDeclaration (TypeClassDeclaration _ name'' _ _ _ _) = kindFor == ClassSig && name' == coerceProperName name'' - matchesDeclaration _ = False - checkKindDeclarations (KindDeclaration sa _ name' _ : _) = do - throwError . errorMessage' (fst sa) $ OrphanKindDeclaration name' - checkKindDeclarations (_ : rest) = checkKindDeclarations rest - checkKindDeclarations [] = return () + checkKindDeclarations :: [Declaration] -> m () + checkKindDeclarations (KindDeclaration sa kindFor name' _ : d : rest) = do + unless (matchesDeclaration d) . throwError . errorMessage' (fst sa) $ OrphanKindDeclaration name' + checkKindDeclarations rest + where + matchesDeclaration :: Declaration -> Bool + matchesDeclaration (DataDeclaration _ Data name'' _ _) = kindFor == DataSig && name' == name'' + matchesDeclaration (DataDeclaration _ Newtype name'' _ _) = kindFor == NewtypeSig && name' == name'' + matchesDeclaration (TypeSynonymDeclaration _ name'' _ _) = kindFor == TypeSynonymSig && name' == name'' + matchesDeclaration (TypeClassDeclaration _ name'' _ _ _ _) = kindFor == ClassSig && name' == coerceProperName name'' + matchesDeclaration _ = False + checkKindDeclarations (KindDeclaration sa _ name' _ : _) = do + throwError . errorMessage' (fst sa) $ OrphanKindDeclaration name' + checkKindDeclarations (_ : rest) = checkKindDeclarations rest + checkKindDeclarations [] = return () - checkRoleDeclarations :: Maybe Declaration -> [Declaration] -> m () - checkRoleDeclarations Nothing (RoleDeclaration RoleDeclarationData{..} : _) = - throwError . errorMessage' (fst rdeclSourceAnn) $ OrphanRoleDeclaration rdeclIdent - checkRoleDeclarations (Just (RoleDeclaration (RoleDeclarationData _ name' _))) ((RoleDeclaration RoleDeclarationData{..}) : _) | name' == rdeclIdent = - throwError . errorMessage' (fst rdeclSourceAnn) $ DuplicateRoleDeclaration rdeclIdent - checkRoleDeclarations (Just d) (rd@(RoleDeclaration RoleDeclarationData{..}) : rest) = do - unless (matchesDeclaration d) . throwError . errorMessage' (fst rdeclSourceAnn) $ OrphanRoleDeclaration rdeclIdent - unless (isSupported d) . throwError . errorMessage' (fst rdeclSourceAnn) $ UnsupportedRoleDeclaration - checkRoleDeclarations (Just rd) rest - where - isSupported :: Declaration -> Bool - isSupported DataDeclaration{} = True - isSupported ExternDataDeclaration{} = True - isSupported _ = False - matchesDeclaration :: Declaration -> Bool - matchesDeclaration (DataDeclaration _ _ name' _ _) = rdeclIdent == name' - matchesDeclaration (ExternDataDeclaration _ name' _) = rdeclIdent == name' - matchesDeclaration (TypeSynonymDeclaration _ name' _ _) = rdeclIdent == name' - matchesDeclaration (TypeClassDeclaration _ name' _ _ _ _) = rdeclIdent == coerceProperName name' - matchesDeclaration _ = False - checkRoleDeclarations _ (d : rest) = checkRoleDeclarations (Just d) rest - checkRoleDeclarations _ [] = return () + checkRoleDeclarations :: Maybe Declaration -> [Declaration] -> m () + checkRoleDeclarations Nothing (RoleDeclaration RoleDeclarationData {..} : _) = + throwError . errorMessage' (fst rdeclSourceAnn) $ OrphanRoleDeclaration rdeclIdent + checkRoleDeclarations (Just (RoleDeclaration (RoleDeclarationData _ name' _))) ((RoleDeclaration RoleDeclarationData {..}) : _) + | name' == rdeclIdent = + throwError . errorMessage' (fst rdeclSourceAnn) $ DuplicateRoleDeclaration rdeclIdent + checkRoleDeclarations (Just d) (rd@(RoleDeclaration RoleDeclarationData {..}) : rest) = do + unless (matchesDeclaration d) . throwError . errorMessage' (fst rdeclSourceAnn) $ OrphanRoleDeclaration rdeclIdent + unless (isSupported d) . throwError . errorMessage' (fst rdeclSourceAnn) $ UnsupportedRoleDeclaration + checkRoleDeclarations (Just rd) rest + where + isSupported :: Declaration -> Bool + isSupported DataDeclaration {} = True + isSupported ExternDataDeclaration {} = True + isSupported _ = False + matchesDeclaration :: Declaration -> Bool + matchesDeclaration (DataDeclaration _ _ name' _ _) = rdeclIdent == name' + matchesDeclaration (ExternDataDeclaration _ name' _) = rdeclIdent == name' + matchesDeclaration (TypeSynonymDeclaration _ name' _ _) = rdeclIdent == name' + matchesDeclaration (TypeClassDeclaration _ name' _ _ _ _) = rdeclIdent == coerceProperName name' + matchesDeclaration _ = False + checkRoleDeclarations _ (d : rest) = checkRoleDeclarations (Just d) rest + checkRoleDeclarations _ [] = return () diff --git a/src/Language/PureScript/Traversals.hs b/src/Language/PureScript/Traversals.hs index 1226342c7..9ec6ca174 100644 --- a/src/Language/PureScript/Traversals.hs +++ b/src/Language/PureScript/Traversals.hs @@ -4,19 +4,19 @@ module Language.PureScript.Traversals where import Prelude sndM :: (Functor f) => (b -> f c) -> (a, b) -> f (a, c) -sndM f (a, b) = (a, ) <$> f b +sndM f (a, b) = (a,) <$> f b sndM' :: (Functor f) => (a -> b -> f c) -> (a, b) -> f (a, c) -sndM' f (a, b) = (a, ) <$> f a b +sndM' f (a, b) = (a,) <$> f a b thirdM :: (Functor f) => (c -> f d) -> (a, b, c) -> f (a, b, d) -thirdM f (a, b, c) = (a, b, ) <$> f c +thirdM f (a, b, c) = (a,b,) <$> f c pairM :: (Applicative f) => (a -> f c) -> (b -> f d) -> (a, b) -> f (c, d) -pairM f g (a, b) = (,) <$> f a <*> g b +pairM f g (a, b) = (,) <$> f a <*> g b eitherM :: (Applicative f) => (a -> f c) -> (b -> f d) -> Either a b -> f (Either c d) -eitherM f _ (Left a) = Left <$> f a +eitherM f _ (Left a) = Left <$> f a eitherM _ g (Right b) = Right <$> g b defS :: (Monad m) => st -> val -> m (st, val) diff --git a/src/Language/PureScript/TypeChecker.hs b/src/Language/PureScript/TypeChecker.hs index 479a01f01..462b6a957 100644 --- a/src/Language/PureScript/TypeChecker.hs +++ b/src/Language/PureScript/TypeChecker.hs @@ -1,93 +1,94 @@ --- | --- The top-level type checker, which checks all declarations in a module. --- -module Language.PureScript.TypeChecker - ( module T - , typeCheckModule - , checkNewtype - ) where +{- | +The top-level type checker, which checks all declarations in a module. +-} +module Language.PureScript.TypeChecker ( + module T, + typeCheckModule, + checkNewtype, + typeCheckAll, +) where -import Prelude import Protolude (headMay, maybeToLeft, ordNub) +import Prelude import Control.Lens ((^..), _2) -import Control.Monad (when, unless, void, forM, zipWithM_) -import Control.Monad.Error.Class (MonadError(..)) -import Control.Monad.State.Class (MonadState(..), modify, gets) +import Control.Monad (forM, unless, void, when, zipWithM_) +import Control.Monad.Error.Class (MonadError (..)) +import Control.Monad.State.Class (MonadState (..), gets, modify) import Control.Monad.Supply.Class (MonadSupply) import Control.Monad.Writer.Class (MonadWriter, tell) -import Data.Foldable (for_, traverse_, toList) -import Data.List (nubBy, (\\), sort, group) -import Data.Maybe (fromMaybe, listToMaybe, mapMaybe) import Data.Either (partitionEithers) -import Data.Text (Text) +import Data.Foldable (for_, toList, traverse_) +import Data.List (group, nubBy, sort, (\\)) import Data.List.NonEmpty qualified as NEL import Data.Map qualified as M +import Data.Maybe (fromMaybe, listToMaybe, mapMaybe) import Data.Set qualified as S +import Data.Text (Text) import Data.Text qualified as T import Language.PureScript.AST import Language.PureScript.AST.Declarations.ChainId (ChainId) import Language.PureScript.Constants.Libs qualified as Libs import Language.PureScript.Crash (internalError) -import Language.PureScript.Environment (DataDeclType(..), Environment(..), FunctionalDependency, NameKind(..), NameVisibility(..), TypeClassData(..), TypeKind(..), isDictTypeName, kindArity, makeTypeClassData, nominalRolesForKind, tyFunction) -import Language.PureScript.Errors (MultipleErrors, SimpleErrorMessage(..), addHint, errorMessage, errorMessage', positionedError, rethrow, warnAndRethrow) +import Language.PureScript.Environment (DataDeclType (..), Environment (..), FunctionalDependency, NameKind (..), NameVisibility (..), TypeClassData (..), TypeKind (..), isDictTypeName, kindArity, makeTypeClassData, nominalRolesForKind, tyFunction) +import Language.PureScript.Errors (MultipleErrors, SimpleErrorMessage (..), addHint, errorMessage, errorMessage', positionedError, rethrow, warnAndRethrow) import Language.PureScript.Linter (checkExhaustiveExpr) import Language.PureScript.Linter.Wildcards (ignoreWildcardsUnderCompleteTypeSignatures) -import Language.PureScript.Names (Ident, ModuleName, ProperName, ProperNameType(..), Qualified(..), QualifiedBy(..), coerceProperName, disqualify, isPlainIdent, mkQualified) +import Language.PureScript.Names (Ident, ModuleName, ProperName, ProperNameType (..), Qualified (..), QualifiedBy (..), coerceProperName, disqualify, isPlainIdent, mkQualified) import Language.PureScript.Roles (Role) -import Language.PureScript.Sugar.Names.Env (Exports(..)) +import Language.PureScript.Sugar.Names.Env (Exports (..)) import Language.PureScript.TypeChecker.Kinds as T import Language.PureScript.TypeChecker.Monad as T import Language.PureScript.TypeChecker.Roles as T import Language.PureScript.TypeChecker.Synonyms as T import Language.PureScript.TypeChecker.Types as T import Language.PureScript.TypeChecker.Unify (varIfUnknown) -import Language.PureScript.TypeClassDictionaries (NamedDict, TypeClassDictionaryInScope(..)) -import Language.PureScript.Types (Constraint(..), SourceConstraint, SourceType, Type(..), containsForAll, eqType, everythingOnTypes, overConstraintArgs, srcInstanceType, unapplyTypes) - -addDataType - :: (MonadState CheckState m, MonadError MultipleErrors m, MonadWriter MultipleErrors m) - => ModuleName - -> DataDeclType - -> ProperName 'TypeName - -> [(Text, Maybe SourceType, Role)] - -> [(DataConstructorDeclaration, SourceType)] - -> SourceType - -> m () +import Language.PureScript.TypeClassDictionaries (NamedDict, TypeClassDictionaryInScope (..)) +import Language.PureScript.Types (Constraint (..), SourceConstraint, SourceType, Type (..), containsForAll, eqType, everythingOnTypes, overConstraintArgs, srcInstanceType, unapplyTypes) + +addDataType :: + (MonadState CheckState m, MonadError MultipleErrors m, MonadWriter MultipleErrors m) => + ModuleName -> + DataDeclType -> + ProperName 'TypeName -> + [(Text, SourceType, Role)] -> + [(DataConstructorDeclaration, SourceType)] -> + SourceType -> + m () addDataType moduleName dtype name args dctors ctorKind = do env <- getEnv let mapDataCtor (DataConstructorDeclaration _ ctorName vars) = (ctorName, snd <$> vars) qualName = Qualified (ByModuleName moduleName) name hasSig = qualName `M.member` types env - putEnv $ env { types = M.insert qualName (ctorKind, DataType dtype args (map (mapDataCtor . fst) dctors)) (types env) } + putEnv $ env {types = M.insert qualName (ctorKind, DataType dtype args (map (mapDataCtor . fst) dctors)) (types env)} unless (hasSig || isDictTypeName name || not (containsForAll ctorKind)) $ do tell . errorMessage $ MissingKindDeclaration (if dtype == Newtype then NewtypeSig else DataSig) name ctorKind for_ dctors $ \(DataConstructorDeclaration _ dctor fields, polyType) -> warnAndRethrow (addHint (ErrorInDataConstructor dctor)) $ addDataConstructor moduleName dtype name dctor fields polyType -addDataConstructor - :: (MonadState CheckState m, MonadError MultipleErrors m) - => ModuleName - -> DataDeclType - -> ProperName 'TypeName - -> ProperName 'ConstructorName - -> [(Ident, SourceType)] - -> SourceType - -> m () +addDataConstructor :: + (MonadState CheckState m, MonadError MultipleErrors m) => + ModuleName -> + DataDeclType -> + ProperName 'TypeName -> + ProperName 'ConstructorName -> + [(Ident, SourceType)] -> + SourceType -> + m () addDataConstructor moduleName dtype name dctor dctorArgs polyType = do let fields = fst <$> dctorArgs env <- getEnv checkTypeSynonyms polyType - putEnv $ env { dataConstructors = M.insert (Qualified (ByModuleName moduleName) dctor) (dtype, name, polyType, fields) (dataConstructors env) } + putEnv $ env {dataConstructors = M.insert (Qualified (ByModuleName moduleName) dctor) (dtype, name, polyType, fields) (dataConstructors env)} -checkRoleDeclaration - :: (MonadState CheckState m, MonadError MultipleErrors m, MonadWriter MultipleErrors m) - => ModuleName - -> RoleDeclarationData - -> m () +checkRoleDeclaration :: + (MonadState CheckState m, MonadError MultipleErrors m, MonadWriter MultipleErrors m) => + ModuleName -> + RoleDeclarationData -> + m () checkRoleDeclaration moduleName (RoleDeclarationData (ss, _) name declaredRoles) = do warnAndRethrow (addHint (ErrorInRoleDeclaration name) . addHint (positionedError ss)) $ do env <- getEnv @@ -97,20 +98,20 @@ checkRoleDeclaration moduleName (RoleDeclarationData (ss, _) name declaredRoles) checkRoleDeclarationArity name declaredRoles (length args) checkRoles args declaredRoles let args' = zipWith (\(v, k, _) r -> (v, k, r)) args declaredRoles - putEnv $ env { types = M.insert qualName (kind, DataType dtype args' dctors) (types env) } + putEnv $ env {types = M.insert qualName (kind, DataType dtype args' dctors) (types env)} Just (kind, ExternData _) -> do checkRoleDeclarationArity name declaredRoles (kindArity kind) - putEnv $ env { types = M.insert qualName (kind, ExternData declaredRoles) (types env) } + putEnv $ env {types = M.insert qualName (kind, ExternData declaredRoles) (types env)} _ -> internalError "Unsupported role declaration" -addTypeSynonym - :: (MonadState CheckState m, MonadError MultipleErrors m, MonadWriter MultipleErrors m) - => ModuleName - -> ProperName 'TypeName - -> [(Text, Maybe SourceType)] - -> SourceType - -> SourceType - -> m () +addTypeSynonym :: + (MonadState CheckState m, MonadError MultipleErrors m, MonadWriter MultipleErrors m) => + ModuleName -> + ProperName 'TypeName -> + [(Text, SourceType)] -> + SourceType -> + SourceType -> + m () addTypeSynonym moduleName name args ty kind = do env <- getEnv checkTypeSynonyms ty @@ -118,42 +119,45 @@ addTypeSynonym moduleName name args ty kind = do hasSig = qualName `M.member` types env unless (hasSig || not (containsForAll kind)) $ do tell . errorMessage $ MissingKindDeclaration TypeSynonymSig name kind - putEnv $ env { types = M.insert qualName (kind, TypeSynonym) (types env) - , typeSynonyms = M.insert qualName (args, ty) (typeSynonyms env) } - -valueIsNotDefined - :: (MonadState CheckState m, MonadError MultipleErrors m) - => ModuleName - -> Ident - -> m () + putEnv $ + env + { types = M.insert qualName (kind, TypeSynonym) (types env) + , typeSynonyms = M.insert qualName (args, ty) (typeSynonyms env) + } + +valueIsNotDefined :: + (MonadState CheckState m, MonadError MultipleErrors m) => + ModuleName -> + Ident -> + m () valueIsNotDefined moduleName name = do env <- getEnv case M.lookup (Qualified (ByModuleName moduleName) name) (names env) of Just _ -> throwError . errorMessage $ RedefinedIdent name Nothing -> return () -addValue - :: (MonadState CheckState m) - => ModuleName - -> Ident - -> SourceType - -> NameKind - -> m () +addValue :: + (MonadState CheckState m) => + ModuleName -> + Ident -> + SourceType -> + NameKind -> + m () addValue moduleName name ty nameKind = do env <- getEnv - putEnv (env { names = M.insert (Qualified (ByModuleName moduleName) name) (ty, nameKind, Defined) (names env) }) - -addTypeClass - :: forall m - . (MonadState CheckState m, MonadError MultipleErrors m, MonadWriter MultipleErrors m) - => ModuleName - -> Qualified (ProperName 'ClassName) - -> [(Text, Maybe SourceType)] - -> [SourceConstraint] - -> [FunctionalDependency] - -> [Declaration] - -> SourceType - -> m () + putEnv (env {names = M.insert (Qualified (ByModuleName moduleName) name) (ty, nameKind, Defined) (names env)}) + +addTypeClass :: + forall m. + (MonadState CheckState m, MonadError MultipleErrors m, MonadWriter MultipleErrors m) => + ModuleName -> + Qualified (ProperName 'ClassName) -> + [(Text, SourceType)] -> + [SourceConstraint] -> + [FunctionalDependency] -> + [Declaration] -> + SourceType -> + m () addTypeClass _ qualifiedClassName args implies dependencies ds kind = do env <- getEnv newClass <- mkNewClass @@ -161,8 +165,11 @@ addTypeClass _ qualifiedClassName args implies dependencies ds kind = do hasSig = qualName `M.member` types env unless (hasSig || not (containsForAll kind)) $ do tell . errorMessage $ MissingKindDeclaration ClassSig (disqualify qualName) kind - putEnv $ env { types = M.insert qualName (kind, ExternData (nominalRolesForKind kind)) (types env) - , typeClasses = M.insert qualifiedClassName newClass (typeClasses env) } + putEnv $ + env + { types = M.insert qualName (kind, ExternData (nominalRolesForKind kind)) (types env) + , typeClasses = M.insert qualifiedClassName newClass (typeClasses env) + } where classMembers :: [(Ident, SourceType)] classMembers = map toPair ds @@ -174,421 +181,435 @@ addTypeClass _ qualifiedClassName args implies dependencies ds kind = do let ctIsEmpty = null classMembers && all (typeClassIsEmpty . findSuperClass env) implies' pure $ makeTypeClassData args classMembers implies' dependencies ctIsEmpty where - findSuperClass env c = case M.lookup (constraintClass c) (typeClasses env) of - Just tcd -> tcd - Nothing -> internalError "Unknown super class in TypeClassDeclaration" + findSuperClass env c = case M.lookup (constraintClass c) (typeClasses env) of + Just tcd -> tcd + Nothing -> internalError "Unknown super class in TypeClassDeclaration" toPair (TypeDeclaration (TypeDeclarationData _ ident ty)) = (ident, ty) toPair _ = internalError "Invalid declaration in TypeClassDeclaration" -addTypeClassDictionaries - :: (MonadState CheckState m) - => QualifiedBy - -> M.Map (Qualified (ProperName 'ClassName)) (M.Map (Qualified Ident) (NEL.NonEmpty NamedDict)) - -> m () +addTypeClassDictionaries :: + (MonadState CheckState m) => + QualifiedBy -> + M.Map (Qualified (ProperName 'ClassName)) (M.Map (Qualified Ident) (NEL.NonEmpty NamedDict)) -> + m () addTypeClassDictionaries mn entries = - modify $ \st -> st { checkEnv = (checkEnv st) { typeClassDictionaries = insertState st } } - where insertState st = M.insertWith (M.unionWith (M.unionWith (<>))) mn entries (typeClassDictionaries . checkEnv $ st) + modify $ \st -> st {checkEnv = (checkEnv st) {typeClassDictionaries = insertState st}} + where + insertState st = M.insertWith (M.unionWith (M.unionWith (<>))) mn entries (typeClassDictionaries . checkEnv $ st) -checkDuplicateTypeArguments - :: (MonadState CheckState m, MonadError MultipleErrors m) - => [Text] - -> m () +checkDuplicateTypeArguments :: + (MonadState CheckState m, MonadError MultipleErrors m) => + [Text] -> + m () checkDuplicateTypeArguments args = for_ firstDup $ \dup -> throwError . errorMessage $ DuplicateTypeArgument dup where - firstDup :: Maybe Text - firstDup = listToMaybe $ args \\ ordNub args - -checkTypeClassInstance - :: (MonadState CheckState m, MonadError MultipleErrors m) - => TypeClassData - -> Int -- ^ index of type class argument - -> SourceType - -> m () -checkTypeClassInstance cls i = check where - -- If the argument is determined via fundeps then we are less restrictive in - -- what type is allowed. This is because the type cannot be used to influence - -- which instance is selected. Currently the only weakened restriction is that - -- row types are allowed in determined type class arguments. - isFunDepDetermined = S.member i (typeClassDeterminedArguments cls) - check = \case - TypeVar _ _ -> return () - TypeLevelString _ _ -> return () - TypeLevelInt _ _ -> return () - TypeConstructor _ _ -> return () - TypeApp _ t1 t2 -> check t1 >> check t2 - KindApp _ t k -> check t >> check k - KindedType _ t _ -> check t - REmpty _ | isFunDepDetermined -> return () - RCons _ _ hd tl | isFunDepDetermined -> check hd >> check tl - ty -> throwError . errorMessage $ InvalidInstanceHead ty - --- | --- Check that type synonyms are fully-applied in a type --- -checkTypeSynonyms - :: (MonadState CheckState m, MonadError MultipleErrors m) - => SourceType - -> m () + firstDup :: Maybe Text + firstDup = listToMaybe $ args \\ ordNub args + +checkTypeClassInstance :: + (MonadState CheckState m, MonadError MultipleErrors m) => + TypeClassData -> + -- | index of type class argument + Int -> + SourceType -> + m () +checkTypeClassInstance cls i = check + where + -- If the argument is determined via fundeps then we are less restrictive in + -- what type is allowed. This is because the type cannot be used to influence + -- which instance is selected. Currently the only weakened restriction is that + -- row types are allowed in determined type class arguments. + isFunDepDetermined = S.member i (typeClassDeterminedArguments cls) + check = \case + TypeVar _ _ _ -> return () + TypeLevelString _ _ -> return () + TypeLevelInt _ _ -> return () + TypeConstructor _ _ -> return () + TypeApp _ t1 t2 -> check t1 >> check t2 + KindApp _ t k -> check t >> check k + KindedType _ t _ -> check t + REmpty _ | isFunDepDetermined -> return () + RCons _ _ hd tl | isFunDepDetermined -> check hd >> check tl + ty -> throwError . errorMessage $ InvalidInstanceHead ty + +{- | +Check that type synonyms are fully-applied in a type +-} +checkTypeSynonyms :: + (MonadState CheckState m, MonadError MultipleErrors m) => + SourceType -> + m () checkTypeSynonyms = void . replaceAllTypeSynonyms --- | --- Type check all declarations in a module --- --- At this point, many declarations will have been desugared, but it is still necessary to --- --- * Kind-check all types and add them to the @Environment@ --- --- * Type-check all values and add them to the @Environment@ --- --- * Infer all type roles and add them to the @Environment@ --- --- * Bring type class instances into scope --- --- * Process module imports --- -typeCheckAll - :: forall m - . (MonadSupply m, MonadState CheckState m, MonadError MultipleErrors m, MonadWriter MultipleErrors m) - => ModuleName - -> [Declaration] - -> m [Declaration] +{- | +Type check all declarations in a module + +At this point, many declarations will have been desugared, but it is still necessary to + + * Kind-check all types and add them to the @Environment@ + + * Type-check all values and add them to the @Environment@ + + * Infer all type roles and add them to the @Environment@ + + * Bring type class instances into scope + + * Process module imports +-} +typeCheckAll :: + forall m. + (MonadSupply m, MonadState CheckState m, MonadError MultipleErrors m, MonadWriter MultipleErrors m) => + ModuleName -> + [Declaration] -> + m [Declaration] typeCheckAll moduleName = traverse go where - go :: Declaration -> m Declaration - go (DataDeclaration sa@(ss, _) dtype name args dctors) = do - warnAndRethrow (addHint (ErrorInTypeConstructor name) . addHint (positionedError ss)) $ do - when (dtype == Newtype) $ void $ checkNewtype name dctors - checkDuplicateTypeArguments $ map fst args - (dataCtors, ctorKind) <- kindOfData moduleName (sa, name, args, dctors) - let args' = args `withKinds` ctorKind - env <- getEnv - dctors' <- traverse (replaceTypeSynonymsInDataConstructor . fst) dataCtors - let args'' = args' `withRoles` inferRoles env moduleName name args' dctors' - addDataType moduleName dtype name args'' dataCtors ctorKind - return $ DataDeclaration sa dtype name args dctors - go d@(DataBindingGroupDeclaration tys) = do - let tysList = NEL.toList tys - syns = mapMaybe toTypeSynonym tysList - dataDecls = mapMaybe toDataDecl tysList - roleDecls = mapMaybe toRoleDecl tysList - clss = mapMaybe toClassDecl tysList - bindingGroupNames = ordNub ((syns ^.. traverse . _2) ++ (dataDecls ^.. traverse . _2 . _2) ++ fmap coerceProperName (clss ^.. traverse . _2 . _2)) - sss = fmap declSourceSpan tys - warnAndRethrow (addHint (ErrorInDataBindingGroup bindingGroupNames) . addHint (PositionedError sss)) $ do - env <- getEnv - (syn_ks, data_ks, cls_ks) <- kindsOfAll moduleName syns (fmap snd dataDecls) (fmap snd clss) - for_ (zip syns syn_ks) $ \((_, name, args, _), (elabTy, kind)) -> do + go :: Declaration -> m Declaration + go (DataDeclaration sa@(ss, _) dtype name args dctors) = do + warnAndRethrow (addHint (ErrorInTypeConstructor name) . addHint (positionedError ss)) $ do + when (dtype == Newtype) $ void $ checkNewtype name dctors checkDuplicateTypeArguments $ map fst args + (dataCtors, ctorKind) <- kindOfData moduleName (sa, name, args, dctors) + let args' = args `withKinds` ctorKind + env <- getEnv + dctors' <- traverse (replaceTypeSynonymsInDataConstructor . fst) dataCtors + let args'' = args' `withRoles` inferRoles env moduleName name args' dctors' + addDataType moduleName dtype name args'' dataCtors ctorKind + return $ DataDeclaration sa dtype name args dctors + go d@(DataBindingGroupDeclaration tys) = do + let tysList = NEL.toList tys + syns = mapMaybe toTypeSynonym tysList + dataDecls = mapMaybe toDataDecl tysList + roleDecls = mapMaybe toRoleDecl tysList + clss = mapMaybe toClassDecl tysList + bindingGroupNames = ordNub ((syns ^.. traverse . _2) ++ (dataDecls ^.. traverse . _2 . _2) ++ fmap coerceProperName (clss ^.. traverse . _2 . _2)) + sss = fmap declSourceSpan tys + warnAndRethrow (addHint (ErrorInDataBindingGroup bindingGroupNames) . addHint (PositionedError sss)) $ do + env <- getEnv + (syn_ks, data_ks, cls_ks) <- kindsOfAll moduleName syns (fmap snd dataDecls) (fmap snd clss) + for_ (zip syns syn_ks) $ \((_, name, args, _), (elabTy, kind)) -> do + checkDuplicateTypeArguments $ map fst args + let args' = args `withKinds` kind + addTypeSynonym moduleName name args' elabTy kind + let dataDeclsWithKinds = + zipWith + ( \(dtype, (_, name, args, _)) (dataCtors, ctorKind) -> + (dtype, name, args `withKinds` ctorKind, dataCtors, ctorKind) + ) + dataDecls + data_ks + inferRoles' <- fmap (inferDataBindingGroupRoles env moduleName roleDecls) + . forM dataDeclsWithKinds + $ \(_, name, args, dataCtors, _) -> + (name,args,) <$> traverse (replaceTypeSynonymsInDataConstructor . fst) dataCtors + for_ dataDeclsWithKinds $ \(dtype, name, args', dataCtors, ctorKind) -> do + when (dtype == Newtype) $ void $ checkNewtype name (map fst dataCtors) + checkDuplicateTypeArguments $ map fst args' + let args'' = args' `withRoles` inferRoles' name args' + addDataType moduleName dtype name args'' dataCtors ctorKind + for_ roleDecls $ checkRoleDeclaration moduleName + for_ (zip clss cls_ks) $ \((deps, (sa, pn, _, _, _)), (args', implies', tys', kind)) -> do + let qualifiedClassName = Qualified (ByModuleName moduleName) pn + guardWith (errorMessage (DuplicateTypeClass pn (fst sa))) $ + not (M.member qualifiedClassName (typeClasses env)) + addTypeClass moduleName qualifiedClassName args' implies' deps tys' kind + return d + where + toTypeSynonym (TypeSynonymDeclaration sa nm args ty) = Just (sa, nm, args, ty) + toTypeSynonym _ = Nothing + toDataDecl (DataDeclaration sa dtype nm args dctors) = Just (dtype, (sa, nm, args, dctors)) + toDataDecl _ = Nothing + toRoleDecl (RoleDeclaration rdd) = Just rdd + toRoleDecl _ = Nothing + toClassDecl (TypeClassDeclaration sa nm args implies deps decls) = Just (deps, (sa, nm, args, implies, decls)) + toClassDecl _ = Nothing + go (TypeSynonymDeclaration sa@(ss, _) name args ty) = do + warnAndRethrow (addHint (ErrorInTypeSynonym name) . addHint (positionedError ss)) $ do + checkDuplicateTypeArguments $ map fst args + (elabTy, kind) <- kindOfTypeSynonym moduleName (sa, name, args, ty) let args' = args `withKinds` kind addTypeSynonym moduleName name args' elabTy kind - let dataDeclsWithKinds = zipWith (\(dtype, (_, name, args, _)) (dataCtors, ctorKind) -> - (dtype, name, args `withKinds` ctorKind, dataCtors, ctorKind)) dataDecls data_ks - inferRoles' <- fmap (inferDataBindingGroupRoles env moduleName roleDecls) . - forM dataDeclsWithKinds $ \(_, name, args, dataCtors, _) -> - (name, args,) <$> traverse (replaceTypeSynonymsInDataConstructor . fst) dataCtors - for_ dataDeclsWithKinds $ \(dtype, name, args', dataCtors, ctorKind) -> do - when (dtype == Newtype) $ void $ checkNewtype name (map fst dataCtors) - checkDuplicateTypeArguments $ map fst args' - let args'' = args' `withRoles` inferRoles' name args' - addDataType moduleName dtype name args'' dataCtors ctorKind - for_ roleDecls $ checkRoleDeclaration moduleName - for_ (zip clss cls_ks) $ \((deps, (sa, pn, _, _, _)), (args', implies', tys', kind)) -> do - let qualifiedClassName = Qualified (ByModuleName moduleName) pn - guardWith (errorMessage (DuplicateTypeClass pn (fst sa))) $ - not (M.member qualifiedClassName (typeClasses env)) - addTypeClass moduleName qualifiedClassName (fmap Just <$> args') implies' deps tys' kind - return d - where - toTypeSynonym (TypeSynonymDeclaration sa nm args ty) = Just (sa, nm, args, ty) - toTypeSynonym _ = Nothing - toDataDecl (DataDeclaration sa dtype nm args dctors) = Just (dtype, (sa, nm, args, dctors)) - toDataDecl _ = Nothing - toRoleDecl (RoleDeclaration rdd) = Just rdd - toRoleDecl _ = Nothing - toClassDecl (TypeClassDeclaration sa nm args implies deps decls) = Just (deps, (sa, nm, args, implies, decls)) - toClassDecl _ = Nothing - go (TypeSynonymDeclaration sa@(ss, _) name args ty) = do - warnAndRethrow (addHint (ErrorInTypeSynonym name) . addHint (positionedError ss) ) $ do - checkDuplicateTypeArguments $ map fst args - (elabTy, kind) <- kindOfTypeSynonym moduleName (sa, name, args, ty) - let args' = args `withKinds` kind - addTypeSynonym moduleName name args' elabTy kind - return $ TypeSynonymDeclaration sa name args ty - go (KindDeclaration sa@(ss, _) kindFor name ty) = do - warnAndRethrow (addHint (ErrorInKindDeclaration name) . addHint (positionedError ss)) $ do - elabTy <- withFreshSubstitution $ checkKindDeclaration moduleName ty - env <- getEnv - putEnv $ env { types = M.insert (Qualified (ByModuleName moduleName) name) (elabTy, LocalTypeVariable) (types env) } - return $ KindDeclaration sa kindFor name elabTy - go d@(RoleDeclaration rdd) = do - checkRoleDeclaration moduleName rdd - return d - go TypeDeclaration{} = - internalError "Type declarations should have been removed before typeCheckAlld" - go (ValueDecl sa@(ss, _) name nameKind [] [MkUnguarded val]) = do - env <- getEnv - let declHint = if isPlainIdent name then addHint (ErrorInValueDeclaration name) else id - warnAndRethrow (declHint . addHint (positionedError ss)) $ do - val' <- checkExhaustiveExpr ss env moduleName val - valueIsNotDefined moduleName name - typesOf NonRecursiveBindingGroup moduleName [((sa, name), val')] >>= \case - [(_, (val'', ty))] -> do - addValue moduleName name ty nameKind - return $ ValueDecl sa name nameKind [] [MkUnguarded val''] - _ -> internalError "typesOf did not return a singleton" - go ValueDeclaration{} = internalError "Binders were not desugared" - go BoundValueDeclaration{} = internalError "BoundValueDeclaration should be desugared" - go (BindingGroupDeclaration vals) = do - env <- getEnv - let sss = fmap (\(((ss, _), _), _, _) -> ss) vals - warnAndRethrow (addHint (ErrorInBindingGroup (fmap (\((_, ident), _, _) -> ident) vals)) . addHint (PositionedError sss)) $ do - for_ vals $ \((_, ident), _, _) -> valueIsNotDefined moduleName ident - vals' <- NEL.toList <$> traverse (\(sai@((ss, _), _), nk, expr) -> (sai, nk,) <$> checkExhaustiveExpr ss env moduleName expr) vals - tys <- typesOf RecursiveBindingGroup moduleName $ fmap (\(sai, _, ty) -> (sai, ty)) vals' - vals'' <- forM [ (sai, val, nameKind, ty) - | (sai@(_, name), nameKind, _) <- vals' - , ((_, name'), (val, ty)) <- tys - , name == name' - ] $ \(sai@(_, name), val, nameKind, ty) -> do - addValue moduleName name ty nameKind - return (sai, nameKind, val) - return . BindingGroupDeclaration $ NEL.fromList vals'' - go d@(ExternDataDeclaration (ss, _) name kind) = do - warnAndRethrow (addHint (ErrorInForeignImportData name) . addHint (positionedError ss)) $ do - elabKind <- withFreshSubstitution $ checkKindDeclaration moduleName kind - env <- getEnv - let qualName = Qualified (ByModuleName moduleName) name - roles = nominalRolesForKind elabKind - putEnv $ env { types = M.insert qualName (elabKind, ExternData roles) (types env) } + return $ TypeSynonymDeclaration sa name args ty + go (KindDeclaration sa@(ss, _) kindFor name ty) = do + warnAndRethrow (addHint (ErrorInKindDeclaration name) . addHint (positionedError ss)) $ do + elabTy <- withFreshSubstitution $ checkKindDeclaration moduleName ty + env <- getEnv + putEnv $ env {types = M.insert (Qualified (ByModuleName moduleName) name) (elabTy, LocalTypeVariable) (types env)} + return $ KindDeclaration sa kindFor name elabTy + go d@(RoleDeclaration rdd) = do + checkRoleDeclaration moduleName rdd return d - go d@(ExternDeclaration (ss, _) name ty) = do - warnAndRethrow (addHint (ErrorInForeignImport name) . addHint (positionedError ss)) $ do + go TypeDeclaration {} = + internalError "Type declarations should have been removed before typeCheckAlld" + go (ValueDecl sa@(ss, _) name nameKind [] [MkUnguarded val]) = do env <- getEnv - (elabTy, kind) <- withFreshSubstitution $ do - ((unks, ty'), kind) <- kindOfWithUnknowns ty - ty'' <- varIfUnknown unks ty' - pure (ty'', kind) - checkTypeKind elabTy kind - case M.lookup (Qualified (ByModuleName moduleName) name) (names env) of - Just _ -> throwError . errorMessage $ RedefinedIdent name - Nothing -> putEnv (env { names = M.insert (Qualified (ByModuleName moduleName) name) (elabTy, External, Defined) (names env) }) - return d - go d@FixityDeclaration{} = return d - go d@ImportDeclaration{} = return d - go d@(TypeClassDeclaration sa@(ss, _) pn args implies deps tys) = do - warnAndRethrow (addHint (ErrorInTypeClassDeclaration pn) . addHint (positionedError ss)) $ do + let declHint = if isPlainIdent name then addHint (ErrorInValueDeclaration name) else id + warnAndRethrow (declHint . addHint (positionedError ss)) $ do + val' <- checkExhaustiveExpr ss env moduleName val + valueIsNotDefined moduleName name + typesOf NonRecursiveBindingGroup moduleName [((sa, name), val')] >>= \case + [(_, (val'', ty))] -> do + addValue moduleName name ty nameKind + return $ ValueDecl sa name nameKind [] [MkUnguarded val''] + _ -> internalError "typesOf did not return a singleton" + go ValueDeclaration {} = internalError "Binders were not desugared" + go BoundValueDeclaration {} = internalError "BoundValueDeclaration should be desugared" + go (BindingGroupDeclaration vals) = do env <- getEnv - let qualifiedClassName = Qualified (ByModuleName moduleName) pn - guardWith (errorMessage (DuplicateTypeClass pn ss)) $ - not (M.member qualifiedClassName (typeClasses env)) - (args', implies', tys', kind) <- kindOfClass moduleName (sa, pn, args, implies, tys) - addTypeClass moduleName qualifiedClassName (fmap Just <$> args') implies' deps tys' kind + let sss = fmap (\(((ss, _), _), _, _) -> ss) vals + warnAndRethrow (addHint (ErrorInBindingGroup (fmap (\((_, ident), _, _) -> ident) vals)) . addHint (PositionedError sss)) $ do + for_ vals $ \((_, ident), _, _) -> valueIsNotDefined moduleName ident + vals' <- NEL.toList <$> traverse (\(sai@((ss, _), _), nk, expr) -> (sai,nk,) <$> checkExhaustiveExpr ss env moduleName expr) vals + tys <- typesOf RecursiveBindingGroup moduleName $ fmap (\(sai, _, ty) -> (sai, ty)) vals' + vals'' <- forM + [ (sai, val, nameKind, ty) + | (sai@(_, name), nameKind, _) <- vals' + , ((_, name'), (val, ty)) <- tys + , name == name' + ] + $ \(sai@(_, name), val, nameKind, ty) -> do + addValue moduleName name ty nameKind + return (sai, nameKind, val) + return . BindingGroupDeclaration $ NEL.fromList vals'' + go d@(ExternDataDeclaration (ss, _) name kind) = do + warnAndRethrow (addHint (ErrorInForeignImportData name) . addHint (positionedError ss)) $ do + elabKind <- withFreshSubstitution $ checkKindDeclaration moduleName kind + env <- getEnv + let qualName = Qualified (ByModuleName moduleName) name + roles = nominalRolesForKind elabKind + putEnv $ env {types = M.insert qualName (elabKind, ExternData roles) (types env)} + return d + go d@(ExternDeclaration (ss, _) name ty) = do + warnAndRethrow (addHint (ErrorInForeignImport name) . addHint (positionedError ss)) $ do + env <- getEnv + (elabTy, kind) <- withFreshSubstitution $ do + ((unks, ty'), kind) <- kindOfWithUnknowns ty + ty'' <- varIfUnknown unks ty' + pure (ty'', kind) + checkTypeKind elabTy kind + case M.lookup (Qualified (ByModuleName moduleName) name) (names env) of + Just _ -> throwError . errorMessage $ RedefinedIdent name + Nothing -> putEnv (env {names = M.insert (Qualified (ByModuleName moduleName) name) (elabTy, External, Defined) (names env)}) return d - go (TypeInstanceDeclaration _ _ _ _ (Left _) _ _ _ _) = internalError "typeCheckAll: type class instance generated name should have been desugared" - go d@(TypeInstanceDeclaration sa@(ss, _) _ ch idx (Right dictName) deps className tys body) = - rethrow (addHint (ErrorInInstance className tys) . addHint (positionedError ss)) $ do - env <- getEnv - let qualifiedDictName = Qualified (ByModuleName moduleName) dictName - flip (traverse_ . traverse_) (typeClassDictionaries env) $ \dictionaries -> - guardWith (errorMessage (DuplicateInstance dictName ss)) $ - not (M.member qualifiedDictName dictionaries) - case M.lookup className (typeClasses env) of - Nothing -> internalError "typeCheckAll: Encountered unknown type class in instance declaration" - Just typeClass -> do - checkInstanceArity dictName className typeClass tys - (deps', kinds', tys', vars) <- withFreshSubstitution $ checkInstanceDeclaration moduleName (sa, deps, className, tys) - tys'' <- traverse replaceAllTypeSynonyms tys' - zipWithM_ (checkTypeClassInstance typeClass) [0..] tys'' - let nonOrphanModules = findNonOrphanModules className typeClass tys'' - checkOrphanInstance dictName className tys'' nonOrphanModules - let chainId = Just ch - checkOverlappingInstance ss chainId dictName vars className typeClass tys'' nonOrphanModules - _ <- traverseTypeInstanceBody checkInstanceMembers body - deps'' <- (traverse . overConstraintArgs . traverse) replaceAllTypeSynonyms deps' - let dict = - TypeClassDictionaryInScope chainId idx qualifiedDictName [] className vars kinds' tys'' (Just deps'') $ - if isPlainIdent dictName then Nothing else Just $ srcInstanceType ss vars className tys'' - addTypeClassDictionaries (ByModuleName moduleName) . M.singleton className $ M.singleton (tcdValue dict) (pure dict) - return d - - checkInstanceArity :: Ident -> Qualified (ProperName 'ClassName) -> TypeClassData -> [SourceType] -> m () - checkInstanceArity dictName className typeClass tys = do - let typeClassArity = length (typeClassArguments typeClass) - instanceArity = length tys - when (typeClassArity /= instanceArity) $ - throwError . errorMessage $ ClassInstanceArityMismatch dictName className typeClassArity instanceArity - - checkInstanceMembers :: [Declaration] -> m [Declaration] - checkInstanceMembers instDecls = do - let idents = sort . map head . group . map memberName $ instDecls - for_ (firstDuplicate idents) $ \ident -> - throwError . errorMessage $ DuplicateValueDeclaration ident - return instDecls - where - memberName :: Declaration -> Ident - memberName (ValueDeclaration vd) = valdeclIdent vd - memberName _ = internalError "checkInstanceMembers: Invalid declaration in type instance definition" - - firstDuplicate :: (Eq a) => [a] -> Maybe a - firstDuplicate (x : xs@(y : _)) - | x == y = Just x - | otherwise = firstDuplicate xs - firstDuplicate _ = Nothing - - findNonOrphanModules - :: Qualified (ProperName 'ClassName) - -> TypeClassData - -> [SourceType] - -> S.Set ModuleName - findNonOrphanModules (Qualified (ByModuleName mn') _) typeClass tys' = nonOrphanModules - where - nonOrphanModules :: S.Set ModuleName - nonOrphanModules = S.insert mn' nonOrphanModules' - - typeModule :: SourceType -> Maybe ModuleName - typeModule (TypeVar _ _) = Nothing - typeModule (TypeLevelString _ _) = Nothing - typeModule (TypeLevelInt _ _) = Nothing - typeModule (TypeConstructor _ (Qualified (ByModuleName mn'') _)) = Just mn'' - typeModule (TypeConstructor _ (Qualified (BySourcePos _) _)) = internalError "Unqualified type name in findNonOrphanModules" - typeModule (TypeApp _ t1 _) = typeModule t1 - typeModule (KindApp _ t1 _) = typeModule t1 - typeModule (KindedType _ t1 _) = typeModule t1 - typeModule _ = internalError "Invalid type in instance in findNonOrphanModules" - - modulesByTypeIndex :: M.Map Int (Maybe ModuleName) - modulesByTypeIndex = M.fromList (zip [0 ..] (typeModule <$> tys')) - - lookupModule :: Int -> S.Set ModuleName - lookupModule idx = case M.lookup idx modulesByTypeIndex of - Just ms -> S.fromList (toList ms) - Nothing -> internalError "Unknown type index in findNonOrphanModules" - - -- If the instance is declared in a module that wouldn't be found based on a covering set - -- then it is considered an orphan - because we'd have a situation in which we expect an - -- instance but can't find it. So a valid module must be applicable across *all* covering - -- sets - therefore we take the intersection of covering set modules. - nonOrphanModules' :: S.Set ModuleName - nonOrphanModules' = foldl1 S.intersection (foldMap lookupModule `S.map` typeClassCoveringSets typeClass) - findNonOrphanModules _ _ _ = internalError "Unqualified class name in findNonOrphanModules" - - -- Check that the instance currently being declared doesn't overlap with any - -- other instance in any module that this instance wouldn't be considered an - -- orphan in. There are overlapping instance situations that won't be caught - -- by this, for example when combining multiparameter type classes with - -- flexible instances: the instances `Cls X y` and `Cls x Y` overlap and - -- could live in different modules but won't be caught here. - checkOverlappingInstance - :: SourceSpan - -> Maybe ChainId - -> Ident - -> [(Text, SourceType)] - -> Qualified (ProperName 'ClassName) - -> TypeClassData - -> [SourceType] - -> S.Set ModuleName - -> m () - checkOverlappingInstance ss ch dictName vars className typeClass tys' nonOrphanModules = do - for_ nonOrphanModules $ \m -> do - dicts <- M.toList <$> lookupTypeClassDictionariesForClass (ByModuleName m) className - - for_ dicts $ \(Qualified mn' ident, dictNel) -> do - for_ dictNel $ \dict -> do - -- ignore instances in the same instance chain - if ch == tcdChain dict || - instancesAreApart (typeClassCoveringSets typeClass) tys' (tcdInstanceTypes dict) - then return () - else do - let this = if isPlainIdent dictName then Right dictName else Left $ srcInstanceType ss vars className tys' - let that = Qualified mn' . maybeToLeft ident $ tcdDescription dict - throwError . errorMessage $ - OverlappingInstances className - tys' - [that, Qualified (ByModuleName moduleName) this] - - instancesAreApart - :: S.Set (S.Set Int) - -> [SourceType] - -> [SourceType] - -> Bool - instancesAreApart sets lhs rhs = all (any typesApart . S.toList) (S.toList sets) - where - typesApart :: Int -> Bool - typesApart i = typeHeadsApart (lhs !! i) (rhs !! i) - - -- Note: implementation doesn't need to care about all possible cases: - -- TUnknown, Skolem, etc. - typeHeadsApart :: SourceType -> SourceType -> Bool - typeHeadsApart l r | eqType l r = False - typeHeadsApart (TypeVar _ _) _ = False - typeHeadsApart _ (TypeVar _ _) = False - typeHeadsApart (KindedType _ t1 _) t2 = typeHeadsApart t1 t2 - typeHeadsApart t1 (KindedType _ t2 _) = typeHeadsApart t1 t2 - typeHeadsApart (TypeApp _ h1 t1) (TypeApp _ h2 t2) = typeHeadsApart h1 h2 || typeHeadsApart t1 t2 - typeHeadsApart _ _ = True - - checkOrphanInstance - :: Ident - -> Qualified (ProperName 'ClassName) - -> [SourceType] - -> S.Set ModuleName - -> m () - checkOrphanInstance dictName className tys' nonOrphanModules - | moduleName `S.member` nonOrphanModules = return () - | otherwise = throwError . errorMessage $ OrphanInstance dictName className nonOrphanModules tys' - - -- This function adds the argument kinds for a type constructor so that they may appear in the externs file, - -- extracted from the kind of the type constructor itself. - -- - withKinds :: [(Text, Maybe SourceType)] -> SourceType -> [(Text, Maybe SourceType)] - withKinds [] _ = [] - withKinds ss (ForAll _ _ _ _ k _) = withKinds ss k - withKinds (s@(_, Just _):ss) (TypeApp _ (TypeApp _ tyFn _) k2) | eqType tyFn tyFunction = s : withKinds ss k2 - withKinds ((s, Nothing):ss) (TypeApp _ (TypeApp _ tyFn k1) k2) | eqType tyFn tyFunction = (s, Just k1) : withKinds ss k2 - withKinds _ _ = internalError "Invalid arguments to withKinds" - - withRoles :: [(Text, Maybe SourceType)] -> [Role] -> [(Text, Maybe SourceType, Role)] - withRoles = zipWith $ \(v, k) r -> (v, k, r) - - replaceTypeSynonymsInDataConstructor :: DataConstructorDeclaration -> m DataConstructorDeclaration - replaceTypeSynonymsInDataConstructor DataConstructorDeclaration{..} = do - dataCtorFields' <- traverse (traverse replaceAllTypeSynonyms) dataCtorFields - return DataConstructorDeclaration - { dataCtorFields = dataCtorFields' - , .. - } - --- | Check that a newtype has just one data constructor with just one field, or --- throw an error. If the newtype is valid, this function returns the single --- data constructor declaration and the single field, as a 'proof' that the --- newtype was indeed a valid newtype. -checkNewtype - :: forall m - . MonadError MultipleErrors m - => ProperName 'TypeName - -> [DataConstructorDeclaration] - -> m (DataConstructorDeclaration, (Ident, SourceType)) + go d@FixityDeclaration {} = return d + go d@ImportDeclaration {} = return d + go d@(TypeClassDeclaration sa@(ss, _) pn args implies deps tys) = do + warnAndRethrow (addHint (ErrorInTypeClassDeclaration pn) . addHint (positionedError ss)) $ do + env <- getEnv + let qualifiedClassName = Qualified (ByModuleName moduleName) pn + guardWith (errorMessage (DuplicateTypeClass pn ss)) $ + not (M.member qualifiedClassName (typeClasses env)) + (args', implies', tys', kind) <- kindOfClass moduleName (sa, pn, args, implies, tys) + addTypeClass moduleName qualifiedClassName args' implies' deps tys' kind + return d + go (TypeInstanceDeclaration _ _ _ _ (Left _) _ _ _ _) = internalError "typeCheckAll: type class instance generated name should have been desugared" + go d@(TypeInstanceDeclaration sa@(ss, _) _ ch idx (Right dictName) deps className tys body) = + rethrow (addHint (ErrorInInstance className tys) . addHint (positionedError ss)) $ do + env <- getEnv + let qualifiedDictName = Qualified (ByModuleName moduleName) dictName + flip (traverse_ . traverse_) (typeClassDictionaries env) $ \dictionaries -> + guardWith (errorMessage (DuplicateInstance dictName ss)) $ + not (M.member qualifiedDictName dictionaries) + case M.lookup className (typeClasses env) of + Nothing -> internalError "typeCheckAll: Encountered unknown type class in instance declaration" + Just typeClass -> do + checkInstanceArity dictName className typeClass tys + (deps', kinds', tys', vars) <- withFreshSubstitution $ checkInstanceDeclaration moduleName (sa, deps, className, tys) + tys'' <- traverse replaceAllTypeSynonyms tys' + zipWithM_ (checkTypeClassInstance typeClass) [0 ..] tys'' + let nonOrphanModules = findNonOrphanModules className typeClass tys'' + checkOrphanInstance dictName className tys'' nonOrphanModules + let chainId = Just ch + checkOverlappingInstance ss chainId dictName vars className typeClass tys'' nonOrphanModules + _ <- traverseTypeInstanceBody checkInstanceMembers body + deps'' <- (traverse . overConstraintArgs . traverse) replaceAllTypeSynonyms deps' + let dict = + TypeClassDictionaryInScope chainId idx qualifiedDictName [] className vars kinds' tys'' (Just deps'') $ + if isPlainIdent dictName then Nothing else Just $ srcInstanceType ss vars className tys'' + addTypeClassDictionaries (ByModuleName moduleName) . M.singleton className $ M.singleton (tcdValue dict) (pure dict) + return d + + checkInstanceArity :: Ident -> Qualified (ProperName 'ClassName) -> TypeClassData -> [SourceType] -> m () + checkInstanceArity dictName className typeClass tys = do + let typeClassArity = length (typeClassArguments typeClass) + instanceArity = length tys + when (typeClassArity /= instanceArity) $ + throwError . errorMessage $ + ClassInstanceArityMismatch dictName className typeClassArity instanceArity + + checkInstanceMembers :: [Declaration] -> m [Declaration] + checkInstanceMembers instDecls = do + let idents = sort . map head . group . map memberName $ instDecls + for_ (firstDuplicate idents) $ \ident -> + throwError . errorMessage $ DuplicateValueDeclaration ident + return instDecls + where + memberName :: Declaration -> Ident + memberName (ValueDeclaration vd) = valdeclIdent vd + memberName _ = internalError "checkInstanceMembers: Invalid declaration in type instance definition" + + firstDuplicate :: (Eq a) => [a] -> Maybe a + firstDuplicate (x : xs@(y : _)) + | x == y = Just x + | otherwise = firstDuplicate xs + firstDuplicate _ = Nothing + + findNonOrphanModules :: + Qualified (ProperName 'ClassName) -> + TypeClassData -> + [SourceType] -> + S.Set ModuleName + findNonOrphanModules (Qualified (ByModuleName mn') _) typeClass tys' = nonOrphanModules + where + nonOrphanModules :: S.Set ModuleName + nonOrphanModules = S.insert mn' nonOrphanModules' + + typeModule :: SourceType -> Maybe ModuleName + typeModule (TypeVar _ _ _) = Nothing + typeModule (TypeLevelString _ _) = Nothing + typeModule (TypeLevelInt _ _) = Nothing + typeModule (TypeConstructor _ (Qualified (ByModuleName mn'') _)) = Just mn'' + typeModule (TypeConstructor _ (Qualified (BySourcePos _) _)) = internalError "Unqualified type name in findNonOrphanModules" + typeModule (TypeApp _ t1 _) = typeModule t1 + typeModule (KindApp _ t1 _) = typeModule t1 + typeModule (KindedType _ t1 _) = typeModule t1 + typeModule _ = internalError "Invalid type in instance in findNonOrphanModules" + + modulesByTypeIndex :: M.Map Int (Maybe ModuleName) + modulesByTypeIndex = M.fromList (zip [0 ..] (typeModule <$> tys')) + + lookupModule :: Int -> S.Set ModuleName + lookupModule idx = case M.lookup idx modulesByTypeIndex of + Just ms -> S.fromList (toList ms) + Nothing -> internalError "Unknown type index in findNonOrphanModules" + + -- If the instance is declared in a module that wouldn't be found based on a covering set + -- then it is considered an orphan - because we'd have a situation in which we expect an + -- instance but can't find it. So a valid module must be applicable across *all* covering + -- sets - therefore we take the intersection of covering set modules. + nonOrphanModules' :: S.Set ModuleName + nonOrphanModules' = foldl1 S.intersection (foldMap lookupModule `S.map` typeClassCoveringSets typeClass) + findNonOrphanModules _ _ _ = internalError "Unqualified class name in findNonOrphanModules" + + -- Check that the instance currently being declared doesn't overlap with any + -- other instance in any module that this instance wouldn't be considered an + -- orphan in. There are overlapping instance situations that won't be caught + -- by this, for example when combining multiparameter type classes with + -- flexible instances: the instances `Cls X y` and `Cls x Y` overlap and + -- could live in different modules but won't be caught here. + checkOverlappingInstance :: + SourceSpan -> + Maybe ChainId -> + Ident -> + [(Text, SourceType)] -> + Qualified (ProperName 'ClassName) -> + TypeClassData -> + [SourceType] -> + S.Set ModuleName -> + m () + checkOverlappingInstance ss ch dictName vars className typeClass tys' nonOrphanModules = do + for_ nonOrphanModules $ \m -> do + dicts <- M.toList <$> lookupTypeClassDictionariesForClass (ByModuleName m) className + + for_ dicts $ \(Qualified mn' ident, dictNel) -> do + for_ dictNel $ \dict -> do + -- ignore instances in the same instance chain + if ch == tcdChain dict + || instancesAreApart (typeClassCoveringSets typeClass) tys' (tcdInstanceTypes dict) + then return () + else do + let this = if isPlainIdent dictName then Right dictName else Left $ srcInstanceType ss vars className tys' + let that = Qualified mn' . maybeToLeft ident $ tcdDescription dict + throwError . errorMessage $ + OverlappingInstances + className + tys' + [that, Qualified (ByModuleName moduleName) this] + + instancesAreApart :: + S.Set (S.Set Int) -> + [SourceType] -> + [SourceType] -> + Bool + instancesAreApart sets lhs rhs = all (any typesApart . S.toList) (S.toList sets) + where + typesApart :: Int -> Bool + typesApart i = typeHeadsApart (lhs !! i) (rhs !! i) + + -- Note: implementation doesn't need to care about all possible cases: + -- TUnknown, Skolem, etc. + typeHeadsApart :: SourceType -> SourceType -> Bool + typeHeadsApart l r | eqType l r = False + typeHeadsApart (TypeVar _ _ _) _ = False + typeHeadsApart _ (TypeVar _ _ _) = False + typeHeadsApart (KindedType _ t1 _) t2 = typeHeadsApart t1 t2 + typeHeadsApart t1 (KindedType _ t2 _) = typeHeadsApart t1 t2 + typeHeadsApart (TypeApp _ h1 t1) (TypeApp _ h2 t2) = typeHeadsApart h1 h2 || typeHeadsApart t1 t2 + typeHeadsApart _ _ = True + + checkOrphanInstance :: + Ident -> + Qualified (ProperName 'ClassName) -> + [SourceType] -> + S.Set ModuleName -> + m () + checkOrphanInstance dictName className tys' nonOrphanModules + | moduleName `S.member` nonOrphanModules = return () + | otherwise = throwError . errorMessage $ OrphanInstance dictName className nonOrphanModules tys' + + -- This function adds the argument kinds for a type constructor so that they may appear in the externs file, + -- extracted from the kind of the type constructor itself. + -- + withKinds :: [(Text, SourceType)] -> SourceType -> [(Text, SourceType)] + withKinds [] _ = [] + withKinds ss (ForAll _ _ _ _ k _) = withKinds ss k + withKinds (s@(_, _) : ss) (TypeApp _ (TypeApp _ tyFn _) k2) | eqType tyFn tyFunction = s : withKinds ss k2 + withKinds _ _ = internalError "Invalid arguments to withKinds" + + withRoles :: [(Text, SourceType)] -> [Role] -> [(Text, SourceType, Role)] + withRoles = zipWith $ \(v, k) r -> (v, k, r) + + replaceTypeSynonymsInDataConstructor :: DataConstructorDeclaration -> m DataConstructorDeclaration + replaceTypeSynonymsInDataConstructor DataConstructorDeclaration {..} = do + dataCtorFields' <- traverse (traverse replaceAllTypeSynonyms) dataCtorFields + return + DataConstructorDeclaration + { dataCtorFields = dataCtorFields' + , .. + } + +{- | Check that a newtype has just one data constructor with just one field, or +throw an error. If the newtype is valid, this function returns the single +data constructor declaration and the single field, as a 'proof' that the +newtype was indeed a valid newtype. +-} +checkNewtype :: + forall m. + (MonadError MultipleErrors m) => + ProperName 'TypeName -> + [DataConstructorDeclaration] -> + m (DataConstructorDeclaration, (Ident, SourceType)) checkNewtype _ [decl@(DataConstructorDeclaration _ _ [field])] = return (decl, field) checkNewtype name _ = throwError . errorMessage $ InvalidNewtype name --- | --- Type check an entire module and ensure all types and classes defined within the module that are --- required by exported members are also exported. --- -typeCheckModule - :: forall m - . (MonadSupply m, MonadState CheckState m, MonadError MultipleErrors m, MonadWriter MultipleErrors m) - => M.Map ModuleName Exports - -> Module - -> m Module +{- | +Type check an entire module and ensure all types and classes defined within the module that are +required by exported members are also exported. +-} +typeCheckModule :: + forall m. + (MonadSupply m, MonadState CheckState m, MonadError MultipleErrors m, MonadWriter MultipleErrors m) => + M.Map ModuleName Exports -> + Module -> + m Module typeCheckModule _ (Module _ _ _ _ Nothing) = internalError "exports should have been elaborated before typeCheckModule" typeCheckModule modulesExports (Module ss coms mn decls (Just exps)) = warnAndRethrow (addHint (ErrorInModule mn)) $ do let (decls', imports) = partitionEithers $ fromImportDecl <$> decls - modify (\s -> s { checkCurrentModule = Just mn, checkCurrentModuleImports = imports }) + modify (\s -> s {checkCurrentModule = Just mn, checkCurrentModuleImports = imports}) decls'' <- typeCheckAll mn $ ignoreWildcardsUnderCompleteTypeSignatures <$> decls' checkSuperClassesAreExported <- getSuperClassExportCheck for_ exps $ \e -> do @@ -599,195 +620,207 @@ typeCheckModule modulesExports (Module ss coms mn decls (Just exps)) = checkDataConstructorsAreExported e return $ Module ss coms mn (map toImportDecl imports ++ decls'') (Just exps) where - - fromImportDecl - :: Declaration - -> Either Declaration - ( SourceAnn - , ModuleName - , ImportDeclarationType - , Maybe ModuleName - , M.Map (ProperName 'TypeName) ([ProperName 'ConstructorName], ExportSource) - ) - fromImportDecl (ImportDeclaration sa moduleName importDeclarationType asModuleName) = - Right (sa, moduleName, importDeclarationType, asModuleName, foldMap exportedTypes $ M.lookup moduleName modulesExports) - fromImportDecl decl = Left decl - - toImportDecl - :: ( SourceAnn - , ModuleName - , ImportDeclarationType - , Maybe ModuleName - , M.Map (ProperName 'TypeName) ([ProperName 'ConstructorName], ExportSource) - ) - -> Declaration - toImportDecl (sa, moduleName, importDeclarationType, asModuleName, _) = - ImportDeclaration sa moduleName importDeclarationType asModuleName - - qualify' :: a -> Qualified a - qualify' = Qualified (ByModuleName mn) - - getSuperClassExportCheck = do - classesToSuperClasses <- gets - ( M.map - ( S.fromList - . filter (\(Qualified mn' _) -> mn' == ByModuleName mn) - . fmap constraintClass - . typeClassSuperclasses + fromImportDecl :: + Declaration -> + Either + Declaration + ( SourceAnn + , ModuleName + , ImportDeclarationType + , Maybe ModuleName + , M.Map (ProperName 'TypeName) ([ProperName 'ConstructorName], ExportSource) ) - . typeClasses - . checkEnv - ) - let - -- A function that, given a class name, returns the set of - -- transitive class dependencies that are defined in this - -- module. - transitiveSuperClassesFor - :: Qualified (ProperName 'ClassName) - -> S.Set (Qualified (ProperName 'ClassName)) - transitiveSuperClassesFor qname = - untilSame - (\s -> s <> foldMap (\n -> fromMaybe S.empty (M.lookup n classesToSuperClasses)) s) - (fromMaybe S.empty (M.lookup qname classesToSuperClasses)) - - superClassesFor qname = - fromMaybe S.empty (M.lookup qname classesToSuperClasses) - - pure $ checkSuperClassExport superClassesFor transitiveSuperClassesFor - moduleClassExports :: S.Set (Qualified (ProperName 'ClassName)) - moduleClassExports = S.fromList $ mapMaybe (\case - TypeClassRef _ name -> Just (qualify' name) - _ -> Nothing) exps - - untilSame :: Eq a => (a -> a) -> a -> a - untilSame f a = let a' = f a in if a == a' then a else untilSame f a' - - checkMemberExport :: (SourceType -> [DeclarationRef]) -> DeclarationRef -> m () - checkMemberExport extract dr@(TypeRef _ name dctors) = do - env <- getEnv - for_ (M.lookup (qualify' name) (types env)) $ \(k, _) -> do - -- TODO: remove? - -- let findModuleKinds = everythingOnTypes (++) $ \case - -- TypeConstructor _ (Qualified (ByModuleName mn') kindName) | mn' == mn -> [kindName] - -- _ -> [] - checkExport dr (extract k) - for_ (M.lookup (qualify' name) (typeSynonyms env)) $ \(_, ty) -> + fromImportDecl (ImportDeclaration sa moduleName importDeclarationType asModuleName) = + Right (sa, moduleName, importDeclarationType, asModuleName, foldMap exportedTypes $ M.lookup moduleName modulesExports) + fromImportDecl decl = Left decl + + toImportDecl :: + ( SourceAnn + , ModuleName + , ImportDeclarationType + , Maybe ModuleName + , M.Map (ProperName 'TypeName) ([ProperName 'ConstructorName], ExportSource) + ) -> + Declaration + toImportDecl (sa, moduleName, importDeclarationType, asModuleName, _) = + ImportDeclaration sa moduleName importDeclarationType asModuleName + + qualify' :: a -> Qualified a + qualify' = Qualified (ByModuleName mn) + + getSuperClassExportCheck = do + classesToSuperClasses <- + gets + ( M.map + ( S.fromList + . filter (\(Qualified mn' _) -> mn' == ByModuleName mn) + . fmap constraintClass + . typeClassSuperclasses + ) + . typeClasses + . checkEnv + ) + let + -- A function that, given a class name, returns the set of + -- transitive class dependencies that are defined in this + -- module. + transitiveSuperClassesFor :: + Qualified (ProperName 'ClassName) -> + S.Set (Qualified (ProperName 'ClassName)) + transitiveSuperClassesFor qname = + untilSame + (\s -> s <> foldMap (\n -> fromMaybe S.empty (M.lookup n classesToSuperClasses)) s) + (fromMaybe S.empty (M.lookup qname classesToSuperClasses)) + + superClassesFor qname = + fromMaybe S.empty (M.lookup qname classesToSuperClasses) + + pure $ checkSuperClassExport superClassesFor transitiveSuperClassesFor + moduleClassExports :: S.Set (Qualified (ProperName 'ClassName)) + moduleClassExports = + S.fromList $ + mapMaybe + ( \case + TypeClassRef _ name -> Just (qualify' name) + _ -> Nothing + ) + exps + + untilSame :: (Eq a) => (a -> a) -> a -> a + untilSame f a = let a' = f a in if a == a' then a else untilSame f a' + + checkMemberExport :: (SourceType -> [DeclarationRef]) -> DeclarationRef -> m () + checkMemberExport extract dr@(TypeRef _ name dctors) = do + env <- getEnv + for_ (M.lookup (qualify' name) (types env)) $ \(k, _) -> do + -- TODO: remove? + -- let findModuleKinds = everythingOnTypes (++) $ \case + -- TypeConstructor _ (Qualified (ByModuleName mn') kindName) | mn' == mn -> [kindName] + -- _ -> [] + checkExport dr (extract k) + for_ (M.lookup (qualify' name) (typeSynonyms env)) $ \(_, ty) -> + checkExport dr (extract ty) + for_ dctors $ \dctors' -> + for_ dctors' $ \dctor -> + for_ (M.lookup (qualify' dctor) (dataConstructors env)) $ \(_, _, ty, _) -> + checkExport dr (extract ty) + checkMemberExport extract dr@(ValueRef _ name) = do + ty <- lookupVariable (qualify' name) checkExport dr (extract ty) - for_ dctors $ \dctors' -> - for_ dctors' $ \dctor -> - for_ (M.lookup (qualify' dctor) (dataConstructors env)) $ \(_, _, ty, _) -> - checkExport dr (extract ty) - checkMemberExport extract dr@(ValueRef _ name) = do - ty <- lookupVariable (qualify' name) - checkExport dr (extract ty) - checkMemberExport _ _ = return () - - checkSuperClassExport - :: (Qualified (ProperName 'ClassName) -> S.Set (Qualified (ProperName 'ClassName))) - -> (Qualified (ProperName 'ClassName) -> S.Set (Qualified (ProperName 'ClassName))) - -> DeclarationRef - -> m () - checkSuperClassExport superClassesFor transitiveSuperClassesFor dr@(TypeClassRef drss className) = do - let superClasses = superClassesFor (qualify' className) - -- thanks to laziness, the computation of the transitive - -- superclasses defined in-module will only occur if we actually - -- throw the error. Constructing the full set of transitive - -- superclasses is likely to be costly for every single term. - transitiveSuperClasses = transitiveSuperClassesFor (qualify' className) - unexported = S.difference superClasses moduleClassExports - unless (null unexported) - . throwError . errorMessage' drss - . TransitiveExportError dr - . map (TypeClassRef drss . disqualify) - $ toList transitiveSuperClasses - checkSuperClassExport _ _ _ = - return () - - checkExport :: DeclarationRef -> [DeclarationRef] -> m () - checkExport dr drs = case filter (not . exported) drs of - [] -> return () - hidden -> throwError . errorMessage' (declRefSourceSpan dr) $ TransitiveExportError dr (nubBy nubEq hidden) - where - exported e = any (exports e) exps - exports (TypeRef _ pn1 _) (TypeRef _ pn2 _) = pn1 == pn2 - exports (ValueRef _ id1) (ValueRef _ id2) = id1 == id2 - exports (TypeClassRef _ pn1) (TypeClassRef _ pn2) = pn1 == pn2 - exports _ _ = False - -- We avoid Eq for `nub`bing as the dctor part of `TypeRef` evaluates to - -- `error` for the values generated here (we don't need them anyway) - nubEq (TypeRef _ pn1 _) (TypeRef _ pn2 _) = pn1 == pn2 - nubEq r1 r2 = r1 == r2 - - - -- Check that all the type constructors defined in the current module that appear in member types - -- have also been exported from the module - checkTypesAreExported :: DeclarationRef -> m () - checkTypesAreExported ref = checkMemberExport findTcons ref - where - findTcons :: SourceType -> [DeclarationRef] - findTcons = everythingOnTypes (++) go + checkMemberExport _ _ = return () + + checkSuperClassExport :: + (Qualified (ProperName 'ClassName) -> S.Set (Qualified (ProperName 'ClassName))) -> + (Qualified (ProperName 'ClassName) -> S.Set (Qualified (ProperName 'ClassName))) -> + DeclarationRef -> + m () + checkSuperClassExport superClassesFor transitiveSuperClassesFor dr@(TypeClassRef drss className) = do + let superClasses = superClassesFor (qualify' className) + -- thanks to laziness, the computation of the transitive + -- superclasses defined in-module will only occur if we actually + -- throw the error. Constructing the full set of transitive + -- superclasses is likely to be costly for every single term. + transitiveSuperClasses = transitiveSuperClassesFor (qualify' className) + unexported = S.difference superClasses moduleClassExports + unless (null unexported) + . throwError + . errorMessage' drss + . TransitiveExportError dr + . map (TypeClassRef drss . disqualify) + $ toList transitiveSuperClasses + checkSuperClassExport _ _ _ = + return () + + checkExport :: DeclarationRef -> [DeclarationRef] -> m () + checkExport dr drs = case filter (not . exported) drs of + [] -> return () + hidden -> throwError . errorMessage' (declRefSourceSpan dr) $ TransitiveExportError dr (nubBy nubEq hidden) where - go (TypeConstructor _ (Qualified (ByModuleName mn') name)) | mn' == mn = - [TypeRef (declRefSourceSpan ref) name (internalError "Data constructors unused in checkTypesAreExported")] - go _ = [] - - -- Check that all the classes defined in the current module that appear in member types have also - -- been exported from the module - checkClassesAreExported :: DeclarationRef -> m () - checkClassesAreExported ref = checkMemberExport findClasses ref - where - findClasses :: SourceType -> [DeclarationRef] - findClasses = everythingOnTypes (++) go + exported e = any (exports e) exps + exports (TypeRef _ pn1 _) (TypeRef _ pn2 _) = pn1 == pn2 + exports (ValueRef _ id1) (ValueRef _ id2) = id1 == id2 + exports (TypeClassRef _ pn1) (TypeClassRef _ pn2) = pn1 == pn2 + exports _ _ = False + -- We avoid Eq for `nub`bing as the dctor part of `TypeRef` evaluates to + -- `error` for the values generated here (we don't need them anyway) + nubEq (TypeRef _ pn1 _) (TypeRef _ pn2 _) = pn1 == pn2 + nubEq r1 r2 = r1 == r2 + + -- Check that all the type constructors defined in the current module that appear in member types + -- have also been exported from the module + checkTypesAreExported :: DeclarationRef -> m () + checkTypesAreExported ref = checkMemberExport findTcons ref where - go (ConstrainedType _ c _) = (fmap (TypeClassRef (declRefSourceSpan ref)) . extractCurrentModuleClass . constraintClass) c - go _ = [] - extractCurrentModuleClass :: Qualified (ProperName 'ClassName) -> [ProperName 'ClassName] - extractCurrentModuleClass (Qualified (ByModuleName mn') name) | mn == mn' = [name] - extractCurrentModuleClass _ = [] - - checkClassMembersAreExported :: DeclarationRef -> m () - checkClassMembersAreExported dr@(TypeClassRef ss' name) = do - let members = ValueRef ss' `map` head (mapMaybe findClassMembers decls) - let missingMembers = members \\ exps - unless (null missingMembers) . throwError . errorMessage' ss' $ TransitiveExportError dr missingMembers - where - findClassMembers :: Declaration -> Maybe [Ident] - findClassMembers (TypeClassDeclaration _ name' _ _ _ ds) | name == name' = Just $ map extractMemberName ds - findClassMembers (DataBindingGroupDeclaration decls') = headMay . mapMaybe findClassMembers $ NEL.toList decls' - findClassMembers _ = Nothing - extractMemberName :: Declaration -> Ident - extractMemberName (TypeDeclaration td) = tydeclIdent td - extractMemberName _ = internalError "Unexpected declaration in typeclass member list" - checkClassMembersAreExported _ = return () - - -- If a type is exported without data constructors, we warn on `Generic` or `Newtype` instances. - -- On the other hand if any data constructors are exported, we require all of them to be exported. - checkDataConstructorsAreExported :: DeclarationRef -> m () - checkDataConstructorsAreExported dr@(TypeRef ss' name (fromMaybe [] -> exportedDataConstructorsNames)) - | null exportedDataConstructorsNames = for_ - [ Libs.Generic - , Libs.Newtype - ] $ \className -> do - env <- getEnv - let dicts = foldMap (foldMap NEL.toList) $ - M.lookup (ByModuleName mn) (typeClassDictionaries env) >>= M.lookup className - when (any isDictOfTypeRef dicts) $ - tell . errorMessage' ss' $ HiddenConstructors dr className - | otherwise = do - env <- getEnv - let dataConstructorNames = fromMaybe [] $ - M.lookup (mkQualified name mn) (types env) >>= getDataConstructorNames . snd - missingDataConstructorsNames = dataConstructorNames \\ exportedDataConstructorsNames - unless (null missingDataConstructorsNames) $ - throwError . errorMessage' ss' $ TransitiveDctorExportError dr missingDataConstructorsNames + findTcons :: SourceType -> [DeclarationRef] + findTcons = everythingOnTypes (++) go + where + go (TypeConstructor _ (Qualified (ByModuleName mn') name)) + | mn' == mn = + [TypeRef (declRefSourceSpan ref) name (internalError "Data constructors unused in checkTypesAreExported")] + go _ = [] + + -- Check that all the classes defined in the current module that appear in member types have also + -- been exported from the module + checkClassesAreExported :: DeclarationRef -> m () + checkClassesAreExported ref = checkMemberExport findClasses ref + where + findClasses :: SourceType -> [DeclarationRef] + findClasses = everythingOnTypes (++) go + where + go (ConstrainedType _ c _) = (fmap (TypeClassRef (declRefSourceSpan ref)) . extractCurrentModuleClass . constraintClass) c + go _ = [] + extractCurrentModuleClass :: Qualified (ProperName 'ClassName) -> [ProperName 'ClassName] + extractCurrentModuleClass (Qualified (ByModuleName mn') name) | mn == mn' = [name] + extractCurrentModuleClass _ = [] + + checkClassMembersAreExported :: DeclarationRef -> m () + checkClassMembersAreExported dr@(TypeClassRef ss' name) = do + let members = ValueRef ss' `map` head (mapMaybe findClassMembers decls) + let missingMembers = members \\ exps + unless (null missingMembers) . throwError . errorMessage' ss' $ TransitiveExportError dr missingMembers + where + findClassMembers :: Declaration -> Maybe [Ident] + findClassMembers (TypeClassDeclaration _ name' _ _ _ ds) | name == name' = Just $ map extractMemberName ds + findClassMembers (DataBindingGroupDeclaration decls') = headMay . mapMaybe findClassMembers $ NEL.toList decls' + findClassMembers _ = Nothing + extractMemberName :: Declaration -> Ident + extractMemberName (TypeDeclaration td) = tydeclIdent td + extractMemberName _ = internalError "Unexpected declaration in typeclass member list" + checkClassMembersAreExported _ = return () + + -- If a type is exported without data constructors, we warn on `Generic` or `Newtype` instances. + -- On the other hand if any data constructors are exported, we require all of them to be exported. + checkDataConstructorsAreExported :: DeclarationRef -> m () + checkDataConstructorsAreExported dr@(TypeRef ss' name (fromMaybe [] -> exportedDataConstructorsNames)) + | null exportedDataConstructorsNames = for_ + [ Libs.Generic + , Libs.Newtype + ] + $ \className -> do + env <- getEnv + let dicts = + foldMap (foldMap NEL.toList) $ + M.lookup (ByModuleName mn) (typeClassDictionaries env) >>= M.lookup className + when (any isDictOfTypeRef dicts) $ + tell . errorMessage' ss' $ + HiddenConstructors dr className + | otherwise = do + env <- getEnv + let dataConstructorNames = + fromMaybe [] $ + M.lookup (mkQualified name mn) (types env) >>= getDataConstructorNames . snd + missingDataConstructorsNames = dataConstructorNames \\ exportedDataConstructorsNames + unless (null missingDataConstructorsNames) $ + throwError . errorMessage' ss' $ + TransitiveDctorExportError dr missingDataConstructorsNames where - isDictOfTypeRef :: TypeClassDictionaryInScope a -> Bool - isDictOfTypeRef dict - | (TypeConstructor _ qualTyName, _, _) : _ <- unapplyTypes <$> tcdInstanceTypes dict - , qualTyName == Qualified (ByModuleName mn) name - = True - isDictOfTypeRef _ = False - getDataConstructorNames :: TypeKind -> Maybe [ProperName 'ConstructorName] - getDataConstructorNames (DataType _ _ constructors) = Just $ fst <$> constructors - getDataConstructorNames _ = Nothing - checkDataConstructorsAreExported _ = return () + isDictOfTypeRef :: TypeClassDictionaryInScope a -> Bool + isDictOfTypeRef dict + | (TypeConstructor _ qualTyName, _, _) : _ <- unapplyTypes <$> tcdInstanceTypes dict + , qualTyName == Qualified (ByModuleName mn) name = + True + isDictOfTypeRef _ = False + getDataConstructorNames :: TypeKind -> Maybe [ProperName 'ConstructorName] + getDataConstructorNames (DataType _ _ constructors) = Just $ fst <$> constructors + getDataConstructorNames _ = Nothing + checkDataConstructorsAreExported _ = return () diff --git a/src/Language/PureScript/TypeChecker/Deriving.hs b/src/Language/PureScript/TypeChecker/Deriving.hs index 8d5dcde9b..036f619bf 100644 --- a/src/Language/PureScript/TypeChecker/Deriving.hs +++ b/src/Language/PureScript/TypeChecker/Deriving.hs @@ -1,6 +1,8 @@ -{- HLINT ignore "Unused LANGUAGE pragma" -} -- HLint doesn't recognize that TypeApplications is used in a pattern +{- HLINT ignore "Unused LANGUAGE pragma" -} +-- HLint doesn't recognize that TypeApplications is used in a pattern {-# LANGUAGE GADTs #-} {-# LANGUAGE TypeApplications #-} + module Language.PureScript.TypeChecker.Deriving (deriveInstance) where import Protolude hiding (Type) @@ -8,118 +10,121 @@ import Protolude hiding (Type) import Control.Lens (both, over) import Control.Monad.Error.Class (liftEither) import Control.Monad.Trans.Writer (Writer, WriterT, runWriter, runWriterT) -import Control.Monad.Writer.Class (MonadWriter(..)) +import Control.Monad.Writer.Class (MonadWriter (..)) import Data.Align (align, unalign) import Data.Foldable (foldl1, foldr1) import Data.List (init, last, zipWith3, (!!)) import Data.Map qualified as M -import Data.These (These(..), mergeTheseWith, these) +import Data.These (These (..), mergeTheseWith, these) import Control.Monad.Supply.Class (MonadSupply) -import Language.PureScript.AST (Binder(..), CaseAlternative(..), ErrorMessageHint(..), Expr(..), InstanceDerivationStrategy(..), Literal(..), SourceSpan, nullSourceSpan) -import Language.PureScript.AST.Utils (UnwrappedTypeConstructor(..), lam, lamCase, lamCase2, mkBinder, mkCtor, mkCtorBinder, mkLit, mkRef, mkVar, unguarded, unwrapTypeConstructor, utcQTyCon) +import Language.PureScript.AST (Binder (..), CaseAlternative (..), ErrorMessageHint (..), Expr (..), InstanceDerivationStrategy (..), Literal (..), SourceSpan, nullSourceSpan) +import Language.PureScript.AST.Utils (UnwrappedTypeConstructor (..), lam, lamCase, lamCase2, mkBinder, mkCtor, mkCtorBinder, mkLit, mkRef, mkVar, unguarded, unwrapTypeConstructor, utcQTyCon) import Language.PureScript.Constants.Libs qualified as Libs import Language.PureScript.Constants.Prim qualified as Prim import Language.PureScript.Crash (internalError) -import Language.PureScript.Environment (DataDeclType(..), Environment(..), FunctionalDependency(..), TypeClassData(..), TypeKind(..), kindType, (-:>)) -import Language.PureScript.Errors (MultipleErrors, SimpleErrorMessage(..), addHint, errorMessage, internalCompilerError) -import Language.PureScript.Label (Label(..)) -import Language.PureScript.Names (pattern ByNullSourcePos, Ident(..), ModuleName(..), Name(..), ProperName(..), ProperNameType(..), Qualified(..), QualifiedBy(..), coerceProperName, freshIdent, qualify) +import Language.PureScript.Environment (DataDeclType (..), Environment (..), FunctionalDependency (..), TypeClassData (..), TypeKind (..), kindType, (-:>)) +import Language.PureScript.Errors (MultipleErrors, SimpleErrorMessage (..), addHint, errorMessage, internalCompilerError) +import Language.PureScript.Label (Label (..)) +import Language.PureScript.Names (Ident (..), ModuleName (..), Name (..), ProperName (..), ProperNameType (..), Qualified (..), QualifiedBy (..), coerceProperName, freshIdent, qualify, pattern ByNullSourcePos) import Language.PureScript.PSString (PSString, mkString) import Language.PureScript.Sugar.TypeClasses (superClassDictionaryNames) import Language.PureScript.TypeChecker.Entailment (InstanceContext, findDicts) import Language.PureScript.TypeChecker.Monad (CheckState, getEnv, getTypeClassDictionaries, unsafeCheckCurrentModule) import Language.PureScript.TypeChecker.Synonyms (replaceAllTypeSynonyms) -import Language.PureScript.TypeClassDictionaries (TypeClassDictionaryInScope(..)) -import Language.PureScript.Types (Constraint(..), pattern REmptyKinded, SourceType, Type(..), completeBinderList, eqType, everythingOnTypes, replaceAllTypeVars, srcTypeVar, usedTypeVariables) - --- | Extract the name of the newtype appearing in the last type argument of --- a derived newtype instance. --- --- Note: since newtypes in newtype instances can only be applied to type arguments --- (no flexible instances allowed), we don't need to bother with unification when --- looking for matching superclass instances, which saves us a lot of work. Instead, --- we just match the newtype name. +import Language.PureScript.TypeClassDictionaries (TypeClassDictionaryInScope (..)) +import Language.PureScript.Types (Constraint (..), SourceType, Type (..), completeBinderList, eqType, everythingOnTypes, replaceAllTypeVars, srcTypeVar, usedTypeVariables, pattern REmptyKinded) + +{- | Extract the name of the newtype appearing in the last type argument of +a derived newtype instance. + +Note: since newtypes in newtype instances can only be applied to type arguments +(no flexible instances allowed), we don't need to bother with unification when +looking for matching superclass instances, which saves us a lot of work. Instead, +we just match the newtype name. +-} extractNewtypeName :: ModuleName -> [SourceType] -> Maybe (ModuleName, ProperName 'TypeName) -extractNewtypeName mn - = fmap (qualify mn . utcQTyCon) - . (unwrapTypeConstructor <=< lastMay) - -deriveInstance - :: forall m - . MonadError MultipleErrors m - => MonadState CheckState m - => MonadSupply m - => MonadWriter MultipleErrors m - => SourceType - -> Qualified (ProperName 'ClassName) - -> InstanceDerivationStrategy - -> m Expr +extractNewtypeName mn = + fmap (qualify mn . utcQTyCon) + . (unwrapTypeConstructor <=< lastMay) + +deriveInstance :: + forall m. + (MonadError MultipleErrors m) => + (MonadState CheckState m) => + (MonadSupply m) => + (MonadWriter MultipleErrors m) => + SourceType -> + Qualified (ProperName 'ClassName) -> + InstanceDerivationStrategy -> + m Expr deriveInstance instType className strategy = do mn <- unsafeCheckCurrentModule env <- getEnv - instUtc@UnwrappedTypeConstructor{ utcArgs = tys } <- maybe (internalCompilerError "invalid instance type") pure $ unwrapTypeConstructor instType + instUtc@UnwrappedTypeConstructor {utcArgs = tys} <- maybe (internalCompilerError "invalid instance type") pure $ unwrapTypeConstructor instType let ctorName = coerceProperName <$> utcQTyCon instUtc - TypeClassData{..} <- + TypeClassData {..} <- note (errorMessage . UnknownName $ fmap TyClassName className) $ className `M.lookup` typeClasses env case strategy of - KnownClassStrategy -> let - unaryClass :: (UnwrappedTypeConstructor -> m [(PSString, Expr)]) -> m Expr - unaryClass f = case tys of - [ty] -> case unwrapTypeConstructor ty of - Just utc | mn == utcModuleName utc -> do - let superclassesDicts = flip map typeClassSuperclasses $ \(Constraint _ superclass _ suTyArgs _) -> - let tyArgs = map (replaceAllTypeVars (zip (map fst typeClassArguments) tys)) suTyArgs - in lam UnusedIdent (DeferredDictionary superclass tyArgs) - let superclasses = map mkString (superClassDictionaryNames typeClassSuperclasses) `zip` superclassesDicts - App (Constructor nullSourceSpan ctorName) . mkLit . ObjectLiteral . (++ superclasses) <$> f utc - _ -> throwError . errorMessage $ ExpectedTypeConstructor className tys ty - _ -> throwError . errorMessage $ InvalidDerivedInstance className tys 1 - - unaryClass' f = unaryClass (f className) - - in case className of - Libs.Bifoldable -> unaryClass' $ deriveFoldable True - Libs.Bifunctor -> unaryClass' $ deriveFunctor (Just False) False Libs.S_bimap - Libs.Bitraversable -> unaryClass' $ deriveTraversable True - Libs.Contravariant -> unaryClass' $ deriveFunctor Nothing True Libs.S_cmap - Libs.Eq -> unaryClass deriveEq - Libs.Eq1 -> unaryClass $ const deriveEq1 - Libs.Foldable -> unaryClass' $ deriveFoldable False - Libs.Functor -> unaryClass' $ deriveFunctor Nothing False Libs.S_map - Libs.Ord -> unaryClass deriveOrd - Libs.Ord1 -> unaryClass $ const deriveOrd1 - Libs.Profunctor -> unaryClass' $ deriveFunctor (Just True) False Libs.S_dimap - Libs.Traversable -> unaryClass' $ deriveTraversable False - -- See L.P.Sugar.TypeClasses.Deriving for the classes that can be - -- derived prior to type checking. - _ -> throwError . errorMessage $ CannotDerive className tys - + KnownClassStrategy -> + let + unaryClass :: (UnwrappedTypeConstructor -> m [(PSString, Expr)]) -> m Expr + unaryClass f = case tys of + [ty] -> case unwrapTypeConstructor ty of + Just utc | mn == utcModuleName utc -> do + let superclassesDicts = flip map typeClassSuperclasses $ \(Constraint _ superclass _ suTyArgs _) -> + let tyArgs = map (replaceAllTypeVars (zip (map fst typeClassArguments) tys)) suTyArgs + in lam UnusedIdent (DeferredDictionary superclass tyArgs) + let superclasses = map mkString (superClassDictionaryNames typeClassSuperclasses) `zip` superclassesDicts + App (Constructor nullSourceSpan ctorName) . mkLit . ObjectLiteral . (++ superclasses) <$> f utc + _ -> throwError . errorMessage $ ExpectedTypeConstructor className tys ty + _ -> throwError . errorMessage $ InvalidDerivedInstance className tys 1 + + unaryClass' f = unaryClass (f className) + in + case className of + Libs.Bifoldable -> unaryClass' $ deriveFoldable True + Libs.Bifunctor -> unaryClass' $ deriveFunctor (Just False) False Libs.S_bimap + Libs.Bitraversable -> unaryClass' $ deriveTraversable True + Libs.Contravariant -> unaryClass' $ deriveFunctor Nothing True Libs.S_cmap + Libs.Eq -> unaryClass deriveEq + Libs.Eq1 -> unaryClass $ const deriveEq1 + Libs.Foldable -> unaryClass' $ deriveFoldable False + Libs.Functor -> unaryClass' $ deriveFunctor Nothing False Libs.S_map + Libs.Ord -> unaryClass deriveOrd + Libs.Ord1 -> unaryClass $ const deriveOrd1 + Libs.Profunctor -> unaryClass' $ deriveFunctor (Just True) False Libs.S_dimap + Libs.Traversable -> unaryClass' $ deriveTraversable False + -- See L.P.Sugar.TypeClasses.Deriving for the classes that can be + -- derived prior to type checking. + _ -> throwError . errorMessage $ CannotDerive className tys NewtypeStrategy -> case tys of - _ : _ | Just utc <- unwrapTypeConstructor (last tys) - , mn == utcModuleName utc - -> deriveNewtypeInstance className tys utc - | otherwise -> throwError . errorMessage $ ExpectedTypeConstructor className tys (last tys) + _ : _ + | Just utc <- unwrapTypeConstructor (last tys) + , mn == utcModuleName utc -> + deriveNewtypeInstance className tys utc + | otherwise -> throwError . errorMessage $ ExpectedTypeConstructor className tys (last tys) _ -> throwError . errorMessage $ InvalidNewtypeInstance className tys -deriveNewtypeInstance - :: forall m - . MonadError MultipleErrors m - => MonadState CheckState m - => MonadWriter MultipleErrors m - => Qualified (ProperName 'ClassName) - -> [SourceType] - -> UnwrappedTypeConstructor - -> m Expr +deriveNewtypeInstance :: + forall m. + (MonadError MultipleErrors m) => + (MonadState CheckState m) => + (MonadWriter MultipleErrors m) => + Qualified (ProperName 'ClassName) -> + [SourceType] -> + UnwrappedTypeConstructor -> + m Expr deriveNewtypeInstance className tys (UnwrappedTypeConstructor mn tyConNm dkargs dargs) = do - verifySuperclasses - (dtype, tyKindNames, tyArgNames, ctors) <- lookupTypeDecl mn tyConNm - go dtype tyKindNames tyArgNames ctors + verifySuperclasses + (dtype, tyKindNames, tyArgNames, ctors) <- lookupTypeDecl mn tyConNm + go dtype tyKindNames tyArgNames ctors where + go :: Maybe DataDeclType -> [Text] -> [(Text, SourceType)] -> [(ProperName 'ConstructorName, [SourceType])] -> m Expr go (Just Newtype) tyKindNames tyArgNames [(_, [wrapped])] = do -- The newtype might not be applied to all type arguments. -- This is okay as long as the newtype wraps something which ends with @@ -143,36 +148,37 @@ deriveNewtypeInstance className tys (UnwrappedTypeConstructor mn tyConNm dkargs takeReverse :: Int -> [a] -> [a] takeReverse n = take n . reverse - stripRight :: [(Text, Maybe kind)] -> SourceType -> Maybe SourceType + stripRight :: [(Text, SourceType)] -> SourceType -> Maybe SourceType stripRight [] ty = Just ty - stripRight ((arg, _) : args) (TypeApp _ t (TypeVar _ arg')) + stripRight ((arg, _) : args) (TypeApp _ t (TypeVar _ arg' _)) | arg == arg' = stripRight args t stripRight _ _ = Nothing verifySuperclasses :: m () verifySuperclasses = do env <- getEnv - for_ (M.lookup className (typeClasses env)) $ \TypeClassData{ typeClassArguments = args, typeClassSuperclasses = superclasses } -> - for_ superclasses $ \Constraint{..} -> do + for_ (M.lookup className (typeClasses env)) $ \TypeClassData {typeClassArguments = args, typeClassSuperclasses = superclasses} -> + for_ superclasses $ \Constraint {..} -> do let constraintClass' = qualify (internalError "verifySuperclasses: unknown class module") constraintClass - for_ (M.lookup constraintClass (typeClasses env)) $ \TypeClassData{ typeClassDependencies = deps } -> + for_ (M.lookup constraintClass (typeClasses env)) $ \TypeClassData {typeClassDependencies = deps} -> -- We need to check whether the newtype is mentioned, because of classes like MonadWriter -- with its Monoid superclass constraint. - when (not (null args) && any ((fst (last args) `elem`) . usedTypeVariables) constraintArgs) $ do + when (not (null args) && any ((last args `elem`) . usedTypeVariables) constraintArgs) $ do -- For now, we only verify superclasses where the newtype is the only argument, -- or for which all other arguments are determined by functional dependencies. -- Everything else raises a UnverifiableSuperclassInstance warning. -- This covers pretty much all cases we're interested in, but later we might want to do -- more work to extend this to other superclass relationships. - let determined = map (srcTypeVar . fst . (args !!)) . ordNub . concatMap fdDetermined . filter ((== [length args - 1]) . fdDeterminers) $ deps - if eqType (last constraintArgs) (srcTypeVar . fst $ last args) && all (`elem` determined) (init constraintArgs) + let determined = map (uncurry srcTypeVar . (args !!)) . ordNub . concatMap fdDetermined . filter ((== [length args - 1]) . fdDeterminers) $ deps + if eqType (last constraintArgs) (uncurry srcTypeVar $ last args) && all (`elem` determined) (init constraintArgs) then do -- Now make sure that a superclass instance was derived. Again, this is not a complete -- check, since the superclass might have multiple type arguments, so overlaps might still -- be possible, so we warn again. for_ (extractNewtypeName mn tys) $ \nm -> do unless (hasNewtypeSuperclassInstance constraintClass' nm (typeClassDictionaries env)) $ - tell . errorMessage $ MissingNewtypeSuperclassInstance constraintClass className tys + tell . errorMessage $ + MissingNewtypeSuperclassInstance constraintClass className tys else tell . errorMessage $ UnverifiableSuperclassInstance constraintClass className tys -- Note that this check doesn't actually verify that the superclass is @@ -180,13 +186,18 @@ deriveNewtypeInstance className tys (UnwrappedTypeConstructor mn tyConNm dkargs -- is pretty sketchy, and could use a thorough review and probably rewrite. hasNewtypeSuperclassInstance (suModule, suClass) nt@(newtypeModule, _) dicts = let su = Qualified (ByModuleName suModule) suClass - lookIn mn' - = elem nt - . (toList . extractNewtypeName mn' . tcdInstanceTypes - <=< foldMap toList . M.elems - <=< toList . (M.lookup su <=< M.lookup (ByModuleName mn'))) - $ dicts - in lookIn suModule || lookIn newtypeModule + lookIn mn' = + elem nt + . ( toList + . extractNewtypeName mn' + . tcdInstanceTypes + <=< foldMap toList + . M.elems + <=< toList + . (M.lookup su <=< M.lookup (ByModuleName mn')) + ) + $ dicts + in lookIn suModule || lookIn newtypeModule data TypeInfo = TypeInfo { tiTypeParams :: [Text] @@ -194,26 +205,26 @@ data TypeInfo = TypeInfo , tiArgSubst :: [(Text, SourceType)] } -lookupTypeInfo - :: forall m - . MonadError MultipleErrors m - => MonadState CheckState m - => UnwrappedTypeConstructor - -> m TypeInfo -lookupTypeInfo UnwrappedTypeConstructor{..} = do +lookupTypeInfo :: + forall m. + (MonadError MultipleErrors m) => + (MonadState CheckState m) => + UnwrappedTypeConstructor -> + m TypeInfo +lookupTypeInfo UnwrappedTypeConstructor {..} = do (_, kindParams, map fst -> tiTypeParams, tiCtors) <- lookupTypeDecl utcModuleName utcTyCon let tiArgSubst = zip tiTypeParams utcArgs <> zip kindParams utcKindArgs - pure TypeInfo{..} - -deriveEq - :: forall m - . MonadError MultipleErrors m - => MonadState CheckState m - => MonadSupply m - => UnwrappedTypeConstructor - -> m [(PSString, Expr)] + pure TypeInfo {..} + +deriveEq :: + forall m. + (MonadError MultipleErrors m) => + (MonadState CheckState m) => + (MonadSupply m) => + UnwrappedTypeConstructor -> + m [(PSString, Expr)] deriveEq utc = do - TypeInfo{..} <- lookupTypeInfo utc + TypeInfo {..} <- lookupTypeInfo utc eqFun <- mkEqFunction tiCtors pure [(Libs.S_eq, eqFun)] where @@ -237,7 +248,7 @@ deriveEq utc = do | length xs /= 1 = xs ++ [catchAll] | otherwise = xs -- Avoid redundant case where - catchAll = CaseAlternative [NullBinder, NullBinder] (unguarded (mkLit (BooleanLiteral False))) + catchAll = CaseAlternative [NullBinder, NullBinder] (unguarded (mkLit (BooleanLiteral False))) mkCtorClause :: (ProperName 'ConstructorName, [SourceType]) -> m CaseAlternative mkCtorClause (ctorName, tys) = do @@ -247,7 +258,7 @@ deriveEq utc = do let tests = zipWith3 toEqTest (map mkVar identsL) (map mkVar identsR) tys' return $ CaseAlternative [caseBinder identsL, caseBinder identsR] (unguarded (conjAll tests)) where - caseBinder idents = mkCtorBinder (utcModuleName utc) ctorName $ map mkBinder idents + caseBinder idents = mkCtorBinder (utcModuleName utc) ctorName $ map mkBinder idents conjAll :: [Expr] -> Expr conjAll = \case @@ -256,25 +267,25 @@ deriveEq utc = do toEqTest :: Expr -> Expr -> SourceType -> Expr toEqTest l r ty - | Just fields <- decomposeRec <=< objectType $ ty - = conjAll - . map (\(Label str, typ) -> toEqTest (Accessor str l) (Accessor str r) typ) - $ fields + | Just fields <- decomposeRec <=< objectType $ ty = + conjAll + . map (\(Label str, typ) -> toEqTest (Accessor str l) (Accessor str r) typ) + $ fields | isAppliedVar ty = preludeEq1 l r | otherwise = preludeEq l r -deriveEq1 :: forall m. Applicative m => m [(PSString, Expr)] +deriveEq1 :: forall m. (Applicative m) => m [(PSString, Expr)] deriveEq1 = pure [(Libs.S_eq1, mkRef Libs.I_eq)] -deriveOrd - :: forall m - . MonadError MultipleErrors m - => MonadState CheckState m - => MonadSupply m - => UnwrappedTypeConstructor - -> m [(PSString, Expr)] +deriveOrd :: + forall m. + (MonadError MultipleErrors m) => + (MonadState CheckState m) => + (MonadSupply m) => + UnwrappedTypeConstructor -> + m [(PSString, Expr)] deriveOrd utc = do - TypeInfo{..} <- lookupTypeInfo utc + TypeInfo {..} <- lookupTypeInfo utc compareFun <- mkCompareFunction tiCtors pure [(Libs.S_compare, compareFun)] where @@ -294,7 +305,7 @@ deriveOrd utc = do | null xs = [catchAll] -- No type constructors | otherwise = xs where - catchAll = CaseAlternative [NullBinder, NullBinder] (unguarded (orderingCtor "EQ")) + catchAll = CaseAlternative [NullBinder, NullBinder] (unguarded (orderingCtor "EQ")) orderingMod :: ModuleName orderingMod = ModuleName "Data.Ordering" @@ -317,49 +328,55 @@ deriveOrd utc = do identsR <- replicateM (length tys) (freshIdent "r") tys' <- mapM replaceAllTypeSynonyms tys let tests = zipWith3 toOrdering (map mkVar identsL) (map mkVar identsR) tys' - extras | not isLast = [ CaseAlternative [nullCaseBinder, NullBinder] (unguarded (orderingCtor "LT")) - , CaseAlternative [NullBinder, nullCaseBinder] (unguarded (orderingCtor "GT")) - ] - | otherwise = [] - return $ CaseAlternative [ caseBinder identsL - , caseBinder identsR - ] - (unguarded (appendAll tests)) - : extras - + extras + | not isLast = + [ CaseAlternative [nullCaseBinder, NullBinder] (unguarded (orderingCtor "LT")) + , CaseAlternative [NullBinder, nullCaseBinder] (unguarded (orderingCtor "GT")) + ] + | otherwise = [] + return $ + CaseAlternative + [ caseBinder identsL + , caseBinder identsR + ] + (unguarded (appendAll tests)) + : extras where - mn = utcModuleName utc - caseBinder idents = mkCtorBinder mn ctorName $ map mkBinder idents - nullCaseBinder = mkCtorBinder mn ctorName $ replicate (length tys) NullBinder + mn = utcModuleName utc + caseBinder idents = mkCtorBinder mn ctorName $ map mkBinder idents + nullCaseBinder = mkCtorBinder mn ctorName $ replicate (length tys) NullBinder appendAll :: [Expr] -> Expr appendAll = \case [] -> orderingCtor "EQ" [x] -> x - (x : xs) -> Case [x] [ CaseAlternative [orderingBinder "LT"] (unguarded (orderingCtor "LT")) - , CaseAlternative [orderingBinder "GT"] (unguarded (orderingCtor "GT")) - , CaseAlternative [NullBinder] (unguarded (appendAll xs)) - ] + (x : xs) -> + Case + [x] + [ CaseAlternative [orderingBinder "LT"] (unguarded (orderingCtor "LT")) + , CaseAlternative [orderingBinder "GT"] (unguarded (orderingCtor "GT")) + , CaseAlternative [NullBinder] (unguarded (appendAll xs)) + ] toOrdering :: Expr -> Expr -> SourceType -> Expr toOrdering l r ty - | Just fields <- decomposeRec <=< objectType $ ty - = appendAll - . map (\(Label str, typ) -> toOrdering (Accessor str l) (Accessor str r) typ) - $ fields + | Just fields <- decomposeRec <=< objectType $ ty = + appendAll + . map (\(Label str, typ) -> toOrdering (Accessor str l) (Accessor str r) typ) + $ fields | isAppliedVar ty = ordCompare1 l r | otherwise = ordCompare l r -deriveOrd1 :: forall m. Applicative m => m [(PSString, Expr)] +deriveOrd1 :: forall m. (Applicative m) => m [(PSString, Expr)] deriveOrd1 = pure [(Libs.S_compare1, mkRef Libs.I_compare)] -lookupTypeDecl - :: forall m - . MonadError MultipleErrors m - => MonadState CheckState m - => ModuleName - -> ProperName 'TypeName - -> m (Maybe DataDeclType, [Text], [(Text, Maybe SourceType)], [(ProperName 'ConstructorName, [SourceType])]) +lookupTypeDecl :: + forall m. + (MonadError MultipleErrors m) => + (MonadState CheckState m) => + ModuleName -> + ProperName 'TypeName -> + m (Maybe DataDeclType, [Text], [(Text, SourceType)], [(ProperName 'ConstructorName, [SourceType])]) lookupTypeDecl mn typeName = do env <- getEnv note (errorMessage $ CannotFindDerivingType typeName) $ do @@ -372,7 +389,7 @@ lookupTypeDecl mn typeName = do pure (dtype, fst . snd <$> kargs, map (\(v, k, _) -> (v, k)) args, dctors) isAppliedVar :: Type a -> Bool -isAppliedVar (TypeApp _ (TypeVar _ _) _) = True +isAppliedVar (TypeApp _ (TypeVar _ _ _) _) = True isAppliedVar _ = False objectType :: Type a -> Maybe (Type a) @@ -381,37 +398,40 @@ objectType _ = Nothing decomposeRec :: SourceType -> Maybe [(Label, SourceType)] decomposeRec = fmap (sortOn fst) . go - where go (RCons _ str typ typs) = fmap ((str, typ) :) (go typs) - go (REmptyKinded _ _) = Just [] - go _ = Nothing + where + go (RCons _ str typ typs) = fmap ((str, typ) :) (go typs) + go (REmptyKinded _ _) = Just [] + go _ = Nothing decomposeRec' :: SourceType -> [(Label, SourceType)] decomposeRec' = sortOn fst . go - where go (RCons _ str typ typs) = (str, typ) : go typs - go _ = [] - --- | The parameter `c` is used to allow or forbid contravariance for different --- type classes. When deriving a type class that is a variation on Functor, a --- witness for `c` will be provided; when deriving a type class that is a --- variation on Foldable or Traversable, `c` will be Void and the contravariant --- ParamUsage constructor can be skipped in pattern matching. + where + go (RCons _ str typ typs) = (str, typ) : go typs + go _ = [] + +{- | The parameter `c` is used to allow or forbid contravariance for different +type classes. When deriving a type class that is a variation on Functor, a +witness for `c` will be provided; when deriving a type class that is a +variation on Foldable or Traversable, `c` will be Void and the contravariant +ParamUsage constructor can be skipped in pattern matching. +-} data ParamUsage c = IsParam - | IsLParam - -- ^ enables biparametric classes (of any variance) to be derived - | MentionsParam (ParamUsage c) - -- ^ enables monoparametric classes to be used in a derivation - | MentionsParamBi (These (ParamUsage c) (ParamUsage c)) - -- ^ enables biparametric classes to be used in a derivation - | MentionsParamContravariantly !c (ContravariantParamUsage c) - -- ^ enables contravariant classes (of either parametricity) to be used in a derivation + | -- | enables biparametric classes (of any variance) to be derived + IsLParam + | -- | enables monoparametric classes to be used in a derivation + MentionsParam (ParamUsage c) + | -- | enables biparametric classes to be used in a derivation + MentionsParamBi (These (ParamUsage c) (ParamUsage c)) + | -- | enables contravariant classes (of either parametricity) to be used in a derivation + MentionsParamContravariantly !c (ContravariantParamUsage c) | IsRecord (NonEmpty (PSString, ParamUsage c)) data ContravariantParamUsage c - = MentionsParamContra (ParamUsage c) - -- ^ enables Contravariant to be used in a derivation - | MentionsParamPro (These (ParamUsage c) (ParamUsage c)) - -- ^ enables Profunctor to be used in a derivation + = -- | enables Contravariant to be used in a derivation + MentionsParamContra (ParamUsage c) + | -- | enables Profunctor to be used in a derivation + MentionsParamPro (These (ParamUsage c) (ParamUsage c)) data CovariantClasses = CovariantClasses { monoClass :: Qualified (ProperName 'ClassName) @@ -430,30 +450,31 @@ data ContravarianceSupport c = ContravarianceSupport , contravariantClasses :: ContravariantClasses } --- | Return, if possible, a These the contents of which each satisfy the --- predicate. +{- | Return, if possible, a These the contents of which each satisfy the +predicate. +-} filterThese :: forall a. (a -> Bool) -> These a a -> Maybe (These a a) filterThese p = uncurry align . over both (mfilter p) . unalign . Just -validateParamsInTypeConstructors - :: forall c m - . MonadError MultipleErrors m - => MonadState CheckState m - => Qualified (ProperName 'ClassName) - -> UnwrappedTypeConstructor - -> Bool - -> CovariantClasses - -> Maybe (ContravarianceSupport c) - -> m [(ProperName 'ConstructorName, [Maybe (ParamUsage c)])] -validateParamsInTypeConstructors derivingClass utc isBi CovariantClasses{..} contravarianceSupport = do - TypeInfo{..} <- lookupTypeInfo utc +validateParamsInTypeConstructors :: + forall c m. + (MonadError MultipleErrors m) => + (MonadState CheckState m) => + Qualified (ProperName 'ClassName) -> + UnwrappedTypeConstructor -> + Bool -> + CovariantClasses -> + Maybe (ContravarianceSupport c) -> + m [(ProperName 'ConstructorName, [Maybe (ParamUsage c)])] +validateParamsInTypeConstructors derivingClass utc isBi CovariantClasses {..} contravarianceSupport = do + TypeInfo {..} <- lookupTypeInfo utc (mbLParam, param) <- liftEither . first (errorMessage . flip KindsDoNotUnify kindType . (kindType -:>)) $ case (isBi, reverse tiTypeParams) of - (False, x : _) -> Right (Nothing, x) - (False, _) -> Left kindType + (False, x : _) -> Right (Nothing, x) + (False, _) -> Left kindType (True, y : x : _) -> Right (Just x, y) - (True, _ : _) -> Left kindType - (True, _) -> Left $ kindType -:> kindType + (True, _ : _) -> Left kindType + (True, _) -> Left $ kindType -:> kindType ctors <- traverse (traverse $ traverse replaceAllTypeSynonyms) tiCtors tcds <- getTypeClassDictionaries let (ctorUsages, problemSpans) = runWriter $ traverse (traverse . traverse $ typeToUsageOf tcds tiArgSubst (maybe That These mbLParam param) False) ctors @@ -461,123 +482,120 @@ validateParamsInTypeConstructors derivingClass utc isBi CovariantClasses{..} con for_ (nonEmpty $ ordNub problemSpans) $ \sss -> throwError . addHint (RelatedPositions sss) . errorMessage $ CannotDeriveInvalidConstructorArg derivingClass relatedClasses (isJust contravarianceSupport) pure ctorUsages - where - typeToUsageOf :: InstanceContext -> [(Text, SourceType)] -> These Text Text -> Bool -> SourceType -> Writer [SourceSpan] (Maybe (ParamUsage c)) - typeToUsageOf tcds subst = fix $ \go params isNegative -> let - goCo = go params isNegative - goContra = go params $ not isNegative - - assertNoParamUsedIn :: SourceType -> Writer [SourceSpan] () - assertNoParamUsedIn ty = void $ both (flip assertParamNotUsedIn ty) params - - assertParamNotUsedIn :: Text -> SourceType -> Writer [SourceSpan] () - assertParamNotUsedIn param = everythingOnTypes (*>) $ \case - TypeVar (ss, _) name | name == param -> tell [ss] - _ -> pure () - - tryBiClasses ht tyLArg tyArg - | hasInstance tcds ht biClass - = goCo tyLArg >>= preferMonoClass MentionsParamBi - | Just (ContravarianceSupport c _ _ ContravariantClasses{..}) <- contravarianceSupport, hasInstance tcds ht proClass - = goContra tyLArg >>= preferMonoClass (MentionsParamContravariantly c . MentionsParamPro) - | otherwise - = assertNoParamUsedIn tyLArg *> tryMonoClasses ht tyArg + typeToUsageOf :: InstanceContext -> [(Text, SourceType)] -> These Text Text -> Bool -> SourceType -> Writer [SourceSpan] (Maybe (ParamUsage c)) + typeToUsageOf tcds subst = fix $ \go params isNegative -> + let + goCo = go params isNegative + goContra = go params $ not isNegative + + assertNoParamUsedIn :: SourceType -> Writer [SourceSpan] () + assertNoParamUsedIn ty = void $ both (flip assertParamNotUsedIn ty) params + + assertParamNotUsedIn :: Text -> SourceType -> Writer [SourceSpan] () + assertParamNotUsedIn param = everythingOnTypes (*>) $ \case + TypeVar (ss, _) name _ | name == param -> tell [ss] + _ -> pure () + + tryBiClasses ht tyLArg tyArg + | hasInstance tcds ht biClass = + goCo tyLArg >>= preferMonoClass MentionsParamBi + | Just (ContravarianceSupport c _ _ ContravariantClasses {..}) <- contravarianceSupport + , hasInstance tcds ht proClass = + goContra tyLArg >>= preferMonoClass (MentionsParamContravariantly c . MentionsParamPro) + | otherwise = + assertNoParamUsedIn tyLArg *> tryMonoClasses ht tyArg + where + preferMonoClass f lUsage = + (if isNothing lUsage && hasInstance tcds ht monoClass then fmap MentionsParam else fmap f . align lUsage) <$> goCo tyArg + + tryMonoClasses ht tyArg + | hasInstance tcds ht monoClass = + fmap MentionsParam <$> goCo tyArg + | Just (ContravarianceSupport c _ _ ContravariantClasses {..}) <- contravarianceSupport + , hasInstance tcds ht contraClass = + fmap (MentionsParamContravariantly c . MentionsParamContra) <$> goContra tyArg + | otherwise = + assertNoParamUsedIn tyArg $> Nothing + + headOfTypeWithSubst :: SourceType -> Qualified (Either Text (ProperName 'TypeName)) + headOfTypeWithSubst = headOfType . replaceAllTypeVars subst + in + \case + ForAll _ _ name _ ty _ -> + fmap join . traverse (\params' -> go params' isNegative ty) $ filterThese (/= name) params + ConstrainedType _ _ ty -> + goCo ty + TypeApp _ (TypeConstructor _ Prim.Record) row -> + fmap (fmap IsRecord . nonEmpty . catMaybes) . for (decomposeRec' row) $ \(Label lbl, ty) -> + fmap (lbl,) <$> goCo ty + TypeApp _ (TypeApp _ tyFn tyLArg) tyArg -> + assertNoParamUsedIn tyFn *> tryBiClasses (headOfTypeWithSubst tyFn) tyLArg tyArg + TypeApp _ tyFn tyArg -> + assertNoParamUsedIn tyFn *> tryMonoClasses (headOfTypeWithSubst tyFn) tyArg + TypeVar (ss, _) name _ -> mergeTheseWith (checkName lparamIsContra IsLParam) (checkName paramIsContra IsParam) (liftA2 (<|>)) params + where + checkName thisParamIsContra usage param + | name == param = when (thisParamIsContra /= isNegative) (tell [ss]) $> Just usage + | otherwise = pure Nothing + ty -> + assertNoParamUsedIn ty $> Nothing + + paramIsContra = any paramIsContravariant contravarianceSupport + lparamIsContra = any lparamIsContravariant contravarianceSupport + + hasInstance :: InstanceContext -> Qualified (Either Text (ProperName 'TypeName)) -> Qualified (ProperName 'ClassName) -> Bool + hasInstance tcds ht@(Qualified qb _) cn@(Qualified cqb _) = + any tcdAppliesToType $ concatMap (findDicts tcds cn) (ordNub [ByNullSourcePos, cqb, qb]) where - preferMonoClass f lUsage = - (if isNothing lUsage && hasInstance tcds ht monoClass then fmap MentionsParam else fmap f . align lUsage) <$> goCo tyArg - - tryMonoClasses ht tyArg - | hasInstance tcds ht monoClass - = fmap MentionsParam <$> goCo tyArg - | Just (ContravarianceSupport c _ _ ContravariantClasses{..}) <- contravarianceSupport, hasInstance tcds ht contraClass - = fmap (MentionsParamContravariantly c . MentionsParamContra) <$> goContra tyArg - | otherwise - = assertNoParamUsedIn tyArg $> Nothing - - headOfTypeWithSubst :: SourceType -> Qualified (Either Text (ProperName 'TypeName)) - headOfTypeWithSubst = headOfType . replaceAllTypeVars subst - - in \case - ForAll _ _ name _ ty _ -> - fmap join . traverse (\params' -> go params' isNegative ty) $ filterThese (/= name) params - - ConstrainedType _ _ ty -> - goCo ty - - TypeApp _ (TypeConstructor _ Prim.Record) row -> - fmap (fmap IsRecord . nonEmpty . catMaybes) . for (decomposeRec' row) $ \(Label lbl, ty) -> - fmap (lbl, ) <$> goCo ty - - TypeApp _ (TypeApp _ tyFn tyLArg) tyArg -> - assertNoParamUsedIn tyFn *> tryBiClasses (headOfTypeWithSubst tyFn) tyLArg tyArg - - TypeApp _ tyFn tyArg -> - assertNoParamUsedIn tyFn *> tryMonoClasses (headOfTypeWithSubst tyFn) tyArg - - TypeVar (ss, _) name -> mergeTheseWith (checkName lparamIsContra IsLParam) (checkName paramIsContra IsParam) (liftA2 (<|>)) params - where - checkName thisParamIsContra usage param - | name == param = when (thisParamIsContra /= isNegative) (tell [ss]) $> Just usage - | otherwise = pure Nothing - - ty -> - assertNoParamUsedIn ty $> Nothing - - paramIsContra = any paramIsContravariant contravarianceSupport - lparamIsContra = any lparamIsContravariant contravarianceSupport - - hasInstance :: InstanceContext -> Qualified (Either Text (ProperName 'TypeName)) -> Qualified (ProperName 'ClassName) -> Bool - hasInstance tcds ht@(Qualified qb _) cn@(Qualified cqb _) = - any tcdAppliesToType $ concatMap (findDicts tcds cn) (ordNub [ByNullSourcePos, cqb, qb]) - where - tcdAppliesToType tcd = case tcdInstanceTypes tcd of - [headOfType -> ht'] -> ht == ht' - -- It's possible that, if ht and ht' are Lefts, this might require - -- verifying that the name isn't shadowed by something in tcdForAll. I - -- can't devise a legal program that causes this issue, but if in the - -- future it seems like a good idea, it probably is. - _ -> False - - headOfType :: SourceType -> Qualified (Either Text (ProperName 'TypeName)) - headOfType = fix $ \go -> \case - TypeApp _ ty _ -> go ty - KindApp _ ty _ -> go ty - TypeVar _ nm -> Qualified ByNullSourcePos (Left nm) - Skolem _ nm _ _ _ -> Qualified ByNullSourcePos (Left nm) - TypeConstructor _ (Qualified qb nm) -> Qualified qb (Right nm) - ty -> internalError $ "headOfType missing a case: " <> show (void ty) - -usingLamIdent :: forall m. MonadSupply m => (Expr -> m Expr) -> m Expr + tcdAppliesToType tcd = case tcdInstanceTypes tcd of + [headOfType -> ht'] -> ht == ht' + -- It's possible that, if ht and ht' are Lefts, this might require + -- verifying that the name isn't shadowed by something in tcdForAll. I + -- can't devise a legal program that causes this issue, but if in the + -- future it seems like a good idea, it probably is. + _ -> False + + headOfType :: SourceType -> Qualified (Either Text (ProperName 'TypeName)) + headOfType = fix $ \go -> \case + TypeApp _ ty _ -> go ty + KindApp _ ty _ -> go ty + TypeVar _ nm _ -> Qualified ByNullSourcePos (Left nm) + Skolem _ nm _ _ _ -> Qualified ByNullSourcePos (Left nm) + TypeConstructor _ (Qualified qb nm) -> Qualified qb (Right nm) + ty -> internalError $ "headOfType missing a case: " <> show (void ty) + +usingLamIdent :: forall m. (MonadSupply m) => (Expr -> m Expr) -> m Expr usingLamIdent cb = do ident <- freshIdent "v" lam ident <$> cb (mkVar ident) -traverseFields :: forall c f. Applicative f => (ParamUsage c -> Expr -> f Expr) -> NonEmpty (PSString, ParamUsage c) -> Expr -> f Expr -traverseFields f fields r = fmap (ObjectUpdate r) . for (toList fields) $ \(lbl, usage) -> (lbl, ) <$> f usage (Accessor lbl r) +traverseFields :: forall c f. (Applicative f) => (ParamUsage c -> Expr -> f Expr) -> NonEmpty (PSString, ParamUsage c) -> Expr -> f Expr +traverseFields f fields r = fmap (ObjectUpdate r) . for (toList fields) $ \(lbl, usage) -> (lbl,) <$> f usage (Accessor lbl r) -unnestRecords :: forall c f. Applicative f => (ParamUsage c -> Expr -> f Expr) -> ParamUsage c -> Expr -> f Expr +unnestRecords :: forall c f. (Applicative f) => (ParamUsage c -> Expr -> f Expr) -> ParamUsage c -> Expr -> f Expr unnestRecords f = fix $ \go -> \case IsRecord fields -> traverseFields go fields usage -> f usage -mkCasesForTraversal - :: forall c f m - . Applicative f -- this effect distinguishes the semantics of maps, folds, and traversals - => MonadSupply m - => ModuleName - -> (ParamUsage c -> Expr -> f Expr) -- how to handle constructor arguments - -> (f Expr -> m Expr) -- resolve the applicative effect into an expression - -> [(ProperName 'ConstructorName, [Maybe (ParamUsage c)])] - -> m Expr +mkCasesForTraversal :: + forall c f m. + (Applicative f) => -- this effect distinguishes the semantics of maps, folds, and traversals + (MonadSupply m) => + ModuleName -> + (ParamUsage c -> Expr -> f Expr) -> -- how to handle constructor arguments + (f Expr -> m Expr) -> -- resolve the applicative effect into an expression + [(ProperName 'ConstructorName, [Maybe (ParamUsage c)])] -> + m Expr mkCasesForTraversal mn handleArg extractExpr ctors = do m <- freshIdent "m" fmap (lamCase m) . for ctors $ \(ctorName, ctorUsages) -> do - ctorArgs <- for ctorUsages $ \usage -> freshIdent "v" <&> (, usage) + ctorArgs <- for ctorUsages $ \usage -> freshIdent "v" <&> (,usage) let ctor = mkCtor mn ctorName let caseBinder = mkCtorBinder mn ctorName $ map (mkBinder . fst) ctorArgs fmap (CaseAlternative [caseBinder] . unguarded) . extractExpr $ - fmap (foldl' App ctor) . for ctorArgs $ \(ident, mbUsage) -> maybe pure handleArg mbUsage $ mkVar ident + fmap (foldl' App ctor) . for ctorArgs $ + \(ident, mbUsage) -> maybe pure handleArg mbUsage $ mkVar ident data TraversalExprs = TraversalExprs { recurseVar :: Expr -- a var representing map, foldMap, or traverse, for handling structured values @@ -594,27 +612,29 @@ data ContraversalExprs = ContraversalExprs } appBirecurseExprs :: TraversalExprs -> These Expr Expr -> Expr -appBirecurseExprs TraversalExprs{..} = these (App lrecurseExpr) (App rrecurseExpr) (App . App birecurseVar) +appBirecurseExprs TraversalExprs {..} = these (App lrecurseExpr) (App rrecurseExpr) (App . App birecurseVar) appDirecurseExprs :: ContraversalExprs -> These Expr Expr -> Expr -appDirecurseExprs ContraversalExprs{..} = these (App lcrecurseVar) (App rprorecurseVar) (App . App direcurseVar) +appDirecurseExprs ContraversalExprs {..} = these (App lcrecurseVar) (App rprorecurseVar) (App . App direcurseVar) -data TraversalOps m = forall f. Applicative f => TraversalOps +data TraversalOps m = forall f. + (Applicative f) => + TraversalOps { visitExpr :: m Expr -> f Expr -- lift an expression into the applicative effect defining the traversal , extractExpr :: f Expr -> m Expr -- resolve the applicative effect into an expression } -mkTraversal - :: forall c m - . MonadSupply m - => ModuleName - -> Bool - -> TraversalExprs - -> (c -> ContraversalExprs) - -> TraversalOps m - -> [(ProperName 'ConstructorName, [Maybe (ParamUsage c)])] - -> m Expr -mkTraversal mn isBi te@TraversalExprs{..} getContraversalExprs (TraversalOps @_ @f visitExpr extractExpr) ctors = do +mkTraversal :: + forall c m. + (MonadSupply m) => + ModuleName -> + Bool -> + TraversalExprs -> + (c -> ContraversalExprs) -> + TraversalOps m -> + [(ProperName 'ConstructorName, [Maybe (ParamUsage c)])] -> + m Expr +mkTraversal mn isBi te@TraversalExprs {..} getContraversalExprs (TraversalOps @_ @f visitExpr extractExpr) ctors = do f <- freshIdent "f" g <- if isBi then freshIdent "g" else pure f let @@ -632,7 +652,7 @@ mkTraversal mn isBi te@TraversalExprs{..} getContraversalExprs (TraversalOps @_ MentionsParamBi theseInnerUsages -> appBirecurseExprs te <$> both mkFnExprForValue theseInnerUsages MentionsParamContravariantly c contraUsage -> do - let ce@ContraversalExprs{..} = getContraversalExprs c + let ce@ContraversalExprs {..} = getContraversalExprs c case contraUsage of MentionsParamContra innerUsage -> App crecurseVar <$> mkFnExprForValue innerUsage @@ -643,61 +663,66 @@ mkTraversal mn isBi te@TraversalExprs{..} getContraversalExprs (TraversalOps @_ lam f . applyWhen isBi (lam g) <$> mkCasesForTraversal mn handleValue extractExpr ctors -deriveFunctor - :: forall m - . MonadError MultipleErrors m - => MonadState CheckState m - => MonadSupply m - => Maybe Bool -- does left parameter exist, and is it contravariant? - -> Bool -- is the (right) parameter contravariant? - -> PSString -- name of the map function for this functor type - -> Qualified (ProperName 'ClassName) - -> UnwrappedTypeConstructor - -> m [(PSString, Expr)] +deriveFunctor :: + forall m. + (MonadError MultipleErrors m) => + (MonadState CheckState m) => + (MonadSupply m) => + Maybe Bool -> -- does left parameter exist, and is it contravariant? + Bool -> -- is the (right) parameter contravariant? + PSString -> -- name of the map function for this functor type + Qualified (ProperName 'ClassName) -> + UnwrappedTypeConstructor -> + m [(PSString, Expr)] deriveFunctor mbLParamIsContravariant paramIsContravariant mapName nm utc = do - ctors <- validateParamsInTypeConstructors nm utc isBi functorClasses $ Just $ ContravarianceSupport - { contravarianceWitness = () - , paramIsContravariant - , lparamIsContravariant = or mbLParamIsContravariant - , contravariantClasses - } + ctors <- + validateParamsInTypeConstructors nm utc isBi functorClasses $ + Just $ + ContravarianceSupport + { contravarianceWitness = () + , paramIsContravariant + , lparamIsContravariant = or mbLParamIsContravariant + , contravariantClasses + } mapFun <- mkTraversal (utcModuleName utc) isBi mapExprs (const cmapExprs) (TraversalOps identity identity) ctors pure [(mapName, mapFun)] where - isBi = isJust mbLParamIsContravariant - mapExprs = TraversalExprs - { recurseVar = mkRef Libs.I_map - , birecurseVar = mkRef Libs.I_bimap - , lrecurseExpr = mkRef Libs.I_lmap - , rrecurseExpr = mkRef Libs.I_rmap - } - cmapExprs = ContraversalExprs - { crecurseVar = mkRef Libs.I_cmap - , direcurseVar = mkRef Libs.I_dimap - , lcrecurseVar = mkRef Libs.I_lcmap - , rprorecurseVar = mkRef Libs.I_profunctorRmap - } - functorClasses = CovariantClasses Libs.Functor Libs.Bifunctor - contravariantClasses = ContravariantClasses Libs.Contravariant Libs.Profunctor + isBi = isJust mbLParamIsContravariant + mapExprs = + TraversalExprs + { recurseVar = mkRef Libs.I_map + , birecurseVar = mkRef Libs.I_bimap + , lrecurseExpr = mkRef Libs.I_lmap + , rrecurseExpr = mkRef Libs.I_rmap + } + cmapExprs = + ContraversalExprs + { crecurseVar = mkRef Libs.I_cmap + , direcurseVar = mkRef Libs.I_dimap + , lcrecurseVar = mkRef Libs.I_lcmap + , rprorecurseVar = mkRef Libs.I_profunctorRmap + } + functorClasses = CovariantClasses Libs.Functor Libs.Bifunctor + contravariantClasses = ContravariantClasses Libs.Contravariant Libs.Profunctor toConst :: forall f a b. f a -> Const [f a] b toConst = Const . pure -consumeConst :: forall f a b c. Applicative f => ([a] -> b) -> Const [f a] c -> f b +consumeConst :: forall f a b c. (Applicative f) => ([a] -> b) -> Const [f a] c -> f b consumeConst f = fmap f . sequenceA . getConst applyWhen :: forall a. Bool -> (a -> a) -> a -> a applyWhen cond f = if cond then f else identity -deriveFoldable - :: forall m - . MonadError MultipleErrors m - => MonadState CheckState m - => MonadSupply m - => Bool -- is there a left parameter (are we deriving Bifoldable)? - -> Qualified (ProperName 'ClassName) - -> UnwrappedTypeConstructor - -> m [(PSString, Expr)] +deriveFoldable :: + forall m. + (MonadError MultipleErrors m) => + (MonadState CheckState m) => + (MonadSupply m) => + Bool -> -- is there a left parameter (are we deriving Bifoldable)? + Qualified (ProperName 'ClassName) -> + UnwrappedTypeConstructor -> + m [(PSString, Expr)] deriveFoldable isBi nm utc = do ctors <- validateParamsInTypeConstructors nm utc isBi foldableClasses Nothing foldlFun <- mkAsymmetricFoldFunction False foldlExprs ctors @@ -709,92 +734,95 @@ deriveFoldable isBi nm utc = do , (if isBi then Libs.S_bifoldMap else Libs.S_foldMap, foldMapFun) ] where - mn = utcModuleName utc - foldableClasses = CovariantClasses Libs.Foldable Libs.Bifoldable - foldlExprs = TraversalExprs - { recurseVar = mkRef Libs.I_foldl - , birecurseVar = bifoldlVar - , lrecurseExpr = App (App flipVar bifoldlVar) constVar - , rrecurseExpr = App bifoldlVar constVar - } - foldrExprs = TraversalExprs - { recurseVar = mkRef Libs.I_foldr - , birecurseVar = bifoldrVar - , lrecurseExpr = App (App flipVar bifoldrVar) (App constVar identityVar) - , rrecurseExpr = App bifoldrVar (App constVar identityVar) - } - foldMapExprs = TraversalExprs - { recurseVar = mkRef Libs.I_foldMap - , birecurseVar = bifoldMapVar - , lrecurseExpr = App (App flipVar bifoldMapVar) memptyVar - , rrecurseExpr = App bifoldMapVar memptyVar - } - bifoldlVar = mkRef Libs.I_bifoldl - bifoldrVar = mkRef Libs.I_bifoldr - bifoldMapVar = mkRef Libs.I_bifoldMap - constVar = mkRef Libs.I_const - flipVar = mkRef Libs.I_flip - identityVar = mkRef Libs.I_identity - memptyVar = mkRef Libs.I_mempty - - mkAsymmetricFoldFunction :: Bool -> TraversalExprs -> [(ProperName 'ConstructorName, [Maybe (ParamUsage Void)])] -> m Expr - mkAsymmetricFoldFunction isRightFold te@TraversalExprs{..} ctors = do - f <- freshIdent "f" - g <- if isBi then freshIdent "g" else pure f - z <- freshIdent "z" - let - appCombiner :: (Bool, Expr) -> Expr -> Expr -> Expr - appCombiner (isFlipped, fn) = applyWhen (isFlipped == isRightFold) flip $ App . App fn - - mkCombinerExpr :: ParamUsage Void -> m Expr - mkCombinerExpr = fmap (uncurry $ \isFlipped -> applyWhen isFlipped $ App flipVar) . getCombiner - - handleValue :: ParamUsage Void -> Expr -> Const [m (Expr -> Expr)] Expr - handleValue = unnestRecords $ \usage inputExpr -> toConst $ flip appCombiner inputExpr <$> getCombiner usage - - getCombiner :: ParamUsage Void -> m (Bool, Expr) - getCombiner = \case - IsParam -> - pure (False, mkVar g) - IsLParam -> - pure (False, mkVar f) - MentionsParam innerUsage -> - (isRightFold, ) . App recurseVar <$> mkCombinerExpr innerUsage - MentionsParamBi theseInnerUsages -> - (isRightFold, ) . appBirecurseExprs te <$> both mkCombinerExpr theseInnerUsages - IsRecord fields -> do - let foldFieldsOf = traverseFields handleValue fields - fmap (False, ) . usingLamIdent $ \lVar -> - usingLamIdent $ - if isRightFold - then flip extractExprStartingWith $ foldFieldsOf lVar - else extractExprStartingWith lVar . foldFieldsOf - - extractExprStartingWith :: Expr -> Const [m (Expr -> Expr)] Expr -> m Expr - extractExprStartingWith = consumeConst . if isRightFold then foldr ($) else foldl' (&) - - lam f . applyWhen isBi (lam g) . lam z <$> mkCasesForTraversal mn handleValue (extractExprStartingWith $ mkVar z) ctors - -foldMapOps :: forall m. Applicative m => TraversalOps m -foldMapOps = TraversalOps { visitExpr = toConst, .. } + mn = utcModuleName utc + foldableClasses = CovariantClasses Libs.Foldable Libs.Bifoldable + foldlExprs = + TraversalExprs + { recurseVar = mkRef Libs.I_foldl + , birecurseVar = bifoldlVar + , lrecurseExpr = App (App flipVar bifoldlVar) constVar + , rrecurseExpr = App bifoldlVar constVar + } + foldrExprs = + TraversalExprs + { recurseVar = mkRef Libs.I_foldr + , birecurseVar = bifoldrVar + , lrecurseExpr = App (App flipVar bifoldrVar) (App constVar identityVar) + , rrecurseExpr = App bifoldrVar (App constVar identityVar) + } + foldMapExprs = + TraversalExprs + { recurseVar = mkRef Libs.I_foldMap + , birecurseVar = bifoldMapVar + , lrecurseExpr = App (App flipVar bifoldMapVar) memptyVar + , rrecurseExpr = App bifoldMapVar memptyVar + } + bifoldlVar = mkRef Libs.I_bifoldl + bifoldrVar = mkRef Libs.I_bifoldr + bifoldMapVar = mkRef Libs.I_bifoldMap + constVar = mkRef Libs.I_const + flipVar = mkRef Libs.I_flip + identityVar = mkRef Libs.I_identity + memptyVar = mkRef Libs.I_mempty + + mkAsymmetricFoldFunction :: Bool -> TraversalExprs -> [(ProperName 'ConstructorName, [Maybe (ParamUsage Void)])] -> m Expr + mkAsymmetricFoldFunction isRightFold te@TraversalExprs {..} ctors = do + f <- freshIdent "f" + g <- if isBi then freshIdent "g" else pure f + z <- freshIdent "z" + let + appCombiner :: (Bool, Expr) -> Expr -> Expr -> Expr + appCombiner (isFlipped, fn) = applyWhen (isFlipped == isRightFold) flip $ App . App fn + + mkCombinerExpr :: ParamUsage Void -> m Expr + mkCombinerExpr = fmap (uncurry $ \isFlipped -> applyWhen isFlipped $ App flipVar) . getCombiner + + handleValue :: ParamUsage Void -> Expr -> Const [m (Expr -> Expr)] Expr + handleValue = unnestRecords $ \usage inputExpr -> toConst $ flip appCombiner inputExpr <$> getCombiner usage + + getCombiner :: ParamUsage Void -> m (Bool, Expr) + getCombiner = \case + IsParam -> + pure (False, mkVar g) + IsLParam -> + pure (False, mkVar f) + MentionsParam innerUsage -> + (isRightFold,) . App recurseVar <$> mkCombinerExpr innerUsage + MentionsParamBi theseInnerUsages -> + (isRightFold,) . appBirecurseExprs te <$> both mkCombinerExpr theseInnerUsages + IsRecord fields -> do + let foldFieldsOf = traverseFields handleValue fields + fmap (False,) . usingLamIdent $ \lVar -> + usingLamIdent $ + if isRightFold + then flip extractExprStartingWith $ foldFieldsOf lVar + else extractExprStartingWith lVar . foldFieldsOf + + extractExprStartingWith :: Expr -> Const [m (Expr -> Expr)] Expr -> m Expr + extractExprStartingWith = consumeConst . if isRightFold then foldr ($) else foldl' (&) + + lam f . applyWhen isBi (lam g) . lam z <$> mkCasesForTraversal mn handleValue (extractExprStartingWith $ mkVar z) ctors + +foldMapOps :: forall m. (Applicative m) => TraversalOps m +foldMapOps = TraversalOps {visitExpr = toConst, ..} where - appendVar = mkRef Libs.I_append - memptyVar = mkRef Libs.I_mempty - - extractExpr :: Const [m Expr] Expr -> m Expr - extractExpr = consumeConst $ \case - [] -> memptyVar - exprs -> foldr1 (App . App appendVar) exprs - -deriveTraversable - :: forall m - . MonadError MultipleErrors m - => MonadState CheckState m - => MonadSupply m - => Bool -- is there a left parameter (are we deriving Bitraversable)? - -> Qualified (ProperName 'ClassName) - -> UnwrappedTypeConstructor - -> m [(PSString, Expr)] + appendVar = mkRef Libs.I_append + memptyVar = mkRef Libs.I_mempty + + extractExpr :: Const [m Expr] Expr -> m Expr + extractExpr = consumeConst $ \case + [] -> memptyVar + exprs -> foldr1 (App . App appendVar) exprs + +deriveTraversable :: + forall m. + (MonadError MultipleErrors m) => + (MonadState CheckState m) => + (MonadSupply m) => + Bool -> -- is there a left parameter (are we deriving Bitraversable)? + Qualified (ProperName 'ClassName) -> + UnwrappedTypeConstructor -> + m [(PSString, Expr)] deriveTraversable isBi nm utc = do ctors <- validateParamsInTypeConstructors nm utc isBi traversableClasses Nothing traverseFun <- mkTraversal (utcModuleName utc) isBi traverseExprs absurd traverseOps ctors @@ -804,33 +832,34 @@ deriveTraversable isBi nm utc = do , (if isBi then Libs.S_bisequence else Libs.S_sequence, sequenceFun) ] where - traversableClasses = CovariantClasses Libs.Traversable Libs.Bitraversable - traverseExprs = TraversalExprs - { recurseVar = traverseVar - , birecurseVar = bitraverseVar - , lrecurseExpr = mkRef Libs.I_ltraverse - , rrecurseExpr = mkRef Libs.I_rtraverse - } - traverseVar = mkRef Libs.I_traverse - bitraverseVar = mkRef Libs.I_bitraverse - identityVar = mkRef Libs.I_identity - -traverseOps :: forall m. MonadSupply m => TraversalOps m -traverseOps = TraversalOps { .. } + traversableClasses = CovariantClasses Libs.Traversable Libs.Bitraversable + traverseExprs = + TraversalExprs + { recurseVar = traverseVar + , birecurseVar = bitraverseVar + , lrecurseExpr = mkRef Libs.I_ltraverse + , rrecurseExpr = mkRef Libs.I_rtraverse + } + traverseVar = mkRef Libs.I_traverse + bitraverseVar = mkRef Libs.I_bitraverse + identityVar = mkRef Libs.I_identity + +traverseOps :: forall m. (MonadSupply m) => TraversalOps m +traverseOps = TraversalOps {..} where - pureVar = mkRef Libs.I_pure - mapVar = mkRef Libs.I_map - applyVar = mkRef Libs.I_apply - - visitExpr :: m Expr -> WriterT [(Ident, m Expr)] m Expr - visitExpr traversedExpr = do - ident <- freshIdent "v" - tell [(ident, traversedExpr)] $> mkVar ident - - extractExpr :: WriterT [(Ident, m Expr)] m Expr -> m Expr - extractExpr = runWriterT >=> \(result, unzip -> (ctx, args)) -> flip mkApps (foldr lam result ctx) <$> sequenceA args - - mkApps :: [Expr] -> Expr -> Expr - mkApps = \case - [] -> App pureVar - h : t -> \l -> foldl' (App . App applyVar) (App (App mapVar l) h) t + pureVar = mkRef Libs.I_pure + mapVar = mkRef Libs.I_map + applyVar = mkRef Libs.I_apply + + visitExpr :: m Expr -> WriterT [(Ident, m Expr)] m Expr + visitExpr traversedExpr = do + ident <- freshIdent "v" + tell [(ident, traversedExpr)] $> mkVar ident + + extractExpr :: WriterT [(Ident, m Expr)] m Expr -> m Expr + extractExpr = runWriterT >=> \(result, unzip -> (ctx, args)) -> flip mkApps (foldr lam result ctx) <$> sequenceA args + + mkApps :: [Expr] -> Expr -> Expr + mkApps = \case + [] -> App pureVar + h : t -> \l -> foldl' (App . App applyVar) (App (App mapVar l) h) t diff --git a/src/Language/PureScript/TypeChecker/Entailment.hs b/src/Language/PureScript/TypeChecker/Entailment.hs index 7a3872c1c..8bc013335 100644 --- a/src/Language/PureScript/TypeChecker/Entailment.hs +++ b/src/Language/PureScript/TypeChecker/Entailment.hs @@ -1,75 +1,83 @@ --- | --- Type class entailment --- -module Language.PureScript.TypeChecker.Entailment - ( InstanceContext - , SolverOptions(..) - , replaceTypeClassDictionaries - , newDictionaries - , entails - , findDicts - ) where - +{- | +Type class entailment +-} +module Language.PureScript.TypeChecker.Entailment ( + InstanceContext, + SolverOptions (..), + replaceTypeClassDictionaries, + newDictionaries, + entails, + findDicts, +) where + +import Protolude (headMay, ordNub) import Prelude -import Protolude (ordNub, headMay) import Control.Arrow (second, (&&&)) -import Control.Monad.Error.Class (MonadError(..)) -import Control.Monad.State (MonadState(..), MonadTrans(..), StateT(..), evalStateT, execStateT, foldM, gets, guard, join, modify, zipWithM, zipWithM_, (<=<)) -import Control.Monad.Supply.Class (MonadSupply(..)) -import Control.Monad.Writer (Any(..), MonadWriter(..), WriterT(..)) +import Control.Monad.Error.Class (MonadError (..)) +import Control.Monad.State (MonadState (..), MonadTrans (..), StateT (..), evalStateT, execStateT, foldM, gets, guard, join, modify, zipWithM, zipWithM_, (<=<)) +import Control.Monad.Supply.Class (MonadSupply (..)) +import Control.Monad.Writer (Any (..), MonadWriter (..), WriterT (..)) import Data.Either (lefts, partitionEithers) -import Data.Foldable (for_, fold, toList) +import Data.Foldable (fold, for_, toList) import Data.Function (on) import Data.Functor (($>), (<&>)) import Data.List (delete, findIndices, minimumBy, nubBy, sortOn, tails) -import Data.Maybe (catMaybes, fromMaybe, listToMaybe, mapMaybe) +import Data.List.NonEmpty (NonEmpty (..)) +import Data.List.NonEmpty qualified as NEL import Data.Map qualified as M +import Data.Maybe (catMaybes, fromMaybe, listToMaybe, mapMaybe) import Data.Set qualified as S -import Data.Traversable (for) import Data.Text (Text, stripPrefix, stripSuffix) import Data.Text qualified as T -import Data.List.NonEmpty (NonEmpty(..)) -import Data.List.NonEmpty qualified as NEL +import Data.Traversable (for) -import Language.PureScript.AST (Binder(..), ErrorMessageHint(..), Expr(..), Literal(..), pattern NullSourceSpan, everywhereOnValuesTopDownM, nullSourceSpan, everythingOnValues) -import Language.PureScript.AST.Declarations (UnknownsHint(..)) +import Language.PureScript.AST (Binder (..), ErrorMessageHint (..), Expr (..), Literal (..), everythingOnValues, everywhereOnValuesTopDownM, nullSourceAnn, nullSourceSpan, pattern NullSourceSpan) +import Language.PureScript.AST.Declarations (UnknownsHint (..)) +import Language.PureScript.Constants.Libs qualified as C +import Language.PureScript.Constants.Prim qualified as C import Language.PureScript.Crash (internalError) -import Language.PureScript.Environment (Environment(..), FunctionalDependency(..), TypeClassData(..), dictTypeName, kindRow, tyBoolean, tyInt, tyString) -import Language.PureScript.Errors (MultipleErrors, SimpleErrorMessage(..), addHint, addHints, errorMessage, rethrow) -import Language.PureScript.Names (pattern ByNullSourcePos, Ident(..), ModuleName, ProperName(..), ProperNameType(..), Qualified(..), QualifiedBy(..), byMaybeModuleName, coerceProperName, disqualify, freshIdent, getQual) -import Language.PureScript.TypeChecker.Entailment.Coercible (GivenSolverState(..), WantedSolverState(..), initialGivenSolverState, initialWantedSolverState, insoluble, solveGivens, solveWanteds) +import Language.PureScript.Environment (Environment (..), FunctionalDependency (..), TypeClassData (..), dictTypeName, kindRow, kindType, mkRecordT, tyBoolean, tyInt, tyString) +import Language.PureScript.Errors (MultipleErrors, SimpleErrorMessage (..), addHint, addHints, errorMessage, rethrow) +import Language.PureScript.Label (Label (..)) +import Language.PureScript.Names (Ident (..), ModuleName, ProperName (..), ProperNameType (..), Qualified (..), QualifiedBy (..), byMaybeModuleName, coerceProperName, disqualify, freshIdent, getQual, pattern ByNullSourcePos) +import Language.PureScript.PSString (PSString, decodeString, mkString) +import Language.PureScript.TypeChecker.Entailment.Coercible (GivenSolverState (..), WantedSolverState (..), initialGivenSolverState, initialWantedSolverState, insoluble, solveGivens, solveWanteds) import Language.PureScript.TypeChecker.Entailment.IntCompare (mkFacts, mkRelation, solveRelation) import Language.PureScript.TypeChecker.Kinds (elaborateKind, unifyKinds') -import Language.PureScript.TypeChecker.Monad (CheckState(..), withErrorMessageHint) +import Language.PureScript.TypeChecker.Monad (CheckState (..), withErrorMessageHint) import Language.PureScript.TypeChecker.Synonyms (replaceAllTypeSynonyms) import Language.PureScript.TypeChecker.Unify (freshTypeWithKind, substituteType, unifyTypes) -import Language.PureScript.TypeClassDictionaries (NamedDict, TypeClassDictionaryInScope(..), superclassName) +import Language.PureScript.TypeClassDictionaries (NamedDict, TypeClassDictionaryInScope (..), superclassName) import Language.PureScript.Types -import Language.PureScript.Label (Label(..)) -import Language.PureScript.PSString (PSString, mkString, decodeString) -import Language.PureScript.Constants.Libs qualified as C -import Language.PureScript.Constants.Prim qualified as C -- | Describes what sort of dictionary to generate for type class instances data Evidence - -- | An existing named instance - = NamedInstance (Qualified Ident) - - -- | Computed instances - | WarnInstance SourceType -- ^ Warn type class with a user-defined warning message - | IsSymbolInstance PSString -- ^ The IsSymbol type class for a given Symbol literal - | ReflectableInstance Reflectable -- ^ The Reflectable type class for a reflectable kind - | EmptyClassInstance -- ^ For any solved type class with no members + = -- | An existing named instance + NamedInstance (Qualified Ident) + | -- | Computed instances + WarnInstance + -- | Warn type class with a user-defined warning message + SourceType + | -- | The IsSymbol type class for a given Symbol literal + IsSymbolInstance PSString + | -- | The Reflectable type class for a reflectable kind + ReflectableInstance Reflectable + | -- | For any solved type class with no members + EmptyClassInstance deriving (Show, Eq) -- | Describes kinds that are reflectable to the term-level data Reflectable - = ReflectableInt Integer -- ^ For type-level numbers - | ReflectableString PSString -- ^ For type-level strings - | ReflectableBoolean Bool -- ^ For type-level booleans - | ReflectableOrdering Ordering -- ^ For type-level orderings + = -- | For type-level numbers + ReflectableInt Integer + | -- | For type-level strings + ReflectableString PSString + | -- | For type-level booleans + ReflectableBoolean Bool + | -- | For type-level orderings + ReflectableOrdering Ordering deriving (Show, Eq) -- | Reflect a reflectable type into an expression @@ -92,50 +100,57 @@ namedInstanceIdentifier _ = Nothing type TypeClassDict = TypeClassDictionaryInScope Evidence -- | The 'InstanceContext' tracks those constraints which can be satisfied. -type InstanceContext = M.Map QualifiedBy - (M.Map (Qualified (ProperName 'ClassName)) - (M.Map (Qualified Ident) (NonEmpty NamedDict))) +type InstanceContext = + M.Map + QualifiedBy + ( M.Map + (Qualified (ProperName 'ClassName)) + (M.Map (Qualified Ident) (NonEmpty NamedDict)) + ) findDicts :: InstanceContext -> Qualified (ProperName 'ClassName) -> QualifiedBy -> [TypeClassDict] findDicts ctx cn = fmap (fmap NamedInstance) . foldMap NEL.toList . foldMap M.elems . (M.lookup cn <=< flip M.lookup ctx) --- | A type substitution which makes an instance head match a list of types. --- --- Note: we store many types per type variable name. For any name, all types --- should unify if we are going to commit to an instance. +{- | A type substitution which makes an instance head match a list of types. + +Note: we store many types per type variable name. For any name, all types +should unify if we are going to commit to an instance. +-} type Matching a = M.Map Text a combineContexts :: InstanceContext -> InstanceContext -> InstanceContext combineContexts = M.unionWith (M.unionWith (M.unionWith (<>))) -- | Replace type class dictionary placeholders with inferred type class dictionaries -replaceTypeClassDictionaries - :: forall m - . (MonadState CheckState m, MonadError MultipleErrors m, MonadWriter MultipleErrors m, MonadSupply m) - => Bool - -> Expr - -> m (Expr, [(Ident, InstanceContext, SourceConstraint)]) +replaceTypeClassDictionaries :: + forall m. + (MonadState CheckState m, MonadError MultipleErrors m, MonadWriter MultipleErrors m, MonadSupply m) => + Bool -> + Expr -> + m (Expr, [(Ident, InstanceContext, SourceConstraint)]) replaceTypeClassDictionaries shouldGeneralize expr = flip evalStateT M.empty $ do - -- Loop, deferring any unsolved constraints, until there are no more - -- constraints which can be solved, then make a generalization pass. - let loop e = do - (e', solved) <- deferPass e - if getAny solved - then loop e' - else return e' - loop expr >>= generalizePass + -- Loop, deferring any unsolved constraints, until there are no more + -- constraints which can be solved, then make a generalization pass. + let loop e = do + (e', solved) <- deferPass e + if getAny solved + then loop e' + else return e' + loop expr >>= generalizePass where -- This pass solves constraints where possible, deferring constraints if not. deferPass :: Expr -> StateT InstanceContext m (Expr, Any) - deferPass = fmap (second fst) . runWriterT . f where - f :: Expr -> WriterT (Any, [(Ident, InstanceContext, SourceConstraint)]) (StateT InstanceContext m) Expr - (_, f, _) = everywhereOnValuesTopDownM return (go True) return + deferPass = fmap (second fst) . runWriterT . f + where + f :: Expr -> WriterT (Any, [(Ident, InstanceContext, SourceConstraint)]) (StateT InstanceContext m) Expr + (_, f, _) = everywhereOnValuesTopDownM return (go True) return -- This pass generalizes any remaining constraints generalizePass :: Expr -> StateT InstanceContext m (Expr, [(Ident, InstanceContext, SourceConstraint)]) - generalizePass = fmap (second snd) . runWriterT . f where - f :: Expr -> WriterT (Any, [(Ident, InstanceContext, SourceConstraint)]) (StateT InstanceContext m) Expr - (_, f, _) = everywhereOnValuesTopDownM return (go False) return + generalizePass = fmap (second snd) . runWriterT . f + where + f :: Expr -> WriterT (Any, [(Ident, InstanceContext, SourceConstraint)]) (StateT InstanceContext m) Expr + (_, f, _) = everywhereOnValuesTopDownM return (go False) return go :: Bool -> Expr -> WriterT (Any, [(Ident, InstanceContext, SourceConstraint)]) (StateT InstanceContext m) Expr go deferErrors (TypeClassDictionary constraint context hints) = @@ -144,19 +159,19 @@ replaceTypeClassDictionaries shouldGeneralize expr = flip evalStateT M.empty $ d -- | Three options for how we can handle a constraint, depending on the mode we're in. data EntailsResult a - = Solved a TypeClassDict - -- ^ We solved this constraint - | Unsolved SourceConstraint - -- ^ We couldn't solve this constraint right now, it will be generalized - | Deferred - -- ^ We couldn't solve this constraint right now, so it has been deferred - deriving Show + = -- | We solved this constraint + Solved a TypeClassDict + | -- | We couldn't solve this constraint right now, it will be generalized + Unsolved SourceConstraint + | -- | We couldn't solve this constraint right now, so it has been deferred + Deferred + deriving (Show) -- | Options for the constraint solver data SolverOptions = SolverOptions { solverShouldGeneralize :: Bool -- ^ Should the solver be allowed to generalize over unsolved constraints? - , solverDeferErrors :: Bool + , solverDeferErrors :: Bool -- ^ Should the solver be allowed to defer errors by skipping constraints? } @@ -166,36 +181,37 @@ data Matched t | Unknown deriving (Eq, Show, Functor) -instance Semigroup t => Semigroup (Matched t) where +instance (Semigroup t) => Semigroup (Matched t) where (Match l) <> (Match r) = Match (l <> r) - Apart <> _ = Apart - _ <> Apart = Apart - _ <> _ = Unknown + Apart <> _ = Apart + _ <> Apart = Apart + _ <> _ = Unknown -instance Monoid t => Monoid (Matched t) where +instance (Monoid t) => Monoid (Matched t) where mempty = Match mempty --- | Check that the current set of type class dictionaries entail the specified type class goal, and, if so, --- return a type class dictionary reference. -entails - :: forall m - . (MonadState CheckState m, MonadError MultipleErrors m, MonadWriter MultipleErrors m, MonadSupply m) - => SolverOptions - -- ^ Solver options - -> SourceConstraint - -- ^ The constraint to solve - -> InstanceContext - -- ^ The contexts in which to solve the constraint - -> [ErrorMessageHint] - -- ^ Error message hints to apply to any instance errors - -> WriterT (Any, [(Ident, InstanceContext, SourceConstraint)]) (StateT InstanceContext m) Expr -entails SolverOptions{..} constraint context hints = +{- | Check that the current set of type class dictionaries entail the specified type class goal, and, if so, +return a type class dictionary reference. +-} +entails :: + forall m. + (MonadState CheckState m, MonadError MultipleErrors m, MonadWriter MultipleErrors m, MonadSupply m) => + -- | Solver options + SolverOptions -> + -- | The constraint to solve + SourceConstraint -> + -- | The contexts in which to solve the constraint + InstanceContext -> + -- | Error message hints to apply to any instance errors + [ErrorMessageHint] -> + WriterT (Any, [(Ident, InstanceContext, SourceConstraint)]) (StateT InstanceContext m) Expr +entails SolverOptions {..} constraint context hints = overConstraintArgsAll (lift . lift . traverse replaceAllTypeSynonyms) constraint >>= solve where forClassNameM :: Environment -> InstanceContext -> Qualified (ProperName 'ClassName) -> [SourceType] -> [SourceType] -> m [TypeClassDict] forClassNameM env ctx cn@C.Coercible kinds args = - fromMaybe (forClassName env ctx cn kinds args) <$> - solveCoercible env ctx kinds args + fromMaybe (forClassName env ctx cn kinds args) + <$> solveCoercible env ctx kinds args forClassNameM env ctx cn kinds args = pure $ forClassName env ctx cn kinds args @@ -232,99 +248,110 @@ entails SolverOptions{..} constraint context hints = valUndefined :: Expr valUndefined = Var nullSourceSpan C.I_undefined + typedEmptyRecord :: Expr + typedEmptyRecord = TypedValue False (Literal nullSourceSpan $ ObjectLiteral []) (mkRecordT $ REmpty nullSourceAnn) + solve :: SourceConstraint -> WriterT (Any, [(Ident, InstanceContext, SourceConstraint)]) (StateT InstanceContext m) Expr solve = go 0 hints where go :: Int -> [ErrorMessageHint] -> SourceConstraint -> WriterT (Any, [(Ident, InstanceContext, SourceConstraint)]) (StateT InstanceContext m) Expr go work _ (Constraint _ className' _ tys' _) | work > 1000 = throwError . errorMessage $ PossiblyInfiniteInstance className' tys' go work hints' con@(Constraint _ className' kinds' tys' conInfo) = WriterT . StateT . (withErrorMessageHint (ErrorSolvingConstraint con) .) . runStateT . runWriterT $ do - -- We might have unified types by solving other constraints, so we need to - -- apply the latest substitution. - latestSubst <- lift . lift $ gets checkSubstitution - let kinds'' = map (substituteType latestSubst) kinds' - tys'' = map (substituteType latestSubst) tys' - - -- Get the inferred constraint context so far, and merge it with the global context - inferred <- lift get - -- We need information about functional dependencies, so we have to look up the class - -- name in the environment: - env <- lift . lift $ gets checkEnv - let classesInScope = typeClasses env - TypeClassData - { typeClassArguments - , typeClassDependencies - , typeClassIsEmpty - , typeClassCoveringSets - , typeClassMembers - } <- case M.lookup className' classesInScope of - Nothing -> throwError . errorMessage $ UnknownClass className' - Just tcd -> pure tcd - - dicts <- lift . lift $ forClassNameM env (combineContexts context inferred) className' kinds'' tys'' - - let (catMaybes -> ambiguous, instances) = partitionEithers $ do - chain :: NonEmpty TypeClassDict <- - NEL.groupBy ((==) `on` tcdChain) $ - sortOn (tcdChain &&& tcdIndex) - dicts - -- process instances in a chain in index order - let found = for (tails1 chain) $ \(tcd :| tl) -> - -- Make sure the type unifies with the type in the type instance definition - case matches typeClassDependencies tcd tys'' of - Apart -> Right () -- keep searching - Match substs -> Left (Right (substs, tcd)) -- found a match - Unknown -> - if null (tcdChain tcd) || null tl - then Right () -- need proof of apartness but this is either not in a chain or at the end - else Left (Left (tcdToInstanceDescription tcd)) -- can't continue with this chain yet, need proof of apartness - - lefts [found] - solution <- lift . lift - $ unique kinds'' tys'' ambiguous instances - $ unknownsInAllCoveringSets (fst . (typeClassArguments !!)) typeClassMembers tys'' typeClassCoveringSets - case solution of - Solved substs tcd -> do - -- Note that we solved something. - tell (Any True, mempty) - -- Make sure the substitution is valid: - lift . lift . for_ substs $ pairwiseM unifyTypes - -- Now enforce any functional dependencies, using unification - -- Note: we need to generate fresh types for any unconstrained - -- type variables before unifying. - let subst = fmap head substs - currentSubst <- lift . lift $ gets checkSubstitution - subst' <- lift . lift $ withFreshTypes tcd (fmap (substituteType currentSubst) subst) - lift . lift $ zipWithM_ (\t1 t2 -> do - let inferredType = replaceAllTypeVars (M.toList subst') t1 - unifyTypes inferredType t2) (tcdInstanceTypes tcd) tys'' - currentSubst' <- lift . lift $ gets checkSubstitution - let subst'' = fmap (substituteType currentSubst') subst' - -- Solve any necessary subgoals - args <- solveSubgoals subst'' (ErrorSolvingConstraint con) (tcdDependencies tcd) - - initDict <- lift . lift $ mkDictionary (tcdValue tcd) args - - let match = foldr (\(className, index) dict -> subclassDictionaryValue dict className index) - initDict - (tcdPath tcd) - - return (if typeClassIsEmpty then Unused match else match) - Unsolved unsolved -> do - -- Generate a fresh name for the unsolved constraint's new dictionary - ident <- freshIdent ("dict" <> runProperName (disqualify (constraintClass unsolved))) - let qident = Qualified ByNullSourcePos ident - -- Store the new dictionary in the InstanceContext so that we can solve this goal in - -- future. - newDicts <- lift . lift $ newDictionaries [] qident unsolved - let newContext = mkContext newDicts - modify (combineContexts newContext) - -- Mark this constraint for generalization - tell (mempty, [(ident, context, unsolved)]) - return (Var nullSourceSpan qident) - Deferred -> - -- Constraint was deferred, just return the dictionary unchanged, - -- with no unsolved constraints. Hopefully, we can solve this later. - return (TypeClassDictionary (srcConstraint className' kinds'' tys'' conInfo) context hints') + -- We might have unified types by solving other constraints, so we need to + -- apply the latest substitution. + latestSubst <- lift . lift $ gets checkSubstitution + let kinds'' = map (substituteType latestSubst) kinds' + tys'' = map (substituteType latestSubst) tys' + + -- Get the inferred constraint context so far, and merge it with the global context + inferred <- lift get + -- We need information about functional dependencies, so we have to look up the class + -- name in the environment: + env <- lift . lift $ gets checkEnv + let classesInScope = typeClasses env + TypeClassData + { typeClassArguments + , typeClassDependencies + , typeClassIsEmpty + , typeClassCoveringSets + , typeClassMembers + } <- case M.lookup className' classesInScope of + Nothing -> throwError . errorMessage $ UnknownClass className' + Just tcd -> pure tcd + + dicts <- lift . lift $ forClassNameM env (combineContexts context inferred) className' kinds'' tys'' + + let (catMaybes -> ambiguous, instances) = partitionEithers $ do + chain :: NonEmpty TypeClassDict <- + NEL.groupBy ((==) `on` tcdChain) $ + sortOn + (tcdChain &&& tcdIndex) + dicts + -- process instances in a chain in index order + let found = for (tails1 chain) $ \(tcd :| tl) -> + -- Make sure the type unifies with the type in the type instance definition + case matches typeClassDependencies tcd tys'' of + Apart -> Right () -- keep searching + Match substs -> Left (Right (substs, tcd)) -- found a match + Unknown -> + if null (tcdChain tcd) || null tl + then Right () -- need proof of apartness but this is either not in a chain or at the end + else Left (Left (tcdToInstanceDescription tcd)) -- can't continue with this chain yet, need proof of apartness + lefts [found] + solution <- + lift . lift $ + unique kinds'' tys'' ambiguous instances $ + unknownsInAllCoveringSets (fst . (typeClassArguments !!)) typeClassMembers tys'' typeClassCoveringSets + case solution of + Solved substs tcd -> do + -- Note that we solved something. + tell (Any True, mempty) + -- Make sure the substitution is valid: + lift . lift . for_ substs $ pairwiseM unifyTypes + -- Now enforce any functional dependencies, using unification + -- Note: we need to generate fresh types for any unconstrained + -- type variables before unifying. + let subst = fmap head substs + currentSubst <- lift . lift $ gets checkSubstitution + subst' <- lift . lift $ withFreshTypes tcd (fmap (substituteType currentSubst) subst) + lift . lift $ + zipWithM_ + ( \t1 t2 -> do + let inferredType = replaceAllTypeVars (M.toList subst') t1 + unifyTypes inferredType t2 + ) + (tcdInstanceTypes tcd) + tys'' + currentSubst' <- lift . lift $ gets checkSubstitution + let subst'' = fmap (substituteType currentSubst') subst' + -- Solve any necessary subgoals + args <- solveSubgoals subst'' (ErrorSolvingConstraint con) (tcdDependencies tcd) + + initDict <- lift . lift $ mkDictionary (tcdValue tcd) args + + let match = + foldr + (\(className, index) dict -> subclassDictionaryValue dict className index) + initDict + (tcdPath tcd) + + return (if typeClassIsEmpty then Unused match else match) + Unsolved unsolved -> do + -- Generate a fresh name for the unsolved constraint's new dictionary + ident <- freshIdent ("dict" <> runProperName (disqualify (constraintClass unsolved))) + let qident = Qualified ByNullSourcePos ident + -- Store the new dictionary in the InstanceContext so that we can solve this goal in + -- future. + newDicts <- lift . lift $ newDictionaries [] qident unsolved + let newContext = mkContext newDicts + modify (combineContexts newContext) + -- Mark this constraint for generalization + tell (mempty, [(ident, context, unsolved)]) + return (Var nullSourceSpan qident) + Deferred -> + -- Constraint was deferred, just return the dictionary unchanged, + -- with no unsolved constraints. Hopefully, we can solve this later. + return (TypeClassDictionary (srcConstraint className' kinds'' tys'' conInfo) context hints') where -- When checking functional dependencies, we need to use unification to make -- sure it is safe to use the selected instance. We will unify the solved type with @@ -338,14 +365,14 @@ entails SolverOptions{..} constraint context hints = -- fresh type variables. This function extends a substitution with fresh type variables -- as necessary, based on the types in the instance head. It also unifies kinds based on -- the substitution so kind information propagates correctly through the solver. - withFreshTypes - :: TypeClassDict - -> Matching SourceType - -> m (Matching SourceType) - withFreshTypes TypeClassDictionaryInScope{..} initSubst = do - subst <- foldM withFreshType initSubst $ filter (flip M.notMember initSubst . fst) tcdForAll - for_ (M.toList initSubst) $ unifySubstKind subst - pure subst + withFreshTypes :: + TypeClassDict -> + Matching SourceType -> + m (Matching SourceType) + withFreshTypes TypeClassDictionaryInScope {..} initSubst = do + subst <- foldM withFreshType initSubst $ filter (flip M.notMember initSubst . fst) tcdForAll + for_ (M.toList initSubst) $ unifySubstKind subst + pure subst where withFreshType subst (var, kind) = do ty <- freshTypeWithKind $ replaceAllTypeVars (M.toList subst) kind @@ -374,14 +401,14 @@ entails SolverOptions{..} constraint context hints = | otherwise = return $ uncurry Solved (minimumBy (compare `on` length . tcdPath . snd) tcds) tcdToInstanceDescription :: TypeClassDict -> Maybe (Qualified (Either SourceType Ident)) - tcdToInstanceDescription TypeClassDictionaryInScope{ tcdDescription, tcdValue } = + tcdToInstanceDescription TypeClassDictionaryInScope {tcdDescription, tcdValue} = let nii = namedInstanceIdentifier tcdValue - in case tcdDescription of - Just ty -> flip Qualified (Left ty) <$> fmap (byMaybeModuleName . getQual) nii - Nothing -> fmap Right <$> nii + in case tcdDescription of + Just ty -> flip Qualified (Left ty) <$> fmap (byMaybeModuleName . getQual) nii + Nothing -> fmap Right <$> nii canBeGeneralized :: Type a -> Bool - canBeGeneralized TUnknown{} = True + canBeGeneralized TUnknown {} = True canBeGeneralized (KindedType _ t _) = canBeGeneralized t canBeGeneralized _ = False @@ -390,10 +417,10 @@ entails SolverOptions{..} constraint context hints = -- Dictionaries which are subclass dictionaries cannot overlap, since otherwise the overlap would have -- been caught when constructing superclass dictionaries. overlapping :: TypeClassDict -> TypeClassDict -> Bool - overlapping TypeClassDictionaryInScope{ tcdPath = _ : _ } _ = False - overlapping _ TypeClassDictionaryInScope{ tcdPath = _ : _ } = False - overlapping TypeClassDictionaryInScope{ tcdDependencies = Nothing } _ = False - overlapping _ TypeClassDictionaryInScope{ tcdDependencies = Nothing } = False + overlapping TypeClassDictionaryInScope {tcdPath = _ : _} _ = False + overlapping _ TypeClassDictionaryInScope {tcdPath = _ : _} = False + overlapping TypeClassDictionaryInScope {tcdDependencies = Nothing} _ = False + overlapping _ TypeClassDictionaryInScope {tcdDependencies = Nothing} = False overlapping tcd1 tcd2 = tcdValue tcd1 /= tcdValue tcd2 -- Create dictionaries for subgoals which still need to be solved by calling go recursively @@ -420,19 +447,18 @@ entails SolverOptions{..} constraint context hints = -- So pass an empty placeholder (undefined) instead. return (useEmptyDict args) mkDictionary (IsSymbolInstance sym) _ = - let fields = [ ("reflectSymbol", Abs (VarBinder nullSourceSpan UnusedIdent) (Literal nullSourceSpan (StringLiteral sym))) ] in - return $ App (Constructor nullSourceSpan (coerceProperName . dictTypeName <$> C.IsSymbol)) (Literal nullSourceSpan (ObjectLiteral fields)) + let fields = [("reflectSymbol", Abs (VarBinder nullSourceSpan UnusedIdent) (Literal nullSourceSpan (StringLiteral sym)))] + in return $ App (Constructor nullSourceSpan (coerceProperName . dictTypeName <$> C.IsSymbol)) (Literal nullSourceSpan (ObjectLiteral fields)) mkDictionary (ReflectableInstance ref) _ = - let fields = [ ("reflectType", Abs (VarBinder nullSourceSpan UnusedIdent) (asExpression ref)) ] in - pure $ App (Constructor nullSourceSpan (coerceProperName . dictTypeName <$> C.Reflectable)) (Literal nullSourceSpan (ObjectLiteral fields)) + let fields = [("reflectType", Abs (VarBinder nullSourceSpan UnusedIdent) (asExpression ref))] + in pure $ App (Constructor nullSourceSpan (coerceProperName . dictTypeName <$> C.Reflectable)) (Literal nullSourceSpan (ObjectLiteral fields)) unknownsInAllCoveringSets :: (Int -> Text) -> [(Ident, SourceType, Maybe (S.Set (NEL.NonEmpty Int)))] -> [SourceType] -> S.Set (S.Set Int) -> UnknownsHint unknownsInAllCoveringSets indexToArgText tyClassMembers tyArgs coveringSets = do let unkIndices = findIndices containsUnknowns tyArgs - if all (\s -> any (`S.member` s) unkIndices) coveringSets then - fromMaybe Unknowns unknownsRequiringVtas - else - NoUnknowns + if all (\s -> any (`S.member` s) unkIndices) coveringSets + then fromMaybe Unknowns unknownsRequiringVtas + else NoUnknowns where unknownsRequiringVtas = do tyClassModuleName <- getQual className' @@ -441,8 +467,9 @@ entails SolverOptions{..} constraint context hints = tyClassMemberVta = M.fromList $ mapMaybe qualifyAndFilter tyClassMembers where -- Only keep type class members that need VTAs to resolve their type class instances - qualifyAndFilter (ident, _, mbVtaRequiredArgs) = mbVtaRequiredArgs <&> \vtaRequiredArgs -> - (Qualified (ByModuleName tyClassModuleName) ident, map (map indexToArgText . NEL.toList) $ S.toList vtaRequiredArgs) + qualifyAndFilter (ident, _, mbVtaRequiredArgs) = + mbVtaRequiredArgs <&> \vtaRequiredArgs -> + (Qualified (ByModuleName tyClassModuleName) ident, map (map indexToArgText . NEL.toList) $ S.toList vtaRequiredArgs) tyClassMembersInExpr :: Expr -> [(Qualified Ident, [[Text]])] tyClassMembersInExpr = getVars @@ -450,15 +477,16 @@ entails SolverOptions{..} constraint context hints = (_, getVars, _, _, _) = everythingOnValues (++) ignore getVarIdents ignore ignore ignore ignore = const [] getVarIdents = \case - Var _ ident | Just vtas <- M.lookup ident tyClassMemberVta -> - [(ident, vtas)] - _ -> + Var _ ident + | Just vtas <- M.lookup ident tyClassMemberVta -> + [(ident, vtas)] + _ -> [] getECTExpr = \case ErrorCheckingType expr _ -> Just expr _ -> Nothing - + tyClassMembers' <- headMay $ mapMaybe (fmap tyClassMembersInExpr . getECTExpr) hints membersWithVtas <- NEL.nonEmpty tyClassMembers' pure $ UnknownsWithVtaRequiringArgs membersWithVtas @@ -466,18 +494,20 @@ entails SolverOptions{..} constraint context hints = -- Turn a DictionaryValue into a Expr subclassDictionaryValue :: Expr -> Qualified (ProperName 'ClassName) -> Integer -> Expr subclassDictionaryValue dict className index = - App (Accessor (mkString (superclassName className index)) dict) valUndefined - + App (Accessor (mkString (superclassName className index)) dict) typedEmptyRecord -- valUndefined solveCoercible :: Environment -> InstanceContext -> [SourceType] -> [SourceType] -> m (Maybe [TypeClassDict]) solveCoercible env ctx kinds [a, b] = do let coercibleDictsInScope = findDicts ctx C.Coercible ByNullSourcePos givens = flip mapMaybe coercibleDictsInScope $ \case - dict | [a', b'] <- tcdInstanceTypes dict -> Just (a', b') - | otherwise -> Nothing - GivenSolverState{ inertGivens } <- execStateT (solveGivens env) $ - initialGivenSolverState givens - (WantedSolverState{ inertWanteds }, hints') <- runWriterT . execStateT (solveWanteds env) $ - initialWantedSolverState inertGivens a b + dict + | [a', b'] <- tcdInstanceTypes dict -> Just (a', b') + | otherwise -> Nothing + GivenSolverState {inertGivens} <- + execStateT (solveGivens env) $ + initialGivenSolverState givens + (WantedSolverState {inertWanteds}, hints') <- + runWriterT . execStateT (solveWanteds env) $ + initialWantedSolverState inertGivens a b -- Solving fails when there's irreducible wanteds left. -- -- We report the first residual constraint instead of the initial wanted, @@ -498,11 +528,11 @@ entails SolverOptions{..} constraint context hints = solveSymbolCompare :: [SourceType] -> Maybe [TypeClassDict] solveSymbolCompare [arg0@(TypeLevelString _ lhs), arg1@(TypeLevelString _ rhs), _] = let ordering = case compare lhs rhs of - LT -> C.LT - EQ -> C.EQ - GT -> C.GT + LT -> C.LT + EQ -> C.EQ + GT -> C.GT args' = [arg0, arg1, srcTypeConstructor ordering] - in Just [TypeClassDictionaryInScope Nothing 0 EmptyClassInstance [] C.SymbolCompare [] [] args' Nothing Nothing] + in Just [TypeClassDictionaryInScope Nothing 0 EmptyClassInstance [] C.SymbolCompare [] [] args' Nothing Nothing] solveSymbolCompare _ = Nothing solveSymbolAppend :: [SourceType] -> Maybe [TypeClassDict] @@ -538,7 +568,8 @@ entails SolverOptions{..} constraint context hints = consSymbol _ _ arg@(TypeLevelString _ s) = do (h, t) <- T.uncons =<< decodeString s pure (mkTLString (T.singleton h), mkTLString t, arg) - where mkTLString = srcTypeLevelString . mkString + where + mkTLString = srcTypeLevelString . mkString consSymbol arg1@(TypeLevelString _ h) arg2@(TypeLevelString _ t) _ = do h' <- decodeString h t' <- decodeString t @@ -587,7 +618,7 @@ entails SolverOptions{..} constraint context hints = addInts arg0@(TypeLevelInt _ l) _ arg2@(TypeLevelInt _ o) = pure (arg0, srcTypeLevelInt (o - l), arg2) -- r o -> l, o - r = l addInts _ arg1@(TypeLevelInt _ r) arg2@(TypeLevelInt _ o) = pure (srcTypeLevelInt (o - r), arg1, arg2) - addInts _ _ _ = Nothing + addInts _ _ _ = Nothing solveIntCompare :: InstanceContext -> [SourceType] -> Maybe [TypeClassDict] solveIntCompare _ [arg0@(TypeLevelInt _ a), arg1@(TypeLevelInt _ b), _] = @@ -596,12 +627,13 @@ entails SolverOptions{..} constraint context hints = LT -> C.LT GT -> C.GT args' = [arg0, arg1, srcTypeConstructor ordering] - in pure [TypeClassDictionaryInScope Nothing 0 EmptyClassInstance [] C.IntCompare [] [] args' Nothing Nothing] + in pure [TypeClassDictionaryInScope Nothing 0 EmptyClassInstance [] C.IntCompare [] [] args' Nothing Nothing] solveIntCompare ctx args@[a, b, _] = do let compareDictsInScope = findDicts ctx C.IntCompare ByNullSourcePos givens = flip mapMaybe compareDictsInScope $ \case - dict | [a', b', c'] <- tcdInstanceTypes dict -> mkRelation a' b' c' - | otherwise -> Nothing + dict + | [a', b', c'] <- tcdInstanceTypes dict -> mkRelation a' b' c' + | otherwise -> Nothing facts = mkFacts (args : (tcdInstanceTypes <$> compareDictsInScope)) c' <- solveRelation (givens <> facts) a b pure [TypeClassDictionaryInScope Nothing 0 EmptyClassInstance [] C.IntCompare [] [] [a, b, srcTypeConstructor c'] Nothing Nothing] @@ -610,24 +642,24 @@ entails SolverOptions{..} constraint context hints = solveIntMul :: [SourceType] -> Maybe [TypeClassDict] solveIntMul [arg0@(TypeLevelInt _ l), arg1@(TypeLevelInt _ r), _] = let args' = [arg0, arg1, srcTypeLevelInt (l * r)] - in pure [TypeClassDictionaryInScope Nothing 0 EmptyClassInstance [] C.IntMul [] [] args' Nothing Nothing] + in pure [TypeClassDictionaryInScope Nothing 0 EmptyClassInstance [] C.IntMul [] [] args' Nothing Nothing] solveIntMul _ = Nothing solveUnion :: [SourceType] -> [SourceType] -> Maybe [TypeClassDict] solveUnion kinds [l, r, u] = do (lOut, rOut, uOut, cst, vars) <- unionRows kinds l r u - pure [ TypeClassDictionaryInScope Nothing 0 EmptyClassInstance [] C.RowUnion vars kinds [lOut, rOut, uOut] cst Nothing ] + pure [TypeClassDictionaryInScope Nothing 0 EmptyClassInstance [] C.RowUnion vars kinds [lOut, rOut, uOut] cst Nothing] solveUnion _ _ = Nothing -- Left biased union of two row types unionRows :: [SourceType] -> SourceType -> SourceType -> SourceType -> Maybe (SourceType, SourceType, SourceType, Maybe [SourceConstraint], [(Text, SourceType)]) unionRows kinds l r u = - guard canMakeProgress $> (lOut, rOut, uOut, cons, vars) + guard canMakeProgress $> (lOut, rOut, uOut, cons, vars) where (fixed, rest) = rowToList l - rowVar = srcTypeVar "r" + rowVar = srcTypeVar "r" (kindRow kindType) (canMakeProgress, lOut, rOut, uOut, cons, vars) = case rest of @@ -637,86 +669,93 @@ entails SolverOptions{..} constraint context hints = -- If the right hand side and output are closed rows, then we can -- compute the left hand side by subtracting the right hand side -- from the output. - _ | (right, rightu@(REmptyKinded _ _)) <- rowToList r + _ + | (right, rightu@(REmptyKinded _ _)) <- rowToList r , (output, restu@(REmptyKinded _ _)) <- rowToList u -> - let - -- Partition the output rows into those that belong in right - -- (taken off the end) and those that must end up in left. - grabLabel e (left', right', remaining) - | rowListLabel e `elem` remaining = - (left', e : right', delete (rowListLabel e) remaining) - | otherwise = - (e : left', right', remaining) - (outL, outR, leftover) = - foldr grabLabel ([], [], fmap rowListLabel right) output - in ( null leftover - , rowFromList (outL, restu) - , rowFromList (outR, rightu) - , u - , Nothing - , [] - ) + let + -- Partition the output rows into those that belong in right + -- (taken off the end) and those that must end up in left. + grabLabel e (left', right', remaining) + | rowListLabel e `elem` remaining = + (left', e : right', delete (rowListLabel e) remaining) + | otherwise = + (e : left', right', remaining) + (outL, outR, leftover) = + foldr grabLabel ([], [], fmap rowListLabel right) output + in + ( null leftover + , rowFromList (outL, restu) + , rowFromList (outR, rightu) + , u + , Nothing + , [] + ) -- If the left hand side is not definitely closed, then the only way we -- can safely make progress is to move any known labels from the left -- input into the output, and add a constraint for any remaining labels. -- Otherwise, the left hand tail might contain the same labels as on -- the right hand side, and we can't be certain we won't reorder the -- types for such labels. - _ -> ( not (null fixed) - , l, r - , rowFromList (fixed, rowVar) - , Just [ srcConstraint C.RowUnion kinds [rest, r, rowVar] Nothing ] - , [("r", kindRow (head kinds))] - ) + _ -> + ( not (null fixed) + , l + , r + , rowFromList (fixed, rowVar) + , Just [srcConstraint C.RowUnion kinds [rest, r, rowVar] Nothing] + , [("r", kindRow (head kinds))] + ) solveRowCons :: [SourceType] -> [SourceType] -> Maybe [TypeClassDict] solveRowCons kinds [TypeLevelString ann sym, ty, r, _] = - Just [ TypeClassDictionaryInScope Nothing 0 EmptyClassInstance [] C.RowCons [] kinds [TypeLevelString ann sym, ty, r, srcRCons (Label sym) ty r] Nothing Nothing ] + Just [TypeClassDictionaryInScope Nothing 0 EmptyClassInstance [] C.RowCons [] kinds [TypeLevelString ann sym, ty, r, srcRCons (Label sym) ty r] Nothing Nothing] solveRowCons _ _ = Nothing solveRowToList :: [SourceType] -> [SourceType] -> Maybe [TypeClassDict] solveRowToList [kind] [r, _] = do entries <- rowToRowList kind r - pure [ TypeClassDictionaryInScope Nothing 0 EmptyClassInstance [] C.RowToList [] [kind] [r, entries] Nothing Nothing ] + pure [TypeClassDictionaryInScope Nothing 0 EmptyClassInstance [] C.RowToList [] [kind] [r, entries] Nothing Nothing] solveRowToList _ _ = Nothing -- Convert a closed row to a sorted list of entries rowToRowList :: SourceType -> SourceType -> Maybe SourceType rowToRowList kind r = - guard (isREmpty rest) $> - foldr rowListCons (srcKindApp (srcTypeConstructor C.RowListNil) kind) fixed + guard (isREmpty rest) + $> foldr rowListCons (srcKindApp (srcTypeConstructor C.RowListNil) kind) fixed where (fixed, rest) = rowToSortedList r rowListCons (RowListItem _ lbl ty) tl = - foldl srcTypeApp (srcKindApp (srcTypeConstructor C.RowListCons) kind) + foldl + srcTypeApp + (srcKindApp (srcTypeConstructor C.RowListCons) kind) [ srcTypeLevelString (runLabel lbl) , ty - , tl ] + , tl + ] solveNub :: [SourceType] -> [SourceType] -> Maybe [TypeClassDict] solveNub kinds [r, _] = do r' <- nubRows r - pure [ TypeClassDictionaryInScope Nothing 0 EmptyClassInstance [] C.RowNub [] kinds [r, r'] Nothing Nothing ] + pure [TypeClassDictionaryInScope Nothing 0 EmptyClassInstance [] C.RowNub [] kinds [r, r'] Nothing Nothing] solveNub _ _ = Nothing nubRows :: SourceType -> Maybe SourceType nubRows r = - guard (isREmpty rest) $> - rowFromList (nubBy ((==) `on` rowListLabel) fixed, rest) + guard (isREmpty rest) + $> rowFromList (nubBy ((==) `on` rowListLabel) fixed, rest) where (fixed, rest) = rowToSortedList r solveLacks :: [SourceType] -> [SourceType] -> Maybe [TypeClassDict] solveLacks kinds tys@[_, REmptyKinded _ _] = - pure [ TypeClassDictionaryInScope Nothing 0 EmptyClassInstance [] C.RowLacks [] kinds tys Nothing Nothing ] + pure [TypeClassDictionaryInScope Nothing 0 EmptyClassInstance [] C.RowLacks [] kinds tys Nothing Nothing] solveLacks kinds [TypeLevelString ann sym, r] = do (r', cst) <- rowLacks kinds sym r - pure [ TypeClassDictionaryInScope Nothing 0 EmptyClassInstance [] C.RowLacks [] kinds [TypeLevelString ann sym, r'] cst Nothing ] + pure [TypeClassDictionaryInScope Nothing 0 EmptyClassInstance [] C.RowLacks [] kinds [TypeLevelString ann sym, r'] cst Nothing] solveLacks _ _ = Nothing rowLacks :: [SourceType] -> PSString -> SourceType -> Maybe (SourceType, Maybe [SourceConstraint]) rowLacks kinds sym r = - guard (lacksSym && canMakeProgress) $> (r, cst) + guard (lacksSym && canMakeProgress) $> (r, cst) where (fixed, rest) = rowToList r @@ -724,46 +763,49 @@ entails SolverOptions{..} constraint context hints = sym `notElem` (runLabel . rowListLabel <$> fixed) (canMakeProgress, cst) = case rest of - REmptyKinded _ _ -> (True, Nothing) - _ -> (not (null fixed), Just [ srcConstraint C.RowLacks kinds [srcTypeLevelString sym, rest] Nothing ]) + REmptyKinded _ _ -> (True, Nothing) + _ -> (not (null fixed), Just [srcConstraint C.RowLacks kinds [srcTypeLevelString sym, rest] Nothing]) -- Check if an instance matches our list of types, allowing for types -- to be solved via functional dependencies. If the types match, we return a -- substitution which makes them match. If not, we return 'Nothing'. matches :: [FunctionalDependency] -> TypeClassDict -> [SourceType] -> Matched (Matching [SourceType]) -matches deps TypeClassDictionaryInScope{..} tys = - -- First, find those types which match exactly - let matched = zipWith typeHeadsAreEqual tys tcdInstanceTypes in - -- Now, use any functional dependencies to infer any remaining types - if not (covers matched) - then if any ((==) Apart . fst) matched then Apart else Unknown - else -- Verify that any repeated type variables are unifiable - let determinedSet = foldMap (S.fromList . fdDetermined) deps - solved = map snd . filter ((`S.notMember` determinedSet) . fst) $ zipWith (\(_, ts) i -> (i, ts)) matched [0..] - in verifySubstitution (M.unionsWith (++) solved) +matches deps TypeClassDictionaryInScope {..} tys = + -- First, find those types which match exactly + let matched = zipWith typeHeadsAreEqual tys tcdInstanceTypes + in -- Now, use any functional dependencies to infer any remaining types + if not (covers matched) + then if any ((==) Apart . fst) matched then Apart else Unknown + else -- Verify that any repeated type variables are unifiable + + let determinedSet = foldMap (S.fromList . fdDetermined) deps + solved = map snd . filter ((`S.notMember` determinedSet) . fst) $ zipWith (\(_, ts) i -> (i, ts)) matched [0 ..] + in verifySubstitution (M.unionsWith (++) solved) where -- Find the closure of a set of functional dependencies. covers :: [(Matched (), subst)] -> Bool - covers ms = finalSet == S.fromList [0..length ms - 1] + covers ms = finalSet == S.fromList [0 .. length ms - 1] where initialSet :: S.Set Int - initialSet = S.fromList . map snd . filter ((==) (Match ()) . fst . fst) $ zip ms [0..] + initialSet = S.fromList . map snd . filter ((==) (Match ()) . fst . fst) $ zip ms [0 ..] finalSet :: S.Set Int finalSet = untilFixedPoint applyAll initialSet - untilFixedPoint :: Eq a => (a -> a) -> a -> a + untilFixedPoint :: (Eq a) => (a -> a) -> a -> a untilFixedPoint f = go where - go a | a' == a = a' - | otherwise = go a' - where a' = f a + go a + | a' == a = a' + | otherwise = go a' + where + a' = f a applyAll :: S.Set Int -> S.Set Int applyAll s = foldr applyDependency s deps applyDependency :: FunctionalDependency -> S.Set Int -> S.Set Int - applyDependency FunctionalDependency{..} xs + applyDependency FunctionalDependency {..} xs | S.fromList fdDeterminers `S.isSubsetOf` xs = xs <> S.fromList fdDetermined | otherwise = xs @@ -772,37 +814,37 @@ matches deps TypeClassDictionaryInScope{..} tys = -- and return a substitution from type variables to types which makes the type heads unify. -- typeHeadsAreEqual :: Type a -> Type a -> (Matched (), Matching [Type a]) - typeHeadsAreEqual (KindedType _ t1 _) t2 = typeHeadsAreEqual t1 t2 - typeHeadsAreEqual t1 (KindedType _ t2 _) = typeHeadsAreEqual t1 t2 - typeHeadsAreEqual (TUnknown _ u1) (TUnknown _ u2) | u1 == u2 = (Match (), M.empty) - typeHeadsAreEqual (Skolem _ _ _ s1 _) (Skolem _ _ _ s2 _) | s1 == s2 = (Match (), M.empty) - typeHeadsAreEqual t (TypeVar _ v) = (Match (), M.singleton v [t]) + typeHeadsAreEqual (KindedType _ t1 _) t2 = typeHeadsAreEqual t1 t2 + typeHeadsAreEqual t1 (KindedType _ t2 _) = typeHeadsAreEqual t1 t2 + typeHeadsAreEqual (TUnknown _ u1) (TUnknown _ u2) | u1 == u2 = (Match (), M.empty) + typeHeadsAreEqual (Skolem _ _ _ s1 _) (Skolem _ _ _ s2 _) | s1 == s2 = (Match (), M.empty) + typeHeadsAreEqual t (TypeVar _ v _) = (Match (), M.singleton v [t]) typeHeadsAreEqual (TypeConstructor _ c1) (TypeConstructor _ c2) | c1 == c2 = (Match (), M.empty) typeHeadsAreEqual (TypeLevelString _ s1) (TypeLevelString _ s2) | s1 == s2 = (Match (), M.empty) - typeHeadsAreEqual (TypeLevelInt _ n1) (TypeLevelInt _ n2) | n1 == n2 = (Match (), M.empty) - typeHeadsAreEqual (TypeApp _ h1 t1) (TypeApp _ h2 t2) = + typeHeadsAreEqual (TypeLevelInt _ n1) (TypeLevelInt _ n2) | n1 == n2 = (Match (), M.empty) + typeHeadsAreEqual (TypeApp _ h1 t1) (TypeApp _ h2 t2) = both (typeHeadsAreEqual h1 h2) (typeHeadsAreEqual t1 t2) - typeHeadsAreEqual (KindApp _ h1 t1) (KindApp _ h2 t2) = + typeHeadsAreEqual (KindApp _ h1 t1) (KindApp _ h2 t2) = both (typeHeadsAreEqual h1 h2) (typeHeadsAreEqual t1 t2) typeHeadsAreEqual (REmpty _) (REmpty _) = (Match (), M.empty) - typeHeadsAreEqual r1@RCons{} r2@RCons{} = - foldr both (uncurry go rest) common + typeHeadsAreEqual r1@RCons {} r2@RCons {} = + foldr both (uncurry go rest) common where (common, rest) = alignRowsWith (const typeHeadsAreEqual) r1 r2 go :: ([RowListItem a], Type a) -> ([RowListItem a], Type a) -> (Matched (), Matching [Type a]) - go (l, KindedType _ t1 _) (r, t2) = go (l, t1) (r, t2) - go (l, t1) (r, KindedType _ t2 _) = go (l, t1) (r, t2) - go (l, KindApp _ t1 k1) (r, KindApp _ t2 k2) | eqType k1 k2 = go (l, t1) (r, t2) - go ([], REmpty _) ([], REmpty _) = (Match (), M.empty) - go ([], TUnknown _ u1) ([], TUnknown _ u2) | u1 == u2 = (Match (), M.empty) - go ([], TypeVar _ v1) ([], TypeVar _ v2) | v1 == v2 = (Match (), M.empty) - go ([], Skolem _ _ _ sk1 _) ([], Skolem _ _ _ sk2 _) | sk1 == sk2 = (Match (), M.empty) - go ([], TUnknown _ _) _ = (Unknown, M.empty) - go (sd, r) ([], TypeVar _ v) = (Match (), M.singleton v [rowFromList (sd, r)]) - go _ _ = (Apart, M.empty) + go (l, KindedType _ t1 _) (r, t2) = go (l, t1) (r, t2) + go (l, t1) (r, KindedType _ t2 _) = go (l, t1) (r, t2) + go (l, KindApp _ t1 k1) (r, KindApp _ t2 k2) | eqType k1 k2 = go (l, t1) (r, t2) + go ([], REmpty _) ([], REmpty _) = (Match (), M.empty) + go ([], TUnknown _ u1) ([], TUnknown _ u2) | u1 == u2 = (Match (), M.empty) + go ([], TypeVar _ v1 _) ([], TypeVar _ v2 _) | v1 == v2 = (Match (), M.empty) + go ([], Skolem _ _ _ sk1 _) ([], Skolem _ _ _ sk2 _) | sk1 == sk2 = (Match (), M.empty) + go ([], TUnknown _ _) _ = (Unknown, M.empty) + go (sd, r) ([], TypeVar _ v _) = (Match (), M.singleton v [rowFromList (sd, r)]) + go _ _ = (Apart, M.empty) typeHeadsAreEqual (TUnknown _ _) _ = (Unknown, M.empty) - typeHeadsAreEqual Skolem{} _ = (Unknown, M.empty) + typeHeadsAreEqual Skolem {} _ = (Unknown, M.empty) typeHeadsAreEqual _ _ = (Apart, M.empty) both :: (Matched (), Matching [Type a]) -> (Matched (), Matching [Type a]) -> (Matched (), Matching [Type a]) @@ -810,85 +852,98 @@ matches deps TypeClassDictionaryInScope{..} tys = -- Ensure that a substitution is valid verifySubstitution :: Matching [Type a] -> Matched (Matching [Type a]) - verifySubstitution mts = foldMap meet mts $> mts where - meet = pairwiseAll typesAreEqual - - -- Note that unknowns are only allowed to unify if they came from a type - -- which was _not_ solved, i.e. one which was inferred by a functional - -- dependency. - typesAreEqual :: Type a -> Type a -> Matched () - typesAreEqual (KindedType _ t1 _) t2 = typesAreEqual t1 t2 - typesAreEqual t1 (KindedType _ t2 _) = typesAreEqual t1 t2 - typesAreEqual (TUnknown _ u1) (TUnknown _ u2) | u1 == u2 = Match () - typesAreEqual (TUnknown _ u1) t2 = if t2 `containsUnknown` u1 then Apart else Unknown - typesAreEqual t1 (TUnknown _ u2) = if t1 `containsUnknown` u2 then Apart else Unknown - typesAreEqual (Skolem _ _ _ s1 _) (Skolem _ _ _ s2 _) | s1 == s2 = Match () - typesAreEqual (Skolem _ _ _ s1 _) t2 = if t2 `containsSkolem` s1 then Apart else Unknown - typesAreEqual t1 (Skolem _ _ _ s2 _) = if t1 `containsSkolem` s2 then Apart else Unknown - typesAreEqual (TypeVar _ v1) (TypeVar _ v2) | v1 == v2 = Match () - typesAreEqual (TypeLevelString _ s1) (TypeLevelString _ s2) | s1 == s2 = Match () - typesAreEqual (TypeLevelInt _ n1) (TypeLevelInt _ n2) | n1 == n2 = Match () - typesAreEqual (TypeConstructor _ c1) (TypeConstructor _ c2) | c1 == c2 = Match () - typesAreEqual (TypeApp _ h1 t1) (TypeApp _ h2 t2) = typesAreEqual h1 h2 <> typesAreEqual t1 t2 - typesAreEqual (KindApp _ h1 t1) (KindApp _ h2 t2) = typesAreEqual h1 h2 <> typesAreEqual t1 t2 - typesAreEqual (REmpty _) (REmpty _) = Match () - typesAreEqual r1 r2 | isRCons r1 || isRCons r2 = - let (common, rest) = alignRowsWith (const typesAreEqual) r1 r2 - in fold common <> uncurry go rest - where - go :: ([RowListItem a], Type a) -> ([RowListItem a], Type a) -> Matched () - go (l, KindedType _ t1 _) (r, t2) = go (l, t1) (r, t2) - go (l, t1) (r, KindedType _ t2 _) = go (l, t1) (r, t2) - go ([], KindApp _ t1 k1) ([], KindApp _ t2 k2) = typesAreEqual t1 t2 <> typesAreEqual k1 k2 - go ([], TUnknown _ u1) ([], TUnknown _ u2) | u1 == u2 = Match () - go ([], TUnknown _ _) ([], _) = Unknown - go ([], _) ([], TUnknown _ _) = Unknown - go ([], Skolem _ _ _ s1 _) ([], Skolem _ _ _ s2 _) | s1 == s2 = Match () - go ([], Skolem _ _ _ _ _) _ = Unknown - go _ ([], Skolem _ _ _ _ _) = Unknown - go ([], REmpty _) ([], REmpty _) = Match () - go ([], TypeVar _ v1) ([], TypeVar _ v2) | v1 == v2 = Match () - go _ _ = Apart - typesAreEqual _ _ = Apart - - isRCons :: Type a -> Bool - isRCons RCons{} = True - isRCons _ = False - - containsSkolem :: Type a -> Int -> Bool - containsSkolem t s = everythingOnTypes (||) (\case Skolem _ _ _ s' _ -> s == s'; _ -> False) t - - containsUnknown :: Type a -> Int -> Bool - containsUnknown t u = everythingOnTypes (||) (\case TUnknown _ u' -> u == u'; _ -> False) t - --- | Add a dictionary for the constraint to the scope, and dictionaries --- for all implied superclass instances. -newDictionaries - :: MonadState CheckState m - => [(Qualified (ProperName 'ClassName), Integer)] - -> Qualified Ident - -> SourceConstraint - -> m [NamedDict] + verifySubstitution mts = foldMap meet mts $> mts + where + meet = pairwiseAll typesAreEqual + + -- Note that unknowns are only allowed to unify if they came from a type + -- which was _not_ solved, i.e. one which was inferred by a functional + -- dependency. + typesAreEqual :: Type a -> Type a -> Matched () + typesAreEqual (KindedType _ t1 _) t2 = typesAreEqual t1 t2 + typesAreEqual t1 (KindedType _ t2 _) = typesAreEqual t1 t2 + typesAreEqual (TUnknown _ u1) (TUnknown _ u2) | u1 == u2 = Match () + typesAreEqual (TUnknown _ u1) t2 = if t2 `containsUnknown` u1 then Apart else Unknown + typesAreEqual t1 (TUnknown _ u2) = if t1 `containsUnknown` u2 then Apart else Unknown + typesAreEqual (Skolem _ _ _ s1 _) (Skolem _ _ _ s2 _) | s1 == s2 = Match () + typesAreEqual (Skolem _ _ _ s1 _) t2 = if t2 `containsSkolem` s1 then Apart else Unknown + typesAreEqual t1 (Skolem _ _ _ s2 _) = if t1 `containsSkolem` s2 then Apart else Unknown + typesAreEqual (TypeVar _ v1 _) (TypeVar _ v2 _) | v1 == v2 = Match () + typesAreEqual (TypeLevelString _ s1) (TypeLevelString _ s2) | s1 == s2 = Match () + typesAreEqual (TypeLevelInt _ n1) (TypeLevelInt _ n2) | n1 == n2 = Match () + typesAreEqual (TypeConstructor _ c1) (TypeConstructor _ c2) | c1 == c2 = Match () + typesAreEqual (TypeApp _ h1 t1) (TypeApp _ h2 t2) = typesAreEqual h1 h2 <> typesAreEqual t1 t2 + typesAreEqual (KindApp _ h1 t1) (KindApp _ h2 t2) = typesAreEqual h1 h2 <> typesAreEqual t1 t2 + typesAreEqual (REmpty _) (REmpty _) = Match () + typesAreEqual r1 r2 + | isRCons r1 || isRCons r2 = + let (common, rest) = alignRowsWith (const typesAreEqual) r1 r2 + in fold common <> uncurry go rest + where + go :: ([RowListItem a], Type a) -> ([RowListItem a], Type a) -> Matched () + go (l, KindedType _ t1 _) (r, t2) = go (l, t1) (r, t2) + go (l, t1) (r, KindedType _ t2 _) = go (l, t1) (r, t2) + go ([], KindApp _ t1 k1) ([], KindApp _ t2 k2) = typesAreEqual t1 t2 <> typesAreEqual k1 k2 + go ([], TUnknown _ u1) ([], TUnknown _ u2) | u1 == u2 = Match () + go ([], TUnknown _ _) ([], _) = Unknown + go ([], _) ([], TUnknown _ _) = Unknown + go ([], Skolem _ _ _ s1 _) ([], Skolem _ _ _ s2 _) | s1 == s2 = Match () + go ([], Skolem _ _ _ _ _) _ = Unknown + go _ ([], Skolem _ _ _ _ _) = Unknown + go ([], REmpty _) ([], REmpty _) = Match () + go ([], TypeVar _ v1 _) ([], TypeVar _ v2 _) | v1 == v2 = Match () + go _ _ = Apart + typesAreEqual _ _ = Apart + + isRCons :: Type a -> Bool + isRCons RCons {} = True + isRCons _ = False + + containsSkolem :: Type a -> Int -> Bool + containsSkolem t s = everythingOnTypes (||) (\case Skolem _ _ _ s' _ -> s == s'; _ -> False) t + + containsUnknown :: Type a -> Int -> Bool + containsUnknown t u = everythingOnTypes (||) (\case TUnknown _ u' -> u == u'; _ -> False) t + +{- | Add a dictionary for the constraint to the scope, and dictionaries +for all implied superclass instances. +-} +newDictionaries :: + (MonadState CheckState m) => + [(Qualified (ProperName 'ClassName), Integer)] -> + Qualified Ident -> + SourceConstraint -> + m [NamedDict] newDictionaries path name (Constraint _ className instanceKinds instanceTy _) = do - tcs <- gets (typeClasses . checkEnv) - let TypeClassData{..} = fromMaybe (internalError "newDictionaries: type class lookup failed") $ M.lookup className tcs - supDicts <- join <$> zipWithM (\(Constraint ann supName supKinds supArgs _) index -> - let sub = zip (map fst typeClassArguments) instanceTy in - newDictionaries ((supName, index) : path) - name - (Constraint ann supName - (replaceAllTypeVars sub <$> supKinds) - (replaceAllTypeVars sub <$> supArgs) - Nothing) - ) typeClassSuperclasses [0..] - return (TypeClassDictionaryInScope Nothing 0 name path className [] instanceKinds instanceTy Nothing Nothing : supDicts) + tcs <- gets (typeClasses . checkEnv) + let TypeClassData {..} = fromMaybe (internalError "newDictionaries: type class lookup failed") $ M.lookup className tcs + supDicts <- + join + <$> zipWithM + ( \(Constraint ann supName supKinds supArgs _) index -> + let sub = zip (map fst typeClassArguments) instanceTy + in newDictionaries + ((supName, index) : path) + name + ( Constraint + ann + supName + (replaceAllTypeVars sub <$> supKinds) + (replaceAllTypeVars sub <$> supArgs) + Nothing + ) + ) + typeClassSuperclasses + [0 ..] + return (TypeClassDictionaryInScope Nothing 0 name path className [] instanceKinds instanceTy Nothing Nothing : supDicts) mkContext :: [NamedDict] -> InstanceContext -mkContext = foldr combineContexts M.empty . map fromDict where - fromDict d = M.singleton ByNullSourcePos (M.singleton (tcdClassName d) (M.singleton (tcdValue d) (pure d))) +mkContext = foldr combineContexts M.empty . map fromDict + where + fromDict d = M.singleton ByNullSourcePos (M.singleton (tcdClassName d) (M.singleton (tcdValue d) (pure d))) -- | Check all pairs of values in a list match a predicate -pairwiseAll :: Monoid m => (a -> a -> m) -> [a] -> m +pairwiseAll :: (Monoid m) => (a -> a -> m) -> [a] -> m pairwiseAll _ [] = mempty pairwiseAll _ [_] = mempty pairwiseAll p (x : xs) = foldMap (p x) xs <> pairwiseAll p xs @@ -899,16 +954,17 @@ pairwiseAny _ [] = False pairwiseAny _ [_] = False pairwiseAny p (x : xs) = any (p x) xs || pairwiseAny p xs -pairwiseM :: Applicative m => (a -> a -> m ()) -> [a] -> m () +pairwiseM :: (Applicative m) => (a -> a -> m ()) -> [a] -> m () pairwiseM _ [] = pure () pairwiseM _ [_] = pure () pairwiseM p (x : xs) = traverse (p x) xs *> pairwiseM p xs --- | Return all nonempty tails of a nonempty list. For example: --- --- tails1 (fromList [1]) == fromList [fromList [1]] --- tails1 (fromList [1,2]) == fromList [fromList [1,2], fromList [2]] --- tails1 (fromList [1,2,3]) == fromList [fromList [1,2,3], fromList [2,3], fromList [3]] +{- | Return all nonempty tails of a nonempty list. For example: + +tails1 (fromList [1]) == fromList [fromList [1]] +tails1 (fromList [1,2]) == fromList [fromList [1,2], fromList [2]] +tails1 (fromList [1,2,3]) == fromList [fromList [1,2,3], fromList [2,3], fromList [3]] +-} tails1 :: NonEmpty a -> NonEmpty (NonEmpty a) tails1 = -- NEL.fromList is an unsafe function, but this usage should be safe, since: diff --git a/src/Language/PureScript/TypeChecker/Entailment/Coercible.hs b/src/Language/PureScript/TypeChecker/Entailment/Coercible.hs index 8abaac31c..d1420bc43 100644 --- a/src/Language/PureScript/TypeChecker/Entailment/Coercible.hs +++ b/src/Language/PureScript/TypeChecker/Entailment/Coercible.hs @@ -1,89 +1,89 @@ {-# LANGUAGE DuplicateRecordFields #-} --- | --- Interaction solver for Coercible constraints --- -module Language.PureScript.TypeChecker.Entailment.Coercible - ( GivenSolverState(..) - , initialGivenSolverState - , solveGivens - , WantedSolverState(..) - , initialWantedSolverState - , solveWanteds - , insoluble - ) where +{- | +Interaction solver for Coercible constraints +-} +module Language.PureScript.TypeChecker.Entailment.Coercible ( + GivenSolverState (..), + initialGivenSolverState, + solveGivens, + WantedSolverState (..), + initialWantedSolverState, + solveWanteds, + insoluble, +) where import Prelude hiding (interact) -import Control.Applicative ((<|>), empty) +import Control.Applicative (empty, (<|>)) import Control.Arrow ((&&&)) -import Control.Monad ((<=<), guard, unless, when) +import Control.Monad (guard, unless, when, (<=<)) import Control.Monad.Error.Class (MonadError, catchError, throwError) import Control.Monad.State (MonadState, StateT, get, gets, modify, put) import Control.Monad.Trans.Class (lift) -import Control.Monad.Trans.Maybe (MaybeT(..), runMaybeT) -import Control.Monad.Trans.Except (ExceptT(..), runExceptT) +import Control.Monad.Trans.Except (ExceptT (..), runExceptT) +import Control.Monad.Trans.Maybe (MaybeT (..), runMaybeT) import Control.Monad.Writer.Strict (MonadWriter, Writer, execWriter, runWriter, runWriterT, tell) import Data.Either (partitionEithers) import Data.Foldable (fold, foldl', for_, toList) import Data.Functor (($>)) import Data.List (find) import Data.Maybe (fromMaybe, isJust) -import Data.Monoid (Any(..)) +import Data.Monoid (Any (..)) import Data.Text (Text) import Data.Map qualified as M import Data.Set qualified as S +import Language.PureScript.Constants.Prim qualified as Prim import Language.PureScript.Crash (internalError) -import Language.PureScript.Environment (DataDeclType(..), Environment(..), TypeKind(..), unapplyKinds) -import Language.PureScript.Errors (DeclarationRef(..), ErrorMessageHint(..), ExportSource, ImportDeclarationType(..), MultipleErrors, SimpleErrorMessage(..), SourceAnn, errorMessage, UnknownsHint(..)) -import Language.PureScript.Names (ModuleName, ProperName, ProperNameType(..), Qualified(..), byMaybeModuleName, toMaybeModuleName) +import Language.PureScript.Environment (DataDeclType (..), Environment (..), TypeKind (..), unapplyKinds) +import Language.PureScript.Errors (DeclarationRef (..), ErrorMessageHint (..), ExportSource, ImportDeclarationType (..), MultipleErrors, SimpleErrorMessage (..), SourceAnn, UnknownsHint (..), errorMessage) +import Language.PureScript.Names (ModuleName, ProperName, ProperNameType (..), Qualified (..), byMaybeModuleName, toMaybeModuleName) +import Language.PureScript.Roles (Role (..)) import Language.PureScript.TypeChecker.Kinds (elaborateKind, freshKindWithKind, unifyKinds') -import Language.PureScript.TypeChecker.Monad (CheckState(..)) +import Language.PureScript.TypeChecker.Monad (CheckState (..)) import Language.PureScript.TypeChecker.Roles (lookupRoles) import Language.PureScript.TypeChecker.Synonyms (replaceAllTypeSynonyms) import Language.PureScript.TypeChecker.Unify (alignRowsWith, freshTypeWithKind, substituteType) -import Language.PureScript.Roles (Role(..)) -import Language.PureScript.Types (Constraint(..), SourceType, Type(..), completeBinderList, containsUnknowns, everythingOnTypes, isMonoType, replaceAllTypeVars, rowFromList, srcConstraint, srcTypeApp, unapplyTypes) -import Language.PureScript.Constants.Prim qualified as Prim +import Language.PureScript.Types (Constraint (..), SourceType, Type (..), completeBinderList, containsUnknowns, everythingOnTypes, isMonoType, replaceAllTypeVars, rowFromList, srcConstraint, srcTypeApp, unapplyTypes) -- | State of the given constraints solver. -data GivenSolverState = - GivenSolverState - { inertGivens :: [(SourceType, SourceType, SourceType)] +data GivenSolverState = GivenSolverState + { inertGivens :: [(SourceType, SourceType, SourceType)] -- ^ A set of irreducible given constraints which do not interact together. - , unsolvedGivens :: [(SourceType, SourceType)] + , unsolvedGivens :: [(SourceType, SourceType)] -- ^ Given constraints yet to be solved. - } + } -- | Initialize the given constraints solver state with the givens to solve. initialGivenSolverState :: [(SourceType, SourceType)] -> GivenSolverState initialGivenSolverState = GivenSolverState [] --- | The given constraints solver follows these steps: --- --- 1. Solving can diverge for recursive newtypes, so we check the solver depth --- and abort if we crossed an arbitrary limit. --- --- For instance the declarations: --- --- @ --- newtype N a = N (a -> N a) --- --- example :: forall a b. N a -> N b --- example = coerce --- @ --- --- yield the wanted @Coercible (N a) (N b)@ which we can unwrap on both sides --- to yield @Coercible (a -> N a) (b -> N b)@, which we can then decompose back --- to @Coercible a b@ and @Coercible (N a) (N b)@. --- --- 2. We pick a constraint from the unsolved queue. If the queue is empty we are --- done, otherwise we unify the constraint arguments kinds and continue. --- --- 3. Then we try to canonicalize the constraint. +{- | The given constraints solver follows these steps: + +1. Solving can diverge for recursive newtypes, so we check the solver depth +and abort if we crossed an arbitrary limit. + +For instance the declarations: + +@ +newtype N a = N (a -> N a) + +example :: forall a b. N a -> N b +example = coerce +@ + +yield the wanted @Coercible (N a) (N b)@ which we can unwrap on both sides +to yield @Coercible (a -> N a) (b -> N b)@, which we can then decompose back +to @Coercible a b@ and @Coercible (N a) (N b)@. + +2. We pick a constraint from the unsolved queue. If the queue is empty we are +done, otherwise we unify the constraint arguments kinds and continue. + +3. Then we try to canonicalize the constraint. +-} -- 3a. Canonicalization can fail, in which case we swallow the error and pretend -- the constraint is irreducible because it is possible to eventually solve it. @@ -117,445 +117,473 @@ initialGivenSolverState = -- -- 3c. Otherwise canonicalization can succeed with derived constraints which we -- add to the unsolved queue and then go back to 1. -solveGivens - :: MonadError MultipleErrors m - => MonadState CheckState m - => Environment - -> StateT GivenSolverState m () -solveGivens env = go (0 :: Int) where - go n = do - when (n > 1000) . throwError . errorMessage $ PossiblyInfiniteCoercibleInstance - gets unsolvedGivens >>= \case - [] -> pure () - given : unsolved -> do - (k, a, b) <- lift $ unify given - GivenSolverState{..} <- get - lift (fst <$> runWriterT (canon env Nothing k a b `catchError` recover)) >>= \case - Irreducible -> case interact env (a, b) inertGivens of - Just (Simplified (a', b')) -> - put $ GivenSolverState { unsolvedGivens = (a', b') : unsolved, .. } - Just Discharged -> - put $ GivenSolverState { unsolvedGivens = unsolved, .. } - Nothing -> do - let (kickedOut, kept) = partitionEithers $ kicksOut env (a, b) <$> inertGivens - put $ GivenSolverState - { inertGivens = (k, a, b) : kept - , unsolvedGivens = kickedOut <> unsolved - } - Canonicalized deriveds -> - put $ GivenSolverState { unsolvedGivens = toList deriveds <> unsolved, .. } - go (n + 1) - recover _ = pure Irreducible +solveGivens :: + (MonadError MultipleErrors m) => + (MonadState CheckState m) => + Environment -> + StateT GivenSolverState m () +solveGivens env = go (0 :: Int) + where + go n = do + when (n > 1000) . throwError . errorMessage $ PossiblyInfiniteCoercibleInstance + gets unsolvedGivens >>= \case + [] -> pure () + given : unsolved -> do + (k, a, b) <- lift $ unify given + GivenSolverState {..} <- get + lift (fst <$> runWriterT (canon env Nothing k a b `catchError` recover)) >>= \case + Irreducible -> case interact env (a, b) inertGivens of + Just (Simplified (a', b')) -> + put $ GivenSolverState {unsolvedGivens = (a', b') : unsolved, ..} + Just Discharged -> + put $ GivenSolverState {unsolvedGivens = unsolved, ..} + Nothing -> do + let (kickedOut, kept) = partitionEithers $ kicksOut env (a, b) <$> inertGivens + put $ + GivenSolverState + { inertGivens = (k, a, b) : kept + , unsolvedGivens = kickedOut <> unsolved + } + Canonicalized deriveds -> + put $ GivenSolverState {unsolvedGivens = toList deriveds <> unsolved, ..} + go (n + 1) + recover _ = pure Irreducible -- | State of the wanted constraints solver. -data WantedSolverState = - WantedSolverState - { inertGivens :: [(SourceType, SourceType, SourceType)] +data WantedSolverState = WantedSolverState + { inertGivens :: [(SourceType, SourceType, SourceType)] -- ^ A set of irreducible given constraints which do not interact together, -- but which could interact with the wanteds. - , inertWanteds :: [(SourceType, SourceType, SourceType)] + , inertWanteds :: [(SourceType, SourceType, SourceType)] -- ^ A set of irreducible wanted constraints which do not interact together, -- nor with any given. - , unsolvedWanteds :: [(SourceType, SourceType)] + , unsolvedWanteds :: [(SourceType, SourceType)] -- ^ Wanted constraints yet to be solved. - } - --- | Initialize the wanted constraints solver state with an inert set of givens --- and the two parameters of the wanted to solve. -initialWantedSolverState - :: [(SourceType, SourceType, SourceType)] - -> SourceType - -> SourceType - -> WantedSolverState + } + +{- | Initialize the wanted constraints solver state with an inert set of givens +and the two parameters of the wanted to solve. +-} +initialWantedSolverState :: + [(SourceType, SourceType, SourceType)] -> + SourceType -> + SourceType -> + WantedSolverState initialWantedSolverState givens a b = WantedSolverState givens [] [(a, b)] --- | The wanted constraints solver follows similar steps than the given solver, --- except for: --- --- 1. When canonicalization fails we can swallow the error, but only if the --- wanted interacts with the givens. --- --- For instance the declarations: --- --- @ --- data D a = D a --- type role D nominal --- --- example :: forall a b. Coercible (D a) (D b) => D a -> D b --- example = coerce --- @ --- --- yield an insoluble wanted @Coercible (D a) (D b)@ which is discharged by --- the given. But we want @example :: forall a b. D a -> D b@ to fail. --- --- 2. Irreducible wanted constraints don't interact with the inert wanteds set, --- because doing so would yield confusing error messages. --- --- For instance the declarations: --- --- @ --- data D a = D a --- --- example :: forall a. D a a -> D Boolean Char --- example = coerce --- @ --- --- yield the wanted @Coercible (D a a) (D Boolean Char)@, which is decomposed to --- the irreducibles @Coercible a Boolean@ and @Coercible a Char@. Would we --- interact the latter with the former, we would report an insoluble --- @Coercible Boolean Char@. -solveWanteds - :: MonadError MultipleErrors m - => MonadWriter [ErrorMessageHint] m - => MonadState CheckState m - => Environment - -> StateT WantedSolverState m () -solveWanteds env = go (0 :: Int) where - go n = do - when (n > 1000) . throwError . errorMessage $ PossiblyInfiniteCoercibleInstance - gets unsolvedWanteds >>= \case - [] -> pure () - wanted : unsolved -> do - (k, a, b) <- lift $ unify wanted - WantedSolverState{..} <- get - lift (canon env (Just inertGivens) k a b `catchError` recover (a, b) inertGivens) >>= \case - Irreducible -> case interact env (a, b) inertGivens of - Just (Simplified (a', b')) -> - put $ WantedSolverState { unsolvedWanteds = (a', b') : unsolved, .. } - Just Discharged -> - put $ WantedSolverState { unsolvedWanteds = unsolved, .. } - Nothing -> - put $ WantedSolverState - { inertWanteds = (k, a, b) : inertWanteds - , unsolvedWanteds = unsolved - , .. - } - Canonicalized deriveds -> - put $ WantedSolverState { unsolvedWanteds = toList deriveds <> unsolved, .. } - go (n + 1) - recover wanted givens errors = - case interact env wanted givens of - Nothing -> throwError errors - Just (Simplified wanted') -> pure . Canonicalized $ S.singleton wanted' - Just Discharged -> pure $ Canonicalized mempty - --- | Unifying constraints arguments kinds isn't strictly necessary but yields --- better error messages. For instance we cannot solve the constraint --- @Coercible (D :: Type -> Type) (D a :: Type)@ because its arguments kinds --- don't match and trying to unify them will say so, which is more helpful than --- simply saying that no type class instance was found. --- --- A subtle thing to note is that types with polymorphic kinds can be annotated --- with kind applications mentioning unknowns that we may have solved by --- unifying the kinds. --- --- For instance the declarations: --- --- @ --- data D :: forall k. k -> Type --- data D a = D --- --- type role D representational --- --- example :: D D -> D D --- example = coerce --- @ --- --- yield a wanted --- @Coercible (D \@(k1 -> Type) (D \@k1)) (D \@(k2 -> Type) (D \@k2))@, which we --- decompose to @Coercible (D \@k1) (D \@k2)@, where @k1@ and @k2@ are unknowns. --- This constraint is not reflexive because @D \@k1@ and @D \@k2@ are differents --- but both arguments kinds unify with @k -> Type@, where @k@ is a fresh unknown, --- so applying the substitution to @D \@k1@ and @D \@k2@ yields a --- @Coercible (D \@k) (D \@k)@ constraint which could be trivially solved by --- reflexivity instead of having to saturate the type constructors. -unify - :: MonadError MultipleErrors m - => MonadState CheckState m - => (SourceType, SourceType) - -> m (SourceType, SourceType, SourceType) +{- | The wanted constraints solver follows similar steps than the given solver, +except for: + +1. When canonicalization fails we can swallow the error, but only if the +wanted interacts with the givens. + +For instance the declarations: + +@ +data D a = D a +type role D nominal + +example :: forall a b. Coercible (D a) (D b) => D a -> D b +example = coerce +@ + +yield an insoluble wanted @Coercible (D a) (D b)@ which is discharged by +the given. But we want @example :: forall a b. D a -> D b@ to fail. + +2. Irreducible wanted constraints don't interact with the inert wanteds set, +because doing so would yield confusing error messages. + +For instance the declarations: + +@ +data D a = D a + +example :: forall a. D a a -> D Boolean Char +example = coerce +@ + +yield the wanted @Coercible (D a a) (D Boolean Char)@, which is decomposed to +the irreducibles @Coercible a Boolean@ and @Coercible a Char@. Would we +interact the latter with the former, we would report an insoluble +@Coercible Boolean Char@. +-} +solveWanteds :: + (MonadError MultipleErrors m) => + (MonadWriter [ErrorMessageHint] m) => + (MonadState CheckState m) => + Environment -> + StateT WantedSolverState m () +solveWanteds env = go (0 :: Int) + where + go n = do + when (n > 1000) . throwError . errorMessage $ PossiblyInfiniteCoercibleInstance + gets unsolvedWanteds >>= \case + [] -> pure () + wanted : unsolved -> do + (k, a, b) <- lift $ unify wanted + WantedSolverState {..} <- get + lift (canon env (Just inertGivens) k a b `catchError` recover (a, b) inertGivens) >>= \case + Irreducible -> case interact env (a, b) inertGivens of + Just (Simplified (a', b')) -> + put $ WantedSolverState {unsolvedWanteds = (a', b') : unsolved, ..} + Just Discharged -> + put $ WantedSolverState {unsolvedWanteds = unsolved, ..} + Nothing -> + put $ + WantedSolverState + { inertWanteds = (k, a, b) : inertWanteds + , unsolvedWanteds = unsolved + , .. + } + Canonicalized deriveds -> + put $ WantedSolverState {unsolvedWanteds = toList deriveds <> unsolved, ..} + go (n + 1) + recover wanted givens errors = + case interact env wanted givens of + Nothing -> throwError errors + Just (Simplified wanted') -> pure . Canonicalized $ S.singleton wanted' + Just Discharged -> pure $ Canonicalized mempty + +{- | Unifying constraints arguments kinds isn't strictly necessary but yields +better error messages. For instance we cannot solve the constraint +@Coercible (D :: Type -> Type) (D a :: Type)@ because its arguments kinds +don't match and trying to unify them will say so, which is more helpful than +simply saying that no type class instance was found. + +A subtle thing to note is that types with polymorphic kinds can be annotated +with kind applications mentioning unknowns that we may have solved by +unifying the kinds. + +For instance the declarations: + +@ +data D :: forall k. k -> Type +data D a = D + +type role D representational + +example :: D D -> D D +example = coerce +@ + +yield a wanted +@Coercible (D \@(k1 -> Type) (D \@k1)) (D \@(k2 -> Type) (D \@k2))@, which we +decompose to @Coercible (D \@k1) (D \@k2)@, where @k1@ and @k2@ are unknowns. +This constraint is not reflexive because @D \@k1@ and @D \@k2@ are differents +but both arguments kinds unify with @k -> Type@, where @k@ is a fresh unknown, +so applying the substitution to @D \@k1@ and @D \@k2@ yields a +@Coercible (D \@k) (D \@k)@ constraint which could be trivially solved by +reflexivity instead of having to saturate the type constructors. +-} +unify :: + (MonadError MultipleErrors m) => + (MonadState CheckState m) => + (SourceType, SourceType) -> + m (SourceType, SourceType, SourceType) unify (a, b) = do let kindOf = sequence . (id &&& elaborateKind) <=< replaceAllTypeSynonyms (a', kind) <- kindOf a (b', kind') <- kindOf b unifyKinds' kind kind' subst <- gets checkSubstitution - pure ( substituteType subst kind - , substituteType subst a' - , substituteType subst b' - ) - --- | A successful interaction between an irreducible constraint and an inert --- given constraint has two possible outcomes: + pure + ( substituteType subst kind + , substituteType subst a' + , substituteType subst b' + ) + +{- | A successful interaction between an irreducible constraint and an inert + given constraint has two possible outcomes: +-} data Interaction - = Simplified (SourceType, SourceType) - -- ^ The interaction can yield a derived constraint, - | Discharged - -- ^ or we can learn the irreducible constraint is redundant and discharge it. + = -- | The interaction can yield a derived constraint, + Simplified (SourceType, SourceType) + | -- | or we can learn the irreducible constraint is redundant and discharge it. + Discharged -- | Interact an irreducible constraint with an inert set of givens. -interact - :: Environment - -> (SourceType, SourceType) - -> [(SourceType, SourceType, SourceType)] - -> Maybe Interaction -interact env irred = go where - go [] = Nothing - go (inert : _) - | canDischarge inert irred = Just Discharged - | Just derived <- interactSameTyVar inert irred = Just $ Simplified derived - | Just derived <- interactDiffTyVar env inert irred = Just $ Simplified derived - go (_ : inerts) = go inerts - --- | A given constraint of the form @Coercible a b@ can discharge constraints --- of the form @Coercible a b@ and @Coercible b a@. -canDischarge - :: (SourceType, SourceType, SourceType) - -> (SourceType, SourceType) - -> Bool +interact :: + Environment -> + (SourceType, SourceType) -> + [(SourceType, SourceType, SourceType)] -> + Maybe Interaction +interact env irred = go + where + go [] = Nothing + go (inert : _) + | canDischarge inert irred = Just Discharged + | Just derived <- interactSameTyVar inert irred = Just $ Simplified derived + | Just derived <- interactDiffTyVar env inert irred = Just $ Simplified derived + go (_ : inerts) = go inerts + +{- | A given constraint of the form @Coercible a b@ can discharge constraints +of the form @Coercible a b@ and @Coercible b a@. +-} +canDischarge :: + (SourceType, SourceType, SourceType) -> + (SourceType, SourceType) -> + Bool canDischarge (_, a, b) constraint = (a, b) == constraint || (b, a) == constraint --- | Two canonical constraints of the form @Coercible tv ty1@ and --- @Coercible tv ty2@ can interact together and yield a new constraint --- @Coercible ty1 ty2@. Canonicality matters to avoid loops. --- --- For instance the declarations: --- --- @ --- data D a = D a --- newtype N a = N (D (N a)) --- --- example :: forall a. Coercible a (D a) => a -> N a --- example = coerce --- @ --- --- yield a non canonical wanted @Coercible a (N a)@ that we can unwrap on the --- right to yield @Coercible a (D (N a))@. Would it interact with the non --- canonical given @Coercible a (D a)@ it would give @Coercible (D a) (D (N a))@, --- then decompose back to @Coercible a (N a)@. -interactSameTyVar - :: (SourceType, SourceType, SourceType) - -> (SourceType, SourceType) - -> Maybe (SourceType, SourceType) +{- | Two canonical constraints of the form @Coercible tv ty1@ and +@Coercible tv ty2@ can interact together and yield a new constraint +@Coercible ty1 ty2@. Canonicality matters to avoid loops. + +For instance the declarations: + +@ +data D a = D a +newtype N a = N (D (N a)) + +example :: forall a. Coercible a (D a) => a -> N a +example = coerce +@ + +yield a non canonical wanted @Coercible a (N a)@ that we can unwrap on the +right to yield @Coercible a (D (N a))@. Would it interact with the non +canonical given @Coercible a (D a)@ it would give @Coercible (D a) (D (N a))@, +then decompose back to @Coercible a (N a)@. +-} +interactSameTyVar :: + (SourceType, SourceType, SourceType) -> + (SourceType, SourceType) -> + Maybe (SourceType, SourceType) interactSameTyVar (_, tv1, ty1) (tv2, ty2) - | tv1 == tv2 && isCanonicalTyVarEq (tv1, ty1) && isCanonicalTyVarEq (tv2, ty2) - = Just (ty1, ty2) + | tv1 == tv2 && isCanonicalTyVarEq (tv1, ty1) && isCanonicalTyVarEq (tv2, ty2) = + Just (ty1, ty2) | otherwise = Nothing --- | Two canonical constraints of the form @Coercible tv1 ty1@ and --- @Coercible tv2 ty2@ can interact together and yield a new constraint --- @Coercible tv2 ty2[ty1/tv1]@. Once again, canonicality matters to avoid loops. --- --- For instance the declarations: --- --- @ --- data D a = D a --- --- example :: forall a b. Coercible b (D b) => a -> b --- example = coerce --- @ --- --- yield an irreducible canonical wanted @Coercible a b@. Would it interact with --- the non canonical given @Coercible b (D b)@ it would give @Coercible a (D b)@, --- which would keep interacting indefinitely with the given. -interactDiffTyVar - :: Environment - -> (SourceType, SourceType, SourceType) - -> (SourceType, SourceType) - -> Maybe (SourceType, SourceType) +{- | Two canonical constraints of the form @Coercible tv1 ty1@ and +@Coercible tv2 ty2@ can interact together and yield a new constraint +@Coercible tv2 ty2[ty1/tv1]@. Once again, canonicality matters to avoid loops. + +For instance the declarations: + +@ +data D a = D a + +example :: forall a b. Coercible b (D b) => a -> b +example = coerce +@ + +yield an irreducible canonical wanted @Coercible a b@. Would it interact with +the non canonical given @Coercible b (D b)@ it would give @Coercible a (D b)@, +which would keep interacting indefinitely with the given. +-} +interactDiffTyVar :: + Environment -> + (SourceType, SourceType, SourceType) -> + (SourceType, SourceType) -> + Maybe (SourceType, SourceType) interactDiffTyVar env (_, tv1, ty1) (tv2, ty2) | tv1 /= tv2 && isCanonicalTyVarEq (tv2, ty2) - , (ty2', Any True) <- runWriter $ rewrite env (tv1, ty1) ty2 - = Just (tv2, ty2') + , (ty2', Any True) <- runWriter $ rewrite env (tv1, ty1) ty2 = + Just (tv2, ty2') | otherwise = Nothing --- | A canonical constraint of the form @Coercible tv1 ty1@ can rewrite the --- right hand side of an irreducible constraint of the form @Coercible tv2 ty2@ --- by substituting @ty1@ for every occurrence of @tv1@ at representational and --- phantom role in @ty2@. Nominal occurrences are left untouched. +{- | A canonical constraint of the form @Coercible tv1 ty1@ can rewrite the +right hand side of an irreducible constraint of the form @Coercible tv2 ty2@ +by substituting @ty1@ for every occurrence of @tv1@ at representational and +phantom role in @ty2@. Nominal occurrences are left untouched. +-} rewrite :: Environment -> (SourceType, SourceType) -> SourceType -> Writer Any SourceType -rewrite env (Skolem _ _ _ s1 _, ty1) | not $ occurs s1 ty1 = go where - go (Skolem _ _ _ s2 _) | s1 == s2 = tell (Any True) $> ty1 - go ty2 | (Skolem{}, _, xs) <- unapplyTypes ty2, not $ null xs = - rewriteTyVarApp go ty2 - | (TypeConstructor _ tyName, _, _) <- unapplyTypes ty2 = do - rewriteTyConApp go (lookupRoles env tyName) ty2 - go (KindApp sa ty k) = KindApp sa <$> go ty <*> pure k - go (ForAll sa vis tv k ty scope) = ForAll sa vis tv k <$> go ty <*> pure scope - go (ConstrainedType sa Constraint{..} ty) | s1 `S.notMember` foldMap skolems constraintArgs = - ConstrainedType sa Constraint{..} <$> go ty - go (RCons sa label ty rest) = RCons sa label <$> go ty <*> go rest - go (KindedType sa ty k) = KindedType sa <$> go ty <*> pure k - go ty2 = pure ty2 +rewrite env (Skolem _ _ _ s1 _, ty1) | not $ occurs s1 ty1 = go + where + go (Skolem _ _ _ s2 _) | s1 == s2 = tell (Any True) $> ty1 + go ty2 + | (Skolem {}, _, xs) <- unapplyTypes ty2 + , not $ null xs = + rewriteTyVarApp go ty2 + | (TypeConstructor _ tyName, _, _) <- unapplyTypes ty2 = do + rewriteTyConApp go (lookupRoles env tyName) ty2 + go (KindApp sa ty k) = KindApp sa <$> go ty <*> pure k + go (ForAll sa vis tv k ty scope) = ForAll sa vis tv k <$> go ty <*> pure scope + go (ConstrainedType sa Constraint {..} ty) + | s1 `S.notMember` foldMap skolems constraintArgs = + ConstrainedType sa Constraint {..} <$> go ty + go (RCons sa label ty rest) = RCons sa label <$> go ty <*> go rest + go (KindedType sa ty k) = KindedType sa <$> go ty <*> pure k + go ty2 = pure ty2 rewrite _ _ = pure -- | Rewrite the head of a type application of the form @tv a_0 .. a_n@. -rewriteTyVarApp - :: Applicative m - => (SourceType -> m SourceType) - -> SourceType - -> m SourceType -rewriteTyVarApp f = go where - go (TypeApp sa lhs rhs) = - TypeApp sa <$> go lhs <*> pure rhs - go (KindApp sa ty k) = - KindApp sa <$> go ty <*> pure k - go ty = f ty - --- | Rewrite the representational and phantom arguments of a type application --- of the form @D a_0 .. a_n@. -rewriteTyConApp - :: Applicative m - => (SourceType -> m SourceType) - -> [Role] - -> SourceType - -> m SourceType -rewriteTyConApp f = go where - go (role : roles) (TypeApp sa lhs rhs) = - TypeApp sa <$> go roles lhs <*> case role of - Nominal -> pure rhs - _ -> f rhs - go roles (KindApp sa ty k) = - KindApp sa <$> go roles ty <*> pure k - go _ ty = pure ty +rewriteTyVarApp :: + (Applicative m) => + (SourceType -> m SourceType) -> + SourceType -> + m SourceType +rewriteTyVarApp f = go + where + go (TypeApp sa lhs rhs) = + TypeApp sa <$> go lhs <*> pure rhs + go (KindApp sa ty k) = + KindApp sa <$> go ty <*> pure k + go ty = f ty + +{- | Rewrite the representational and phantom arguments of a type application +of the form @D a_0 .. a_n@. +-} +rewriteTyConApp :: + (Applicative m) => + (SourceType -> m SourceType) -> + [Role] -> + SourceType -> + m SourceType +rewriteTyConApp f = go + where + go (role : roles) (TypeApp sa lhs rhs) = + TypeApp sa <$> go roles lhs <*> case role of + Nominal -> pure rhs + _ -> f rhs + go roles (KindApp sa ty k) = + KindApp sa <$> go roles ty <*> pure k + go _ ty = pure ty canRewrite :: Environment -> (SourceType, SourceType) -> SourceType -> Bool canRewrite env irred = getAny . execWriter . rewrite env irred --- | An irreducible given constraint must kick out of the inert set any --- constraint it can rewrite when it becomes inert, otherwise solving would be --- sensitive to the order of constraints. Wanteds cannot rewrite other wanteds --- so this applies only to givens. --- --- For instance the declaration: --- --- @ --- example :: forall f g a b. Coercible a (f b) => Coercible f g => Proxy f -> a -> g b --- example _ = coerce --- @ --- --- yields the irreducible givens @Coercible a (f b)@ and @Coercible f g@. Would --- we not kick out the former when adding the latter to the inert set we would --- not be able to rewrite it to @Coercible a (g b)@ and discharge the wanted, --- but inverting the givens would work. -kicksOut - :: Environment - -> (SourceType, SourceType) - -> (SourceType, SourceType, SourceType) - -> Either (SourceType, SourceType) (SourceType, SourceType, SourceType) +{- | An irreducible given constraint must kick out of the inert set any +constraint it can rewrite when it becomes inert, otherwise solving would be +sensitive to the order of constraints. Wanteds cannot rewrite other wanteds +so this applies only to givens. + +For instance the declaration: + +@ +example :: forall f g a b. Coercible a (f b) => Coercible f g => Proxy f -> a -> g b +example _ = coerce +@ + +yields the irreducible givens @Coercible a (f b)@ and @Coercible f g@. Would +we not kick out the former when adding the latter to the inert set we would +not be able to rewrite it to @Coercible a (g b)@ and discharge the wanted, +but inverting the givens would work. +-} +kicksOut :: + Environment -> + (SourceType, SourceType) -> + (SourceType, SourceType, SourceType) -> + Either (SourceType, SourceType) (SourceType, SourceType, SourceType) kicksOut env irred (_, tv2, ty2) - | isCanonicalTyVarEq (tv2, ty2) && canRewrite env irred ty2 - = Left (tv2, ty2) + | isCanonicalTyVarEq (tv2, ty2) && canRewrite env irred ty2 = + Left (tv2, ty2) kicksOut _ _ inert = Right inert --- | A constraint of the form @Coercible tv ty@ is canonical when @tv@ does not --- occur in @ty@. Non canonical constraints do not interact to prevent loops. +{- | A constraint of the form @Coercible tv ty@ is canonical when @tv@ does not +occur in @ty@. Non canonical constraints do not interact to prevent loops. +-} isCanonicalTyVarEq :: (SourceType, SourceType) -> Bool isCanonicalTyVarEq (Skolem _ _ _ s _, ty) = not $ occurs s ty isCanonicalTyVarEq _ = False occurs :: Int -> SourceType -> Bool -occurs s1 = everythingOnTypes (||) go where - go (Skolem _ _ _ s2 _) | s1 == s2 = True - go _ = False +occurs s1 = everythingOnTypes (||) go + where + go (Skolem _ _ _ s2 _) | s1 == s2 = True + go _ = False skolems :: SourceType -> S.Set Int -skolems = everythingOnTypes (<>) go where - go (Skolem _ _ _ s _) = S.singleton s - go _ = mempty +skolems = everythingOnTypes (<>) go + where + go (Skolem _ _ _ s _) = S.singleton s + go _ = mempty -- | A successful canonicalization result has two possible outcomes: data Canonicalized - = Canonicalized (S.Set (SourceType, SourceType)) - -- ^ Canonicalization can yield a set of derived constraints, - | Irreducible - -- ^ or we can learn the constraint is irreducible. Irreducibility is not - -- necessarily an error, we may make further progress by interacting with - -- inerts. - --- | Canonicalization takes a wanted constraint and try to reduce it to a set of --- simpler constraints whose satisfaction will imply the goal. -canon - :: MonadError MultipleErrors m - => MonadWriter [ErrorMessageHint] m - => MonadState CheckState m - => Environment - -> Maybe [(SourceType, SourceType, SourceType)] - -> SourceType - -> SourceType - -> SourceType - -> m Canonicalized + = -- | Canonicalization can yield a set of derived constraints, + Canonicalized (S.Set (SourceType, SourceType)) + | -- | or we can learn the constraint is irreducible. Irreducibility is not + -- necessarily an error, we may make further progress by interacting with + -- inerts. + Irreducible + +{- | Canonicalization takes a wanted constraint and try to reduce it to a set of +simpler constraints whose satisfaction will imply the goal. +-} +canon :: + (MonadError MultipleErrors m) => + (MonadWriter [ErrorMessageHint] m) => + (MonadState CheckState m) => + Environment -> + Maybe [(SourceType, SourceType, SourceType)] -> + SourceType -> + SourceType -> + SourceType -> + m Canonicalized canon env givens k a b = maybe (throwError $ insoluble k a b) pure <=< runMaybeT $ - canonRefl a b - <|> canonUnsaturatedHigherKindedType env a b - <|> canonRow a b - -- We unwrap newtypes before trying the decomposition rules because it let - -- us solve more constraints. - -- - -- For instance the declarations: - -- - -- @ - -- newtype N f a = N (f a) - -- - -- example :: forall a b. Coercible a b => N Maybe a -> N Maybe b - -- example = coerce - -- @ - -- - -- yield the wanted @Coercible (N Maybe a) (N Maybe b)@ which we cannot - -- decompose because the second parameter of @N@ is nominal. On the other - -- hand, unwrapping on both sides yields @Coercible (Maybe a) (Maybe b)@ - -- which we can then decompose to @Coercible a b@ and discharge with the - -- given. - <|> canonNewtypeLeft env a b - <|> canonNewtypeRight env a b - <|> canonDecomposition env a b - <|> canonDecompositionFailure env k a b - <|> canonNewtypeDecomposition env givens a b - <|> canonNewtypeDecompositionFailure a b - <|> canonTypeVars a b - <|> canonTypeVarLeft a b - <|> canonTypeVarRight a b - <|> canonApplicationLeft a b - <|> canonApplicationRight a b - -insoluble - :: SourceType - -> SourceType - -> SourceType - -> MultipleErrors + canonRefl a b + <|> canonUnsaturatedHigherKindedType env a b + <|> canonRow a b + -- We unwrap newtypes before trying the decomposition rules because it let + -- us solve more constraints. + -- + -- For instance the declarations: + -- + -- @ + -- newtype N f a = N (f a) + -- + -- example :: forall a b. Coercible a b => N Maybe a -> N Maybe b + -- example = coerce + -- @ + -- + -- yield the wanted @Coercible (N Maybe a) (N Maybe b)@ which we cannot + -- decompose because the second parameter of @N@ is nominal. On the other + -- hand, unwrapping on both sides yields @Coercible (Maybe a) (Maybe b)@ + -- which we can then decompose to @Coercible a b@ and discharge with the + -- given. + <|> canonNewtypeLeft env a b + <|> canonNewtypeRight env a b + <|> canonDecomposition env a b + <|> canonDecompositionFailure env k a b + <|> canonNewtypeDecomposition env givens a b + <|> canonNewtypeDecompositionFailure a b + <|> canonTypeVars a b + <|> canonTypeVarLeft a b + <|> canonTypeVarRight a b + <|> canonApplicationLeft a b + <|> canonApplicationRight a b + +insoluble :: + SourceType -> + SourceType -> + SourceType -> + MultipleErrors insoluble k a b = -- We can erase kind applications when determining whether to show the -- "Consider adding a type annotation" hint, because annotating kinds to -- instantiate unknowns in Coercible constraints should never resolve -- NoInstanceFound errors. - errorMessage $ NoInstanceFound (srcConstraint Prim.Coercible [k] [a, b] Nothing) [] - $ if any containsUnknowns [a, b] then Unknowns else NoUnknowns - --- | Constraints of the form @Coercible a b@ can be solved if the two arguments --- are the same. Since we currently don't support higher-rank arguments in --- instance heads, term equality is a sufficient notion of "the same". -canonRefl - :: Monad m - => SourceType - -> SourceType - -> MaybeT m Canonicalized + errorMessage $ + NoInstanceFound (srcConstraint Prim.Coercible [k] [a, b] Nothing) [] $ + if any containsUnknowns [a, b] then Unknowns else NoUnknowns + +{- | Constraints of the form @Coercible a b@ can be solved if the two arguments +are the same. Since we currently don't support higher-rank arguments in +instance heads, term equality is a sufficient notion of "the same". +-} +canonRefl :: + (Monad m) => + SourceType -> + SourceType -> + MaybeT m Canonicalized canonRefl a b = guard (a == b) $> Canonicalized mempty --- | Constraints of the form @Coercible (T1 a_0 .. a_n) (T2 b_0 .. b_n)@, where --- both arguments have kind @k1 -> k2@, yield a constraint --- @Coercible (T1 a_0 .. a_n c_0 .. c_m) (T2 b_0 .. b_n c_0 .. c_m)@, where both --- arguments are fully saturated with the same unknowns and have kind @Type@. -canonUnsaturatedHigherKindedType - :: MonadError MultipleErrors m - => MonadState CheckState m - => Environment - -> SourceType - -> SourceType - -> MaybeT m Canonicalized +{- | Constraints of the form @Coercible (T1 a_0 .. a_n) (T2 b_0 .. b_n)@, where +both arguments have kind @k1 -> k2@, yield a constraint +@Coercible (T1 a_0 .. a_n c_0 .. c_m) (T2 b_0 .. b_n c_0 .. c_m)@, where both +arguments are fully saturated with the same unknowns and have kind @Type@. +-} +canonUnsaturatedHigherKindedType :: + (MonadError MultipleErrors m) => + (MonadState CheckState m) => + Environment -> + SourceType -> + SourceType -> + MaybeT m Canonicalized canonUnsaturatedHigherKindedType env a b | (TypeConstructor _ aTyName, akapps, axs) <- unapplyTypes a , (ak, _) <- fromMaybe (internalError "canonUnsaturatedHigherKindedType: type lookup failed") $ M.lookup aTyName (types env) @@ -573,27 +601,28 @@ canonUnsaturatedHigherKindedType env a b pure . Canonicalized $ S.singleton (a', b') | otherwise = empty --- | Constraints of the form --- @Coercible ( label_0 :: a_0, .. label_n :: a_n | r ) ( label_0 :: b_0, .. label_n :: b_n | s )@ --- yield a constraint @Coercible r s@ and constraints on the types for each --- label in both rows. Labels exclusive to one row yield a failure. -canonRow - :: MonadError MultipleErrors m - => MonadState CheckState m - => SourceType - -> SourceType - -> MaybeT m Canonicalized +{- | Constraints of the form +@Coercible ( label_0 :: a_0, .. label_n :: a_n | r ) ( label_0 :: b_0, .. label_n :: b_n | s )@ +yield a constraint @Coercible r s@ and constraints on the types for each +label in both rows. Labels exclusive to one row yield a failure. +-} +canonRow :: + (MonadError MultipleErrors m) => + (MonadState CheckState m) => + SourceType -> + SourceType -> + MaybeT m Canonicalized canonRow a b - | RCons{} <- a = + | RCons {} <- a = case alignRowsWith (const (,)) a b of -- We throw early when a bare unknown remains on either side after -- aligning the rows because we don't know how to canonicalize them yet -- and the unification error thrown when the rows are misaligned should -- not mention unknowns. - (_, (([], u@TUnknown{}), rl2)) -> do + (_, (([], u@TUnknown {}), rl2)) -> do k <- elaborateKind u throwError $ insoluble k u (rowFromList rl2) - (_, (rl1, ([], u@TUnknown{}))) -> do + (_, (rl1, ([], u@TUnknown {}))) -> do k <- elaborateKind u throwError $ insoluble k (rowFromList rl1) u (deriveds, (([], tail1), ([], tail2))) -> do @@ -604,89 +633,93 @@ canonRow a b -- | Unwrapping a newtype can fails in two ways: data UnwrapNewtypeError - = CannotUnwrapInfiniteNewtypeChain - -- ^ The newtype might wrap an infinite newtype chain. We may think that this - -- is already handled by the solver depth check, but failing to unwrap - -- infinite chains of newtypes let us try other rules. - -- - -- For instance the declarations: - -- - -- @ - -- newtype N a = N (N a) - -- type role N representational - -- - -- example :: forall a b. Coercible a b => N a -> N b - -- example = coerce - -- @ - -- - -- yield a wanted @Coercible (N a) (N b)@ that we can decompose to - -- @Coercible a b@ then discharge with the given if the newtype - -- unwrapping rules do not apply. - | CannotUnwrapConstructor - -- ^ The constructor may not be in scope or may not belong to a newtype. - --- | Unwraps a newtype and yields its underlying type with the newtype arguments --- substituted in (e.g. @N[D/a] = D@ given @newtype N a = N a@ and @data D = D@). -unwrapNewtype - :: MonadState CheckState m - => MonadWriter [ErrorMessageHint] m - => Environment - -> SourceType - -> m (Either UnwrapNewtypeError SourceType) -unwrapNewtype env = go (0 :: Int) where - go n ty = runExceptT $ do - when (n > 1000) $ throwError CannotUnwrapInfiniteNewtypeChain - (currentModuleName, currentModuleImports) <- gets $ checkCurrentModule &&& checkCurrentModuleImports - case unapplyTypes ty of - (TypeConstructor _ newtypeName, ks, xs) - | Just (inScope, fromModuleName, tvs, newtypeCtorName, wrappedTy) <- - lookupNewtypeConstructorInScope env currentModuleName currentModuleImports newtypeName ks - -- We refuse to unwrap newtypes over polytypes because we don't know how - -- to canonicalize them yet and we'd rather try to make progress with - -- another rule. - , isMonoType wrappedTy -> do - unless inScope $ do - tell [MissingConstructorImportForCoercible newtypeCtorName] - throwError CannotUnwrapConstructor - for_ fromModuleName $ flip addConstructorImportForCoercible newtypeCtorName - let wrappedTySub = replaceAllTypeVars (zip tvs xs) wrappedTy - ExceptT (go (n + 1) wrappedTySub) `catchError` \case - CannotUnwrapInfiniteNewtypeChain -> throwError CannotUnwrapInfiniteNewtypeChain - CannotUnwrapConstructor -> pure wrappedTySub - _ -> throwError CannotUnwrapConstructor - addConstructorImportForCoercible fromModuleName newtypeCtorName = modify $ \st -> - st { checkConstructorImportsForCoercible = S.insert (fromModuleName, newtypeCtorName) $ checkConstructorImportsForCoercible st } - --- | Looks up a given name and, if it names a newtype, returns the names of the --- type's parameters, the type the newtype wraps and the names of the type's --- fields. -lookupNewtypeConstructor - :: Environment - -> Qualified (ProperName 'TypeName) - -> [SourceType] - -> Maybe ([Text], ProperName 'ConstructorName, SourceType) + = -- | The newtype might wrap an infinite newtype chain. We may think that this + -- is already handled by the solver depth check, but failing to unwrap + -- infinite chains of newtypes let us try other rules. + -- + -- For instance the declarations: + -- + -- @ + -- newtype N a = N (N a) + -- type role N representational + -- + -- example :: forall a b. Coercible a b => N a -> N b + -- example = coerce + -- @ + -- + -- yield a wanted @Coercible (N a) (N b)@ that we can decompose to + -- @Coercible a b@ then discharge with the given if the newtype + -- unwrapping rules do not apply. + CannotUnwrapInfiniteNewtypeChain + | -- | The constructor may not be in scope or may not belong to a newtype. + CannotUnwrapConstructor + +{- | Unwraps a newtype and yields its underlying type with the newtype arguments +substituted in (e.g. @N[D/a] = D@ given @newtype N a = N a@ and @data D = D@). +-} +unwrapNewtype :: + (MonadState CheckState m) => + (MonadWriter [ErrorMessageHint] m) => + Environment -> + SourceType -> + m (Either UnwrapNewtypeError SourceType) +unwrapNewtype env = go (0 :: Int) + where + go n ty = runExceptT $ do + when (n > 1000) $ throwError CannotUnwrapInfiniteNewtypeChain + (currentModuleName, currentModuleImports) <- gets $ checkCurrentModule &&& checkCurrentModuleImports + case unapplyTypes ty of + (TypeConstructor _ newtypeName, ks, xs) + | Just (inScope, fromModuleName, tvs, newtypeCtorName, wrappedTy) <- + lookupNewtypeConstructorInScope env currentModuleName currentModuleImports newtypeName ks + , -- We refuse to unwrap newtypes over polytypes because we don't know how + -- to canonicalize them yet and we'd rather try to make progress with + -- another rule. + isMonoType wrappedTy -> do + unless inScope $ do + tell [MissingConstructorImportForCoercible newtypeCtorName] + throwError CannotUnwrapConstructor + for_ fromModuleName $ flip addConstructorImportForCoercible newtypeCtorName + let wrappedTySub = replaceAllTypeVars (zip tvs xs) wrappedTy + ExceptT (go (n + 1) wrappedTySub) `catchError` \case + CannotUnwrapInfiniteNewtypeChain -> throwError CannotUnwrapInfiniteNewtypeChain + CannotUnwrapConstructor -> pure wrappedTySub + _ -> throwError CannotUnwrapConstructor + addConstructorImportForCoercible fromModuleName newtypeCtorName = modify $ \st -> + st {checkConstructorImportsForCoercible = S.insert (fromModuleName, newtypeCtorName) $ checkConstructorImportsForCoercible st} + +{- | Looks up a given name and, if it names a newtype, returns the names of the +type's parameters, the type the newtype wraps and the names of the type's +fields. +-} +lookupNewtypeConstructor :: + Environment -> + Qualified (ProperName 'TypeName) -> + [SourceType] -> + Maybe ([Text], ProperName 'ConstructorName, SourceType) lookupNewtypeConstructor env qualifiedNewtypeName ks = do (newtyk, DataType Newtype tvs [(ctorName, [wrappedTy])]) <- M.lookup qualifiedNewtypeName (types env) let (kvs, _) = fromMaybe (internalError "lookupNewtypeConstructor: unkinded forall binder") $ completeBinderList newtyk instantiatedKinds = zipWith (\(_, (kv, _)) k -> (kv, k)) kvs ks pure (map (\(name, _, _) -> name) tvs, ctorName, replaceAllTypeVars instantiatedKinds wrappedTy) --- | Behaves like 'lookupNewtypeConstructor' but also returns whether the --- newtype constructor is in scope and the module from which it is imported, or --- 'Nothing' if it is defined in the current module. -lookupNewtypeConstructorInScope - :: Environment - -> Maybe ModuleName - -> [ ( SourceAnn - , ModuleName - , ImportDeclarationType - , Maybe ModuleName - , M.Map (ProperName 'TypeName) ([ProperName 'ConstructorName], ExportSource) - ) - ] - -> Qualified (ProperName 'TypeName) - -> [SourceType] - -> Maybe (Bool, Maybe ModuleName, [Text], Qualified (ProperName 'ConstructorName), SourceType) +{- | Behaves like 'lookupNewtypeConstructor' but also returns whether the +newtype constructor is in scope and the module from which it is imported, or +'Nothing' if it is defined in the current module. +-} +lookupNewtypeConstructorInScope :: + Environment -> + Maybe ModuleName -> + [ ( SourceAnn + , ModuleName + , ImportDeclarationType + , Maybe ModuleName + , M.Map (ProperName 'TypeName) ([ProperName 'ConstructorName], ExportSource) + ) + ] -> + Qualified (ProperName 'TypeName) -> + [SourceType] -> + Maybe (Bool, Maybe ModuleName, [Text], Qualified (ProperName 'ConstructorName), SourceType) lookupNewtypeConstructorInScope env currentModuleName currentModuleImports qualifiedNewtypeName@(Qualified newtypeModuleName newtypeName) ks = do let fromModule = find isNewtypeCtorImported currentModuleImports fromModuleName = (\(_, n, _, _, _) -> n) <$> fromModule @@ -697,65 +730,68 @@ lookupNewtypeConstructorInScope env currentModuleName currentModuleImports quali (tvs, ctorName, wrappedTy) <- lookupNewtypeConstructor env qualifiedNewtypeName ks pure (inScope, fromModuleName, tvs, Qualified (byMaybeModuleName asModuleName) ctorName, wrappedTy) where - isNewtypeCtorImported (_, _, importDeclType, _, exportedTypes) = - case M.lookup newtypeName exportedTypes of - Just ([_], _) -> case importDeclType of - Implicit -> True - Explicit refs -> any isNewtypeCtorRef refs - Hiding refs -> not $ any isNewtypeCtorRef refs + isNewtypeCtorImported (_, _, importDeclType, _, exportedTypes) = + case M.lookup newtypeName exportedTypes of + Just ([_], _) -> case importDeclType of + Implicit -> True + Explicit refs -> any isNewtypeCtorRef refs + Hiding refs -> not $ any isNewtypeCtorRef refs + _ -> False + isNewtypeCtorRef = \case + TypeRef _ importedTyName Nothing -> importedTyName == newtypeName + TypeRef _ importedTyName (Just [_]) -> importedTyName == newtypeName _ -> False - isNewtypeCtorRef = \case - TypeRef _ importedTyName Nothing -> importedTyName == newtypeName - TypeRef _ importedTyName (Just [_]) -> importedTyName == newtypeName - _ -> False - --- | Constraints of the form @Coercible (N a_0 .. a_n) b@ yield a constraint --- @Coercible a b@ if unwrapping the newtype yields @a@. -canonNewtypeLeft - :: MonadState CheckState m - => MonadWriter [ErrorMessageHint] m - => Environment - -> SourceType - -> SourceType - -> MaybeT m Canonicalized + +{- | Constraints of the form @Coercible (N a_0 .. a_n) b@ yield a constraint +@Coercible a b@ if unwrapping the newtype yields @a@. +-} +canonNewtypeLeft :: + (MonadState CheckState m) => + (MonadWriter [ErrorMessageHint] m) => + Environment -> + SourceType -> + SourceType -> + MaybeT m Canonicalized canonNewtypeLeft env a b = unwrapNewtype env a >>= \case Left CannotUnwrapInfiniteNewtypeChain -> empty Left CannotUnwrapConstructor -> empty Right a' -> pure . Canonicalized $ S.singleton (a', b) --- | Constraints of the form @Coercible a (N b_0 .. b_n)@ yield a constraint --- @Coercible a b@ if unwrapping the newtype yields @b@. -canonNewtypeRight - :: MonadState CheckState m - => MonadWriter [ErrorMessageHint] m - => Environment - -> SourceType - -> SourceType - -> MaybeT m Canonicalized +{- | Constraints of the form @Coercible a (N b_0 .. b_n)@ yield a constraint +@Coercible a b@ if unwrapping the newtype yields @b@. +-} +canonNewtypeRight :: + (MonadState CheckState m) => + (MonadWriter [ErrorMessageHint] m) => + Environment -> + SourceType -> + SourceType -> + MaybeT m Canonicalized canonNewtypeRight env = flip $ canonNewtypeLeft env --- | Decomposes constraints of the form @Coercible (D a_0 .. a_n) (D b_0 .. b_n)@ --- into constraints on their representational arguments, ignoring phantom --- arguments and failing on unequal nominal arguments. --- --- For instance given the declarations: --- --- @ --- data D a b c = D a b --- type role D nominal representational phantom --- @ --- --- We can decompose @Coercible (D a b d) (D a c e)@ into @Coercible b c@, but --- decomposing @Coercible (D a c d) (D b c d)@ would fail. -decompose - :: MonadError MultipleErrors m - => Environment - -> Qualified (ProperName 'TypeName) - -> [SourceType] - -> [SourceType] - -> m Canonicalized +{- | Decomposes constraints of the form @Coercible (D a_0 .. a_n) (D b_0 .. b_n)@ +into constraints on their representational arguments, ignoring phantom +arguments and failing on unequal nominal arguments. + +For instance given the declarations: + +@ +data D a b c = D a b +type role D nominal representational phantom +@ + +We can decompose @Coercible (D a b d) (D a c e)@ into @Coercible b c@, but +decomposing @Coercible (D a c d) (D b c d)@ would fail. +-} +decompose :: + (MonadError MultipleErrors m) => + Environment -> + Qualified (ProperName 'TypeName) -> + [SourceType] -> + [SourceType] -> + m Canonicalized decompose env tyName axs bxs = do let roles = lookupRoles env tyName f role ax bx = case role of @@ -776,14 +812,15 @@ decompose env tyName axs bxs = do pure mempty fmap (Canonicalized . fold) $ sequence $ zipWith3 f roles axs bxs --- | Constraints of the form @Coercible (D a_0 .. a_n) (D b_0 .. b_n)@, where --- @D@ is not a newtype, yield constraints on their arguments. -canonDecomposition - :: MonadError MultipleErrors m - => Environment - -> SourceType - -> SourceType - -> MaybeT m Canonicalized +{- | Constraints of the form @Coercible (D a_0 .. a_n) (D b_0 .. b_n)@, where +@D@ is not a newtype, yield constraints on their arguments. +-} +canonDecomposition :: + (MonadError MultipleErrors m) => + Environment -> + SourceType -> + SourceType -> + MaybeT m Canonicalized canonDecomposition env a b | (TypeConstructor _ aTyName, _, axs) <- unapplyTypes a , (TypeConstructor _ bTyName, _, bxs) <- unapplyTypes b @@ -792,16 +829,17 @@ canonDecomposition env a b decompose env aTyName axs bxs | otherwise = empty --- | Constraints of the form @Coercible (D1 a_0 .. a_n) (D2 b_0 .. b_n)@, where --- @D1@ and @D2@ are different type constructors and neither of them are --- newtypes, are insoluble. -canonDecompositionFailure - :: MonadError MultipleErrors m - => Environment - -> SourceType - -> SourceType - -> SourceType - -> MaybeT m Canonicalized +{- | Constraints of the form @Coercible (D1 a_0 .. a_n) (D2 b_0 .. b_n)@, where +@D1@ and @D2@ are different type constructors and neither of them are +newtypes, are insoluble. +-} +canonDecompositionFailure :: + (MonadError MultipleErrors m) => + Environment -> + SourceType -> + SourceType -> + SourceType -> + MaybeT m Canonicalized canonDecompositionFailure env k a b | (TypeConstructor _ aTyName, _, _) <- unapplyTypes a , (TypeConstructor _ bTyName, _, _) <- unapplyTypes b @@ -811,46 +849,47 @@ canonDecompositionFailure env k a b throwError $ insoluble k a b | otherwise = empty --- | Wanted constraints of the form @Coercible (N a_0 .. a_n) (N b_0 .. b_n)@, --- where @N@ is a newtype whose constructor is out of scope, yield constraints --- on their arguments only when no given constraint can discharge them. --- --- We cannot decompose given constraints because newtypes are not necessarily --- injective with respect to representational equality. --- --- For instance given the declaration: --- --- @ --- newtype Const a b = MkConst a --- type role Const representational representational --- @ --- --- Decomposing a given @Coercible (Const a a) (Const a b)@ constraint to --- @Coercible a b@ when @MkConst@ is out of scope would let us coerce arbitrary --- types in modules where @MkConst@ is imported, because the given is easily --- satisfied with the newtype unwrapping rules. --- --- Moreover we do not decompose wanted constraints if they could be discharged --- by a given constraint. --- --- For instance the declaration: --- --- @ --- example :: forall a b. Coercible (Const a a) (Const a b) => Const a a -> Const a b --- example = coerce --- @ --- --- yield an irreducible given @Coercible (Const a a) (Const a b)@ when @MkConst@ --- is out of scope. Would we decompose the wanted --- @Coercible (Const a a) (Const a b)@ to @Coercible a b@ we would not be able --- to discharge it with the given. -canonNewtypeDecomposition - :: MonadError MultipleErrors m - => Environment - -> Maybe [(SourceType, SourceType, SourceType)] - -> SourceType - -> SourceType - -> MaybeT m Canonicalized +{- | Wanted constraints of the form @Coercible (N a_0 .. a_n) (N b_0 .. b_n)@, +where @N@ is a newtype whose constructor is out of scope, yield constraints +on their arguments only when no given constraint can discharge them. + +We cannot decompose given constraints because newtypes are not necessarily +injective with respect to representational equality. + +For instance given the declaration: + +@ +newtype Const a b = MkConst a +type role Const representational representational +@ + +Decomposing a given @Coercible (Const a a) (Const a b)@ constraint to +@Coercible a b@ when @MkConst@ is out of scope would let us coerce arbitrary +types in modules where @MkConst@ is imported, because the given is easily +satisfied with the newtype unwrapping rules. + +Moreover we do not decompose wanted constraints if they could be discharged +by a given constraint. + +For instance the declaration: + +@ +example :: forall a b. Coercible (Const a a) (Const a b) => Const a a -> Const a b +example = coerce +@ + +yield an irreducible given @Coercible (Const a a) (Const a b)@ when @MkConst@ +is out of scope. Would we decompose the wanted +@Coercible (Const a a) (Const a b)@ to @Coercible a b@ we would not be able +to discharge it with the given. +-} +canonNewtypeDecomposition :: + (MonadError MultipleErrors m) => + Environment -> + Maybe [(SourceType, SourceType, SourceType)] -> + SourceType -> + SourceType -> + MaybeT m Canonicalized canonNewtypeDecomposition env (Just givens) a b | (TypeConstructor _ aTyName, _, axs) <- unapplyTypes a , (TypeConstructor _ bTyName, _, bxs) <- unapplyTypes b @@ -861,86 +900,90 @@ canonNewtypeDecomposition env (Just givens) a b decompose env aTyName axs bxs canonNewtypeDecomposition _ _ _ _ = empty --- | Constraints of the form @Coercible (N1 a_0 .. a_n) (N2 b_0 .. b_n)@, where --- @N1@ and @N2@ are different type constructors and either of them is a --- newtype whose constructor is out of scope, are irreducible. -canonNewtypeDecompositionFailure - :: Monad m - => SourceType - -> SourceType - -> MaybeT m Canonicalized +{- | Constraints of the form @Coercible (N1 a_0 .. a_n) (N2 b_0 .. b_n)@, where +@N1@ and @N2@ are different type constructors and either of them is a +newtype whose constructor is out of scope, are irreducible. +-} +canonNewtypeDecompositionFailure :: + (Monad m) => + SourceType -> + SourceType -> + MaybeT m Canonicalized canonNewtypeDecompositionFailure a b - | (TypeConstructor{}, _, _) <- unapplyTypes a - , (TypeConstructor{}, _, _) <- unapplyTypes b - = pure Irreducible + | (TypeConstructor {}, _, _) <- unapplyTypes a + , (TypeConstructor {}, _, _) <- unapplyTypes b = + pure Irreducible | otherwise = empty --- | Constraints of the form @Coercible tv1 tv2@ may be irreducibles, but only --- when the variables are lexicographically ordered. Reordering variables is --- necessary to prevent loops. --- --- For instance the declaration: --- --- @ --- example :: forall a b. Coercible a b => Coercible b a => a -> b --- example = coerce --- @ --- --- yields the irreducible givens @Coercible a b@ and @Coercible b a@ which would --- repeatedly kick each other out the inert set whereas reordering the latter to --- @Coercible a b@ makes it redundant and let us discharge it. -canonTypeVars - :: Monad m - => SourceType - -> SourceType - -> MaybeT m Canonicalized +{- | Constraints of the form @Coercible tv1 tv2@ may be irreducibles, but only +when the variables are lexicographically ordered. Reordering variables is +necessary to prevent loops. + +For instance the declaration: + +@ +example :: forall a b. Coercible a b => Coercible b a => a -> b +example = coerce +@ + +yields the irreducible givens @Coercible a b@ and @Coercible b a@ which would +repeatedly kick each other out the inert set whereas reordering the latter to +@Coercible a b@ makes it redundant and let us discharge it. +-} +canonTypeVars :: + (Monad m) => + SourceType -> + SourceType -> + MaybeT m Canonicalized canonTypeVars a b | Skolem _ tv1 _ _ _ <- a , Skolem _ tv2 _ _ _ <- b - , tv2 < tv1 - = pure . Canonicalized $ S.singleton (b, a) - | Skolem{} <- a, Skolem{} <- b - = pure Irreducible + , tv2 < tv1 = + pure . Canonicalized $ S.singleton (b, a) + | Skolem {} <- a + , Skolem {} <- b = + pure Irreducible | otherwise = empty -- | Constraints of the form @Coercible tv ty@ are irreducibles. -canonTypeVarLeft - :: Monad m - => SourceType - -> SourceType - -> MaybeT m Canonicalized +canonTypeVarLeft :: + (Monad m) => + SourceType -> + SourceType -> + MaybeT m Canonicalized canonTypeVarLeft a _ - | Skolem{} <- a = pure Irreducible + | Skolem {} <- a = pure Irreducible | otherwise = empty --- | Constraints of the form @Coercible ty tv@ are reordered to --- @Coercible tv ty@ to satisfy the canonicality requirement of having the type --- variable on the left. -canonTypeVarRight - :: Monad m - => SourceType - -> SourceType - -> MaybeT m Canonicalized +{- | Constraints of the form @Coercible ty tv@ are reordered to +@Coercible tv ty@ to satisfy the canonicality requirement of having the type +variable on the left. +-} +canonTypeVarRight :: + (Monad m) => + SourceType -> + SourceType -> + MaybeT m Canonicalized canonTypeVarRight a b - | Skolem{} <- b = pure . Canonicalized $ S.singleton (b, a) + | Skolem {} <- b = pure . Canonicalized $ S.singleton (b, a) | otherwise = empty -- | Constraints of the form @Coercible (f a_0 .. a_n) b@ are irreducibles. -canonApplicationLeft - :: Monad m - => SourceType - -> SourceType - -> MaybeT m Canonicalized +canonApplicationLeft :: + (Monad m) => + SourceType -> + SourceType -> + MaybeT m Canonicalized canonApplicationLeft a _ - | TypeApp{} <- a = pure Irreducible + | TypeApp {} <- a = pure Irreducible | otherwise = empty -- | Constraints of the form @Coercible a (f b_0 .. b_n) b@ are irreducibles. -canonApplicationRight - :: Monad m - => SourceType - -> SourceType - -> MaybeT m Canonicalized +canonApplicationRight :: + (Monad m) => + SourceType -> + SourceType -> + MaybeT m Canonicalized canonApplicationRight _ b - | TypeApp{} <- b = pure Irreducible + | TypeApp {} <- b = pure Irreducible | otherwise = empty diff --git a/src/Language/PureScript/TypeChecker/Entailment/IntCompare.hs b/src/Language/PureScript/TypeChecker/Entailment/IntCompare.hs index 802e9d611..72c2f94de 100644 --- a/src/Language/PureScript/TypeChecker/Entailment/IntCompare.hs +++ b/src/Language/PureScript/TypeChecker/Entailment/IntCompare.hs @@ -1,7 +1,7 @@ --- | --- Graph-based solver for comparing type-level numbers with respect to --- reflexivity, symmetry, and transitivity properties. --- +{- | +Graph-based solver for comparing type-level numbers with respect to +reflexivity, symmetry, and transitivity properties. +-} module Language.PureScript.TypeChecker.Entailment.IntCompare where import Protolude @@ -9,9 +9,9 @@ import Protolude import Data.Graph qualified as G import Data.Map qualified as M +import Language.PureScript.Constants.Prim qualified as P import Language.PureScript.Names qualified as P import Language.PureScript.Types qualified as P -import Language.PureScript.Constants.Prim qualified as P data Relation a = Equal a a @@ -43,38 +43,38 @@ type PSOrdering = P.Qualified (P.ProperName 'P.TypeName) -- ╔═══╗ ╔═══╗ ╔═══╗ ╔═══╗ -- ║ a ║ -> ║ b ║ -> ║ c ║ <-> ║ d ║ -- ╚═══╝ ╚═══╝ ╚═══╝ ╚═══╝ -solveRelation :: forall a. Ord a => Context a -> a -> a -> Maybe PSOrdering +solveRelation :: forall a. (Ord a) => Context a -> a -> a -> Maybe PSOrdering solveRelation context lhs rhs = - if lhs == rhs then - pure P.EQ - else do - let (graph, search) = inequalities - lhs' <- search lhs - rhs' <- search rhs - case (G.path graph lhs' rhs', G.path graph rhs' lhs') of - (True, True) -> - pure P.EQ - (True, False) -> - pure P.LT - (False, True) -> - pure P.GT - _ -> - Nothing + if lhs == rhs + then pure P.EQ + else do + let (graph, search) = inequalities + lhs' <- search lhs + rhs' <- search rhs + case (G.path graph lhs' rhs', G.path graph rhs' lhs') of + (True, True) -> + pure P.EQ + (True, False) -> + pure P.LT + (False, True) -> + pure P.GT + _ -> + Nothing where - inequalities :: (G.Graph, a -> Maybe G.Vertex) - inequalities = makeGraph $ clean $ foldMap convert context - where - convert :: Relation a -> [(a, [a])] - convert (Equal a b) = [(a, [b]), (b, [a])] - convert (LessThan a b) = [(a, [b]), (b, [])] + inequalities :: (G.Graph, a -> Maybe G.Vertex) + inequalities = makeGraph $ clean $ foldMap convert context + where + convert :: Relation a -> [(a, [a])] + convert (Equal a b) = [(a, [b]), (b, [a])] + convert (LessThan a b) = [(a, [b]), (b, [])] - makeGraph :: [(a, [a])] -> (G.Graph, a -> Maybe G.Vertex) - makeGraph m = - case G.graphFromEdges $ (\(a, b) -> (a, a, b)) <$> m of - (g, _, f) -> (g, f) + makeGraph :: [(a, [a])] -> (G.Graph, a -> Maybe G.Vertex) + makeGraph m = + case G.graphFromEdges $ (\(a, b) -> (a, a, b)) <$> m of + (g, _, f) -> (g, f) - clean :: forall k. Ord k => [(k, [k])] -> [(k, [k])] - clean = M.toList . M.fromListWith (<>) + clean :: forall k. (Ord k) => [(k, [k])] -> [(k, [k])] + clean = M.toList . M.fromListWith (<>) mkRelation :: P.Type a -> P.Type a -> P.Type a -> Maybe (Relation (P.Type a)) mkRelation lhs rhs rel = case rel of @@ -88,15 +88,15 @@ mkRelation lhs rhs rel = case rel of mkFacts :: [[P.Type a]] -> [Relation (P.Type a)] mkFacts = mkRels [] . sort . findFacts where - mkRels a [] = concat a - mkRels a (x : xs) = mkRels (map (LessThan x) xs : a) xs + mkRels a [] = concat a + mkRels a (x : xs) = mkRels (map (LessThan x) xs : a) xs - findFacts = mapMaybe $ \case - [P.TypeLevelInt _ _, P.TypeLevelInt _ _, _] -> - Nothing - [i@(P.TypeLevelInt _ _), _, _] -> - Just i - [_, i@(P.TypeLevelInt _ _), _] -> - Just i - _ -> - Nothing + findFacts = mapMaybe $ \case + [P.TypeLevelInt _ _, P.TypeLevelInt _ _, _] -> + Nothing + [i@(P.TypeLevelInt _ _), _, _] -> + Just i + [_, i@(P.TypeLevelInt _ _), _] -> + Just i + _ -> + Nothing diff --git a/src/Language/PureScript/TypeChecker/Kinds.hs b/src/Language/PureScript/TypeChecker/Kinds.hs index 5be87c005..ce862790c 100644 --- a/src/Language/PureScript/TypeChecker/Kinds.hs +++ b/src/Language/PureScript/TypeChecker/Kinds.hs @@ -1,38 +1,38 @@ --- | --- This module implements the kind checker --- -module Language.PureScript.TypeChecker.Kinds - ( kindOf - , kindOfWithUnknowns - , kindOfWithScopedVars - , kindOfData - , kindOfTypeSynonym - , kindOfClass - , kindsOfAll - , unifyKinds - , unifyKinds' - , subsumesKind - , instantiateKind - , checkKind - , inferKind - , elaborateKind - , checkConstraint - , checkInstanceDeclaration - , checkKindDeclaration - , checkTypeKind - , unknownsWithKinds - , freshKind - , freshKindWithKind - ) where +{- | +This module implements the kind checker +-} +module Language.PureScript.TypeChecker.Kinds ( + kindOf, + kindOfWithUnknowns, + kindOfWithScopedVars, + kindOfData, + kindOfTypeSynonym, + kindOfClass, + kindsOfAll, + unifyKinds, + unifyKinds', + subsumesKind, + instantiateKind, + checkKind, + inferKind, + elaborateKind, + checkConstraint, + checkInstanceDeclaration, + checkKindDeclaration, + checkTypeKind, + unknownsWithKinds, + freshKind, + freshKindWithKind, +) where import Prelude import Control.Arrow ((***)) import Control.Lens ((^.), _1, _2, _3) import Control.Monad (join, unless, void, when, (<=<)) -import Control.Monad.Error.Class (MonadError(..)) +import Control.Monad.Error.Class (MonadError (..)) import Control.Monad.State (MonadState, gets, modify) -import Control.Monad.Supply.Class (MonadSupply(..)) +import Control.Monad.Supply.Class (MonadSupply (..)) import Data.Bifunctor (first, second) import Data.Bitraversable (bitraverse) @@ -47,48 +47,110 @@ import Data.Text (Text) import Data.Text qualified as T import Data.Traversable (for) +import Language.PureScript.CST.Types (Comment) import Language.PureScript.Crash (HasCallStack, internalError) import Language.PureScript.Environment qualified as E import Language.PureScript.Errors -import Language.PureScript.Names (pattern ByNullSourcePos, ModuleName, Name(..), ProperName(..), ProperNameType(..), Qualified(..), QualifiedBy(..), coerceProperName, mkQualified) -import Language.PureScript.TypeChecker.Monad (CheckState(..), Substitution(..), UnkLevel(..), Unknown, bindLocalTypeVariables, debugType, getEnv, lookupTypeVariable, unsafeCheckCurrentModule, withErrorMessageHint, withFreshSubstitution) +import Language.PureScript.Names (ModuleName, Name (..), ProperName (..), ProperNameType (..), Qualified (..), QualifiedBy (..), coerceProperName, mkQualified, pattern ByNullSourcePos) +import Language.PureScript.Pretty.Types (prettyPrintType) +import Language.PureScript.TypeChecker.Monad (CheckState (..), Substitution (..), UnkLevel (..), Unknown, bindLocalTypeVariables, debugType, getEnv, lookupTypeVariable, unsafeCheckCurrentModule, withErrorMessageHint, withFreshSubstitution) import Language.PureScript.TypeChecker.Skolems (newSkolemConstant, newSkolemScope, skolemize) import Language.PureScript.TypeChecker.Synonyms (replaceAllTypeSynonyms) import Language.PureScript.Types -import Language.PureScript.Pretty.Types (prettyPrintType) +import Data.Bifunctor (bimap) +import Debug.Trace +import Language.Purus.Pretty.Types (prettyTypeStr) + +moduleTraces :: Bool +moduleTraces = True + +goTrace :: forall x. String -> x -> x +goTrace str x + | moduleTraces = trace str x + | otherwise = x + +goTraceM :: forall f. (Applicative f) => String -> f () +goTraceM msg + | moduleTraces = traceM msg + | otherwise = pure () + +spacer = '\n' : replicate 20 '-' +prettySubstitution :: Substitution -> String +prettySubstitution Substitution {..} = + "SUBSTITUTION: " + <> "\n SUBST_TYPE: " + <> show (bimap show prettyTypeStr <$> M.toList substType) + <> "\n SUBST_UNSOLVED: " + <> show (bimap show (bimap show prettyTypeStr) <$> M.toList substUnsolved) + <> "\n SUBST_NAMES: " + <> show (M.toList substNames) + +-- TODO/REVIEW/HACK: ----------------------------------- +-- NO CLUE IF THE CHANGES I MADE HERE ARE CORRECT generalizeUnknowns :: [(Unknown, SourceType)] -> SourceType -> SourceType generalizeUnknowns unks ty = - generalizeUnknownsWithVars (unknownVarNames (usedTypeVariables ty) unks) ty + goTrace msg $ + generalizeUnknownsWithVars (unknownVarNames (fst <$> usedTypeVariables ty) unks) ty + where + result = generalizeUnknownsWithVars (unknownVarNames (fst <$> usedTypeVariables ty) unks) ty + msg = + "GENERALIZE UNKNOWNS:\nUNKNOWNS" + <> prettyUnknowns + <> "\n INPUT TYPE: " + <> prettyTypeStr ty + <> "\n OUTPUT TYPE: " + <> prettyTypeStr result + <> spacer + prettyUnknowns = concatMap (\x -> show (fst x) <> " :: " <> show (snd x) <> "\n") unks generalizeUnknownsWithVars :: [(Unknown, (Text, SourceType))] -> SourceType -> SourceType generalizeUnknownsWithVars binders ty = - mkForAll ((getAnnForType ty,) . fmap (Just . replaceUnknownsWithVars binders) . snd <$> binders) . replaceUnknownsWithVars binders $ ty - -replaceUnknownsWithVars :: [(Unknown, (Text, a))] -> SourceType -> SourceType + goTrace msg $ + mkForAll ((getAnnForType ty,) . fmap (replaceUnknownsWithVars binders) . snd <$> binders) . replaceUnknownsWithVars binders $ + ty + where + prettyBinders :: [(Unknown, (Text, SourceType))] -> String + prettyBinders xs = concatMap (\x -> show (fst x) <> ", " <> T.unpack (fst (snd x)) <> " := " <> prettyTypeStr (snd (snd x)) <> "\n") xs + + msg = + "GENERALIZE UNKNOWNS WITH VARS:" + <> "\n UNKNOWNS: " + <> prettyBinders binders + <> "\n TYPE: " + <> prettyTypeStr ty + <> spacer + +replaceUnknownsWithVars :: [(Unknown, (Text, SourceType))] -> SourceType -> SourceType replaceUnknownsWithVars binders ty | null binders = ty | otherwise = go ty where - go :: SourceType -> SourceType - go = everywhereOnTypes $ \case - TUnknown ann unk | Just (name, _) <- lookup unk binders -> TypeVar ann name - other -> other + go :: SourceType -> SourceType + go = everywhereOnTypes $ \case + TUnknown ann unk | Just (name, ki) <- lookup unk binders -> TypeVar ann name ki + other -> other unknownVarNames :: [Text] -> [(Unknown, SourceType)] -> [(Unknown, (Text, SourceType))] unknownVarNames used unks = zipWith (\(a, b) n -> (a, (n, b))) unks $ allVars \\ used where - allVars :: [Text] - allVars - | [_] <- unks = "k" : vars - | otherwise = vars + allVars :: [Text] + allVars + | [_] <- unks = "k" : vars + | otherwise = vars - vars :: [Text] - vars = fmap (("k" <>) . T.pack . show) ([1..] :: [Int]) + vars :: [Text] + vars = fmap (("k" <>) . T.pack . show) ([1 ..] :: [Int]) apply :: (MonadState CheckState m) => SourceType -> m SourceType -apply ty = flip substituteType ty <$> gets checkSubstitution +apply ty = goTrace msg $ flip substituteType ty <$> gets checkSubstitution + where + msg = + "APPLY" + <> "\n TYPE: " + <> prettyTypeStr ty + <> spacer substituteType :: Substitution -> SourceType -> SourceType substituteType sub = everywhereOnTypes $ \case @@ -103,7 +165,7 @@ substituteType sub = everywhereOnTypes $ \case freshUnknown :: (MonadState CheckState m) => m Unknown freshUnknown = do k <- gets checkNextType - modify $ \st -> st { checkNextType = k + 1 } + modify $ \st -> st {checkNextType = k + 1} pure k freshKind :: (MonadState CheckState m) => SourceSpan -> m SourceType @@ -123,130 +185,140 @@ addUnsolved lvl unk kind = modify $ \st -> do Just (UnkLevel lvl') -> lvl' <> pure unk subs = checkSubstitution st uns = M.insert unk (newLvl, kind) $ substUnsolved subs - st { checkSubstitution = subs { substUnsolved = uns } } + st {checkSubstitution = subs {substUnsolved = uns}} solve :: (MonadState CheckState m) => Unknown -> SourceType -> m () solve unk solution = modify $ \st -> do let subs = checkSubstitution st tys = M.insert unk solution $ substType subs - st { checkSubstitution = subs { substType = tys } } + st {checkSubstitution = subs {substType = tys}} -lookupUnsolved - :: (MonadState CheckState m, MonadError MultipleErrors m, HasCallStack) - => Unknown - -> m (UnkLevel, SourceType) +lookupUnsolved :: + (MonadState CheckState m, MonadError MultipleErrors m, HasCallStack) => + Unknown -> + m (UnkLevel, SourceType) lookupUnsolved u = do uns <- gets (substUnsolved . checkSubstitution) case M.lookup u uns of Nothing -> internalCompilerError $ "Unsolved unification variable ?" <> T.pack (show u) <> " is not bound" Just res -> return res -unknownsWithKinds - :: forall m. (MonadState CheckState m, MonadError MultipleErrors m, HasCallStack) - => [Unknown] - -> m [(Unknown, SourceType)] +unknownsWithKinds :: + forall m. + (MonadState CheckState m, MonadError MultipleErrors m, HasCallStack) => + [Unknown] -> + m [(Unknown, SourceType)] unknownsWithKinds = fmap (fmap snd . nubBy ((==) `on` fst) . sortOn fst . join) . traverse go where - go u = do - (lvl, ty) <- traverse apply =<< lookupUnsolved u - rest <- fmap join . traverse go . IS.toList . unknowns $ ty - pure $ (lvl, (u, ty)) : rest - -inferKind - :: (MonadError MultipleErrors m, MonadState CheckState m, HasCallStack) - => SourceType - -> m (SourceType, SourceType) + go u = do + (lvl, ty) <- traverse apply =<< lookupUnsolved u + rest <- fmap join . traverse go . IS.toList . unknowns $ ty + pure $ (lvl, (u, ty)) : rest + +inferKind :: + (MonadError MultipleErrors m, MonadState CheckState m, HasCallStack) => + SourceType -> + m (SourceType, SourceType) inferKind = \tyToInfer -> withErrorMessageHint (ErrorInferringKind tyToInfer) . rethrowWithPosition (fst $ getAnnForType tyToInfer) - $ go tyToInfer + $ do + result <- go tyToInfer + let msg = + "\nINFERKIND INPUT: " + <> prettyTypeStr tyToInfer + <> "\nINFERKIND RESULT: " + <> prettyTypeStr (snd result) + <> "\n" + <> replicate 20 '-' + goTraceM msg + pure result where - go = \case - ty@(TypeConstructor ann v) -> do - env <- getEnv - case M.lookup v (E.types env) of - Nothing -> - throwError . errorMessage' (fst ann) . UnknownName . fmap TyName $ v - Just (kind, E.LocalTypeVariable) -> do - kind' <- apply kind - pure (ty, kind' $> ann) - Just (kind, _) -> do - pure (ty, kind $> ann) - ConstrainedType ann' con@(Constraint ann v _ _ _) ty -> do - env <- getEnv - con' <- case M.lookup (coerceProperName <$> v) (E.types env) of - Nothing -> - throwError . errorMessage' (fst ann) . UnknownName . fmap TyClassName $ v - Just _ -> - checkConstraint con - ty' <- checkIsSaturatedType ty - con'' <- applyConstraint con' - pure (ConstrainedType ann' con'' ty', E.kindType $> ann') - ty@(TypeLevelString ann _) -> - pure (ty, E.kindSymbol $> ann) - ty@(TypeLevelInt ann _) -> - pure (ty, E.tyInt $> ann) - ty@(TypeVar ann v) -> do - moduleName <- unsafeCheckCurrentModule - kind <- apply =<< lookupTypeVariable moduleName (Qualified ByNullSourcePos $ ProperName v) - pure (ty, kind $> ann) - ty@(Skolem ann _ mbK _ _) -> do - kind <- apply $ fromMaybe (internalError "Skolem has no kind") mbK - pure (ty, kind $> ann) - ty@(TUnknown ann u) -> do - kind <- apply . snd =<< lookupUnsolved u - pure (ty, kind $> ann) - ty@(TypeWildcard ann _) -> do - k <- freshKind (fst ann) - pure (ty, k $> ann) - ty@(REmpty ann) -> do - pure (ty, E.kindOfREmpty $> ann) - ty@(RCons ann _ _ _) | (rowList, rowTail) <- rowToList ty -> do - kr <- freshKind (fst ann) - rowList' <- for rowList $ \(RowListItem a lbl t) -> - RowListItem a lbl <$> checkKind t kr - rowTail' <- checkKind rowTail $ E.kindRow kr - kr' <- apply kr - pure (rowFromList (rowList', rowTail'), E.kindRow kr' $> ann) - TypeApp ann t1 t2 -> do - (t1', k1) <- go t1 - inferAppKind ann (t1', k1) t2 - KindApp ann t1 t2 -> do - (t1', kind) <- bitraverse pure apply =<< go t1 - case kind of - ForAll _ _ arg (Just argKind) resKind _ -> do - t2' <- checkKind t2 argKind - pure (KindApp ann t1' t2', replaceTypeVars arg t2' resKind) - _ -> - internalError "inferKind: unkinded forall binder" - KindedType _ t1 t2 -> do - t2' <- replaceAllTypeSynonyms . fst =<< go t2 - t1' <- checkKind t1 t2' - t2'' <- apply t2' - pure (t1', t2'') - ForAll ann vis arg mbKind ty sc -> do - moduleName <- unsafeCheckCurrentModule - kind <- case mbKind of - Just k -> replaceAllTypeSynonyms =<< checkIsSaturatedType k - Nothing -> freshKind (fst ann) - (ty', unks) <- bindLocalTypeVariables moduleName [(ProperName arg, kind)] $ do - ty' <- apply =<< checkIsSaturatedType ty - unks <- unknownsWithKinds . IS.toList $ unknowns ty' - pure (ty', unks) - for_ unks . uncurry $ addUnsolved Nothing - pure (ForAll ann vis arg (Just kind) ty' sc, E.kindType $> ann) - ParensInType _ ty -> - go ty - ty -> - internalError $ "inferKind: Unimplemented case \n" <> prettyPrintType 100 ty - -inferAppKind - :: (MonadError MultipleErrors m, MonadState CheckState m, HasCallStack) - => SourceAnn - -> (SourceType, SourceType) - -> SourceType - -> m (SourceType, SourceType) + go = \case + ty@(TypeConstructor ann v) -> do + env <- getEnv + case M.lookup v (E.types env) of + Nothing -> + throwError . errorMessage' (fst ann) . UnknownName . fmap TyName $ v + Just (kind, E.LocalTypeVariable) -> do + kind' <- apply kind + pure (ty, kind' $> ann) + Just (kind, _) -> do + pure (ty, kind $> ann) + ConstrainedType ann' con@(Constraint ann v _ _ _) ty -> do + env <- getEnv + con' <- case M.lookup (coerceProperName <$> v) (E.types env) of + Nothing -> + throwError . errorMessage' (fst ann) . UnknownName . fmap TyClassName $ v + Just _ -> + checkConstraint con + ty' <- checkIsSaturatedType ty + con'' <- applyConstraint con' + pure (ConstrainedType ann' con'' ty', E.kindType $> ann') + ty@(TypeLevelString ann _) -> + pure (ty, E.kindSymbol $> ann) + ty@(TypeLevelInt ann _) -> + pure (ty, E.tyInt $> ann) + ty@(TypeVar ann v kx) -> do + -- moduleName <- unsafeCheckCurrentModule + -- kind <- apply =<< lookupTypeVariable moduleName (Qualified ByNullSourcePos $ ProperName v) + pure (ty, kx $> ann) + ty@(Skolem ann _ mbK _ _) -> do + kind <- apply $ mbK + pure (ty, kind $> ann) + ty@(TUnknown ann u) -> do + kind <- apply . snd =<< lookupUnsolved u + pure (ty, kind $> ann) + ty@(TypeWildcard ann _) -> do + k <- freshKind (fst ann) + pure (ty, k $> ann) + ty@(REmpty ann) -> do + pure (ty, E.kindOfREmpty $> ann) + ty@(RCons ann _ _ _) | (rowList, rowTail) <- rowToList ty -> do + kr <- freshKind (fst ann) + rowList' <- for rowList $ \(RowListItem a lbl t) -> + RowListItem a lbl <$> checkKind t kr + rowTail' <- checkKind rowTail $ E.kindRow kr + kr' <- apply kr + pure (rowFromList (rowList', rowTail'), E.kindRow kr' $> ann) + TypeApp ann t1 t2 -> do + (t1', k1) <- go t1 + inferAppKind ann (t1', k1) t2 + KindApp ann t1 t2 -> do + (t1', kind) <- bitraverse pure apply =<< go t1 + case kind of + ForAll _ _ arg argKind resKind _ -> do + t2' <- checkKind t2 argKind + pure (KindApp ann t1' t2', replaceTypeVars arg t2' resKind) + _ -> + internalError "inferKind: unkinded forall binder" + KindedType _ t1 t2 -> do + t2' <- replaceAllTypeSynonyms . fst =<< go t2 + t1' <- checkKind t1 t2' + t2'' <- apply t2' + pure (t1', t2'') + ForAll ann vis arg k ty sc -> do + moduleName <- unsafeCheckCurrentModule + kind <- replaceAllTypeSynonyms =<< checkIsSaturatedType k + + (ty', unks) <- bindLocalTypeVariables moduleName [(ProperName arg, kind)] $ do + ty' <- apply =<< checkIsSaturatedType ty + unks <- unknownsWithKinds . IS.toList $ unknowns ty' + pure (ty', unks) + for_ unks . uncurry $ addUnsolved Nothing + pure (ForAll ann vis arg kind ty' sc, E.kindType $> ann) + ParensInType _ ty -> + go ty + ty -> + internalError $ "inferKind: Unimplemented case \n" <> prettyPrintType 100 ty + +inferAppKind :: + (MonadError MultipleErrors m, MonadState CheckState m, HasCallStack) => + SourceAnn -> + (SourceType, SourceType) -> + SourceType -> + m (SourceType, SourceType) inferAppKind ann (fn, fnKind) arg = case fnKind of TypeApp _ (TypeApp _ arrKind argKind) resKind | eqType arrKind E.tyFunction -> do expandSynonyms <- requiresSynonymsToExpand fn @@ -261,82 +333,83 @@ inferAppKind ann (fn, fnKind) arg = case fnKind of solve u $ (TUnknown ann u1 E.-:> TUnknown ann u2) $> ann arg' <- checkKind arg $ TUnknown ann u1 pure (TypeApp ann fn arg', TUnknown ann u2) - ForAll _ _ a (Just k) ty _ -> do + ForAll _ _ a k ty _ -> do u <- freshUnknown addUnsolved Nothing u k inferAppKind ann (KindApp ann fn (TUnknown ann u), replaceTypeVars a (TUnknown ann u) ty) arg _ -> cannotApplyTypeToType fn arg where - requiresSynonymsToExpand = \case - TypeConstructor _ v -> M.notMember v . E.typeSynonyms <$> getEnv - TypeApp _ l _ -> requiresSynonymsToExpand l - KindApp _ l _ -> requiresSynonymsToExpand l - _ -> pure True - -cannotApplyTypeToType - :: (MonadError MultipleErrors m, MonadState CheckState m, HasCallStack) - => SourceType - -> SourceType - -> m a + requiresSynonymsToExpand = \case + TypeConstructor _ v -> M.notMember v . E.typeSynonyms <$> getEnv + TypeApp _ l _ -> requiresSynonymsToExpand l + KindApp _ l _ -> requiresSynonymsToExpand l + _ -> pure True + +cannotApplyTypeToType :: + (MonadError MultipleErrors m, MonadState CheckState m, HasCallStack) => + SourceType -> + SourceType -> + m a cannotApplyTypeToType fn arg = do argKind <- snd <$> inferKind arg _ <- checkKind fn . srcTypeApp (srcTypeApp E.tyFunction argKind) =<< freshKind nullSourceSpan internalCompilerError . T.pack $ "Cannot apply type to type: " <> debugType (srcTypeApp fn arg) -cannotApplyKindToType - :: (MonadError MultipleErrors m, MonadState CheckState m, HasCallStack) - => SourceType - -> SourceType - -> m a +cannotApplyKindToType :: + (MonadError MultipleErrors m, MonadState CheckState m, HasCallStack) => + SourceType -> + SourceType -> + m a cannotApplyKindToType poly arg = do let ann = getAnnForType arg argKind <- snd <$> inferKind arg - _ <- checkKind poly . mkForAll [(ann, ("k", Just argKind))] =<< freshKind nullSourceSpan + _ <- checkKind poly . mkForAll [(ann, ("k", argKind))] =<< freshKind nullSourceSpan internalCompilerError . T.pack $ "Cannot apply kind to type: " <> debugType (srcKindApp poly arg) -checkKind - :: (MonadError MultipleErrors m, MonadState CheckState m, HasCallStack) - => SourceType - -> SourceType - -> m SourceType +checkKind :: + (MonadError MultipleErrors m, MonadState CheckState m, HasCallStack) => + SourceType -> + SourceType -> + m SourceType checkKind = checkKind' False --- | `checkIsSaturatedType t` is identical to `checkKind t E.kindType` except --- that the former checks that the type synonyms in `t` expand completely. This --- is the appropriate function to use when expanding the types of type --- parameter kinds, arguments to data constructors, etc., in order for the --- PartiallyAppliedSynonym error to take precedence over the KindsDoNotUnify --- error. --- -checkIsSaturatedType - :: (MonadError MultipleErrors m, MonadState CheckState m, HasCallStack) - => SourceType - -> m SourceType +{- | `checkIsSaturatedType t` is identical to `checkKind t E.kindType` except +that the former checks that the type synonyms in `t` expand completely. This +is the appropriate function to use when expanding the types of type +parameter kinds, arguments to data constructors, etc., in order for the +PartiallyAppliedSynonym error to take precedence over the KindsDoNotUnify +error. +-} +checkIsSaturatedType :: + (MonadError MultipleErrors m, MonadState CheckState m, HasCallStack) => + SourceType -> + m SourceType checkIsSaturatedType ty = checkKind' True ty E.kindType -checkKind' - :: (MonadError MultipleErrors m, MonadState CheckState m, HasCallStack) - => Bool - -> SourceType - -> SourceType - -> m SourceType +checkKind' :: + (MonadError MultipleErrors m, MonadState CheckState m, HasCallStack) => + Bool -> + SourceType -> + SourceType -> + m SourceType checkKind' requireSynonymsToExpand ty kind2 = do withErrorMessageHint (ErrorCheckingKind ty kind2) - . rethrowWithPosition (fst $ getAnnForType ty) $ do - (ty', kind1) <- inferKind ty - kind1' <- apply kind1 - kind2' <- apply kind2 - when requireSynonymsToExpand $ void $ replaceAllTypeSynonyms ty' - instantiateKind (ty', kind1') kind2' - -instantiateKind - :: (MonadError MultipleErrors m, MonadState CheckState m, HasCallStack) - => (SourceType, SourceType) - -> SourceType - -> m SourceType + . rethrowWithPosition (fst $ getAnnForType ty) + $ do + (ty', kind1) <- inferKind ty + kind1' <- apply kind1 + kind2' <- apply kind2 + when requireSynonymsToExpand $ void $ replaceAllTypeSynonyms ty' + instantiateKind (ty', kind1') kind2' + +instantiateKind :: + (MonadError MultipleErrors m, MonadState CheckState m, HasCallStack) => + (SourceType, SourceType) -> + SourceType -> + m SourceType instantiateKind (ty, kind1) kind2 = case kind1 of - ForAll _ _ a (Just k) t _ | shouldInstantiate kind2 -> do + ForAll _ _ a k t _ | shouldInstantiate kind2 -> do let ann = getAnnForType ty u <- freshKindWithKind (fst ann) k instantiateKind (KindApp ann ty u, replaceTypeVars a u t) kind2 @@ -344,141 +417,154 @@ instantiateKind (ty, kind1) kind2 = case kind1 of subsumesKind kind1 kind2 pure ty where - shouldInstantiate = not . \case - ForAll _ _ _ _ _ _ -> True - _ -> False - -subsumesKind - :: (MonadError MultipleErrors m, MonadState CheckState m, HasCallStack) - => SourceType - -> SourceType - -> m () + shouldInstantiate = + not . \case + ForAll _ _ _ _ _ _ -> True + _ -> False + +subsumesKind :: + (MonadError MultipleErrors m, MonadState CheckState m, HasCallStack) => + SourceType -> + SourceType -> + m () subsumesKind = go where - go = curry $ \case - (TypeApp _ (TypeApp _ arr1 a1) a2, TypeApp _ (TypeApp _ arr2 b1) b2) - | eqType arr1 E.tyFunction - , eqType arr2 E.tyFunction -> do - go b1 a1 - join $ go <$> apply a2 <*> apply b2 - (a, ForAll ann _ var mbKind b mbScope) -> do - scope <- maybe newSkolemScope pure mbScope - skolc <- newSkolemConstant - go a $ skolemize ann var mbKind skolc scope b - (ForAll ann _ var (Just kind) a _, b) -> do - a' <- freshKindWithKind (fst ann) kind - go (replaceTypeVars var a' a) b - (TUnknown ann u, b@(TypeApp _ (TypeApp _ arr _) _)) - | eqType arr E.tyFunction - , IS.notMember u (unknowns b) -> - join $ go <$> solveUnknownAsFunction ann u <*> pure b - (a@(TypeApp _ (TypeApp _ arr _) _), TUnknown ann u) - | eqType arr E.tyFunction - , IS.notMember u (unknowns a) -> - join $ go <$> pure a <*> solveUnknownAsFunction ann u - (a, b) -> - unifyKinds a b - -unifyKinds - :: (MonadError MultipleErrors m, MonadState CheckState m, HasCallStack) - => SourceType - -> SourceType - -> m () + go = curry $ \case + (TypeApp _ (TypeApp _ arr1 a1) a2, TypeApp _ (TypeApp _ arr2 b1) b2) + | eqType arr1 E.tyFunction + , eqType arr2 E.tyFunction -> do + go b1 a1 + join $ go <$> apply a2 <*> apply b2 + (a, ForAll ann _ var mbKind b mbScope) -> do + scope <- maybe newSkolemScope pure mbScope + skolc <- newSkolemConstant + go a $ skolemize ann var mbKind skolc scope b + (ForAll ann _ var (kind) a _, b) -> do + a' <- freshKindWithKind (fst ann) kind + go (replaceTypeVars var a' a) b + (TUnknown ann u, b@(TypeApp _ (TypeApp _ arr _) _)) + | eqType arr E.tyFunction + , IS.notMember u (unknowns b) -> + join $ go <$> solveUnknownAsFunction ann u <*> pure b + (a@(TypeApp _ (TypeApp _ arr _) _), TUnknown ann u) + | eqType arr E.tyFunction + , IS.notMember u (unknowns a) -> + join $ go <$> pure a <*> solveUnknownAsFunction ann u + (a, b) -> + unifyKinds a b + +unifyKinds :: + (MonadError MultipleErrors m, MonadState CheckState m, HasCallStack) => + SourceType -> + SourceType -> + m () unifyKinds = unifyKindsWithFailure $ \w1 w2 -> throwError . errorMessage''' (fst . getAnnForType <$> [w1, w2]) $ KindsDoNotUnify w1 w2 --- | Does not attach positions to the error node, instead relies on the --- | local position context. This is useful when invoking kind unification --- | outside of kind checker internals. -unifyKinds' - :: (MonadError MultipleErrors m, MonadState CheckState m, HasCallStack) - => SourceType - -> SourceType - -> m () +{- | Does not attach positions to the error node, instead relies on the +| local position context. This is useful when invoking kind unification +| outside of kind checker internals. +-} +unifyKinds' :: + (MonadError MultipleErrors m, MonadState CheckState m, HasCallStack) => + SourceType -> + SourceType -> + m () unifyKinds' = unifyKindsWithFailure $ \w1 w2 -> throwError . errorMessage $ KindsDoNotUnify w1 w2 -- | Check the kind of a type, failing if it is not of kind *. -checkTypeKind - :: (MonadError MultipleErrors m, MonadState CheckState m, HasCallStack) - => SourceType - -> SourceType - -> m () +checkTypeKind :: + (MonadError MultipleErrors m, MonadState CheckState m, HasCallStack) => + SourceType -> + SourceType -> + m () checkTypeKind ty kind = unifyKindsWithFailure (\_ _ -> throwError . errorMessage $ ExpectedType ty kind) kind E.kindType -unifyKindsWithFailure - :: (MonadError MultipleErrors m, MonadState CheckState m, HasCallStack) - => (SourceType -> SourceType -> m ()) - -> SourceType - -> SourceType - -> m () +unifyKindsWithFailure :: + (MonadError MultipleErrors m, MonadState CheckState m, HasCallStack) => + (SourceType -> SourceType -> m ()) -> + SourceType -> + SourceType -> + m () unifyKindsWithFailure onFailure = go where - goWithLabel l t1 t2 = withErrorMessageHint (ErrorInRowLabel l) $ go t1 t2 - go = curry $ \case - (TypeApp _ p1 p2, TypeApp _ p3 p4) -> do - go p1 p3 - join $ go <$> apply p2 <*> apply p4 - (KindApp _ p1 p2, KindApp _ p3 p4) -> do - go p1 p3 - join $ go <$> apply p2 <*> apply p4 - (r1@(RCons _ _ _ _), r2) -> - unifyRows r1 r2 - (r1, r2@(RCons _ _ _ _)) -> - unifyRows r1 r2 - (r1@(REmpty _), r2) -> - unifyRows r1 r2 - (r1, r2@(REmpty _)) -> - unifyRows r1 r2 - (w1, w2) | eqType w1 w2 -> - pure () - (TUnknown _ a', p1) -> - solveUnknown a' p1 - (p1, TUnknown _ a') -> - solveUnknown a' p1 - (w1, w2) -> - onFailure w1 w2 - - unifyRows r1 r2 = do - let (matches, rest) = alignRowsWith goWithLabel r1 r2 - sequence_ matches - unifyTails rest - - unifyTails = \case - (([], TUnknown _ a'), (rs, p1)) -> - solveUnknown a' $ rowFromList (rs, p1) - ((rs, p1), ([], TUnknown _ a')) -> - solveUnknown a' $ rowFromList (rs, p1) - (([], w1), ([], w2)) | eqType w1 w2 -> - pure () - ((rs1, TUnknown _ u1), (rs2, TUnknown _ u2)) | u1 /= u2 -> do - rest <- freshKind nullSourceSpan - solveUnknown u1 $ rowFromList (rs2, rest) - solveUnknown u2 $ rowFromList (rs1, rest) - (w1, w2) -> - onFailure (rowFromList w1) (rowFromList w2) - -solveUnknown - :: (MonadError MultipleErrors m, MonadState CheckState m, HasCallStack) - => Unknown - -> SourceType - -> m () + goWithLabel l t1 t2 = withErrorMessageHint (ErrorInRowLabel l) $ go t1 t2 + go tx1 tx2 = goTrace msg $ case (tx1, tx2) of + (TypeApp _ p1 p2, TypeApp _ p3 p4) -> do + go p1 p3 + join $ go <$> apply p2 <*> apply p4 + (KindApp _ p1 p2, KindApp _ p3 p4) -> do + go p1 p3 + join $ go <$> apply p2 <*> apply p4 + (r1@(RCons _ _ _ _), r2) -> + unifyRows r1 r2 + (r1, r2@(RCons _ _ _ _)) -> + unifyRows r1 r2 + (r1@(REmpty _), r2) -> + unifyRows r1 r2 + (r1, r2@(REmpty _)) -> + unifyRows r1 r2 + (w1, w2) + | eqType w1 w2 -> + pure () + (TUnknown _ a', p1) -> + solveUnknown a' p1 + (p1, TUnknown _ a') -> + solveUnknown a' p1 + (w1, w2) -> + onFailure w1 w2 + where + msg = + "UNIFY KINDS WITH FAILURE" + <> "\n Ty1: " + <> prettyTypeStr tx1 + <> "\n Ty2: " + <> prettyTypeStr tx2 + <> "\n" + <> replicate 20 '-' + + unifyRows r1 r2 = do + let (matches, rest) = alignRowsWith goWithLabel r1 r2 + sequence_ matches + unifyTails rest + + unifyTails = \case + (([], TUnknown _ a'), (rs, p1)) -> + solveUnknown a' $ rowFromList (rs, p1) + ((rs, p1), ([], TUnknown _ a')) -> + solveUnknown a' $ rowFromList (rs, p1) + (([], w1), ([], w2)) + | eqType w1 w2 -> + pure () + ((rs1, TUnknown _ u1), (rs2, TUnknown _ u2)) | u1 /= u2 -> do + rest <- freshKind nullSourceSpan + solveUnknown u1 $ rowFromList (rs2, rest) + solveUnknown u2 $ rowFromList (rs1, rest) + (w1, w2) -> + onFailure (rowFromList w1) (rowFromList w2) + +solveUnknown :: + (MonadError MultipleErrors m, MonadState CheckState m, HasCallStack) => + Unknown -> + SourceType -> + m () solveUnknown a' p1 = do p2 <- promoteKind a' p1 w1 <- snd <$> lookupUnsolved a' join $ unifyKinds <$> apply w1 <*> elaborateKind p2 solve a' p2 -solveUnknownAsFunction - :: (MonadError MultipleErrors m, MonadState CheckState m, HasCallStack) - => SourceAnn - -> Unknown - -> m SourceType +solveUnknownAsFunction :: + (MonadError MultipleErrors m, MonadState CheckState m, HasCallStack) => + SourceAnn -> + Unknown -> + m SourceType solveUnknownAsFunction ann u = do lvl <- fst <$> lookupUnsolved u u1 <- freshUnknown @@ -489,32 +575,32 @@ solveUnknownAsFunction ann u = do solve u uarr pure uarr -promoteKind - :: (MonadError MultipleErrors m, MonadState CheckState m, HasCallStack) - => Unknown - -> SourceType - -> m SourceType +promoteKind :: + (MonadError MultipleErrors m, MonadState CheckState m, HasCallStack) => + Unknown -> + SourceType -> + m SourceType promoteKind u2 ty = do lvl2 <- fst <$> lookupUnsolved u2 flip everywhereOnTypesM ty $ \case ty'@(TUnknown ann u1) -> do when (u1 == u2) . throwError . errorMessage . InfiniteKind $ ty (lvl1, k) <- lookupUnsolved u1 - if lvl1 < lvl2 then - pure ty' - else do - k' <- promoteKind u2 =<< apply k - u1' <- freshUnknown - addUnsolved (Just lvl2) u1' k' - solve u1 $ TUnknown ann u1' - pure $ TUnknown ann u1' + if lvl1 < lvl2 + then pure ty' + else do + k' <- promoteKind u2 =<< apply k + u1' <- freshUnknown + addUnsolved (Just lvl2) u1' k' + solve u1 $ TUnknown ann u1' + pure $ TUnknown ann u1' ty' -> pure ty' -elaborateKind - :: (MonadError MultipleErrors m, MonadState CheckState m, HasCallStack) - => SourceType - -> m SourceType +elaborateKind :: + (MonadError MultipleErrors m, MonadState CheckState m, HasCallStack) => + SourceType -> + m SourceType elaborateKind = \case TypeLevelString ann _ -> pure $ E.kindSymbol $> ann @@ -527,12 +613,13 @@ elaborateKind = \case throwError . errorMessage' (fst ann) . UnknownName . fmap TyName $ v Just (kind, _) -> ($> ann) <$> apply kind - TypeVar ann a -> do - moduleName <- unsafeCheckCurrentModule - kind <- apply =<< lookupTypeVariable moduleName (Qualified ByNullSourcePos $ ProperName a) + TypeVar ann a kind -> do + -- moduleName <- unsafeCheckCurrentModule + -- kind <- apply =<< lookupTypeVariable moduleName (Qualified ByNullSourcePos $ ProperName a) + -- unifyKinds ki kind -- TODO/REVIEW/HACK: I DO NOT KNOW WHETHER THIS IS WHAT WE WANT pure (kind $> ann) (Skolem ann _ mbK _ _) -> do - kind <- apply $ fromMaybe (internalError "Skolem has no kind") mbK + kind <- apply $ mbK pure $ kind $> ann TUnknown ann a' -> do kind <- snd <$> lookupUnsolved a' @@ -572,42 +659,42 @@ elaborateKind = \case ty -> throwError . errorMessage' (fst (getAnnForType ty)) $ UnsupportedTypeInKind ty -checkEscapedSkolems :: MonadError MultipleErrors m => SourceType -> m () +checkEscapedSkolems :: (MonadError MultipleErrors m) => SourceType -> m () checkEscapedSkolems ty = traverse_ (throwError . toSkolemError) . everythingWithContextOnTypes ty [] (<>) go $ ty where - go :: SourceType -> SourceType -> (SourceType, [(SourceSpan, Text, SourceType)]) - go ty' = \case - Skolem ss name _ _ _ -> (ty', [(fst ss, name, ty')]) - ty''@(KindApp _ _ _) -> (ty'', []) - _ -> (ty', []) - - toSkolemError (ss, name, ty') = - errorMessage' (fst $ getAnnForType ty') $ EscapedSkolem name (Just ss) ty' - -kindOfWithUnknowns - :: (MonadError MultipleErrors m, MonadState CheckState m, HasCallStack) - => SourceType - -> m (([(Unknown, SourceType)], SourceType), SourceType) + go :: SourceType -> SourceType -> (SourceType, [(SourceSpan, Text, SourceType)]) + go ty' = \case + Skolem ss name _ _ _ -> (ty', [(fst ss, name, ty')]) + ty''@(KindApp _ _ _) -> (ty'', []) + _ -> (ty', []) + + toSkolemError (ss, name, ty') = + errorMessage' (fst $ getAnnForType ty') $ EscapedSkolem name (Just ss) ty' + +kindOfWithUnknowns :: + (MonadError MultipleErrors m, MonadState CheckState m, HasCallStack) => + SourceType -> + m (([(Unknown, SourceType)], SourceType), SourceType) kindOfWithUnknowns ty = do (ty', kind) <- kindOf ty unks <- unknownsWithKinds . IS.toList $ unknowns ty' pure ((unks, ty'), kind) -- | Infer the kind of a single type -kindOf - :: (MonadError MultipleErrors m, MonadState CheckState m, HasCallStack) - => SourceType - -> m (SourceType, SourceType) +kindOf :: + (MonadError MultipleErrors m, MonadState CheckState m, HasCallStack) => + SourceType -> + m (SourceType, SourceType) kindOf = fmap (first snd) . kindOfWithScopedVars -- | Infer the kind of a single type, returning the kinds of any scoped type variables -kindOfWithScopedVars - :: (MonadError MultipleErrors m, MonadState CheckState m, HasCallStack) - => SourceType - -> m (([(Text, SourceType)], SourceType), SourceType) +kindOfWithScopedVars :: + (MonadError MultipleErrors m, MonadState CheckState m, HasCallStack) => + SourceType -> + m (([(Text, SourceType)], SourceType), SourceType) kindOfWithScopedVars ty = do (ty', kind) <- bitraverse apply (replaceAllTypeSynonyms <=< apply) =<< inferKind ty let binders = fst . fromJust $ completeBinderList ty' @@ -616,223 +703,245 @@ kindOfWithScopedVars ty = do type DataDeclarationArgs = ( SourceAnn , ProperName 'TypeName - , [(Text, Maybe SourceType)] + , [(Text, SourceType)] , [DataConstructorDeclaration] ) type DataDeclarationResult = ( [(DataConstructorDeclaration, SourceType)] - -- The infered type signatures of data constructors - , SourceType - -- The inferred kind of the declaration + , -- The infered type signatures of data constructors + SourceType + -- The inferred kind of the declaration ) -kindOfData - :: forall m. (MonadError MultipleErrors m, MonadState CheckState m) - => ModuleName - -> DataDeclarationArgs - -> m DataDeclarationResult +kindOfData :: + forall m. + (MonadError MultipleErrors m, MonadState CheckState m) => + ModuleName -> + DataDeclarationArgs -> + m DataDeclarationResult kindOfData moduleName dataDecl = head . (^. _2) <$> kindsOfAll moduleName [] [dataDecl] [] -inferDataDeclaration - :: forall m. (MonadError MultipleErrors m, MonadState CheckState m) - => ModuleName - -> DataDeclarationArgs - -> m [(DataConstructorDeclaration, SourceType)] +inferDataDeclaration :: + forall m. + (MonadError MultipleErrors m, MonadState CheckState m) => + ModuleName -> + DataDeclarationArgs -> + m [(DataConstructorDeclaration, SourceType)] inferDataDeclaration moduleName (ann, tyName, tyArgs, ctors) = do tyKind <- apply =<< lookupTypeVariable moduleName (Qualified ByNullSourcePos tyName) let (sigBinders, tyKind') = fromJust . completeBinderList $ tyKind bindLocalTypeVariables moduleName (first ProperName . snd <$> sigBinders) $ do - tyArgs' <- for tyArgs . traverse . maybe (freshKind (fst ann)) $ replaceAllTypeSynonyms <=< apply <=< checkIsSaturatedType + tyArgs' <- for tyArgs . traverse $ replaceAllTypeSynonyms <=< apply <=< checkIsSaturatedType subsumesKind (foldr ((E.-:>) . snd) E.kindType tyArgs') tyKind' bindLocalTypeVariables moduleName (first ProperName <$> tyArgs') $ do let tyCtorName = srcTypeConstructor $ mkQualified tyName moduleName - tyCtor = foldl (\ty -> srcKindApp ty . srcTypeVar . fst . snd) tyCtorName sigBinders - tyCtor' = foldl (\ty -> srcTypeApp ty . srcTypeVar . fst) tyCtor tyArgs' - ctorBinders = fmap (fmap (fmap Just)) $ sigBinders <> fmap (nullSourceAnn,) tyArgs' + tyCtor = foldl (\ty -> srcKindApp ty . uncurry srcTypeVar . snd) tyCtorName sigBinders + tyCtor' = foldl (\ty -> srcTypeApp ty . uncurry srcTypeVar) tyCtor tyArgs' + ctorBinders = sigBinders <> fmap (nullSourceAnn,) tyArgs' visibility = second (const TypeVarVisible) <$> tyArgs for ctors $ fmap (fmap (addVisibility visibility . mkForAll ctorBinders)) . inferDataConstructor tyCtor' -inferDataConstructor - :: forall m. (MonadError MultipleErrors m, MonadState CheckState m) - => SourceType - -> DataConstructorDeclaration - -> m (DataConstructorDeclaration, SourceType) -inferDataConstructor tyCtor DataConstructorDeclaration{..} = do +inferDataConstructor :: + forall m. + (MonadError MultipleErrors m, MonadState CheckState m) => + SourceType -> + DataConstructorDeclaration -> + m (DataConstructorDeclaration, SourceType) +inferDataConstructor tyCtor DataConstructorDeclaration {..} = do dataCtorFields' <- traverse (traverse checkIsSaturatedType) dataCtorFields dataCtor <- flip (foldr ((E.-:>) . snd)) dataCtorFields' <$> checkKind tyCtor E.kindType - pure ( DataConstructorDeclaration { dataCtorFields = dataCtorFields', .. }, dataCtor ) + pure (DataConstructorDeclaration {dataCtorFields = dataCtorFields', ..}, dataCtor) type TypeDeclarationArgs = ( SourceAnn , ProperName 'TypeName - , [(Text, Maybe SourceType)] + , [(Text, SourceType)] , SourceType ) type TypeDeclarationResult = ( SourceType - -- The elaborated rhs of the declaration - , SourceType - -- The inferred kind of the declaration + , -- The elaborated rhs of the declaration + SourceType + -- The inferred kind of the declaration ) -kindOfTypeSynonym - :: forall m. (MonadError MultipleErrors m, MonadState CheckState m) - => ModuleName - -> TypeDeclarationArgs - -> m TypeDeclarationResult +kindOfTypeSynonym :: + forall m. + (MonadError MultipleErrors m, MonadState CheckState m) => + ModuleName -> + TypeDeclarationArgs -> + m TypeDeclarationResult kindOfTypeSynonym moduleName typeDecl = head . (^. _1) <$> kindsOfAll moduleName [typeDecl] [] [] -inferTypeSynonym - :: forall m. (MonadError MultipleErrors m, MonadState CheckState m) - => ModuleName - -> TypeDeclarationArgs - -> m SourceType +inferTypeSynonym :: + forall m. + (MonadError MultipleErrors m, MonadState CheckState m) => + ModuleName -> + TypeDeclarationArgs -> + m SourceType inferTypeSynonym moduleName (ann, tyName, tyArgs, tyBody) = do tyKind <- apply =<< lookupTypeVariable moduleName (Qualified ByNullSourcePos tyName) let (sigBinders, tyKind') = fromJust . completeBinderList $ tyKind bindLocalTypeVariables moduleName (first ProperName . snd <$> sigBinders) $ do kindRes <- freshKind (fst ann) - tyArgs' <- for tyArgs . traverse . maybe (freshKind (fst ann)) $ replaceAllTypeSynonyms <=< apply <=< checkIsSaturatedType + tyArgs' <- for tyArgs . traverse $ replaceAllTypeSynonyms <=< apply <=< checkIsSaturatedType unifyKinds tyKind' $ foldr ((E.-:>) . snd) kindRes tyArgs' bindLocalTypeVariables moduleName (first ProperName <$> tyArgs') $ do tyBodyAndKind <- traverse apply =<< inferKind tyBody instantiateKind tyBodyAndKind =<< apply kindRes --- | Checks that a particular generalization is valid and well-scoped. --- | Implicitly generalized kinds are always elaborated before explicitly --- | quantified type variables. It's possible that such a kind can be --- | inserted before other variables that it depends on, making it --- | ill-scoped. We require that users explicitly generalize this kind --- | in such a case. -checkQuantification - :: forall m. (MonadError MultipleErrors m) - => SourceType - -> m () -checkQuantification = - collectErrors . go [] [] . fst . fromJust . completeBinderList +type BinderList = [(SourceAnn, (Text, Type SourceAnn))] + +{- | Checks that a particular generalization is valid and well-scoped. +| Implicitly generalized kinds are always elaborated before explicitly +| quantified type variables. It's possible that such a kind can be +| inserted before other variables that it depends on, making it +| ill-scoped. We require that users explicitly generalize this kind +| in such a case. +-} +checkQuantification :: + forall m. + (MonadError MultipleErrors m) => + SourceType -> + m () +checkQuantification = collectErrors . go [] [] . fst . fromJust . completeBinderList where - collectErrors vars = - unless (null vars) - . throwError - . foldMap (\(ann, arg) -> errorMessage' (fst ann) $ QuantificationCheckFailureInKind arg) - $ vars - - go acc _ [] = reverse acc - go acc sco ((_, (arg, k)) : rest) - | not . all (flip elem sco) $ freeTypeVariables k = goDeps acc arg rest - | otherwise = go acc (arg : sco) rest - - goDeps acc _ [] = acc - goDeps acc karg ((ann, (arg, k)) : rest) - | isDep && arg == karg = (ann, arg) : acc - | isDep = goDeps ((ann, arg) : acc) karg rest - | otherwise = goDeps acc karg rest - where - isDep = - elem karg $ freeTypeVariables k - -checkVisibleTypeQuantification - :: forall m. (MonadError MultipleErrors m) - => SourceType - -> m () + collectErrors vars = + unless (null vars) + . throwError + . foldMap (\(ann, (arg, _)) -> errorMessage' (fst ann) $ QuantificationCheckFailureInKind arg) + $ vars + go :: BinderList -> [(Text, SourceType)] -> BinderList -> BinderList + go acc _ [] = reverse acc + go acc sco ((_, (arg, k)) : rest) + | not . all (flip elem sco) $ freeTypeVariables k = goDeps acc (arg, k) rest + | otherwise = go acc ((arg, k) : sco) rest + + goDeps :: BinderList -> (Text, SourceType) -> BinderList -> BinderList + goDeps acc _ [] = acc + goDeps acc karg ((ann, (arg, k)) : rest) + | isDep && (arg, k) == karg = (ann, (arg, k)) : acc + | isDep = goDeps ((ann, (arg, k)) : acc) karg rest + | otherwise = goDeps acc karg rest + where + isDep = + elem karg $ freeTypeVariables k + +checkVisibleTypeQuantification :: + forall m. + (MonadError MultipleErrors m) => + SourceType -> + m () checkVisibleTypeQuantification = collectErrors . freeTypeVariables where - collectErrors vars = - unless (null vars) - . throwError - . foldMap (errorMessage . VisibleQuantificationCheckFailureInType) - $ vars - --- | Checks that there are no remaining unknowns in a type, and if so --- | throws an error. This is necessary for contexts where we can't --- | implicitly generalize unknowns, such as on the right-hand-side of --- | a type synonym, or in arguments to data constructors. -checkTypeQuantification - :: forall m. (MonadError MultipleErrors m) - => SourceType - -> m () + collectErrors vars = + unless (null vars) + . throwError + . foldMap (errorMessage . VisibleQuantificationCheckFailureInType . fst) + $ vars + +{- | Checks that there are no remaining unknowns in a type, and if so +| throws an error. This is necessary for contexts where we can't +| implicitly generalize unknowns, such as on the right-hand-side of +| a type synonym, or in arguments to data constructors. +-} +checkTypeQuantification :: + forall m. + (MonadError MultipleErrors m) => + SourceType -> + m () checkTypeQuantification = collectErrors . everythingWithContextOnTypes True [] (<>) unknownsInKinds where - collectErrors tysWithUnks = - unless (null tysWithUnks) . throwError . foldMap toMultipleErrors $ tysWithUnks - - toMultipleErrors (ss, unks, ty) = - errorMessage' ss $ QuantificationCheckFailureInType (IS.toList unks) ty - - unknownsInKinds False _ = (False, []) - unknownsInKinds _ ty = case ty of - ForAll sa _ _ _ _ _ | unks <- unknowns ty, not (IS.null unks) -> - (False, [(fst sa, unks, ty)]) - KindApp sa _ _ | unks <- unknowns ty, not (IS.null unks) -> - (False, [(fst sa, unks, ty)]) - ConstrainedType sa _ _ | unks <- unknowns ty, not (IS.null unks) -> - (False, [(fst sa, unks, ty)]) - _ -> - (True, []) + collectErrors tysWithUnks = + unless (null tysWithUnks) . throwError . foldMap toMultipleErrors $ tysWithUnks + + toMultipleErrors (ss, unks, ty) = + errorMessage' ss $ QuantificationCheckFailureInType (IS.toList unks) ty + + unknownsInKinds False _ = (False, []) + unknownsInKinds _ ty = case ty of + ForAll sa _ _ _ _ _ + | unks <- unknowns ty + , not (IS.null unks) -> + (False, [(fst sa, unks, ty)]) + KindApp sa _ _ + | unks <- unknowns ty + , not (IS.null unks) -> + (False, [(fst sa, unks, ty)]) + ConstrainedType sa _ _ + | unks <- unknowns ty + , not (IS.null unks) -> + (False, [(fst sa, unks, ty)]) + _ -> + (True, []) type ClassDeclarationArgs = ( SourceAnn , ProperName 'ClassName - , [(Text, Maybe SourceType)] + , [(Text, SourceType)] , [SourceConstraint] , [Declaration] ) type ClassDeclarationResult = ( [(Text, SourceType)] - -- The kind annotated class arguments - , [SourceConstraint] - -- The kind annotated superclass constraints - , [Declaration] - -- The kind annotated declarations - , SourceType - -- The inferred kind of the declaration + , -- The kind annotated class arguments + [SourceConstraint] + , -- The kind annotated superclass constraints + [Declaration] + , -- The kind annotated declarations + SourceType + -- The inferred kind of the declaration ) -kindOfClass - :: forall m. (MonadError MultipleErrors m, MonadState CheckState m) - => ModuleName - -> ClassDeclarationArgs - -> m ClassDeclarationResult +kindOfClass :: + forall m. + (MonadError MultipleErrors m, MonadState CheckState m) => + ModuleName -> + ClassDeclarationArgs -> + m ClassDeclarationResult kindOfClass moduleName clsDecl = head . (^. _3) <$> kindsOfAll moduleName [] [] [clsDecl] -inferClassDeclaration - :: forall m. (MonadError MultipleErrors m, MonadState CheckState m) - => ModuleName - -> ClassDeclarationArgs - -> m ([(Text, SourceType)], [SourceConstraint], [Declaration]) +inferClassDeclaration :: + forall m. + (MonadError MultipleErrors m, MonadState CheckState m) => + ModuleName -> + ClassDeclarationArgs -> + m ([(Text, SourceType)], [SourceConstraint], [Declaration]) inferClassDeclaration moduleName (ann, clsName, clsArgs, superClasses, decls) = do clsKind <- apply =<< lookupTypeVariable moduleName (Qualified ByNullSourcePos $ coerceProperName clsName) let (sigBinders, clsKind') = fromJust . completeBinderList $ clsKind bindLocalTypeVariables moduleName (first ProperName . snd <$> sigBinders) $ do - clsArgs' <- for clsArgs . traverse . maybe (freshKind (fst ann)) $ replaceAllTypeSynonyms <=< apply <=< checkIsSaturatedType + clsArgs' <- for clsArgs . traverse $ replaceAllTypeSynonyms <=< apply <=< checkIsSaturatedType unifyKinds clsKind' $ foldr ((E.-:>) . snd) E.kindConstraint clsArgs' bindLocalTypeVariables moduleName (first ProperName <$> clsArgs') $ do (clsArgs',,) <$> for superClasses checkConstraint <*> for decls checkClassMemberDeclaration -checkClassMemberDeclaration - :: forall m. (MonadError MultipleErrors m, MonadState CheckState m) - => Declaration - -> m Declaration +checkClassMemberDeclaration :: + forall m. + (MonadError MultipleErrors m, MonadState CheckState m) => + Declaration -> + m Declaration checkClassMemberDeclaration = \case TypeDeclaration (TypeDeclarationData ann ident ty) -> TypeDeclaration . TypeDeclarationData ann ident <$> checkKind ty E.kindType _ -> internalError "Invalid class member declaration" -applyClassMemberDeclaration - :: forall m. (MonadError MultipleErrors m, MonadState CheckState m) - => Declaration - -> m Declaration +applyClassMemberDeclaration :: + forall m. + (MonadError MultipleErrors m, MonadState CheckState m) => + Declaration -> + m Declaration applyClassMemberDeclaration = \case TypeDeclaration (TypeDeclarationData ann ident ty) -> TypeDeclaration . TypeDeclarationData ann ident <$> apply ty @@ -845,19 +954,21 @@ mapTypeDeclaration f = \case other -> other -checkConstraint - :: forall m. (MonadError MultipleErrors m, MonadState CheckState m) - => SourceConstraint - -> m SourceConstraint +checkConstraint :: + forall m. + (MonadError MultipleErrors m, MonadState CheckState m) => + SourceConstraint -> + m SourceConstraint checkConstraint (Constraint ann clsName kinds args dat) = do let ty = foldl (TypeApp ann) (foldl (KindApp ann) (TypeConstructor ann (fmap coerceProperName clsName)) kinds) args (_, kinds', args') <- unapplyTypes <$> checkKind ty E.kindConstraint pure $ Constraint ann clsName kinds' args' dat -applyConstraint - :: forall m. (MonadError MultipleErrors m, MonadState CheckState m) - => SourceConstraint - -> m SourceConstraint +applyConstraint :: + forall m. + (MonadError MultipleErrors m, MonadState CheckState m) => + SourceConstraint -> + m SourceConstraint applyConstraint (Constraint ann clsName kinds args dat) = do let ty = foldl (TypeApp ann) (foldl (KindApp ann) (TypeConstructor ann (fmap coerceProperName clsName)) kinds) args (_, kinds', args') <- unapplyTypes <$> apply ty @@ -877,32 +988,34 @@ type InstanceDeclarationResult = , [(Text, SourceType)] ) -checkInstanceDeclaration - :: forall m. (MonadError MultipleErrors m, MonadState CheckState m) - => ModuleName - -> InstanceDeclarationArgs - -> m InstanceDeclarationResult +checkInstanceDeclaration :: + forall m. + (MonadError MultipleErrors m, MonadState CheckState m) => + ModuleName -> + InstanceDeclarationArgs -> + m InstanceDeclarationResult checkInstanceDeclaration moduleName (ann, constraints, clsName, args) = do let ty = foldl (TypeApp ann) (TypeConstructor ann (fmap coerceProperName clsName)) args tyWithConstraints = foldr srcConstrainedType ty constraints - freeVars = freeTypeVariables tyWithConstraints + freeVars = fst <$> freeTypeVariables tyWithConstraints freeVarsDict <- for freeVars $ \v -> (ProperName v,) <$> freshKind (fst ann) bindLocalTypeVariables moduleName freeVarsDict $ do ty' <- checkKind ty E.kindConstraint constraints' <- for constraints checkConstraint allTy <- apply $ foldr srcConstrainedType ty' constraints' allUnknowns <- unknownsWithKinds . IS.toList . foldMap unknowns . (allTy :) =<< traverse (apply . snd) freeVarsDict - let unknownVars = unknownVarNames (usedTypeVariables allTy) allUnknowns + let unknownVars = unknownVarNames (fst <$> usedTypeVariables allTy) allUnknowns let allWithVars = replaceUnknownsWithVars unknownVars allTy let (allConstraints, (_, allKinds, allArgs)) = unapplyTypes <$> unapplyConstraints allWithVars varKinds <- traverse (traverse (fmap (replaceUnknownsWithVars unknownVars) . apply)) $ (snd <$> unknownVars) <> (first runProperName <$> freeVarsDict) pure (allConstraints, allKinds, allArgs, varKinds) -checkKindDeclaration - :: forall m. (MonadSupply m, MonadError MultipleErrors m, MonadState CheckState m) - => ModuleName - -> SourceType - -> m SourceType +checkKindDeclaration :: + forall m. + (MonadSupply m, MonadError MultipleErrors m, MonadState CheckState m) => + ModuleName -> + SourceType -> + m SourceType checkKindDeclaration _ ty = do (ty', kind) <- kindOf ty checkTypeKind kind E.kindType @@ -912,46 +1025,49 @@ checkKindDeclaration _ ty = do checkQuantification finalTy checkValidKind finalTy where - -- When expanding type synonyms and generalizing, we need to generate more - -- unique names so that they don't clash or shadow other names, or can - -- be referenced (easily). - freshVar arg = (arg <>) . T.pack . show <$> fresh - freshenForAlls = curry $ \case - (ForAll _ _ v1 _ ty1 _, ForAll a2 vis v2 k2 ty2 sc2) | v1 == v2 -> do - ty2' <- freshenForAlls ty1 ty2 - pure $ ForAll a2 vis v2 k2 ty2' sc2 - (_, ty2) -> go ty2 where - go = \case - ForAll a' vis v' k' ty' sc' -> do - v'' <- freshVar v' - ty'' <- go (replaceTypeVars v' (TypeVar a' v'') ty') - pure $ ForAll a' vis v'' k' ty'' sc' - other -> pure other - - checkValidKind = everywhereOnTypesM $ \case - ty'@(ConstrainedType ann _ _) -> - throwError . errorMessage' (fst ann) $ UnsupportedTypeInKind ty' - other -> pure other - -existingSignatureOrFreshKind - :: forall m. MonadState CheckState m - => ModuleName - -> SourceSpan - -> ProperName 'TypeName - -> m SourceType + -- When expanding type synonyms and generalizing, we need to generate more + -- unique names so that they don't clash or shadow other names, or can + -- be referenced (easily). + freshVar arg = (arg <>) . T.pack . show <$> fresh + freshenForAlls = curry $ \case + (ForAll _ _ v1 _ ty1 _, ForAll a2 vis v2 k2 ty2 sc2) | v1 == v2 -> do + ty2' <- freshenForAlls ty1 ty2 + pure $ ForAll a2 vis v2 k2 ty2' sc2 + (_, ty2) -> go ty2 + where + go = \case + ForAll a' vis v' k' ty' sc' -> do + v'' <- freshVar v' + ty'' <- go (replaceTypeVars v' (TypeVar a' v'' k') ty') + pure $ ForAll a' vis v'' k' ty'' sc' + other -> pure other + + checkValidKind = everywhereOnTypesM $ \case + ty'@(ConstrainedType ann _ _) -> + throwError . errorMessage' (fst ann) $ UnsupportedTypeInKind ty' + other -> pure other + +existingSignatureOrFreshKind :: + forall m. + (MonadState CheckState m) => + ModuleName -> + SourceSpan -> + ProperName 'TypeName -> + m SourceType existingSignatureOrFreshKind moduleName ss name = do env <- getEnv case M.lookup (Qualified (ByModuleName moduleName) name) (E.types env) of Nothing -> freshKind ss Just (kind, _) -> pure kind -kindsOfAll - :: forall m. (MonadError MultipleErrors m, MonadState CheckState m) - => ModuleName - -> [TypeDeclarationArgs] - -> [DataDeclarationArgs] - -> [ClassDeclarationArgs] - -> m ([TypeDeclarationResult], [DataDeclarationResult], [ClassDeclarationResult]) +kindsOfAll :: + forall m. + (MonadError MultipleErrors m, MonadState CheckState m) => + ModuleName -> + [TypeDeclarationArgs] -> + [DataDeclarationArgs] -> + [ClassDeclarationArgs] -> + m ([TypeDeclarationResult], [DataDeclarationResult], [ClassDeclarationResult]) kindsOfAll moduleName syns dats clss = withFreshSubstitution $ do synDict <- for syns $ \(sa, synName, _, _) -> (synName,) <$> existingSignatureOrFreshKind moduleName (fst sa) synName datDict <- for dats $ \(sa, datName, _, _) -> (datName,) <$> existingSignatureOrFreshKind moduleName (fst sa) datName @@ -993,24 +1109,25 @@ kindsOfAll moduleName syns dats clss = withFreshSubstitution $ do clsResultsWithKinds = flip fmap clsResultsWithUnks $ \(((clsName, clsKind), (args, supers, decls)), _) -> do let tyUnks = snd . fromJust $ lookup (mkQualified clsName moduleName) tySubs (usedTypeVariablesInDecls, _, _, _, _) = accumTypes usedTypeVariables - usedVars = usedTypeVariables clsKind - <> foldMap (usedTypeVariables . snd) args - <> foldMap (foldMap usedTypeVariables . (\c -> constraintKindArgs c <> constraintArgs c)) supers - <> foldMap usedTypeVariablesInDecls decls - unkBinders = unknownVarNames usedVars tyUnks + usedVars = + usedTypeVariables clsKind + <> foldMap (usedTypeVariables . snd) args + <> foldMap (foldMap usedTypeVariables . (\c -> constraintKindArgs c <> constraintArgs c)) supers + <> foldMap usedTypeVariablesInDecls decls + unkBinders = unknownVarNames (fst <$> usedVars) tyUnks args' = fmap (replaceUnknownsWithVars unkBinders . replaceTypeCtors) <$> args supers' = mapConstraintArgsAll (fmap (replaceUnknownsWithVars unkBinders . replaceTypeCtors)) <$> supers decls' = mapTypeDeclaration (replaceUnknownsWithVars unkBinders . replaceTypeCtors) <$> decls (args', supers', decls', generalizeUnknownsWithVars unkBinders clsKind) datResultsWithKinds <- for datResultsWithUnks $ \(((datName, datKind), ctors), _) -> do let tyUnks = snd . fromJust $ lookup (mkQualified datName moduleName) tySubs - replaceDataCtorField ty = replaceUnknownsWithVars (unknownVarNames (usedTypeVariables ty) tyUnks) $ replaceTypeCtors ty + replaceDataCtorField ty = replaceUnknownsWithVars (unknownVarNames (fst <$> usedTypeVariables ty) tyUnks) $ replaceTypeCtors ty ctors' = fmap (mapDataCtorFields (fmap (fmap replaceDataCtorField)) *** generalizeUnknowns tyUnks . replaceTypeCtors) ctors traverse_ (traverse_ checkTypeQuantification) ctors' pure (ctors', generalizeUnknowns tyUnks datKind) synResultsWithKinds <- for synResultsWithUnks $ \(((synName, synKind), synBody), _) -> do let tyUnks = snd . fromJust $ lookup (mkQualified synName moduleName) tySubs - unkBinders = unknownVarNames (usedTypeVariables synKind <> usedTypeVariables synBody) tyUnks + unkBinders = unknownVarNames (fst <$> usedTypeVariables synKind <> usedTypeVariables synBody) tyUnks genBody = replaceUnknownsWithVars unkBinders $ replaceTypeCtors synBody genSig = generalizeUnknownsWithVars unkBinders synKind checkEscapedSkolems genBody diff --git a/src/Language/PureScript/TypeChecker/Monad.hs b/src/Language/PureScript/TypeChecker/Monad.hs index ba27d0299..d384a9094 100644 --- a/src/Language/PureScript/TypeChecker/Monad.hs +++ b/src/Language/PureScript/TypeChecker/Monad.hs @@ -1,31 +1,31 @@ {-# LANGUAGE GADTs #-} --- | --- Monads for type checking and type inference and associated data types --- +{- | +Monads for type checking and type inference and associated data types +-} module Language.PureScript.TypeChecker.Monad where import Prelude import Control.Arrow (second) -import Control.Monad.Error.Class (MonadError(..)) -import Control.Monad.State (MonadState(..), StateT(..), forM_, gets, guard, join, modify, when, (<=<)) -import Control.Monad.Writer.Class (MonadWriter(..), censor) +import Control.Monad.Error.Class (MonadError (..)) +import Control.Monad.State (MonadState (..), StateT (..), forM_, gets, guard, join, modify, when, (<=<)) +import Control.Monad.Writer.Class (MonadWriter (..), censor) -import Data.Maybe (fromMaybe) +import Data.List.NonEmpty qualified as NEL import Data.Map qualified as M +import Data.Maybe (fromMaybe) import Data.Set qualified as S import Data.Text (Text, isPrefixOf, unpack) -import Data.List.NonEmpty qualified as NEL import Language.PureScript.Crash (internalError) -import Language.PureScript.Environment (Environment(..), NameKind(..), NameVisibility(..), TypeClassData(..), TypeKind(..)) -import Language.PureScript.Errors (Context, ErrorMessageHint, ExportSource, Expr, ImportDeclarationType, MultipleErrors, SimpleErrorMessage(..), SourceAnn, SourceSpan(..), addHint, errorMessage, positionedError, rethrow, warnWithPosition) -import Language.PureScript.Names (Ident(..), ModuleName, ProperName(..), ProperNameType(..), Qualified(..), QualifiedBy(..), coerceProperName, disqualify, runIdent, runModuleName, showQualified, toMaybeModuleName) +import Language.PureScript.Environment (Environment (..), NameKind (..), NameVisibility (..), TypeClassData (..), TypeKind (..)) +import Language.PureScript.Errors (Context, ErrorMessageHint, ExportSource, Expr, ImportDeclarationType, MultipleErrors, SimpleErrorMessage (..), SourceAnn, SourceSpan (..), addHint, errorMessage, positionedError, rethrow, warnWithPosition) +import Language.PureScript.Names (Ident (..), ModuleName, ProperName (..), ProperNameType (..), Qualified (..), QualifiedBy (..), coerceProperName, disqualify, runIdent, runModuleName, showQualified, toMaybeModuleName) import Language.PureScript.Pretty.Types (prettyPrintType) import Language.PureScript.Pretty.Values (prettyPrintValue) -import Language.PureScript.TypeClassDictionaries (NamedDict, TypeClassDictionaryInScope(..)) -import Language.PureScript.Types (Constraint(..), SourceType, Type(..), srcKindedType, srcTypeVar) +import Language.PureScript.TypeClassDictionaries (NamedDict, TypeClassDictionaryInScope (..)) +import Language.PureScript.Types (Constraint (..), SourceType, Type (..), srcKindedType, srcTypeVar) import Text.PrettyPrint.Boxes (render) newtype UnkLevel = UnkLevel (NEL.NonEmpty Unknown) @@ -37,11 +37,11 @@ instance Ord UnkLevel where compare (UnkLevel a) (UnkLevel b) = go (NEL.toList a) (NEL.toList b) where - go [] [] = EQ - go _ [] = LT - go [] _ = GT - go (x:xs) (y:ys) = - compare x y <> go xs ys + go [] [] = EQ + go _ [] = LT + go [] _ = GT + go (x : xs) (y : ys) = + compare x y <> go xs ys -- | A substitution of unification variables for types. data Substitution = Substitution @@ -55,13 +55,16 @@ data Substitution = Substitution insertUnkName :: (MonadState CheckState m) => Unknown -> Text -> m () insertUnkName u t = do - modify (\s -> - s { checkSubstitution = - (checkSubstitution s) { substNames = - M.insert u t $ substNames $ checkSubstitution s - } - } - ) + modify + ( \s -> + s + { checkSubstitution = + (checkSubstitution s) + { substNames = + M.insert u t $ substNames $ checkSubstitution s + } + } + ) lookupUnkName :: (MonadState CheckState m) => Unknown -> m (Maybe Text) lookupUnkName u = gets $ M.lookup u . substNames . checkSubstitution @@ -72,36 +75,36 @@ emptySubstitution = Substitution M.empty M.empty M.empty -- | State required for type checking data CheckState = CheckState - { checkEnv :: Environment + { checkEnv :: !Environment -- ^ The current @Environment@ - , checkNextType :: Int + , checkNextType :: !Int -- ^ The next type unification variable - , checkNextSkolem :: Int + , checkNextSkolem :: !Int -- ^ The next skolem variable - , checkNextSkolemScope :: Int + , checkNextSkolemScope :: !Int -- ^ The next skolem scope constant - , checkCurrentModule :: Maybe ModuleName + , checkCurrentModule :: !(Maybe ModuleName) -- ^ The current module , checkCurrentModuleImports :: - [ ( SourceAnn - , ModuleName - , ImportDeclarationType - , Maybe ModuleName - , M.Map (ProperName 'TypeName) ([ProperName 'ConstructorName], ExportSource) - ) - ] + ![ ( SourceAnn + , ModuleName + , ImportDeclarationType + , Maybe ModuleName + , M.Map (ProperName 'TypeName) ([ProperName 'ConstructorName], ExportSource) + ) + ] -- ^ The current module imports and their exported types. -- Newtype constructors have to be in scope for some Coercible constraints to -- be solvable, so we need to know which constructors are imported and whether -- they are actually defined in or re-exported from the imported modules. - , checkSubstitution :: Substitution + , checkSubstitution :: !Substitution -- ^ The current substitution - , checkHints :: [ErrorMessageHint] + , checkHints :: ![ErrorMessageHint] -- ^ The current error message hint stack. -- This goes into state, rather than using 'rethrow', -- since this way, we can provide good error messages -- during instance resolution. - , checkConstructorImportsForCoercible :: S.Set (ModuleName, Qualified (ProperName 'ConstructorName)) + , checkConstructorImportsForCoercible :: !(S.Set (ModuleName, Qualified (ProperName 'ConstructorName))) -- ^ Newtype constructors imports required to solve Coercible constraints. -- We have to keep track of them so that we don't emit unused import warnings. } @@ -114,141 +117,144 @@ emptyCheckState env = CheckState env 0 0 0 Nothing [] emptySubstitution [] mempt type Unknown = Int -- | Temporarily bind a collection of names to values -bindNames - :: MonadState CheckState m - => M.Map (Qualified Ident) (SourceType, NameKind, NameVisibility) - -> m a - -> m a +bindNames :: + (MonadState CheckState m) => + M.Map (Qualified Ident) (SourceType, NameKind, NameVisibility) -> + m a -> + m a bindNames newNames action = do orig <- get - modify $ \st -> st { checkEnv = (checkEnv st) { names = newNames `M.union` (names . checkEnv $ st) } } + modify $ \st -> st {checkEnv = (checkEnv st) {names = newNames `M.union` (names . checkEnv $ st)}} a <- action - modify $ \st -> st { checkEnv = (checkEnv st) { names = names . checkEnv $ orig } } + modify $ \st -> st {checkEnv = (checkEnv st) {names = names . checkEnv $ orig}} return a -- | Temporarily bind a collection of names to types -bindTypes - :: MonadState CheckState m - => M.Map (Qualified (ProperName 'TypeName)) (SourceType, TypeKind) - -> m a - -> m a +bindTypes :: + (MonadState CheckState m) => + M.Map (Qualified (ProperName 'TypeName)) (SourceType, TypeKind) -> + m a -> + m a bindTypes newNames action = do orig <- get - modify $ \st -> st { checkEnv = (checkEnv st) { types = newNames `M.union` (types . checkEnv $ st) } } + modify $ \st -> st {checkEnv = (checkEnv st) {types = newNames `M.union` (types . checkEnv $ st)}} a <- action - modify $ \st -> st { checkEnv = (checkEnv st) { types = types . checkEnv $ orig } } + modify $ \st -> st {checkEnv = (checkEnv st) {types = types . checkEnv $ orig}} return a -- | Temporarily bind a collection of names to types -withScopedTypeVars - :: (MonadState CheckState m, MonadWriter MultipleErrors m) - => ModuleName - -> [(Text, SourceType)] - -> m a - -> m a +withScopedTypeVars :: + (MonadState CheckState m, MonadWriter MultipleErrors m) => + ModuleName -> + [(Text, SourceType)] -> + m a -> + m a withScopedTypeVars mn ks ma = do orig <- get forM_ ks $ \(name, _) -> when (Qualified (ByModuleName mn) (ProperName name) `M.member` types (checkEnv orig)) $ - tell . errorMessage $ ShadowedTypeVar name + tell . errorMessage $ + ShadowedTypeVar name bindTypes (M.fromList (map (\(name, k) -> (Qualified (ByModuleName mn) (ProperName name), (k, ScopedTypeVar))) ks)) ma -withErrorMessageHint - :: (MonadState CheckState m, MonadError MultipleErrors m) - => ErrorMessageHint - -> m a - -> m a +withErrorMessageHint :: + (MonadState CheckState m, MonadError MultipleErrors m) => + ErrorMessageHint -> + m a -> + m a withErrorMessageHint hint action = do orig <- get - modify $ \st -> st { checkHints = hint : checkHints st } + modify $ \st -> st {checkHints = hint : checkHints st} -- Need to use 'rethrow' anyway, since we have to handle regular errors a <- rethrow (addHint hint) action - modify $ \st -> st { checkHints = checkHints orig } + modify $ \st -> st {checkHints = checkHints orig} return a --- | These hints are added at the front, so the most nested hint occurs --- at the front, but the simplifier assumes the reverse order. -getHints :: MonadState CheckState m => m [ErrorMessageHint] +{- | These hints are added at the front, so the most nested hint occurs +at the front, but the simplifier assumes the reverse order. +-} +getHints :: (MonadState CheckState m) => m [ErrorMessageHint] getHints = gets (reverse . checkHints) -rethrowWithPositionTC - :: (MonadState CheckState m, MonadError MultipleErrors m) - => SourceSpan - -> m a - -> m a +rethrowWithPositionTC :: + (MonadState CheckState m, MonadError MultipleErrors m) => + SourceSpan -> + m a -> + m a rethrowWithPositionTC pos = withErrorMessageHint (positionedError pos) -warnAndRethrowWithPositionTC - :: (MonadState CheckState m, MonadError MultipleErrors m, MonadWriter MultipleErrors m) - => SourceSpan - -> m a - -> m a +warnAndRethrowWithPositionTC :: + (MonadState CheckState m, MonadError MultipleErrors m, MonadWriter MultipleErrors m) => + SourceSpan -> + m a -> + m a warnAndRethrowWithPositionTC pos = rethrowWithPositionTC pos . warnWithPosition pos -- | Temporarily make a collection of type class dictionaries available -withTypeClassDictionaries - :: MonadState CheckState m - => [NamedDict] - -> m a - -> m a +withTypeClassDictionaries :: + (MonadState CheckState m) => + [NamedDict] -> + m a -> + m a withTypeClassDictionaries entries action = do orig <- get let mentries = - M.fromListWith (M.unionWith (M.unionWith (<>))) + M.fromListWith + (M.unionWith (M.unionWith (<>))) [ (qb, M.singleton className (M.singleton tcdValue (pure entry))) - | entry@TypeClassDictionaryInScope{ tcdValue = tcdValue@(Qualified qb _), tcdClassName = className } - <- entries + | entry@TypeClassDictionaryInScope {tcdValue = tcdValue@(Qualified qb _), tcdClassName = className} <- + entries ] - modify $ \st -> st { checkEnv = (checkEnv st) { typeClassDictionaries = M.unionWith (M.unionWith (M.unionWith (<>))) (typeClassDictionaries . checkEnv $ st) mentries } } + modify $ \st -> st {checkEnv = (checkEnv st) {typeClassDictionaries = M.unionWith (M.unionWith (M.unionWith (<>))) (typeClassDictionaries . checkEnv $ st) mentries}} a <- action - modify $ \st -> st { checkEnv = (checkEnv st) { typeClassDictionaries = typeClassDictionaries . checkEnv $ orig } } + modify $ \st -> st {checkEnv = (checkEnv st) {typeClassDictionaries = typeClassDictionaries . checkEnv $ orig}} return a -- | Get the currently available map of type class dictionaries -getTypeClassDictionaries - :: (MonadState CheckState m) - => m (M.Map QualifiedBy (M.Map (Qualified (ProperName 'ClassName)) (M.Map (Qualified Ident) (NEL.NonEmpty NamedDict)))) +getTypeClassDictionaries :: + (MonadState CheckState m) => + m (M.Map QualifiedBy (M.Map (Qualified (ProperName 'ClassName)) (M.Map (Qualified Ident) (NEL.NonEmpty NamedDict)))) getTypeClassDictionaries = gets $ typeClassDictionaries . checkEnv -- | Lookup type class dictionaries in a module. -lookupTypeClassDictionaries - :: (MonadState CheckState m) - => QualifiedBy - -> m (M.Map (Qualified (ProperName 'ClassName)) (M.Map (Qualified Ident) (NEL.NonEmpty NamedDict))) +lookupTypeClassDictionaries :: + (MonadState CheckState m) => + QualifiedBy -> + m (M.Map (Qualified (ProperName 'ClassName)) (M.Map (Qualified Ident) (NEL.NonEmpty NamedDict))) lookupTypeClassDictionaries mn = gets $ fromMaybe M.empty . M.lookup mn . typeClassDictionaries . checkEnv -- | Lookup type class dictionaries in a module. -lookupTypeClassDictionariesForClass - :: (MonadState CheckState m) - => QualifiedBy - -> Qualified (ProperName 'ClassName) - -> m (M.Map (Qualified Ident) (NEL.NonEmpty NamedDict)) +lookupTypeClassDictionariesForClass :: + (MonadState CheckState m) => + QualifiedBy -> + Qualified (ProperName 'ClassName) -> + m (M.Map (Qualified Ident) (NEL.NonEmpty NamedDict)) lookupTypeClassDictionariesForClass mn cn = fromMaybe M.empty . M.lookup cn <$> lookupTypeClassDictionaries mn -- | Temporarily bind a collection of names to local variables -bindLocalVariables - :: (MonadState CheckState m) - => [(SourceSpan, Ident, SourceType, NameVisibility)] - -> m a - -> m a +bindLocalVariables :: + (MonadState CheckState m) => + [(SourceSpan, Ident, SourceType, NameVisibility)] -> + m a -> + m a bindLocalVariables bindings = bindNames (M.fromList $ flip map bindings $ \(ss, name, ty, visibility) -> (Qualified (BySourcePos $ spanStart ss) name, (ty, Private, visibility))) -- | Temporarily bind a collection of names to local type variables -bindLocalTypeVariables - :: (MonadState CheckState m) - => ModuleName - -> [(ProperName 'TypeName, SourceType)] - -> m a - -> m a +bindLocalTypeVariables :: + (MonadState CheckState m) => + ModuleName -> + [(ProperName 'TypeName, SourceType)] -> + m a -> + m a bindLocalTypeVariables moduleName bindings = bindTypes (M.fromList $ flip map bindings $ \(pn, kind) -> (Qualified (ByModuleName moduleName) pn, (kind, LocalTypeVariable))) -- | Update the visibility of all names to Defined makeBindingGroupVisible :: (MonadState CheckState m) => m () -makeBindingGroupVisible = modifyEnv $ \e -> e { names = M.map (\(ty, nk, _) -> (ty, nk, Defined)) (names e) } +makeBindingGroupVisible = modifyEnv $ \e -> e {names = M.map (\(ty, nk, _) -> (ty, nk, Defined)) (names e)} -- | Update the visibility of all names to Defined in the scope of the provided action withBindingGroupVisible :: (MonadState CheckState m) => m a -> m a @@ -259,14 +265,14 @@ preservingNames :: (MonadState CheckState m) => m a -> m a preservingNames action = do orig <- gets (names . checkEnv) a <- action - modifyEnv $ \e -> e { names = orig } + modifyEnv $ \e -> e {names = orig} return a -- | Lookup the type of a value by name in the @Environment@ -lookupVariable - :: (e ~ MultipleErrors, MonadState CheckState m, MonadError e m) - => Qualified Ident - -> m SourceType +lookupVariable :: + (e ~ MultipleErrors, MonadState CheckState m, MonadError e m) => + Qualified Ident -> + m SourceType lookupVariable qual = do env <- getEnv case M.lookup qual (names env) of @@ -274,10 +280,10 @@ lookupVariable qual = do Just (ty, _, _) -> return ty -- | Lookup the visibility of a value by name in the @Environment@ -getVisibility - :: (e ~ MultipleErrors, MonadState CheckState m, MonadError e m) - => Qualified Ident - -> m NameVisibility +getVisibility :: + (e ~ MultipleErrors, MonadState CheckState m, MonadError e m) => + Qualified Ident -> + m NameVisibility getVisibility qual = do env <- getEnv case M.lookup qual (names env) of @@ -285,10 +291,10 @@ getVisibility qual = do Just (_, _, vis) -> return vis -- | Assert that a name is visible -checkVisibility - :: (e ~ MultipleErrors, MonadState CheckState m, MonadError e m) - => Qualified Ident - -> m () +checkVisibility :: + (e ~ MultipleErrors, MonadState CheckState m, MonadError e m) => + Qualified Ident -> + m () checkVisibility name@(Qualified _ var) = do vis <- getVisibility name case vis of @@ -296,38 +302,38 @@ checkVisibility name@(Qualified _ var) = do _ -> return () -- | Lookup the kind of a type by name in the @Environment@ -lookupTypeVariable - :: (e ~ MultipleErrors, MonadState CheckState m, MonadError e m) - => ModuleName - -> Qualified (ProperName 'TypeName) - -> m SourceType +lookupTypeVariable :: + (e ~ MultipleErrors, MonadState CheckState m, MonadError e m) => + ModuleName -> + Qualified (ProperName 'TypeName) -> + m SourceType lookupTypeVariable currentModule (Qualified qb name) = do env <- getEnv case M.lookup (Qualified qb' name) (types env) of Nothing -> throwError . errorMessage $ UndefinedTypeVariable name Just (k, _) -> return k where - qb' = ByModuleName $ case qb of - ByModuleName m -> m - BySourcePos _ -> currentModule + qb' = ByModuleName $ case qb of + ByModuleName m -> m + BySourcePos _ -> currentModule -- | Get the current @Environment@ getEnv :: (MonadState CheckState m) => m Environment getEnv = gets checkEnv -- | Get locally-bound names in context, to create an error message. -getLocalContext :: MonadState CheckState m => m Context +getLocalContext :: (MonadState CheckState m) => m Context getLocalContext = do env <- getEnv - return [ (ident, ty') | (Qualified (BySourcePos _) ident@Ident{}, (ty', _, Defined)) <- M.toList (names env) ] + return [(ident, ty') | (Qualified (BySourcePos _) ident@Ident {}, (ty', _, Defined)) <- M.toList (names env)] -- | Update the @Environment@ putEnv :: (MonadState CheckState m) => Environment -> m () -putEnv env = modify (\s -> s { checkEnv = env }) +putEnv env = modify (\s -> s {checkEnv = env}) -- | Modify the @Environment@ modifyEnv :: (MonadState CheckState m) => (Environment -> Environment) -> m () -modifyEnv f = modify (\s -> s { checkEnv = f (checkEnv s) }) +modifyEnv f = modify (\s -> s {checkEnv = f (checkEnv s)}) -- | Run a computation in the typechecking monad, failing with an error, or succeeding with a return value and the final @Environment@. runCheck :: (Functor m) => CheckState -> StateT CheckState m a -> m (a, Environment) @@ -338,50 +344,52 @@ guardWith :: (MonadError e m) => e -> Bool -> m () guardWith _ True = return () guardWith e False = throwError e -capturingSubstitution - :: MonadState CheckState m - => (a -> Substitution -> b) - -> m a - -> m b +capturingSubstitution :: + (MonadState CheckState m) => + (a -> Substitution -> b) -> + m a -> + m b capturingSubstitution f ma = do a <- ma subst <- gets checkSubstitution return (f a subst) -withFreshSubstitution - :: MonadState CheckState m - => m a - -> m a +withFreshSubstitution :: + (MonadState CheckState m) => + m a -> + m a withFreshSubstitution ma = do orig <- get - modify $ \st -> st { checkSubstitution = emptySubstitution } + modify $ \st -> st {checkSubstitution = emptySubstitution} a <- ma - modify $ \st -> st { checkSubstitution = checkSubstitution orig } + modify $ \st -> st {checkSubstitution = checkSubstitution orig} return a -withoutWarnings - :: MonadWriter w m - => m a - -> m (a, w) +withoutWarnings :: + (MonadWriter w m) => + m a -> + m (a, w) withoutWarnings = censor (const mempty) . listen -unsafeCheckCurrentModule - :: forall m - . (MonadError MultipleErrors m, MonadState CheckState m) - => m ModuleName -unsafeCheckCurrentModule = gets checkCurrentModule >>= \case - Nothing -> internalError "No module name set in scope" - Just name -> pure name +unsafeCheckCurrentModule :: + forall m. + (MonadError MultipleErrors m, MonadState CheckState m) => + m ModuleName +unsafeCheckCurrentModule = + gets checkCurrentModule >>= \case + Nothing -> internalError "No module name set in scope" + Just name -> pure name debugEnv :: Environment -> [String] -debugEnv env = join - [ debugTypes env - , debugTypeSynonyms env - , debugTypeClasses env - , debugTypeClassDictionaries env - , debugDataConstructors env - , debugNames env - ] +debugEnv env = + join + [ debugTypes env + , debugTypeSynonyms env + , debugTypeClasses env + , debugTypeClassDictionaries env + , debugDataConstructors env + , debugNames env + ] debugType :: Type a -> String debugType = init . prettyPrintType 100 @@ -393,72 +401,71 @@ debugConstraint (Constraint ann clsName kinds args _) = debugTypes :: Environment -> [String] debugTypes = go <=< M.toList . types where - go (qual, (srcTy, which)) = do - let - ppTy = prettyPrintType 100 srcTy - name = showQualified runProperName qual - decl = case which of - DataType _ _ _ -> "data" - TypeSynonym -> "type" - ExternData _ -> "extern" - LocalTypeVariable -> "local" - ScopedTypeVar -> "scoped" - guard (not ("Prim" `isPrefixOf` name)) - pure $ decl <> " " <> unpack name <> " :: " <> init ppTy + go (qual, (srcTy, which)) = do + let + ppTy = prettyPrintType 100 srcTy + name = showQualified runProperName qual + decl = case which of + DataType _ _ _ -> "data" + TypeSynonym -> "type" + ExternData _ -> "extern" + LocalTypeVariable -> "local" + ScopedTypeVar -> "scoped" + guard (not ("Prim" `isPrefixOf` name)) + pure $ decl <> " " <> unpack name <> " :: " <> init ppTy debugNames :: Environment -> [String] debugNames = fmap go . M.toList . names where - go (qual, (srcTy, _, _)) = do - let - ppTy = prettyPrintType 100 srcTy - name = showQualified runIdent qual - unpack name <> " :: " <> init ppTy + go (qual, (srcTy, _, _)) = do + let + ppTy = prettyPrintType 100 srcTy + name = showQualified runIdent qual + unpack name <> " :: " <> init ppTy debugDataConstructors :: Environment -> [String] debugDataConstructors = fmap go . M.toList . dataConstructors where - go (qual, (_, _, ty, _)) = do - let - ppTy = prettyPrintType 100 ty - name = showQualified runProperName qual - unpack name <> " :: " <> init ppTy + go (qual, (_, _, ty, _)) = do + let + ppTy = prettyPrintType 100 ty + name = showQualified runProperName qual + unpack name <> " :: " <> init ppTy debugTypeSynonyms :: Environment -> [String] debugTypeSynonyms = fmap go . M.toList . typeSynonyms where - go (qual, (binders, subTy)) = do - let - vars = unwords $ flip fmap binders $ \case - (v, Just k) -> "(" <> unpack v <> " :: " <> init (prettyPrintType 100 k) <> ")" - (v, Nothing) -> unpack v - ppTy = prettyPrintType 100 subTy - name = showQualified runProperName qual - "type " <> unpack name <> " " <> vars <> " = " <> init ppTy + go (qual, (binders, subTy)) = do + let + vars = unwords $ flip fmap binders $ \case + (v, k) -> "(" <> unpack v <> " :: " <> init (prettyPrintType 100 k) <> ")" + ppTy = prettyPrintType 100 subTy + name = showQualified runProperName qual + "type " <> unpack name <> " " <> vars <> " = " <> init ppTy debugTypeClassDictionaries :: Environment -> [String] debugTypeClassDictionaries = go . typeClassDictionaries where - go tcds = do - (mbModuleName, classes) <- M.toList tcds - (className, instances) <- M.toList classes - (ident, dicts) <- M.toList instances - let - moduleName = maybe "" (\m -> "[" <> runModuleName m <> "] ") (toMaybeModuleName mbModuleName) - className' = showQualified runProperName className - ident' = showQualified runIdent ident - kds = unwords $ fmap ((\a -> "@(" <> a <> ")") . debugType) $ tcdInstanceKinds $ NEL.head dicts - tys = unwords $ fmap ((\a -> "(" <> a <> ")") . debugType) $ tcdInstanceTypes $ NEL.head dicts - pure $ "dict " <> unpack moduleName <> unpack className' <> " " <> unpack ident' <> " (" <> show (length dicts) <> ")" <> " " <> kds <> " " <> tys + go tcds = do + (mbModuleName, classes) <- M.toList tcds + (className, instances) <- M.toList classes + (ident, dicts) <- M.toList instances + let + moduleName = maybe "" (\m -> "[" <> runModuleName m <> "] ") (toMaybeModuleName mbModuleName) + className' = showQualified runProperName className + ident' = showQualified runIdent ident + kds = unwords $ fmap ((\a -> "@(" <> a <> ")") . debugType) $ tcdInstanceKinds $ NEL.head dicts + tys = unwords $ fmap ((\a -> "(" <> a <> ")") . debugType) $ tcdInstanceTypes $ NEL.head dicts + pure $ "dict " <> unpack moduleName <> unpack className' <> " " <> unpack ident' <> " (" <> show (length dicts) <> ")" <> " " <> kds <> " " <> tys debugTypeClasses :: Environment -> [String] debugTypeClasses = fmap go . M.toList . typeClasses where - go (className, tc) = do - let - className' = showQualified runProperName className - args = unwords $ (\(a, b) -> "(" <> debugType (maybe (srcTypeVar a) (srcKindedType (srcTypeVar a)) b) <> ")") <$> typeClassArguments tc - "class " <> unpack className' <> " " <> args + go (className, tc) = do + let + className' = showQualified runProperName className + args = unwords $ (\(a, b) -> "(" <> debugType (srcTypeVar a b) <> ")") <$> typeClassArguments tc + "class " <> unpack className' <> " " <> args debugValue :: Expr -> String debugValue = init . render . prettyPrintValue 100 @@ -471,14 +478,14 @@ debugSubstitution (Substitution solved unsolved names) = , fmap go3 (M.toList names) ] where - unsolved' = - M.filterWithKey (\k _ -> M.notMember k solved) unsolved + unsolved' = + M.filterWithKey (\k _ -> M.notMember k solved) unsolved - go1 (u, ty) = - "?" <> show u <> " = " <> debugType ty + go1 (u, ty) = + "?" <> show u <> " = " <> debugType ty - go2 (u, (_, k)) = - "?" <> show u <> " :: " <> debugType k + go2 (u, (_, k)) = + "?" <> show u <> " :: " <> debugType k - go3 (u, t) = - unpack t <> show u + go3 (u, t) = + unpack t <> show u diff --git a/src/Language/PureScript/TypeChecker/Roles.hs b/src/Language/PureScript/TypeChecker/Roles.hs index 7b38a317b..720ea94de 100644 --- a/src/Language/PureScript/TypeChecker/Roles.hs +++ b/src/Language/PureScript/TypeChecker/Roles.hs @@ -1,42 +1,43 @@ {-# LANGUAGE TypeApplications #-} --- | --- Role inference --- -module Language.PureScript.TypeChecker.Roles - ( lookupRoles - , checkRoles - , checkRoleDeclarationArity - , inferRoles - , inferDataBindingGroupRoles - ) where +{- | +Role inference +-} +module Language.PureScript.TypeChecker.Roles ( + lookupRoles, + checkRoles, + checkRoleDeclarationArity, + inferRoles, + inferDataBindingGroupRoles, +) where import Prelude import Control.Arrow ((&&&)) import Control.Monad (unless, when, zipWithM_) -import Control.Monad.Error.Class (MonadError(..)) -import Control.Monad.State (MonadState(..), runState, state) +import Control.Monad.Error.Class (MonadError (..)) +import Control.Monad.State (MonadState (..), runState, state) import Data.Coerce (coerce) import Data.Map qualified as M import Data.Maybe (fromMaybe) +import Data.Semigroup (Any (..)) import Data.Set qualified as S -import Data.Semigroup (Any(..)) import Data.Text (Text) -import Language.PureScript.Environment (Environment(..), TypeKind(..)) -import Language.PureScript.Errors (DataConstructorDeclaration(..), MultipleErrors, RoleDeclarationData(..), SimpleErrorMessage(..), errorMessage) -import Language.PureScript.Names (ModuleName, ProperName, ProperNameType(..), Qualified(..), QualifiedBy(..)) -import Language.PureScript.Roles (Role(..)) -import Language.PureScript.Types (Constraint(..), SourceType, Type(..), freeTypeVariables, unapplyTypes) +import Language.PureScript.Environment (Environment (..), TypeKind (..)) +import Language.PureScript.Errors (DataConstructorDeclaration (..), MultipleErrors, RoleDeclarationData (..), SimpleErrorMessage (..), errorMessage) +import Language.PureScript.Names (ModuleName, ProperName, ProperNameType (..), Qualified (..), QualifiedBy (..)) +import Language.PureScript.Roles (Role (..)) +import Language.PureScript.Types (Constraint (..), SourceType, Type (..), freeTypeVariables, unapplyTypes) --- | --- A map of a type's formal parameter names to their roles. This type's --- @Semigroup@ and @Monoid@ instances preserve the least-permissive role --- ascribed to any given variable, as defined by the @Role@ type's @Ord@ --- instance. That is, a variable that has been marked as @Nominal@ can not --- later be marked @Representational@, and so on. -newtype RoleMap = RoleMap { getRoleMap :: M.Map Text Role } +{- | +A map of a type's formal parameter names to their roles. This type's +@Semigroup@ and @Monoid@ instances preserve the least-permissive role +ascribed to any given variable, as defined by the @Role@ type's @Ord@ +instance. That is, a variable that has been marked as @Nominal@ can not +later be marked @Representational@, and so on. +-} +newtype RoleMap = RoleMap {getRoleMap :: M.Map Text Role} instance Semigroup RoleMap where (<>) = @@ -61,203 +62,205 @@ getRoleEnv :: Environment -> RoleEnv getRoleEnv env = M.mapMaybe (typeKindRoles . snd) (types env) -updateRoleEnv - :: Qualified (ProperName 'TypeName) - -> [Role] - -> RoleEnv - -> (Any, RoleEnv) +updateRoleEnv :: + Qualified (ProperName 'TypeName) -> + [Role] -> + RoleEnv -> + (Any, RoleEnv) updateRoleEnv qualTyName roles' roleEnv = let roles = fromMaybe (repeat Phantom) $ M.lookup qualTyName roleEnv mostRestrictiveRoles = zipWith min roles roles' didRolesChange = any (uncurry (<)) $ zip mostRestrictiveRoles roles - in (Any didRolesChange, M.insert qualTyName mostRestrictiveRoles roleEnv) + in (Any didRolesChange, M.insert qualTyName mostRestrictiveRoles roleEnv) --- | --- Lookup the roles for a type in the environment. If the type does not have --- roles (e.g. is a type synonym or a type variable), then this function --- returns an empty list. --- -lookupRoles - :: Environment - -> Qualified (ProperName 'TypeName) - -> [Role] +{- | +Lookup the roles for a type in the environment. If the type does not have +roles (e.g. is a type synonym or a type variable), then this function +returns an empty list. +-} +lookupRoles :: + Environment -> + Qualified (ProperName 'TypeName) -> + [Role] lookupRoles env tyName = fromMaybe [] $ M.lookup tyName (types env) >>= typeKindRoles . snd --- | --- Compares the inferred roles to the explicitly declared roles and ensures --- that the explicitly declared roles are not more permissive than the --- inferred ones. --- -checkRoles - :: forall m - . (MonadError MultipleErrors m) - => [(Text, Maybe SourceType, Role)] - -- ^ type parameters for the data type whose roles we are checking - -> [Role] - -- ^ roles declared for the data type - -> m () +{- | +Compares the inferred roles to the explicitly declared roles and ensures +that the explicitly declared roles are not more permissive than the +inferred ones. +-} +checkRoles :: + forall m. + (MonadError MultipleErrors m) => + -- | type parameters for the data type whose roles we are checking + [(Text, SourceType, Role)] -> + -- | roles declared for the data type + [Role] -> + m () checkRoles tyArgs declaredRoles = do let k (var, _, inf) dec = when (inf < dec) . throwError . errorMessage $ RoleMismatch var inf dec zipWithM_ k tyArgs declaredRoles -checkRoleDeclarationArity - :: forall m - . (MonadError MultipleErrors m) - => ProperName 'TypeName - -> [Role] - -> Int - -> m () +checkRoleDeclarationArity :: + forall m. + (MonadError MultipleErrors m) => + ProperName 'TypeName -> + [Role] -> + Int -> + m () checkRoleDeclarationArity tyName roles expected = do let actual = length roles unless (expected == actual) $ throwError . errorMessage $ RoleDeclarationArityMismatch tyName expected actual --- | --- Infers roles for the given data type declaration. --- -inferRoles - :: Environment - -> ModuleName - -> ProperName 'TypeName - -- ^ The name of the data type whose roles we are checking - -> [(Text, Maybe SourceType)] - -- ^ type parameters for the data type whose roles we are checking - -> [DataConstructorDeclaration] - -- ^ constructors of the data type whose roles we are checking - -> [Role] +{- | +Infers roles for the given data type declaration. +-} +inferRoles :: + Environment -> + ModuleName -> + -- | The name of the data type whose roles we are checking + ProperName 'TypeName -> + -- | type parameters for the data type whose roles we are checking + [(Text, SourceType)] -> + -- | constructors of the data type whose roles we are checking + [DataConstructorDeclaration] -> + [Role] inferRoles env moduleName tyName tyArgs ctors = inferDataBindingGroupRoles env moduleName [] [(tyName, tyArgs, ctors)] tyName tyArgs -inferDataBindingGroupRoles - :: Environment - -> ModuleName - -> [RoleDeclarationData] - -> [DataDeclaration] - -> ProperName 'TypeName - -> [(Text, Maybe SourceType)] - -> [Role] +inferDataBindingGroupRoles :: + Environment -> + ModuleName -> + [RoleDeclarationData] -> + [DataDeclaration] -> + ProperName 'TypeName -> + [(Text, SourceType)] -> + [Role] inferDataBindingGroupRoles env moduleName roleDeclarations group = let declaredRoleEnv = M.fromList $ map (Qualified (ByModuleName moduleName) . rdeclIdent &&& rdeclRoles) roleDeclarations inferredRoleEnv = getRoleEnv env initialRoleEnv = declaredRoleEnv `M.union` inferredRoleEnv inferredRoleEnv' = inferDataBindingGroupRoles' moduleName group initialRoleEnv - in \tyName tyArgs -> + in \tyName tyArgs -> let qualTyName = Qualified (ByModuleName moduleName) tyName inferredRoles = M.lookup qualTyName inferredRoleEnv' - in fromMaybe (Phantom <$ tyArgs) inferredRoles + in fromMaybe (Phantom <$ tyArgs) inferredRoles type DataDeclaration = ( ProperName 'TypeName - , [(Text, Maybe SourceType)] + , [(Text, SourceType)] , [DataConstructorDeclaration] ) -inferDataBindingGroupRoles' - :: ModuleName - -> [DataDeclaration] - -> RoleEnv - -> RoleEnv +inferDataBindingGroupRoles' :: + ModuleName -> + [DataDeclaration] -> + RoleEnv -> + RoleEnv inferDataBindingGroupRoles' moduleName group roleEnv = - let (Any didRolesChange, roleEnv') = flip runState roleEnv $ - mconcat <$> traverse (state . inferDataDeclarationRoles moduleName) group - in if didRolesChange - then inferDataBindingGroupRoles' moduleName group roleEnv' - else roleEnv' + let (Any didRolesChange, roleEnv') = + flip runState roleEnv $ + mconcat <$> traverse (state . inferDataDeclarationRoles moduleName) group + in if didRolesChange + then inferDataBindingGroupRoles' moduleName group roleEnv' + else roleEnv' --- | --- Infers roles for the given data type declaration, along with a flag to tell --- if more restrictive roles were added to the environment. --- -inferDataDeclarationRoles - :: ModuleName - -> DataDeclaration - -> RoleEnv - -> (Any, RoleEnv) +{- | +Infers roles for the given data type declaration, along with a flag to tell +if more restrictive roles were added to the environment. +-} +inferDataDeclarationRoles :: + ModuleName -> + DataDeclaration -> + RoleEnv -> + (Any, RoleEnv) inferDataDeclarationRoles moduleName (tyName, tyArgs, ctors) roleEnv = let qualTyName = Qualified (ByModuleName moduleName) tyName ctorRoles = getRoleMap . foldMap (walk mempty . snd) $ ctors >>= dataCtorFields inferredRoles = map (\(arg, _) -> fromMaybe Phantom (M.lookup arg ctorRoles)) tyArgs - in updateRoleEnv qualTyName inferredRoles roleEnv + in updateRoleEnv qualTyName inferredRoles roleEnv where - -- This function is named @walk@ to match the specification given in the - -- "Role inference" section of the paper "Safe Zero-cost Coercions for - -- Haskell". - walk :: S.Set Text -> SourceType -> RoleMap - walk btvs (TypeVar _ v) - -- A type variable standing alone (e.g. @a@ in @data D a b = D a@) is - -- representational, _unless_ it has been bound by a quantifier, in which - -- case it is not actually a parameter to the type (e.g. @z@ in - -- @data T z = T (forall z. z -> z)@). - | S.member v btvs = - mempty - | otherwise = - RoleMap $ M.singleton v Representational - walk btvs (ForAll _ _ tv _ t _) = - -- We can walk under universal quantifiers as long as we make note of the - -- variables that they bind. For instance, given a definition - -- @data T z = T (forall z. z -> z)@, we will make note that @z@ is bound - -- by a quantifier so that we do not mark @T@'s parameter as - -- representational later on. Similarly, given a definition like - -- @data D a = D (forall r. r -> a)@, we'll mark @r@ as bound so that it - -- doesn't appear as a spurious parameter to @D@ when we complete - -- inference. - walk (S.insert tv btvs) t - walk btvs (ConstrainedType _ Constraint{..} t) = - -- For constrained types, mark all free variables in the constraint - -- arguments as nominal and recurse on the type beneath the constraint. - walk btvs t <> foldMap (freeNominals btvs) constraintArgs - walk btvs (RCons _ _ thead ttail) = do - -- For row types, we just walk along them and collect the results. - walk btvs thead <> walk btvs ttail - walk btvs (KindedType _ t _k) = - -- For kind-annotated types, discard the annotation and recurse on the - -- type beneath. + -- This function is named @walk@ to match the specification given in the + -- "Role inference" section of the paper "Safe Zero-cost Coercions for + -- Haskell". + walk :: S.Set Text -> SourceType -> RoleMap + walk btvs (TypeVar _ v _) + -- A type variable standing alone (e.g. @a@ in @data D a b = D a@) is + -- representational, _unless_ it has been bound by a quantifier, in which + -- case it is not actually a parameter to the type (e.g. @z@ in + -- @data T z = T (forall z. z -> z)@). + | S.member v btvs = + mempty + | otherwise = + RoleMap $ M.singleton v Representational + walk btvs (ForAll _ _ tv _ t _) = + -- We can walk under universal quantifiers as long as we make note of the + -- variables that they bind. For instance, given a definition + -- @data T z = T (forall z. z -> z)@, we will make note that @z@ is bound + -- by a quantifier so that we do not mark @T@'s parameter as + -- representational later on. Similarly, given a definition like + -- @data D a = D (forall r. r -> a)@, we'll mark @r@ as bound so that it + -- doesn't appear as a spurious parameter to @D@ when we complete + -- inference. + walk (S.insert tv btvs) t + walk btvs (ConstrainedType _ Constraint {..} t) = + -- For constrained types, mark all free variables in the constraint + -- arguments as nominal and recurse on the type beneath the constraint. + walk btvs t <> foldMap (freeNominals btvs) constraintArgs + walk btvs (RCons _ _ thead ttail) = do + -- For row types, we just walk along them and collect the results. + walk btvs thead <> walk btvs ttail + walk btvs (KindedType _ t _k) = + -- For kind-annotated types, discard the annotation and recurse on the + -- type beneath. + walk btvs t walk btvs t - walk btvs t - | (t1, _, t2s) <- unapplyTypes t - , not $ null t2s = - case t1 of - -- If the type is an application of a type constructor to some - -- arguments, recursively infer the roles of the type constructor's - -- arguments. For each (role, argument) pair: - -- - -- - If the role is nominal, mark all free variables in the argument - -- as nominal also, since they cannot be coerced if the - -- argument's nominality is to be preserved. - -- - -- - If the role is representational, recurse on the argument, since - -- its use of our parameters is important. - -- - -- - If the role is phantom, terminate, since the argument's use of - -- our parameters is unimportant. - TypeConstructor _ t1Name -> - let - t1Roles = fromMaybe (repeat Phantom) $ M.lookup t1Name roleEnv - k role ti = case role of - Nominal -> - freeNominals btvs ti - Representational -> - go ti - Phantom -> - mempty - in mconcat (zipWith k t1Roles t2s) - -- If the type is an application of any other type-level term, walk - -- that term to collect its roles and mark all free variables in - -- its argument as nominal. - _ -> do - go t1 <> foldMap (freeNominals btvs) t2s - | otherwise = - mempty - where - go = walk btvs + | (t1, _, t2s) <- unapplyTypes t + , not $ null t2s = + case t1 of + -- If the type is an application of a type constructor to some + -- arguments, recursively infer the roles of the type constructor's + -- arguments. For each (role, argument) pair: + -- + -- - If the role is nominal, mark all free variables in the argument + -- as nominal also, since they cannot be coerced if the + -- argument's nominality is to be preserved. + -- + -- - If the role is representational, recurse on the argument, since + -- its use of our parameters is important. + -- + -- - If the role is phantom, terminate, since the argument's use of + -- our parameters is unimportant. + TypeConstructor _ t1Name -> + let + t1Roles = fromMaybe (repeat Phantom) $ M.lookup t1Name roleEnv + k role ti = case role of + Nominal -> + freeNominals btvs ti + Representational -> + go ti + Phantom -> + mempty + in + mconcat (zipWith k t1Roles t2s) + -- If the type is an application of any other type-level term, walk + -- that term to collect its roles and mark all free variables in + -- its argument as nominal. + _ -> do + go t1 <> foldMap (freeNominals btvs) t2s + | otherwise = + mempty + where + go = walk btvs -- Given a type, computes the list of free variables in that type -- (taking into account those bound in @walk@) and returns a @RoleMap@ -- ascribing a nominal role to each of those variables. freeNominals :: S.Set Text -> SourceType -> RoleMap freeNominals btvs x = - let ftvs = filter (flip S.notMember btvs) (freeTypeVariables x) - in RoleMap (M.fromList $ map (, Nominal) ftvs) + let ftvs = filter (flip S.notMember btvs) (fst <$> freeTypeVariables x) + in RoleMap (M.fromList $ map (,Nominal) ftvs) diff --git a/src/Language/PureScript/TypeChecker/Skolems.hs b/src/Language/PureScript/TypeChecker/Skolems.hs index aa49997fd..4d95e2972 100644 --- a/src/Language/PureScript/TypeChecker/Skolems.hs +++ b/src/Language/PureScript/TypeChecker/Skolems.hs @@ -1,59 +1,60 @@ -- | Functions relating to skolemization used during typechecking -module Language.PureScript.TypeChecker.Skolems - ( newSkolemConstant - , introduceSkolemScope - , newSkolemScope - , skolemize - , skolemizeTypesInValue - , skolemEscapeCheck - ) where +module Language.PureScript.TypeChecker.Skolems ( + newSkolemConstant, + introduceSkolemScope, + newSkolemScope, + skolemize, + skolemizeTypesInValue, + skolemEscapeCheck, +) where import Prelude -import Control.Monad.Error.Class (MonadError(..)) -import Control.Monad.State.Class (MonadState(..), gets, modify) +import Control.Monad.Error.Class (MonadError (..)) +import Control.Monad.State.Class (MonadState (..), gets, modify) import Data.Foldable (traverse_) -import Data.Functor.Identity (Identity(), runIdentity) +import Data.Functor.Identity (Identity (), runIdentity) import Data.Set (Set, fromList, notMember) import Data.Text (Text) -import Language.PureScript.AST (Binder(..), ErrorMessageHint(..), Expr(..), SourceAnn, SourceSpan, everythingWithContextOnValues, everywhereWithContextOnValuesM, nonEmptySpan) +import Language.PureScript.AST (Binder (..), ErrorMessageHint (..), Expr (..), SourceAnn, SourceSpan, everythingWithContextOnValues, everywhereWithContextOnValuesM, nonEmptySpan) import Language.PureScript.Crash (internalError) -import Language.PureScript.Errors (ErrorMessage(..), MultipleErrors, SimpleErrorMessage(..), positionedError, singleError) +import Language.PureScript.Errors (ErrorMessage (..), MultipleErrors, SimpleErrorMessage (..), positionedError, singleError) import Language.PureScript.Traversals (defS) -import Language.PureScript.TypeChecker.Monad (CheckState(..)) -import Language.PureScript.Types (SkolemScope(..), SourceType, Type(..), everythingOnTypes, everywhereOnTypesM, replaceTypeVars) +import Language.PureScript.TypeChecker.Monad (CheckState (..)) +import Language.PureScript.Types (SkolemScope (..), SourceType, Type (..), everythingOnTypes, everywhereOnTypesM, replaceTypeVars) -- | Generate a new skolem constant -newSkolemConstant :: MonadState CheckState m => m Int +newSkolemConstant :: (MonadState CheckState m) => m Int newSkolemConstant = do s <- gets checkNextSkolem - modify $ \st -> st { checkNextSkolem = s + 1 } + modify $ \st -> st {checkNextSkolem = s + 1} return s -- | Introduce skolem scope at every occurrence of a ForAll -introduceSkolemScope :: MonadState CheckState m => Type a -> m (Type a) +introduceSkolemScope :: (MonadState CheckState m) => Type a -> m (Type a) introduceSkolemScope = everywhereOnTypesM go where - go (ForAll ann vis ident mbK ty Nothing) = ForAll ann vis ident mbK ty <$> (Just <$> newSkolemScope) - go other = return other + go (ForAll ann vis ident mbK ty Nothing) = ForAll ann vis ident mbK ty <$> (Just <$> newSkolemScope) + go other = return other -- | Generate a new skolem scope -newSkolemScope :: MonadState CheckState m => m SkolemScope +newSkolemScope :: (MonadState CheckState m) => m SkolemScope newSkolemScope = do s <- gets checkNextSkolemScope - modify $ \st -> st { checkNextSkolemScope = s + 1 } + modify $ \st -> st {checkNextSkolemScope = s + 1} return $ SkolemScope s -- | Skolemize a type variable by replacing its instances with fresh skolem constants -skolemize :: a -> Text -> Maybe (Type a) -> Int -> SkolemScope -> Type a -> Type a +skolemize :: a -> Text -> (Type a) -> Int -> SkolemScope -> Type a -> Type a skolemize ann ident mbK sko scope = replaceTypeVars ident (Skolem ann ident mbK sko scope) --- | This function skolemizes type variables appearing in any type signatures or --- 'DeferredDictionary' placeholders. These type variables are the only places --- where scoped type variables can appear in expressions. -skolemizeTypesInValue :: SourceAnn -> Text -> Maybe SourceType -> Int -> SkolemScope -> Expr -> Expr +{- | This function skolemizes type variables appearing in any type signatures or +'DeferredDictionary' placeholders. These type variables are the only places +where scoped type variables can appear in expressions. +-} +skolemizeTypesInValue :: SourceAnn -> Text -> SourceType -> Int -> SkolemScope -> Expr -> Expr skolemizeTypesInValue ann ident mbK sko scope = - runIdentity . onExpr' + runIdentity . onExpr' where onExpr' :: Expr -> Identity Expr (_, onExpr', _, _, _, _) = everywhereWithContextOnValuesM [] defS onExpr onBinder defS defS defS @@ -76,37 +77,39 @@ skolemizeTypesInValue ann ident mbK sko scope = peelTypeVars (ForAll _ _ i _ ty _) = i : peelTypeVars ty peelTypeVars _ = [] --- | Ensure skolem variables do not escape their scope --- --- Every skolem variable is created when a 'ForAll' type is skolemized. --- This determines the scope of that skolem variable, which is copied from --- the 'SkolemScope' field of the 'ForAll' constructor. --- --- This function traverses the tree top-down, and collects any 'SkolemScope's --- introduced by 'ForAll's. If a 'Skolem' is encountered whose 'SkolemScope' is --- not in the current list, then we have found an escaped skolem variable. -skolemEscapeCheck :: MonadError MultipleErrors m => Expr -> m () +{- | Ensure skolem variables do not escape their scope + +Every skolem variable is created when a 'ForAll' type is skolemized. +This determines the scope of that skolem variable, which is copied from +the 'SkolemScope' field of the 'ForAll' constructor. + +This function traverses the tree top-down, and collects any 'SkolemScope's +introduced by 'ForAll's. If a 'Skolem' is encountered whose 'SkolemScope' is +not in the current list, then we have found an escaped skolem variable. +-} +skolemEscapeCheck :: (MonadError MultipleErrors m) => Expr -> m () skolemEscapeCheck (TypedValue False _ _) = return () -skolemEscapeCheck expr@TypedValue{} = - traverse_ (throwError . singleError) (toSkolemErrors expr) +skolemEscapeCheck expr@TypedValue {} = + traverse_ (throwError . singleError) (toSkolemErrors expr) where toSkolemErrors :: Expr -> [ErrorMessage] (_, toSkolemErrors, _, _, _) = everythingWithContextOnValues (mempty, Nothing) [] (<>) def go def def def def s _ = (s, []) - go :: (Set SkolemScope, Maybe SourceSpan) - -> Expr - -> ((Set SkolemScope, Maybe SourceSpan), [ErrorMessage]) + go :: + (Set SkolemScope, Maybe SourceSpan) -> + Expr -> + ((Set SkolemScope, Maybe SourceSpan), [ErrorMessage]) go (scopes, _) (PositionedValue ss _ _) = ((scopes, Just ss), []) go (scopes, ssUsed) val@(TypedValue _ _ ty) = - ( (allScopes, ssUsed) - , [ ErrorMessage (maybe id ((:) . positionedError) ssUsed [ ErrorInExpression val ]) $ - EscapedSkolem name (nonEmptySpan ssBound) ty - | (ssBound, name, scope) <- collectSkolems ty - , notMember scope allScopes - ] - ) + ( (allScopes, ssUsed) + , [ ErrorMessage (maybe id ((:) . positionedError) ssUsed [ErrorInExpression val]) $ + EscapedSkolem name (nonEmptySpan ssBound) ty + | (ssBound, name, scope) <- collectSkolems ty + , notMember scope allScopes + ] + ) where -- Any new skolem scopes introduced by universal quantifiers newScopes :: [SkolemScope] @@ -119,13 +122,14 @@ skolemEscapeCheck expr@TypedValue{} = -- Collect any scopes appearing in quantifiers at the top level collectScopes :: SourceType -> [SkolemScope] collectScopes (ForAll _ _ _ _ t (Just sco)) = sco : collectScopes t - collectScopes ForAll{} = internalError "skolemEscapeCheck: No skolem scope" + collectScopes ForAll {} = internalError "skolemEscapeCheck: No skolem scope" collectScopes _ = [] -- Collect any skolem variables appearing in a type collectSkolems :: SourceType -> [(SourceAnn, Text, SkolemScope)] - collectSkolems = everythingOnTypes (++) collect where - collect (Skolem ss name _ _ scope) = [(ss, name, scope)] - collect _ = [] + collectSkolems = everythingOnTypes (++) collect + where + collect (Skolem ss name _ _ scope) = [(ss, name, scope)] + collect _ = [] go scos _ = (scos, []) skolemEscapeCheck _ = internalError "skolemEscapeCheck: untyped value" diff --git a/src/Language/PureScript/TypeChecker/Subsumption.hs b/src/Language/PureScript/TypeChecker/Subsumption.hs index 26da5e980..5187b5e8c 100644 --- a/src/Language/PureScript/TypeChecker/Subsumption.hs +++ b/src/Language/PureScript/TypeChecker/Subsumption.hs @@ -1,51 +1,71 @@ {-# LANGUAGE GADTs #-} -- | Subsumption checking -module Language.PureScript.TypeChecker.Subsumption - ( subsumes - ) where +module Language.PureScript.TypeChecker.Subsumption ( + subsumes, +) where import Prelude import Control.Monad (when) -import Control.Monad.Error.Class (MonadError(..)) -import Control.Monad.State.Class (MonadState(..)) +import Control.Monad.Error.Class (MonadError (..)) +import Control.Monad.State.Class (MonadState (..)) import Data.Foldable (for_) import Data.List (uncons) import Data.List.Ordered (minusBy') import Data.Ord (comparing) -import Language.PureScript.AST (ErrorMessageHint(..), Expr(..), pattern NullSourceAnn) +import Language.PureScript.AST (ErrorMessageHint (..), Expr (..), pattern NullSourceAnn) import Language.PureScript.Crash (internalError) import Language.PureScript.Environment (tyFunction, tyRecord) -import Language.PureScript.Errors (MultipleErrors, SimpleErrorMessage(..), errorMessage, internalCompilerError) +import Language.PureScript.Errors (MultipleErrors, SimpleErrorMessage (..), errorMessage, internalCompilerError) import Language.PureScript.TypeChecker.Monad (CheckState, getHints, getTypeClassDictionaries, withErrorMessageHint) import Language.PureScript.TypeChecker.Skolems (newSkolemConstant, skolemize) import Language.PureScript.TypeChecker.Unify (alignRowsWith, freshTypeWithKind, unifyTypes) -import Language.PureScript.Types (RowListItem(..), SourceType, Type(..), eqType, isREmpty, replaceTypeVars, rowFromList) - --- | Subsumption can operate in two modes: --- --- * Elaboration mode, in which we try to insert type class dictionaries --- * No-elaboration mode, in which we do not insert dictionaries --- --- Some subsumption rules apply in both modes, and others are specific to --- certain modes. --- --- The subsumption algorithm follows the structure of the types in question, --- and we can switch into no-elaboration mode when we move under a type --- constructor where we can no longer insert dictionaries, e.g. into the fields --- of a record. +import Language.PureScript.Types (RowListItem (..), SourceType, Type (..), eqType, isREmpty, replaceTypeVars, rowFromList) + +import Debug.Trace (trace, traceM) +import Language.Purus.Pretty.Types (prettyTypeStr) + +moduleTraces :: Bool +moduleTraces = True + +goTrace :: forall x. String -> x -> x +goTrace str x + | moduleTraces = trace str x + | otherwise = x + +goTraceM :: forall f. (Applicative f) => String -> f () +goTraceM msg + | moduleTraces = traceM msg + | otherwise = pure () + +spacer = "\n" <> replicate 20 '-' + +{- | Subsumption can operate in two modes: + +* Elaboration mode, in which we try to insert type class dictionaries +* No-elaboration mode, in which we do not insert dictionaries + +Some subsumption rules apply in both modes, and others are specific to +certain modes. + +The subsumption algorithm follows the structure of the types in question, +and we can switch into no-elaboration mode when we move under a type +constructor where we can no longer insert dictionaries, e.g. into the fields +of a record. +-} data Mode = Elaborate | NoElaborate -- | Value-level proxies for the two modes data ModeSing (mode :: Mode) where - SElaborate :: ModeSing 'Elaborate + SElaborate :: ModeSing 'Elaborate SNoElaborate :: ModeSing 'NoElaborate --- | This type family tracks what evidence we return from 'subsumes' for each --- mode. +{- | This type family tracks what evidence we return from 'subsumes' for each +mode. +-} type family Coercion (mode :: Mode) where -- When elaborating, we generate a coercion Coercion 'Elaborate = Expr -> Expr @@ -54,28 +74,36 @@ type family Coercion (mode :: Mode) where -- | The default coercion for each mode. defaultCoercion :: ModeSing mode -> Coercion mode -defaultCoercion SElaborate = id +defaultCoercion SElaborate = id defaultCoercion SNoElaborate = () -- | Check that one type subsumes another, rethrowing errors to provide a better error message -subsumes - :: (MonadError MultipleErrors m, MonadState CheckState m) - => SourceType - -> SourceType - -> m (Expr -> Expr) +subsumes :: + (MonadError MultipleErrors m, MonadState CheckState m) => + SourceType -> + SourceType -> + m (Expr -> Expr) subsumes ty1 ty2 = - withErrorMessageHint (ErrorInSubsumption ty1 ty2) $ - subsumes' SElaborate ty1 ty2 + goTrace msg $ + withErrorMessageHint (ErrorInSubsumption ty1 ty2) $ + subsumes' SElaborate ty1 ty2 + where + msg = + "SUBSUMES" + <> "\n TYPE 1: " + <> prettyTypeStr ty1 + <> "\n TYPE 2: " + <> prettyTypeStr ty2 -- | Check that one type subsumes another -subsumes' - :: (MonadError MultipleErrors m, MonadState CheckState m) - => ModeSing mode - -> SourceType - -> SourceType - -> m (Coercion mode) +subsumes' :: + (MonadError MultipleErrors m, MonadState CheckState m) => + ModeSing mode -> + SourceType -> + SourceType -> + m (Coercion mode) subsumes' mode (ForAll _ _ ident mbK ty1 _) ty2 = do - u <- maybe (internalCompilerError "Unelaborated forall") freshTypeWithKind mbK + u <- freshTypeWithKind mbK let replaced = replaceTypeVars ident u ty1 subsumes' mode replaced ty2 subsumes' mode ty1 (ForAll _ _ ident mbK ty2 sco) = @@ -103,27 +131,30 @@ subsumes' SElaborate (ConstrainedType _ con ty1) ty2 = do let addDicts val = App val (TypeClassDictionary con dicts hints) return (elaborate . addDicts) subsumes' mode (TypeApp _ f1 r1) (TypeApp _ f2 r2) | eqType f1 tyRecord && eqType f2 tyRecord = do - let goWithLabel l t1 t2 = withErrorMessageHint (ErrorInRowLabel l) $ subsumes' SNoElaborate t1 t2 - let (common, ((ts1', r1'), (ts2', r2'))) = alignRowsWith goWithLabel r1 r2 - -- For { ts1 | r1 } to subsume { ts2 | r2 } when r1 is empty (= we're working with a closed row), - -- every property in ts2 must appear in ts1. If not, then the candidate expression is missing a required property. - -- Conversely, when r2 is empty, every property in ts1 must appear in ts2, or else the expression has - -- an additional property which is not allowed. - when (isREmpty r1') - (for_ (firstMissingProp ts2' ts1') (throwError . errorMessage . PropertyIsMissing . rowListLabel)) - when (isREmpty r2') - (for_ (firstMissingProp ts1' ts2') (throwError . errorMessage . AdditionalProperty . rowListLabel)) - -- Check subsumption for common labels - sequence_ common - -- Inject the info here - unifyTypes (rowFromList (ts1', r1')) (rowFromList (ts2', r2')) - -- Nothing was elaborated, return the default coercion - return (defaultCoercion mode) + let goWithLabel l t1 t2 = withErrorMessageHint (ErrorInRowLabel l) $ subsumes' SNoElaborate t1 t2 + let (common, ((ts1', r1'), (ts2', r2'))) = alignRowsWith goWithLabel r1 r2 + -- For { ts1 | r1 } to subsume { ts2 | r2 } when r1 is empty (= we're working with a closed row), + -- every property in ts2 must appear in ts1. If not, then the candidate expression is missing a required property. + -- Conversely, when r2 is empty, every property in ts1 must appear in ts2, or else the expression has + -- an additional property which is not allowed. + when + (isREmpty r1') + (for_ (firstMissingProp ts2' ts1') (throwError . errorMessage . PropertyIsMissing . rowListLabel)) + when + (isREmpty r2') + (for_ (firstMissingProp ts1' ts2') (throwError . errorMessage . AdditionalProperty . rowListLabel)) + -- Check subsumption for common labels + sequence_ common + -- Inject the info here + unifyTypes (rowFromList (ts1', r1')) (rowFromList (ts2', r2')) + -- Nothing was elaborated, return the default coercion + return (defaultCoercion mode) where -- Find the first property that's in the first list (of tuples) but not in the second firstMissingProp t1 t2 = fst <$> uncons (minusBy' (comparing rowListLabel) t1 t2) -subsumes' mode ty1 ty2@(TypeApp _ obj _) | obj == tyRecord = - subsumes' mode ty2 ty1 +subsumes' mode ty1 ty2@(TypeApp _ obj _) + | obj == tyRecord = + subsumes' mode ty2 ty1 subsumes' mode ty1 ty2 = do unifyTypes ty1 ty2 -- Nothing was elaborated, return the default coercion diff --git a/src/Language/PureScript/TypeChecker/Synonyms.hs b/src/Language/PureScript/TypeChecker/Synonyms.hs index 567ae415e..1c34b73ba 100644 --- a/src/Language/PureScript/TypeChecker/Synonyms.hs +++ b/src/Language/PureScript/TypeChecker/Synonyms.hs @@ -1,59 +1,59 @@ {-# LANGUAGE GADTs #-} --- | --- Functions for replacing fully applied type synonyms --- -module Language.PureScript.TypeChecker.Synonyms - ( SynonymMap - , KindMap - , replaceAllTypeSynonyms - ) where +{- | +Functions for replacing fully applied type synonyms +-} +module Language.PureScript.TypeChecker.Synonyms ( + SynonymMap, + KindMap, + replaceAllTypeSynonyms, +) where import Prelude -import Control.Monad.Error.Class (MonadError(..)) +import Control.Monad.Error.Class (MonadError (..)) import Control.Monad.State (MonadState) -import Data.Maybe (fromMaybe) import Data.Map qualified as M +import Data.Maybe (fromMaybe) import Data.Text (Text) -import Language.PureScript.Environment (Environment(..), TypeKind) -import Language.PureScript.Errors (MultipleErrors, SimpleErrorMessage(..), SourceSpan, errorMessage') -import Language.PureScript.Names (ProperName, ProperNameType(..), Qualified) +import Language.PureScript.Environment (Environment (..), TypeKind) +import Language.PureScript.Errors (MultipleErrors, SimpleErrorMessage (..), SourceSpan, errorMessage') +import Language.PureScript.Names (ProperName, ProperNameType (..), Qualified) import Language.PureScript.TypeChecker.Monad (CheckState, getEnv) -import Language.PureScript.Types (SourceType, Type(..), completeBinderList, everywhereOnTypesTopDownM, getAnnForType, replaceAllTypeVars) +import Language.PureScript.Types (SourceType, Type (..), completeBinderList, everywhereOnTypesTopDownM, getAnnForType, replaceAllTypeVars) -- | Type synonym information (arguments with kinds, aliased type), indexed by name -type SynonymMap = M.Map (Qualified (ProperName 'TypeName)) ([(Text, Maybe SourceType)], SourceType) +type SynonymMap = M.Map (Qualified (ProperName 'TypeName)) ([(Text, SourceType)], SourceType) type KindMap = M.Map (Qualified (ProperName 'TypeName)) (SourceType, TypeKind) -replaceAllTypeSynonyms' - :: SynonymMap - -> KindMap - -> SourceType - -> Either MultipleErrors SourceType +replaceAllTypeSynonyms' :: + SynonymMap -> + KindMap -> + SourceType -> + Either MultipleErrors SourceType replaceAllTypeSynonyms' syns kinds = everywhereOnTypesTopDownM try where - try :: SourceType -> Either MultipleErrors SourceType - try t = fromMaybe t <$> go (fst $ getAnnForType t) 0 [] [] t - - go :: SourceSpan -> Int -> [SourceType] -> [SourceType] -> SourceType -> Either MultipleErrors (Maybe SourceType) - go ss c kargs args (TypeConstructor _ ctor) - | Just (synArgs, body) <- M.lookup ctor syns - , c == length synArgs - , kindArgs <- lookupKindArgs ctor - , length kargs == length kindArgs - = let repl = replaceAllTypeVars (zip (map fst synArgs) args <> zip kindArgs kargs) body - in Just <$> try repl - | Just (synArgs, _) <- M.lookup ctor syns - , length synArgs > c - = throwError . errorMessage' ss $ PartiallyAppliedSynonym ctor - go ss c kargs args (TypeApp _ f arg) = go ss (c + 1) kargs (arg : args) f - go ss c kargs args (KindApp _ f arg) = go ss c (arg : kargs) args f - go _ _ _ _ _ = return Nothing - - lookupKindArgs :: Qualified (ProperName 'TypeName) -> [Text] - lookupKindArgs ctor = fromMaybe [] $ fmap (fmap (fst . snd) . fst) . completeBinderList . fst =<< M.lookup ctor kinds + try :: SourceType -> Either MultipleErrors SourceType + try t = fromMaybe t <$> go (fst $ getAnnForType t) 0 [] [] t + + go :: SourceSpan -> Int -> [SourceType] -> [SourceType] -> SourceType -> Either MultipleErrors (Maybe SourceType) + go ss c kargs args (TypeConstructor _ ctor) + | Just (synArgs, body) <- M.lookup ctor syns + , c == length synArgs + , kindArgs <- lookupKindArgs ctor + , length kargs == length kindArgs = + let repl = replaceAllTypeVars (zip (map fst synArgs) args <> zip kindArgs kargs) body + in Just <$> try repl + | Just (synArgs, _) <- M.lookup ctor syns + , length synArgs > c = + throwError . errorMessage' ss $ PartiallyAppliedSynonym ctor + go ss c kargs args (TypeApp _ f arg) = go ss (c + 1) kargs (arg : args) f + go ss c kargs args (KindApp _ f arg) = go ss c (arg : kargs) args f + go _ _ _ _ _ = return Nothing + + lookupKindArgs :: Qualified (ProperName 'TypeName) -> [Text] + lookupKindArgs ctor = fromMaybe [] $ fmap (fmap (fst . snd) . fst) . completeBinderList . fst =<< M.lookup ctor kinds -- | Replace fully applied type synonyms replaceAllTypeSynonyms :: (e ~ MultipleErrors, MonadState CheckState m, MonadError e m) => SourceType -> m SourceType diff --git a/src/Language/PureScript/TypeChecker/TypeSearch.hs b/src/Language/PureScript/TypeChecker/TypeSearch.hs index 6158f48a8..c3eb4a403 100644 --- a/src/Language/PureScript/TypeChecker/TypeSearch.hs +++ b/src/Language/PureScript/TypeChecker/TypeSearch.hs @@ -1,6 +1,6 @@ -module Language.PureScript.TypeChecker.TypeSearch - ( typeSearch - ) where +module Language.PureScript.TypeChecker.TypeSearch ( + typeSearch, +) where import Protolude @@ -10,51 +10,51 @@ import Language.PureScript.TypeChecker.Entailment qualified as Entailment import Language.PureScript.TypeChecker.Monad qualified as TC import Language.PureScript.TypeChecker.Subsumption (subsumes) -import Language.PureScript.TypeChecker.Unify as P +import Language.PureScript.TypeChecker.Unify as P -import Control.Monad.Supply as P -import Language.PureScript.AST as P -import Language.PureScript.Environment as P -import Language.PureScript.Errors as P +import Control.Monad.Supply as P +import Language.PureScript.AST as P +import Language.PureScript.Environment as P +import Language.PureScript.Errors as P import Language.PureScript.Label (Label) -import Language.PureScript.Names as P -import Language.PureScript.Pretty.Types as P -import Language.PureScript.TypeChecker.Skolems as Skolem -import Language.PureScript.TypeChecker.Synonyms as P -import Language.PureScript.Types as P - -checkInEnvironment - :: Environment - -> TC.CheckState - -> StateT TC.CheckState (SupplyT (WriterT b (Except P.MultipleErrors))) a - -> Maybe (a, Environment) +import Language.PureScript.Names as P +import Language.PureScript.Pretty.Types as P +import Language.PureScript.TypeChecker.Skolems as Skolem +import Language.PureScript.TypeChecker.Synonyms as P +import Language.PureScript.Types as P + +checkInEnvironment :: + Environment -> + TC.CheckState -> + StateT TC.CheckState (SupplyT (WriterT b (Except P.MultipleErrors))) a -> + Maybe (a, Environment) checkInEnvironment env st = either (const Nothing) Just - . runExcept - . evalWriterT - . P.evalSupplyT 0 - . TC.runCheck (st { TC.checkEnv = env }) + . runExcept + . evalWriterT + . P.evalSupplyT 0 + . TC.runCheck (st {TC.checkEnv = env}) -evalWriterT :: Monad m => WriterT b m r -> m r +evalWriterT :: (Monad m) => WriterT b m r -> m r evalWriterT m = fmap fst (runWriterT m) -checkSubsume - :: Maybe [(P.Ident, Entailment.InstanceContext, P.SourceConstraint)] - -- ^ Additional constraints we need to satisfy - -> P.Environment - -- ^ The Environment which contains the relevant definitions and typeclasses - -> TC.CheckState - -- ^ The typechecker state - -> P.SourceType - -- ^ The user supplied type - -> P.SourceType - -- ^ The type supplied by the environment - -> Maybe ((P.Expr, [(P.Ident, Entailment.InstanceContext, P.SourceConstraint)]), P.Environment) +checkSubsume :: + -- | Additional constraints we need to satisfy + Maybe [(P.Ident, Entailment.InstanceContext, P.SourceConstraint)] -> + -- | The Environment which contains the relevant definitions and typeclasses + P.Environment -> + -- | The typechecker state + TC.CheckState -> + -- | The user supplied type + P.SourceType -> + -- | The type supplied by the environment + P.SourceType -> + Maybe ((P.Expr, [(P.Ident, Entailment.InstanceContext, P.SourceConstraint)]), P.Environment) checkSubsume unsolved env st userT envT = checkInEnvironment env st $ do let initializeSkolems = Skolem.introduceSkolemScope - <=< P.replaceAllTypeSynonyms - <=< P.replaceTypeWildcards + <=< P.replaceAllTypeSynonyms + <=< P.replaceTypeWildcards userT' <- initializeSkolems userT envT' <- initializeSkolems envT @@ -66,30 +66,37 @@ checkSubsume unsolved env st userT envT = checkInEnvironment env st $ do let expP = P.overTypes (P.substituteType subst) (elab dummyExpression) -- Now check that any unsolved constraints have not become impossible - (traverse_ . traverse_) (\(_, context, constraint) -> do - let constraint' = P.mapConstraintArgs (map (P.substituteType subst)) constraint - flip evalStateT Map.empty . evalWriterT $ - Entailment.entails - (Entailment.SolverOptions - { solverShouldGeneralize = True - , solverDeferErrors = False - }) constraint' context []) unsolved + (traverse_ . traverse_) + ( \(_, context, constraint) -> do + let constraint' = P.mapConstraintArgs (map (P.substituteType subst)) constraint + flip evalStateT Map.empty . evalWriterT $ + Entailment.entails + ( Entailment.SolverOptions + { solverShouldGeneralize = True + , solverDeferErrors = False + } + ) + constraint' + context + [] + ) + unsolved -- Finally, check any constraints which were found during elaboration Entailment.replaceTypeClassDictionaries (isJust unsolved) expP -accessorSearch - :: Maybe [(P.Ident, Entailment.InstanceContext, P.SourceConstraint)] - -> P.Environment - -> TC.CheckState - -> P.SourceType - -> ([(Label, P.SourceType)], [(Label, P.SourceType)]) - -- ^ (all accessors we found, all accessors we found that match the result type) +accessorSearch :: + Maybe [(P.Ident, Entailment.InstanceContext, P.SourceConstraint)] -> + P.Environment -> + TC.CheckState -> + P.SourceType -> + -- | (all accessors we found, all accessors we found that match the result type) + ([(Label, P.SourceType)], [(Label, P.SourceType)]) accessorSearch unsolved env st userT = maybe ([], []) fst $ checkInEnvironment env st $ do let initializeSkolems = Skolem.introduceSkolemScope - <=< P.replaceAllTypeSynonyms - <=< P.replaceTypeWildcards + <=< P.replaceAllTypeSynonyms + <=< P.replaceTypeWildcards userT' <- initializeSkolems userT @@ -105,16 +112,16 @@ accessorSearch unsolved env st userT = maybe ([], []) fst $ checkInEnvironment e checkAccessor tcs x (_, type') = isJust (checkSubsume unsolved env tcs x type') toRowPair (RowListItem _ lbl ty) = (lbl, ty) -typeSearch - :: Maybe [(P.Ident, Entailment.InstanceContext, P.SourceConstraint)] - -- ^ Additional constraints we need to satisfy - -> P.Environment - -- ^ The Environment which contains the relevant definitions and typeclasses - -> TC.CheckState - -- ^ The typechecker state - -> P.SourceType - -- ^ The type we are looking for - -> ([(P.Qualified Text, P.SourceType)], Maybe [(Label, P.SourceType)]) +typeSearch :: + -- | Additional constraints we need to satisfy + Maybe [(P.Ident, Entailment.InstanceContext, P.SourceConstraint)] -> + -- | The Environment which contains the relevant definitions and typeclasses + P.Environment -> + -- | The typechecker state + TC.CheckState -> + -- | The type we are looking for + P.SourceType -> + ([(P.Qualified Text, P.SourceType)], Maybe [(Label, P.SourceType)]) typeSearch unsolved env st type' = let runTypeSearch :: Map k P.SourceType -> Map k P.SourceType @@ -126,8 +133,9 @@ typeSearch unsolved env st type' = runPlainIdent (Qualified m (Ident k), v) = Just (Qualified m k, v) runPlainIdent _ = Nothing - in + in ( (first (P.Qualified P.ByNullSourcePos . ("_." <>) . P.prettyPrintLabel) <$> matchingLabels) - <> mapMaybe runPlainIdent (Map.toList matchingNames) - <> (first (map P.runProperName) <$> Map.toList matchingConstructors) - , if null allLabels then Nothing else Just allLabels) + <> mapMaybe runPlainIdent (Map.toList matchingNames) + <> (first (map P.runProperName) <$> Map.toList matchingConstructors) + , if null allLabels then Nothing else Just allLabels + ) diff --git a/src/Language/PureScript/TypeChecker/Types.hs b/src/Language/PureScript/TypeChecker/Types.hs index 3f758805c..9846090f5 100644 --- a/src/Language/PureScript/TypeChecker/Types.hs +++ b/src/Language/PureScript/TypeChecker/Types.hs @@ -1,11 +1,24 @@ --- | --- This module implements the type checker --- -module Language.PureScript.TypeChecker.Types - ( BindingGroupType(..) - , typesOf - , checkTypeKind - ) where +{- | +This module implements the type checker +-} +module Language.PureScript.TypeChecker.Types ( + BindingGroupType (..), + typesOf, + checkTypeKind, + check, + infer, + inferBinder, + freshTypeWithKind, + kindType, + TypedValue' (..), + instantiatePolyTypeWithUnknowns, + instantiateForBinders, + tvToExpr, + SplitBindingGroup (..), + typeDictionaryForBindingGroup, + typeForBindingGroupElement, + checkTypedBindingGroupElement, +) where {- The following functions represent the corresponding type checking judgements: @@ -23,33 +36,36 @@ module Language.PureScript.TypeChecker.Types Check a function of a given type returns a value of another type when applied to its arguments -} +import Protolude (atMay, fold, ordNub) import Prelude -import Protolude (ordNub, fold, atMay) import Control.Arrow (first, second, (***)) import Control.Monad (forM, forM_, guard, replicateM, unless, when, zipWithM, (<=<)) -import Control.Monad.Error.Class (MonadError(..)) -import Control.Monad.State.Class (MonadState(..), gets) +import Control.Monad.Error.Class (MonadError (..)) +import Control.Monad.State.Class (MonadState (..), gets) import Control.Monad.Supply.Class (MonadSupply) -import Control.Monad.Writer.Class (MonadWriter(..)) +import Control.Monad.Writer.Class (MonadWriter (..)) import Data.Bifunctor (bimap) import Data.Either (partitionEithers) import Data.Functor (($>)) -import Data.List (transpose, (\\), partition, delete) -import Data.Maybe (fromMaybe) -import Data.Text (Text) -import Data.Traversable (for) +import Data.IntSet qualified as IS +import Data.List (delete, partition, transpose, (\\)) import Data.List.NonEmpty qualified as NEL import Data.Map qualified as M +import Data.Maybe (fromMaybe) import Data.Set qualified as S -import Data.IntSet qualified as IS +import Data.Text (Text) +import Data.Text qualified as T +import Data.Traversable (for) import Language.PureScript.AST import Language.PureScript.Crash (internalError) import Language.PureScript.Environment -import Language.PureScript.Errors (ErrorMessage(..), MultipleErrors, SimpleErrorMessage(..), errorMessage, errorMessage', escalateWarningWhen, internalCompilerError, onErrorMessages, onTypesInErrorMessage, parU) -import Language.PureScript.Names (pattern ByNullSourcePos, Ident(..), ModuleName, Name(..), ProperName(..), ProperNameType(..), Qualified(..), QualifiedBy(..), byMaybeModuleName, coerceProperName, freshIdent) +import Language.PureScript.Errors (ErrorMessage (..), MultipleErrors, SimpleErrorMessage (..), errorMessage, errorMessage', escalateWarningWhen, internalCompilerError, onErrorMessages, onTypesInErrorMessage, parU) +import Language.PureScript.Label (Label (..)) +import Language.PureScript.Names (Ident (..), ModuleName, Name (..), ProperName (..), ProperNameType (..), Qualified (..), QualifiedBy (..), byMaybeModuleName, coerceProperName, freshIdent, runIdent, runModuleName, pattern ByNullSourcePos) +import Language.PureScript.PSString (PSString) import Language.PureScript.TypeChecker.Deriving (deriveInstance) import Language.PureScript.TypeChecker.Entailment (InstanceContext, newDictionaries, replaceTypeClassDictionaries) import Language.PureScript.TypeChecker.Kinds (checkConstraint, checkKind, checkTypeKind, kindOf, kindOfWithScopedVars, unifyKinds', unknownsWithKinds) @@ -60,8 +76,25 @@ import Language.PureScript.TypeChecker.Synonyms (replaceAllTypeSynonyms) import Language.PureScript.TypeChecker.TypeSearch (typeSearch) import Language.PureScript.TypeChecker.Unify (freshTypeWithKind, replaceTypeWildcards, substituteType, unifyTypes, unknownsInType, varIfUnknown) import Language.PureScript.Types -import Language.PureScript.Label (Label(..)) -import Language.PureScript.PSString (PSString) + +import Debug.Trace +import Language.PureScript.Pretty.Values (renderValue) +import Language.Purus.Pretty.Types (prettyTypeStr) + +moduleTraces :: Bool +moduleTraces = True + +goTrace :: forall x. String -> x -> x +goTrace str x + | moduleTraces = trace str x + | otherwise = x + +goTraceM :: forall f. (Applicative f) => String -> f () +goTraceM msg + | moduleTraces = traceM msg + | otherwise = pure () + +spacer = '\n' : replicate 20 '-' data BindingGroupType = RecursiveBindingGroup @@ -76,141 +109,143 @@ tvToExpr :: TypedValue' -> Expr tvToExpr (TypedValue' c e t) = TypedValue c e t -- | Lookup data about a type class in the @Environment@ -lookupTypeClass :: MonadState CheckState m => Qualified (ProperName 'ClassName) -> m TypeClassData +lookupTypeClass :: (MonadState CheckState m) => Qualified (ProperName 'ClassName) -> m TypeClassData lookupTypeClass name = let findClass = fromMaybe (internalError "entails: type class not found in environment") . M.lookup name in gets (findClass . typeClasses . checkEnv) --- | Infer the types of multiple mutually-recursive values, and return elaborated values including --- type class dictionaries and type annotations. -typesOf - :: (MonadSupply m, MonadState CheckState m, MonadError MultipleErrors m, MonadWriter MultipleErrors m) - => BindingGroupType - -> ModuleName - -> [((SourceAnn, Ident), Expr)] - -> m [((SourceAnn, Ident), (Expr, SourceType))] -typesOf bindingGroupType moduleName vals = withFreshSubstitution $ do - (tys, wInfer) <- capturingSubstitution tidyUp $ do - (SplitBindingGroup untyped typed dict, w) <- withoutWarnings $ typeDictionaryForBindingGroup (Just moduleName) vals - ds1 <- parU typed $ \e -> withoutWarnings $ checkTypedBindingGroupElement moduleName e dict - ds2 <- forM untyped $ \e -> withoutWarnings $ typeForBindingGroupElement e dict - return (map (False, ) ds1 ++ map (True, ) ds2, w) - - inferred <- forM tys $ \(shouldGeneralize, ((sai@((ss, _), ident), (val, ty)), _)) -> do - -- Replace type class dictionary placeholders with actual dictionaries - (val', unsolved) <- replaceTypeClassDictionaries shouldGeneralize val - -- Generalize and constrain the type - currentSubst <- gets checkSubstitution - let ty' = substituteType currentSubst ty - ty'' = constrain unsolved ty' - unsolvedTypeVarsWithKinds <- unknownsWithKinds . IS.toList . unknowns $ constrain unsolved ty'' - let unsolvedTypeVars = IS.toList $ unknowns ty' - - generalized <- varIfUnknown unsolvedTypeVarsWithKinds ty'' - - when shouldGeneralize $ do - -- Show the inferred type in a warning - tell - . errorMessage' ss - $ MissingTypeDeclaration ident generalized - -- For non-recursive binding groups, can generalize over constraints. - -- For recursive binding groups, we throw an error here for now. - when (bindingGroupType == RecursiveBindingGroup && not (null unsolved)) - . throwError - . errorMessage' ss - $ CannotGeneralizeRecursiveFunction ident generalized - -- We need information about functional dependencies, since we allow - -- ambiguous types to be inferred if they can be solved by some functional - -- dependency. - conData <- forM unsolved $ \(_, _, con) -> do - TypeClassData{ typeClassDependencies } <- lookupTypeClass $ constraintClass con - let - -- The set of unknowns mentioned in each argument. - unknownsForArg :: [S.Set Int] - unknownsForArg = - map (S.fromList . map snd . unknownsInType) (constraintArgs con) - pure (typeClassDependencies, unknownsForArg) - -- Make sure any unsolved type constraints are determined by the - -- type variables which appear unknown in the inferred type. +{- | Infer the types of multiple mutually-recursive values, and return elaborated values including +type class dictionaries and type annotations. +-} +typesOf :: + (MonadSupply m, MonadState CheckState m, MonadError MultipleErrors m, MonadWriter MultipleErrors m) => + BindingGroupType -> + ModuleName -> + [((SourceAnn, Ident), Expr)] -> + m [((SourceAnn, Ident), (Expr, SourceType))] +typesOf bindingGroupType moduleName vals = goTrace ("TYPESOF: " <> T.unpack (runModuleName moduleName)) $ withFreshSubstitution $ do + (tys, wInfer) <- capturingSubstitution tidyUp $ do + (SplitBindingGroup untyped typed dict, w) <- withoutWarnings $ typeDictionaryForBindingGroup (Just moduleName) vals + ds1 <- parU typed $ \e -> withoutWarnings $ checkTypedBindingGroupElement moduleName e dict + ds2 <- forM untyped $ \e -> withoutWarnings $ typeForBindingGroupElement e dict + return (map (False,) ds1 ++ map (True,) ds2, w) + + inferred <- forM tys $ \(shouldGeneralize, ((sai@((ss, _), ident), (val, ty)), _)) -> do + -- Replace type class dictionary placeholders with actual dictionaries + (val', unsolved) <- replaceTypeClassDictionaries shouldGeneralize val + -- Generalize and constrain the type + currentSubst <- gets checkSubstitution + let ty' = substituteType currentSubst ty + ty'' = constrain unsolved ty' + unsolvedTypeVarsWithKinds <- unknownsWithKinds . IS.toList . unknowns $ constrain unsolved ty'' + let unsolvedTypeVars = IS.toList $ unknowns ty' + + generalized <- varIfUnknown unsolvedTypeVarsWithKinds ty'' + + when shouldGeneralize $ do + -- Show the inferred type in a warning + tell + . errorMessage' ss + $ MissingTypeDeclaration ident generalized + -- For non-recursive binding groups, can generalize over constraints. + -- For recursive binding groups, we throw an error here for now. + when (bindingGroupType == RecursiveBindingGroup && not (null unsolved)) + . throwError + . errorMessage' ss + $ CannotGeneralizeRecursiveFunction ident generalized + -- We need information about functional dependencies, since we allow + -- ambiguous types to be inferred if they can be solved by some functional + -- dependency. + conData <- forM unsolved $ \(_, _, con) -> do + TypeClassData {typeClassDependencies} <- lookupTypeClass $ constraintClass con let - -- Take the closure of fundeps across constraints, to get more - -- and more solved variables until reaching a fixpoint. - solveFrom :: S.Set Int -> S.Set Int - solveFrom determined = do - let solved = solve1 determined - if solved `S.isSubsetOf` determined - then determined - else solveFrom (determined <> solved) - solve1 :: S.Set Int -> S.Set Int - solve1 determined = fold $ do - (tcDeps, conArgUnknowns) <- conData - let - lookupUnknowns :: Int -> Maybe (S.Set Int) - lookupUnknowns = atMay conArgUnknowns - unknownsDetermined :: Maybe (S.Set Int) -> Bool - unknownsDetermined Nothing = False - unknownsDetermined (Just unks) = - unks `S.isSubsetOf` determined - -- If all of the determining arguments of a particular fundep are - -- already determined, add the determined arguments from the fundep - tcDep <- tcDeps - guard $ all (unknownsDetermined . lookupUnknowns) (fdDeterminers tcDep) - map (fromMaybe S.empty . lookupUnknowns) (fdDetermined tcDep) - -- These unknowns can be determined from the body of the inferred - -- type (i.e. excluding the unknowns mentioned in the constraints) - let determinedFromType = S.fromList unsolvedTypeVars - -- These are all the unknowns mentioned in the constraints - let constraintTypeVars = fold (conData >>= snd) - let solved = solveFrom determinedFromType - let unsolvedVars = S.difference constraintTypeVars solved - let lookupUnkName' i = do - mn <- lookupUnkName i - pure (fromMaybe "t" mn, i) - unsolvedVarNames <- traverse lookupUnkName' (S.toList unsolvedVars) - unless (S.null unsolvedVars) . - throwError - . onErrorMessages (replaceTypes currentSubst) - . errorMessage' ss - $ AmbiguousTypeVariables generalized unsolvedVarNames - - -- Check skolem variables did not escape their scope - skolemEscapeCheck val' - return ((sai, (foldr (Abs . VarBinder nullSourceSpan . (\(x, _, _) -> x)) val' unsolved, generalized)), unsolved) - - -- Show warnings here, since types in wildcards might have been solved during - -- instance resolution (by functional dependencies). - finalState <- get - let replaceTypes' = replaceTypes (checkSubstitution finalState) - runTypeSearch' gen = runTypeSearch (guard gen $> foldMap snd inferred) finalState - raisePreviousWarnings gen = escalateWarningWhen isHoleError . tell . onErrorMessages (runTypeSearch' gen . replaceTypes') - - raisePreviousWarnings False wInfer - forM_ tys $ \(shouldGeneralize, ((_, (_, _)), w)) -> - raisePreviousWarnings shouldGeneralize w - - return (map fst inferred) + -- The set of unknowns mentioned in each argument. + unknownsForArg :: [S.Set Int] + unknownsForArg = + map (S.fromList . map snd . unknownsInType) (constraintArgs con) + pure (typeClassDependencies, unknownsForArg) + -- Make sure any unsolved type constraints are determined by the + -- type variables which appear unknown in the inferred type. + let + -- Take the closure of fundeps across constraints, to get more + -- and more solved variables until reaching a fixpoint. + solveFrom :: S.Set Int -> S.Set Int + solveFrom determined = do + let solved = solve1 determined + if solved `S.isSubsetOf` determined + then determined + else solveFrom (determined <> solved) + solve1 :: S.Set Int -> S.Set Int + solve1 determined = fold $ do + (tcDeps, conArgUnknowns) <- conData + let + lookupUnknowns :: Int -> Maybe (S.Set Int) + lookupUnknowns = atMay conArgUnknowns + unknownsDetermined :: Maybe (S.Set Int) -> Bool + unknownsDetermined Nothing = False + unknownsDetermined (Just unks) = + unks `S.isSubsetOf` determined + -- If all of the determining arguments of a particular fundep are + -- already determined, add the determined arguments from the fundep + tcDep <- tcDeps + guard $ all (unknownsDetermined . lookupUnknowns) (fdDeterminers tcDep) + map (fromMaybe S.empty . lookupUnknowns) (fdDetermined tcDep) + -- These unknowns can be determined from the body of the inferred + -- type (i.e. excluding the unknowns mentioned in the constraints) + let determinedFromType = S.fromList unsolvedTypeVars + -- These are all the unknowns mentioned in the constraints + let constraintTypeVars = fold (conData >>= snd) + let solved = solveFrom determinedFromType + let unsolvedVars = S.difference constraintTypeVars solved + let lookupUnkName' i = do + mn <- lookupUnkName i + pure (fromMaybe "t" mn, i) + unsolvedVarNames <- traverse lookupUnkName' (S.toList unsolvedVars) + unless (S.null unsolvedVars) + . throwError + . onErrorMessages (replaceTypes currentSubst) + . errorMessage' ss + $ AmbiguousTypeVariables generalized unsolvedVarNames + + -- Check skolem variables did not escape their scope + skolemEscapeCheck val' + return ((sai, (foldr (Abs . VarBinder nullSourceSpan . (\(x, _, _) -> x)) val' unsolved, generalized)), unsolved) + + -- Show warnings here, since types in wildcards might have been solved during + -- instance resolution (by functional dependencies). + finalState <- get + let replaceTypes' = replaceTypes (checkSubstitution finalState) + runTypeSearch' gen = runTypeSearch (guard gen $> foldMap snd inferred) finalState + raisePreviousWarnings gen = escalateWarningWhen isHoleError . tell . onErrorMessages (runTypeSearch' gen . replaceTypes') + + raisePreviousWarnings False wInfer + forM_ tys $ \(shouldGeneralize, ((_, (_, _)), w)) -> + raisePreviousWarnings shouldGeneralize w + + return (map fst inferred) where - replaceTypes - :: Substitution - -> ErrorMessage - -> ErrorMessage + replaceTypes :: + Substitution -> + ErrorMessage -> + ErrorMessage replaceTypes subst = onTypesInErrorMessage (substituteType subst) -- Run type search to complete any typed hole error messages - runTypeSearch - :: Maybe [(Ident, InstanceContext, SourceConstraint)] - -- Any unsolved constraints which we need to continue to satisfy - -> CheckState - -- The final type checker state - -> ErrorMessage - -> ErrorMessage + runTypeSearch :: + Maybe [(Ident, InstanceContext, SourceConstraint)] -> + -- Any unsolved constraints which we need to continue to satisfy + CheckState -> + -- The final type checker state + ErrorMessage -> + ErrorMessage runTypeSearch cons st = \case ErrorMessage hints (HoleInferredType x ty y (Just (TSBefore env))) -> let subst = checkSubstitution st - searchResult = onTypeSearchTypes - (substituteType subst) - (uncurry TSAfter (typeSearch cons env st (substituteType subst ty))) - in ErrorMessage hints (HoleInferredType x ty y (Just searchResult)) + searchResult = + onTypeSearchTypes + (substituteType subst) + (uncurry TSAfter (typeSearch cons env st (substituteType subst ty))) + in ErrorMessage hints (HoleInferredType x ty y (Just searchResult)) other -> other -- Add any unsolved constraints @@ -221,13 +256,14 @@ typesOf bindingGroupType moduleName vals = withFreshSubstitution $ do tidyUp ts sub = first (map (second (first (second (overTypes (substituteType sub) *** substituteType sub))))) ts isHoleError :: ErrorMessage -> Bool - isHoleError (ErrorMessage _ HoleInferredType{}) = True + isHoleError (ErrorMessage _ HoleInferredType {}) = True isHoleError _ = False --- | A binding group contains multiple value definitions, some of which are typed --- and some which are not. --- --- This structure breaks down a binding group into typed and untyped parts. +{- | A binding group contains multiple value definitions, some of which are typed +and some which are not. + +This structure breaks down a binding group into typed and untyped parts. +-} data SplitBindingGroup = SplitBindingGroup { _splitBindingGroupUntyped :: [((SourceAnn, Ident), (Expr, SourceType))] -- ^ The untyped expressions @@ -240,113 +276,164 @@ data SplitBindingGroup = SplitBindingGroup -- compatible with the type of 'bindNames'. } --- | This function breaks a binding group down into two sets of declarations: --- those which contain type annotations, and those which don't. --- This function also generates fresh unification variables for the types of --- declarations without type annotations, returned in the 'UntypedData' structure. -typeDictionaryForBindingGroup - :: (MonadState CheckState m, MonadError MultipleErrors m, MonadWriter MultipleErrors m) - => Maybe ModuleName - -> [((SourceAnn, Ident), Expr)] - -> m SplitBindingGroup +{- | This function breaks a binding group down into two sets of declarations: +those which contain type annotations, and those which don't. +This function also generates fresh unification variables for the types of +declarations without type annotations, returned in the 'UntypedData' structure. +-} +typeDictionaryForBindingGroup :: + (MonadState CheckState m, MonadError MultipleErrors m, MonadWriter MultipleErrors m) => + Maybe ModuleName -> + [((SourceAnn, Ident), Expr)] -> + m SplitBindingGroup typeDictionaryForBindingGroup moduleName vals = do - -- Filter the typed and untyped declarations and make a map of names to typed declarations. - -- Replace type wildcards here so that the resulting dictionary of types contains the - -- fully expanded types. - let (untyped, typed) = partitionEithers (map splitTypeAnnotation vals) - (typedDict, typed') <- fmap unzip . for typed $ \(sai, (expr, ty, checkType)) -> do - ((args, elabTy), kind) <- kindOfWithScopedVars ty - checkTypeKind ty kind - elabTy' <- replaceTypeWildcards elabTy - return ((sai, elabTy'), (sai, (expr, args, elabTy', checkType))) - -- Create fresh unification variables for the types of untyped declarations - (untypedDict, untyped') <- fmap unzip . for untyped $ \(sai, expr) -> do - ty <- freshTypeWithKind kindType - return ((sai, ty), (sai, (expr, ty))) - -- Create the dictionary of all name/type pairs, which will be added to the - -- environment during type checking - let dict = M.fromList [ (Qualified (maybe (BySourcePos $ spanStart ss) ByModuleName moduleName) ident, (ty, Private, Undefined)) - | (((ss, _), ident), ty) <- typedDict <> untypedDict - ] - return (SplitBindingGroup untyped' typed' dict) + -- Filter the typed and untyped declarations and make a map of names to typed declarations. + -- Replace type wildcards here so that the resulting dictionary of types contains the + -- fully expanded types. + let (untyped, typed) = partitionEithers (map splitTypeAnnotation vals) + (typedDict, typed') <- fmap unzip . for typed $ \(sai, (expr, ty, checkType)) -> do + ((args, elabTy), kind) <- kindOfWithScopedVars ty + checkTypeKind ty kind + elabTy' <- replaceTypeWildcards elabTy + return ((sai, elabTy'), (sai, (expr, args, elabTy', checkType))) + -- Create fresh unification variables for the types of untyped declarations + (untypedDict, untyped') <- fmap unzip . for untyped $ \(sai, expr) -> do + ty <- freshTypeWithKind kindType + return ((sai, ty), (sai, (expr, ty))) + -- Create the dictionary of all name/type pairs, which will be added to the + -- environment during type checking + let dict = + M.fromList + [ (Qualified (maybe (BySourcePos $ spanStart ss) ByModuleName moduleName) ident, (ty, Private, Undefined)) + | (((ss, _), ident), ty) <- typedDict <> untypedDict + ] + return (SplitBindingGroup untyped' typed' dict) where -- Check if a value contains a type annotation, and if so, separate it -- from the value itself. splitTypeAnnotation :: (a, Expr) -> Either (a, Expr) (a, (Expr, SourceType, Bool)) splitTypeAnnotation (a, TypedValue checkType value ty) = Right (a, (value, ty, checkType)) splitTypeAnnotation (a, PositionedValue pos c value) = - bimap (second (PositionedValue pos c)) - (second (\(e, t, b) -> (PositionedValue pos c e, t, b))) - (splitTypeAnnotation (a, value)) + bimap + (second (PositionedValue pos c)) + (second (\(e, t, b) -> (PositionedValue pos c e, t, b))) + (splitTypeAnnotation (a, value)) splitTypeAnnotation (a, value) = Left (a, value) -- | Check the type annotation of a typed value in a binding group. -checkTypedBindingGroupElement - :: (MonadSupply m, MonadState CheckState m, MonadError MultipleErrors m, MonadWriter MultipleErrors m) - => ModuleName - -> ((SourceAnn, Ident), (Expr, [(Text, SourceType)], SourceType, Bool)) - -- ^ The identifier we are trying to define, along with the expression and its type annotation - -> M.Map (Qualified Ident) (SourceType, NameKind, NameVisibility) - -- ^ Names brought into scope in this binding group - -> m ((SourceAnn, Ident), (Expr, SourceType)) -checkTypedBindingGroupElement mn (ident, (val, args, ty, checkType)) dict = do +checkTypedBindingGroupElement :: + (MonadSupply m, MonadState CheckState m, MonadError MultipleErrors m, MonadWriter MultipleErrors m) => + ModuleName -> + -- | The identifier we are trying to define, along with the expression and its type annotation + ((SourceAnn, Ident), (Expr, [(Text, SourceType)], SourceType, Bool)) -> + -- | Names brought into scope in this binding group + M.Map (Qualified Ident) (SourceType, NameKind, NameVisibility) -> + m ((SourceAnn, Ident), (Expr, SourceType)) +checkTypedBindingGroupElement mn (ident, (val, args, ty, checkType)) dict = goTrace msg $ do -- We replace type synonyms _after_ kind-checking, since we don't want type -- synonym expansion to bring type variables into scope. See #2542. ty' <- introduceSkolemScope <=< replaceAllTypeSynonyms $ ty -- Check the type with the new names in scope - val' <- if checkType - then withScopedTypeVars mn args $ bindNames dict $ check val ty' - else return (TypedValue' False val ty') + val' <- + if checkType + then withScopedTypeVars mn args $ bindNames dict $ check val ty' + else return (TypedValue' False val ty') return (ident, (tvToExpr val', ty')) + where + msg = + "CHECK_TYPED_BINDING_GROUP_ELEMENT: " + <> T.unpack (runIdent $ snd ident) + <> "\n VALUE: " + <> renderValue 100 val + <> "\n ARGS: " + <> concatMap (\(_nm, _ty) -> " " <> T.unpack _nm <> " := " <> prettyTypeStr _ty <> "\n") args + <> "\n TYPE: " + <> prettyTypeStr ty + <> spacer -- | Infer a type for a value in a binding group which lacks an annotation. -typeForBindingGroupElement - :: (MonadSupply m, MonadState CheckState m, MonadError MultipleErrors m, MonadWriter MultipleErrors m) - => ((SourceAnn, Ident), (Expr, SourceType)) - -- ^ The identifier we are trying to define, along with the expression and its assigned type +typeForBindingGroupElement :: + (MonadSupply m, MonadState CheckState m, MonadError MultipleErrors m, MonadWriter MultipleErrors m) => + -- | The identifier we are trying to define, along with the expression and its assigned type -- (at this point, this should be a unification variable) - -> M.Map (Qualified Ident) (SourceType, NameKind, NameVisibility) - -- ^ Names brought into scope in this binding group - -> m ((SourceAnn, Ident), (Expr, SourceType)) -typeForBindingGroupElement (ident, (val, ty)) dict = do + ((SourceAnn, Ident), (Expr, SourceType)) -> + -- | Names brought into scope in this binding group + M.Map (Qualified Ident) (SourceType, NameKind, NameVisibility) -> + m ((SourceAnn, Ident), (Expr, SourceType)) +typeForBindingGroupElement (ident, (val, ty)) dict = goTrace msg $ do -- Infer the type with the new names in scope TypedValue' _ val' ty' <- bindNames dict $ infer val -- Unify the type with the unification variable we chose for this definition unifyTypes ty ty' return (ident, (TypedValue True val' ty', ty')) + where + msg = + "TYPE_FOR_BINDING_GROUP_ELEMENT: " + <> T.unpack (runIdent $ snd ident) + <> "\n VALUE: " + <> renderValue 100 val + <> "\n TYPE: " + <> prettyTypeStr ty + <> spacer --- | Remove any ForAlls and ConstrainedType constructors in a type by introducing new unknowns --- or TypeClassDictionary values. --- --- This is necessary during type checking to avoid unifying a polymorphic type with a --- unification variable. -instantiatePolyTypeWithUnknowns - :: (MonadState CheckState m, MonadError MultipleErrors m) - => Expr - -> SourceType - -> m (Expr, SourceType) -instantiatePolyTypeWithUnknowns val (ForAll _ _ ident mbK ty _) = do - u <- maybe (internalCompilerError "Unelaborated forall") freshTypeWithKind mbK +{- | Remove any ForAlls and ConstrainedType constructors in a type by introducing new unknowns +or TypeClassDictionary values. + +This is necessary during type checking to avoid unifying a polymorphic type with a +unification variable. +-} +instantiatePolyTypeWithUnknowns :: + (MonadState CheckState m, MonadError MultipleErrors m) => + Expr -> + SourceType -> + m (Expr, SourceType) +instantiatePolyTypeWithUnknowns val printMe@(ForAll _ _ ident mbK ty _) = do + u <- freshTypeWithKind mbK insertUnkName' u ident - instantiatePolyTypeWithUnknowns val $ replaceTypeVars ident u ty -instantiatePolyTypeWithUnknowns val (ConstrainedType _ con ty) = do + result <- instantiatePolyTypeWithUnknowns val $ replaceTypeVars ident u ty + -- let msg = mkMsg result + -- goTraceM msg + pure result + where + mkMsg (resultExpr, resultTy) = + "INSTANTIATE POLYTYPES WITH UNKNOWNS" + -- <> "\n EXPR: " <> renderValue 100 val + <> "\n TYPE: " + <> prettyTypeStr printMe + <> "\n RESULT EXPR: " + <> renderValue 100 resultExpr + -- <> "\n RESULT TYPE: " <> prettyTypeStr resultTy + <> spacer +instantiatePolyTypeWithUnknowns val printMe@(ConstrainedType _ con ty) = do dicts <- getTypeClassDictionaries hints <- getHints - instantiatePolyTypeWithUnknowns (App val (TypeClassDictionary con dicts hints)) ty + result <- instantiatePolyTypeWithUnknowns (App val (TypeClassDictionary con dicts hints)) ty + -- goTraceM (mkMsg result) + pure result + where + mkMsg (resultExpr, resultTy) = + "INSTANTIATE POLYTYPES WITH UNKNOWNS" + -- <> "\n EXPR: " <> renderValue 100 val + <> "\n TYPE: " + <> prettyTypeStr printMe + <> "\n RESULT EXPR: " + <> renderValue 100 resultExpr + -- <> "\n RESULT TYPE: " <> prettyTypeStr resultTy + <> spacer instantiatePolyTypeWithUnknowns val ty = return (val, ty) -instantiatePolyTypeWithUnknownsUntilVisible - :: (MonadState CheckState m, MonadError MultipleErrors m) - => Expr - -> SourceType - -> m (Expr, SourceType) +instantiatePolyTypeWithUnknownsUntilVisible :: + (MonadState CheckState m, MonadError MultipleErrors m) => + Expr -> + SourceType -> + m (Expr, SourceType) instantiatePolyTypeWithUnknownsUntilVisible val (ForAll _ TypeVarInvisible ident mbK ty _) = do - u <- maybe (internalCompilerError "Unelaborated forall") freshTypeWithKind mbK + u <- freshTypeWithKind mbK insertUnkName' u ident instantiatePolyTypeWithUnknownsUntilVisible val $ replaceTypeVars ident u ty instantiatePolyTypeWithUnknownsUntilVisible val ty = return (val, ty) -instantiateConstraint :: MonadState CheckState m => Expr -> Type SourceAnn -> m (Expr, Type SourceAnn) +instantiateConstraint :: (MonadState CheckState m) => Expr -> Type SourceAnn -> m (Expr, Type SourceAnn) instantiateConstraint val (ConstrainedType _ con ty) = do dicts <- getTypeClassDictionaries hints <- getHints @@ -355,35 +442,47 @@ instantiateConstraint val ty = pure (val, ty) -- | Match against TUnknown and call insertUnkName, failing otherwise. insertUnkName' :: (MonadState CheckState m, MonadError MultipleErrors m) => SourceType -> Text -> m () -insertUnkName' (TUnknown _ i) n = insertUnkName i n +insertUnkName' tu@(TUnknown _ i) n = goTrace msg $ insertUnkName i n + where + msg = + "INSERT UNK NAME" + <> "\n TYPE: " + <> prettyTypeStr tu + <> "\n NAME: " + <> T.unpack n insertUnkName' _ _ = internalCompilerError "type is not TUnknown" -- | Infer a type for a value, rethrowing any error to provide a more useful error message -infer - :: (MonadSupply m, MonadState CheckState m, MonadError MultipleErrors m, MonadWriter MultipleErrors m) - => Expr - -> m TypedValue' -infer val = withErrorMessageHint (ErrorInferringType val) $ infer' val +infer :: + (MonadSupply m, MonadState CheckState m, MonadError MultipleErrors m, MonadWriter MultipleErrors m) => + Expr -> + m TypedValue' +infer val = + goTrace + ("INFER\n EXPR: " <> renderValue 100 val <> spacer) + withErrorMessageHint + (ErrorInferringType val) + $ infer' val -- | Infer a type for a value -infer' - :: forall m - . (MonadSupply m, MonadState CheckState m, MonadError MultipleErrors m, MonadWriter MultipleErrors m) - => Expr - -> m TypedValue' +infer' :: + forall m. + (MonadSupply m, MonadState CheckState m, MonadError MultipleErrors m, MonadWriter MultipleErrors m) => + Expr -> + m TypedValue' infer' v@(Literal _ (NumericLiteral (Left _))) = return $ TypedValue' True v tyInt infer' v@(Literal _ (NumericLiteral (Right _))) = return $ TypedValue' True v tyNumber infer' v@(Literal _ (StringLiteral _)) = return $ TypedValue' True v tyString infer' v@(Literal _ (CharLiteral _)) = return $ TypedValue' True v tyChar infer' v@(Literal _ (BooleanLiteral _)) = return $ TypedValue' True v tyBoolean -infer' (Literal ss (ArrayLiteral vals)) = do +infer' (Literal ss (ListLiteral vals)) = do ts <- traverse infer vals els <- freshTypeWithKind kindType ts' <- forM ts $ \(TypedValue' ch val t) -> do (val', t') <- instantiatePolyTypeWithUnknowns val t unifyTypes els t' return (TypedValue ch val' t') - return $ TypedValue' True (Literal ss (ArrayLiteral ts')) (srcTypeApp tyArray els) + return $ TypedValue' True (Literal ss (ListLiteral ts')) (srcTypeApp tyList els) infer' (Literal ss (ObjectLiteral ps)) = do ensureNoDuplicateProperties ps typedFields <- inferProperties ps @@ -472,7 +571,7 @@ infer' (VisibleTypeApp valFn tyArg) = do tyArg' <- introduceSkolemScope <=< replaceAllTypeSynonyms <=< replaceTypeWildcards $ tyArg (valFn'', valTy') <- instantiatePolyTypeWithUnknownsUntilVisible valFn' valTy case valTy' of - ForAll _ _ qName (Just qKind) qBody _ -> do + ForAll _ _ qName qKind qBody _ -> do tyArg'' <- replaceAllTypeSynonyms <=< checkKind tyArg' $ qKind let resTy = replaceTypeVars qName tyArg'' qBody (valFn''', resTy') <- instantiateConstraint valFn'' resTy @@ -513,9 +612,11 @@ infer' (DeferredDictionary className tys) = do dicts <- getTypeClassDictionaries hints <- getHints con <- checkConstraint (srcConstraint className [] tys Nothing) - return $ TypedValue' False - (TypeClassDictionary con dicts hints) - (foldl srcTypeApp (srcTypeConstructor (fmap coerceProperName className)) tys) + return $ + TypedValue' + False + (TypeClassDictionary con dicts hints) + (foldl srcTypeApp (srcTypeConstructor (fmap coerceProperName className)) tys) infer' (TypedValue checkType val ty) = do moduleName <- unsafeCheckCurrentModule ((args, elabTy), kind) <- kindOfWithScopedVars ty @@ -534,53 +635,56 @@ infer' (PositionedValue pos c val) = warnAndRethrowWithPositionTC pos $ do return $ TypedValue' t (PositionedValue pos c v) ty infer' v = internalError $ "Invalid argument to infer: " ++ show v --- | --- Infer the types of named record fields. -inferProperties - :: ( MonadSupply m - , MonadState CheckState m - , MonadError MultipleErrors m - , MonadWriter MultipleErrors m - ) - => [(PSString, Expr)] - -> m [(PSString, (Expr, SourceType))] +{- | +Infer the types of named record fields. +-} +inferProperties :: + ( MonadSupply m + , MonadState CheckState m + , MonadError MultipleErrors m + , MonadWriter MultipleErrors m + ) => + [(PSString, Expr)] -> + m [(PSString, (Expr, SourceType))] inferProperties = traverse (traverse inferWithinRecord) --- | --- Infer the type of a value when used as a record field. -inferWithinRecord - :: ( MonadSupply m - , MonadState CheckState m - , MonadError MultipleErrors m - , MonadWriter MultipleErrors m - ) - => Expr - -> m (Expr, SourceType) +{- | +Infer the type of a value when used as a record field. +-} +inferWithinRecord :: + ( MonadSupply m + , MonadState CheckState m + , MonadError MultipleErrors m + , MonadWriter MultipleErrors m + ) => + Expr -> + m (Expr, SourceType) inferWithinRecord e = do TypedValue' _ v t <- infer e if propertyShouldInstantiate e then instantiatePolyTypeWithUnknowns v t else pure (v, t) --- | --- Determines if a value's type needs to be monomorphized when --- used inside of a record. +{- | +Determines if a value's type needs to be monomorphized when +used inside of a record. +-} propertyShouldInstantiate :: Expr -> Bool propertyShouldInstantiate = \case - Var{} -> True - Constructor{} -> True + Var {} -> True + Constructor {} -> True VisibleTypeApp e _ -> propertyShouldInstantiate e PositionedValue _ _ e -> propertyShouldInstantiate e _ -> False -inferLetBinding - :: (MonadSupply m, MonadState CheckState m, MonadError MultipleErrors m, MonadWriter MultipleErrors m) - => [Declaration] - -> [Declaration] - -> Expr - -> (Expr -> m TypedValue') - -> m ([Declaration], TypedValue') -inferLetBinding seen [] ret j = (seen, ) <$> withBindingGroupVisible (j ret) +inferLetBinding :: + (MonadSupply m, MonadState CheckState m, MonadError MultipleErrors m, MonadWriter MultipleErrors m) => + [Declaration] -> + [Declaration] -> + Expr -> + (Expr -> m TypedValue') -> + m ([Declaration], TypedValue') +inferLetBinding seen [] ret j = (seen,) <$> withBindingGroupVisible (j ret) inferLetBinding seen (ValueDecl sa@(ss, _) ident nameKind [] [MkUnguarded (TypedValue checkType val ty)] : rest) ret j = do moduleName <- unsafeCheckCurrentModule TypedValue' _ val' ty'' <- warnAndRethrowWithPositionTC ss $ do @@ -591,16 +695,19 @@ inferLetBinding seen (ValueDecl sa@(ss, _) ident nameKind [] [MkUnguarded (Typed if checkType then withScopedTypeVars moduleName args (bindNames dict (check val ty')) else return (TypedValue' checkType val elabTy) - bindNames (M.singleton (Qualified (BySourcePos $ spanStart ss) ident) (ty'', nameKind, Defined)) - $ inferLetBinding (seen ++ [ValueDecl sa ident nameKind [] [MkUnguarded (TypedValue checkType val' ty'')]]) rest ret j + bindNames (M.singleton (Qualified (BySourcePos $ spanStart ss) ident) (ty'', nameKind, Defined)) $ + inferLetBinding (seen ++ [ValueDecl sa ident nameKind [] [MkUnguarded (TypedValue checkType val' ty'')]]) rest ret j inferLetBinding seen (ValueDecl sa@(ss, _) ident nameKind [] [MkUnguarded val] : rest) ret j = do valTy <- freshTypeWithKind kindType - TypedValue' _ val' valTy' <- warnAndRethrowWithPositionTC ss $ do + TypedValue' chk val' valTy' <- warnAndRethrowWithPositionTC ss $ do let dict = M.singleton (Qualified (BySourcePos $ spanStart ss) ident) (valTy, nameKind, Undefined) bindNames dict $ infer val warnAndRethrowWithPositionTC ss $ unifyTypes valTy valTy' - bindNames (M.singleton (Qualified (BySourcePos $ spanStart ss) ident) (valTy', nameKind, Defined)) - $ inferLetBinding (seen ++ [ValueDecl sa ident nameKind [] [MkUnguarded val']]) rest ret j + -- NOTE (from Sean): Returning a TypedValue gives us access to monomorphized types for un-annotated let bindings. + -- I'm not sure why they don't do this, perhaps there is a reason to avoid doing so? + let val'' = TypedValue chk val' valTy' + bindNames (M.singleton (Qualified (BySourcePos $ spanStart ss) ident) (valTy', nameKind, Defined)) $ + inferLetBinding (seen ++ [ValueDecl sa ident nameKind [] [MkUnguarded val'']]) rest ret j inferLetBinding seen (BindingGroupDeclaration ds : rest) ret j = do moduleName <- unsafeCheckCurrentModule SplitBindingGroup untyped typed dict <- typeDictionaryForBindingGroup Nothing . NEL.toList $ fmap (\(i, _, v) -> (i, v)) ds @@ -613,12 +720,12 @@ inferLetBinding seen (BindingGroupDeclaration ds : rest) ret j = do inferLetBinding _ _ _ _ = internalError "Invalid argument to inferLetBinding" -- | Infer the types of variables brought into scope by a binder -inferBinder - :: forall m - . (MonadState CheckState m, MonadError MultipleErrors m, MonadWriter MultipleErrors m) - => SourceType - -> Binder - -> m (M.Map Ident (SourceSpan, SourceType)) +inferBinder :: + forall m. + (MonadState CheckState m, MonadError MultipleErrors m, MonadWriter MultipleErrors m) => + SourceType -> + Binder -> + m (M.Map Ident (SourceSpan, SourceType)) inferBinder _ NullBinder = return M.empty inferBinder val (LiteralBinder _ (StringLiteral _)) = unifyTypes val tyString >> return M.empty inferBinder val (LiteralBinder _ (CharLiteral _)) = unifyTypes val tyChar >> return M.empty @@ -629,8 +736,19 @@ inferBinder val (VarBinder ss name) = return $ M.singleton name (ss, val) inferBinder val (ConstructorBinder ss ctor binders) = do env <- getEnv case M.lookup ctor (dataConstructors env) of - Just (_, _, ty, _) -> do - (_, fn) <- instantiatePolyTypeWithUnknowns (internalError "Data constructor types cannot contain constraints") ty + Just (_, tn, ty, _) -> do + let tn' = T.unpack $ runProperName tn + (_, fn) <- + instantiatePolyTypeWithUnknowns + ( internalError $ + "Data constructor types cannot contain constraints: " + <> prettyTypeStr val + <> "\n while inferring binders for constructor of type: " + <> tn' + <> "\n " + <> prettyTypeStr ty + ) + ty fn' <- introduceSkolemScope <=< replaceAllTypeSynonyms $ fn let (args, ret) = peelArgs fn' expected = length args @@ -640,11 +758,11 @@ inferBinder val (ConstructorBinder ss ctor binders) = do M.unions <$> zipWithM inferBinder (reverse args) binders _ -> throwError . errorMessage' ss . UnknownName . fmap DctorName $ ctor where - peelArgs :: Type a -> ([Type a], Type a) - peelArgs = go [] - where - go args (TypeApp _ (TypeApp _ fn arg) ret) | eqType fn tyFunction = go (arg : args) ret - go args ret = (args, ret) + peelArgs :: Type a -> ([Type a], Type a) + peelArgs = go [] + where + go args (TypeApp _ (TypeApp _ fn arg) ret) | eqType fn tyFunction = go (arg : args) ret + go args ret = (args, ret) inferBinder val (LiteralBinder _ (ObjectLiteral props)) = do row <- freshTypeWithKind (kindRow kindType) rest <- freshTypeWithKind (kindRow kindType) @@ -652,17 +770,17 @@ inferBinder val (LiteralBinder _ (ObjectLiteral props)) = do unifyTypes val (srcTypeApp tyRecord row) return m1 where - inferRowProperties :: SourceType -> SourceType -> [(PSString, Binder)] -> m (M.Map Ident (SourceSpan, SourceType)) - inferRowProperties nrow row [] = unifyTypes nrow row >> return M.empty - inferRowProperties nrow row ((name, binder):binders) = do - propTy <- freshTypeWithKind kindType - m1 <- inferBinder propTy binder - m2 <- inferRowProperties nrow (srcRCons (Label name) propTy row) binders - return $ m1 `M.union` m2 -inferBinder val (LiteralBinder _ (ArrayLiteral binders)) = do + inferRowProperties :: SourceType -> SourceType -> [(PSString, Binder)] -> m (M.Map Ident (SourceSpan, SourceType)) + inferRowProperties nrow row [] = unifyTypes nrow row >> return M.empty + inferRowProperties nrow row ((name, binder) : binders) = do + propTy <- freshTypeWithKind kindType + m1 <- inferBinder propTy binder + m2 <- inferRowProperties nrow (srcRCons (Label name) propTy row) binders + return $ m1 `M.union` m2 +inferBinder val (LiteralBinder _ (ListLiteral binders)) = do el <- freshTypeWithKind kindType m1 <- M.unions <$> traverse (inferBinder el) binders - unifyTypes val (srcTypeApp tyArray el) + unifyTypes val (srcTypeApp tyList el) return m1 inferBinder val (NamedBinder ss name binder) = warnAndRethrowWithPositionTC ss $ do @@ -676,15 +794,16 @@ inferBinder val (TypedBinder ty binder) = do ty1 <- introduceSkolemScope <=< replaceAllTypeSynonyms <=< replaceTypeWildcards $ elabTy unifyTypes val ty1 inferBinder ty1 binder -inferBinder _ OpBinder{} = +inferBinder _ OpBinder {} = internalError "OpBinder should have been desugared before inferBinder" -inferBinder _ BinaryNoParensBinder{} = +inferBinder _ BinaryNoParensBinder {} = internalError "BinaryNoParensBinder should have been desugared before inferBinder" -inferBinder _ ParensInBinder{} = +inferBinder _ ParensInBinder {} = internalError "ParensInBinder should have been desugared before inferBinder" --- | Returns true if a binder requires its argument type to be a monotype. --- | If this is the case, we need to instantiate any polymorphic types before checking binders. +{- | Returns true if a binder requires its argument type to be a monotype. +| If this is the case, we need to instantiate any polymorphic types before checking binders. +-} binderRequiresMonotype :: Binder -> Bool binderRequiresMonotype NullBinder = False binderRequiresMonotype (VarBinder _ _) = False @@ -694,44 +813,51 @@ binderRequiresMonotype (TypedBinder ty b) = isMonoType ty || binderRequiresMonot binderRequiresMonotype _ = True -- | Instantiate polytypes only when necessitated by a binder. -instantiateForBinders - :: (MonadSupply m, MonadState CheckState m, MonadError MultipleErrors m, MonadWriter MultipleErrors m) - => [Expr] - -> [CaseAlternative] - -> m ([Expr], [SourceType]) -instantiateForBinders vals cas = unzip <$> zipWithM (\val inst -> do - TypedValue' _ val' ty <- infer val - if inst - then instantiatePolyTypeWithUnknowns val' ty - else return (val', ty)) vals shouldInstantiate +instantiateForBinders :: + (MonadSupply m, MonadState CheckState m, MonadError MultipleErrors m, MonadWriter MultipleErrors m) => + [Expr] -> + [CaseAlternative] -> + m ([Expr], [SourceType]) +instantiateForBinders vals cas = + unzip + <$> zipWithM + ( \val inst -> do + TypedValue' _ val' ty <- infer val + if inst + then instantiatePolyTypeWithUnknowns val' ty + else return (val', ty) + ) + vals + shouldInstantiate where - shouldInstantiate :: [Bool] - shouldInstantiate = map (any binderRequiresMonotype) . transpose . map caseAlternativeBinders $ cas - --- | --- Check the types of the return values in a set of binders in a case statement --- -checkBinders - :: (MonadSupply m, MonadState CheckState m, MonadError MultipleErrors m, MonadWriter MultipleErrors m) - => [SourceType] - -> SourceType - -> [CaseAlternative] - -> m [CaseAlternative] + shouldInstantiate :: [Bool] + shouldInstantiate = map (any binderRequiresMonotype) . transpose . map caseAlternativeBinders $ cas + +{- | +Check the types of the return values in a set of binders in a case statement +-} +checkBinders :: + (MonadSupply m, MonadState CheckState m, MonadError MultipleErrors m, MonadWriter MultipleErrors m) => + [SourceType] -> -- the types of the scrutinee values + SourceType -> -- return type of case expr + [CaseAlternative] -> -- the binders + m [CaseAlternative] checkBinders _ _ [] = return [] checkBinders nvals ret (CaseAlternative binders result : bs) = do guardWith (errorMessage $ OverlappingArgNames Nothing) $ let ns = concatMap binderNames binders in length (ordNub ns) == length ns m1 <- M.unions <$> zipWithM inferBinder nvals binders - r <- bindLocalVariables [ (ss, name, ty, Defined) | (name, (ss, ty)) <- M.toList m1 ] $ - CaseAlternative binders <$> forM result (\ge -> checkGuardedRhs ge ret) + r <- + bindLocalVariables [(ss, name, ty, Defined) | (name, (ss, ty)) <- M.toList m1] $ + CaseAlternative binders <$> forM result (\ge -> checkGuardedRhs ge ret) rs <- checkBinders nvals ret bs return $ r : rs -checkGuardedRhs - :: (MonadSupply m, MonadState CheckState m, MonadError MultipleErrors m, MonadWriter MultipleErrors m) - => GuardedExpr - -> SourceType - -> m GuardedExpr +checkGuardedRhs :: + (MonadSupply m, MonadState CheckState m, MonadError MultipleErrors m, MonadWriter MultipleErrors m) => + GuardedExpr -> + SourceType -> + m GuardedExpr checkGuardedRhs (GuardedExpr [] rhs) ret = do rhs' <- TypedValue True <$> (tvToExpr <$> check rhs ret) <*> pure ret return $ GuardedExpr [] rhs' @@ -742,39 +868,53 @@ checkGuardedRhs (GuardedExpr (ConditionGuard cond : guards) rhs) ret = do checkGuardedRhs (GuardedExpr (PatternGuard binder expr : guards) rhs) ret = do tv@(TypedValue' _ _ ty) <- infer expr variables <- inferBinder ty binder - GuardedExpr guards' rhs' <- bindLocalVariables [ (ss, name, bty, Defined) - | (name, (ss, bty)) <- M.toList variables - ] $ - checkGuardedRhs (GuardedExpr guards rhs) ret + GuardedExpr guards' rhs' <- + bindLocalVariables + [ (ss, name, bty, Defined) + | (name, (ss, bty)) <- M.toList variables + ] + $ checkGuardedRhs (GuardedExpr guards rhs) ret return $ GuardedExpr (PatternGuard binder (tvToExpr tv) : guards') rhs' --- | --- Check the type of a value, rethrowing errors to provide a better error message --- -check - :: (MonadSupply m, MonadState CheckState m, MonadError MultipleErrors m, MonadWriter MultipleErrors m) - => Expr - -> SourceType - -> m TypedValue' -check val ty = withErrorMessageHint' val (ErrorCheckingType val ty) $ check' val ty - --- | --- Check the type of a value --- -check' - :: forall m - . (MonadSupply m, MonadState CheckState m, MonadError MultipleErrors m, MonadWriter MultipleErrors m) - => Expr - -> SourceType - -> m TypedValue' +{- | +Check the type of a value, rethrowing errors to provide a better error message +-} +check :: + (MonadSupply m, MonadState CheckState m, MonadError MultipleErrors m, MonadWriter MultipleErrors m) => + Expr -> + SourceType -> + m TypedValue' +check val ty = do + goTraceM msg1 + result <- withErrorMessageHint' val (ErrorCheckingType val ty) $ check' val ty + let msg2 = "\n CHECK RESULT: " <> renderValue 100 (tvToExpr result) <> spacer + goTraceM msg2 + pure result + where + msg1 = + "CHECK" + <> "\n EXPR: " + <> renderValue 100 val + <> "\n TYPE: " + <> prettyTypeStr ty + +{- | +Check the type of a value +-} +check' :: + forall m. + (MonadSupply m, MonadState CheckState m, MonadError MultipleErrors m, MonadWriter MultipleErrors m) => + Expr -> + SourceType -> + m TypedValue' check' val (ForAll ann vis ident mbK ty _) = do env <- getEnv mn <- gets checkCurrentModule scope <- newSkolemScope sko <- newSkolemConstant let ss = case val of - PositionedValue pos c _ -> (pos, c) - _ -> NullSourceAnn + PositionedValue pos c _ -> (pos, c) + _ -> NullSourceAnn sk = skolemize ss ident mbK sko scope ty -- We should only skolemize types in values when the type variable -- was actually brought into scope. Otherwise we can end up skolemizing @@ -787,7 +927,7 @@ check' val (ForAll ann vis ident mbK ty _) = do val' <- tvToExpr <$> check skVal sk return $ TypedValue' True val' (ForAll ann vis ident mbK ty (Just scope)) check' val t@(ConstrainedType _ con@(Constraint _ cls@(Qualified _ (ProperName className)) _ _ _) ty) = do - TypeClassData{ typeClassIsEmpty } <- lookupTypeClass cls + TypeClassData {typeClassIsEmpty} <- lookupTypeClass cls -- An empty class dictionary is never used; see code in `TypeChecker.Entailment` -- that wraps empty dictionary solutions in `Unused`. dictName <- if typeClassIsEmpty then pure UnusedIdent else freshIdent ("dict" <> className) @@ -800,19 +940,24 @@ check' val u@(TUnknown _ _) = do (val'', ty') <- instantiatePolyTypeWithUnknowns (tvToExpr val') ty unifyTypes ty' u return $ TypedValue' True val'' ty' -check' v@(Literal _ (NumericLiteral (Left _))) t | t == tyInt = - return $ TypedValue' True v t -check' v@(Literal _ (NumericLiteral (Right _))) t | t == tyNumber = - return $ TypedValue' True v t -check' v@(Literal _ (StringLiteral _)) t | t == tyString = - return $ TypedValue' True v t -check' v@(Literal _ (CharLiteral _)) t | t == tyChar = - return $ TypedValue' True v t -check' v@(Literal _ (BooleanLiteral _)) t | t == tyBoolean = - return $ TypedValue' True v t -check' (Literal ss (ArrayLiteral vals)) t@(TypeApp _ a ty) = do - unifyTypes a tyArray - array <- Literal ss . ArrayLiteral . map tvToExpr <$> forM vals (`check` ty) +check' v@(Literal _ (NumericLiteral (Left _))) t + | t == tyInt = + return $ TypedValue' True v t +check' v@(Literal _ (NumericLiteral (Right _))) t + | t == tyNumber = + return $ TypedValue' True v t +check' v@(Literal _ (StringLiteral _)) t + | t == tyString = + return $ TypedValue' True v t +check' v@(Literal _ (CharLiteral _)) t + | t == tyChar = + return $ TypedValue' True v t +check' v@(Literal _ (BooleanLiteral _)) t + | t == tyBoolean = + return $ TypedValue' True v t +check' (Literal ss (ListLiteral vals)) t@(TypeApp _ a ty) = do + unifyTypes a tyList + array <- Literal ss . ListLiteral . map tvToExpr <$> forM vals (`check` ty) return $ TypedValue' True array t check' (Abs binder ret) ty@(TypeApp _ (TypeApp _ t argTy) retTy) | VarBinder ss arg <- binder = do @@ -841,9 +986,11 @@ check' (DeferredDictionary className tys) ty = do dicts <- getTypeClassDictionaries hints <- getHints con <- checkConstraint (srcConstraint className [] tys Nothing) - return $ TypedValue' False - (TypeClassDictionary con dicts hints) - ty + return $ + TypedValue' + False + (TypeClassDictionary con dicts hints) + ty check' (TypedValue checkType val ty1) ty2 = do moduleName <- unsafeCheckCurrentModule ((args, elabTy1), kind1) <- kindOfWithScopedVars ty1 @@ -853,9 +1000,10 @@ check' (TypedValue checkType val ty1) ty2 = do ty1' <- introduceSkolemScope <=< replaceAllTypeSynonyms <=< replaceTypeWildcards $ elabTy1 ty2' <- introduceSkolemScope <=< replaceAllTypeSynonyms <=< replaceTypeWildcards $ elabTy2 elaborate <- subsumes ty1' ty2' - val' <- if checkType - then withScopedTypeVars moduleName args $ tvToExpr <$> check val ty1' - else pure val + val' <- + if checkType + then withScopedTypeVars moduleName args $ tvToExpr <$> check val ty1' + else pure val return $ TypedValue' True (TypedValue checkType (elaborate val') ty1') ty2' check' (Case vals binders) ret = do (vals', ts) <- instantiateForBinders vals binders @@ -912,85 +1060,89 @@ check' val ty = do elaborate <- subsumes ty' ty return $ TypedValue' True (elaborate val') ty --- | --- Check the type of a collection of named record fields --- --- The @lax@ parameter controls whether or not every record member has to be provided. For object updates, this is not the case. --- -checkProperties - :: (MonadSupply m, MonadState CheckState m, MonadError MultipleErrors m, MonadWriter MultipleErrors m) - => Expr - -> [(PSString, Expr)] - -> SourceType - -> Bool - -> m [(PSString, Expr)] -checkProperties expr ps row lax = convert <$> go ps (toRowPair <$> ts') r' where - convert = fmap (fmap tvToExpr) - (ts', r') = rowToList row - toRowPair (RowListItem _ lbl ty) = (lbl, ty) - go [] [] (REmptyKinded _ _) = return [] - go [] [] u@(TUnknown _ _) - | lax = return [] - | otherwise = do unifyTypes u srcREmpty - return [] - go [] [] Skolem{} | lax = return [] - go [] ((p, _): _) _ | lax = return [] - | otherwise = throwError . errorMessage $ PropertyIsMissing p - go ((p,_):_) [] (REmptyKinded _ _) = throwError . errorMessage $ AdditionalProperty $ Label p - go ((p,v):ps') ts r = - case lookup (Label p) ts of - Nothing -> do - (v', ty) <- inferWithinRecord v - rest <- freshTypeWithKind (kindRow kindType) - unifyTypes r (srcRCons (Label p) ty rest) - ps'' <- go ps' ts rest - return $ (p, TypedValue' True v' ty) : ps'' - Just ty -> do - v' <- check v ty - ps'' <- go ps' (delete (Label p, ty) ts) r - return $ (p, v') : ps'' - go _ _ _ = throwError . errorMessage $ ExprDoesNotHaveType expr (srcTypeApp tyRecord row) - --- | Check the type of a function application, rethrowing errors to provide a better error message. --- --- This judgment takes three inputs: --- --- * The expression of the function we are applying --- * The type of that function --- * The expression we are applying it to --- --- and synthesizes two outputs: --- --- * The return type --- * The elaborated expression for the function application (since we might need to --- insert type class dictionaries, etc.) -checkFunctionApplication - :: (MonadSupply m, MonadState CheckState m, MonadError MultipleErrors m, MonadWriter MultipleErrors m) - => Expr - -- ^ The function expression - -> SourceType - -- ^ The type of the function - -> Expr - -- ^ The argument expression - -> m (SourceType, Expr) - -- ^ The result type, and the elaborated term +{- | +Check the type of a collection of named record fields + +The @lax@ parameter controls whether or not every record member has to be provided. For object updates, this is not the case. +-} +checkProperties :: + (MonadSupply m, MonadState CheckState m, MonadError MultipleErrors m, MonadWriter MultipleErrors m) => + Expr -> + [(PSString, Expr)] -> + SourceType -> + Bool -> + m [(PSString, Expr)] +checkProperties expr ps row lax = convert <$> go ps (toRowPair <$> ts') r' + where + convert = fmap (fmap tvToExpr) + (ts', r') = rowToList row + toRowPair (RowListItem _ lbl ty) = (lbl, ty) + go [] [] (REmptyKinded _ _) = return [] + go [] [] u@(TUnknown _ _) + | lax = return [] + | otherwise = do + unifyTypes u srcREmpty + return [] + go [] [] Skolem {} | lax = return [] + go [] ((p, _) : _) _ + | lax = return [] + | otherwise = throwError . errorMessage $ PropertyIsMissing p + go ((p, _) : _) [] (REmptyKinded _ _) = throwError . errorMessage $ AdditionalProperty $ Label p + go ((p, v) : ps') ts r = + case lookup (Label p) ts of + Nothing -> do + (v', ty) <- inferWithinRecord v + rest <- freshTypeWithKind (kindRow kindType) + unifyTypes r (srcRCons (Label p) ty rest) + ps'' <- go ps' ts rest + return $ (p, TypedValue' True v' ty) : ps'' + Just ty -> do + v' <- check v ty + ps'' <- go ps' (delete (Label p, ty) ts) r + return $ (p, v') : ps'' + go _ _ _ = throwError . errorMessage $ ExprDoesNotHaveType expr (srcTypeApp tyRecord row) + +{- | Check the type of a function application, rethrowing errors to provide a better error message. + +This judgment takes three inputs: + +* The expression of the function we are applying +* The type of that function +* The expression we are applying it to + +and synthesizes two outputs: + +* The return type +* The elaborated expression for the function application (since we might need to + insert type class dictionaries, etc.) +-} +checkFunctionApplication :: + (MonadSupply m, MonadState CheckState m, MonadError MultipleErrors m, MonadWriter MultipleErrors m) => + -- | The function expression + Expr -> + -- | The type of the function + SourceType -> + -- | The argument expression + Expr -> + -- | The result type, and the elaborated term + m (SourceType, Expr) checkFunctionApplication fn fnTy arg = withErrorMessageHint' fn (ErrorInApplication fn fnTy arg) $ do subst <- gets checkSubstitution checkFunctionApplication' fn (substituteType subst fnTy) arg -- | Check the type of a function application -checkFunctionApplication' - :: (MonadSupply m, MonadState CheckState m, MonadError MultipleErrors m, MonadWriter MultipleErrors m) - => Expr - -> SourceType - -> Expr - -> m (SourceType, Expr) +checkFunctionApplication' :: + (MonadSupply m, MonadState CheckState m, MonadError MultipleErrors m, MonadWriter MultipleErrors m) => + Expr -> + SourceType -> + Expr -> + m (SourceType, Expr) checkFunctionApplication' fn (TypeApp _ (TypeApp _ tyFunction' argTy) retTy) arg = do unifyTypes tyFunction' tyFunction arg' <- tvToExpr <$> check arg argTy return (retTy, App fn arg') checkFunctionApplication' fn (ForAll _ _ ident mbK ty _) arg = do - u <- maybe (internalCompilerError "Unelaborated forall") freshTypeWithKind mbK + u <- freshTypeWithKind mbK insertUnkName' u ident let replaced = replaceTypeVars ident u ty checkFunctionApplication fn replaced arg @@ -1000,7 +1152,7 @@ checkFunctionApplication' fn (ConstrainedType _ con fnTy) arg = do dicts <- getTypeClassDictionaries hints <- getHints checkFunctionApplication' (App fn (TypeClassDictionary con dicts hints)) fnTy arg -checkFunctionApplication' fn fnTy dict@TypeClassDictionary{} = +checkFunctionApplication' fn fnTy dict@TypeClassDictionary {} = return (fnTy, App fn dict) checkFunctionApplication' fn u arg = do tv@(TypedValue' _ _ ty) <- do @@ -1011,15 +1163,15 @@ checkFunctionApplication' fn u arg = do unifyTypes u (function ty ret) return (ret, App fn (tvToExpr tv)) --- | --- Ensure a set of property names and value does not contain duplicate labels --- +{- | +Ensure a set of property names and value does not contain duplicate labels +-} ensureNoDuplicateProperties :: (MonadError MultipleErrors m) => [(PSString, Expr)] -> m () ensureNoDuplicateProperties ps = - let ls = map fst ps in - case ls \\ ordNub ls of - l : _ -> throwError . errorMessage $ DuplicateLabel (Label l) Nothing - _ -> return () + let ls = map fst ps + in case ls \\ ordNub ls of + l : _ -> throwError . errorMessage $ DuplicateLabel (Label l) Nothing + _ -> return () -- | Test if this is an internal value to be excluded from error hints isInternal :: Expr -> Bool @@ -1027,14 +1179,14 @@ isInternal = \case PositionedValue _ _ v -> isInternal v TypedValue _ v _ -> isInternal v Constructor _ (Qualified _ name) -> isDictTypeName name - DerivedInstancePlaceholder{} -> True + DerivedInstancePlaceholder {} -> True _ -> False -- | Introduce a hint only if the given expression is not internal -withErrorMessageHint' - :: (MonadState CheckState m, MonadError MultipleErrors m) - => Expr - -> ErrorMessageHint - -> m a - -> m a +withErrorMessageHint' :: + (MonadState CheckState m, MonadError MultipleErrors m) => + Expr -> + ErrorMessageHint -> + m a -> + m a withErrorMessageHint' expr = if isInternal expr then const id else withErrorMessageHint diff --git a/src/Language/PureScript/TypeChecker/Unify.hs b/src/Language/PureScript/TypeChecker/Unify.hs index e4f1040eb..02bee845b 100644 --- a/src/Language/PureScript/TypeChecker/Unify.hs +++ b/src/Language/PureScript/TypeChecker/Unify.hs @@ -1,52 +1,85 @@ --- | --- Functions and instances relating to unification --- -module Language.PureScript.TypeChecker.Unify - ( freshType - , freshTypeWithKind - , solveType - , substituteType - , unknownsInType - , unifyTypes - , unifyRows - , alignRowsWith - , replaceTypeWildcards - , varIfUnknown - ) where +{- | +Functions and instances relating to unification +-} +module Language.PureScript.TypeChecker.Unify ( + freshType, + freshTypeWithKind, + solveType, + substituteType, + unknownsInType, + unifyTypes, + unifyRows, + alignRowsWith, + replaceTypeWildcards, + varIfUnknown, +) where import Prelude import Control.Monad (forM_, void) -import Control.Monad.Error.Class (MonadError(..)) -import Control.Monad.State.Class (MonadState(..), gets, modify, state) -import Control.Monad.Writer.Class (MonadWriter(..)) +import Control.Monad.Error.Class (MonadError (..)) +import Control.Monad.State.Class (MonadState (..), gets, modify, state) +import Control.Monad.Writer.Class (MonadWriter (..)) import Data.Foldable (traverse_) -import Data.Maybe (fromMaybe) import Data.Map qualified as M +import Data.Maybe (fromMaybe) import Data.Text qualified as T import Language.PureScript.Crash (internalError) import Language.PureScript.Environment qualified as E -import Language.PureScript.Errors (ErrorMessageHint(..), MultipleErrors, SimpleErrorMessage(..), SourceAnn, errorMessage, internalCompilerError, onErrorMessages, rethrow, warnWithPosition, withoutPosition) +import Language.PureScript.Errors (ErrorMessageHint (..), MultipleErrors, SimpleErrorMessage (..), SourceAnn, errorMessage, internalCompilerError, onErrorMessages, rethrow, warnWithPosition, withoutPosition) import Language.PureScript.TypeChecker.Kinds (elaborateKind, instantiateKind, unifyKinds') -import Language.PureScript.TypeChecker.Monad (CheckState(..), Substitution(..), UnkLevel(..), Unknown, getLocalContext, guardWith, lookupUnkName, withErrorMessageHint) +import Language.PureScript.TypeChecker.Monad (CheckState (..), Substitution (..), UnkLevel (..), Unknown, debugSubstitution, getLocalContext, guardWith, lookupUnkName, withErrorMessageHint) import Language.PureScript.TypeChecker.Skolems (newSkolemConstant, skolemize) -import Language.PureScript.Types (Constraint(..), pattern REmptyKinded, RowListItem(..), SourceType, Type(..), WildcardData(..), alignRowsWith, everythingOnTypes, everywhereOnTypes, everywhereOnTypesM, getAnnForType, mkForAll, rowFromList, srcTUnknown) +import Language.PureScript.Types (Constraint (..), RowListItem (..), SourceType, Type (..), WildcardData (..), alignRowsWith, everythingOnTypes, everywhereOnTypes, everywhereOnTypesM, getAnnForType, mkForAll, rowFromList, srcTUnknown, pattern REmptyKinded) + +import Data.Bifunctor (bimap) +import Debug.Trace +import Language.Purus.Pretty.Types (prettyTypeStr) + +moduleTraces :: Bool +moduleTraces = True + +goTrace :: forall x. String -> x -> x +goTrace str x + | moduleTraces = trace str x + | otherwise = x + +goTraceM :: forall f. (Applicative f) => String -> f () +goTraceM msg + | moduleTraces = traceM msg + | otherwise = pure () + +spacer = "\n" <> replicate 20 '-' + +prettySubstitution :: Substitution -> String +prettySubstitution Substitution {..} = + "SUBSTITUTION: " + <> "\n SUBST_TYPE: " + <> show (bimap show prettyTypeStr <$> M.toList substType) + <> "\n SUBST_UNSOLVED: " + <> show (bimap show (bimap show prettyTypeStr) <$> M.toList substUnsolved) + <> "\n SUBST_NAMES: " + <> show (M.toList substNames) -- | Generate a fresh type variable with an unknown kind. Avoid this if at all possible. freshType :: (MonadState CheckState m) => m SourceType freshType = state $ \st -> do let t = checkNextType st - st' = st { checkNextType = t + 2 - , checkSubstitution = - (checkSubstitution st) { substUnsolved = M.insert t (UnkLevel (pure t), E.kindType) - . M.insert (t + 1) (UnkLevel (pure (t + 1)), srcTUnknown t) - . substUnsolved - $ checkSubstitution st - } - } + st' = + st + { checkNextType = t + 2 + , checkSubstitution = + (checkSubstitution st) + { substUnsolved = + M.insert t (UnkLevel (pure t), E.kindType) + . M.insert (t + 1) (UnkLevel (pure (t + 1)), srcTUnknown t) + . substUnsolved + $ checkSubstitution st + } + } (srcTUnknown (t + 1), st') -- | Generate a fresh type variable with a known kind. @@ -54,15 +87,17 @@ freshTypeWithKind :: (MonadState CheckState m) => SourceType -> m SourceType freshTypeWithKind kind = state $ \st -> do let t = checkNextType st - st' = st { checkNextType = t + 1 - , checkSubstitution = - (checkSubstitution st) { substUnsolved = M.insert t (UnkLevel (pure t), kind) (substUnsolved (checkSubstitution st)) } - } + st' = + st + { checkNextType = t + 1 + , checkSubstitution = + (checkSubstitution st) {substUnsolved = M.insert t (UnkLevel (pure t), kind) (substUnsolved (checkSubstitution st))} + } (srcTUnknown t, st') -- | Update the substitution to solve a type constraint solveType :: (MonadError MultipleErrors m, MonadState CheckState m) => Int -> SourceType -> m () -solveType u t = rethrow (onErrorMessages withoutPosition) $ do +solveType u t = goTrace msg $ rethrow (onErrorMessages withoutPosition) $ do -- We strip the position so that any errors get rethrown with the position of -- the original unification constraint. Otherwise errors may arise from arbitrary -- locations. We don't otherwise have the "correct" position on hand, since it @@ -72,152 +107,206 @@ solveType u t = rethrow (onErrorMessages withoutPosition) $ do subst <- gets checkSubstitution k2 <- maybe (internalCompilerError ("No kind for unification variable ?" <> T.pack (show u))) (pure . substituteType subst . snd) . M.lookup u . substUnsolved $ subst t' <- instantiateKind (t, k1) k2 - modify $ \cs -> cs { checkSubstitution = - (checkSubstitution cs) { substType = - M.insert u t' $ substType $ checkSubstitution cs - } - } + modify $ \cs -> + cs + { checkSubstitution = + (checkSubstitution cs) + { substType = + M.insert u t' $ substType $ checkSubstitution cs + } + } + where + msg = + "SOLVETYPE" + <> "\n UNKNOWN: " + <> show u + <> "\n TYPE: " + <> prettyTypeStr t -- | Apply a substitution to a type substituteType :: Substitution -> SourceType -> SourceType -substituteType sub = everywhereOnTypes go +substituteType sub toSub = goTrace msg result where - go (TUnknown ann u) = - case M.lookup u (substType sub) of - Nothing -> TUnknown ann u - Just (TUnknown ann' u1) | u1 == u -> TUnknown ann' u1 - Just t -> substituteType sub t - go other = other + result = everywhereOnTypes go toSub + + msg = + "SUBSTITUTE TYPE" + <> "\n SUBSTITUTION: " + <> prettySubstitution sub + <> "\n INPUT: " + <> prettyTypeStr toSub + <> "\n RESULT: " + <> prettyTypeStr result + <> spacer + + go (TUnknown ann u) = + case M.lookup u (substType sub) of + Nothing -> TUnknown ann u + Just (TUnknown ann' u1) | u1 == u -> TUnknown ann' u1 + Just t -> substituteType sub t + go other = other -- | Make sure that an unknown does not occur in a type occursCheck :: (MonadError MultipleErrors m) => Int -> SourceType -> m () -occursCheck _ TUnknown{} = return () +occursCheck _ TUnknown {} = return () occursCheck u t = void $ everywhereOnTypesM go t where - go (TUnknown _ u') | u == u' = throwError . errorMessage . InfiniteType $ t - go other = return other + go (TUnknown _ u') | u == u' = throwError . errorMessage . InfiniteType $ t + go other = return other -- | Compute a list of all unknowns appearing in a type unknownsInType :: Type a -> [(a, Int)] unknownsInType t = everythingOnTypes (.) go t [] where - go :: Type a -> [(a, Int)] -> [(a, Int)] - go (TUnknown ann u) = ((ann, u) :) - go _ = id + go :: Type a -> [(a, Int)] -> [(a, Int)] + go (TUnknown ann u) = ((ann, u) :) + go _ = id -- | Unify two types, updating the current substitution unifyTypes :: (MonadError MultipleErrors m, MonadState CheckState m) => SourceType -> SourceType -> m () unifyTypes t1 t2 = do + let msg = + "UNIFY TYPES" + <> "\n TYPE A: " + <> prettyTypeStr t1 + <> "\n TYPE B: " + <> prettyTypeStr t2 + <> "\n" + <> replicate 20 '-' + goTraceM msg sub <- gets checkSubstitution withErrorMessageHint (ErrorUnifyingTypes t1 t2) $ unifyTypes' (substituteType sub t1) (substituteType sub t2) where - unifyTypes' (TUnknown _ u1) (TUnknown _ u2) | u1 == u2 = return () - unifyTypes' (TUnknown _ u) t = solveType u t - unifyTypes' t (TUnknown _ u) = solveType u t - unifyTypes' (ForAll ann1 _ ident1 mbK1 ty1 sc1) (ForAll ann2 _ ident2 mbK2 ty2 sc2) = - case (sc1, sc2) of - (Just sc1', Just sc2') -> do - sko <- newSkolemConstant - let sk1 = skolemize ann1 ident1 mbK1 sko sc1' ty1 - let sk2 = skolemize ann2 ident2 mbK2 sko sc2' ty2 - sk1 `unifyTypes` sk2 - _ -> internalError "unifyTypes: unspecified skolem scope" - unifyTypes' (ForAll ann _ ident mbK ty1 (Just sc)) ty2 = do - sko <- newSkolemConstant - let sk = skolemize ann ident mbK sko sc ty1 - sk `unifyTypes` ty2 - unifyTypes' ForAll{} _ = internalError "unifyTypes: unspecified skolem scope" - unifyTypes' ty f@ForAll{} = f `unifyTypes` ty - unifyTypes' (TypeVar _ v1) (TypeVar _ v2) | v1 == v2 = return () - unifyTypes' ty1@(TypeConstructor _ c1) ty2@(TypeConstructor _ c2) = - guardWith (errorMessage (TypesDoNotUnify ty1 ty2)) (c1 == c2) - unifyTypes' (TypeLevelString _ s1) (TypeLevelString _ s2) | s1 == s2 = return () - unifyTypes' (TypeLevelInt _ n1) (TypeLevelInt _ n2) | n1 == n2 = return () - unifyTypes' (TypeApp _ t3 t4) (TypeApp _ t5 t6) = do - t3 `unifyTypes` t5 - t4 `unifyTypes` t6 - unifyTypes' (KindApp _ t3 t4) (KindApp _ t5 t6) = do - t3 `unifyKinds'` t5 - t4 `unifyTypes` t6 - unifyTypes' (Skolem _ _ _ s1 _) (Skolem _ _ _ s2 _) | s1 == s2 = return () - unifyTypes' (KindedType _ ty1 _) ty2 = ty1 `unifyTypes` ty2 - unifyTypes' ty1 (KindedType _ ty2 _) = ty1 `unifyTypes` ty2 - unifyTypes' r1@RCons{} r2 = unifyRows r1 r2 - unifyTypes' r1 r2@RCons{} = unifyRows r1 r2 - unifyTypes' r1@REmptyKinded{} r2 = unifyRows r1 r2 - unifyTypes' r1 r2@REmptyKinded{} = unifyRows r1 r2 - unifyTypes' (ConstrainedType _ c1 ty1) (ConstrainedType _ c2 ty2) - | constraintClass c1 == constraintClass c2 && constraintData c1 == constraintData c2 = do - traverse_ (uncurry unifyTypes) (constraintArgs c1 `zip` constraintArgs c2) - ty1 `unifyTypes` ty2 - unifyTypes' ty1@ConstrainedType{} ty2 = - throwError . errorMessage $ ConstrainedTypeUnified ty1 ty2 - unifyTypes' t3 t4@ConstrainedType{} = unifyTypes' t4 t3 - unifyTypes' t3 t4 = - throwError . errorMessage $ TypesDoNotUnify t3 t4 - --- | Unify two rows, updating the current substitution --- --- Common labels are identified and unified. Remaining labels and types are unified with a --- trailing row unification variable, if appropriate. + unifyTypes' (TUnknown _ u1) (TUnknown _ u2) | u1 == u2 = return () + unifyTypes' (TUnknown _ u) t = solveType u t + unifyTypes' t (TUnknown _ u) = solveType u t + unifyTypes' (ForAll ann1 _ ident1 mbK1 ty1 sc1) (ForAll ann2 _ ident2 mbK2 ty2 sc2) = + case (sc1, sc2) of + (Just sc1', Just sc2') -> do + sko <- newSkolemConstant + let sk1 = skolemize ann1 ident1 mbK1 sko sc1' ty1 + let sk2 = skolemize ann2 ident2 mbK2 sko sc2' ty2 + sk1 `unifyTypes` sk2 + _ -> internalError "unifyTypes: unspecified skolem scope" + unifyTypes' (ForAll ann _ ident mbK ty1 (Just sc)) ty2 = do + sko <- newSkolemConstant + let sk = skolemize ann ident mbK sko sc ty1 + sk `unifyTypes` ty2 + unifyTypes' ForAll {} _ = internalError "unifyTypes: unspecified skolem scope" + unifyTypes' ty f@ForAll {} = f `unifyTypes` ty + unifyTypes' (TypeVar _ v1 k1) (TypeVar _ v2 k2) | v1 == v2 = pure () -- REVIEW/HACK: Not sure if this is right... + unifyTypes' ty1@(TypeConstructor _ c1) ty2@(TypeConstructor _ c2) = + guardWith (errorMessage (TypesDoNotUnify ty1 ty2)) (c1 == c2) + unifyTypes' (TypeLevelString _ s1) (TypeLevelString _ s2) | s1 == s2 = return () + unifyTypes' (TypeLevelInt _ n1) (TypeLevelInt _ n2) | n1 == n2 = return () + unifyTypes' (TypeApp _ t3 t4) (TypeApp _ t5 t6) = do + t3 `unifyTypes` t5 + t4 `unifyTypes` t6 + unifyTypes' (KindApp _ t3 t4) (KindApp _ t5 t6) = do + t3 `unifyKinds'` t5 + t4 `unifyTypes` t6 + unifyTypes' (Skolem _ _ _ s1 _) (Skolem _ _ _ s2 _) | s1 == s2 = return () + unifyTypes' (KindedType _ ty1 _) ty2 = ty1 `unifyTypes` ty2 + unifyTypes' ty1 (KindedType _ ty2 _) = ty1 `unifyTypes` ty2 + unifyTypes' r1@RCons {} r2 = unifyRows r1 r2 + unifyTypes' r1 r2@RCons {} = unifyRows r1 r2 + unifyTypes' r1@REmptyKinded {} r2 = unifyRows r1 r2 + unifyTypes' r1 r2@REmptyKinded {} = unifyRows r1 r2 + unifyTypes' (ConstrainedType _ c1 ty1) (ConstrainedType _ c2 ty2) + | constraintClass c1 == constraintClass c2 && constraintData c1 == constraintData c2 = do + traverse_ (uncurry unifyTypes) (constraintArgs c1 `zip` constraintArgs c2) + ty1 `unifyTypes` ty2 + unifyTypes' ty1@ConstrainedType {} ty2 = + throwError . errorMessage $ ConstrainedTypeUnified ty1 ty2 + unifyTypes' t3 t4@ConstrainedType {} = unifyTypes' t4 t3 + unifyTypes' t3 t4 = + throwError . errorMessage $ TypesDoNotUnify t3 t4 + +{- | Unify two rows, updating the current substitution + +Common labels are identified and unified. Remaining labels and types are unified with a +trailing row unification variable, if appropriate. +-} unifyRows :: forall m. (MonadError MultipleErrors m, MonadState CheckState m) => SourceType -> SourceType -> m () -unifyRows r1 r2 = sequence_ matches *> uncurry unifyTails rest where - unifyTypesWithLabel l t1 t2 = withErrorMessageHint (ErrorInRowLabel l) $ unifyTypes t1 t2 - - (matches, rest) = alignRowsWith unifyTypesWithLabel r1 r2 - - unifyTails :: ([RowListItem SourceAnn], SourceType) -> ([RowListItem SourceAnn], SourceType) -> m () - unifyTails ([], TUnknown _ u) (sd, r) = solveType u (rowFromList (sd, r)) - unifyTails (sd, r) ([], TUnknown _ u) = solveType u (rowFromList (sd, r)) - unifyTails ([], REmptyKinded _ _) ([], REmptyKinded _ _) = return () - unifyTails ([], TypeVar _ v1) ([], TypeVar _ v2) | v1 == v2 = return () - unifyTails ([], Skolem _ _ _ s1 _) ([], Skolem _ _ _ s2 _) | s1 == s2 = return () - unifyTails (sd1, TUnknown a u1) (sd2, TUnknown _ u2) | u1 /= u2 = do - forM_ sd1 $ occursCheck u2 . rowListType - forM_ sd2 $ occursCheck u1 . rowListType - rest' <- freshTypeWithKind =<< elaborateKind (TUnknown a u1) - solveType u1 (rowFromList (sd2, rest')) - solveType u2 (rowFromList (sd1, rest')) - unifyTails _ _ = - throwError . errorMessage $ TypesDoNotUnify r1 r2 - --- | --- Replace type wildcards with unknowns --- +unifyRows r1 r2 = sequence_ matches *> uncurry unifyTails rest + where + unifyTypesWithLabel l t1 t2 = withErrorMessageHint (ErrorInRowLabel l) $ unifyTypes t1 t2 + + (matches, rest) = alignRowsWith unifyTypesWithLabel r1 r2 + + unifyTails :: ([RowListItem SourceAnn], SourceType) -> ([RowListItem SourceAnn], SourceType) -> m () + unifyTails ([], TUnknown _ u) (sd, r) = solveType u (rowFromList (sd, r)) + unifyTails (sd, r) ([], TUnknown _ u) = solveType u (rowFromList (sd, r)) + unifyTails ([], REmptyKinded _ _) ([], REmptyKinded _ _) = return () + unifyTails ([], TypeVar _ v1 k1) ([], TypeVar _ v2 k2) | v1 == v2 && k1 == k2 = return () + unifyTails ([], Skolem _ _ _ s1 _) ([], Skolem _ _ _ s2 _) | s1 == s2 = return () + unifyTails (sd1, TUnknown a u1) (sd2, TUnknown _ u2) | u1 /= u2 = do + forM_ sd1 $ occursCheck u2 . rowListType + forM_ sd2 $ occursCheck u1 . rowListType + rest' <- freshTypeWithKind =<< elaborateKind (TUnknown a u1) + solveType u1 (rowFromList (sd2, rest')) + solveType u2 (rowFromList (sd1, rest')) + unifyTails _ _ = + throwError . errorMessage $ TypesDoNotUnify r1 r2 + +{- | +Replace type wildcards with unknowns +-} replaceTypeWildcards :: (MonadWriter MultipleErrors m, MonadState CheckState m) => SourceType -> m SourceType replaceTypeWildcards = everywhereOnTypesM replace where - replace (TypeWildcard ann wdata) = do - t <- freshType - ctx <- getLocalContext - let err = case wdata of - HoleWildcard n -> Just $ HoleInferredType n t ctx Nothing - UnnamedWildcard -> Just $ WildcardInferredType t ctx - IgnoredWildcard -> Nothing - forM_ err $ warnWithPosition (fst ann) . tell . errorMessage - return t - replace other = return other - --- | --- Replace outermost unsolved unification variables with named type variables --- + replace (TypeWildcard ann wdata) = do + t <- freshType + ctx <- getLocalContext + let err = case wdata of + HoleWildcard n -> Just $ HoleInferredType n t ctx Nothing + UnnamedWildcard -> Just $ WildcardInferredType t ctx + IgnoredWildcard -> Nothing + forM_ err $ warnWithPosition (fst ann) . tell . errorMessage + return t + replace other = return other + +{- | +Replace outermost unsolved unification variables with named type variables +-} varIfUnknown :: forall m. (MonadState CheckState m) => [(Unknown, SourceType)] -> SourceType -> m SourceType varIfUnknown unks ty = do bn' <- traverse toBinding unks + -- This *should* be a map from TyVar names to their kinds. ugh + let bindings = M.fromList $ snd <$> bn' ty' <- go ty - pure $ mkForAll bn' ty' + let result = mkForAll bn' $ cleanup bindings ty' + msg = + "VAR_IF_UNKNOWN" + <> "\n UNKNOWNS: " + <> show (bimap show prettyTypeStr <$> unks) + <> "\n INPUT: " + <> prettyTypeStr ty + <> "\n RESULT: " + <> prettyTypeStr result + <> "\n" + <> replicate 20 '-' + goTraceM msg + pure result where - toName :: Unknown -> m T.Text - toName u = (<> T.pack (show u)) . fromMaybe "t" <$> lookupUnkName u - - toBinding :: (Unknown, SourceType) -> m (SourceAnn, (T.Text, Maybe SourceType)) - toBinding (u, k) = do - u' <- toName u - k' <- go k - pure (getAnnForType ty, (u', Just k')) - - go :: SourceType -> m SourceType - go = everywhereOnTypesM $ \case - (TUnknown ann u) -> - TypeVar ann <$> toName u - t -> pure t + toName :: Unknown -> m T.Text + toName u = (<> T.pack (show u)) . fromMaybe "t" <$> lookupUnkName u + + toBinding :: (Unknown, SourceType) -> m (SourceAnn, (T.Text, SourceType)) + toBinding (u, k) = do + u' <- toName u + k' <- go k + pure (getAnnForType ty, (u', k')) + + cleanup :: M.Map T.Text SourceType -> SourceType -> SourceType + cleanup dict = everywhereOnTypes $ \case + tv@(TypeVar ann nm _) -> case M.lookup nm dict of + Nothing -> tv + Just k' -> TypeVar ann nm k' + other -> other + + go :: SourceType -> m SourceType + go = everywhereOnTypesM $ \case + tu@(TUnknown ann u) -> + (\nm -> TypeVar ann nm tu) <$> toName u + t -> pure t diff --git a/src/Language/PureScript/TypeClassDictionaries.hs b/src/Language/PureScript/TypeClassDictionaries.hs index 593e8c1a8..727f55a99 100644 --- a/src/Language/PureScript/TypeClassDictionaries.hs +++ b/src/Language/PureScript/TypeClassDictionaries.hs @@ -2,48 +2,48 @@ module Language.PureScript.TypeClassDictionaries where import Prelude -import GHC.Generics (Generic) import Control.DeepSeq (NFData) import Data.Text (Text, pack) +import GHC.Generics (Generic) import Language.PureScript.AST.Declarations.ChainId (ChainId) -import Language.PureScript.Names (Ident, ProperName(..), ProperNameType(..), Qualified, disqualify) +import Language.PureScript.Names (Ident, ProperName (..), ProperNameType (..), Qualified, disqualify) import Language.PureScript.Types (SourceConstraint, SourceType) -- -- Data representing a type class dictionary which is in scope -- -data TypeClassDictionaryInScope v - = TypeClassDictionaryInScope { - -- | The instance chain - tcdChain :: Maybe ChainId - -- | Index of the instance chain - , tcdIndex :: Integer - -- | The value with which the dictionary can be accessed at runtime - , tcdValue :: v - -- | How to obtain this instance via superclass relationships - , tcdPath :: [(Qualified (ProperName 'ClassName), Integer)] - -- | The name of the type class to which this type class instance applies - , tcdClassName :: Qualified (ProperName 'ClassName) - -- | Quantification of type variables in the instance head and dependencies - , tcdForAll :: [(Text, SourceType)] - -- | The kinds to which this type class instance applies - , tcdInstanceKinds :: [SourceType] - -- | The types to which this type class instance applies - , tcdInstanceTypes :: [SourceType] - -- | Type class dependencies which must be satisfied to construct this dictionary - , tcdDependencies :: Maybe [SourceConstraint] - -- | If this instance was unnamed, the type to use when describing it in - -- error messages - , tcdDescription :: Maybe SourceType - } - deriving (Show, Functor, Foldable, Traversable, Generic) +data TypeClassDictionaryInScope v = TypeClassDictionaryInScope + { tcdChain :: Maybe ChainId + -- ^ The instance chain + , tcdIndex :: Integer + -- ^ Index of the instance chain + , tcdValue :: v + -- ^ The value with which the dictionary can be accessed at runtime + , tcdPath :: [(Qualified (ProperName 'ClassName), Integer)] + -- ^ How to obtain this instance via superclass relationships + , tcdClassName :: Qualified (ProperName 'ClassName) + -- ^ The name of the type class to which this type class instance applies + , tcdForAll :: [(Text, SourceType)] + -- ^ Quantification of type variables in the instance head and dependencies + , tcdInstanceKinds :: [SourceType] + -- ^ The kinds to which this type class instance applies + , tcdInstanceTypes :: [SourceType] + -- ^ The types to which this type class instance applies + , tcdDependencies :: Maybe [SourceConstraint] + -- ^ Type class dependencies which must be satisfied to construct this dictionary + , tcdDescription :: Maybe SourceType + -- ^ If this instance was unnamed, the type to use when describing it in + -- error messages + } + deriving (Show, Functor, Foldable, Traversable, Generic) -instance NFData v => NFData (TypeClassDictionaryInScope v) +instance (NFData v) => NFData (TypeClassDictionaryInScope v) type NamedDict = TypeClassDictionaryInScope (Qualified Ident) --- | Generate a name for a superclass reference which can be used in --- generated code. +{- | Generate a name for a superclass reference which can be used in +generated code. +-} superclassName :: Qualified (ProperName 'ClassName) -> Integer -> Text superclassName pn index = runProperName (disqualify pn) <> pack (show index) diff --git a/src/Language/PureScript/Types.hs b/src/Language/PureScript/Types.hs index ef00e21a0..b350892f5 100644 --- a/src/Language/PureScript/Types.hs +++ b/src/Language/PureScript/Types.hs @@ -1,18 +1,18 @@ --- | --- Data types for types --- +{- | +Data types for types +-} module Language.PureScript.Types where +import Protolude (fromMaybe, ordNub) import Prelude -import Protolude (ordNub, fromMaybe) import Codec.Serialise (Serialise) import Control.Applicative ((<|>)) import Control.Arrow (first, second) import Control.DeepSeq (NFData) -import Control.Lens (Lens', (^.), set) +import Control.Lens (Lens', set, (^.)) import Control.Monad ((<=<), (>=>)) -import Data.Aeson ((.:), (.:?), (.!=), (.=)) +import Data.Aeson ((.!=), (.:), (.:?), (.=)) import Data.Aeson qualified as A import Data.Aeson.Types qualified as A import Data.Foldable (fold, foldl') @@ -23,30 +23,30 @@ import Data.Text (Text) import Data.Text qualified as T import GHC.Generics (Generic) -import Language.PureScript.AST.SourcePos (pattern NullSourceAnn, SourceAnn, SourceSpan) +import Language.PureScript.AST.SourcePos (SourceAnn, SourceSpan, pattern NullSourceAnn) import Language.PureScript.Constants.Prim qualified as C -import Language.PureScript.Names (OpName, OpNameType(..), ProperName, ProperNameType(..), Qualified, coerceProperName) import Language.PureScript.Label (Label) +import Language.PureScript.Names (OpName, OpNameType (..), ProperName, ProperNameType (..), Qualified, coerceProperName) import Language.PureScript.PSString (PSString) type SourceType = Type SourceAnn type SourceConstraint = Constraint SourceAnn --- | --- An identifier for the scope of a skolem variable --- -newtype SkolemScope = SkolemScope { runSkolemScope :: Int } +{- | +An identifier for the scope of a skolem variable +-} +newtype SkolemScope = SkolemScope {runSkolemScope :: Int} deriving (Show, Eq, Ord, A.ToJSON, A.FromJSON, Generic) instance NFData SkolemScope instance Serialise SkolemScope --- | --- Describes how a TypeWildcard should be presented to the user during --- type checking: holes (?foo) are always emitted as errors, whereas unnamed --- wildcards (_) default to warnings, but are ignored entirely if they are --- contained by a binding with a complete (wildcard-free) type signature. --- +{- | +Describes how a TypeWildcard should be presented to the user during +type checking: holes (?foo) are always emitted as errors, whereas unnamed +wildcards (_) default to warnings, but are ignored entirely if they are +contained by a binding with a complete (wildcard-free) type signature. +-} data WildcardData = HoleWildcard Text | UnnamedWildcard | IgnoredWildcard deriving (Show, Eq, Ord, Generic) @@ -66,59 +66,60 @@ typeVarVisibilityPrefix = \case TypeVarVisible -> "@" TypeVarInvisible -> mempty --- | --- The type of types --- +{- | +The type of types +-} data Type a - -- | A unification variable of type Type - = TUnknown a Int - -- | A named type variable - | TypeVar a Text - -- | A type-level string - | TypeLevelString a PSString - -- | A type-level natural - | TypeLevelInt a Integer - -- | A type wildcard, as would appear in a partial type synonym - | TypeWildcard a WildcardData - -- | A type constructor - | TypeConstructor a (Qualified (ProperName 'TypeName)) - -- | A type operator. This will be desugared into a type constructor during the - -- "operators" phase of desugaring. - | TypeOp a (Qualified (OpName 'TypeOpName)) - -- | A type application - | TypeApp a (Type a) (Type a) - -- | Explicit kind application - | KindApp a (Type a) (Type a) - -- | Forall quantifier - | ForAll a TypeVarVisibility Text (Maybe (Type a)) (Type a) (Maybe SkolemScope) - -- | A type with a set of type class constraints - | ConstrainedType a (Constraint a) (Type a) - -- | A skolem constant - | Skolem a Text (Maybe (Type a)) Int SkolemScope - -- | An empty row - | REmpty a - -- | A non-empty row - | RCons a Label (Type a) (Type a) - -- | A type with a kind annotation - | KindedType a (Type a) (Type a) - -- | Binary operator application. During the rebracketing phase of desugaring, - -- this data constructor will be removed. - | BinaryNoParensType a (Type a) (Type a) (Type a) - -- | Explicit parentheses. During the rebracketing phase of desugaring, this - -- data constructor will be removed. - -- - -- Note: although it seems this constructor is not used, it _is_ useful, - -- since it prevents certain traversals from matching. - | ParensInType a (Type a) + = -- | A unification variable of type Type + TUnknown a Int + | -- | A named type variable with a kind annotation + TypeVar a Text (Type a) + | -- | A type-level string + TypeLevelString a PSString + | -- | A type-level natural + TypeLevelInt a Integer + | -- | A type wildcard, as would appear in a partial type synonym + TypeWildcard a WildcardData + | -- | A type constructor + TypeConstructor a (Qualified (ProperName 'TypeName)) + | -- | A type operator. This will be desugared into a type constructor during the + -- "operators" phase of desugaring. + TypeOp a (Qualified (OpName 'TypeOpName)) + | -- | A type application + TypeApp a (Type a) (Type a) + | -- | Explicit kind application + KindApp a (Type a) (Type a) + | -- | Forall quantifier + -- \/ TODO: Remove the maybe + ForAll a TypeVarVisibility Text (Type a) (Type a) (Maybe SkolemScope) + | -- | A type with a set of type class constraints + ConstrainedType a (Constraint a) (Type a) + | -- | A skolem constant + Skolem a Text (Type a) Int SkolemScope + | -- | An empty row + REmpty a + | -- | A non-empty row + RCons a Label (Type a) (Type a) + | -- | A type with a kind annotation + KindedType a (Type a) (Type a) + | -- | Binary operator application. During the rebracketing phase of desugaring, + -- this data constructor will be removed. + BinaryNoParensType a (Type a) (Type a) (Type a) + | -- | Explicit parentheses. During the rebracketing phase of desugaring, this + -- data constructor will be removed. + -- + -- Note: although it seems this constructor is not used, it _is_ useful, + -- since it prevents certain traversals from matching. + ParensInType a (Type a) deriving (Show, Generic, Functor, Foldable, Traversable) -instance NFData a => NFData (Type a) -instance Serialise a => Serialise (Type a) +instance (NFData a) => NFData (Type a) +instance (Serialise a) => Serialise (Type a) srcTUnknown :: Int -> SourceType srcTUnknown = TUnknown NullSourceAnn -srcTypeVar :: Text -> SourceType +srcTypeVar :: Text -> SourceType -> SourceType srcTypeVar = TypeVar NullSourceAnn srcTypeLevelString :: PSString -> SourceType @@ -139,7 +140,7 @@ srcTypeApp = TypeApp NullSourceAnn srcKindApp :: SourceType -> SourceType -> SourceType srcKindApp = KindApp NullSourceAnn -srcForAll :: TypeVarVisibility -> Text -> Maybe SourceType -> SourceType -> Maybe SkolemScope -> SourceType +srcForAll :: TypeVarVisibility -> Text -> SourceType -> SourceType -> Maybe SkolemScope -> SourceType srcForAll = ForAll NullSourceAnn srcConstrainedType :: SourceConstraint -> SourceType -> SourceType @@ -167,12 +168,12 @@ isREmpty = isJust . toREmptyKinded -- | Additional data relevant to type class constraints data ConstraintData - = PartialConstraintData [[Text]] Bool - -- ^ Data to accompany a Partial constraint generated by the exhaustivity checker. - -- It contains (rendered) binder information for those binders which were - -- not matched, and a flag indicating whether the list was truncated or not. - -- Note: we use 'Text' here because using 'Binder' would introduce a cyclic - -- dependency in the module graph. + = -- | Data to accompany a Partial constraint generated by the exhaustivity checker. + -- It contains (rendered) binder information for those binders which were + -- not matched, and a flag indicating whether the list was truncated or not. + -- Note: we use 'Text' here because using 'Binder' would introduce a cyclic + -- dependency in the module graph. + PartialConstraintData [[Text]] Bool deriving (Show, Eq, Ord, Generic) instance NFData ConstraintData @@ -186,33 +187,35 @@ data Constraint a = Constraint -- ^ constraint class name , constraintKindArgs :: [Type a] -- ^ kind arguments - , constraintArgs :: [Type a] + , constraintArgs :: [Type a] -- ^ type arguments - , constraintData :: Maybe ConstraintData + , constraintData :: Maybe ConstraintData -- ^ additional data relevant to this constraint - } deriving (Show, Generic, Functor, Foldable, Traversable) + } + deriving (Show, Generic, Functor, Foldable, Traversable) -instance NFData a => NFData (Constraint a) -instance Serialise a => Serialise (Constraint a) +instance (NFData a) => NFData (Constraint a) +instance (Serialise a) => Serialise (Constraint a) srcConstraint :: Qualified (ProperName 'ClassName) -> [SourceType] -> [SourceType] -> Maybe ConstraintData -> SourceConstraint srcConstraint = Constraint NullSourceAnn mapConstraintArgs :: ([Type a] -> [Type a]) -> Constraint a -> Constraint a -mapConstraintArgs f c = c { constraintArgs = f (constraintArgs c) } +mapConstraintArgs f c = c {constraintArgs = f (constraintArgs c)} -overConstraintArgs :: Functor f => ([Type a] -> f [Type a]) -> Constraint a -> f (Constraint a) -overConstraintArgs f c = (\args -> c { constraintArgs = args }) <$> f (constraintArgs c) +overConstraintArgs :: (Functor f) => ([Type a] -> f [Type a]) -> Constraint a -> f (Constraint a) +overConstraintArgs f c = (\args -> c {constraintArgs = args}) <$> f (constraintArgs c) mapConstraintArgsAll :: ([Type a] -> [Type a]) -> Constraint a -> Constraint a mapConstraintArgsAll f c = - c { constraintKindArgs = f (constraintKindArgs c) + c + { constraintKindArgs = f (constraintKindArgs c) , constraintArgs = f (constraintArgs c) } -overConstraintArgsAll :: Applicative f => ([Type a] -> f [Type a]) -> Constraint a -> f (Constraint a) +overConstraintArgsAll :: (Applicative f) => ([Type a] -> f [Type a]) -> Constraint a -> f (Constraint a) overConstraintArgsAll f c = - (\a b -> c { constraintKindArgs = a, constraintArgs = b }) + (\a b -> c {constraintKindArgs = a, constraintArgs = b}) <$> f (constraintKindArgs c) <*> f (constraintArgs c) @@ -225,11 +228,11 @@ constraintDataToJSON (PartialConstraintData bs trunc) = constraintToJSON :: (a -> A.Value) -> Constraint a -> A.Value constraintToJSON annToJSON Constraint {..} = A.object - [ "constraintAnn" .= annToJSON constraintAnn + [ "constraintAnn" .= annToJSON constraintAnn , "constraintClass" .= constraintClass - , "constraintKindArgs" .= fmap (typeToJSON annToJSON) constraintKindArgs - , "constraintArgs" .= fmap (typeToJSON annToJSON) constraintArgs - , "constraintData" .= fmap constraintDataToJSON constraintData + , "constraintKindArgs" .= fmap (typeToJSON annToJSON) constraintKindArgs + , "constraintArgs" .= fmap (typeToJSON annToJSON) constraintArgs + , "constraintData" .= fmap constraintDataToJSON constraintData ] typeVarVisToJSON :: TypeVarVisibility -> A.Value @@ -242,8 +245,12 @@ typeToJSON annToJSON ty = case ty of TUnknown a b -> variant "TUnknown" a b - TypeVar a b -> - variant "TypeVar" a b + TypeVar a b k -> + variant "TypeVar" a $ + A.object + [ "var" .= b + , "kind" .= typeToJSON annToJSON k + ] TypeLevelString a b -> variant "TypeLevelString" a b TypeLevelInt a b -> @@ -259,17 +266,18 @@ typeToJSON annToJSON ty = KindApp a b c -> variant "KindApp" a (go b, go c) ForAll a b c d e f -> - variant "ForAll" a $ A.object - [ "visibility" .= b - , "identifier" .= c - , "kind" .= fmap go d - , "type" .= go e - , "skolem" .= f - ] + variant "ForAll" a $ + A.object + [ "visibility" .= b + , "identifier" .= c + , "kind" .= go d + , "type" .= go e + , "skolem" .= f + ] ConstrainedType a b c -> variant "ConstrainedType" a (constraintToJSON annToJSON b, go c) Skolem a b c d e -> - variant "Skolem" a (b, go <$> c, d, e) + variant "Skolem" a (b, go c, d, e) REmpty a -> nullary "REmpty" a RCons a b c d -> @@ -281,34 +289,34 @@ typeToJSON annToJSON ty = ParensInType a b -> variant "ParensInType" a (go b) where - go :: Type a -> A.Value - go = typeToJSON annToJSON - - variant :: A.ToJSON b => String -> a -> b -> A.Value - variant tag ann contents = - A.object - [ "tag" .= tag - , "annotation" .= annToJSON ann - , "contents" .= contents - ] - - nullary :: String -> a -> A.Value - nullary tag ann = - A.object - [ "tag" .= tag - , "annotation" .= annToJSON ann - ] + go :: Type a -> A.Value + go = typeToJSON annToJSON + + variant :: (A.ToJSON b) => String -> a -> b -> A.Value + variant tag ann contents = + A.object + [ "tag" .= tag + , "annotation" .= annToJSON ann + , "contents" .= contents + ] + + nullary :: String -> a -> A.Value + nullary tag ann = + A.object + [ "tag" .= tag + , "annotation" .= annToJSON ann + ] instance A.ToJSON WildcardData where toJSON = \case HoleWildcard name -> A.String name UnnamedWildcard -> A.Null - IgnoredWildcard -> A.object [ "ignored" .= True ] + IgnoredWildcard -> A.object ["ignored" .= True] -instance A.ToJSON a => A.ToJSON (Type a) where +instance (A.ToJSON a) => A.ToJSON (Type a) where toJSON = typeToJSON A.toJSON -instance A.ToJSON a => A.ToJSON (Constraint a) where +instance (A.ToJSON a) => A.ToJSON (Constraint a) where toJSON = constraintToJSON A.toJSON instance A.ToJSON ConstraintData where @@ -324,11 +332,11 @@ constraintDataFromJSON = A.withObject "PartialConstraintData" $ \o -> do constraintFromJSON :: forall a. A.Parser a -> (A.Value -> A.Parser a) -> A.Value -> A.Parser (Constraint a) constraintFromJSON defaultAnn annFromJSON = A.withObject "Constraint" $ \o -> do - constraintAnn <- (o .: "constraintAnn" >>= annFromJSON) <|> defaultAnn + constraintAnn <- (o .: "constraintAnn" >>= annFromJSON) <|> defaultAnn constraintClass <- o .: "constraintClass" constraintKindArgs <- o .:? "constraintKindArgs" .!= [] >>= traverse (typeFromJSON defaultAnn annFromJSON) - constraintArgs <- o .: "constraintArgs" >>= traverse (typeFromJSON defaultAnn annFromJSON) - constraintData <- o .: "constraintData" >>= traverse constraintDataFromJSON + constraintArgs <- o .: "constraintArgs" >>= traverse (typeFromJSON defaultAnn annFromJSON) + constraintData <- o .: "constraintData" >>= traverse constraintDataFromJSON pure $ Constraint {..} typeVarVisFromJSON :: A.Value -> A.Parser TypeVarVisibility @@ -342,15 +350,18 @@ typeVarVisFromJSON v = do typeFromJSON :: forall a. A.Parser a -> (A.Value -> A.Parser a) -> A.Value -> A.Parser (Type a) typeFromJSON defaultAnn annFromJSON = A.withObject "Type" $ \o -> do tag <- o .: "tag" - a <- (o .: "annotation" >>= annFromJSON) <|> defaultAnn + a <- (o .: "annotation" >>= annFromJSON) <|> defaultAnn let - contents :: A.FromJSON b => A.Parser b + contents :: (A.FromJSON b) => A.Parser b contents = o .: "contents" case tag of "TUnknown" -> TUnknown a <$> contents - "TypeVar" -> - TypeVar a <$> contents + "TypeVar" -> do + tv <- contents + var <- tv .: "var" + ki <- A.explicitParseField (typeFromJSON defaultAnn annFromJSON) tv "kind" + pure $ TypeVar a var ki "TypeLevelString" -> TypeLevelString a <$> contents "TypeLevelInt" -> @@ -374,25 +385,21 @@ typeFromJSON defaultAnn annFromJSON = A.withObject "Type" $ \o -> do f <- contents v <- f .: "visibility" i <- f .: "identifier" - k <- f .:? "kind" + k <- f .: "kind" t <- f .: "type" s <- f .: "skolem" - ForAll a v i <$> traverse go k <*> go t <*> pure s - - withoutMbKind = do - (b, c, d) <- contents - ForAll a TypeVarInvisible b Nothing <$> go c <*> pure d + ForAll a v i <$> go k <*> go t <*> pure s withMbKind = do (b, c, d, e) <- contents - ForAll a TypeVarInvisible b <$> (Just <$> go c) <*> go d <*> pure e - asObject <|> withMbKind <|> withoutMbKind + ForAll a TypeVarInvisible b <$> (go c) <*> go d <*> pure e + asObject <|> withMbKind "ConstrainedType" -> do (b, c) <- contents ConstrainedType a <$> constraintFromJSON defaultAnn annFromJSON b <*> go c "Skolem" -> do (b, c, d, e) <- contents - c' <- traverse go c + c' <- go c pure $ Skolem a b c' d e "REmpty" -> pure $ REmpty a @@ -421,8 +428,8 @@ typeFromJSON defaultAnn annFromJSON = A.withObject "Type" $ \o -> do other -> fail $ "Unrecognised tag: " ++ other where - go :: A.Value -> A.Parser (Type a) - go = typeFromJSON defaultAnn annFromJSON + go :: A.Value -> A.Parser (Type a) + go = typeFromJSON defaultAnn annFromJSON -- These overlapping instances exist to preserve compatibility for common -- instances which have a sensible default for missing annotations. @@ -432,7 +439,7 @@ instance {-# OVERLAPPING #-} A.FromJSON (Type SourceAnn) where instance {-# OVERLAPPING #-} A.FromJSON (Type ()) where parseJSON = typeFromJSON (pure ()) A.parseJSON -instance {-# OVERLAPPING #-} A.FromJSON a => A.FromJSON (Type a) where +instance {-# OVERLAPPING #-} (A.FromJSON a) => A.FromJSON (Type a) where parseJSON = typeFromJSON (fail "Invalid annotation") A.parseJSON instance {-# OVERLAPPING #-} A.FromJSON (Constraint SourceAnn) where @@ -441,7 +448,7 @@ instance {-# OVERLAPPING #-} A.FromJSON (Constraint SourceAnn) where instance {-# OVERLAPPING #-} A.FromJSON (Constraint ()) where parseJSON = constraintFromJSON (pure ()) A.parseJSON -instance {-# OVERLAPPING #-} A.FromJSON a => A.FromJSON (Constraint a) where +instance {-# OVERLAPPING #-} (A.FromJSON a) => A.FromJSON (Constraint a) where parseJSON = constraintFromJSON (fail "Invalid annotation") A.parseJSON instance A.FromJSON ConstraintData where @@ -461,17 +468,19 @@ data RowListItem a = RowListItem { rowListAnn :: a , rowListLabel :: Label , rowListType :: Type a - } deriving (Show, Generic, Functor, Foldable, Traversable) + } + deriving (Show, Generic, Functor, Foldable, Traversable) srcRowListItem :: Label -> SourceType -> RowListItem SourceAnn srcRowListItem = RowListItem NullSourceAnn -- | Convert a row to a list of pairs of labels and types rowToList :: Type a -> ([RowListItem a], Type a) -rowToList = go where - go (RCons ann name ty row) = - first (RowListItem ann name ty :) (rowToList row) - go r = ([], r) +rowToList = go + where + go (RCons ann name ty row) = + first (RowListItem ann name ty :) (rowToList row) + go r = ([], r) -- | Convert a row to a list of pairs of labels and types, sorted by the labels. rowToSortedList :: Type a -> ([RowListItem a], Type a) @@ -481,39 +490,41 @@ rowToSortedList = first (sortOn rowListLabel) . rowToList rowFromList :: ([RowListItem a], Type a) -> Type a rowFromList (xs, r) = foldr (\(RowListItem ann name ty) -> RCons ann name ty) r xs --- | Align two rows of types, splitting them into three parts: --- --- * Those types which appear in both rows --- * Those which appear only on the left --- * Those which appear only on the right --- --- Note: importantly, we preserve the order of the types with a given label. -alignRowsWith - :: (Label -> Type a -> Type a -> r) - -> Type a - -> Type a - -> ([r], (([RowListItem a], Type a), ([RowListItem a], Type a))) -alignRowsWith f ty1 ty2 = go s1 s2 where - (s1, tail1) = rowToSortedList ty1 - (s2, tail2) = rowToSortedList ty2 - - go [] r = ([], (([], tail1), (r, tail2))) - go r [] = ([], ((r, tail1), ([], tail2))) - go lhs@(RowListItem a1 l1 t1 : r1) rhs@(RowListItem a2 l2 t2 : r2) = - case compare l1 l2 of - LT -> (second . first . first) (RowListItem a1 l1 t1 :) (go r1 rhs) - GT -> (second . second . first) (RowListItem a2 l2 t2 :) (go lhs r2) - EQ -> first (f l1 t1 t2 :) (go r1 r2) +{- | Align two rows of types, splitting them into three parts: + +* Those types which appear in both rows +* Those which appear only on the left +* Those which appear only on the right + +Note: importantly, we preserve the order of the types with a given label. +-} +alignRowsWith :: + (Label -> Type a -> Type a -> r) -> + Type a -> + Type a -> + ([r], (([RowListItem a], Type a), ([RowListItem a], Type a))) +alignRowsWith f ty1 ty2 = go s1 s2 + where + (s1, tail1) = rowToSortedList ty1 + (s2, tail2) = rowToSortedList ty2 + + go [] r = ([], (([], tail1), (r, tail2))) + go r [] = ([], ((r, tail1), ([], tail2))) + go lhs@(RowListItem a1 l1 t1 : r1) rhs@(RowListItem a2 l2 t2 : r2) = + case compare l1 l2 of + LT -> (second . first . first) (RowListItem a1 l1 t1 :) (go r1 rhs) + GT -> (second . second . first) (RowListItem a2 l2 t2 :) (go lhs r2) + EQ -> first (f l1 t1 t2 :) (go r1 r2) -- | Check whether a type is a monotype isMonoType :: Type a -> Bool -isMonoType ForAll{} = False +isMonoType ForAll {} = False isMonoType (ParensInType _ t) = isMonoType t isMonoType (KindedType _ t _) = isMonoType t -isMonoType _ = True +isMonoType _ = True -- | Universally quantify a type -mkForAll :: [(a, (Text, Maybe (Type a)))] -> Type a -> Type a +mkForAll :: [(a, (Text, Type a))] -> Type a -> Type a mkForAll args ty = foldr (\(ann, (arg, mbK)) t -> ForAll ann TypeVarInvisible arg mbK t Nothing) ty args -- | Replace a type variable, taking into account variable shadowing @@ -522,246 +533,243 @@ replaceTypeVars v r = replaceAllTypeVars [(v, r)] -- | Replace named type variables with types replaceAllTypeVars :: [(Text, Type a)] -> Type a -> Type a -replaceAllTypeVars = go [] where - go :: [Text] -> [(Text, Type a)] -> Type a -> Type a - go _ m (TypeVar ann v) = fromMaybe (TypeVar ann v) (v `lookup` m) - go bs m (TypeApp ann t1 t2) = TypeApp ann (go bs m t1) (go bs m t2) - go bs m (KindApp ann t1 t2) = KindApp ann (go bs m t1) (go bs m t2) - go bs m (ForAll ann vis v mbK t sco) - | v `elem` keys = go bs (filter ((/= v) . fst) m) $ ForAll ann vis v mbK' t sco - | v `elem` usedVars = - let v' = genPureName v (keys ++ bs ++ usedVars) - t' = go bs [(v, TypeVar ann v')] t - in ForAll ann vis v' mbK' (go (v' : bs) m t') sco - | otherwise = ForAll ann vis v mbK' (go (v : bs) m t) sco - where - mbK' = go bs m <$> mbK - keys = map fst m - usedVars = concatMap (usedTypeVariables . snd) m - go bs m (ConstrainedType ann c t) = ConstrainedType ann (mapConstraintArgsAll (map (go bs m)) c) (go bs m t) - go bs m (RCons ann name' t r) = RCons ann name' (go bs m t) (go bs m r) - go bs m (KindedType ann t k) = KindedType ann (go bs m t) (go bs m k) - go bs m (BinaryNoParensType ann t1 t2 t3) = BinaryNoParensType ann (go bs m t1) (go bs m t2) (go bs m t3) - go bs m (ParensInType ann t) = ParensInType ann (go bs m t) - go _ _ ty = ty +replaceAllTypeVars = go [] + where + go :: [Text] -> [(Text, Type a)] -> Type a -> Type a + go _ m (TypeVar ann v k) = fromMaybe (TypeVar ann v k) (v `lookup` m) + go bs m (TypeApp ann t1 t2) = TypeApp ann (go bs m t1) (go bs m t2) + go bs m (KindApp ann t1 t2) = KindApp ann (go bs m t1) (go bs m t2) + go bs m (ForAll ann vis v mbK t sco) + | v `elem` keys = go bs (filter ((/= v) . fst) m) $ ForAll ann vis v mbK' t sco + | (v, mbK) `elem` usedVars = + let v' = genPureName v (keys ++ bs ++ (fst <$> usedVars)) + t' = go bs [(v, TypeVar ann v' mbK)] t + in ForAll ann vis v' mbK' (go (v' : bs) m t') sco + | otherwise = ForAll ann vis v mbK' (go (v : bs) m t) sco + where + mbK' = go bs m mbK + keys = map fst m + usedVars = concatMap (usedTypeVariables . snd) m + go bs m (ConstrainedType ann c t) = ConstrainedType ann (mapConstraintArgsAll (map (go bs m)) c) (go bs m t) + go bs m (RCons ann name' t r) = RCons ann name' (go bs m t) (go bs m r) + go bs m (KindedType ann t k) = KindedType ann (go bs m t) (go bs m k) + go bs m (BinaryNoParensType ann t1 t2 t3) = BinaryNoParensType ann (go bs m t1) (go bs m t2) (go bs m t3) + go bs m (ParensInType ann t) = ParensInType ann (go bs m t) + go _ _ ty = ty genPureName :: Text -> [Text] -> Text genPureName orig inUse = try' 0 where - try' :: Integer -> Text - try' n | (orig <> T.pack (show n)) `elem` inUse = try' (n + 1) - | otherwise = orig <> T.pack (show n) + try' :: Integer -> Text + try' n + | (orig <> T.pack (show n)) `elem` inUse = try' (n + 1) + | otherwise = orig <> T.pack (show n) -- | Add visible type abstractions to top-level foralls. addVisibility :: [(Text, TypeVarVisibility)] -> Type a -> Type a -addVisibility v = go where - go (ForAll ann vis arg mbK ty sco) = case lookup arg v of - Just vis' -> - ForAll ann vis' arg mbK (go ty) sco - Nothing -> - ForAll ann vis arg mbK (go ty) sco - go (ParensInType ann ty) = ParensInType ann (go ty) - go ty = ty +addVisibility v = go + where + go (ForAll ann vis arg mbK ty sco) = case lookup arg v of + Just vis' -> + ForAll ann vis' arg mbK (go ty) sco + Nothing -> + ForAll ann vis arg mbK (go ty) sco + go (ParensInType ann ty) = ParensInType ann (go ty) + go ty = ty -- | Collect all type variables appearing in a type -usedTypeVariables :: Type a -> [Text] -usedTypeVariables = ordNub . everythingOnTypes (++) go where - go (TypeVar _ v) = [v] - go _ = [] +usedTypeVariables :: Type a -> [(Text, Type a)] +usedTypeVariables = ordNub . everythingOnTypes (++) go + where + go (TypeVar _ v k) = [(v, k)] + go _ = [] -- | Collect all free type variables appearing in a type -freeTypeVariables :: Type a -> [Text] -freeTypeVariables = ordNub . fmap snd . sortOn fst . go 0 [] where - -- Tracks kind levels so that variables appearing in kind annotations are listed first. - go :: Int -> [Text] -> Type a -> [(Int, Text)] - go lvl bound (TypeVar _ v) | v `notElem` bound = [(lvl, v)] - go lvl bound (TypeApp _ t1 t2) = go lvl bound t1 ++ go lvl bound t2 - go lvl bound (KindApp _ t1 t2) = go lvl bound t1 ++ go (lvl - 1) bound t2 - go lvl bound (ForAll _ _ v mbK t _) = foldMap (go (lvl - 1) bound) mbK ++ go lvl (v : bound) t - go lvl bound (ConstrainedType _ c t) = foldMap (go (lvl - 1) bound) (constraintKindArgs c) ++ foldMap (go lvl bound) (constraintArgs c) ++ go lvl bound t - go lvl bound (RCons _ _ t r) = go lvl bound t ++ go lvl bound r - go lvl bound (KindedType _ t k) = go lvl bound t ++ go (lvl - 1) bound k - go lvl bound (BinaryNoParensType _ t1 t2 t3) = go lvl bound t1 ++ go lvl bound t2 ++ go lvl bound t3 - go lvl bound (ParensInType _ t) = go lvl bound t - go _ _ _ = [] +freeTypeVariables :: Type a -> [(Text, Type a)] +freeTypeVariables = ordNub . fmap snd . sortOn fst . go 0 [] + where + -- Tracks kind levels so that variables appearing in kind annotations are listed first. + go :: Int -> [Text] -> Type a -> [(Int, (Text, Type a))] + go lvl bound (TypeVar _ v k) | v `notElem` bound = [(lvl, (v, k))] + go lvl bound (TypeApp _ t1 t2) = go lvl bound t1 ++ go lvl bound t2 + go lvl bound (KindApp _ t1 t2) = go lvl bound t1 ++ go (lvl - 1) bound t2 + go lvl bound (ForAll _ _ v mbK t _) = go (lvl - 1) bound mbK ++ go lvl (v : bound) t + go lvl bound (ConstrainedType _ c t) = foldMap (go (lvl - 1) bound) (constraintKindArgs c) ++ foldMap (go lvl bound) (constraintArgs c) ++ go lvl bound t + go lvl bound (RCons _ _ t r) = go lvl bound t ++ go lvl bound r + go lvl bound (KindedType _ t k) = go lvl bound t ++ go (lvl - 1) bound k + go lvl bound (BinaryNoParensType _ t1 t2 t3) = go lvl bound t1 ++ go lvl bound t2 ++ go lvl bound t3 + go lvl bound (ParensInType _ t) = go lvl bound t + go _ _ _ = [] -- | Collect a complete set of kind-annotated quantifiers at the front of a type. completeBinderList :: Type a -> Maybe ([(a, (Text, Type a))], Type a) completeBinderList = go [] where - go acc = \case - ForAll _ _ _ Nothing _ _ -> Nothing - ForAll ann _ var (Just k) ty _ -> go ((ann, (var, k)) : acc) ty - ty -> Just (reverse acc, ty) + go acc = \case + ForAll ann _ var k ty _ -> go ((ann, (var, k)) : acc) ty + ty -> Just (reverse acc, ty) -- | Universally quantify over all type variables appearing free in a type quantify :: Type a -> Type a -quantify ty = foldr (\arg t -> ForAll (getAnnForType ty) TypeVarInvisible arg Nothing t Nothing) ty $ freeTypeVariables ty +quantify ty = foldr (\(arg, argKind) t -> ForAll (getAnnForType ty) TypeVarInvisible arg argKind t Nothing) ty $ freeTypeVariables ty -- | Move all universal quantifiers to the front of a type -moveQuantifiersToFront :: a -> Type a -> Type a -moveQuantifiersToFront syntheticAnn = go [] [] +moveQuantifiersToFront :: forall a. a -> Type a -> Type a +moveQuantifiersToFront syntheticAnn = go [] [] where - go qs cs = \case - ForAll ann vis q mbK ty sco -> do - let - cArgs :: [Text] = cs >>= constraintArgs . snd >>= freeTypeVariables - (q'', ty') - | q `elem` cArgs = do - let q' = genPureName q $ cArgs <> freeTypeVariables ty - (q', replaceTypeVars q (TypeVar syntheticAnn q') ty) - | otherwise = - (q, ty) - go ((ann, q'', sco, mbK, vis) : qs) cs ty' - ConstrainedType ann c ty -> - go qs ((ann, c) : cs) ty - ty -> - foldl (\ty' (ann, q, sco, mbK, vis) -> ForAll ann vis q mbK ty' sco) (foldl (\ty' (ann, c) -> ConstrainedType ann c ty') ty cs) qs + go qs cs = \case + ForAll ann vis q mbK ty sco -> do + let + cArgs :: [(Text, Type a)] = cs >>= constraintArgs . snd >>= freeTypeVariables + (q'', ty') + | q `elem` (fst <$> cArgs) = do + let q' = genPureName q $ (fst <$> cArgs) <> (fst <$> freeTypeVariables ty) + (q', replaceTypeVars q (TypeVar syntheticAnn q' mbK) ty) + | otherwise = + (q, ty) + go ((ann, q'', sco, mbK, vis) : qs) cs ty' + ConstrainedType ann c ty -> + go qs ((ann, c) : cs) ty + ty -> + foldl (\ty' (ann, q, sco, mbK, vis) -> ForAll ann vis q mbK ty' sco) (foldl (\ty' (ann, c) -> ConstrainedType ann c ty') ty cs) qs -- | Check if a type contains `forall` containsForAll :: Type a -> Bool -containsForAll = everythingOnTypes (||) go where - go :: Type a -> Bool - go ForAll{} = True - go _ = False +containsForAll = everythingOnTypes (||) go + where + go :: Type a -> Bool + go ForAll {} = True + go _ = False unknowns :: Type a -> IS.IntSet -unknowns = everythingOnTypes (<>) go where - go :: Type a -> IS.IntSet - go (TUnknown _ u) = IS.singleton u - go _ = mempty +unknowns = everythingOnTypes (<>) go + where + go :: Type a -> IS.IntSet + go (TUnknown _ u) = IS.singleton u + go _ = mempty --- | Check if a type contains unknowns in a position that is relevant to --- constraint solving. (Kinds are not.) +{- | Check if a type contains unknowns in a position that is relevant to +constraint solving. (Kinds are not.) +-} containsUnknowns :: Type a -> Bool -containsUnknowns = everythingOnTypes (||) go . eraseKindApps where - go :: Type a -> Bool - go TUnknown{} = True - go _ = False +containsUnknowns = everythingOnTypes (||) go . eraseKindApps + where + go :: Type a -> Bool + go TUnknown {} = True + go _ = False eraseKindApps :: Type a -> Type a eraseKindApps = everywhereOnTypes $ \case KindApp _ ty _ -> ty ConstrainedType ann con ty -> - ConstrainedType ann (con { constraintKindArgs = [] }) ty - Skolem ann name _ i sc -> - Skolem ann name Nothing i sc + ConstrainedType ann (con {constraintKindArgs = []}) ty other -> other -eraseForAllKindAnnotations :: Type a -> Type a -eraseForAllKindAnnotations = removeAmbiguousVars . removeForAllKinds - where - removeForAllKinds = everywhereOnTypes $ \case - ForAll ann vis arg _ ty sco -> - ForAll ann vis arg Nothing ty sco - other -> other - - removeAmbiguousVars = everywhereOnTypes $ \case - fa@(ForAll _ _ arg _ ty _) - | arg `elem` freeTypeVariables ty -> fa - | otherwise -> ty - other -> other - unapplyTypes :: Type a -> (Type a, [Type a], [Type a]) unapplyTypes = goTypes [] where - goTypes acc (TypeApp _ a b) = goTypes (b : acc) a - goTypes acc a = let (ty, kinds) = goKinds [] a in (ty, kinds, acc) + goTypes acc (TypeApp _ a b) = goTypes (b : acc) a + goTypes acc a = let (ty, kinds) = goKinds [] a in (ty, kinds, acc) - goKinds acc (KindApp _ a b) = goKinds (b : acc) a - goKinds acc a = (a, acc) + goKinds acc (KindApp _ a b) = goKinds (b : acc) a + goKinds acc a = (a, acc) unapplyConstraints :: Type a -> ([Constraint a], Type a) unapplyConstraints = go [] where - go acc (ConstrainedType _ con ty) = go (con : acc) ty - go acc ty = (reverse acc, ty) - --- | Construct the type of an instance declaration from its parts. Used in --- error messages describing unnamed instances. -srcInstanceType - :: SourceSpan - -> [(Text, SourceType)] - -> Qualified (ProperName 'ClassName) - -> [SourceType] - -> SourceType -srcInstanceType ss vars className tys - = setAnnForType (ss, []) - . flip (foldr $ \(tv, k) ty -> srcForAll TypeVarInvisible tv (Just k) ty Nothing) vars - . flip (foldl' srcTypeApp) tys - $ srcTypeConstructor $ coerceProperName <$> className + go acc (ConstrainedType _ con ty) = go (con : acc) ty + go acc ty = (reverse acc, ty) + +{- | Construct the type of an instance declaration from its parts. Used in +error messages describing unnamed instances. +-} +srcInstanceType :: + SourceSpan -> + [(Text, SourceType)] -> + Qualified (ProperName 'ClassName) -> + [SourceType] -> + SourceType +srcInstanceType ss vars className tys = + setAnnForType (ss, []) + . flip (foldr $ \(tv, k) ty -> srcForAll TypeVarInvisible tv k ty Nothing) vars + . flip (foldl' srcTypeApp) tys + $ srcTypeConstructor + $ coerceProperName <$> className everywhereOnTypes :: (Type a -> Type a) -> Type a -> Type a -everywhereOnTypes f = go where - go (TypeApp ann t1 t2) = f (TypeApp ann (go t1) (go t2)) - go (KindApp ann t1 t2) = f (KindApp ann (go t1) (go t2)) - go (ForAll ann vis arg mbK ty sco) = f (ForAll ann vis arg (go <$> mbK) (go ty) sco) - go (ConstrainedType ann c ty) = f (ConstrainedType ann (mapConstraintArgsAll (map go) c) (go ty)) - go (Skolem ann name mbK i sc) = f (Skolem ann name (go <$> mbK) i sc) - go (RCons ann name ty rest) = f (RCons ann name (go ty) (go rest)) - go (KindedType ann ty k) = f (KindedType ann (go ty) (go k)) - go (BinaryNoParensType ann t1 t2 t3) = f (BinaryNoParensType ann (go t1) (go t2) (go t3)) - go (ParensInType ann t) = f (ParensInType ann (go t)) - go other = f other - -everywhereOnTypesM :: Monad m => (Type a -> m (Type a)) -> Type a -> m (Type a) -everywhereOnTypesM f = go where - go (TypeApp ann t1 t2) = (TypeApp ann <$> go t1 <*> go t2) >>= f - go (KindApp ann t1 t2) = (KindApp ann <$> go t1 <*> go t2) >>= f - go (ForAll ann vis arg mbK ty sco) = (ForAll ann vis arg <$> traverse go mbK <*> go ty <*> pure sco) >>= f - go (ConstrainedType ann c ty) = (ConstrainedType ann <$> overConstraintArgsAll (mapM go) c <*> go ty) >>= f - go (Skolem ann name mbK i sc) = (Skolem ann name <$> traverse go mbK <*> pure i <*> pure sc) >>= f - go (RCons ann name ty rest) = (RCons ann name <$> go ty <*> go rest) >>= f - go (KindedType ann ty k) = (KindedType ann <$> go ty <*> go k) >>= f - go (BinaryNoParensType ann t1 t2 t3) = (BinaryNoParensType ann <$> go t1 <*> go t2 <*> go t3) >>= f - go (ParensInType ann t) = (ParensInType ann <$> go t) >>= f - go other = f other - -everywhereOnTypesTopDownM :: Monad m => (Type a -> m (Type a)) -> Type a -> m (Type a) -everywhereOnTypesTopDownM f = go <=< f where - go (TypeApp ann t1 t2) = TypeApp ann <$> (f t1 >>= go) <*> (f t2 >>= go) - go (KindApp ann t1 t2) = KindApp ann <$> (f t1 >>= go) <*> (f t2 >>= go) - go (ForAll ann vis arg mbK ty sco) = ForAll ann vis arg <$> traverse (f >=> go) mbK <*> (f ty >>= go) <*> pure sco - go (ConstrainedType ann c ty) = ConstrainedType ann <$> overConstraintArgsAll (mapM (go <=< f)) c <*> (f ty >>= go) - go (Skolem ann name mbK i sc) = Skolem ann name <$> traverse (f >=> go) mbK <*> pure i <*> pure sc - go (RCons ann name ty rest) = RCons ann name <$> (f ty >>= go) <*> (f rest >>= go) - go (KindedType ann ty k) = KindedType ann <$> (f ty >>= go) <*> (f k >>= go) - go (BinaryNoParensType ann t1 t2 t3) = BinaryNoParensType ann <$> (f t1 >>= go) <*> (f t2 >>= go) <*> (f t3 >>= go) - go (ParensInType ann t) = ParensInType ann <$> (f t >>= go) - go other = pure other +everywhereOnTypes f = go + where + go (TypeApp ann t1 t2) = f (TypeApp ann (go t1) (go t2)) + go (KindApp ann t1 t2) = f (KindApp ann (go t1) (go t2)) + go (ForAll ann vis arg mbK ty sco) = f (ForAll ann vis arg (go mbK) (go ty) sco) + go (ConstrainedType ann c ty) = f (ConstrainedType ann (mapConstraintArgsAll (map go) c) (go ty)) + go (Skolem ann name mbK i sc) = f (Skolem ann name (go mbK) i sc) + go (RCons ann name ty rest) = f (RCons ann name (go ty) (go rest)) + go (KindedType ann ty k) = f (KindedType ann (go ty) (go k)) + go (BinaryNoParensType ann t1 t2 t3) = f (BinaryNoParensType ann (go t1) (go t2) (go t3)) + go (ParensInType ann t) = f (ParensInType ann (go t)) + go other = f other + +everywhereOnTypesM :: (Monad m) => (Type a -> m (Type a)) -> Type a -> m (Type a) +everywhereOnTypesM f = go + where + go (TypeApp ann t1 t2) = (TypeApp ann <$> go t1 <*> go t2) >>= f + go (KindApp ann t1 t2) = (KindApp ann <$> go t1 <*> go t2) >>= f + go (ForAll ann vis arg mbK ty sco) = (ForAll ann vis arg <$> go mbK <*> go ty <*> pure sco) >>= f + go (ConstrainedType ann c ty) = (ConstrainedType ann <$> overConstraintArgsAll (mapM go) c <*> go ty) >>= f + go (Skolem ann name mbK i sc) = (Skolem ann name <$> go mbK <*> pure i <*> pure sc) >>= f + go (RCons ann name ty rest) = (RCons ann name <$> go ty <*> go rest) >>= f + go (KindedType ann ty k) = (KindedType ann <$> go ty <*> go k) >>= f + go (BinaryNoParensType ann t1 t2 t3) = (BinaryNoParensType ann <$> go t1 <*> go t2 <*> go t3) >>= f + go (ParensInType ann t) = (ParensInType ann <$> go t) >>= f + go other = f other + +everywhereOnTypesTopDownM :: (Monad m) => (Type a -> m (Type a)) -> Type a -> m (Type a) +everywhereOnTypesTopDownM f = go <=< f + where + go (TypeApp ann t1 t2) = TypeApp ann <$> (f t1 >>= go) <*> (f t2 >>= go) + go (KindApp ann t1 t2) = KindApp ann <$> (f t1 >>= go) <*> (f t2 >>= go) + go (ForAll ann vis arg mbK ty sco) = ForAll ann vis arg <$> (f >=> go) mbK <*> (f ty >>= go) <*> pure sco + go (ConstrainedType ann c ty) = ConstrainedType ann <$> overConstraintArgsAll (mapM (go <=< f)) c <*> (f ty >>= go) + go (Skolem ann name mbK i sc) = Skolem ann name <$> (f >=> go) mbK <*> pure i <*> pure sc + go (RCons ann name ty rest) = RCons ann name <$> (f ty >>= go) <*> (f rest >>= go) + go (KindedType ann ty k) = KindedType ann <$> (f ty >>= go) <*> (f k >>= go) + go (BinaryNoParensType ann t1 t2 t3) = BinaryNoParensType ann <$> (f t1 >>= go) <*> (f t2 >>= go) <*> (f t3 >>= go) + go (ParensInType ann t) = ParensInType ann <$> (f t >>= go) + go other = pure other everythingOnTypes :: (r -> r -> r) -> (Type a -> r) -> Type a -> r -everythingOnTypes (<+>) f = go where - go t@(TypeApp _ t1 t2) = f t <+> go t1 <+> go t2 - go t@(KindApp _ t1 t2) = f t <+> go t1 <+> go t2 - go t@(ForAll _ _ _ (Just k) ty _) = f t <+> go k <+> go ty - go t@(ForAll _ _ _ _ ty _) = f t <+> go ty - go t@(ConstrainedType _ c ty) = foldl (<+>) (f t) (map go (constraintKindArgs c) ++ map go (constraintArgs c)) <+> go ty - go t@(Skolem _ _ (Just k) _ _) = f t <+> go k - go t@(RCons _ _ ty rest) = f t <+> go ty <+> go rest - go t@(KindedType _ ty k) = f t <+> go ty <+> go k - go t@(BinaryNoParensType _ t1 t2 t3) = f t <+> go t1 <+> go t2 <+> go t3 - go t@(ParensInType _ t1) = f t <+> go t1 - go other = f other +everythingOnTypes (<+>) f = go + where + go t@(TypeApp _ t1 t2) = f t <+> go t1 <+> go t2 + go t@(KindApp _ t1 t2) = f t <+> go t1 <+> go t2 + go t@(ForAll _ _ _ (k) ty _) = f t <+> go k <+> go ty + go t@(ConstrainedType _ c ty) = foldl (<+>) (f t) (map go (constraintKindArgs c) ++ map go (constraintArgs c)) <+> go ty + go t@(Skolem _ _ (k) _ _) = f t <+> go k + go t@(RCons _ _ ty rest) = f t <+> go ty <+> go rest + go t@(KindedType _ ty k) = f t <+> go ty <+> go k + go t@(BinaryNoParensType _ t1 t2 t3) = f t <+> go t1 <+> go t2 <+> go t3 + go t@(ParensInType _ t1) = f t <+> go t1 + go other = f other everythingWithContextOnTypes :: s -> r -> (r -> r -> r) -> (s -> Type a -> (s, r)) -> Type a -> r -everythingWithContextOnTypes s0 r0 (<+>) f = go' s0 where - go' s t = let (s', r) = f s t in r <+> go s' t - go s (TypeApp _ t1 t2) = go' s t1 <+> go' s t2 - go s (KindApp _ t1 t2) = go' s t1 <+> go' s t2 - go s (ForAll _ _ _ (Just k) ty _) = go' s k <+> go' s ty - go s (ForAll _ _ _ _ ty _) = go' s ty - go s (ConstrainedType _ c ty) = foldl (<+>) r0 (map (go' s) (constraintKindArgs c) ++ map (go' s) (constraintArgs c)) <+> go' s ty - go s (Skolem _ _ (Just k) _ _) = go' s k - go s (RCons _ _ ty rest) = go' s ty <+> go' s rest - go s (KindedType _ ty k) = go' s ty <+> go' s k - go s (BinaryNoParensType _ t1 t2 t3) = go' s t1 <+> go' s t2 <+> go' s t3 - go s (ParensInType _ t1) = go' s t1 - go _ _ = r0 +everythingWithContextOnTypes s0 r0 (<+>) f = go' s0 + where + go' s t = let (s', r) = f s t in r <+> go s' t + go s (TypeApp _ t1 t2) = go' s t1 <+> go' s t2 + go s (KindApp _ t1 t2) = go' s t1 <+> go' s t2 + go s (ForAll _ _ _ (k) ty _) = go' s k <+> go' s ty + go s (ConstrainedType _ c ty) = foldl (<+>) r0 (map (go' s) (constraintKindArgs c) ++ map (go' s) (constraintArgs c)) <+> go' s ty + go s (Skolem _ _ (k) _ _) = go' s k + go s (RCons _ _ ty rest) = go' s ty <+> go' s rest + go s (KindedType _ ty k) = go' s ty <+> go' s k + go s (BinaryNoParensType _ t1 t2 t3) = go' s t1 <+> go' s t2 <+> go' s t3 + go s (ParensInType _ t1) = go' s t1 + go _ _ = r0 annForType :: Lens' (Type a) a annForType k (TUnknown a b) = (\z -> TUnknown z b) <$> k a -annForType k (TypeVar a b) = (\z -> TypeVar z b) <$> k a +annForType k (TypeVar a b ki) = (\z -> TypeVar z b ki) <$> k a annForType k (TypeLevelString a b) = (\z -> TypeLevelString z b) <$> k a annForType k (TypeLevelInt a b) = (\z -> TypeLevelInt z b) <$> k a annForType k (TypeWildcard a b) = (\z -> TypeWildcard z b) <$> k a @@ -792,7 +800,7 @@ instance Ord (Type a) where eqType :: Type a -> Type b -> Bool eqType (TUnknown _ a) (TUnknown _ a') = a == a' -eqType (TypeVar _ a) (TypeVar _ a') = a == a' +eqType (TypeVar _ a k) (TypeVar _ a' k') = a == a' && eqType k k' eqType (TypeLevelString _ a) (TypeLevelString _ a') = a == a' eqType (TypeLevelInt _ a) (TypeLevelInt _ a') = a == a' eqType (TypeWildcard _ a) (TypeWildcard _ a') = a == a' @@ -800,9 +808,9 @@ eqType (TypeConstructor _ a) (TypeConstructor _ a') = a == a' eqType (TypeOp _ a) (TypeOp _ a') = a == a' eqType (TypeApp _ a b) (TypeApp _ a' b') = eqType a a' && eqType b b' eqType (KindApp _ a b) (KindApp _ a' b') = eqType a a' && eqType b b' -eqType (ForAll _ _ a b c d) (ForAll _ _ a' b' c' d') = a == a' && eqMaybeType b b' && eqType c c' && d == d' +eqType (ForAll _ _ a b c d) (ForAll _ _ a' b' c' d') = a == a' && eqType b b' && eqType c c' && d == d' eqType (ConstrainedType _ a b) (ConstrainedType _ a' b') = eqConstraint a a' && eqType b b' -eqType (Skolem _ a b c d) (Skolem _ a' b' c' d') = a == a' && eqMaybeType b b' && c == c' && d == d' +eqType (Skolem _ a b c d) (Skolem _ a' b' c' d') = a == a' && eqType b b' && c == c' && d == d' eqType (REmpty _) (REmpty _) = True eqType (RCons _ a b c) (RCons _ a' b' c') = a == a' && eqType b b' && eqType c c' eqType (KindedType _ a b) (KindedType _ a' b') = eqType a a' && eqType b b' @@ -817,7 +825,7 @@ eqMaybeType _ _ = False compareType :: Type a -> Type b -> Ordering compareType (TUnknown _ a) (TUnknown _ a') = compare a a' -compareType (TypeVar _ a) (TypeVar _ a') = compare a a' +compareType (TypeVar _ a k) (TypeVar _ a' k') = compare a a' <> compareType k k' -- is that right? compareType (TypeLevelString _ a) (TypeLevelString _ a') = compare a a' compareType (TypeLevelInt _ a) (TypeLevelInt _ a') = compare a a' compareType (TypeWildcard _ a) (TypeWildcard _ a') = compare a a' @@ -825,9 +833,9 @@ compareType (TypeConstructor _ a) (TypeConstructor _ a') = compare a a' compareType (TypeOp _ a) (TypeOp _ a') = compare a a' compareType (TypeApp _ a b) (TypeApp _ a' b') = compareType a a' <> compareType b b' compareType (KindApp _ a b) (KindApp _ a' b') = compareType a a' <> compareType b b' -compareType (ForAll _ _ a b c d) (ForAll _ _ a' b' c' d') = compare a a' <> compareMaybeType b b' <> compareType c c' <> compare d d' +compareType (ForAll _ _ a b c d) (ForAll _ _ a' b' c' d') = compare a a' <> compareType b b' <> compareType c c' <> compare d d' compareType (ConstrainedType _ a b) (ConstrainedType _ a' b') = compareConstraint a a' <> compareType b b' -compareType (Skolem _ a b c d) (Skolem _ a' b' c' d') = compare a a' <> compareMaybeType b b' <> compare c c' <> compare d d' +compareType (Skolem _ a b c d) (Skolem _ a' b' c' d') = compare a a' <> compareType b b' <> compare c c' <> compare d d' compareType (REmpty _) (REmpty _) = EQ compareType (RCons _ a b c) (RCons _ a' b' c') = compare a a' <> compareType b b' <> compareType c c' compareType (KindedType _ a b) (KindedType _ a' b') = compareType a a' <> compareType b b' @@ -835,25 +843,25 @@ compareType (BinaryNoParensType _ a b c) (BinaryNoParensType _ a' b' c') = compa compareType (ParensInType _ a) (ParensInType _ a') = compareType a a' compareType typ typ' = compare (orderOf typ) (orderOf typ') - where - orderOf :: Type a -> Int - orderOf TUnknown{} = 0 - orderOf TypeVar{} = 1 - orderOf TypeLevelString{} = 2 - orderOf TypeLevelInt{} = 3 - orderOf TypeWildcard{} = 4 - orderOf TypeConstructor{} = 5 - orderOf TypeOp{} = 6 - orderOf TypeApp{} = 7 - orderOf KindApp{} = 8 - orderOf ForAll{} = 9 - orderOf ConstrainedType{} = 10 - orderOf Skolem{} = 11 - orderOf REmpty{} = 12 - orderOf RCons{} = 13 - orderOf KindedType{} = 14 - orderOf BinaryNoParensType{} = 15 - orderOf ParensInType{} = 16 + where + orderOf :: Type a -> Int + orderOf TUnknown {} = 0 + orderOf TypeVar {} = 1 + orderOf TypeLevelString {} = 2 + orderOf TypeLevelInt {} = 3 + orderOf TypeWildcard {} = 4 + orderOf TypeConstructor {} = 5 + orderOf TypeOp {} = 6 + orderOf TypeApp {} = 7 + orderOf KindApp {} = 8 + orderOf ForAll {} = 9 + orderOf ConstrainedType {} = 10 + orderOf Skolem {} = 11 + orderOf REmpty {} = 12 + orderOf RCons {} = 13 + orderOf KindedType {} = 14 + orderOf BinaryNoParensType {} = 15 + orderOf ParensInType {} = 16 compareMaybeType :: Maybe (Type a) -> Maybe (Type b) -> Ordering compareMaybeType (Just a) (Just b) = compareType a b diff --git a/src/Language/Purus/Config.hs b/src/Language/Purus/Config.hs new file mode 100644 index 000000000..a8b937e94 --- /dev/null +++ b/src/Language/Purus/Config.hs @@ -0,0 +1,12 @@ +{- Contains constants that affect compiler behavior. + + At the moment, just contains the max tuple size. In the future, might contain something else! + +-} + +module Language.Purus.Config (maxTupleSize) where + +import Prelude (Int) + +maxTupleSize :: Int +maxTupleSize = 64 diff --git a/src/Language/Purus/Debug.hs b/src/Language/Purus/Debug.hs new file mode 100644 index 000000000..39c812fd2 --- /dev/null +++ b/src/Language/Purus/Debug.hs @@ -0,0 +1,63 @@ +module Language.Purus.Debug where + +import Control.Monad (when) +import Data.Set qualified as S +import Debug.Trace +import Prelude + +{- Debug machinery for everything *after* CoreFn conversion. + +-} + +type TraceCfg = S.Set String + +traceCfg :: TraceCfg +traceCfg = S.fromList ["instantiateApp"] + +doTrace :: forall x. String -> String -> x -> x +doTrace identifier msg x = + if identifier `S.member` traceCfg + then trace prefixed x + else x + where + prefixed = mkMsg identifier msg + +doTraceM :: + forall f. + (Applicative f) => + String -> + String -> + f () +doTraceM identifier msg = + Control.Monad.when (identifier `S.member` traceCfg) $ traceM prefixed + where + prefixed = mkMsg identifier msg + +wrapTraceM :: forall m a. (Monad m) => String -> String -> m a -> m a +wrapTraceM identifier msg act = do + when (identifier `S.member` traceCfg) $ traceM startMsg + res <- act + when (identifier `S.member` traceCfg) $ traceM endMsg + pure res + where + padding = replicate 10 '=' + pad str = padding <> str <> padding + startMsg = pad $ "BEGIN " <> msg + endMsg = pad $ "END " <> msg + +prettify :: [String] -> String +prettify = concatMap (\x -> x <> "\n\n") + +mkMsg :: String -> String -> String +mkMsg header body = + spacer + <> header + <> spacer + <> "\n" + <> body + <> "\n" + <> spacer + <> spacer + <> "\n\n" + where + spacer = replicate 20 '-' diff --git a/src/Language/Purus/Eval.hs b/src/Language/Purus/Eval.hs new file mode 100644 index 000000000..cb8362a1d --- /dev/null +++ b/src/Language/Purus/Eval.hs @@ -0,0 +1,129 @@ +{-# LANGUAGE TypeApplications #-} + +module Language.Purus.Eval ( + compileToUPLC, + evaluateTerm, + -- temporary for GHCI testing. TODO move these to the test suite + passing, +) where + +import Prelude + +import Data.Text (Text) + +import Data.Bifunctor (Bifunctor (first)) + +import Control.Exception (throwIO) + +import Control.Monad (join, void) +import Control.Monad.Reader (Reader, runReader) +import Control.Monad.Trans.Except (ExceptT, runExceptT) + +import Language.Purus.Types (PIRTerm, PLCTerm) + +import PlutusCore ( + getDefTypeCheckConfig, + latestVersion, + runQuoteT, + ) +import PlutusCore qualified as PLC +import PlutusCore.Default ( + DefaultFun, + DefaultUni, + ) +import PlutusCore.Evaluation.Machine.Ck ( + EvaluationResult, + unsafeEvaluateCk, + ) +import PlutusCore.Evaluation.Machine.ExBudgetingDefaults qualified as PLC +import PlutusIR (Name, Program (Program)) +import PlutusIR.Compiler (CompilationCtx, Compiling, compileProgram, compileToReadable, toDefaultCompilationCtx) +import PlutusIR.Compiler.Provenance (Provenance (Original)) +import PlutusIR.Error (Error) + +type PLCProgram uni fun a = PLC.Program PLC.TyName PLC.Name uni fun (Provenance a) + +{- Evaluates a UPLC Program -} +runPLCProgram :: PLCProgram DefaultUni DefaultFun () -> (EvaluationResult PLCTerm, [Text]) +runPLCProgram (PLC.Program _ _ c) = unsafeEvaluateCk PLC.defaultBuiltinsRuntime $ void c + +{- Evaluates a PIR Term -} +evaluateTerm :: PIRTerm -> IO (EvaluationResult (PLC.Term PLC.TyName Name DefaultUni DefaultFun ()), [Text]) +evaluateTerm term = runPLCProgram <$> compileToUPLC term + +{- Compile a PIR Term to a UPLC Program-} +compileToUPLC :: PIRTerm -> IO (PLCProgram DefaultUni DefaultFun ()) +compileToUPLC e = do + let input = Program (Original ()) latestVersion (Original <$> e) + withErrors = either (throwIO . userError) pure + readable <- withErrors . runCompile $ compileToReadable input + withErrors . runCompile $ compileProgram (void readable) + +{- lol -} +runCompile :: + forall e m c b. + ( e ~ Error DefaultUni DefaultFun (Provenance ()) + , c ~ CompilationCtx DefaultUni DefaultFun () + , m ~ ExceptT e (ExceptT e (PLC.QuoteT (Reader c))) + ) => + (Compiling m e DefaultUni DefaultFun ()) => + m b -> + Either String b +runCompile x = + let + res :: Either e b + res = do + plcConfig <- getDefTypeCheckConfig (Original ()) + let ctx = toDefaultCompilationCtx plcConfig + join $ flip runReader ctx $ runQuoteT $ runExceptT $ runExceptT x + in + first show res + +-- temporary list of test cases used to validate compiler behavior +passing :: [Text] +passing = + [ "testTestClass" + , "minus" + , "testEq" + , "workingEven" + , "brokenEven" + , "opt2Int" + , "testOpt2Int" + , "unIdentitee" + , "testIdentitee" + , "testEq2" + , "nestedBinds" + , "anIntLit" + , "aStringLit" + , "aVal" + , "testTuple" + , "testCons" + , "cons" + , "aList" + , "aFunction2" + , "polyInObjMatch" + , "arrForall" + , "testBinders" + , "testBindersCase" + , "testValidator" + , "testasum" + , "aBool" + , "aFunction" + , "aFunction3" + , "testBuiltin" + , "main" + , "plus" + , "testPlus" + , "anObj" + , "objUpdate" + , "polyInObj" + , "aPred" + , "id" + , "testId" + , "objForall" + , "arrForall" + , "testValidatorApplied" + , "guardedCase" + , "litPattern" + , "irrPattern" + ] diff --git a/src/Language/Purus/IR.hs b/src/Language/Purus/IR.hs new file mode 100644 index 000000000..739d7c7f2 --- /dev/null +++ b/src/Language/Purus/IR.hs @@ -0,0 +1,859 @@ +{-# LANGUAGE DeriveAnyClass #-} +{-# LANGUAGE DeriveTraversable #-} +{-# LANGUAGE InstanceSigs #-} +{-# LANGUAGE QuantifiedConstraints #-} +{-# LANGUAGE ScopedTypeVariables #-} +{-# LANGUAGE StandaloneDeriving #-} +{-# LANGUAGE StandaloneKindSignatures #-} +{-# LANGUAGE TemplateHaskell #-} +{-# LANGUAGE TypeApplications #-} +{-# LANGUAGE UndecidableInstances #-} +{-# OPTIONS_GHC -Wno-deferred-out-of-scope-variables #-} +-- has to be here (more or less) +{-# OPTIONS_GHC -Wno-orphans #-} + +module Language.Purus.IR where + +import Prelude + +import Protolude.List (ordNub) + +import Control.Monad (ap, join) +import Data.Bifunctor (Bifunctor (first)) +import Data.Kind qualified as GHC +import Data.List (elemIndex, sortOn) +import Data.Maybe (fromJust, fromMaybe) +import Data.Void (Void) + +import Data.Text (Text) +import Data.Text qualified as T + +import Language.PureScript.Constants.Prim qualified as C +import Language.PureScript.CoreFn.TypeLike ( + TypeLike (..), + instantiateWithArgs, + ) +import Language.PureScript.Names (Ident (..), ProperName (..), ProperNameType (..), Qualified (..), QualifiedBy (..), disqualify, runIdent, runModuleName, showIdent, showQualified) +import Language.PureScript.PSString (PSString, decodeStringWithReplacement, prettyPrintString) +import Language.PureScript.Types ( + SkolemScope, + TypeVarVisibility (..), + genPureName, + ) + +import Language.Purus.Debug (doTrace) +import Language.Purus.Pretty ((<::>)) +import Language.Purus.Pretty.Common (prettyStr) + +import Bound (Bound (..), Scope, Var (..), fromScope) +import Bound.Scope (instantiateEither) + +import Control.Lens.Plated (Plated (..)) +import Control.Lens.TH (makePrisms) + +import Data.Functor.Classes ( + Eq1 (..), + Ord1 (..), + Show1 (liftShowsPrec), + ) + +import Prettyprinter ( + Doc, + Pretty (pretty), + align, + defaultLayoutOptions, + dot, + encloseSep, + group, + hardline, + hsep, + indent, + layoutPretty, + parens, + vcat, + viaShow, + vsep, + (<+>), + ) +import Prettyprinter.Render.Text (renderStrict) + +import Text.Show.Deriving (deriveShow1, makeLiftShowsPrec) + +-- The final representation of types and terms, where all constructions that + +-- * should* have been eliminated in previous steps are impossible + +-- TODO: Make sure we error on exotic kinds + +data Kind + = KindType + | KindArrow Kind Kind + deriving (Show, Eq, Ord) + +data Ty + = TyVar Text Kind + | TyCon (Qualified (ProperName 'TypeName)) + | TyApp Ty Ty + | KApp Ty Ty + | Forall TypeVarVisibility Text Kind Ty (Maybe SkolemScope) + | KType Ty Ty + deriving (Show, Eq, Ord) + +pattern (:~>) :: Ty -> Ty -> Ty +pattern a :~> b = TyApp (TyApp (TyCon C.Function) a) b +infixr 0 :~> + +instance Plated Ty where + plate f = \case + TyVar txt ki -> pure $ TyVar txt ki + TyCon nm -> pure $ TyCon nm + TyApp t1 t2 -> TyApp <$> f t1 <*> f t2 + KApp t1 t2 -> KApp <$> f t1 <*> f t2 + Forall vis var k innerTy scop -> + (\x -> Forall vis var k x scop) + <$> f innerTy + KType t1 t2 -> KType <$> f t1 <*> f t2 + +instance TypeLike Ty where + type KindOf Ty = Kind + applyType = TyApp + + stripQuantifiers = \case + Forall vis var mk inner _ -> first ((vis, var, mk) :) $ stripQuantifiers inner + other -> ([], other) + + funTy a b = a :~> b + + funArgTypes = init . splitFunTyParts + + replaceAllTypeVars = go [] + where + go :: [Text] -> [(Text, Ty)] -> Ty -> Ty + go _ m (TyVar v k) = fromMaybe (TyVar v k) (v `lookup` m) + go bs m (TyApp t1 t2) = TyApp (go bs m t1) (go bs m t2) + go bs m (KApp t1 t2) = KApp (go bs m t1) (go bs m t2) + go bs m (Forall vis v k t sco) + | v `elem` keys = go bs (filter ((/= v) . fst) m) $ Forall vis v k t sco + | (v, k) `elem` usedVars = + let v' = genPureName v (keys ++ bs ++ (fst <$> usedVars)) + t' = go bs [(v, TyVar v' k)] t + in Forall vis v' k (go (v' : bs) m t') sco + | otherwise = Forall vis v k (go (v : bs) m t) sco + where + keys = map fst m + usedVars = concatMap (usedTypeVariables . snd) m + go bs m (KType t k) = KType (go bs m t) (go bs m k) + go _ _ ty = ty + + splitFunTyParts = \case + (a :~> b) -> a : splitFunTyParts b + t -> [t] + + quantify ty = foldr (\(arg, argKind) t -> Forall TypeVarInvisible arg argKind t Nothing) ty $ freeTypeVariables ty + + instantiates var x (TyVar y _) | y == var = Just x + instantiates var (TyApp t1 t2) (TyApp t1' t2') = case instantiates var t1 t1' of + Just x -> Just x + Nothing -> instantiates var t2 t2' + instantiates _ _ _ = Nothing + + freeTypeVariables = ordNub . fmap snd . sortOn fst . go 0 [] + where + -- Tracks kind levels so that variables appearing in kind annotations are listed first. + go :: Int -> [Text] -> Ty -> [(Int, (Text, Kind))] + go lvl bound (TyVar v k) | v `notElem` bound = [(lvl, (v, k))] + go lvl bound (TyApp t1 t2) = go lvl bound t1 ++ go lvl bound t2 + go lvl bound (KApp t1 t2) = go lvl bound t1 ++ go (lvl - 1) bound t2 + go lvl bound (Forall _ v _ t _) = go lvl (v : bound) t + go lvl bound (KType t k) = go lvl bound t ++ go (lvl - 1) bound k + go _ _ _ = [] + + usedTypeVariables = ordNub . go + where + go :: Ty -> [(Text, Kind)] + go (TyVar v k) = [(v, k)] + go (TyApp t1 t2) = go t1 <> go t2 + go (KApp t1 t2) = go t1 <> go t2 + go (KType t1 t2) = go t1 <> go t2 + go (Forall _ _ _ inner _) = go inner + go (TyCon _) = [] + + resultTy t = case snd $ stripQuantifiers t of + (_ :~> b) -> resultTy b + other -> other + + unTyVar = \case + TyVar t k -> Just (t, k) + _ -> Nothing + + instTy t = \case + Forall _ var _k inner _ -> replaceAllTypeVars [(var, t)] inner + other -> other + + unFunction = \case + (a :~> b) -> Just (a, b) + _ -> Nothing + + quantify1 nm kind inner = Forall TypeVarInvisible nm kind inner Nothing + +-- HACK: Need this for pretty printer, refactor later +class FuncType ty where + -- | Get first argument of a function, if function or act as identity otherwise + headArg :: ty -> ty + +instance FuncType Ty where + headArg t = case snd $ stripQuantifiers t of + (a :~> _) -> a + other -> other + +-- A Bound variable. Serves as a bridge between the textual representation and the named de bruijn we'll need for PIR +data BVar ty = BVar Int ty Ident deriving (Show, Eq, Ord) -- maybe BVar Int (FVar ty) ?? + +data FVar ty = FVar ty (Qualified Ident) deriving (Show, Eq, Ord, Functor, Foldable, Traversable) + +type VoidList :: GHC.Type -> GHC.Type -> GHC.Type +type family VoidList voidOrNot argTy where + VoidList Void _x = Void + VoidList _a x = [x] + +data Lit x a + = IntL Integer + | -- | NumL Double + StringL PSString + | CharL Char + | -- | ArrayL [a] + -- | ConstArrayL [Lit x Void] + ObjectL !(XObjectLiteral x) [(PSString, a)] + deriving (Functor, Foldable, Traversable) + +deriving instance (Show a, Show (XObjectLiteral x)) => Show (Lit x a) +deriving instance (Eq a, Eq (XObjectLiteral x)) => Eq (Lit x a) +deriving instance (Ord a, Ord (XObjectLiteral x)) => Ord (Lit x a) + +-- We're switching to a more "Haskell-like" representation (largely to avoid overlapping names) +data Pat x t (f :: GHC.Type -> GHC.Type) a + = VarP Ident Int t -- VarBinder + | WildP -- NullBinder + | LitP (Lit x (Pat x t f a)) -- LiteralBinder + | ConP (Qualified (ProperName 'TypeName)) (Qualified (ProperName 'ConstructorName)) [Pat x t f a] -- CTor binder + deriving (Functor, Foldable, Traversable) + +deriving instance (Show a, Show t, Show (XObjectLiteral x)) => Show (Pat x t f a) +deriving instance (Eq t, Eq a, Eq (XObjectLiteral x)) => Eq (Pat x t f a) +deriving instance (Ord t, Ord a, Ord (XObjectLiteral x)) => Ord (Pat x t f a) + +data Alt x ty f a + = UnguardedAlt (Pat x ty f a) (Scope (BVar ty) f a) + deriving (Functor, Foldable, Traversable) + +deriving instance (Monad f, Show1 f, Show a, Show ty, Show (XObjectLiteral x)) => Show (Alt x ty f a) +deriving instance (Monad f, Eq1 f, Eq a, Eq ty, Eq (XObjectLiteral x)) => Eq (Alt x ty f a) +deriving instance (Monad f, Ord1 f, Ord a, Ord ty, Ord (XObjectLiteral x)) => Ord (Alt x ty f a) + +getPat :: Alt x ty f a -> Pat x ty f a +getPat = \case + UnguardedAlt ps _ -> ps + +-- idk if we really need the identifiers? +data BindE ty (f :: GHC.Type -> GHC.Type) a + = NonRecursive Ident Int (Scope (BVar ty) f a) + | Recursive [((Ident, Int), Scope (BVar ty) f a)] + deriving (Eq, Ord, Show, Functor, Foldable, Traversable) + +type family XAccessor x +type family XObjectUpdate x +type family XObjectLiteral x + +data Exp x ty a + = V a -- let's see if this works + | LitE ty (Lit x (Exp x ty a)) + | LamE (BVar ty) (Scope (BVar ty) (Exp x ty) a) + | AppE (Exp x ty a) (Exp x ty a) + | CaseE ty (Exp x ty a) [Alt x ty (Exp x ty) a] + | LetE [BindE ty (Exp x ty) a] (Scope (BVar ty) (Exp x ty) a) + | AccessorE !(XAccessor x) ty PSString (Exp x ty a) + | ObjectUpdateE !(XObjectUpdate x) ty (Exp x ty a) (Maybe [PSString]) [(PSString, Exp x ty a)] + | TyInstE ty (Exp x ty a) + | TyAbs (BVar (KindOf ty)) (Exp x ty a) + deriving (Functor, Foldable, Traversable) + +deriving instance (Eq ty, Eq a, Eq (KindOf ty), Eq (XAccessor x), Eq (XObjectUpdate x), Eq (XObjectLiteral x)) => Eq (Exp x ty a) + +instance (Eq ty, Eq (KindOf ty)) => Eq1 (Exp x ty) where + {-# INLINEABLE liftEq #-} + liftEq eq = \case + V a -> \case + V b -> eq a b + _ -> False + LitE t1 l1 -> \case + LitE t2 l2 -> t1 == t2 && liftEq (liftEq eq) l1 l2 + _ -> False + LamE n1 e1 -> \case + LamE n2 e2 -> n1 == n2 && liftEq eq e1 e2 + _ -> False + AppE l1 l2 -> \case + AppE r1 r2 -> liftEq eq l1 r1 && liftEq eq l2 r2 + _ -> False + CaseE t1 es1 as1 -> \case + CaseE t2 es2 as2 -> + t1 == t2 + && liftEq eq es1 es2 + && liftEq (liftEq eq) as1 as2 + _ -> False + LetE bs1 e1 -> \case + LetE bs2 e2 -> + liftEq (liftEq eq) bs1 bs2 + && liftEq eq e1 e2 + _ -> False + AccessorE _ t1 s1 e1 -> \case + AccessorE _ t2 s2 e2 -> + t1 == t2 + && s1 == s2 + && liftEq eq e1 e2 + _ -> False + ObjectUpdateE _ t1 e1 ms1 upd1 -> \case + ObjectUpdateE _ t2 e2 ms2 upd2 -> + t1 == t2 + && liftEq eq e1 e2 + && ms1 == ms2 + && liftEq (\(s1, e1') (s2, e2') -> s1 == s2 && liftEq eq e1' e2') upd1 upd2 + _ -> False + TyInstE t1 e1 -> \case + TyInstE t2 e2 -> t1 == t2 && liftEq eq e1 e2 + _ -> False + TyAbs bv1 e1 -> \case + TyAbs bv2 e2 -> bv1 == bv2 && liftEq eq e1 e2 + _ -> False + +instance (Ord ty, Ord (KindOf ty)) => Ord1 (Exp x ty) where + {-# INLINEABLE liftCompare #-} + liftCompare comp = \case + V x -> \case + V y -> comp x y + _ -> LT + LitE t lit -> \case + V _ -> GT + LitE t' lit' -> compare t t' <> liftCompare (liftCompare comp) lit lit' + _ -> LT + LamE bvar scope -> \case + V _ -> GT + LitE _ _ -> GT + LamE bvar' scope' -> compare bvar bvar' <> liftCompare comp scope scope' + _ -> LT + AppE exp1 exp2 -> \case + V _ -> GT + LitE _ _ -> GT + LamE _ _ -> GT + AppE exp1' exp2' -> liftCompare comp exp1 exp1' <> liftCompare comp exp2 exp2' + _ -> LT + CaseE t exp1 cases -> \case + V _ -> GT + LitE _ _ -> GT + LamE _ _ -> GT + AppE _ _ -> GT + CaseE t' exp' cases' -> + compare t t' + <> liftCompare comp exp1 exp' + <> liftCompare (liftCompare comp) cases cases' + _ -> LT + LetE bindApps scope -> \case + V _ -> GT + LitE _ _ -> GT + LamE _ _ -> GT + AppE _ _ -> GT + CaseE _ _ _ -> GT + LetE bindApps' scope' -> + liftCompare (liftCompare comp) bindApps bindApps' + <> liftCompare comp scope scope' + _ -> LT + AccessorE _ t str exp1 -> \case + V _ -> GT + LitE _ _ -> GT + LamE _ _ -> GT + AppE _ _ -> GT + CaseE _ _ _ -> GT + LetE _ _ -> GT + AccessorE _ t' str' exp' -> + compare t t' + <> compare str str' + <> liftCompare comp exp1 exp' + _ -> LT + ObjectUpdateE _ t exp1 mStr updates -> \case + V _ -> GT + LitE _ _ -> GT + LamE _ _ -> GT + AppE _ _ -> GT + CaseE _ _ _ -> GT + LetE _ _ -> GT + AccessorE _ _ _ _ -> GT + ObjectUpdateE _ t' exp' mStr' updates' -> + compare t t' + <> liftCompare comp exp1 exp' + <> compare mStr mStr' + <> liftCompare (\(s, e) (s', e') -> compare s s' <> liftCompare comp e e') updates updates' + _ -> LT + TyInstE t exp1 -> \case + V _ -> GT + LitE _ _ -> GT + LamE _ _ -> GT + AppE _ _ -> GT + CaseE _ _ _ -> GT + LetE _ _ -> GT + AccessorE _ _ _ _ -> GT + ObjectUpdateE _ _ _ _ _ -> GT + TyInstE t' exp' -> + compare t t' + <> liftCompare comp exp1 exp' + _ -> LT + TyAbs bvar exp1 -> \case + TyAbs bvar' exp' -> + compare bvar bvar' + <> liftCompare comp exp1 exp' + _ -> GT + +instance Eq1 (Lit x) where + {-# INLINEABLE liftEq #-} + liftEq eq = \case + IntL i1 -> \case + IntL i2 -> i1 == i2 + _ -> False + StringL i1 -> \case + StringL i2 -> i1 == i2 + _ -> False + CharL i1 -> \case + CharL i2 -> i1 == i2 + _ -> False + ObjectL _ fs1 -> \case + ObjectL _ fs2 -> liftEq (liftEq eq) fs1 fs2 + _ -> False + +instance Ord1 (Lit x) where + {-# INLINEABLE liftCompare #-} + liftCompare comp = \case + IntL i -> \case + IntL i' -> compare i i' + _ -> LT + StringL str -> \case + IntL _ -> GT + StringL str' -> compare str str' + _ -> LT + CharL c -> \case + IntL _ -> GT + StringL _ -> GT + CharL c' -> compare c c' + _ -> LT + ObjectL _ fields -> \case + ObjectL _ fields' -> liftCompare (liftCompare comp) fields fields' + _ -> GT + +instance (Eq1 f, Monad f, Eq t) => Eq1 (Pat x t f) where + liftEq _ (VarP i1 n1 t1) (VarP i2 n2 t2) = i1 == i2 && n1 == n2 && t1 == t2 + liftEq _ WildP WildP = True + liftEq eq (ConP tn1 cn1 ps1) (ConP tn2 cn2 ps2) = tn1 == tn2 && cn1 == cn2 && liftEq (liftEq eq) ps1 ps2 + liftEq eq (LitP l1) (LitP l2) = liftEq (liftEq eq) l1 l2 + liftEq _ _ _ = False + +instance (Ord1 f, Monad f, Ord t) => Ord1 (Pat x t f) where + {-# INLINEABLE liftCompare #-} + liftCompare comp = \case + VarP i1 n1 t1 -> \case + VarP i2 n2 t2 -> + compare i1 i2 + <> compare n1 n2 + <> compare t1 t2 + _ -> LT + WildP -> \case + VarP _ _ _ -> GT + WildP -> EQ + _ -> LT + LitP l1 -> \case + VarP _ _ _ -> GT + WildP -> GT + LitP l2 -> liftCompare (liftCompare comp) l1 l2 + _ -> LT + ConP tn1 cn1 ps1 -> \case + ConP tn2 cn2 ps2 -> + compare tn1 tn2 + <> compare cn1 cn2 + <> liftCompare (liftCompare comp) ps1 ps2 + _ -> GT + +instance (Eq1 f, Monad f, Eq ty) => Eq1 (BindE ty f) where + liftEq eq (NonRecursive i1 ix1 b1) (NonRecursive i2 ix2 b2) = ix1 == ix2 && i1 == i2 && liftEq eq b1 b2 + liftEq eq (Recursive xs) (Recursive ys) = go eq xs ys + where + go :: + forall a b. + (a -> b -> Bool) -> + [((Ident, Int), Scope (BVar ty) f a)] -> + [((Ident, Int), Scope (BVar ty) f b)] -> + Bool + go f ((i1, x) : xss) ((i2, y) : yss) = i1 == i2 && liftEq f x y && go f xss yss + go _ [] [] = True + go _ _ _ = False + liftEq _ _ _ = False + +instance (Ord1 f, Monad f, Ord ty) => Ord1 (BindE ty f) where + {-# INLINEABLE liftCompare #-} + liftCompare comp = \case + NonRecursive i1 ix1 b1 -> \case + NonRecursive i2 ix2 b2 -> + compare i1 i2 + <> compare ix1 ix2 + <> liftCompare comp b1 b2 + _ -> LT + Recursive xs -> \case + NonRecursive _ _ _ -> GT + Recursive ys -> go comp xs ys + where + go :: + forall a b. + (a -> b -> Ordering) -> + [((Ident, Int), Scope (BVar ty) f a)] -> + [((Ident, Int), Scope (BVar ty) f b)] -> + Ordering + go comp' = \case + [] -> \case + [] -> EQ + _ -> LT + ((i1, x) : xs') -> \case + [] -> GT + ((i2, y) : ys) -> + compare i1 i2 + <> liftCompare comp' x y + <> go comp' xs' ys + +instance (Eq1 f, Monad f, Eq ty) => Eq1 (Alt x ty f) where + liftEq eq (UnguardedAlt ps1 e1) (UnguardedAlt ps2 e2) = liftEq eq ps1 ps2 && liftEq eq e1 e2 + +instance (Ord1 f, Monad f, Ord ty) => Ord1 (Alt x ty f) where + {-# INLINEABLE liftCompare #-} + liftCompare comp (UnguardedAlt ps1 e1) (UnguardedAlt ps2 e2) = + liftCompare comp ps1 ps2 + <> liftCompare comp e1 e2 + +instance Applicative (Exp x ty) where + pure = V + (<*>) = ap + +instance Monad (Exp x ty) where + return = pure + V a >>= f = f a + AppE e1 e2 >>= f = AppE (e1 >>= f) (e2 >>= f) + LamE i e >>= f = LamE i (e >>>= f) + LetE bs e >>= f = LetE (map (>>>= f) bs) (e >>>= f) + CaseE t es alts >>= f = CaseE t (es >>= f) (map (>>>= f) alts) + LitE t lit >>= f = LitE t $ goLit lit + where + goLit = \case + IntL i -> IntL i + -- NumL d -> NumL d + StringL str -> StringL str + CharL c -> CharL c + -- ArrayL xs -> ArrayL $ map (\x -> x >>= f) xs + -- ConstArrayL lits -> ConstArrayL lits + ObjectL ext obj -> ObjectL ext $ map (\(field, x) -> (field, x >>= f)) obj + TyInstE t e >>= f = TyInstE t (e >>= f) + TyAbs bv e >>= f = TyAbs bv (e >>= f) + AccessorE ext ty field expr >>= f = AccessorE ext ty field (expr >>= f) + ObjectUpdateE ext ty expr toCopy toUpdate >>= f = + ObjectUpdateE ext ty (expr >>= f) toCopy (map (\(field, x) -> (field, x >>= f)) toUpdate) + +instance Bound (Pat x t) where + VarP i n t >>>= _ = VarP i n t + WildP >>>= _ = WildP + ConP tn cn p >>>= f = ConP tn cn (map (>>>= f) p) + LitP litP >>>= f = LitP (goLit litP) + where + goLit = \case + IntL i -> IntL i + -- NumL d -> NumL d + StringL str -> StringL str + CharL c -> CharL c + -- ConstArrayL lits -> ConstArrayL lits + -- ArrayL xs -> ArrayL $ map (\x -> x >>>= f) xs + ObjectL ext obj -> ObjectL ext $ map (\(field, x) -> (field, x >>>= f)) obj + +instance Bound (Alt x ty) where + UnguardedAlt ps e >>>= f = UnguardedAlt (ps >>>= f) (e >>>= f) + +instance Bound (BindE ty) where + NonRecursive i ix e >>>= f = NonRecursive i ix $ e >>>= f + Recursive xs >>>= f = Recursive $ go f xs + where + go :: + forall a f c. + (Monad f) => + (a -> f c) -> + [((Ident, Int), Scope (BVar ty) f a)] -> + [((Ident, Int), Scope (BVar ty) f c)] + go _ [] = [] + go g ((i, e) : rest) = + let e' = e >>>= g + rest' = go g rest + in (i, e') : rest' + +instance (Pretty ty) => Pretty (BVar ty) where + pretty (BVar n t i) = + align . parens $ + pretty (showIdent i) <> "#" <> pretty n <+> "::" <+> pretty t + +instance (Pretty ty) => Pretty (FVar ty) where + pretty (FVar _t i) = + align . parens $ + pretty (showQualified showIdent i) <+> "::" <+> pretty _t + +instance Pretty Kind where + pretty = \case + KindType -> "*" + KindArrow k1 k2 -> parens (pretty k1 <+> "->" <+> pretty k2) +instance Pretty Ty where + pretty = \case + TyVar t k -> parens (pretty t <::> pretty k) + TyCon (Qualified qb tn) -> case qb of + ByModuleName mn -> + let mn' = runModuleName mn + tn' = runProperName tn + in pretty mn' <> "." <> pretty tn' + _ -> pretty (runProperName tn) + TyApp t1 t2 -> goTypeApp t1 t2 + KApp t1 t2 -> pretty t1 <> ("@" <> pretty t2) + Forall vis var mk inner _ -> case stripQuantifiers inner of + (quantified, inner') -> goForall ((vis, var, mk) : quantified) inner' + KType ty kind -> parens $ pretty ty <> " :: " <> pretty kind + where + goTypeApp :: forall ann. Ty -> Ty -> Doc ann + goTypeApp (TyApp f a) b + | f == TyCon C.Function = + let a' = pretty a + b' = pretty b + in parens $ hsep [a' <+> "->", b'] + | otherwise = + let f' = goTypeApp f a + b' = pretty b + in parens $ f' <+> b' + goTypeApp a b = hsep [pretty a, parens $ pretty b] + + goForall :: [(TypeVarVisibility, Text, Kind)] -> Ty -> Doc ann + goForall xs inner = + let boundVars = hsep $ renderBoundVar <$> xs + inner' = pretty inner + in "forall" <+> boundVars <> "." <+> inner' + where + renderBoundVar :: (TypeVarVisibility, Text, Kind) -> Doc ann + renderBoundVar (_, var, mk) = parens (pretty var <+> "::" <+> pretty mk) + +bvType :: BVar ty -> ty +bvType (BVar _ t _) = t + +instance (Pretty a, Pretty ty, Pretty (KindOf ty), TypeLike ty) => Pretty (Exp x ty a) where + pretty = \case + V x -> pretty x + LitE ty lit -> parens $ pretty lit <+> "::" <+> pretty ty + LamE bv body' -> + let unscoped = fromScope body' + in group . align $ + "\\" + <> align (pretty bv) + <+> "->" + <> hardline + <> indent 4 (pretty unscoped) + appE@(AppE _ _) -> case unsafeAnalyzeApp appE of + (fun, args) -> + let applied = group . align . vsep $ pretty fun : fmap (indent 2 . ("#" <+>) . pretty) args + in group . align $ applied + CaseE _ es alts -> + let scrutinees = pretty es + branches = group . pretty <$> alts + in "case" + <+> scrutinees + <+> "of" + <+> hardline + <+> indent 2 (vcat branches) + LetE bound e -> + let unscopedE = fromScope e + in align $ + vcat + [ "let" + , indent 2 . align . vcat $ pretty <$> bound + , "in" <+> align (pretty unscopedE) + ] + AccessorE _ _ field expr -> parens (pretty expr) <> dot <> pretty field + ObjectUpdateE _ _ _ _ _ -> "TODO: Implement ObjectUpdateE printer" + TyInstE t e -> vsep [pretty e, "@" <> parens (pretty t)] + TyAbs bv e -> + "/\\" + <+> align (pretty bv) + <+> "->" + <> hardline + <> indent 4 (pretty e) + +instance (Pretty a, Pretty ty, Pretty (KindOf ty), TypeLike ty) => Pretty (Alt x ty (Exp x ty) a) where + pretty = \case + UnguardedAlt ps body -> + pretty ps + <+> "->" + <> hardline + <> indent 2 (pretty $ fromScope body) + +instance (Pretty b, Pretty a) => Pretty (Var b a) where + pretty = \case + B b -> pretty b + F a -> pretty a + +instance (Pretty a) => Pretty (Lit x a) where + pretty = \case + IntL i -> pretty i + -- NumL d -> pretty d + StringL pss -> pretty . T.unpack $ prettyPrintString pss + CharL c -> viaShow . show $ c + -- ConstArrayL xs -> list $ pretty <$> xs + -- ArrayL xs -> list $ pretty <$> xs + ObjectL _ obj -> + encloseSep + "{" + "}" + ", " + (map (\(field, expr) -> pretty (T.pack $ decodeStringWithReplacement field) <> ":" <+> pretty expr) obj) + +instance (Pretty a, Pretty t) => Pretty (Pat x t (Exp x ty) a) where + pretty = \case + VarP i n t -> pretty (runIdent i) <> pretty n <> "@" <> parens (pretty t) + WildP -> "_" + LitP lit -> case lit of + IntL i -> pretty i + -- NumL d -> pretty d + StringL pss -> pretty . T.unpack $ prettyPrintString pss + CharL c -> viaShow . show $ c + -- ConstArrayL xs -> list $ pretty <$> xs + -- ArrayL xs -> list $ pretty <$> xs + ObjectL _ _obj -> "TODO: Implement ObjectL pattern printer" + ConP _ cn ps -> pretty (runProperName . disqualify $ cn) <+> hsep (pretty <$> ps) + +instance (Pretty a, Pretty (KindOf ty), Pretty ty, TypeLike ty, Pretty (Exp x ty a)) => Pretty (BindE ty (Exp x ty) a) where + pretty = \case + NonRecursive i ix e -> let e' = fromScope e in pretty (runIdent i) <> "#" <> pretty ix <+> "=" <+> pretty e' + Recursive es -> + let go ((ident, ix), expr) = + let expr' = fromScope expr + in pretty (runIdent ident) <> "#" <> pretty ix <+> "=" <+> pretty expr' + in align . vcat $ go <$> es + +ppExp :: (Pretty a, Pretty ty, Pretty (KindOf ty), TypeLike ty) => Exp x ty a -> String +ppExp = T.unpack . renderStrict . layoutPretty defaultLayoutOptions . pretty + +ppTy :: Ty -> String +ppTy = T.unpack . renderStrict . layoutPretty defaultLayoutOptions . pretty + +unsafeAnalyzeApp :: forall x a ty. Exp x ty a -> (Exp x ty a, [Exp x ty a]) +unsafeAnalyzeApp = fromJust . analyzeApp + +analyzeApp :: forall x a ty. Exp x ty a -> Maybe (Exp x ty a, [Exp x ty a]) +analyzeApp e = (,appArgs e) <$> appFun e + where + appArgs :: Exp x ty a -> [Exp x ty a] + appArgs (AppE t1 t2) = appArgs t1 <> [t2] + appArgs _ = [] + + appFun :: Exp x ty a -> Maybe (Exp x ty a) + appFun (AppE t1 _) = go t1 + where + go (AppE tx _) = case appFun tx of + Nothing -> Just tx + Just tx' -> Just tx' + go other = Just other + appFun _ = Nothing + +expTy :: forall x t a. (TypeLike t, Pretty t) => (a -> Var (BVar t) (FVar t)) -> Exp x t a -> t +expTy f = \case + V x -> case f x of + B (BVar _ t _) -> t + F (FVar t _) -> t + LitE t _ -> t + LamE (BVar _ t _) body -> t `funTy` expTy' f body + AppE e1 e2 -> appType f e1 e2 + CaseE t _ _ -> t + LetE _ e -> expTy' f e + AccessorE _ t _ _ -> t + ObjectUpdateE _ t _ _ _ -> t + TyInstE t e -> instTy t $ expTy f e + TyAbs (BVar _ k idnt) inner -> quantify1 (runIdent idnt) k (expTy f inner) + +expTy' :: forall x t a. (TypeLike t, Pretty t) => (a -> Var (BVar t) (FVar t)) -> Scope (BVar t) (Exp x t) a -> t +expTy' f scoped = case instantiateEither (either (V . B) (V . F)) scoped of + V x -> case x >>= f of + B (BVar _ t _) -> t + F (FVar t _) -> t + LitE t _ -> t + LamE (BVar _ t _) body -> + let body' = join <$> fmap f <$> body + in t `funTy` expTy' id body' + AppE e1 e2 -> appType (>>= f) e1 e2 + CaseE t _ _ -> t + LetE _ e -> expTy' (>>= f) e + AccessorE _ t _ _ -> t + ObjectUpdateE _ t _ _ _ -> t + TyAbs (BVar _ k idnt) inner -> + let e' = join <$> fmap f <$> inner + innerT = expTy id e' + in quantify1 (runIdent idnt) k innerT + TyInstE t e -> + let e' = join <$> fmap f <$> e + in instTy t (expTy id e') + +{- | Gets the type of an application expression. + (Name might be a bit confusing, does not apply types) +-} +appType :: forall x t a. (TypeLike t, Pretty t) => (a -> Var (BVar t) (FVar t)) -> Exp x t a -> Exp x t a -> t +appType h fe ae = doTrace "appType" msg result + where + errmsg = + ( "\nINPUT FUN:\n" + <> prettyStr (expTy h fe) + <> "\n\nINPUT ARGS:\n" + <> prettyStr (expTy h ae) + ) + + msg = errmsg <> "\n\nRESULT\n: " <> prettyStr result + + foldr1Trace f xs + | null xs = error $ "appType\n\n" <> errmsg + | otherwise = foldr1 f xs + + result = case unsafeAnalyzeApp (AppE fe ae) of + (fe', ae') -> + quantify + . foldr1Trace funTy + . drop (length ae') + . splitFunTyParts + . snd + . stripQuantifiers + $ instantiateWithArgs (expTy h fe') (expTy h <$> ae') + +$(deriveShow1 ''BindE) + +instance (Show (XObjectLiteral x)) => Show1 (Lit x) where + liftShowsPrec = $(makeLiftShowsPrec ''Lit) + +instance (Show (XObjectLiteral x), Show t) => Show1 (Pat x t f) where + liftShowsPrec = $(makeLiftShowsPrec ''Pat) + +instance (Show ty, Show (KindOf ty), Show (XAccessor x), Show (XObjectUpdate x), Show (XObjectLiteral x)) => Show1 (Exp x ty) where + liftShowsPrec = $(makeLiftShowsPrec ''Exp) + +-- TH cannot derive it because `f` is used in last and second last field and some machinery doesn't like that +instance (Show ty, Show (KindOf ty), Show (XAccessor x), Show (XObjectUpdate x), Show (XObjectLiteral x)) => Show1 (Alt x ty (Exp x ty)) where + liftShowsPrec sp sl d (UnguardedAlt ps e) = + showString "UnGuardedAlt " + . showString " " + . showsPrec d (liftShowsPrec sp sl d ps "") + . showString " " + . liftShowsPrec sp sl d e + +deriving instance (Show a, Show (KindOf ty), Show ty, Show1 (Exp x ty), Show (XAccessor x), Show (XObjectUpdate x), Show (XObjectLiteral x)) => Show (Exp x ty a) + +makePrisms ''Ty +makePrisms ''Exp + +abstractMany :: (Eq ty) => [FVar ty] -> FVar ty -> Maybe (BVar ty) +abstractMany xs v@(FVar t i) = (\index -> BVar index t $ disqualify i) <$> elemIndex v xs diff --git a/src/Language/Purus/IR/Utils.hs b/src/Language/Purus/IR/Utils.hs new file mode 100644 index 000000000..1edd3da23 --- /dev/null +++ b/src/Language/Purus/IR/Utils.hs @@ -0,0 +1,494 @@ +{-# LANGUAGE StarIsType #-} +{-# OPTIONS_GHC -Wno-orphans #-} +{-# OPTIONS_GHC -Wno-unrecognised-pragmas #-} + +{-# HLINT ignore "Use camelCase" #-} +module Language.Purus.IR.Utils ( + WithObjects, + WithoutObjects, + IR_Decl, + Vars, + asExp, + viaExp, + viaExpM, + toExp, + fromExp, + deepMapMaybeBound, + transformTypesInExp, + containsBVar, + traverseBind, + mapBind, + foldBinds, + flatBinds, + allDeclIdentifiers, + traverseAlt, + mapAlt, + isBuiltinE, + isBuiltin, + isConstructorE, + isConstructor, + mkBVar, + unBVar, + allBoundVars, + stripSkolems, + stripSkolemsFromExpr, +) where + +import Prelude + +import Bound (Scope, Var (..), abstract, fromScope) +import Control.Monad (join) +import Data.Void (Void) +import Language.PureScript.CoreFn.Expr (PurusType) +import Language.PureScript.CoreFn.TypeLike (TypeLike (KindOf)) +import Language.PureScript.Names ( + Ident (Ident), + ModuleName (ModuleName), + Qualified (..), + QualifiedBy (ByModuleName), + ) +import Language.Purus.IR ( + Alt (..), + BVar (..), + BindE (..), + Exp (..), + FVar (..), + Lit (CharL, IntL, ObjectL, StringL), + Pat (ConP, LitP, VarP), + XAccessor, + XObjectLiteral, + XObjectUpdate, + ) +import Prettyprinter (Pretty) + +import Data.Set (Set) +import Data.Set qualified as S + +import Data.Map (Map) +import Data.Map qualified as M + +import Data.Text qualified as T + +import Data.Maybe (fromMaybe, mapMaybe) + +import Data.Char (isUpper) + +import Data.Functor.Identity (Identity (..)) + +import Control.Lens.Operators ((^..)) +import Control.Lens.Plated (Plated (..), cosmos, transform) +import Data.Foldable (foldl') +import Language.PureScript.AST.SourcePos (SourceAnn) +import Language.PureScript.Types (Constraint (..), SourceType, Type (..)) + +{- Convenience/Utility Type Stuff -} + +data WithObjects + +type instance XAccessor WithObjects = () +type instance XObjectUpdate WithObjects = () +type instance XObjectLiteral WithObjects = () + +data WithoutObjects + +type instance XAccessor WithoutObjects = Void +type instance XObjectUpdate WithoutObjects = Void +type instance XObjectLiteral WithoutObjects = Void + +type IR_Decl = BindE PurusType (Exp WithObjects PurusType) (Vars PurusType) + +type Vars t = Var (BVar t) (FVar t) + +{- + ********************* + Exp/Scope Utilities + ********************* +-} + +-- Scope helpers +asExp :: + forall x t r. + Scope (BVar t) (Exp x t) (Vars t) -> + (Exp x t (Vars t) -> r) -> + r +asExp e f = f . fmap join . fromScope $ e + +viaExp :: + forall x t. + (Exp x t (Vars t) -> Exp x t (Vars t)) -> + Scope (BVar t) (Exp x t) (Vars t) -> + Scope (BVar t) (Exp x t) (Vars t) +viaExp f scoped = + abstract (\case B bv -> Just bv; _ -> Nothing) + . f + . fmap join + . fromScope + $ scoped + +viaExpM :: + forall x t m. + (Monad m) => + (Exp x t (Vars t) -> m (Exp x t (Vars t))) -> + Scope (BVar t) (Exp x t) (Vars t) -> + m (Scope (BVar t) (Exp x t) (Vars t)) +viaExpM f scoped = do + let unscoped = toExp scoped + transformed <- f unscoped + pure $ abstract (\case B bv -> Just bv; _ -> Nothing) transformed + +-- stupid, but `\e -> toExp e`` is probably the most duplicated code phrase +-- in this whole project +toExp :: Scope (BVar t) (Exp x t) (Vars t) -> Exp x t (Vars t) +toExp = fmap join . fromScope + +fromExp :: Exp x t (Vars t) -> Scope (BVar t) (Exp x t) (Vars t) +fromExp = abstract $ \case B bv -> Just bv; _ -> Nothing + +{- | Does not touch Var *binders*. + + This is primarily useful for updating identifiers or indices of BVar *expressions* + when "moving expressions around" the AST, e.g. in lifting. + + A typical use case is: You've extracted an expression from a context where some variables in + the expression are bound in that context, but free in the new context, and you need to bind them + in the new context. To maintain uniqueness (of names or indices), it is necessary to rename/reindex + (or conceivably retype, typically by renaming tyvars) the previously bound vars *wherever* + they occur in the extracted expression. + + Note that this passes over the `BVar (KindOf t)` that lives inside a `TyAbs`, i.e., this is for transforming + *term-level* bound vars +-} +deepMapMaybeBound :: + forall x t. + (TypeLike t, Pretty t, Pretty (KindOf t), Show (Exp x t (Vars t))) => + (BVar t -> Maybe (BVar t)) -> + Exp x t (Vars t) -> + Exp x t (Vars t) +deepMapMaybeBound _f = \case + V (B bv) -> V . B . f $ bv + V (F fv) -> V . F $ fv + AppE e1 e2 -> AppE (go e1) (go e2) + LamE bv body -> LamE bv $ goScope body + LetE bs e -> + let bs' = mapBind (const goScope) <$> bs + e' = goScope e + in LetE bs' e' + LitE t lit -> LitE t $ go <$> lit + AccessorE x t str e -> AccessorE x t str $ go e + ObjectUpdateE x t e copy fs -> + let e' = go e + fs' = fmap go <$> fs + in ObjectUpdateE x t e' copy fs' + TyInstE t e -> TyInstE t (go e) + TyAbs tv e -> TyAbs tv $ go e + CaseE t scrut alts -> + let scrut' = go scrut + alts' = mapAlt goScope <$> alts + in CaseE t scrut' alts' + where + goScope = + abstract (\case B bv -> Just $ f bv; _ -> Nothing) + . go + . fmap join + . fromScope + go = deepMapMaybeBound _f + f bv = fromMaybe bv (_f bv) + +-- touches everything, *except* the kind annotations in TyAbs (can't write a generic traversal b/c (KindOf t ~ t) is +-- only true for SourceType and not Ty) +transformTypesInExp :: + forall x t. + (t -> t) -> + Exp x t (Vars t) -> + Exp x t (Vars t) +transformTypesInExp f = \case + V (B bv) -> V . B . goBV $ bv + V (F (FVar fvTy fvNm)) -> V . F $ FVar (f fvTy) fvNm + AppE e1 e2 -> AppE (go e1) (go e2) + LitE t lit -> LitE (f t) (go <$> lit) + LamE bv body -> + let bv' = goBV bv + body' = goScope body + in LamE bv' body' + LetE bs body -> + let bs' = mapBind (const goScope) <$> bs + body' = goScope body + in LetE bs' body' + AccessorE x t str e -> + let t' = f t + e' = go e + in AccessorE x t' str e' + ObjectUpdateE x t e copy fs -> + let t' = f t + e' = go e + fs' = fmap go <$> fs + in ObjectUpdateE x t' e' copy fs' + CaseE t scrut alts -> + let t' = f t + scrut' = go scrut + alts' = goAlt <$> alts + in CaseE t' scrut' alts' + TyInstE t e -> TyInstE (f t) (go e) + TyAbs btv e -> TyAbs btv (go e) + where + -- can't use mapAlt b/c we need to update types in patterns + -- (We still have object lit pats before object desugaring) + goAlt :: Alt x t (Exp x t) (Vars t) -> Alt x t (Exp x t) (Vars t) + goAlt (UnguardedAlt pat body) = + let pat' = goPat pat + body' = goScope body + in UnguardedAlt pat' body' + + goPat :: Pat x t (Exp x t) (Vars t) -> Pat x t (Exp x t) (Vars t) + goPat = \case + VarP nm indx t -> VarP nm indx (f t) + LitP (ObjectL x fs) -> LitP . ObjectL x $ fmap goPat <$> fs + ConP tn cn ps -> ConP tn cn $ goPat <$> ps + other -> other + + goBV :: BVar t -> BVar t + goBV (BVar bvIx bvTy bvNm) = BVar bvIx (f bvTy) bvNm + + goScope :: Scope (BVar t) (Exp x t) (Vars t) -> Scope (BVar t) (Exp x t) (Vars t) + goScope = viaExp go + + go = transformTypesInExp f + +containsBVar :: Ident -> Int -> Scope (BVar t) (Exp x t) (Vars t) -> Bool +containsBVar idnt indx expr = + any + ( \case + V (B (BVar bvix _ bvident)) -> bvix == indx && idnt == bvident + _ -> False + ) + subExpressions + where + subExpressions = toExp expr ^.. cosmos + +{- + ********************* + BindE Utilities + ********************* +-} + +traverseBind :: + forall (f :: * -> *) x t. + (Applicative f) => + ( (Ident, Int) -> + Scope (BVar t) (Exp x t) (Vars t) -> + f (Scope (BVar t) (Exp x t) (Vars t)) + ) -> + BindE t (Exp x t) (Vars t) -> + f (BindE t (Exp x t) (Vars t)) +traverseBind f = \case + NonRecursive nm i b -> curry goNonRec nm i b + Recursive xs -> Recursive <$> traverse (\(nm, body) -> (nm,) <$> f nm body) xs + where + goNonRec i@(nm, indx) body = NonRecursive nm indx <$> f i body + +mapBind :: + forall x t. + ( (Ident, Int) -> + Scope (BVar t) (Exp x t) (Vars t) -> + Scope (BVar t) (Exp x t) (Vars t) + ) -> + BindE t (Exp x t) (Vars t) -> + BindE t (Exp x t) (Vars t) +mapBind f = runIdentity . traverseBind (\a b -> pure $ f a b) + +-- it's a foldl' if that ever matters +foldBinds :: + forall x t r. + ( r -> + (Ident, Int) -> + Scope (BVar t) (Exp x t) (Vars t) -> + r + ) -> + r -> + [BindE t (Exp x t) (Vars t)] -> + r +foldBinds _ e [] = e +foldBinds f e (x : xs) = case x of + NonRecursive nm i b -> foldBinds f (f e (nm, i) b) xs + Recursive recBinds -> + let e' = foldl' (\acc (nm, b) -> f acc nm b) e recBinds + in foldBinds f e' xs + +flatBinds :: [BindE t (Exp x t) (Vars t)] -> Map (Ident, Int) (Scope (BVar t) (Exp x t) (Vars t)) +flatBinds = foldBinds (\acc nm scoped -> M.insert nm scoped acc) M.empty + +-- N.B. we're using Set instead of [] mainly to ensure that everything has the same order +allDeclIdentifiers :: forall x t. (Ord t) => [BindE t (Exp x t) (Vars t)] -> Set (Ident, Int) +allDeclIdentifiers [] = S.empty +allDeclIdentifiers (b : rest) = case b of + NonRecursive nm indx _ -> S.insert (nm, indx) $ allDeclIdentifiers rest + Recursive xs -> + let rest' = allDeclIdentifiers rest + in foldl' (\acc ((nm, indx), _) -> S.insert (nm, indx) acc) rest' xs + +{- + ********************* + Alt Utilities + ********************* +-} + +traverseAlt :: + forall (f :: * -> *) x t. + (Functor f) => + (Scope (BVar t) (Exp x t) (Vars t) -> f (Scope (BVar t) (Exp x t) (Vars t))) -> + Alt x t (Exp x t) (Vars t) -> + f (Alt x t (Exp x t) (Vars t)) +traverseAlt f (UnguardedAlt pat body) = UnguardedAlt pat <$> f body + +mapAlt :: + forall x t. + (Scope (BVar t) (Exp x t) (Vars t) -> Scope (BVar t) (Exp x t) (Vars t)) -> + Alt x t (Exp x t) (Vars t) -> + Alt x t (Exp x t) (Vars t) +mapAlt f alt = runIdentity . traverseAlt (pure . f) $ alt + +{- + ********************* + Misc Utilities (Predicates/Var manipulation/etc) + ********************* +-} + +isBuiltinE :: Exp x ty1 (Var b (FVar ty2)) -> Bool +isBuiltinE = \case + V (F (FVar _ qi)) -> isBuiltin qi + TyInstE _ e -> isBuiltinE e + _ -> False + +isBuiltin :: Qualified a -> Bool +isBuiltin (Qualified (ByModuleName (ModuleName "Builtin")) _) = True +isBuiltin _ = False + +isConstructorE :: Exp x ty1 (Var b (FVar ty2)) -> Bool +isConstructorE = \case + V (F (FVar _ qi)) -> isConstructor qi + TyInstE _ e -> isConstructorE e + _ -> False + +-- After the recent changes, constructors *can't* be inlined, i.e., they must remain +-- free until the final PIR compilation stage +isConstructor :: Qualified Ident -> Bool +isConstructor (Qualified _ (Ident nm)) = isUpper (T.head nm) +isConstructor _ = False + +mkBVar :: Ident -> Int -> t -> BVar t +mkBVar idnt indx ty = BVar indx ty idnt + +unBVar :: BVar t -> (Ident, Int) +unBVar (BVar indx _ idnt) = (idnt, indx) + +allBoundVars :: forall x t. (Ord t) => Exp x t (Vars t) -> [BVar t] +allBoundVars e = S.toList . S.fromList $ flip mapMaybe everything $ \case + V (B bv) -> Just bv + _ -> Nothing + where + everything = e ^.. cosmos + +{- Remove skolems from *types* by stripping their index and turning the remaining ident into a TyVar +-} +stripSkolems :: PurusType -> PurusType +stripSkolems = transform $ \case + Skolem a nm ki _ _ -> TypeVar a nm ki + other -> other + +{- Strip skolems from *all type annotations in an expression* +-} +stripSkolemsFromExpr :: Exp x PurusType (Vars PurusType) -> Exp x PurusType (Vars PurusType) +stripSkolemsFromExpr = transformTypesInExp stripSkolems + +{- + ********************* + Orphan instances + ********************* +-} + +instance Plated SourceType where + plate f = \case + tu@(TUnknown _ _) -> pure tu + tv@(TypeVar _ _ _) -> pure tv + tstr@(TypeLevelString _ _) -> pure tstr + tint@(TypeLevelInt _ _) -> pure tint + twild@(TypeWildcard _ _) -> pure twild + tcon@(TypeConstructor _ _) -> pure tcon + top@(TypeOp _ _) -> pure top + TypeApp a t1 t2 -> TypeApp a <$> f t1 <*> f t2 + KindApp a t1 t2 -> KindApp a <$> f t1 <*> f t2 + ForAll a vis var mk innerTy scop -> + (\mk' innerTy' -> ForAll a vis var mk' innerTy' scop) + <$> f mk + <*> f innerTy + ConstrainedType a constraint t -> ConstrainedType a <$> goConstraint f constraint <*> f t + Skolem a txt mk i scop -> (\mk' -> Skolem a txt mk' i scop) <$> f mk + REmpty a -> pure $ REmpty a + RCons a l x xs -> RCons a l <$> f x <*> f xs + KindedType a t1 t2 -> KindedType a <$> f t1 <*> f t2 + BinaryNoParensType a t1 t2 t3 -> BinaryNoParensType a <$> f t1 <*> f t2 <*> f t3 + ParensInType a t -> ParensInType a <$> f t + where + goConstraint :: + forall f. + (Applicative f) => + (SourceType -> f SourceType) -> + Constraint SourceAnn -> + f (Constraint SourceAnn) + goConstraint g (Constraint a cn kargs args cdata) = + (\kargs' args' -> Constraint a cn kargs' args' cdata) + <$> traverse g kargs + <*> traverse g args + +{- Useful for transform/rewrite/cosmos/etc -} +instance Plated (Exp x t (Vars t)) where + plate = go + where + go :: + forall f. + (Applicative f) => + (Exp x t (Vars t) -> f (Exp x t (Vars t))) -> + Exp x t (Vars t) -> + f (Exp x t (Vars t)) + go tfun = \case + LamE bv e -> LamE bv <$> scopeHelper e + CaseE t es alts -> + let goAlt :: Alt x t (Exp x t) (Vars t) -> f (Alt x t (Exp x t) (Vars t)) + goAlt (UnguardedAlt pats scoped) = + UnguardedAlt pats <$> scopeHelper scoped + in CaseE t <$> tfun es <*> traverse goAlt alts + LetE decls scoped -> + let goDecls :: BindE t (Exp x t) (Vars t) -> f (BindE t (Exp x t) (Vars t)) + goDecls = \case + NonRecursive ident bvix expr -> + NonRecursive ident bvix <$> scopeHelper expr + Recursive xs -> + Recursive <$> traverse (\(i, x) -> (i,) <$> scopeHelper x) xs + in LetE <$> traverse goDecls decls <*> scopeHelper scoped + AppE e1 e2 -> AppE <$> tfun e1 <*> tfun e2 + AccessorE x t pss e -> AccessorE x t pss <$> tfun e + ObjectUpdateE x t e cf fs -> + (\e' fs' -> ObjectUpdateE x t e' cf fs') + <$> tfun e + <*> traverse (\(nm, expr) -> (nm,) <$> tfun expr) fs + LitE t lit -> LitE t <$> traverseLit lit + V a -> pure (V a) + TyAbs bv e -> TyAbs bv <$> tfun e + TyInstE t e -> TyInstE t <$> tfun e + where + scopeHelper :: + Scope (BVar t) (Exp x t) (Vars t) -> + f (Scope (BVar t) (Exp x t) (Vars t)) + scopeHelper scoped = + let unscoped = toExp scoped + effed = tfun unscoped + abstr = abstract $ \case + B bv -> Just bv + _ -> Nothing + in abstr <$> effed + + traverseLit = \case + IntL i -> pure $ IntL i + StringL str -> pure $ StringL str + CharL char -> pure $ CharL char + ObjectL x fs -> ObjectL x <$> traverse (\(str, e) -> (str,) <$> tfun e) fs diff --git a/src/Language/Purus/Make.hs b/src/Language/Purus/Make.hs new file mode 100644 index 000000000..fb85b67f9 --- /dev/null +++ b/src/Language/Purus/Make.hs @@ -0,0 +1,228 @@ +module Language.Purus.Make where + +import Prelude + +import Control.Exception (throwIO) + +import Data.Text (Text) +import Data.Text qualified as T + +import Data.Map qualified as M +import Data.Set qualified as S + +import Data.Function (on) + +import Data.Foldable (foldrM) +import Data.List (delete, foldl', groupBy, sortBy, stripPrefix) + +import System.FilePath ( + makeRelative, + takeDirectory, + takeExtensions, + (), + ) + +import Language.PureScript.CoreFn.Ann (Ann) +import Language.PureScript.CoreFn.Expr (Bind, PurusType) +import Language.PureScript.CoreFn.Module (Module (..)) +import Language.PureScript.Names ( + Ident (Ident), + ModuleName (..), + runIdent, + runModuleName, + ) + +import Language.Purus.Eval +import Language.Purus.IR.Utils (IR_Decl, foldBinds) +import Language.Purus.Pipeline.CompileToPIR (compileToPIR) +import Language.Purus.Pipeline.DesugarCore (desugarCoreModule) +import Language.Purus.Pipeline.DesugarObjects ( + desugarObjects, + desugarObjectsInDatatypes, + ) +import Language.Purus.Pipeline.EliminateCases (eliminateCases) +import Language.Purus.Pipeline.GenerateDatatypes ( + generateDatatypes, + ) +import Language.Purus.Pipeline.Inline (inline) +import Language.Purus.Pipeline.Instantiate (applyPolyRowArgs, instantiateTypes) +import Language.Purus.Pipeline.Lift (lift) +import Language.Purus.Pipeline.Monad ( + CounterT (runCounterT), + DesugarCore, + globalScope, + runCounter, + runDesugarCore, + runInline, + runPlutusContext, + ) +import Language.Purus.Pretty.Common (prettyStr) +import Language.Purus.Prim.Data (primDataPS) +import Language.Purus.Types (PIRTerm, PLCTerm, initDatatypeDict) +import Language.Purus.Utils ( + decodeModuleIO, + findDeclBodyWithIndex, + ) + +import Control.Monad.Except (MonadError (throwError)) +import Control.Monad.State (evalStateT) + +import Control.Lens (At (at)) +import Control.Lens.Combinators (folded) +import Control.Lens.Operators ((^?)) + +import Algebra.Graph.AdjacencyMap (stars) +import Algebra.Graph.AdjacencyMap.Algorithm (topSort) + +import System.FilePath.Glob qualified as Glob + +import PlutusCore.Evaluation.Result (EvaluationResult) + +-- import Debug.Trace (traceM) +-- import PlutusIR.Core.Instance.Pretty.Readable (prettyPirReadable) + +{- Compiles a main function to PIR, given its module name, dependencies, and a + Prim module that will be compiled before anything else. (This is kind of a hack-ey shim + to let us write e.g. serialization functions and provide them by default without a + more sophisticated build system). +-} +compile :: + Module (Bind Ann) PurusType PurusType Ann -> -- The Prim Module, or, if there isn't one, the first module to be compiles + [Module (Bind Ann) PurusType PurusType Ann] -> -- The rest of the modules, sorted in dependency order (e.g. so Main comes last) + ModuleName -> -- Name of the module with the main function (will probably be hardcoded to "Main") + Ident -> -- Name of the main function (will probably be hardcoded to "main") + Either String PIRTerm +compile primModule orderedModules mainModuleName mainFunctionName = + evalStateT (runCounterT go) 0 + where + desugarCoreModules :: + Module (Bind Ann) PurusType PurusType Ann -> + [Module (Bind Ann) PurusType PurusType Ann] -> + DesugarCore (Module IR_Decl PurusType PurusType Ann) + desugarCoreModules prim rest = do + desugaredPrim <- desugarCoreModule primDataPS mempty prim + loop desugaredPrim rest + where + loop here [] = pure here + loop here (r : rs) = do + let hereDatatypes = moduleDataTypes here + hereDecls = moduleDecls here + r' <- desugarCoreModule hereDatatypes hereDecls r + loop r' rs + go :: CounterT (Either String) PIRTerm + go = do + (summedModule, dsCxt) <- runDesugarCore $ desugarCoreModules primModule orderedModules + let + -- traceBracket lbl msg = traceM ("\n" <> lbl <> "\n\n" <> msg <> "\n\n") + decls = moduleDecls summedModule + declIdentsSet = foldBinds (\acc nm _ -> S.insert nm acc) S.empty decls + couldn'tFindMain n = + "Error: Could not find a main function with the name (" + <> show (n :: Int) + <> ") '" + <> T.unpack (runIdent mainFunctionName) + <> "' in module " + <> T.unpack (runModuleName mainModuleName) + <> "\nin declarations:\n" + <> prettyStr (S.toList declIdentsSet) + mainFunctionIx <- note (couldn'tFindMain 1) $ dsCxt ^? globalScope . at mainModuleName . folded . at mainFunctionName . folded + -- traceM $ "Found main function Index: " <> show mainFunctionIx + mainFunctionBody <- note (couldn'tFindMain 2) $ findDeclBodyWithIndex mainFunctionName mainFunctionIx decls + -- traceM "Found main function body" + inlined <- runInline summedModule $ lift (mainFunctionName, mainFunctionIx) mainFunctionBody >>= inline + -- traceBracket "Done inlining. Result:" $ prettyStr inlined + let !instantiated = applyPolyRowArgs $ instantiateTypes inlined + -- traceBracket "Done instantiating types. Result:" $ prettyStr instantiated + withoutObjects <- instantiateTypes <$> runCounter (desugarObjects instantiated) + -- traceBracket "Desugared objects. Result:\n" $ prettyStr withoutObjects + datatypes <- runCounter $ desugarObjectsInDatatypes (moduleDataTypes summedModule) + -- traceM "Desugared datatypes" + runPlutusContext initDatatypeDict $ do + generateDatatypes datatypes + -- traceM "Generated PIR datatypes" + withoutCases <- eliminateCases datatypes withoutObjects + -- traceM "Eliminated case expressions. Compiling to PIR..." + compileToPIR datatypes withoutCases + +-- traceM . docString $ prettyPirReadable pirTerm + +modulesInDependencyOrder :: [[FilePath]] -> IO [Module (Bind Ann) PurusType PurusType Ann] +modulesInDependencyOrder (concat -> paths) = do + modules <- traverse decodeModuleIO paths + let modMap = foldl' (\acc m@Module {..} -> M.insert moduleName m acc) M.empty modules + depGraph = stars . M.toList $ M.mapWithKey (\n m -> delete n . fmap snd $ moduleImports m) modMap + case reverse <$> topSort depGraph of + Left cyc -> throwIO . userError $ "Error: Cycles detected in module graph: " <> show cyc + Right ordered -> do + -- we ignore Builtin and Prim deps (b/c we add those later ourselves) + let canResolve :: ModuleName -> Bool + canResolve (ModuleName mn) = mn /= "Prim" && mn /= "Builtin" + foldrM + ( \mn acc -> + if not (canResolve mn) + then pure acc + else case modMap ^? at mn . folded of + Nothing -> throwIO . userError $ "Error: Module '" <> T.unpack (runModuleName mn) <> "' is required for compilation but could not be found" + Just mdl -> pure $ mdl : acc + ) + [] + ordered + +getFilesToCompile :: FilePath -> IO [[FilePath]] +getFilesToCompile targdir = do + getFiles targdir <$> testGlob targdir + where + -- A glob for all purs and js files within a test directory + testGlob :: FilePath -> IO [FilePath] + testGlob = Glob.globDir1 (Glob.compile "**/*.cfn") + -- Groups the test files so that a top-level file can have dependencies in a + -- subdirectory of the same name. The inner tuple contains a list of the + -- .purs files and the .js files for the test case. + getFiles :: FilePath -> [FilePath] -> [[FilePath]] + getFiles baseDir = + map (filter ((== ".cfn") . takeExtensions) . map (baseDir )) + . groupBy ((==) `on` extractPrefix) + . sortBy (compare `on` extractPrefix) + . map (makeRelative baseDir) + -- Extracts the filename part of a .purs file, or if the file is in a + -- subdirectory, the first part of that directory path. + extractPrefix :: FilePath -> FilePath + extractPrefix fp = + let dir = takeDirectory fp + ext = reverse ".cfn" + in if dir == "." + then maybe fp reverse $ stripPrefix ext $ reverse fp + else dir + +make :: + FilePath -> -- Path to the directory containing the modules to be compiled + Text -> -- Name of the Main module (we'll default to Main in production but its nice to configure for testing) + Text -> -- Name of the `main` function we're compiling + Maybe (Module (Bind Ann) PurusType PurusType Ann) -> -- Optional prim module to compile first. Should be required but we don't *have* it yet so atm can't be + IO PIRTerm +make path mainModule mainFunction primModule = do + ordered <- getFilesToCompile path >>= modulesInDependencyOrder + case (primModule, ordered) of + (Just prim, toCompile) -> + either (throwIO . userError) pure $ compile prim toCompile (ModuleName mainModule) (Ident mainFunction) + -- if we don't have a prim module we treat the first module in compilation order as prim + -- (need to do this for development/testing) + (Nothing, m : ms) -> either (throwIO . userError) pure $ compile m ms (ModuleName mainModule) (Ident mainFunction) + _ -> throwIO . userError $ "Error: No modules found for compilation" + +-- for exploration/repl testing, this hardcodes `tests/purus/passing/Lib` as the target directory and +-- we only select the name of the main function +makeForTest :: Text -> IO PIRTerm +makeForTest main = make "tests/purus/passing/Misc" "Lib" main Nothing + +evalForTest_ :: Text -> IO () +evalForTest_ main = evalForTest main >>= print + +evalForTest :: Text -> IO (EvaluationResult PLCTerm, [Text]) +evalForTest main = makeForTest main >>= evaluateTerm + +-- TODO put this somewhere else +note :: (MonadError String m) => String -> Maybe a -> m a +note msg = \case + Nothing -> throwError msg + Just x -> pure x diff --git a/src/Language/Purus/Make/Prim.hs b/src/Language/Purus/Make/Prim.hs new file mode 100644 index 000000000..66909ed7d --- /dev/null +++ b/src/Language/Purus/Make/Prim.hs @@ -0,0 +1,116 @@ +module Language.Purus.Make.Prim where + +import Prelude + +import Control.Exception (throwIO) + +import Data.Text (Text) +import Data.Text qualified as T + +import Data.Map qualified as M +import Data.Set qualified as S + +import Data.Function (on) + +import Data.Foldable (foldrM) +import Data.List (delete, foldl', groupBy, sortBy, stripPrefix) + +import System.FilePath ( + makeRelative, + takeDirectory, + takeExtensions, + (), + ) + +import Language.PureScript.CoreFn.Ann (Ann) +import Language.PureScript.CoreFn.Expr (Bind, PurusType) +import Language.PureScript.CoreFn.Module +import Language.PureScript.Names ( + Ident (Ident), + ModuleName (..), + runIdent, + runModuleName, + ) +import Language.PureScript.Types (SourceType) + +import Language.Purus.Eval +import Language.Purus.IR.Utils (IR_Decl, foldBinds) +import Language.Purus.Pipeline.CompileToPIR (compileToPIR) +import Language.Purus.Pipeline.DesugarCore (desugarCoreModule) +import Language.Purus.Pipeline.DesugarObjects ( + desugarObjects, + desugarObjectsInDatatypes, + ) +import Language.Purus.Pipeline.EliminateCases (eliminateCases) +import Language.Purus.Pipeline.GenerateDatatypes ( + generateDatatypes, + ) +import Language.Purus.Pipeline.Inline (inline) +import Language.Purus.Pipeline.Instantiate (applyPolyRowArgs, instantiateTypes) +import Language.Purus.Pipeline.Lift (lift) +import Language.Purus.Pipeline.Monad ( + CounterT (runCounterT), + DesugarCore, + globalScope, + runCounter, + runDesugarCore, + runInline, + runPlutusContext, + ) +import Language.Purus.Pretty.Common (prettyStr) +import Language.Purus.Prim.Data (primDataPS) +import Language.Purus.Types (PIRTerm, PLCTerm, initDatatypeDict) +import Language.Purus.Utils ( + decodeModuleIO, + findDeclBodyWithIndex, + ) + +import Control.Monad.Except (MonadError (throwError)) +import Control.Monad.State (evalStateT) + +import Control.Lens (At (at)) +import Control.Lens.Combinators (folded) +import Control.Lens.Operators ((^?)) + +{- You know, maybe it'd be better to do this *after* CoreFn desugaring? + +synthesizeModule :: FilePath -- path to the .cfn CoreFn JSON module + {- Optional datatype declarations to shim here. We expect these + to already have the Module Name provided as an argument here + -} + -> Datatypes SourceType SourceType + -> ModuleName -- the *new* name for the module, e.g. Prim. See [NOTE 1] + -> IO (Module (Bind Ann) PurusType PurusType Ann) +synthesizeModule path datatypes newName = do + old <- decodeModuleIO path + let renamed = renameEverything old + newDataTypes = datatypes <> moduleDataTypes renamed + pure $ renamed {moduleDataTypes = newDataTypes} + where + renameEverything :: Module (Bind Ann) PurusType PurusType Ann + -> Module (Bind Ann) PurusType PurusType Ann + renameEverything (Module srcSpan comments _oldName _path imports exports reExports mForeign decls mDatatypes) + = Module + (renameSrcSpan srcSpan) + (renameComments comments) + newName + path + (renameImports imports) + exports + (renameReExports reExports) + mForeign + (renameDecls decls) + +-} + +{- +[NOTE 1] + + This function renames every Qualified Ident/TypeName/ProperName/etc everywhere in the module such that + it has the new name provided as an argument. + + At the moment, it has to be Builtin or Prim if we want to use it as an imported-by-default or always-available + module, because only those are properly supported in Language.PureScript.Sugar.Names.Env, though in principle we could have as many + prim modules as we like. + +-} diff --git a/src/Language/Purus/Pipeline/CompileToPIR.hs b/src/Language/Purus/Pipeline/CompileToPIR.hs new file mode 100644 index 000000000..3e1518ff2 --- /dev/null +++ b/src/Language/Purus/Pipeline/CompileToPIR.hs @@ -0,0 +1,196 @@ +{-# LANGUAGE AllowAmbiguousTypes #-} +{-# LANGUAGE GADTs #-} +{-# LANGUAGE PartialTypeSignatures #-} +{-# LANGUAGE PolyKinds #-} +{-# LANGUAGE ScopedTypeVariables #-} + +module Language.Purus.Pipeline.CompileToPIR (compileToPIR) where + +import Prelude + +import Data.List.NonEmpty qualified as NE +import Data.Map qualified as M +import Data.Text qualified as T + +import Control.Monad ( + foldM, + ) +import Control.Monad.Except (MonadError (..)) +import Data.Bifunctor (Bifunctor (..)) + +import Language.PureScript.Constants.PLC (defaultFunMap) +import Language.PureScript.Constants.Prim qualified as C +import Language.PureScript.CoreFn.FromJSON () +import Language.PureScript.CoreFn.Module ( + Datatypes, + ) +import Language.PureScript.CoreFn.TypeLike (TypeLike (..)) +import Language.PureScript.Names ( + Ident (..), + Qualified (..), + QualifiedBy (ByModuleName), + runIdent, + ) +import Language.PureScript.PSString (prettyPrintString) + +import Language.Purus.Debug (doTraceM, prettify) +import Language.Purus.IR ( + BVar (..), + BindE (..), + Exp (..), + FVar (..), + Lit (CharL, IntL, StringL), + Ty, + expTy, + expTy', + ) +import Language.Purus.IR qualified as IR +import Language.Purus.IR.Utils (Vars, WithoutObjects, toExp) +import Language.Purus.Pipeline.GenerateDatatypes ( + mkKind, + toPIRType, + ) +import Language.Purus.Pipeline.GenerateDatatypes.Utils ( + bindTV, + getConstructorName, + ) +import Language.Purus.Pipeline.Monad (PlutusContext) +import Language.Purus.Pretty.Common (prettyStr) +import Language.Purus.Types (PIRTerm, pirDatatypes) +import PlutusCore.Default ( + DefaultFun, + DefaultUni, + ) + +import PlutusCore (Unique (..)) +import PlutusCore qualified as PLC +import PlutusIR (Binding (TermBind), Name (Name), Strictness (..), Term (Builtin), VarDecl (VarDecl)) +import PlutusIR qualified as PIR +import PlutusIR.MkPir (mkConstant) + +import Bound (Var (..)) +import Control.Lens (view) +import Language.Purus.Pipeline.CompileToPIR.Utils (builtinSubstitutions) + +type PIRTermBind = Binding PLC.TyName Name DefaultUni DefaultFun () + +pattern Unit :: FVar t +pattern Unit <- FVar _ (Qualified (ByModuleName C.M_Prim) (Ident "unit")) + +compileToPIR :: + Datatypes IR.Kind Ty -> + Exp WithoutObjects Ty (Vars Ty) -> + PlutusContext PIRTerm +compileToPIR _datatypes _exp = do + resBody <- compileToPIR' _datatypes _exp + datatypes <- view pirDatatypes + let binds = NE.fromList $ map (PIR.DatatypeBind ()) . M.elems $ datatypes + msg = + prettify + [ "INPUT:\n" <> prettyStr _exp + , "OUTPUT (BODY):\n" <> prettyStr resBody + ] + doTraceM "compileToPIR" msg + pure $ PIR.Let () PIR.Rec binds resBody + +compileToPIR' :: + Datatypes IR.Kind Ty -> + Exp WithoutObjects Ty (Vars Ty) -> + PlutusContext PIRTerm +compileToPIR' datatypes _exp = + doTraceM "compileToPIR'" (prettyStr _exp) >> case _exp of + V x -> case x of + F Unit -> pure $ mkConstant () () + F (FVar _ ident@(Qualified _ (runIdent -> nm))) -> + case M.lookup (T.unpack nm) defaultFunMap of + Just aBuiltinFun -> case M.lookup aBuiltinFun builtinSubstitutions of + Nothing -> pure $ Builtin () aBuiltinFun + Just substBuiltin -> substBuiltin + Nothing -> do + getConstructorName ident >>= \case + Just aCtorNm -> pure $ PIR.Var () aCtorNm + Nothing -> + throwError $ + T.unpack nm + <> " isn't a builtin, and it shouldn't be possible to have a" + <> " free variable that's anything but a builtin. Please " + <> "report this bug to the Purus authors. " + B (BVar bvix _ (runIdent -> nm)) -> pure $ PIR.Var () (Name nm $ Unique bvix) + LitE _ lit -> compileToPIRLit lit + lam@(LamE (BVar bvIx bvT bvNm) body) -> do + let lty = funTy bvT (expTy' id body) + ty' <- toPIRType bvT + let nm = Name (runIdent bvNm) $ Unique bvIx + body' = toExp body + body'' <- compileToPIR' datatypes body' + let result = PIR.LamAbs () nm ty' body'' + msg = + "BVar:\n" + <> prettyStr bvNm + <> "\n\nInput Lam:\n" + <> prettyStr lam + <> "\n\nInferred Lam Ty:\n" + <> prettyStr lty + <> "\n\nRESULT: " + <> prettyStr result + doTraceM "compileToPIRLamTy" msg + pure result + AppE e1 e2 -> do + e1' <- compileToPIR' datatypes e1 + e2' <- compileToPIR' datatypes e2 + pure $ PIR.Apply () e1' e2' + LetE binds body -> do + boundTerms <- foldM convertBind [] binds + body' <- compileToPIR' datatypes $ toExp body + case NE.nonEmpty boundTerms of + -- REVIEW: For simplicity we assume here that all let bindings are mutually recursive. + -- This might not be great for performance (depends on what the PIR compiler does) + Just boundTerms' -> pure $ PIR.Let () PIR.Rec boundTerms' body' + Nothing -> error "empty bindings" + ce@CaseE {} -> error $ "Case expressions should be eliminated by now, but found:\n\n" <> prettyStr ce + TyInstE t e -> do + t' <- toPIRType t + e' <- compileToPIR' datatypes e + pure $ PIR.TyInst () e' t' + TyAbs (BVar bvIx bvT bvNm) e -> do + let bvKind = mkKind bvT + bvNmTxt = runIdent bvNm + tNm = PIR.TyName $ PIR.Name (runIdent bvNm) (Unique bvIx) + bindTV bvNmTxt tNm + e' <- compileToPIR' datatypes e + pure $ PIR.TyAbs () tNm bvKind e' + where + convertBind :: + [PIRTermBind] -> + BindE Ty (Exp WithoutObjects Ty) (Vars Ty) -> + PlutusContext [PIRTermBind] + convertBind acc = \case + NonRecursive ident bvix expr -> do + let unscoped = toExp expr + nonRec <- goBind (ident, bvix) unscoped + pure $ nonRec : acc + Recursive xs -> do + xs' <- traverse (uncurry goBind . second toExp) xs + pure $ xs' <> acc + where + goBind :: (Ident, Int) -> Exp WithoutObjects Ty (Var (BVar Ty) (FVar Ty)) -> PlutusContext PIRTermBind + goBind (ident, i) expr = do + let nm = Name (runIdent ident) $ Unique i + ty <- toPIRType (expTy id expr) + expr' <- compileToPIR' datatypes expr + -- REVIEW: Not sure if this should always be strict? + pure $ TermBind () Strict (VarDecl () nm ty) expr' + + compileToPIRLit :: + Lit WithoutObjects (Exp WithoutObjects Ty (Vars Ty)) -> + PlutusContext PIRTerm + compileToPIRLit = \case + IntL i -> pure $ mkConstant () i + StringL str -> + pure $ mkConstant () $ prettyPrintString str + CharL c -> + pure + . mkConstant () + . toInteger + . fromEnum + $ c diff --git a/src/Language/Purus/Pipeline/CompileToPIR/Utils.hs b/src/Language/Purus/Pipeline/CompileToPIR/Utils.hs new file mode 100644 index 000000000..2cceb0660 --- /dev/null +++ b/src/Language/Purus/Pipeline/CompileToPIR/Utils.hs @@ -0,0 +1,240 @@ +{- Contains utilities for PIR CodeGen, mainly helper functions which run in the PlutusContext + Monad to perform tasks that require access to the datatype context or counter. +-} +{-# LANGUAGE GADTs #-} + +module Language.Purus.Pipeline.CompileToPIR.Utils (builtinSubstitutions) where + +import Prelude + +import Data.Map (Map) +import Data.Map qualified as M + +import Language.Purus.IR (Ty (..)) +import Language.Purus.Pipeline.GenerateDatatypes (toPIRType) +import Language.Purus.Pipeline.GenerateDatatypes.Utils ( + freshName, + getConstructorName, + getDestructorTy, + note, + ) +import Language.Purus.Pipeline.Monad (PlutusContext) +import Language.Purus.Types (PIRTerm, PIRType) + +import Language.Purus.Prim.Utils (properToIdent) +import PlutusCore qualified as PLC +import PlutusIR ( + Type (TyBuiltin), + ) +import PlutusIR qualified as PIR +import PlutusIR.MkPir (mkConstant) + +import Language.PureScript.Constants.Prim qualified as C +import Language.PureScript.Constants.Purus qualified as C + +{- + PIR Constants, Term Builders, Helpers, Etc +-} + +tyBuiltinBool :: PIRType +tyBuiltinBool = PLC.TyBuiltin () (PLC.SomeTypeIn PLC.DefaultUniBool) + +{- Mainly used for type abstraction/instantiation, it should be the "smallest" thing we can use (or close to it) -} +unit :: PIRType +unit = PLC.TyBuiltin () (PLC.SomeTypeIn PLC.DefaultUniUnit) + +unitTerm :: PIRTerm +unitTerm = mkConstant () () + +{- A la plutarch, helper for writing the other functions in this module-} +(#) :: PIRTerm -> PIRTerm -> PIRTerm +e1 # e2 = PIR.Apply () e1 e2 + +-- I think this is the right fixity? TODO: Check plutarch +infixl 9 # + +-- :: con bool -> Boolean +pirBoolToBoolean :: PIRTerm -> PlutusContext PIRTerm +pirBoolToBoolean conBoolTerm = do + tyConBool <- toPIRType tyBool + trueNm <- note "True not defined" =<< getConstructorName (properToIdent <$> C.C_True) + falseNm <- note "False not defined" =<< getConstructorName (properToIdent <$> C.C_False) + let true = PIR.Var () trueNm + false = PIR.Var () falseNm + pirIfThen tyConBool conBoolTerm true false + +-- Boolean -> con bool +pirBooleanToBool :: PIRTerm -> PlutusContext PIRTerm +pirBooleanToBool psBool = do + boolDctor <- PIR.Var () <$> getDestructorTy C.Boolean + pure $ PIR.TyInst () (boolDctor # psBool # mkConstant () True # mkConstant () False) tyBuiltinBool + +{- This is *NOT* the thing that we desugar `Builtin.IfThenElse` to. This is a *lazy* if-then-else + (using TyAbs/TyInst to emulate force/delay since PIR lacks force/delay). You have to pass in the + return type. +-} +pirIfThen :: PIRType -> PIRTerm -> PIRTerm -> PIRTerm -> PlutusContext PIRTerm +pirIfThen resTy cond troo fawlse = do + troo' <- pirDelay troo + fawlse' <- pirDelay fawlse + pure . pirForce $ pirTyInst (PIR.TyFun () unit resTy) (PIR.Builtin () PLC.IfThenElse) # cond # troo' # fawlse' + +{- A utility for constructing LamAbs w/ a fresh variable name. Only serves to make this module more readable. +-} +freshLam :: + Ty -> -- type of the fresh var being created + (PIRType -> PIRTerm -> PlutusContext PIRTerm) -> -- fn from that fresh var to a term + PlutusContext PIRTerm +freshLam t f = do + name <- freshName + t' <- toPIRType t + PIR.LamAbs () name t' <$> f t' (PIR.Var () name) + +{- Variant of the above function but accepts a PIR Type (useful in a few contexts) -} +freshLam' :: + PIRType -> -- type of the fresh var being created + (PIRType -> PIRTerm -> PlutusContext PIRTerm) -> -- fn from that fresh var to a term + PlutusContext PIRTerm +freshLam' t f = do + name <- freshName + PIR.LamAbs () name t <$> f t (PIR.Var () name) + +{- Type instantiation -} +pirTyInst :: PIRType -> PIRTerm -> PIRTerm +pirTyInst ty term = PIR.TyInst () term ty + +{- Delay/Force implemented with type abstraction/instantiation -} +pirDelay :: PIRTerm -> PlutusContext PIRTerm +pirDelay term = do + nm <- freshName + pure $ PIR.LamAbs () nm unit term + +pirForce :: PIRTerm -> PIRTerm +pirForce term = PIR.Apply () term unitTerm + +{- This assumes that the kind is * -} +pirTyAbs :: (PIRType -> PlutusContext PIRTerm) -> PlutusContext PIRTerm +pirTyAbs f = do + tName <- PIR.TyName <$> freshName + let kindType = PIR.Type () + body <- f (PIR.TyVar () tName) + pure $ PIR.TyAbs () tName kindType body + +{- REVIEW: Is this right? Is that what we *want*? + TODO: Add a "fake" function to Language.PureScript.Environment so that users can... use this... +-} +pirError :: PIRType -> PlutusContext PIRTerm +pirError t = pirForce <$> pirDelay (PIR.Error () t) + +{- Builtin function substitutions. Each builtin function with a Purus type that contains + a `Boolean` is a lie. We use algebraic datatype Booleans, not the Plutus builtin. (This + makes case expression desugaring much easier.) + + Consequently, we need to construct variants of those builtins which convert between `con bool` + and the ADT Boolean. The simplicity is worth the minor performance penalty. + + TODO: Introduce machinery to let- bind these in the outer scope of the expression being compiled. + There shouldn't be any need to duplicate them. +-} +builtinSubstitutions :: Map PLC.DefaultFun (PlutusContext PIRTerm) +builtinSubstitutions = + M.fromList + [ (PLC.EqualsInteger, pirEqInt) + , (PLC.EqualsString, pirEqString) + , (PLC.LessThanInteger, pirLessThanInteger) + , (PLC.LessThanEqualsInteger, pirLessThanEqualsInteger) + , (PLC.EqualsByteString, pirEqualsByteString) + , (PLC.LessThanByteString, pirLessThanByteString) + , (PLC.LessThanEqualsByteString, pirLessThanEqualsByteString) + , (PLC.VerifyEd25519Signature, pirVerifyEd25519Signature) + , (PLC.VerifyEcdsaSecp256k1Signature, pirVerifyEcdsaSecp256k1Signature) + , (PLC.EqualsData, pirEqualsData) + , (PLC.IfThenElse, pirIfThenElse) + , (PLC.NullList, pirNullList) + ] + +tyInt, tyBool, tyByteString, tyData, tyString :: Ty +tyInt = TyCon C.Int +tyBool = TyCon C.Boolean +tyByteString = TyCon C.BuiltinByteString +tyData = TyCon C.BuiltinData +tyString = TyCon C.String + +wrapBoolToBoolean2 :: Ty -> PLC.DefaultFun -> PlutusContext PIRTerm +wrapBoolToBoolean2 t f = freshLam t $ \_ x1 -> freshLam t $ \_ x2 -> do + let fun = PIR.Builtin () f + pirBoolToBoolean $ fun # x1 # x2 + +wrapBoolToBoolean3 :: Ty -> PLC.DefaultFun -> PlutusContext PIRTerm +wrapBoolToBoolean3 t f = freshLam t $ \_ x1 -> freshLam t $ \_ x2 -> freshLam t $ \_ x3 -> do + let fun = PIR.Builtin () f + pirBoolToBoolean $ fun # x1 # x2 # x3 + +-- Int -> Int -> Bool +pirEqInt :: PlutusContext PIRTerm +pirEqInt = wrapBoolToBoolean2 tyInt PLC.EqualsInteger + +-- String -> String -> Bool +pirEqString :: PlutusContext PIRTerm +pirEqString = wrapBoolToBoolean2 tyString PLC.EqualsString + +-- Int -> Int -> Bool +pirLessThanInteger :: PlutusContext PIRTerm +pirLessThanInteger = wrapBoolToBoolean2 tyInt PLC.LessThanInteger + +-- Int -> Int -> Bool +pirLessThanEqualsInteger :: PlutusContext PIRTerm +pirLessThanEqualsInteger = wrapBoolToBoolean2 tyInt PLC.LessThanEqualsInteger + +-- Bytestring -> ByteString -> Bool +pirEqualsByteString :: PlutusContext PIRTerm +pirEqualsByteString = wrapBoolToBoolean2 tyByteString PLC.EqualsByteString + +-- Bytestring -> ByteString -> Bool +pirLessThanByteString :: PlutusContext PIRTerm +pirLessThanByteString = wrapBoolToBoolean2 tyByteString PLC.LessThanByteString + +-- Bytestring -> ByteString -> Bool +pirLessThanEqualsByteString :: PlutusContext PIRTerm +pirLessThanEqualsByteString = wrapBoolToBoolean2 tyByteString PLC.LessThanEqualsByteString + +-- Bytestring -> ByteString -> ByteString -> Bool +pirVerifyEd25519Signature :: PlutusContext PIRTerm +pirVerifyEd25519Signature = wrapBoolToBoolean3 tyByteString PLC.VerifyEd25519Signature + +-- Bytestring -> ByteString -> ByteString -> Bool +pirVerifyEcdsaSecp256k1Signature :: PlutusContext PIRTerm +pirVerifyEcdsaSecp256k1Signature = wrapBoolToBoolean3 tyByteString PLC.VerifyEcdsaSecp256k1Signature + +-- BuiltinData -> BuiltinData -> Bool +pirEqualsData :: PlutusContext PIRTerm +pirEqualsData = wrapBoolToBoolean2 tyData PLC.EqualsData + +-- N.B. This differs from the one above in that +-- this assumed that the condition +-- will be represented as an ADT Prim.Boolean +-- so we need to turn it into a con bool +-- (also we're not adding force/delay here) +-- forall x. Bool -> x -> x -> x +pirIfThenElse :: PlutusContext PIRTerm +pirIfThenElse = + pirTyAbs $ \tv -> + freshLam tyBool $ \_ cond -> + freshLam' tv $ \_ trueVar -> + freshLam' tv $ \_ falseVar -> do + pirIfiedCond <- pirBooleanToBool cond + let pirIFTE = PIR.Builtin () PLC.IfThenElse + pure $ pirIFTE # pirIfiedCond # trueVar # falseVar + +-- forall x. BuiltinList x -> Bool +pirNullList :: PlutusContext PIRTerm +pirNullList = + pirTyAbs $ \tv -> do + let listAppliedTy = + PIR.TyApp + () + (TyBuiltin () (PLC.SomeTypeIn PLC.DefaultUniProtoList)) + tv + freshLam' listAppliedTy $ \_ arg -> do + let nullListFun = PIR.Builtin () PLC.NullList + pirBoolToBoolean (pirTyInst tv nullListFun # arg) diff --git a/src/Language/Purus/Pipeline/DesugarCore.hs b/src/Language/Purus/Pipeline/DesugarCore.hs new file mode 100644 index 000000000..651f68b90 --- /dev/null +++ b/src/Language/Purus/Pipeline/DesugarCore.hs @@ -0,0 +1,518 @@ +{-# LANGUAGE TypeApplications #-} +{-# OPTIONS_GHC -Wno-orphans #-} +{-# OPTIONS_GHC -Wno-unrecognised-pragmas #-} + +{-# HLINT ignore "Use camelCase" #-} +module Language.Purus.Pipeline.DesugarCore (desugarCoreModule, matchVarLamAbs) where + +import Prelude + +import Data.Map qualified as M + +import Data.Text (Text) +import Data.Text qualified as T + +import Data.Char (isUpper) +import Data.Foldable (Foldable (foldl'), foldrM, traverse_) +import Data.List (sort, sortOn) +import Data.Maybe (fromJust, isJust) + +import Data.Bifunctor (Bifunctor (first, second)) + +import Control.Monad.Reader (MonadReader (local), join, unless) +import Control.Monad.State (get, modify) + +import Language.PureScript.AST.Literals (Literal (..)) +import Language.PureScript.Constants.Prim qualified as C +import Language.PureScript.CoreFn.Ann (Ann, nullAnn) +import Language.PureScript.CoreFn.Binders (Binder (..)) +import Language.PureScript.CoreFn.Desugar.Utils (properToIdent, showIdent', wrapTrace) +import Language.PureScript.CoreFn.Expr ( + Bind (NonRec, Rec), + CaseAlternative (CaseAlternative), + Expr (..), + PurusType, + ) +import Language.PureScript.CoreFn.Module (Datatypes, Module (..)) +import Language.PureScript.CoreFn.TypeLike (TypeLike (..)) +import Language.PureScript.CoreFn.Utils (exprType) +import Language.PureScript.Environment (mkCtorTy, mkTupleTyName) +import Language.PureScript.Names ( + Ident (..), + ModuleName (ModuleName), + ProperName (ProperName), + Qualified (Qualified), + QualifiedBy (ByModuleName), + coerceProperName, + disqualify, + runIdent, + ) +import Language.PureScript.Types (Type (..)) + +import Language.Purus.Debug ( + doTrace, + doTraceM, + prettify, + ) +import Language.Purus.IR ( + Alt (..), + BVar (..), + BindE (..), + Exp (..), + FVar (..), + FuncType (..), + Lit (CharL, IntL, ObjectL, StringL), + Pat (..), + expTy, + ) +import Language.Purus.IR.Utils ( + IR_Decl, + Vars, + WithObjects, + foldBinds, + mapBind, + viaExp, + ) +import Language.Purus.Pipeline.Monad ( + DesugarContext (DesugarContext), + DesugarCore, + MonadCounter (next), + globalScope, + localScope, + ) +import Language.Purus.Pretty (prettyStr, prettyTypeStr, renderExprStr) +import Language.Purus.Pretty.Common qualified as PC + +import Bound (Var (..), abstract) +import Bound.Scope (fromScope) + +import Control.Lens ( + At (at), + Ixed (ix), + folded, + over, + set, + transform, + view, + (.=), + (^?), + ) + +import Debug.Trace (traceM) +import Prettyprinter (Pretty (..)) + +{- This runs the computation in an empty *local* context. The globals (i.e. top level declarations and + imports are still in scope.) + + In general, we ignore locally-scoped top-level declarations until we've desugared + everything to core, then we abstract those variables after we've assigned enough + indices. +-} +freshly :: DesugarCore a -> DesugarCore a +freshly act = local (set localScope M.empty) act + +{- Binds a local variable. +-} +bindLocal :: Ident -> DesugarCore Int +bindLocal ident = do + i <- next + modify $ over localScope (M.insert ident i) -- localScope . at ident .= i + s <- view localScope + doTraceM "bind" ("IDENT: " <> T.unpack (runIdent ident) <> "\n\nINDEX: " <> prettyStr i <> "\n\nSCOPE:\n" <> prettyStr (M.toList s)) + pure i + +{- Binds a "global" variable to the specific index. + + "Global" in the context of this module means: An identifier that corresponds to + a top-level declaration in the module being compiled or one of its dependencies. +-} +forceBindGlobal :: ModuleName -> Ident -> Int -> DesugarCore () +forceBindGlobal mn i indx = do + DesugarContext globals _ <- get + let modMapExists = isJust (M.lookup mn globals) + unless modMapExists $ + modify $ + over globalScope (M.insert mn M.empty) + modify $ over (globalScope . ix mn) (M.insert i indx) + +{- -} +isCtorOrPrim :: Exp x t (Vars t) -> Bool +isCtorOrPrim = \case + V (F (FVar _ (Qualified (ByModuleName (ModuleName "Prim")) _))) -> True + V (F (FVar _ (Qualified _ (Ident i)))) -> isUpper (T.head i) + _ -> False + +{- We don't bind anything b/c the type level isn't `Bound` -} +tyAbs :: forall x t. Text -> KindOf t -> Exp x t (Vars t) -> DesugarCore (Exp x t (Vars t)) +tyAbs nm k exp' = do + u <- next + pure $ TyAbs (BVar u k (Ident nm)) exp' + +tyAbsMany :: forall x t. [(Text, KindOf t)] -> Exp x t (Vars t) -> DesugarCore (Exp x t (Vars t)) +tyAbsMany vars expr = foldrM (uncurry tyAbs) expr vars + +{- NOTE: We need access to the declarations for all imports here in order to correctly abstract (i.e. bind) + all variables that should be represented as BVars. + + For all subsequent compiler passes, a free variable (an IR.FVar) indicates a variable which is + *absolutely free* until the final code generation pass, i.e., a variable that either *cannot* be bound + at all, or one which can only be sensibly bound by some PIR-specific construct. + + In practice these variables fall into three catogories: + + - Constructors, which acquire binders in PIR datatype declarations. Those declarations cannot be + created until (at least) the object desugaring pass, which necessarily occurs somewhat late in + the compilation pipeline. Only the winnowed IR, which we create in that pass, has types which are + guaranteed to be representable in PIR. + + - Actual PLC (well, PLC DefaultFun) Builtins. These are true primitives and are replaced with the + PIR AST `Builtin` construct during code generation. + + - "Morally" Builtin functions that have declarations which are baked into the Purus compiler. + We have to provide some of these for (e.g.) serializing and deserializing ledger API types. + + Note that variables which represent the identifiers of imported declarations do not fall into + one of those categories! We have to bind those declarations *here*, so we need to collect those + declarations from this modules dependencies and pass them as an argument here. +-} + +desugarCoreModule :: + Datatypes PurusType PurusType -> + [IR_Decl] -> + Module (Bind Ann) PurusType PurusType Ann -> + DesugarCore (Module IR_Decl PurusType PurusType Ann) +desugarCoreModule inScope imports Module {..} = do + globalScope . at moduleName .= Just M.empty + decls' <- traverse (freshly . desugarCoreDecl . doEtaReduce) moduleDecls + decls <- bindLocalTopLevelDeclarations decls' + let allDatatypes = moduleDataTypes <> inScope + s <- get + traceM $ "DesugarContext for " <> prettyStr moduleName <> "\n" <> prettyStr s + let result = Module {moduleDecls = decls <> imports, moduleDataTypes = allDatatypes, ..} + -- traceM $ "Desugar Coure output for " <> prettyStr moduleName <> "\n" <> docString (prettyModule result) + pure result + where + doEtaReduce = \case + NonRec a nm body -> NonRec a nm (runEtaReduce body) + Rec xs -> Rec $ fmap runEtaReduce <$> xs + {- Need to do this to ensure that all -} + bindLocalTopLevelDeclarations :: + [BindE PurusType (Exp WithObjects PurusType) (Vars PurusType)] -> + DesugarCore [BindE PurusType (Exp WithObjects PurusType) (Vars PurusType)] + bindLocalTopLevelDeclarations ds = do + let topLevelIdents = foldBinds (\acc nm _ -> nm : acc) [] ds + traverse_ (uncurry (forceBindGlobal moduleName)) topLevelIdents + s <- get + doTraceM "bindLocalTopLevelDeclarations" $ + prettify + [ -- "Input (Module Decls):\n" <> prettify (prettyStr <$> ds) + "Top level idents:\n" <> prettify (prettyStr <$> topLevelIdents) + , "State:\n" <> prettyStr s + ] + -- this is only safe because every locally-scoped (i.e. inside a decl) variable should be + -- bound by this point + let upd = \case + V (B bv) -> V $ B bv + V (F fv@(FVar t (Qualified (ByModuleName mn) ident))) -> + case s ^? globalScope . at mn . folded . at ident . folded of + Just indx -> V $ B $ BVar indx t ident + Nothing -> V $ F fv + other -> other + pure $ mapBind (const $ viaExp (transform upd)) <$> ds + +desugarCoreDecl :: + Bind Ann -> + DesugarCore (BindE PurusType (Exp WithObjects PurusType) (Vars PurusType)) +desugarCoreDecl = \case + NonRec _ ident expr -> wrapTrace ("desugarCoreDecl: " <> showIdent' ident) $ do + bvix <- bindLocal ident + s <- view localScope + let abstr = abstract (matchLet s) + desugared <- desugarCore expr + let scoped = abstr desugared + pure $ NonRecursive ident bvix scoped + Rec xs -> do + let inMsg = + concatMap + ( \((_, i), x) -> + prettyStr i + <> " :: " + <> prettyTypeStr (exprType x) + <> "\n" + <> prettyStr i + <> " = " + <> renderExprStr x + <> "\n\n" + ) + xs + doTraceM "desugarCoreDecl" inMsg + first_pass <- traverse (\((_, ident), e) -> bindLocal ident >>= \u -> pure ((ident, u), e)) xs + s <- view localScope + let abstr = abstract (matchLet s) + second_pass <- + traverse + ( \((ident, bvix), expr) -> do + wrapTrace ("desugarCoreDecl: " <> showIdent' ident) $ do + desugared <- desugarCore expr + let scoped = abstr desugared + pure ((ident, bvix), scoped) + ) + first_pass + doTraceM "desugarCoreDecl" ("RESULT (RECURSIVE):\n" <> prettyStr (fmap fromScope <$> second_pass)) + pure $ Recursive second_pass + +{- | Turns a list of expressions into an n-ary + tuple, where n = the length of the list. + + Throws an error on empty lists. Should only be used + in contexts that must be nonempty (e.g. case expression + scrutinees and case alternative patterns) +-} +tuplify :: [Expr Ann] -> Expr Ann +tuplify [] = error "tuplify called on empty list of expressions" +tuplify es = foldl' (App nullAnn) tupCtor es + where + n = length es + tupName = Qualified (ByModuleName C.M_Prim) (ProperName $ "Tuple" <> T.pack (show n)) + tupCtorType = mkCtorTy tupName n + + tupCtor :: Expr Ann + tupCtor = Var nullAnn tupCtorType (properToIdent <$> tupName) + +desugarCore :: Expr Ann -> DesugarCore (Exp WithObjects PurusType (Vars PurusType)) +desugarCore e = do + let ty = exprType e + result <- desugarCore' e + let msg = + prettify + [ "INPUT:\n" <> renderExprStr e + , "INPUT TY:\n" <> prettyTypeStr ty + , "OUTPUT:\n" <> prettyStr result + , "OUTPUT TY:\n" <> prettyStr (expTy id result) + ] + doTraceM "desugarCore" msg + pure result + +desugarCore' :: Expr Ann -> DesugarCore (Exp WithObjects PurusType (Vars PurusType)) +desugarCore' (Literal _ann ty lit) = LitE ty <$> desugarLit lit +desugarCore' lam@(Abs _ann ty ident expr) = do + bvIx <- bindLocal ident + s <- view localScope + expr' <- desugarCore' expr + let !ty' = functionArgumentIfFunction $ snd (stripQuantifiers ty) + (vars', _) = stripQuantifiers ty + vars = (\(_, b, c) -> (b, c)) <$> vars' + scopedExpr = abstract (matchLet s) expr' + result <- tyAbsMany vars $ LamE (BVar bvIx ty' ident) scopedExpr + let msg = + prettify + [ "ANNOTATED LAM TY:\n" <> prettyStr ty + , "BOUND VAR TY:\n" <> prettyStr ty' + , "BOUND VAR INDEX: " <> prettyStr bvIx + , "BOUND VAR IDENT: " <> prettyStr ident + , "BODY TY:\n" <> prettyStr (exprType expr) + , "INPUT EXPR:\n" <> renderExprStr lam + , "RESULT EXPR:\n" <> prettyStr result + , "RESULT EXPR TY:\n" <> prettyStr (expTy id result) + , "LOCAL SCOPE:\n" <> prettyStr (M.toList s) + ] + doTraceM "desugarCoreLam" msg + pure result +desugarCore' appE@(App {}) = case fromJust $ PC.analyzeApp appE of + (f, args) -> do + f' <- desugarCore f + args' <- traverse desugarCore args + pure $ foldl' AppE f' args' +desugarCore' (Var _ann ty qi) = pure $ V . F $ FVar ty qi +desugarCore' (Let _ann binds cont) = do + bindEs <- traverse rebindInScope =<< traverse desugarCoreDecl binds + s <- view localScope + cont' <- desugarCore cont + let abstr = abstract (matchLet s) + pure $ LetE bindEs $ abstr cont' +desugarCore' (Accessor _ann ty label expr) = do + expr' <- desugarCore expr + pure $ AccessorE () ty label expr' +desugarCore' (ObjectUpdate _ann ty expr toCopy toUpdate) = do + expr' <- desugarCore expr + toUpdate' <- desugarObjectMembers toUpdate + pure $ ObjectUpdateE () ty expr' toCopy toUpdate' +-- NOTE: We do not tuple single scrutinees b/c that's just a performance hit w/ no point +desugarCore' (Case _ann ty [scrutinee] alts) = do + scrutinee' <- desugarCore scrutinee + alts' <- traverse desugarAlt alts + pure $ CaseE ty scrutinee' alts' +desugarCore' (Case _ann ty scrutinees alts) = do + scrutinees' <- desugarCore $ tuplify scrutinees + alts' <- traverse desugarAlt alts + pure $ CaseE ty scrutinees' alts' + +rebindInScope :: + BindE PurusType (Exp WithObjects PurusType) (Vars PurusType) -> + DesugarCore (BindE PurusType (Exp WithObjects PurusType) (Vars PurusType)) +rebindInScope b = do + s <- view localScope + let f scoped = abstract (matchLet s) . fmap join . fromScope $ scoped + case b of + NonRecursive i x scoped -> pure $ NonRecursive i x (f scoped) + Recursive xs -> pure . Recursive $ second f <$> xs +desugarAlt :: + CaseAlternative Ann -> + DesugarCore (Alt WithObjects PurusType (Exp WithObjects PurusType) (Vars PurusType)) +desugarAlt (CaseAlternative [binder] result) = case result of + Left exs -> + error $ + "internal error: `desugarAlt` guarded alt not expected at this stage: " <> show exs + Right ex -> do + pat <- toPat binder + s <- view localScope + re' <- desugarCore ex + let abstrE = abstract (matchLet s) + pure $ UnguardedAlt pat (abstrE re') +desugarAlt (CaseAlternative binders result) = do + pats <- traverse toPat binders + s <- view localScope -- NOTE: Maybe this should be moved into the case block? + let abstrE = abstract (matchLet s) + n = length binders + tupTyName = mkTupleTyName n + tupCtorName = coerceProperName <$> tupTyName + pat = ConP tupTyName tupCtorName pats + case result of + Left exs -> do + error $ "internal error: `desugarAlt` guarded alt not expected at this stage: " <> show exs + Right ex -> do + re' <- desugarCore ex + pure $ UnguardedAlt pat (abstrE re') + +toPat :: Binder ann -> DesugarCore (Pat x PurusType (Exp x ty) (Vars ty)) +toPat = \case + NullBinder _ -> pure WildP + VarBinder _ i ty -> do + n <- bindLocal i + pure $ VarP i n ty + ConstructorBinder _ tn cn bs -> ConP tn cn <$> traverse toPat bs + NamedBinder _ nm _ -> + error $ + "found namedBinder: " + <> T.unpack (runIdent nm) + <> "TODO: remove NamedBinder/AsP everywhere (parser, cst, AST)" + LiteralBinder _ lp -> case lp of + NumericLiteral (Left i) -> pure . LitP $ IntL i + NumericLiteral (Right _) -> error "numeric literals not supported (yet)" + StringLiteral pss -> pure . LitP $ StringL pss + CharLiteral c -> pure . LitP $ CharL c + BooleanLiteral _ -> error "boolean literal patterns shouldn't exist anymore" + ListLiteral _ -> error "array literal patterns shouldn't exist anymore" + ObjectLiteral fs' -> do + -- REVIEW/FIXME: + -- this isn't right, we need to make sure the positions of the binders are correct, + -- since (I think?) you can use an Obj binder w/o using all of the fields + let fs = sortOn fst fs' + len = length fs + tupTyName = mkTupleTyName len + tupCtorName = coerceProperName <$> tupTyName + ConP tupTyName tupCtorName <$> traverse (toPat . snd) fs + +-- N.B. We expect the various kinds of literals here to be eliminated prior to this phase of desugaring +-- (they should be eliminated when converting AST to CoreFn) +desugarLit :: Literal (Expr Ann) -> DesugarCore (Lit WithObjects (Exp WithObjects PurusType (Vars PurusType))) +desugarLit (NumericLiteral (Left int)) = pure $ IntL int +desugarLit (NumericLiteral (Right _)) = error "TODO: Remove Number lits from all preceding ASTs" -- pure $ NumL number +desugarLit (StringLiteral string) = pure $ StringL string +desugarLit (CharLiteral char) = pure $ CharL char +desugarLit (BooleanLiteral _) = error "TODO: Remove BooleanLiteral from all preceding ASTs" +desugarLit (ListLiteral _) = error "TODO: Remove ListLiteral from IR AST" -- ListL <$> traverse desugarCore arr +desugarLit (ObjectLiteral object) = ObjectL () <$> desugarObjectMembers object + +-- this looks like existing monadic combinator but I couldn't find it +desugarObjectMembers :: [(field, Expr Ann)] -> DesugarCore [(field, Exp WithObjects PurusType (Vars PurusType))] +desugarObjectMembers = traverse (\(memberName, val) -> (memberName,) <$> desugarCore val) + +pattern (:~>) :: PurusType -> PurusType -> PurusType +pattern a :~> b <- + ( TypeApp + _ + ( TypeApp + _ + (TypeConstructor _ (Qualified (ByModuleName (ModuleName "Prim")) (ProperName "Function"))) + a + ) + b + ) +infixr 0 :~> + +functionArgumentIfFunction :: PurusType -> PurusType +functionArgumentIfFunction (arg :~> _) = arg +functionArgumentIfFunction t = t + +-- | For usage with `Bound`, use only with lambda +matchVarLamAbs :: Ident -> Int -> FVar ty -> Maybe (BVar ty) +matchVarLamAbs nm bvix (FVar ty n') + | nm == disqualify n' = Just (BVar bvix ty nm) + | otherwise = Nothing + +matchLet :: (Pretty ty) => M.Map Ident Int -> Vars ty -> Maybe (BVar ty) +matchLet _ (B bv) = Just bv +matchLet binds fv@(F (FVar ty n')) = case result of + Nothing -> Nothing + Just _ -> doTrace "matchLet" msg result + where + msg = + "INPUT:\n" + <> prettyStr fv + <> "\n\nOUTPUT:\n" + <> prettyStr result + result = do + let nm = disqualify n' + bvix <- M.lookup nm binds + pure $ BVar bvix ty nm + +-- TODO (t4ccer): Move somehwere, but cycilc imports are annoying +instance FuncType PurusType where + headArg = functionArgumentIfFunction + +runEtaReduce :: Expr ann -> Expr ann +runEtaReduce = transform etaReduce + +etaReduce :: + forall ann. + Expr ann -> + Expr ann +etaReduce input = case partitionLam input of + Just (boundVars, fun, args) -> + if sort boundVars == sort args then fun else input + Nothing -> input + where + partitionLam :: + Expr ann -> + Maybe ([Ident], Expr ann, [Ident]) + partitionLam e = do + let (bvars, inner) = stripLambdas e + (f, args) <- analyzeAppCfn inner + argBVars <- traverse argToBVar args + pure $ (bvars, f, argBVars) + + argToBVar :: Expr ann -> Maybe Ident + argToBVar = \case + Var _ _ qualified -> Just . disqualify $ qualified + _ -> Nothing + + stripLambdas = \case + Abs _ _ bv body -> first (bv :) $ stripLambdas body + other -> ([], other) + +analyzeAppCfn :: Expr ann -> Maybe (Expr ann, [Expr ann]) +analyzeAppCfn e = (,appArgs e) <$> appFun e + where + appArgs :: Expr ann -> [Expr ann] + appArgs (App _ t1 t2) = appArgs t1 <> [t2] + appArgs _ = [] + + appFun :: Expr ann -> Maybe (Expr ann) + appFun (App _ t1 _) = go t1 + where + go (App _ tx _) = case appFun tx of + Nothing -> Just tx + Just tx' -> Just tx' + go other = Just other + appFun _ = Nothing diff --git a/src/Language/Purus/Pipeline/DesugarObjects.hs b/src/Language/Purus/Pipeline/DesugarObjects.hs new file mode 100644 index 000000000..636c8e616 --- /dev/null +++ b/src/Language/Purus/Pipeline/DesugarObjects.hs @@ -0,0 +1,432 @@ +{-# LANGUAGE ScopedTypeVariables #-} +{-# LANGUAGE TypeApplications #-} + +module Language.Purus.Pipeline.DesugarObjects (desugarObjects, desugarObjectsInDatatypes) where + +import Data.Bifunctor (Bifunctor (second)) +import Data.List (elemIndex, foldl', sortOn) + +import Data.Map qualified as M + +import Data.Maybe (fromJust) + +import Data.Text qualified as T + +import Control.Monad (foldM) + +import Language.PureScript.Constants.Prim qualified as C +import Language.PureScript.CoreFn.Desugar.Utils (properToIdent) +import Language.PureScript.CoreFn.Expr ( + PurusType, + ) +import Language.PureScript.CoreFn.FromJSON () +import Language.PureScript.CoreFn.Module ( + Datatypes, + bitraverseDatatypes, + ) +import Language.PureScript.CoreFn.TypeLike (TypeLike (..)) +import Language.PureScript.Environment (kindType, mkTupleTyName, pattern RecordT, pattern (:->)) +import Language.PureScript.Names (Ident (..), coerceProperName) +import Language.PureScript.PSString (PSString) +import Language.PureScript.Types ( + RowListItem (rowListType), + SourceType, + Type (..), + eqType, + rowToList, + srcTypeApp, + srcTypeConstructor, + ) +import Language.Purus.Debug (doTraceM) +import Language.Purus.IR ( + Alt (..), + BVar (..), + BindE (..), + Exp (..), + FVar (..), + Kind (..), + Lit (..), + Pat (..), + Ty (..), + expTy, + ppExp, + pattern (:~>), + ) +import Language.Purus.IR.Utils ( + Vars, + WithObjects, + WithoutObjects, + fromExp, + toExp, + ) +import Language.Purus.Pipeline.Monad ( + Counter, + MonadCounter (next), + ) +import Language.Purus.Pretty.Common (prettyStr) +import Language.Purus.Pretty.Types (prettyTypeStr) +import Language.Purus.Utils (mkFieldMap) +import Prelude + +import Bound (Var (..)) +import Bound.Scope (toScope) + +import Control.Lens (ix, (&), (.~)) + +import Control.Monad.Except (liftEither, throwError) + +tryConvertType :: SourceType -> Counter Ty +tryConvertType = go id + where + go :: (SourceType -> SourceType) -> SourceType -> Counter Ty + go f t = case t of + RecordT fs -> + if isClosedRow fs + then do + let fields = rowListType <$> mkFieldMap fs + arity = M.size fields + fakeTName = mkTupleTyName arity + types = M.elems fields + ctorType = foldl' srcTypeApp (srcTypeConstructor fakeTName) types + go f ctorType + else throwError $ prettyTypeStr fs <> " is not a closed row. Last: " <> prettyTypeStr (rowLast fs) + TypeVar _ txt k -> TyVar txt <$> tryConvertKind' f t k + TypeConstructor _ tn -> pure $ TyCon tn + TypeApp ann t1 t2 -> do + t2' <- go (f . TypeApp ann t1) t2 + t1' <- go (f . (\x -> TypeApp ann x t2)) t1 + pure $ TyApp t1' t2' + KindApp ann t1 t2 -> do + t2' <- go (f . KindApp ann t1) t2 + t1' <- go (f . (\x -> KindApp ann x t2)) t1 + pure $ KApp t1' t2' + ForAll ann vis var mbk inner skol -> do + let khole = f . (\x -> ForAll ann vis var x inner skol) + ihole = f . (\x -> ForAll ann vis var mbk x skol) + k <- tryConvertKind' khole t mbk + inner' <- go ihole inner + pure $ Forall vis var k inner' skol + KindedType ann t1 t2 -> do + t2' <- go (f . KindedType ann t1) t2 + t1' <- go (f . (\x -> KindedType ann x t2)) t1 + pure $ KType t1' t2' + other -> throwError $ "Unsupported type:\n " <> show other + +tryConvertKind' :: (SourceType -> SourceType) -> SourceType -> SourceType -> Counter Kind +tryConvertKind' f t = \case + TypeConstructor _ C.Type -> pure KindType + k1 :-> k2 -> do + k1' <- tryConvertKind' f t k1 + k2' <- tryConvertKind' f t k2 + pure $ KindArrow k1' k2' + other -> + throwError $ + "Couldn't convert type: " + <> prettyTypeStr other + <> " to a Plutus Kind.\n" + <> "Plutus only supports kinds * and (* -> Plutus Kind)" + +isClosedRow :: SourceType -> Bool +isClosedRow t = case rowToList t of + (_, REmpty {}) -> True + (_, KindApp _ REmpty {} k) | eqType k kindType -> True + _ -> False + +rowLast :: SourceType -> SourceType +rowLast t = case rowToList t of + (_, r) -> r + +desugarObjects :: + Exp WithObjects SourceType (Vars SourceType) -> + Counter (Exp WithoutObjects Ty (Vars Ty)) +desugarObjects __expr = do + result <- go __expr + let msg = + "INPUT:\n" + <> ppExp __expr + <> "\n\nINPUT TY:\n" + <> prettyStr (expTy id __expr) + <> "\n\nRESULT:\n" + <> ppExp result + <> "\n\nRESULT TY:\n" + <> prettyStr (expTy id result) + doTraceM "desugarObjects" msg + pure result + where + go :: + Exp WithObjects SourceType (Vars SourceType) -> + Counter (Exp WithoutObjects Ty (Vars Ty)) + go expression = case expression of + LitE ty lit -> do + ty' <- goType ty + tryConvertLit lit >>= \case + Left desObj -> pure desObj + Right lit' -> pure $ LitE ty' lit' + LamE bv e -> do + bv' <- updateBV bv + let unscoped = toExp e + ex <- fromExp <$> desugarObjects unscoped + pure $ LamE bv' ex + AppE e1 e2 -> do + e2' <- desugarObjects e2 + e1' <- desugarObjects e1 + pure $ AppE e1' e2' + CaseE ty scrutinee alts -> do + ty' <- goType ty + scrutinees' <- desugarObjects scrutinee + alts' <- traverse goAlt alts + pure $ CaseE ty' scrutinees' alts' + LetE bound e -> do + bound' <- goBinds bound + let unscoped = toExp e + e' <- toScope <$> desugarObjects unscoped + pure $ LetE bound' (F <$> e') + AccessorE _ resTy lbl e -> desugarObjectAccessor resTy lbl e + ObjectUpdateE _ ty orig copF updF -> desugarObjectUpdate ty orig copF updF + V fvar -> case fvar of + B (BVar i t nm) -> do + t' <- goType t + pure . V . B $ BVar i t' nm + F (FVar t qi) -> do + t' <- goType t + pure . V . F $ FVar t' qi + TyInstE t e -> TyInstE <$> goType t <*> go e + TyAbs (BVar bvix bvty bvid) e -> do + case purusTypeToKind bvty of + Left err -> error err + Right k -> do + e' <- go e + pure $ TyAbs (BVar bvix k bvid) e' + where + -- TODO: Error location w/ scope in alts + goAlt :: + Alt WithObjects SourceType (Exp WithObjects SourceType) (Vars SourceType) -> + Counter (Alt WithoutObjects Ty (Exp WithoutObjects Ty) (Vars Ty)) + goAlt (UnguardedAlt pat e) = do + pat' <- goPat pat + let unscoped = toExp e + e' <- toScope . fmap F <$> desugarObjects unscoped + pure $ UnguardedAlt pat' e' + + goPat :: + Pat WithObjects SourceType (Exp WithObjects SourceType) a -> + Counter (Pat WithoutObjects Ty (Exp WithoutObjects Ty) (Vars Ty)) + goPat = \case + VarP i n tyx -> VarP i n <$> goType tyx + WildP -> pure WildP + LitP lp -> + tryConvertLitP lp >>= \case + Left p -> pure p + Right litp -> pure $ LitP litp + ConP tn cn ps -> ConP tn cn <$> traverse goPat ps + + tryConvertLitP :: + Lit WithObjects (Pat WithObjects SourceType (Exp WithObjects SourceType) a) -> + Counter + ( Either + (Pat WithoutObjects Ty (Exp WithoutObjects Ty) (Vars Ty)) + (Lit WithoutObjects (Pat WithoutObjects Ty (Exp WithoutObjects Ty) (Vars Ty))) + ) + tryConvertLitP = \case + IntL i -> pure . pure $ IntL i + -- NumL d -> pure . pure $ NumL d + StringL s -> pure . pure $ StringL s + CharL c -> pure . pure $ CharL c + -- ArrayL ps -> pure . ArrayL <$> traverse goPat ps + -- ConstArrayL lits -> pure . ConstArrayL <$> traverse tryConvertConstLitP lits + ObjectL _ fs' -> do + let fs = sortOn fst fs' + len = length fs + tupTyName = mkTupleTyName len + tupCtorName = coerceProperName <$> tupTyName + bareFields = snd <$> fs + bareFields' <- traverse goPat bareFields + pure . Left $ ConP tupTyName tupCtorName bareFields' + + goBinds :: + [BindE SourceType (Exp WithObjects SourceType) (Vars SourceType)] -> + Counter [BindE Ty (Exp WithoutObjects Ty) (Vars Ty)] + goBinds [] = pure [] + goBinds (b : bs) = case b of + NonRecursive ident bvix expr -> do + let unscoped = toExp expr + e' <- desugarObjects unscoped + rest <- goBinds bs + pure $ NonRecursive ident bvix (F <$> toScope e') : rest + Recursive xs -> do + -- TODO: Accurate error reporting + let xsUnscoped = second (\e -> toExp e) <$> xs + xs' <- traverse (traverse desugarObjects) xsUnscoped + let xsRescoped = second (fmap F . toScope) <$> xs' + rest <- goBinds bs + pure $ Recursive xsRescoped : rest + + tryConvertLit :: + Lit WithObjects (Exp WithObjects SourceType (Vars SourceType)) -> + Counter + ( Either + (Exp WithoutObjects Ty (Vars Ty)) + (Lit WithoutObjects (Exp WithoutObjects Ty (Vars Ty))) + ) + tryConvertLit = \case + IntL i -> pure . pure $ IntL i + -- NumL d -> pure . pure $ NumL d + StringL psstr -> pure . pure $ StringL psstr + CharL c -> pure . pure $ CharL c + -- ArrayL nonLitArr -> Right . ArrayL <$> traverse go nonLitArr + -- ConstArrayL lits -> Right . ConstArrayL <$> traverse constArrHelper lits + ObjectL _ fs' -> Left <$> handleObjectLiteral fs' + where + handleObjectLiteral :: + [(PSString, Exp WithObjects SourceType (Vars SourceType))] -> + Counter (Exp WithoutObjects Ty (Vars Ty)) + handleObjectLiteral fs' = do + let fs = sortOn fst fs' + len = length fs + tupTyName = mkTupleTyName len + bareFields = snd <$> fs + bareFields' <- traverse desugarObjects bareFields + let types' = expTy id <$> bareFields' + types = types' <> [foldl' applyType (TyCon tupTyName) types'] + ctorType = foldr1 funTy types + + ctorExp :: Exp WithoutObjects Ty (Vars Ty) + ctorExp = V . F $ FVar ctorType $ properToIdent <$> tupTyName + assembleDesugaredObjectLit ctorExp ctorType bareFields' + + goType :: SourceType -> Counter Ty + goType = tryConvertType + + updateBV :: BVar SourceType -> Counter (BVar Ty) + updateBV (BVar bvIx bvTy bvNm) = do + bvTy' <- goType bvTy + pure $ BVar bvIx bvTy' bvNm + + -- TODO/FIXME: We need to ensure that we don't introduce conflicts in the bound variables. Not sure what the best way is ATM + + -- I'm not really sure what the point of the copy fields is? TODO: Figure out what the point of them is + desugarObjectUpdate :: + SourceType -> + Exp WithObjects SourceType (Vars SourceType) -> + Maybe [PSString] -> + [(PSString, Exp WithObjects SourceType (Vars SourceType))] -> + Counter (Exp WithoutObjects Ty (Vars Ty)) + desugarObjectUpdate _ e _ updateFields = do + _fs <- case expTy id e of + RecordT fs -> pure fs + other -> + error $ + "ERROR: Record expression:\n " + <> prettyStr e + <> "\n should have a Record type, but instead has type:\n " + <> prettyStr other + + updateMap <- traverse desugarObjects $ M.fromList updateFields + updateTypes <- traverse goType $ M.fromList $ second (expTy id) <$> updateFields + origTypes <- traverse (goType . rowListType) (mkFieldMap _fs) + let ts = updateTypes `M.union` origTypes + len = M.size ts + tupTyName = mkTupleTyName len + tupCtorName = coerceProperName <$> tupTyName + types' = M.elems ts + types = types' <> [foldl' applyType (TyCon tupTyName) types'] + ctorType = foldr1 funTy types + + positioned = zip (M.keys ts) [0 ..] + + indices <- foldM (\acc nm -> do u <- next; pure $ M.insert nm u acc) M.empty (fst <$> positioned) + + let withPositioned :: forall x. (PSString -> Int -> Counter x) -> Counter [x] + withPositioned f' = traverse (uncurry f') positioned + + argBndrTemplate :: Counter [Pat WithoutObjects Ty (Exp WithoutObjects Ty) (FVar Ty)] + argBndrTemplate = withPositioned $ \lbl i -> case M.lookup lbl updateMap of + Nothing -> do + let ident = Ident $ " T.pack (show i) <> ">" + n = indices M.! lbl + pure @Counter $ VarP ident n (ts M.! lbl) + Just _ -> pure @Counter WildP + + resultTemplate = withPositioned $ \lbl i -> case M.lookup lbl updateMap of + Nothing -> do + let nm = Ident $ " T.pack (show i) <> ">" + n = indices M.! lbl + pure $ V . B $ BVar n (origTypes M.! lbl) nm + Just expr -> pure expr + + ctorExp = V . F $ FVar ctorType $ properToIdent <$> tupTyName + + ctorBndr <- ConP tupTyName tupCtorName <$> argBndrTemplate + + resultExpr <- assembleDesugaredObjectLit ctorExp ctorType =<< resultTemplate + e' <- go e + let scoped = toScope resultExpr + altBranch = F <$> UnguardedAlt ctorBndr scoped + pure $ CaseE ctorType e' [altBranch] + + desugarObjectAccessor :: + SourceType -> + PSString -> + Exp WithObjects SourceType (Vars SourceType) -> + Counter (Exp WithoutObjects Ty (Vars Ty)) + desugarObjectAccessor resTy lbl e = do + _fs <- case expTy id e of + RecordT fs -> pure fs + other -> + throwError $ + "ERROR: Record expression:\n " + <> prettyStr e + <> "\n should have a Record type, but instead has type:\n " + <> prettyStr other + fs <- traverse (traverse goType) $ M.toList (rowListType <$> mkFieldMap _fs) + let len = length fs + tupTyName = mkTupleTyName len + tupCtorName = coerceProperName <$> tupTyName + types' = snd <$> fs + dummyNm = Ident "" + lblIx = fromJust $ elemIndex lbl (fst <$> fs) -- FIXME: fromJust + let fieldTy = types' !! lblIx -- if it's not there *something* should have caught it by now + n <- next + let argBndrTemplate = replicate len WildP & ix lblIx .~ VarP dummyNm n fieldTy + let ctorBndr = ConP tupTyName tupCtorName argBndrTemplate + -- NOTE: `lblIx` is a placeholder for a better var ix + rhs :: Exp WithoutObjects Ty (Vars Ty) + rhs = V . B $ BVar n fieldTy dummyNm + altBranch = F <$> UnguardedAlt ctorBndr (toScope rhs) + e' <- desugarObjects e + let result = CaseE fieldTy e' [altBranch] + msg = + "INPUT EXP:\n" + <> prettyStr e + <> "\n\nLABEL:\n" + <> prettyStr lbl + <> "\n\nSUPPLIED RESTYPE:\n" + <> prettyStr resTy + <> "\n\nFIELD TYPES:\n" + <> prettyStr types' + <> "\n\nRESULT RHS:\n" + <> prettyStr rhs + <> "\n\nOUTPUT RESULT:\n" + <> prettyStr result + doTraceM "desugarObjectAccessor" msg + pure $ CaseE fieldTy e' [altBranch] + +assembleDesugaredObjectLit :: forall x a. Exp x Ty a -> Ty -> [Exp x Ty a] -> Counter (Exp x Ty a) +assembleDesugaredObjectLit expr (_ :~> b) (arg : args) = assembleDesugaredObjectLit (AppE expr arg) b args +assembleDesugaredObjectLit expr _ [] = pure expr -- TODO better error +assembleDesugaredObjectLit _ _ _ = error "something went wrong in assembleDesugaredObjectLit" + +purusTypeToKind :: SourceType -> Either String Kind +purusTypeToKind _t = + doTraceM "sourceTypeToKind" (prettyStr _t) >> case _t of + TypeConstructor _ C.Type -> pure KindType + t1 :-> t2 -> do + t1' <- purusTypeToKind t1 + t2' <- purusTypeToKind t2 + pure $ KindArrow t1' t2' + other -> Left $ "Error: PureScript type '" <> prettyTypeStr other <> " is not a valid Plutus Kind" + +desugarObjectsInDatatypes :: + Datatypes PurusType PurusType -> + Counter (Datatypes Kind Ty) +desugarObjectsInDatatypes = bitraverseDatatypes (liftEither . purusTypeToKind) tryConvertType diff --git a/src/Language/Purus/Pipeline/EliminateCases.hs b/src/Language/Purus/Pipeline/EliminateCases.hs new file mode 100644 index 000000000..ca29be87a --- /dev/null +++ b/src/Language/Purus/Pipeline/EliminateCases.hs @@ -0,0 +1,799 @@ +module Language.Purus.Pipeline.EliminateCases (eliminateCases) where + +import Prelude + +import Data.Map qualified as M + +import Data.Text qualified as T + +import Data.Bifunctor (second) +import Data.Foldable (foldl', foldrM) +import Data.List (sortOn) +import Data.Maybe (fromJust) +import Data.Traversable (for) + +import Language.PureScript.Constants.Prim qualified as C +import Language.PureScript.Constants.Purus qualified as C +import Language.PureScript.CoreFn.Module ( + CtorDecl (..), + Datatypes, + cdCtorFields, + cdCtorName, + dDataArgs, + dDataCtors, + getAllConstructorDecls, + getConstructorIndexAndDecl, + lookupCtorType, + lookupDataDecl, + tyDict, + ) +import Language.PureScript.CoreFn.TypeLike ( + TypeLike ( + applyType, + funTy, + instTy, + quantify, + replaceAllTypeVars, + splitFunTyParts + ), + getAllInstantiations, + getInstantiations, + safeFunArgTypes, + ) +import Language.PureScript.Names ( + Ident (..), + ProperName (..), + ProperNameType (..), + Qualified (..), + runIdent, + showQualified, + ) +import Language.PureScript.Types ( + TypeVarVisibility (TypeVarVisible), + ) + +import Language.Purus.Debug (doTrace, doTraceM, prettify) +import Language.Purus.IR ( + Alt (..), + BVar (BVar), + BindE (..), + Exp (..), + FVar (FVar), + Lit (..), + Pat (..), + Ty (..), + expTy, + expTy', + getPat, + unsafeAnalyzeApp, + pattern (:~>), + ) +import Language.Purus.IR qualified as IR +import Language.Purus.IR.Utils ( + Vars, + WithoutObjects, + fromExp, + isConstructor, + toExp, + ) +import Language.Purus.Pipeline.DesugarCore ( + matchVarLamAbs, + ) +import Language.Purus.Pipeline.GenerateDatatypes.Utils ( + analyzeTyApp, + foldr1Err, + freshName, + funResultTy, + getDestructorTy, + prettyQI, + prettyQPN, + ) +import Language.Purus.Pipeline.Monad ( + MonadCounter (next), + PlutusContext, + ) +import Language.Purus.Pretty.Common (prettyStr) + +import Bound (Var (..)) +import Bound.Scope ( + Scope, + abstract, + instantiate, + mapBound, + toScope, + ) +import Control.Lens ( + at, + view, + (^.), + ) +import Control.Lens.Combinators (transform) + +import Control.Monad.Except ( + MonadError (throwError), + ) + +import PlutusCore.Name (Unique (Unique)) +import PlutusIR ( + Name (Name), + ) + +{- @Koz: This module contains the transformations needed to eliminate case expressions. + + Because we are using PIR datatypes (and not, e.g., hand-rolled SOPs), we have to use their + destructor function machinery to eliminate cases. The bulk of this module consists in functions that + create (and correctly type) those destructors. + + The order of transformations here is: + 1. Eliminate literal patterns (by transforming them into constructor patterns that match on Boolean) + 2. Eliminate bare irrefutable patterns, since those don't actually require case analysis + 3. Eliminate constructor patterns + + We also run a final Constructor instantiation pass to ensure that all constructors have the + correct type instantiations and type annotations, and handle nullary constructors separately. + + NOTE on Nullary constructors: The PS type checker annotates constructors with their *Monomorphic* types + (or: with types as monomorphic as they can be). To instantiate nullary + constructors, we just look at the type annotation, figure out the + necessary instantiations by unifying the annotated type with the + type in the declaration, and instantiate. +-} + +eliminateCases :: + Datatypes IR.Kind Ty -> + Exp WithoutObjects Ty (Var (BVar Ty) (FVar Ty)) -> + PlutusContext (Exp WithoutObjects Ty (Var (BVar Ty) (FVar Ty))) +eliminateCases datatypes _exp = do + res <- eliminateCaseExpressions datatypes . desugarIrrefutables . desugarLiteralPatterns $ _exp + doTraceM "eliminateCaseExpressions" ("INPUT:\n" <> prettyStr _exp <> "\n\nOUTPUT:\n" <> prettyStr res) + pure + . instantiateNullaryWithAnnotatedType datatypes + . instantiateCtors datatypes + $ res + +{- NOTE(@Koz): This function runs "desugarConstructorPatterns", but is called "eliminateCaseExpressions" + because, if we run this *after* desugarIrrefutables and desugarLiteralPatterns, + we ought to *only* have Constructor Patterns remaining in the AST. If that is the case, + this will completely eliminate case expressions from the input. + + Honestly, I'm not exactly sure why I had to write it like this. But it *works* written like this! +-} +eliminateCaseExpressions :: + Datatypes IR.Kind Ty -> + Exp WithoutObjects Ty (Var (BVar Ty) (FVar Ty)) -> + PlutusContext (Exp WithoutObjects Ty (Var (BVar Ty) (FVar Ty))) +eliminateCaseExpressions datatypes = \case + V x -> pure $ V x + LitE t lit -> pure $ LitE t lit + LamE bv scoped -> do + let unscoped = toExp scoped + rescoped <- eliminateCaseExpressions datatypes unscoped + pure + . LamE bv + . toScope + . fmap F + $ rescoped + AppE e1 e2 -> do + e1' <- eliminateCaseExpressions datatypes e1 + e2' <- eliminateCaseExpressions datatypes e2 + pure $ AppE e1' e2' + ce@CaseE {} -> + case ezMonomorphize $ monomorphizePatterns datatypes ce of + CaseE resTy _scrut _alts -> do + let retTy = case head _alts of UnguardedAlt _ e -> expTy' id e + msg = + prettify + [ "ANN RES TY:\n " <> prettyStr resTy + , "SCRUTINEE:\n" <> prettyStr _scrut + , "ALTS:\n" <> prettyStr _alts + ] + doTraceM "eliminateCaseExpressions" msg + scrut <- eliminateCaseExpressions datatypes _scrut + alts <- traverse eliminateCasesInAlt _alts + desugarConstructorPattern datatypes retTy (CaseE resTy scrut alts) + other -> throwError ("eliminateCaseExpressions: IMPOSSIBLE:\n" <> prettyStr other) + LetE _bindEs _scoped -> do + let unscoped = toExp _scoped + scoped <- toScope . fmap F <$> eliminateCaseExpressions datatypes unscoped + bindEs <- traverse eliminateCasesInBind _bindEs + pure $ LetE bindEs scoped + TyInstE ty inner -> TyInstE ty <$> eliminateCaseExpressions datatypes inner + TyAbs bv inner -> TyAbs bv <$> eliminateCaseExpressions datatypes inner + where + eliminateCasesInAlt :: + Alt WithoutObjects Ty (Exp WithoutObjects Ty) (Var (BVar Ty) (FVar Ty)) -> + PlutusContext (Alt WithoutObjects Ty (Exp WithoutObjects Ty) (Var (BVar Ty) (FVar Ty))) + eliminateCasesInAlt (UnguardedAlt pat inner) = do + let unscoped = toExp inner + inner' <- toScope . fmap F <$> eliminateCaseExpressions datatypes unscoped + pure $ UnguardedAlt pat inner' + + eliminateCasesInBind = \case + NonRecursive i bvix e -> + let e' = toExp e + in NonRecursive i bvix . toScope . fmap F + <$> eliminateCaseExpressions datatypes e' + Recursive xs -> + let deScope e = toExp e + rescope = fmap F . toScope + xs' = traverse (traverse (eliminateCaseExpressions datatypes) . second deScope) xs + in Recursive . map (second rescope) <$> xs' + +{- Creates (and correctly types) the destructor function + +-} +mkDestructorFunTy :: + Datatypes IR.Kind Ty -> + Qualified (ProperName 'TypeName) -> + PlutusContext (Bool, Ty) -- (Is it a nullary TyCon,Destructor fun ty ) +mkDestructorFunTy datatypes tn = do + case datatypes ^. tyDict . at tn of + Nothing -> throwError $ "mkDestructorFunTy: No type info for " <> prettyQPN tn + Just dDecl -> do + let tyArgs = dDecl ^. dDataArgs + tyAppliedToArgs = foldl' (\acc (t, k) -> TyApp acc (TyVar t k)) (TyCon tn) tyArgs + let funTyLHS' out = foldr (\(txt, k) acc -> Forall TypeVarVisible txt k acc Nothing) out (dDecl ^. dDataArgs) + n <- T.pack . show <$> next + let outVarNm = "out" <> n + outVar = TyVar outVarNm IR.KindType + let funTyLHS inner = funTyLHS' $ Forall TypeVarVisible ("out" <> n) IR.KindType inner Nothing + ctorfs = map snd . view cdCtorFields <$> dDecl ^. dDataCtors + let funTyRHS = tyAppliedToArgs :~> mkFunTyRHS outVar ctorfs -- foldr funTy outVar funTyCtorArgs + let result = funTyLHS funTyRHS + doTraceM + "mkDestructorFunTy" + $ prettify + [ "TYPE NAME:\n" <> prettyStr tn + , "TY CTOR FIELDS:\n" <> prettyStr ctorfs + , "TY RHS:\n" <> prettyStr funTyRHS + , "RESULT:\n" <> prettyStr result + ] + pure (null tyArgs, result) + where + mkFunTyRHS outVar [] = outVar + mkFunTyRHS outVar ([] : fss) = outVar :~> mkFunTyRHS outVar fss + mkFunTyRHS outVar (fs : fss) = + let fs' = foldr1Err "mkFunTyRHS" (:~>) fs + in (fs' :~> outVar) :~> mkFunTyRHS outVar fss + +desugarConstructorPattern :: + Datatypes IR.Kind Ty -> + Ty -> + Exp WithoutObjects Ty (Var (BVar Ty) (FVar Ty)) -> + PlutusContext (Exp WithoutObjects Ty (Var (BVar Ty) (FVar Ty))) +desugarConstructorPattern datatypes altBodyTy _e = + let _eTy = expTy id _e + in case _e of + CaseE _resTy scrut alts@(UnguardedAlt (ConP tn _ _) _ : _) -> do + let isConP alt = case getPat alt of ConP {} -> True; _ -> False + conPatAlts = takeWhile isConP alts + scrutTy = expTy id scrut + indexedBranches <- sortOn fst <$> traverse (mkIndexedBranch scrutTy) conPatAlts + let branchTy = expTy id . snd . head $ indexedBranches + branchSplit = splitFunTyParts branchTy + branchRetTy = last . splitFunTyParts $ branchTy + allCtors = zip [0 ..] $ getAllConstructorDecls tn datatypes + (Name dcTor (Unique dctorIx)) <- getDestructorTy tn + (isNullaryTyCon, dctorTy) <- mkDestructorFunTy datatypes tn + let destructorRaw = V . B $ BVar dctorIx dctorTy (Ident dcTor) + instantiateTyCon :: Exp WithoutObjects Ty (Var (BVar Ty) (FVar Ty)) -> Exp WithoutObjects Ty (Var (BVar Ty) (FVar Ty)) + instantiateTyCon + | isNullaryTyCon = id + | otherwise = mkInstantiateTyCon (expTy id scrut) + + retTy' = mkInstantiateResTy scrutTy altBodyTy + -- NOTE: We'll need more sophisticated "pattern sorting" with as patterns + case dropWhile isConP alts of + [] -> do + -- In this branch we know we have exhaustive constructor patterns in the alts + let destructor = TyInstE altBodyTy (AppE (instantiateTyCon destructorRaw) scrut) + result = foldl' AppE destructor (snd <$> indexedBranches) + msg = + prettify + [ "INPUT TY:\n" <> prettyStr _eTy + , "RESULT TY:\n" <> prettyStr (expTy id result) + , "DESTRUCTOR TY:\n" <> prettyStr (expTy id destructor) + , "ORIGINAL CASE RES TY:\n" <> prettyStr _resTy + , "DEDUCED BRANCH RES TY:\n" <> prettyStr branchRetTy + , "SPLIT BRANCH TY:\n" <> prettyStr branchSplit + , "FULL BRANCH TY:\n" <> prettyStr branchTy + , "SCRUT TY:\n" <> prettyStr scrutTy + , "SCRUT EXPR:\n" <> prettyStr scrut + , "RESULT:\n" <> prettyStr result + , "ALT BODY TY:\n" <> prettyStr altBodyTy + , "INSTANTIATED ALT BODY TY:\n" <> prettyStr retTy' + ] + doTraceM "desugarConstructorPattern" msg + pure result + irrefutables -> do + let destructor = TyInstE altBodyTy (AppE (instantiateTyCon destructorRaw) scrut) + {- This is confusing and I keep making mistakes, so what's going on with 'irrefutables' is: + + This only concerns the "catchall" case that we expect when we encounter an + incomplete enumeration of constructor patterns in a set of case alternatives. + + If we have a WildP, we only care about the RHS b/c no variables are bound. + + If we have a VarP, it binds a variable. But we have to be careful here. If we have (pardon the stupid example) + ``` + case (mb :: Maybe Int) of + Nothing -> 0 + other -> fromJust other + ``` + + `other` is a VarBinder for a value of type `Maybe Int`. + + The `match` functions we're forced to use don't expect function arguments where the lambda binds + a variable of the scrutinee type. E.g. (assuming Nothing is the first ctor) + + ``` + match_Maybe :: forall t out. Maybe t -> out -> (t -> out) -> out + ``` + + So the translation for the above example is going to look like (pay attention to the types!) + + match_Maybe @Int mb 0 (\(_n :: Int) -> (\(other :: Maybe Int) -> fromJust other) mb) + + That's unnecessarily verbose and we can avoid creating a new lambda entirely by substituting the + scrutinee into `other` to perform a reduction step, a la: + + match_Maybe @Int mb 0 (\(_n :: Int) -> fromJust mb) + + If we had + ``` + case (mb :: Maybe Int) of + Nothing -> 0 + _ -> 1 + ``` + + The translation would be: + + ``` + match_Maybe @Int mb 0 (\(_n :: Int) -> 1) + ``` + + Anyway, the idea is that `irrefutable` here is always going to be a self-contained RHS for a lambda that we will attach unused binders to + during assembly so as to make the types line up w/ what the destructor fn expects + + TODO: We should let- bind the scrutinee because it will almost always occur in multiple places + -} + irrefutable = case head irrefutables of + UnguardedAlt WildP irrRHS -> toExp irrRHS + UnguardedAlt (VarP bvId bvIx _) irrRHS -> flip instantiate irrRHS $ \case + bv@(BVar bvIx' _ bvId') -> + if bvIx == bvIx' && bvId == bvId' + then scrut + else V . B $ bv + other -> error $ "Expected an irrefutable alt but got: " <> prettyStr other + result <- assemblePartialCtorCase (CtorCase irrefutable (M.fromList indexedBranches) destructor scrutTy) allCtors + let msg = + prettify + [ "INPUT TY:\n" <> prettyStr _eTy + , "INPUT:\n" <> prettyStr _e + , "RESULT TY:\n" <> prettyStr (expTy id result) + , "DESTRUCTOR TY:\n" <> prettyStr (expTy id destructor) + , "ORIGINAL CASE RES TY:\n" <> prettyStr _resTy + , "DEDUCED BRANCH RES TY:\n" <> prettyStr branchRetTy + , "SPLIT BRANCH TY:\n" <> prettyStr branchSplit + , "FULL BRANCH TY:\n" <> prettyStr branchTy + , "SCRUT TY:\n" <> prettyStr scrutTy + , "SCRUT EXPR:\n" <> prettyStr scrut + , "RESULT:\n" <> prettyStr result + , "ALT BODY TY:\n" <> prettyStr altBodyTy + , "INSTANTIATED ALT BODY TY:\n" <> prettyStr retTy' + ] + doTraceM "desugarConstructorPattern" msg + pure result + other -> pure other + where + assemblePartialCtorCase :: CtorCase -> [(Int, CtorDecl Ty)] -> PlutusContext (Exp WithoutObjects Ty (Var (BVar Ty) (FVar Ty))) + assemblePartialCtorCase CtorCase {..} [] = pure acc + assemblePartialCtorCase CtorCase {..} ((ctorIx, ctorDecl) : rest) = case M.lookup ctorIx indexedMatchArgs of + Nothing -> do + let cn = ctorDecl ^. cdCtorName + tn = fromJust $ lookupCtorType cn datatypes + cnProper = ProperName . runIdent <$> cn + monoFieldTypes = snd $ monoCtorFields tn cnProper scrutType datatypes + + lhsVars <- for monoFieldTypes $ \fldTy -> do + Name nm (Unique u) <- freshName + pure $ BVar u fldTy (Ident nm) + + let irrefutableLam = mkLHSBinder lhsVars irrefutableRHS + acc' = AppE acc irrefutableLam + assemblePartialCtorCase (CtorCase irrefutableRHS indexedMatchArgs acc' scrutType) rest + Just iFun -> do + let acc' = AppE acc iFun + assemblePartialCtorCase (CtorCase irrefutableRHS indexedMatchArgs acc' scrutType) rest + where + defAbstr = abstract $ \case + B bv -> Just bv + _ -> Nothing + mkLHSBinder :: + [BVar Ty] -> + Exp WithoutObjects Ty (Var (BVar Ty) (FVar Ty)) -> + Exp WithoutObjects Ty (Var (BVar Ty) (FVar Ty)) + mkLHSBinder [] = id + mkLHSBinder (bv : bvs) = \inner -> + let mkRHS = mkLHSBinder bvs + rhs = mkRHS inner + in LamE bv (defAbstr rhs) + + mkInstantiateTyCon :: + Ty -> + Exp WithoutObjects Ty (Var (BVar Ty) (FVar Ty)) -> + Exp WithoutObjects Ty (Var (BVar Ty) (FVar Ty)) + mkInstantiateTyCon t e = doTrace "instantiateTyCon" msg result + where + result = case analyzeTyApp t of + Just (_, tyArgs) -> foldr TyInstE e (reverse tyArgs) + Nothing -> e + + resTy = expTy id result + + msg = + prettify + [ "INPUT TY:\n" <> prettyStr t + , "INPUT EXPR:\n" <> prettyStr e + , "INPUT EXPR TY:\n" <> prettyStr (expTy id e) + , "OUTPUT TY:\n" <> prettyStr resTy + , "OUTPUT:\n" <> prettyStr result + ] + {- This is a bit weird. If the alt body type is already quantified then we don't want to + do any instantiations. TODO: Explain why (kind of complicated) + -} + mkInstantiateResTy :: Ty -> Ty -> Ty + mkInstantiateResTy _ altT@(Forall {}) = doTrace "instantiateResTy" ("UNCHANGED:\n" <> prettyStr altT) altT + mkInstantiateResTy scrutT altT = doTrace "instantiateResTy" msg result + where + result = case analyzeTyApp scrutT of + Just (_, tyArgs) -> foldr instTy (quantify altT) (reverse tyArgs) + Nothing -> altT + msg = + prettify + [ "INPUT SCRUT TY:\n" <> prettyStr scrutT + , "INPUT TARG TY:\n" <> prettyStr altT + , "OUTPUT TY:\n" <> prettyStr result + ] + + mkIndexedBranch :: + Ty -> + Alt WithoutObjects Ty (Exp WithoutObjects Ty) (Var (BVar Ty) (FVar Ty)) -> + PlutusContext (Int, Exp WithoutObjects Ty (Var (BVar Ty) (FVar Ty))) + mkIndexedBranch scrutTy alte@(UnguardedAlt (ConP tn cn binders) rhs) = do + doTraceM "mkIndexedBranch" ("INPUT:\n" <> prettyStr alte) + let go (x, t) acc = case x of + VarP bvId bvIx bvTy' -> do + let lamBV = BVar bvIx bvTy' bvId + pure $ + LamE lamBV + . abstract (\case F fv -> matchVarLamAbs bvId bvIx fv; B _ -> Nothing) + . acc + WildP -> do + freshIx <- next + let newName = "_t" <> T.pack (show freshIx) + lamBv = BVar freshIx t (Ident newName) + pure $ LamE lamBv . toScope . fmap F . acc + other -> error $ "Unexpected pattern in alternative: Expected a VarP but got " <> show other + monoFields = snd $ monoCtorFields tn cn scrutTy datatypes + doTraceM "mkIndexedBranch" ("MONO FIELDS:\n" <> prettyStr monoFields) + lambdaLHS <- foldrM go id (zip binders monoFields) + let indx = case fst <$> getConstructorIndexAndDecl cn datatypes of + Left _ -> error $ "No constructor data for ctor " <> show cn + Right i -> i + rhsUnscoped = toExp rhs + result = lambdaLHS rhsUnscoped + doTraceM "mkIndexedBranch" ("RESULT:\n" <> prettyStr result) + pure (indx, result) + mkIndexedBranch _ (UnguardedAlt otherP _) = error $ "mkIndexedBranch: Expected constructor pattern but got " <> prettyStr otherP + +instantiateCtors :: Datatypes IR.Kind Ty -> Exp WithoutObjects Ty (Var (BVar Ty) (FVar Ty)) -> Exp WithoutObjects Ty (Var (BVar Ty) (FVar Ty)) +instantiateCtors dt = transform (instantiateCtor dt) + +instantiateCtor :: + Datatypes IR.Kind Ty -> + Exp WithoutObjects Ty (Var (BVar Ty) (FVar Ty)) -> + Exp WithoutObjects Ty (Var (BVar Ty) (FVar Ty)) +instantiateCtor datatypes expr = case expr of + AppE fe ae -> case unsafeAnalyzeApp (AppE fe ae) of + (V (F (FVar t n)), args) + | isConstructor n -> + let ctorNm :: Qualified (ProperName 'ConstructorName) + ctorNm = ProperName . runIdent <$> n + + tyNm = case lookupCtorType n datatypes of + Nothing -> + error $ + "instantiateCtor: No type information for constructor: " + <> prettyQI n + Just tn -> tn + monoFields = monoCtorInst tyNm ctorNm (funResultTy t) datatypes + fe' = foldr TyInstE fe monoFields + result = foldl' AppE fe' args + msg = + prettify + [ "NAME:" <> T.unpack (showQualified runIdent n) + , "MONO TYPE:\n" <> prettyStr t + , "INPUT:\n" <> prettyStr expr + , "RESULT:\n" <> prettyStr result + , "MONO FIELDS:\n" <> prettyStr monoFields + , "INSTANTIATED FUN:\n" <> prettyStr fe' + ] + in doTrace "instantiateCtor" msg result + _ -> expr + _ -> expr + +instantiateNullaryWithAnnotatedType :: + forall x. + Datatypes IR.Kind Ty -> + Exp x Ty (Vars Ty) -> + Exp x Ty (Vars Ty) +instantiateNullaryWithAnnotatedType datatypes _e = doTrace "instantiateNullaryWithAnnotatedType" msg result + where + msg = + prettify + [ "INPUT:\n" <> prettyStr _e + , "OUTPUT:\n" <> prettyStr result + ] + result = transform go _e + go :: + Exp x Ty (Vars Ty) -> + Exp x Ty (Vars Ty) + go expr = case expr of + V (F (FVar ty nm)) + | isConstructor nm -> + let cnm = ProperName . runIdent <$> nm + ctorDecl = either error snd $ getConstructorIndexAndDecl cnm datatypes + in case ctorDecl ^. cdCtorFields of + [] -> case analyzeTyApp ty of + Just (_, xs@(_ : _)) -> foldr TyInstE expr (reverse xs) + _ -> expr + _ -> expr + _ -> expr + +monoCtorInst :: + Qualified (ProperName 'TypeName) -> + Qualified (ProperName 'ConstructorName) -> + Ty -> -- the type of the scrutinee + Datatypes IR.Kind Ty -> + [Ty] -- Constructor index & list of field types +monoCtorInst tn cn t datatypes = doTrace "monoCtorInst" msg $ snd <$> reverse instantiations + where + msg = + "TYPE NAME:" + <> T.unpack (showQualified runProperName tn) + <> "CTOR NAME:\n" + <> T.unpack (showQualified runProperName cn) + <> "MONO IN TYPE:\n" + <> prettyStr t + <> "CTOR DECL ARGS:\n" + <> prettyStr ctorArgs + <> "POLY TY:\n" + <> prettyStr polyTy + <> "INSTANTIATIONS:\n" + <> prettyStr instantiations + (_, thisCtorDecl) = either error id $ getConstructorIndexAndDecl cn datatypes + ctorArgs = snd <$> thisCtorDecl ^. cdCtorFields + thisDataDecl = fromJust $ lookupDataDecl tn datatypes + declArgVars = uncurry IR.TyVar <$> thisDataDecl ^. dDataArgs + dataTyCon = TyCon tn + polyTy = foldl' applyType dataTyCon declArgVars + + instantiations = getInstantiations t polyTy + +{- Given a scrutinee type and enough information to uniquely identify a constructor (so as to + retrieve its data declaration), return the index of the constructor and its instantiated arguments. + + This is used, primarily, to ensure that the annotations attached to Var patterns are correctly instantiated to the + type of the scrutinee they serve as matchers for. +-} +monoCtorFields :: + Qualified (ProperName 'TypeName) -> + Qualified (ProperName 'ConstructorName) -> + Ty -> -- the type of the scrutinee + Datatypes IR.Kind Ty -> + (Int, [Ty]) -- Constructor index & list of field types +monoCtorFields tn cn t datatypes = doTrace "monoCtorFields" msg (thisCtorIx, monoCtorArgs) + where + msg = + prettify + [ "TYPE NAME:" <> T.unpack (showQualified runProperName tn) + , "CTOR NAME:\n" <> T.unpack (showQualified runProperName cn) + , "MONO IN TYPE:\n" <> prettyStr t + , "CTOR DECL ARGS:\n" <> prettyStr ctorArgs + , "POLY TY:\n" <> prettyStr polyTy + , "RESULT TYS:\n" <> prettyStr monoCtorArgs + , "INSTANTIATIONS:\n" <> prettyStr instantiations + ] + (thisCtorIx, thisCtorDecl) = either error id $ getConstructorIndexAndDecl cn datatypes + ctorArgs = snd <$> thisCtorDecl ^. cdCtorFields + thisDataDecl = fromJust $ lookupDataDecl tn datatypes + declArgVars = uncurry IR.TyVar <$> thisDataDecl ^. dDataArgs + dataTyCon = TyCon tn + polyTy = foldl' applyType dataTyCon declArgVars + polyCtorTy = foldr funTy polyTy ctorArgs + instantiations = getInstantiations t polyTy + -- This might not be exactly correct, it assumes that NO tyvars remain in the input type. + -- If any remain, they might not line up with the var names in the declaration (probably won't + -- since I think I generated the decl vars). Might require tweaking "instantiates" & co + monoCtorTy = replaceAllTypeVars instantiations polyCtorTy + -- if it's a unary constructor, we want to skip the error from funArgTypes being partial + monoCtorArgs = safeFunArgTypes monoCtorTy + +{- + +Variables bound in patterns contain type annotations in those patterns. We generally ignore those annotations +in previous compiler passes, as they do not matter there. Here, we need to ensure that the annotations are correct +so that the constructor pattern desugaring works as intended & the lambdas introduced there have the correct types. + +An example might be helpful. If we have + +``` +case (x :: Maybe Int) of + Just y -> f y + Nothing -> (...) +``` + +The `y` in pattern position there there may have a (hidden/internal) annotation like +`Maybe a`. We need to force that `a` to `Int`, which is simple enough with some unification, +provided that we have access to the data declaration for `Maybe`. +-} +monomorphizePatterns :: + Datatypes IR.Kind Ty -> + Exp WithoutObjects Ty (Var (BVar Ty) (FVar Ty)) -> + Exp WithoutObjects Ty (Var (BVar Ty) (FVar Ty)) +monomorphizePatterns datatypes _e' = case _e' of + CaseE resTy scrut alts -> + let scrutTy = expTy id scrut + alts' = goAlt scrutTy <$> alts -- REVIEW: Why do we do this twice? Was there a reason or is this just a mistake? + res = CaseE resTy scrut $ goAlt scrutTy <$> alts' + in doTrace "monomorphizePatterns" ("INPUT:\n" <> prettyStr _e' <> "RESULT:\n" <> prettyStr res) res + other -> other + where + monomorphPat :: + Ty -> + Pat WithoutObjects Ty (Exp WithoutObjects Ty) (Var (BVar Ty) (FVar Ty)) -> + Pat WithoutObjects Ty (Exp WithoutObjects Ty) (Var (BVar Ty) (FVar Ty)) + monomorphPat t = \case + VarP idnt indx _ -> VarP idnt indx t + ConP tn cn ps -> + let monoFields = snd $ monoCtorFields tn cn t datatypes + ps' = zipWith monomorphPat monoFields ps + in ConP tn cn ps' + other -> other + + rebindPat :: + Pat WithoutObjects Ty (Exp WithoutObjects Ty) (Var (BVar Ty) (FVar Ty)) -> + Scope (BVar Ty) (Exp WithoutObjects Ty) (Var (BVar Ty) (FVar Ty)) -> + Scope (BVar Ty) (Exp WithoutObjects Ty) (Var (BVar Ty) (FVar Ty)) + rebindPat p e = + let upd idnt indx t = + mapBound (\bv@(BVar bvix _ bvidnt) -> if idnt == bvidnt && indx == bvix then BVar bvix t bvidnt else bv) + . fmap + ( \case + bv@(B (BVar bvix _ bvidnt)) -> if idnt == bvidnt && indx == bvix then B (BVar bvix t bvidnt) else bv + other -> other + ) + in case p of + VarP vpId vpIx vpTy -> upd vpId vpIx vpTy e + ConP _ _ ps' -> foldl' (flip rebindPat) e ps' + _ -> e + + goAlt :: + Ty -> + Alt WithoutObjects Ty (Exp WithoutObjects Ty) (Var (BVar Ty) (FVar Ty)) -> + Alt WithoutObjects Ty (Exp WithoutObjects Ty) (Var (BVar Ty) (FVar Ty)) + goAlt scrutTy (UnguardedAlt p e) = + let p' = monomorphPat scrutTy p + e' = rebindPat p' e + in UnguardedAlt p' e' + +desugarLiteralPatterns :: + Exp WithoutObjects Ty (Var (BVar Ty) (FVar Ty)) -> + Exp WithoutObjects Ty (Var (BVar Ty) (FVar Ty)) +desugarLiteralPatterns = transform desugarLiteralPattern + +desugarLiteralPattern :: + Exp WithoutObjects Ty (Var (BVar Ty) (FVar Ty)) -> + Exp WithoutObjects Ty (Var (BVar Ty) (FVar Ty)) +desugarLiteralPattern = \case + CaseE resTy scrut (UnguardedAlt (LitP patLit) rhs : alts) -> + let eqTest = mkEqTestFun scrut patLit + trueP = ConP C.Boolean C.C_True [] + falseP = ConP C.Boolean C.C_False [] + rest = fromExp $ desugarLiteralPattern (CaseE resTy scrut alts) + in CaseE + resTy + eqTest + [ UnguardedAlt trueP rhs + , UnguardedAlt falseP rest + ] + CaseE _ _ (UnguardedAlt WildP rhs : _) -> toExp rhs -- FIXME: Wrong! Need to do the same + -- catchall stuff we do in the ctor + -- case eliminator + -- NOTE (8/28): I'm not sure if the previous FIXME still matters? + CaseE _ scrut (UnguardedAlt (VarP bvId bvIx _) rhs : _) -> flip instantiate rhs $ \case + bv@(BVar bvIx' _ bvId') -> + if bvIx == bvIx' && bvId == bvId' + then scrut + else V . B $ bv + other -> other + where + eqInt = + V . F $ + FVar + (TyCon C.Int :~> TyCon C.Int :~> TyCon C.Boolean) + C.I_equalsInteger + + eqChar = eqInt + eqString = + V . F $ + FVar + (TyCon C.Int :~> TyCon C.Int :~> TyCon C.Boolean) + C.I_equalsString + + mkEqTestFun :: + Exp WithoutObjects Ty (Var (BVar Ty) (FVar Ty)) -> + Lit WithoutObjects (Pat WithoutObjects Ty (Exp WithoutObjects Ty) (Var (BVar Ty) (FVar Ty))) -> + Exp WithoutObjects Ty (Var (BVar Ty) (FVar Ty)) + mkEqTestFun scrut = \case + IntL i -> eqInt `AppE` LitE (TyCon C.Int) (IntL i) `AppE` scrut + CharL c -> eqChar `AppE` LitE (TyCon C.Char) (CharL c) `AppE` scrut + StringL s -> eqString `AppE` LitE (TyCon C.String) (StringL s) `AppE` scrut + +-- This is for case expressions where the first alternative contains an irrefutable pattern (WildP, VarP) +-- (we need this b/c the other two won't catch and eliminate those expressions) +desugarIrrefutables :: + Exp WithoutObjects Ty (Var (BVar Ty) (FVar Ty)) -> + Exp WithoutObjects Ty (Var (BVar Ty) (FVar Ty)) +desugarIrrefutables = transform $ \case + CaseE _ _ (UnguardedAlt WildP rhs : _) -> toExp rhs + CaseE _ scrut (UnguardedAlt (VarP bvId bvIx _) rhs : _) -> flip instantiate rhs $ \case + bv@(BVar bvIx' _ bvId') -> + if bvIx == bvIx' && bvId == bvId' + then scrut + else V . B $ bv + other -> other + +data CtorCase = CtorCase + { irrefutableRHS :: Exp WithoutObjects Ty (Var (BVar Ty) (FVar Ty)) + , indexedMatchArgs :: M.Map Int (Exp WithoutObjects Ty (Var (BVar Ty) (FVar Ty))) + , -- The destructor fun initially, then the application of that fun to its args + acc :: Exp WithoutObjects Ty (Var (BVar Ty) (FVar Ty)) + , scrutType :: Ty + } + +-- I think we can replace this with Language.Purus.Pipeline.Instantiate.instantiateTypes but I'm terrified to +-- change anything now that the compiler seems to work.... +-- FIXME/REVIEW: I don't think we'll have to do this anymore if we re-instantiate after object desugaring. I should test this. +ezMonomorphize :: + Exp WithoutObjects Ty (Var (BVar Ty) (FVar Ty)) -> + Exp WithoutObjects Ty (Var (BVar Ty) (FVar Ty)) +ezMonomorphize = transform go + where + go expr = case expr of + AppE fe ae -> case unsafeAnalyzeApp (AppE fe ae) of + (f, args) -> case expTy id f of + ft@Forall {} -> case getAllInstantiations ft (expTy id <$> args) of + [] -> expr + instantiations' -> + let instantiations = reverse (snd <$> instantiations') + f' = foldr TyInstE f instantiations + result = foldl' AppE f' args + msg = + prettify + [ "INPUT:\n" <> prettyStr expr + , "OUTPUT:\n" + , prettyStr result + ] + in doTrace "ezMonomorphize" msg result + ft -> + let msg = + prettify + [ "NO CHANGE (NOT A FORALL):" + , "FUN TY:\n" <> prettyStr ft + , "ARG TYPES:\n" <> prettyStr (expTy id <$> args) + , "ORIGINAL EXPR:\n" <> prettyStr expr + ] + in doTrace "ezMonomorphize" msg expr + _ -> expr -- doTrace "ezMonomorphize" ("" <> prettyStr expr) expr diff --git a/src/Language/Purus/Pipeline/GenerateDatatypes.hs b/src/Language/Purus/Pipeline/GenerateDatatypes.hs new file mode 100644 index 000000000..b10d2476f --- /dev/null +++ b/src/Language/Purus/Pipeline/GenerateDatatypes.hs @@ -0,0 +1,233 @@ +{- Generates the PIR Datatype declarations which must be let- bound in order for + our modules to compile. +-} +{-# LANGUAGE GADTs #-} +{-# LANGUAGE PolyKinds #-} +{-# OPTIONS_GHC -Wno-orphans #-} + +module Language.Purus.Pipeline.GenerateDatatypes ( + generateDatatypes, + toPIRType, + mkKind, +) where + +import Prelude + +import Data.Map qualified as M + +import Data.Set qualified as S + +import Data.Text (Text) +import Data.Text qualified as T + +import Control.Monad.State (modify) +import Data.Foldable (foldl', traverse_) +import Data.Maybe (fromJust, isJust) + +import Language.PureScript.Constants.Prim qualified as C +import Language.PureScript.Constants.Purus qualified as C +import Language.PureScript.CoreFn.Module ( + CtorDecl (..), + Datatypes, + cdCtorFields, + cdCtorName, + dDataArgs, + dDataCtors, + lookupDataDecl, + tyDict, + ) +import Language.PureScript.CoreFn.TypeLike +import Language.PureScript.Environment (pattern (:->)) +import Language.PureScript.Names ( + ProperName (..), + ProperNameType (..), + Qualified (..), + showQualified, + pattern ByThisModuleName, + ) +import Language.PureScript.Types ( + SourceType, + Type (TypeConstructor), + ) + +import Language.Purus.Debug (doTraceM) +import Language.Purus.IR ( + Ty (..), + ppTy, + ) +import Language.Purus.IR qualified as IR +import Language.Purus.Pipeline.GenerateDatatypes.Utils ( + bindTV, + foldr1Err, + getBoundTyVarName, + mkConstrName, + mkNewTyVar, + mkTyName, + prettyQPN, + ) +import Language.Purus.Pipeline.Monad ( + MonadCounter (next), + PlutusContext, + ) +import Language.Purus.Pretty.Common (prettyStr) +import Language.Purus.Pretty.Types (prettyTypeStr) +import Language.Purus.Types (PIRType, destructors, pirDatatypes) + +import PlutusCore qualified as PLC +import PlutusIR ( + TyVarDecl (TyVarDecl), + Type (TyBuiltin, TyForall), + VarDecl (VarDecl), + ) +import PlutusIR qualified as PIR + +import Control.Lens ( + over, + to, + (^.), + ) +import Control.Monad.Except ( + MonadError (throwError), + ) + +{- Generates PIR datatypes declarations for all of the datatypes in scope + in the Main module we are compiling and adds them to the monadic context for use + by the subsequent passes. + + We are using PIR's datatype encodings, so we need to do this to ensure that + all possibly-used datatypes are available for case desugaring (which references + the destructors for those datatypes), and so that CompileToPIR can let- bind them + in the outermost scope of the main expression. + + This does strictly more work than it needs to, since we could get away with generating + only declarations for the types directly mentioned in the expression and the recursive + dependencies of those types. However, PIR removes unused datatype declarations (seemingly + with 100% reliability?), so being lazy here doesn't have that much of an impact + (unless we're reading our traces -_-) + +-} +generateDatatypes :: + Datatypes IR.Kind Ty -> + PlutusContext () +generateDatatypes datatypes = mkPIRDatatypes datatypes allTypeConstructors + where + allTypeConstructors :: S.Set (Qualified (ProperName 'TypeName)) + allTypeConstructors = datatypes ^. tyDict . to M.keys . to S.fromList + +mkPIRDatatypes :: + Datatypes IR.Kind Ty -> + S.Set (Qualified (ProperName 'TypeName)) -> + PlutusContext () +mkPIRDatatypes datatypes tyConsInExp = + doTraceM "mkPIRDatatypes" (show $ S.map prettyQPN tyConsInExp) + >> traverse_ go tyConsInExp + where + -- these things don't have datatype definitions anywhere + truePrimitives = S.fromList [C.Function, C.Int, C.Char, C.String] + + go :: + Qualified (ProperName 'TypeName) -> + PlutusContext () + go qn | qn `S.member` truePrimitives = pure () + go qn@(Qualified _ (ProperName tnm)) = + doTraceM "mkPIRDatatypes" ("go: " <> prettyQPN qn) >> case lookupDataDecl qn datatypes of + Nothing -> + throwError $ + "Error when translating data types to PIR: " + <> "Couldn't find a data type declaration for " + <> T.unpack (showQualified runProperName qn) + Just dDecl -> do + -- TODO: newtypes should probably be newtype-ey + let declArgs = fst <$> dDecl ^. dDataArgs + declKind = mkDeclKind $ mkKind . snd <$> dDecl ^. dDataArgs + doTraceM "mkPIRDatatypes" $ "Decl " <> prettyStr dDecl + doTraceM "mkPIRDatatypes" $ "decl args: " <> show declArgs + tyName <- mkTyName qn + let typeNameDecl = TyVarDecl () tyName declKind + dataArgs = dDecl ^. dDataArgs + argDecls <- traverse mkArgDecl (dDecl ^. dDataArgs) + uniq <- next + let destructorName = PIR.Name ("match_" <> tnm) $ PLC.Unique uniq + modify $ over destructors (M.insert qn destructorName) + ctors <- traverse (mkCtorDecl qn dataArgs) $ zip [0 ..] (dDecl ^. dDataCtors) + let this = PIR.Datatype () typeNameDecl argDecls destructorName ctors + modify $ over pirDatatypes (M.insert qn this) + + mkCtorDecl :: + Qualified (ProperName 'TypeName) -> + [(Text, IR.Kind)] -> + (Int, CtorDecl Ty) -> + PlutusContext (PIR.VarDecl PIR.TyName PIR.Name PLC.DefaultUni ()) + mkCtorDecl qTyName dataArgs (cix, ctorDecl) = + doTraceM "mkCtorDecl" (prettyQPN qTyName) >> do + let ctorFields = snd <$> ctorDecl ^. cdCtorFields + resultTy' = foldl' TyApp (TyCon qTyName) (uncurry TyVar <$> dataArgs) + ctorFunTy :: Ty + ctorFunTy = foldr1Err "mkCtorDecl" funTy (ctorFields <> [resultTy']) + ctorName <- mkConstrName (ctorDecl ^. cdCtorName) cix + ctorFunTyPIR <- toPIRType ctorFunTy + pure $ VarDecl () ctorName ctorFunTyPIR + + mkDeclKind :: [PIR.Kind ()] -> PIR.Kind () + mkDeclKind = \case + [] -> PIR.Type () + xs -> foldr1Err "mkDeclKind" (PIR.KindArrow ()) (xs <> [PIR.Type ()]) + + -- the arguments to the *type*, i.e., they're all tyvars + -- NOTE: We should really make changes such that `Maybe SourceType` is `SourceType` + mkArgDecl :: (Text, IR.Kind) -> PlutusContext (PIR.TyVarDecl PIR.TyName ()) + mkArgDecl (varNm, ki) = do + tyVarNm <- mkNewTyVar varNm + bindTV varNm tyVarNm + pure $ TyVarDecl () tyVarNm (mkKind ki) + +toPIRType :: Ty -> PlutusContext PIRType +toPIRType _ty = case _ty of + IR.TyVar txt _ -> PIR.TyVar () <$> getBoundTyVarName txt + TyCon qtn@(Qualified qb _) -> case qb of + ByThisModuleName "Builtin" -> either throwError pure $ handleBuiltinTy qtn + ByThisModuleName "Prim" | isJust (handlePrimTy qtn) -> pure . fromJust $ handlePrimTy qtn + _ -> do + tyName <- mkTyName qtn + let result = PIR.TyVar () tyName + doTraceM "toPIRType" ("\nINPUT:\n" <> prettyStr _ty <> "\n\nRESULT:\n" <> prettyStr result) + pure result + IR.TyApp t1 t2 -> do + result <- goTypeApp t1 t2 + doTraceM "toPIRType" ("\nINPUT:\n" <> prettyStr _ty <> "\n\nRESULT:\n" <> prettyStr result) + pure result + Forall _ v k ty _ -> do + vTyName <- mkNewTyVar v + bindTV v vTyName + ty' <- toPIRType ty + let result = TyForall () vTyName (mkKind k) ty' + doTraceM "toPIRType" ("\nINPUT:\n" <> prettyStr _ty <> "\n\nRESULT:\n" <> prettyStr result) + pure result + other -> error $ "Upon reflection, other types like " <> ppTy other <> " shouldn't be allowed in the Ty ast" + where + goTypeApp (IR.TyApp (TyCon C.Function) a) b = do + a' <- toPIRType a + b' <- toPIRType b + pure $ PIR.TyFun () a' b' + goTypeApp a b = PIR.TyApp () <$> toPIRType a <*> toPIRType b + +handleBuiltinTy :: Qualified (ProperName 'TypeName) -> Either String (PIR.Type tyname PLC.DefaultUni ()) +handleBuiltinTy = \case + C.BuiltinData -> pure $ TyBuiltin () (PLC.SomeTypeIn PLC.DefaultUniData) + C.BuiltinPair -> pure $ TyBuiltin () (PLC.SomeTypeIn PLC.DefaultUniProtoPair) + C.BuiltinList -> pure $ TyBuiltin () (PLC.SomeTypeIn PLC.DefaultUniProtoList) + C.BuiltinByteString -> pure $ TyBuiltin () (PLC.SomeTypeIn PLC.DefaultUniByteString) + other -> Left $ "Error when translating to PIR types: unsupported builtin type: " <> show other + +handlePrimTy :: Qualified (ProperName 'TypeName) -> Maybe (PLC.Type tyname PLC.DefaultUni ()) +handlePrimTy = \case + C.String -> pure $ TyBuiltin () (PLC.SomeTypeIn PLC.DefaultUniString) + C.Char -> pure $ TyBuiltin () (PLC.SomeTypeIn PLC.DefaultUniInteger) + C.Int -> pure $ TyBuiltin () (PLC.SomeTypeIn PLC.DefaultUniInteger) + C.Unit -> pure $ TyBuiltin () (PLC.SomeTypeIn PLC.DefaultUniUnit) + _ -> Nothing + +mkKind :: IR.Kind -> PIR.Kind () +mkKind = \case + IR.KindType -> PIR.Type () + IR.KindArrow k1 k2 -> PIR.KindArrow () (mkKind k1) (mkKind k2) diff --git a/src/Language/Purus/Pipeline/GenerateDatatypes/Utils.hs b/src/Language/Purus/Pipeline/GenerateDatatypes/Utils.hs new file mode 100644 index 000000000..49611b406 --- /dev/null +++ b/src/Language/Purus/Pipeline/GenerateDatatypes/Utils.hs @@ -0,0 +1,180 @@ +{-# OPTIONS_GHC -Wno-orphans #-} + +module Language.Purus.Pipeline.GenerateDatatypes.Utils ( + bindTV, + getConstructorName, + analyzeTyApp, + foldr1Err, + freshName, + funResultTy, + getDestructorTy, + prettyQI, + prettyQPN, + getBoundTyVarName, + mkConstrName, + mkNewTyVar, + mkTyName, + note, +) where + +import Prelude + +import Data.Map qualified as M +import Data.Text (Text) +import Data.Text qualified as T + +import Control.Monad.State (gets, modify) +import Debug.Trace (traceM) + +import Language.PureScript.CoreFn.TypeLike +import Language.PureScript.Names ( + Ident (..), + ProperName (..), + ProperNameType (..), + Qualified (..), + disqualify, + runIdent, + showIdent, + showQualified, + ) + +import Language.Purus.Debug (doTraceM) +import Language.Purus.IR ( + Ty (..), + ) +import Language.Purus.IR qualified as IR +import Language.Purus.Pipeline.Monad ( + MonadCounter (next), + PlutusContext, + ) +import Language.Purus.Types ( + DatatypeDictionary (_tyVars), + constrNames, + destructors, + tyNames, + tyVars, + ) + +import PlutusCore qualified as PLC +import PlutusIR ( + Name (Name), + TyName, + ) +import PlutusIR qualified as PIR + +import Control.Lens ( + at, + folded, + over, + view, + (^?), + _1, + ) +import Control.Monad.Except ( + MonadError (throwError), + ) +import Prettyprinter (Pretty (..)) +import System.Random (mkStdGen, randomR) + +foldr1Err :: (Foldable t) => String -> (a -> a -> a) -> t a -> a +foldr1Err msg f ta + | null ta = error msg + | otherwise = foldr1 f ta + +pseudoRandomChar :: Int -> Char +pseudoRandomChar i = fst $ randomR ('a', 'z') (mkStdGen i) + +mkTyName :: Qualified (ProperName 'TypeName) -> PlutusContext PIR.TyName +mkTyName qn = + doTraceM "mkTyName" (prettyQPN qn) >> gets (view tyNames) >>= \tnames -> case M.lookup qn tnames of + Just tyname -> pure tyname + Nothing -> do + uniq <- next + let tyname = PIR.TyName $ Name (runProperName . disqualify $ qn) $ PLC.Unique uniq + modify $ over tyNames (M.insert qn tyname) + pure tyname + +mkConstrName :: Qualified Ident -> Int -> PlutusContext PIR.Name +mkConstrName qi cix = + doTraceM "mkConstrName" (prettyQI qi) >> gets (view constrNames) >>= \cnames -> case M.lookup qi cnames of + Just cname -> pure $ fst cname + Nothing -> do + uniq <- next + let nm = Name (showIdent . disqualify $ qi) $ PLC.Unique uniq + modify $ over constrNames (M.insert qi (nm, cix)) + pure nm + +-- | Only gives you a TyName, doesn't insert anything into the context +mkNewTyVar :: Text -> PlutusContext TyName +mkNewTyVar nm = + doTraceM "mkNewTyVar" (T.unpack nm) >> do + uniq <- next + pure . PIR.TyName $ PIR.Name nm $ PLC.Unique uniq + +freshName :: PlutusContext PIR.Name +freshName = do + uniq <- next + let c = pseudoRandomChar uniq + let nm = T.pack (c : '#' : show uniq) + pure $ PIR.Name nm (PLC.Unique uniq) + +getBoundTyVarName :: Text -> PlutusContext PIR.TyName +getBoundTyVarName nm = + doTraceM "mkBoundTyVarName" (T.unpack nm) >> do + boundTyVars <- gets _tyVars + case M.lookup nm boundTyVars of + Just tyName -> pure tyName + Nothing -> error $ "Free type variable in IR: " <> T.unpack nm + +bindTV :: Text -> PIR.TyName -> PlutusContext () +bindTV txt nm = modify $ over tyVars (M.insert txt nm) + +note :: String -> Maybe a -> PlutusContext a +note msg = maybe (throwError msg) pure + +getDestructorTy :: Qualified (ProperName 'TypeName) -> PlutusContext PLC.Name +getDestructorTy qn = do + dctors <- gets (view destructors) + case M.lookup qn dctors of + Nothing -> + throwError $ + "No destructor defined for datatype " + <> T.unpack (showQualified runProperName qn) + <> ". This indicates a compiler bug (datatype declaration not generated)" + Just dctor -> pure dctor + +getConstructorName :: Qualified Ident -> PlutusContext (Maybe PLC.Name) +getConstructorName qi = + doTraceM "getConstructorName" (show qi) >> do + ctors <- gets (view constrNames) + traceM $ show ctors + pure $ ctors ^? at qi . folded . _1 + +prettyQPN :: Qualified (ProperName 'TypeName) -> String +prettyQPN = T.unpack . showQualified runProperName + +instance Pretty (Qualified (ProperName 'TypeName)) where + pretty = pretty . prettyQPN + +prettyQI :: Qualified Ident -> String +prettyQI = T.unpack . showQualified runIdent + +instance Pretty (Qualified Ident) where + pretty = pretty . prettyQI + +funResultTy :: (TypeLike t) => t -> t +funResultTy = last . splitFunTyParts + +analyzeTyApp :: Ty -> Maybe (Ty, [Ty]) +analyzeTyApp t = (,tyAppArgs t) <$> tyAppFun t + where + tyAppArgs (IR.TyApp t1 t2) = tyAppArgs t1 <> [t2] + tyAppArgs _ = [] + + tyAppFun (IR.TyApp tF _) = go tF + where + go (IR.TyApp tX _) = case tyAppFun tX of + Nothing -> Just tX + Just tX' -> Just tX' + go other = Just other + tyAppFun _ = Nothing diff --git a/src/Language/Purus/Pipeline/Inline.hs b/src/Language/Purus/Pipeline/Inline.hs new file mode 100644 index 000000000..85c26e0d3 --- /dev/null +++ b/src/Language/Purus/Pipeline/Inline.hs @@ -0,0 +1,458 @@ +module Language.Purus.Pipeline.Inline (inline) where + +import Prelude + +import Data.Map (Map) +import Data.Map qualified as M + +import Data.Set (Set) +import Data.Set qualified as S + +import Data.Text qualified as T + +import Data.Maybe (mapMaybe) + +import Control.Monad.State ( + MonadState (get, put), + State, + evalState, + execState, + unless, + void, + when, + ) + +import Data.Foldable (find, maximumBy) + +import Language.PureScript.Constants.Prim qualified as C +import Language.PureScript.CoreFn.Expr (PurusType) +import Language.PureScript.CoreFn.FromJSON () +import Language.PureScript.Environment (pattern RecordT) + +-- for the instance +import Language.PureScript.Names ( + Ident (GenIdent, Ident), + runIdent, + ) +import Language.PureScript.Types ( + Type ( + KindedType, + RCons, + REmpty, + TypeApp, + TypeConstructor, + TypeVar + ), + freeTypeVariables, + isMonoType, + ) + +import Language.Purus.Debug (doTrace, doTraceM, prettify) +import Language.Purus.IR ( + BVar (..), + BindE (..), + Exp (..), + expTy, + expTy', + unsafeAnalyzeApp, + ) +import Language.Purus.IR.Utils ( + Vars, + allDeclIdentifiers, + containsBVar, + deepMapMaybeBound, + flatBinds, + foldBinds, + isConstructorE, + mapBind, + mkBVar, + stripSkolems, + toExp, + transformTypesInExp, + traverseAlt, + traverseBind, + unBVar, + viaExp, + viaExpM, + ) +import Language.Purus.Pipeline.Inline.Types ( + InlineBodyData (..), + LoopBreaker (..), + LoopBreakerScore (..), + getInlineBody, + notALoopBreaker, + traverseBodyData, + ) +import Language.Purus.Pipeline.Lift.Types ( + Hole (Hole), + LiftResult (LiftResult), + MonoBind, + MonoExp, + MonoScoped, + toHole, + unHole, + pattern LiftedHole, + ) +import Language.Purus.Pipeline.Monad (Inline, MonadCounter (next)) +import Language.Purus.Pretty.Common (prettyStr) + +import Algebra.Graph.AdjacencyMap ( + AdjacencyMap (..), + edgeList, + edges, + gmap, + stars, + vertexList, + vertexSet, + ) +import Algebra.Graph.AdjacencyMap.Algorithm (Cycle, scc, topSort) +import Algebra.Graph.NonEmpty.AdjacencyMap (fromNonEmpty) + +import Control.Lens.Combinators (at, cosmos, transformM) +import Control.Lens.Operators ((.=), (^..)) + +import Bound (Var (..)) +import Bound.Scope (abstract) + +import Prettyprinter ( + Pretty (pretty), + align, + hardline, + vcat, + (<+>), + ) + +inline :: LiftResult -> Inline MonoExp +inline (LiftResult decls bodyE) = do + declsPrepared <- inlineInLifted decls + let plugHoles :: forall (f :: * -> *). (Functor f) => f (Vars PurusType) -> f (Vars PurusType) + plugHoles = fmap $ \case + F (LiftedHole hNm hIndx hTy) -> B (BVar (fromInteger hIndx) hTy (Ident hNm)) + other -> other + + inlinedBodyE = + abstract (\case B bv -> Just bv; _ -> Nothing) + . plugHoles + . inlineWithData' declsPrepared + $ bodyE + onlyLoopBreakers = + M.foldlWithKey' + ( \acc (n, i) v -> case v of + IsALoopBreaker (plugHoles -> b) -> + NonRecursive n i b : acc + _ -> acc + ) + [] + declsPrepared + flatLB = M.toList $ flatBinds onlyLoopBreakers + declsSelfRecHandled <- + map (\((n, i), b) -> NonRecursive n i b) + . M.toList + . M.unions + <$> traverse (uncurry handleSelfRecursive) flatLB + cleanup declsSelfRecHandled inlinedBodyE + where + {- If we just returned the set of lifted declarations as-is, they might have + ill-formed types. In particular, they may have out of scope type variables + (which were in scope in the context that they were originally defined). + + To fix this, we need to introduce type abstractions for any loop breakers that + haven't been inlined & update the types of those declarations in both their + lifted peers & in the body of the "main" expression being compiled. + + We are warranted in deferring these abstractions until this stage (and indeed + need to do so in order to avoid an ocean of superfluous abstractions and instantiations) + by the fact that a lifted declaration will always be inlined into a context where + those free type variables are well-scoped (since the definition context always contains + the call-site contexts). But we have to do it now, or PIR will yell at us. + + As a NOTE to myself: Here, all of the "holes" have been filled, so the variables we need to + update are BVars, not "Hole-ey" FVars. + -} + cleanup :: [MonoBind] -> MonoScoped -> Inline MonoExp + cleanup [] body = pure $ toExp body + cleanup breakers body = do + abstracted <- addTypeAbstractions breakers + let newTypeDict = foldBinds (\acc nm b -> M.insert nm (expTy' id b) acc) M.empty abstracted + updateTypes = deepMapMaybeBound $ \(unBVar -> bv) -> case M.lookup bv newTypeDict of + Nothing -> Nothing + Just t -> Just $ uncurry mkBVar bv t + finalDecls = mapBind (const $ viaExp updateTypes) <$> abstracted + finalBody = viaExp updateTypes body + case finalDecls of + [] -> pure . toExp $ finalBody + _ -> pure $ LetE finalDecls finalBody + + addTypeAbstractions :: [MonoBind] -> Inline [MonoBind] + addTypeAbstractions = traverse (traverseBind (const go)) + where + go :: MonoScoped -> Inline MonoScoped + go = viaExpM $ \e -> do + let e' = transformTypesInExp stripSkolems e + t = expTy id e' + free = freeTypeVariables t + bvars <- traverse (\(nm, ki) -> next >>= \u -> pure $ BVar u ki (Ident nm)) free + let result = foldr TyAbs e' bvars + msg = + prettify + [ "INPUT EXPR:\n" <> prettyStr e + , "INPUT EXPR TY:\n" <> prettyStr t <> "\n\n" <> show (void t) + , "FREE TY VARS IN INPUT:\n" <> prettyStr free + , "RESULT:\n" <> prettyStr result + , "RESULT TY:\n" <> prettyStr (expTy id result) + ] + doTraceM "addTypeAbstractions" msg + pure result + +-- sorry koz. in my heart i know you're right about type synonyms, but... +type InlineState a = State (Map (Ident, Int) InlineBodyData) a + +inlineWithData' :: Map (Ident, Int) InlineBodyData -> MonoExp -> MonoExp +inlineWithData' d e = evalState (inlineWithData e) d + +handleSelfRecursive :: (Ident, Int) -> MonoScoped -> Inline (Map (Ident, Int) MonoScoped) +handleSelfRecursive (nm, indx) body + | not (containsBVar nm indx body) = pure $ M.singleton (nm, indx) body + | otherwise = do + u <- next + let uTxt = T.pack (show u) + newNm = case nm of + Ident t -> Ident $ t <> "$" <> uTxt + GenIdent (Just t) i -> GenIdent (Just $ t <> "$" <> uTxt) i -- we only care about a unique ord property for the maps + GenIdent Nothing i -> GenIdent (Just $ "$" <> uTxt) i + other -> other + bodyTy = expTy' id body + f = \case + (BVar bvIx bvTy bvNm) -> + if bvIx == indx && bvNm == nm + then Just (BVar u bvTy newNm) + else Nothing + updatedOriginalBody = viaExp (deepMapMaybeBound f) body + updatedOriginalDecl = ((nm, indx), updatedOriginalBody) + abstr = abstract $ \case B bv -> Just bv; _ -> Nothing + newBreakerDecl = ((newNm, u), abstr . V . B $ BVar indx bodyTy nm) + pure $ M.fromList [updatedOriginalDecl, newBreakerDecl] + +inlineWithData :: MonoExp -> InlineState MonoExp +inlineWithData = transformM go'' + where + go'' ex = do + res <- go ex + let msg = prettify ["INPUT:\n" <> prettyStr ex, "RESULT:\n" <> prettyStr res] + doTraceM "inlineWithData" msg + pure res + go :: MonoExp -> InlineState MonoExp + go ex = + get >>= \dict -> case ex of + fv@(V (F {})) -> case toHole fv of + Just (Hole hId hIx _) -> case M.lookup (hId, hIx) dict of + Just (NotALoopBreaker (toExp -> e)) -> do + let msg = + prettify + [ "INPUT:\n" <> prettyStr fv + , "RESULT:\n" <> prettyStr e + ] + doTraceM "inlineWithData" msg + pure e + _ -> pure fv + _ -> pure fv + V b@B {} -> pure $ V b + AppE e1 e2 -> AppE <$> go e1 <*> go e2 + CaseE t scrut alts -> do + scrut' <- go scrut + alts' <- traverse (traverseAlt (viaExpM go)) alts + pure $ CaseE t scrut' alts' + LamE bv body -> LamE bv <$> viaExpM go body + LetE decls body -> do + decls' <- traverse (traverseBind (\_ b -> viaExpM go b)) decls + body' <- viaExpM go body + pure $ LetE decls' body' + AccessorE x t pss e -> AccessorE x t pss <$> go e + ObjectUpdateE x t e cf fs -> + (\e' fs' -> ObjectUpdateE x t e' cf fs') + <$> go e + <*> traverse (traverse go) fs + LitE t lit -> LitE t <$> traverse go lit + TyInstE t e -> TyInstE t <$> go e + TyAbs bv e -> TyAbs bv <$> go e + +doneInlining :: MonoExp -> InlineState Bool +doneInlining me = do + dct <- get + let allInlineable = M.keysSet $ M.filter notALoopBreaker dct + allHoles = S.fromList $ mapMaybe (fmap unHole . toHole) (me ^.. cosmos) + result = S.null $ S.intersection allHoles allInlineable + msg = + prettify + [ "Input Expr:\n" <> prettyStr me + , "All Inlineable Vars:\n" <> prettyStr (S.toList allInlineable) + , "All Holes in expr:\n" <> prettyStr (S.toList allHoles) + , "Not yet inlined:\n" <> prettyStr (S.toList $ S.intersection allHoles allInlineable) + , "Are we done?: " <> show result + ] + doTraceM "doneInlining" msg + pure result + +prettyDict :: Map (Ident, Int) InlineBodyData -> String +prettyDict = + show + . align + . vcat + . map (\((i, n), b) -> pretty (runIdent i) <+> "#" <+> pretty n <+> "=" <+> pretty (toExp $ getInlineBody b) <+> hardline) + . M.toList + +inlineInLifted :: [MonoBind] -> Inline (Map (Ident, Int) InlineBodyData) +inlineInLifted decls = do + let breakers = S.map getLoopBreaker . breakLoops $ allLiftedDependencies + dict = + foldBinds + ( \acc nm b -> + if nm `S.member` breakers + then M.insert nm (IsALoopBreaker b) acc + else M.insert nm (NotALoopBreaker b) acc + ) + M.empty + decls + let res = flip execState dict $ update [] (M.keys dict) + msg = prettify ["Input:\n" <> prettyStr decls, "Result:\n" <> prettyDict res, "Breakers:\n" <> prettyStr (S.toList breakers)] + doTraceM "inlineLifted" msg + pure res + where + update :: [(Ident, Int)] -> [(Ident, Int)] -> InlineState () + update [] [] = pure () + update retry [] = do + let msg = "RETRY:\n" <> prettyStr retry + doTraceM "update" msg + update [] retry + update retry (i : is) = do + doTraceM "update" (prettify ["GO", "RETRY STACK:\n" <> prettyStr retry, "ACTIVE STACK:\n" <> prettyStr (i : is)]) + s <- get + let e = s M.! i + done1 <- doneInlining . toExp . getInlineBody $ e + unless done1 $ do + e' <- go e + at i .= Just e' + update (i : retry) is + when done1 $ do + update retry is + where + go :: InlineBodyData -> InlineState InlineBodyData + go = traverseBodyData (viaExpM inlineWithData) + + allLiftedDeclarations :: Map (Ident, Int) MonoScoped + allLiftedDeclarations = flatBinds decls + + allLiftedDependencies :: AdjacencyMap (Ident, Int) + allLiftedDependencies = + stars + . M.toList + . fmap S.toList + $ allLiftedDependenciesMap + + allLiftedDependenciesMap :: Map (Ident, Int) (Set (Ident, Int)) + allLiftedDependenciesMap = foldBinds go M.empty decls + where + allDeclIDs :: Set (Ident, Int) + allDeclIDs = allDeclIdentifiers decls + + go :: + Map (Ident, Int) (Set (Ident, Int)) -> + (Ident, Int) -> + MonoScoped -> + Map (Ident, Int) (Set (Ident, Int)) + go acc nm scoped = + let unscoped = toExp scoped + allComponentHoleIdents = S.fromList $ mapMaybe (fmap unHole . toHole) (unscoped ^.. cosmos) + theseUsedBinds = S.intersection allDeclIDs allComponentHoleIdents + in M.insert nm theseUsedBinds acc + + -- Example for testing: Design a call graph that has two SCCs in it + + {- I.e. select the necessary number of loop breakers and + return the set of declarations that will actually be + inlined (that is: the set with the loop breakers removed) + NOTE: Since this will be the same at every call site, we should use `inline` + to construct a static map from declaration identifiers to their inlineable + declaration groups + -} + breakLoops :: + AdjacencyMap (Ident, Int) -> + Set LoopBreaker + breakLoops adjMap = doTrace "breakLoops" msg result + where + result = evalState breakEm adjMap + msg = "RESULT:\n" <> prettyStr (S.toList result) + + breakEm :: State (AdjacencyMap (Ident, Int)) (Set LoopBreaker) + breakEm = do + adjaMap <- get + let stronglyConnected = gmap fromNonEmpty $ scc adjaMap + revTopoSorted :: [AdjacencyMap (Ident, Int)] + revTopoSorted = reverse $ either cycleErr id $ topSort stronglyConnected + doTraceM "breakEm" ("RevTopoSorted:\n" <> prettyStr (vertexList <$> revTopoSorted)) + case find nonTrivialGroup revTopoSorted of + Nothing -> pure S.empty + Just target -> do + let targIdentifiers = vertexList target + scored = score adjaMap <$> targIdentifiers + highScore = maximumBy (\a b -> let f = snd . getScore in compare (f a) (f b)) scored + case highScore of + LoopBreakerScore (_, Nothing) -> error $ "Could not select a loop breaker for decl group:\n" <> show targIdentifiers + LoopBreakerScore (nm, _) -> do + removeEdgesTerminatingAt nm + S.insert (LoopBreaker nm) <$> breakEm + where + removeEdgesTerminatingAt :: (Ident, Int) -> State (AdjacencyMap (Ident, Int)) () + removeEdgesTerminatingAt nm = do + s <- get + let depsEdges = edgeList s + depsWinnowed = filter (\x -> snd x /= nm) depsEdges + newState = edges depsWinnowed + put newState + + nonTrivialGroup :: forall x. AdjacencyMap x -> Bool + nonTrivialGroup x = S.size (vertexSet x) > 1 + + cycleErr :: Cycle (AdjacencyMap (Ident, Int)) -> a + cycleErr cyc = error $ "Fatal Error: Cannot inline, topologically sorted graph of dependencies contains cycles:\n" <> show cyc + + score :: + AdjacencyMap (Ident, Int) -> + (Ident, Int) -> + LoopBreakerScore + score adjaMap nm = adjustScore $ case M.lookup nm allLiftedDeclarations of + Just (toExp -> e) + | typeContainsRow e -> LoopBreakerScore (nm, Nothing) + | not (isMonoType (expTy id e)) -> LoopBreakerScore (nm, Just 0) + | otherwise -> case e of + V _ -> LoopBreakerScore (nm, Just 3) + LitE {} -> LoopBreakerScore (nm, Just 3) + appE@(AppE {}) -> case unsafeAnalyzeApp appE of + (f, _) + | isConstructorE f -> LoopBreakerScore (nm, Just 2) + | otherwise -> LoopBreakerScore (nm, Just 1) + _ -> LoopBreakerScore (nm, Just 1) + Nothing -> LoopBreakerScore (nm, Nothing) + where + {- We want to give higher priority potential loop breakers that "do more breaking" -} + adjustScore (LoopBreakerScore (nm', Just sc)) = + let nE = length $ filter (\x -> snd x == nm') (edgeList adjaMap) + newScore = sc + nE + in LoopBreakerScore (nm', Just newScore) + adjustScore lb = lb + + typeContainsRow :: MonoExp -> Bool + typeContainsRow e = any isRow allTypeComponents + where + allTypeComponents :: [PurusType] + allTypeComponents = expTy id e ^.. cosmos + + isRow = \case + TypeConstructor _ C.Row -> True + RecordT _ -> True + TypeVar _ _ k -> isRow k + RCons {} -> True + REmpty {} -> True + KindedType _ t1 t2 -> isRow t1 || isRow t2 + TypeApp _ t1 t2 -> isRow t1 || isRow t2 + _ -> False diff --git a/src/Language/Purus/Pipeline/Inline/Types.hs b/src/Language/Purus/Pipeline/Inline/Types.hs new file mode 100644 index 000000000..db44bbae6 --- /dev/null +++ b/src/Language/Purus/Pipeline/Inline/Types.hs @@ -0,0 +1,41 @@ +module Language.Purus.Pipeline.Inline.Types where + +import Prelude + +import Language.PureScript.Names (Ident) + +import Language.Purus.Pipeline.Lift.Types (MonoScoped) + +import Prettyprinter (Pretty) + +newtype LoopBreakerScore = LoopBreakerScore {getScore :: ((Ident, Int), Maybe Int)} deriving (Show, Eq, Ord) + +newtype LoopBreaker = LoopBreaker {getLoopBreaker :: (Ident, Int)} + deriving newtype (Show, Eq, Ord, Pretty) + +data InlineBodyData + = NotALoopBreaker MonoScoped + | IsALoopBreaker MonoScoped + deriving (Show, Eq) + +-- idk this is ugly. also isn't there some category theory magic for this? +unBodyData :: InlineBodyData -> (MonoScoped -> InlineBodyData, MonoScoped) +unBodyData = \case + NotALoopBreaker ms -> (NotALoopBreaker, ms) + IsALoopBreaker ms -> (IsALoopBreaker, ms) + +getInlineBody :: InlineBodyData -> MonoScoped +getInlineBody = \case + NotALoopBreaker s -> s + IsALoopBreaker s -> s + +traverseBodyData :: (Applicative f) => (MonoScoped -> f MonoScoped) -> InlineBodyData -> f InlineBodyData +traverseBodyData f = \case + NotALoopBreaker b -> NotALoopBreaker <$> f b + IsALoopBreaker b -> IsALoopBreaker <$> f b + +isALoopBreaker :: InlineBodyData -> Bool +isALoopBreaker = \case IsALoopBreaker {} -> True; _ -> False + +notALoopBreaker :: InlineBodyData -> Bool +notALoopBreaker = \case NotALoopBreaker {} -> True; _ -> False diff --git a/src/Language/Purus/Pipeline/Instantiate.hs b/src/Language/Purus/Pipeline/Instantiate.hs new file mode 100644 index 000000000..c8e4c70a7 --- /dev/null +++ b/src/Language/Purus/Pipeline/Instantiate.hs @@ -0,0 +1,115 @@ +{- After inlining, we have an AST which contains several different kinds of expression which + will require - yet lack at this stage - type instantiations (TyInstE in our AST) in order to + typecheck in PIR (and also to simplify some of our own subsequent compiler passes). +-} + +module Language.Purus.Pipeline.Instantiate (instantiateTypes, applyPolyRowArgs) where + +import Prelude + +import Data.Map (Map) +import Data.Map qualified as M + +import Data.Foldable (foldl') + +import Data.Text (Text) + +import Language.PureScript.Constants.Prim qualified as C +import Language.PureScript.CoreFn.Expr (PurusType) +import Language.PureScript.CoreFn.TypeLike (TypeLike (..), instantiates) +import Language.PureScript.Names (Ident (Ident)) +import Language.PureScript.Types (Type (..)) + +import Language.Purus.Debug (doTrace, prettify) +import Language.Purus.IR (BVar (..), Exp (..), analyzeApp, expTy) +import Language.Purus.IR.Utils ( + Vars, + WithObjects, + mapAlt, + mapBind, + transformTypesInExp, + viaExp, + ) +import Language.Purus.Pretty.Common (prettyStr) + +import Control.Lens (transform, view, _2) +import Prettyprinter (Pretty) + +{- After inlining and instantiating, we're left abstracted type variables and instantiated types which + may be of kind `Row Type`. That's bad! We need to "apply" the instantiations to the abstractions so + that we have concrete rows (or as concrete as they can possibly be at any rate) before we + do object desugaring. +-} +applyPolyRowArgs :: + Exp WithObjects PurusType (Vars PurusType) -> + Exp WithObjects PurusType (Vars PurusType) +applyPolyRowArgs = transform $ \case + instE@(TyInstE t (TyAbs (BVar kvI kvTy (Ident kvNm)) innerE)) -> case kvTy of + TypeApp _ (TypeConstructor _ C.Row) _ -> transformTypesInExp (replaceAllTypeVars [(kvNm, t)]) innerE + _ -> instE + other -> other + +{- Instantiates every type abstraction wherever it is possible to deduce the instantiation. +-} +instantiateTypes :: forall x (t :: *). (TypeLike t, Pretty t, Pretty (KindOf t)) => Exp x t (Vars t) -> Exp x t (Vars t) +instantiateTypes = \case + V v -> V v + LitE t lit -> LitE t $ instantiateTypes <$> lit + LamE bv scope -> LamE bv $ viaExp instantiateTypes scope + AppE f a -> + let a' = instantiateTypes a + f' = instantiateTypes f + in instantiateApp $ AppE f' a' + CaseE t scrut alts -> CaseE t (instantiateTypes scrut) (mapAlt (viaExp instantiateTypes) <$> alts) + LetE decls body -> LetE (mapBind (const (viaExp instantiateTypes)) <$> decls) (viaExp instantiateTypes body) + AccessorE x t lbl obj -> AccessorE x t lbl (instantiateTypes obj) + ObjectUpdateE x t e copy fs -> ObjectUpdateE x t (instantiateTypes e) copy (fmap instantiateTypes <$> fs) + TyAbs t inner -> TyAbs t (instantiateTypes inner) + TyInstE t inner -> TyInstE t (instantiateTypes inner) + +instantiateApp :: forall x (t :: *). (Pretty t, TypeLike t, Pretty (KindOf t)) => Exp x t (Vars t) -> Exp x t (Vars t) +instantiateApp e = case analyzeApp e of + Nothing -> e + Just (f, args) -> + let (fTyVars, fInner) = stripQuantifiers (expTy id f) + fTypes = splitFunTyParts fInner + argTypes = expTy id <$> args + quantifiedTyVars = view _2 <$> fTyVars + instantiations = getInstantiations quantifiedTyVars fTypes argTypes + f' = go instantiations quantifiedTyVars f + msg = + prettify + [ "Function:\n" <> prettyStr f + , "Arguments:\n" <> prettyStr args + , "Split Fun Types:\n" <> prettyStr fTypes + , "Split Arg Types:\n" <> prettyStr argTypes + , "Quantified TyVars:\n" <> prettyStr quantifiedTyVars + , "Instantiations:\n" <> prettyStr (M.toList instantiations) + , "New Function:\n" <> prettyStr f' + , "New Function Type:\n" <> prettyStr (expTy id f') + ] + in doTrace "instantiateTypes" msg $ foldl' AppE f' args + where + go :: Map Text t -> [Text] -> Exp x t (Vars t) -> Exp x t (Vars t) + go _ [] ex = ex + go dict (v : vs) ex = case M.lookup v dict of + Nothing -> ex + Just t -> go dict vs (TyInstE t ex) + +{- Takes a list of variables, the split function types, and split arguments types, + and returns a Map of type variable substitutions. +-} +getInstantiations :: + (TypeLike t) => + [Text] -> + [t] -> + [t] -> + M.Map Text t +getInstantiations [] _ _ = M.empty +getInstantiations _ [] _ = M.empty +getInstantiations _ _ [] = M.empty +getInstantiations (var : vars) fs@(fE : fEs) as@(aE : aEs) = case instantiates var aE fE of + Nothing -> + getInstantiations [var] fEs aEs + <> getInstantiations vars fs as + Just t -> M.insert var t $ getInstantiations vars fs as diff --git a/src/Language/Purus/Pipeline/Lift.hs b/src/Language/Purus/Pipeline/Lift.hs new file mode 100644 index 000000000..083d3c8bb --- /dev/null +++ b/src/Language/Purus/Pipeline/Lift.hs @@ -0,0 +1,619 @@ +{-# LANGUAGE ScopedTypeVariables #-} + +{-# HLINT ignore "Use if" #-} +{-# HLINT ignore "Use <&>" #-} +{-# HLINT ignore "Move concatMap out" #-} + +module Language.Purus.Pipeline.Lift (lift) where + +import Prelude + +import Language.PureScript.CoreFn.Expr (PurusType) +import Language.PureScript.CoreFn.FromJSON () +import Language.PureScript.CoreFn.Module (Module (..)) +import Language.PureScript.CoreFn.TypeLike ( + TypeLike (..), + ) +import Language.PureScript.Names (Ident (..), runIdent) +import Language.PureScript.PSString (PSString) +import Language.Purus.Debug ( + doTraceM, + prettify, + ) +import Language.Purus.IR ( + Alt (..), + BVar (..), + BindE (..), + Exp (..), + Lit (..), + Pat (..), + expTy, + expTy', + ) +import Language.Purus.IR.Utils ( + Vars, + WithObjects, + allBoundVars, + asExp, + containsBVar, + deepMapMaybeBound, + foldBinds, + fromExp, + mapBind, + stripSkolems, + stripSkolemsFromExpr, + toExp, + viaExp, + ) +import Language.Purus.Pipeline.Lift.Types ( + Hole (Hole), + LiftResult (LiftResult), + MonoAlt, + MonoBind, + MonoExp, + MonoScoped, + ToLift (ToLift, declarations), + fromHole, + toHole, + unHole, + pattern LiftedHole, + pattern LiftedHoleTerm, + ) +import Language.Purus.Pipeline.Monad (Inline, MonadCounter (next)) +import Language.Purus.Pretty.Common (docString, prettyStr) + +import Control.Applicative (Alternative ((<|>))) + +import Data.Foldable (foldl', toList) +import Data.Maybe (mapMaybe) + +import Data.Map (Map) +import Data.Map qualified as M + +import Data.Set (Set) +import Data.Set qualified as S + +import Control.Monad.Reader (asks, foldM) + +import Debug.Trace (trace) + +import Data.Text qualified as T + +import Control.Lens (cosmos, over, toListOf, transform, (^..), _1) + +import Bound.Scope (abstract) +import Bound.Var (Var (..)) + +import Prettyprinter ( + Pretty (pretty), + align, + hardline, + indent, + vcat, + ) + +{- Given a collection of declarations that will be lifted, determine for each declaration + the "deep" (recursive) set of NEW variable dependencies which need to be added + as additional arguments. + + That is, for: + + ``` + testForLift :: Int -> Boolean + testForLift x = h x 3 + where + h a b = g a <= j 4 b + j c d = c + g d + g a = if h a x then j x 1 else x * x + ``` + + the resulting map would be: + h := [x], + j := [x], + g := [x] + + `g` references an `x` that is in scope at the original declaration, but will + become out of scope when `g` is lifted, so must be added as an argument. + + `h` and `j` reference `g` and therefore incur that dependency, so `x` must be + added as an argument to their lifted declaration bodies as well. + +-} +deepAnalysis :: Set ToLift -> Map (Ident, Int) (Set (BVar PurusType)) -- high tide, hold priority, crack lion's eye diamond, flashback... +deepAnalysis toLifts = M.mapWithKey go analyses + where + go :: (Ident, Int) -> (Set (Ident, Int), Set (BVar PurusType)) -> Set (BVar PurusType) + go me (dps, theseUnBoundVars) = + theseUnBoundVars <> getResult (resolvedDeepChildren S.empty (me, dps)) + where + getResult :: S.Set (Ident, Int) -> S.Set (BVar PurusType) + getResult children = S.unions $ snd <$> lookupMany children analyses + + lookupMany :: forall k v t. (Ord k, Foldable t) => t k -> Map k v -> [v] + lookupMany ks m = mapMaybe (\k -> M.lookup k m) (toList ks) + + resolvedDeepChildren :: S.Set (Ident, Int) -> ((Ident, Int), S.Set (Ident, Int)) -> S.Set (Ident, Int) + resolvedDeepChildren visited' (nm, deps) = + let thisStep = mapMaybe (\k -> (k,) . fst <$> M.lookup k analyses) (S.toList deps) + withThis = S.insert nm visited' + thisStepWinnowed = filter (\d -> fst d `S.notMember` withThis) thisStep + newVisited = foldl' (\acc x -> S.insert x acc) withThis (fst <$> thisStep) + in case thisStepWinnowed of + [] -> deps + _ -> deps <> S.unions (resolvedDeepChildren newVisited <$> thisStepWinnowed) + + analyses :: Map (Ident, Int) (Set (Ident, Int), Set (BVar PurusType)) + analyses = + let allLiftedBinds = S.toList . S.unions $ declarations <$> S.toList toLifts + in foldBinds + ( \acc nm scoped -> + let oosVars = allNewlyOutOfScopeVars M.! nm + liftedDeps = getLiftedPeerDeps scoped + this = (liftedDeps, oosVars) + in M.insert nm this acc + ) + M.empty + allLiftedBinds + + -- FIXME: I think the problem is here? yup it was, keeping this as a reminder i changed it in case breaks + getLiftedPeerDeps :: MonoScoped -> Set (Ident, Int) + getLiftedPeerDeps scoped = + let unscoped = toExp scoped + allComponentHoleIdents = S.fromList $ mapMaybe (fmap unHole . toHole) (unscoped ^.. cosmos) + in S.intersection allLiftedDeclIdents allComponentHoleIdents + + allLiftedDeclIdents = M.keysSet allNewlyOutOfScopeVars + + allNewlyOutOfScopeVars :: Map (Ident, Int) (Set (BVar PurusType)) + allNewlyOutOfScopeVars = foldMap getNewlyOutOfScopeVars toLifts + + getNewlyOutOfScopeVars :: ToLift -> Map (Ident, Int) (Set (BVar PurusType)) + getNewlyOutOfScopeVars (ToLift varScope _ decls) = + foldBinds + (\acc nm body -> M.insert nm (getUnboundVars body) acc) + M.empty + (S.toList decls) + where + getUnboundVars :: MonoScoped -> Set (BVar PurusType) + getUnboundVars scoped = asExp scoped $ \e -> + foldl' + ( \acc bv -> + if S.member bv varScope then S.insert bv acc else acc + ) + S.empty + (allBoundVars e) + +cleanupLiftedTypes :: LiftResult -> Inline LiftResult +cleanupLiftedTypes (LiftResult bs body) = do + let refreshTypes = mkRefreshTypes bs + updateVars :: forall (f :: * -> *). (Functor f) => f (Vars PurusType) -> f (Vars PurusType) + updateVars = fmap refreshTypes + bs' = map (mapBind (const updateVars)) bs + body' = updateVars body + pure $ LiftResult bs' body' + where + mkRefreshTypes :: [MonoBind] -> Vars PurusType -> Vars PurusType + mkRefreshTypes binds v = case v of + F (LiftedHole hid@(Ident -> hId) hix@(fromInteger -> hIx) _) -> case M.lookup (hId, hIx) refreshDict of + Nothing -> v + Just hTy -> F $ LiftedHole hid hix hTy + _ -> v + where + refreshDict = + foldBinds + ( \acc nm b -> + let ty = expTy' id b + in M.insert nm ty acc + ) + M.empty + binds + +{- See [NOTE: 1] for a rough explanation of what this function does. -} +updateAllBinds :: + Map (Ident, Int) (Set (BVar PurusType)) -> + MonoExp -> + [MonoBind] -> + Inline ([MonoBind], MonoExp) +updateAllBinds deepDict prunedBody _binds = do + let allLiftedIdents = M.keys deepDict + allOldToNew <- M.fromList <$> traverse (\nm -> (nm,) <$> mkOldToNew nm) allLiftedIdents + let adjustedBody = transform (foldl' (\accF nm -> mkUpdateCallSiteBody nm . accF) id allLiftedIdents) prunedBody + go nm = + viaExp $ + updateLiftedLambdas allOldToNew nm + . updateCallSiteLifted allOldToNew nm + + binds = mapBind go <$> _binds + + msg = + prettify + [ "Pruned body:\n " <> prettyStr prunedBody + , "AllDeclIdents:\n " <> prettyStr allLiftedIdents + , "AdjustedBody:\n " <> prettyStr adjustedBody + , "Binds:\n" <> concatMap (\x -> prettyStr x <> "\n\n") binds + , "Deep Dict:\n" <> prettyStr (M.toList (S.toList <$> deepDict)) + ] + doTraceM "updateAllBinds" msg + pure (binds, adjustedBody) + where + coerceOldToNew :: + Map (BVar PurusType) (BVar PurusType) -> + MonoExp -> + MonoExp + coerceOldToNew thisOldToNew = deepMapMaybeBound (\bv -> M.lookup bv thisOldToNew) + + updateLiftedLambdas :: + Map (Ident, Int) (Map (BVar PurusType) (BVar PurusType)) -> + (Ident, Int) -> + MonoExp -> + MonoExp + updateLiftedLambdas allOldToNew nm e = + let thisOldToNew = allOldToNew M.! nm + in mkUpdateLiftedLambdas thisOldToNew (M.elems thisOldToNew) e + + updateCallSiteLifted :: + Map (Ident, Int) (Map (BVar PurusType) (BVar PurusType)) -> + (Ident, Int) -> -- The Name of the *enclosing lifted declaration*. We need this to select the correct "renaming dictionary" + MonoExp -> + MonoExp + updateCallSiteLifted allOldToNew declNm = coerceOldToNew thisOldToNew . transform go + where + go x = case toHole x of + Just (Hole hId hIx _) -> case M.lookup (hId, hIx) deepDict of + Just deep -> + let liftedWithOldVars = mkUpdateCallSiteLifted deep (hId, hIx) x + bvf v = M.lookup v thisOldToNew <|> Just v + updatedVarBind = abstract (\case B v -> bvf v; _ -> Nothing) liftedWithOldVars + in toExp updatedVarBind + Nothing -> x + _ -> x + thisOldToNew = allOldToNew M.! declNm -- has to be here if it's in dict + regenBVar :: forall t. BVar t -> Inline (BVar t) + regenBVar (BVar _ bvTy bvIdent) = do + u <- next + pure (BVar u bvTy bvIdent) + + {- Things named `oldToNew` here refer to a Map from variables with their original indices + to variables with newly generated indices. + + Because (afaict from talking to the Plutus guys) we need to maintain the *global* uniqueness + of indices, we will have one map for each declaration being lifted. + + `allOldToNew` is used to refer to the global map from identifiers to their `oldToNew` map. + -} + mkOldToNew :: (Ident, Int) -> Inline (Map (BVar PurusType) (BVar PurusType)) + mkOldToNew nm = + M.fromList + <$> foldM + (\acc bv -> do el <- (bv,) <$> regenBVar bv; pure (el : acc)) + [] + (deepDict M.! nm) + + {- Corresponds to (2) in [NOTE 1]-} + mkUpdateCallSiteLifted :: Set (BVar PurusType) -> (Ident, Int) -> MonoExp -> MonoExp + mkUpdateCallSiteLifted new (idnt, indx) me = case toHole me of + Just (Hole hId hIx _) + | hIx == indx && hId == idnt -> foldl' AppE me (V . B <$> S.toList new) + | otherwise -> me + Nothing -> me + + {- For the expression being lifted, corresponds to (3) in [NOTE 1] -} + mkUpdateLiftedLambdas :: + Map (BVar PurusType) (BVar PurusType) -> + [BVar PurusType] -> + MonoExp -> + MonoExp + mkUpdateLiftedLambdas oldToNew new e = foldl' (\rhs bv -> LamE bv (abstr rhs)) e new + where + bvf bv = case M.lookup bv oldToNew of Just bvnew -> Just bvnew; Nothing -> Just bv + abstr = abstract $ \case B bv -> bvf bv; _ -> Nothing + + {- + This correspond to (1) in [NOTE 1], i.e., it is used for updating the call sites of the + declarations being lifted *in the body where of the expression where the lifted declarations were + originally let- bound. + + When updating the call site, we don't need to re-index variables b/c the originals *Must* be + in scope at the call site. (This is also the reason why we need a separate function for the + original call-sites: We don't care about *new* variables/indices because there aren't any new + vars/indices) + -} + mkUpdateCallSiteBody :: (Ident, Int) -> MonoExp -> MonoExp + mkUpdateCallSiteBody nm@(idnt, indx) x = case toHole x of + Just hole@(Hole hId hIx _) + | hIx == indx && hId == idnt -> + let deep = S.toList $ deepDict M.! nm + in foldl' AppE (fromHole hole) (V . B <$> deep) + | otherwise -> x + Nothing -> x + +{- Given a "main" expression (and implicit access to the module context via the + `Inline` monad), lift all component declarations, transform their bodies, + and update all call-sites. + + NOTE: The first argument is the name of the 'main' declaration. We need this to handle the case where the main function is + self-recursive. *IN PRODUCTION* that doesn't matter at all, because a validator or minting policy cannot be + (sensibly) self-recursive. However, it's essential for testing (we need to evaluate some self-recursive + functions to check other parts of the compiler). + + Also it's a really weird restriction to forbid self-recursive main functions and I'd like to minimize the number + of special cases we need to +-} +lift :: + (Ident, Int) -> + MonoExp -> + Inline LiftResult -- we don't put the expression back together yet b/c it's helpful to keep the pieces separate for monomorphization +lift mainNm _e = do + e <- handleSelfRecursiveMain + modDict <- mkModDict + let collectDict = mkDict S.empty modDict e + prettyCollectDict = docString . indent 2 . align . vcat $ map (\((nm, indx), b) -> pretty nm <> "#" <> pretty indx <> pretty (toExp b) <> hardline) (M.toList collectDict) + (toLift, prunedExp, _) = collect S.empty collectDict S.empty S.empty e + deepDict = deepAnalysis toLift + liftThese = S.toList . S.unions $ declarations <$> S.toList toLift + (binds, body) <- updateAllBinds deepDict prunedExp liftThese + result <- cleanupLiftedTypes $ LiftResult binds body + let msg = + prettify + [ "Input Expr:\n" <> prettyStr e + , "Pruned Expr:\n" <> prettyStr prunedExp + , "ToLifts:\n" <> prettyStr (S.toList toLift) + , "Collect Dict:\n" <> prettyCollectDict + , "Result\n" <> prettyStr result + ] + doTraceM "lift" msg + pure result + where + handleSelfRecursiveMain :: Inline MonoExp + handleSelfRecursiveMain + | not (uncurry containsBVar mainNm (fromExp _e)) = pure _e + | otherwise = do + let (mnNm, mnIx) = mainNm + u <- next + let uTxt = T.pack (show u) + newNm = case mnNm of + Ident t -> Ident $ t <> "$" <> uTxt + GenIdent (Just t) i -> GenIdent (Just $ t <> "$" <> uTxt) i -- we only care about a unique ord property for the maps + GenIdent Nothing i -> GenIdent (Just $ "$" <> uTxt) i + other -> other + eTy = expTy id _e + f = \case + (BVar bvIx bvTy bvNm) -> + if bvIx == mnIx && bvNm == mnNm + then Just (BVar u bvTy newNm) + else Nothing + updatedMainBody = deepMapMaybeBound f _e + syntheticMainBinding = (mainNm, fromExp updatedMainBody) + abstr = abstract $ \case B bv -> Just bv; _ -> Nothing + syntheticPrimeBody = abstr . V . B $ BVar mnIx eTy mnNm + syntheticPrimeBinding = ((newNm, u), syntheticPrimeBody) + bindingGroup = Recursive [syntheticMainBinding, syntheticPrimeBinding] + pure $ LetE [bindingGroup] syntheticPrimeBody + + mkDict :: + Set (Ident, Int) -> + Map (Ident, Int) MonoScoped -> + MonoExp -> + Map (Ident, Int) MonoScoped + mkDict visited acc me = trace "mkDict" $ case me of + V F {} -> acc + (V (B (BVar bvIx _ bvId))) -> case S.member (bvId, bvIx) visited of + True -> acc + False -> case M.lookup (bvId, bvIx) acc of + Nothing -> acc + Just declBody -> mkDict (S.insert (bvId, bvIx) visited) acc (toExp declBody) + LitE _ (ObjectL _ fs) -> foldl' (\ac fld -> mkDict visited ac (snd fld)) acc fs + LitE _ _ -> acc + AppE e1 e2 -> mkDict visited acc e1 <> mkDict visited acc e2 + CaseE _ scrut alts -> + let wScrut = mkDict visited acc scrut + in foldl' (\ac (UnguardedAlt _ body) -> mkDict visited ac (toExp body)) wScrut alts + AccessorE _ _ _ arg -> mkDict visited acc arg + ObjectUpdateE _ _ ex _ flds -> + let wEx = mkDict visited acc ex + in foldl' (\ac fld -> mkDict visited ac (snd fld)) wEx flds + TyAbs _ ex -> mkDict visited acc ex + LamE _ scoped -> mkDict visited acc (toExp scoped) + LetE decls scoped -> + let wDeclsTopLevel = foldBinds (\ac nm body -> M.insert nm body ac) acc decls + wDeclsDeep = foldBinds (\ac _ body -> mkDict visited ac (toExp body)) wDeclsTopLevel decls + in mkDict visited wDeclsDeep (toExp scoped) + TyInstE {} -> acc -- TyInst shouldn't exist + collect :: + Set (Ident, Int) -> + Map (Ident, Int) MonoScoped -> + Set (BVar PurusType) -> + Set (BVar (KindOf PurusType)) -> + MonoExp -> + (Set ToLift, MonoExp, Set (Ident, Int)) + collect visited dict boundVars boundTyVars me = trace "collect" $ case me of + -- we ignore free variables. For us, a free variable more or less represents "shouldn't/can't be inlined" + V fv@F {} -> (S.empty, V fv, visited) + V b@(B (BVar bvIx (stripSkolems -> bvTy) bvIdent)) -> case M.lookup (bvIdent, bvIx) dict of + Nothing -> (S.empty, V b, visited) + Just declbody + | S.member (bvIdent, bvIx) visited -> (S.empty, fromHole $ Hole bvIdent bvIx bvTy, visited) + | otherwise -> + let + visited' = S.insert (bvIdent, bvIx) visited -- NOTE: if something breaks look here + (collectedToLift, collectedBody, visited'') = collect visited' dict S.empty S.empty (toExp declbody) + collectedDecl = NonRecursive bvIdent bvIx (fromExp . stripSkolemsFromExpr $ collectedBody) + here = ToLift S.empty S.empty (S.singleton collectedDecl) + hole = LiftedHoleTerm (runIdent bvIdent) (fromIntegral bvIx) bvTy + in + (S.insert here collectedToLift, hole, visited'') + LitE t lit -> case lit of + IntL i -> (S.empty, LitE t (IntL i), visited) + StringL s -> (S.empty, LitE t (StringL s), visited) + CharL c -> (S.empty, LitE t (CharL c), visited) + ObjectL x fs -> case foldl' goField (S.empty, [], visited) fs of + (bnds, flds, visited') -> (bnds, LitE t $ ObjectL x flds, visited') + AppE e1 e2 -> + let (bnds1, e1', vis1) = collect visited dict boundVars boundTyVars e1 + (bnds2, e2', vis2) = collect vis1 dict boundVars boundTyVars e2 + in (bnds1 <> bnds2, AppE e1' e2', vis2) + CaseE ty scrut alts -> + let (sBnds, scrut', vis1) = collect visited dict boundVars boundTyVars scrut + (aBnds, alts', vis2) = collectFromAlts (S.empty, [], vis1) alts + in (sBnds <> aBnds, CaseE ty scrut' alts', vis2) + AccessorE x ty fld arg -> + let (fldBnds, arg', vis1) = collect visited dict boundVars boundTyVars arg + in (fldBnds, AccessorE x ty fld arg', vis1) + ObjectUpdateE x ty ex copy flds -> + let (eBnds, e', vis1) = collect visited dict boundVars boundTyVars ex + (fldBnds, flds', vis2) = foldl' goField (S.empty, [], vis1) flds + bnds = eBnds <> fldBnds + in (bnds, ObjectUpdateE x ty e' copy flds', vis2) + TyAbs tv ex -> case collect visited dict boundVars (S.insert tv boundTyVars) ex of + (l, m, r) -> (l, TyAbs tv m, r) + LamE bv scoped -> + let (bnds, unscoped, vis1) = collect visited dict (S.insert bv boundVars) boundTyVars (toExp scoped) + rescoped = abstract (\case B bvx -> Just bvx; _ -> Nothing) unscoped + in (bnds, LamE bv rescoped, vis1) + LetE _decls scoped -> + let decls = mapBind (const $ viaExp stripSkolemsFromExpr) <$> _decls + -- boundVarsPlusDecls = foldBinds (\acc (nm,indx) body -> S.insert (BVar indx (expTy' id body) nm) acc) boundVars decls + -- vis1 = foldBinds (\vis nm _ -> S.insert nm vis) visited decls + (liftedDecls, vis2) = collectFromNestedDeclarations visited boundVars boundTyVars decls + in over _1 (liftedDecls <>) $ collect vis2 dict boundVars boundTyVars (toExp scoped) + -- If we run this directly after core desugaring then there should not be any TyInstEs in the AST + tInst@TyInstE {} -> + error $ + "Don't know what to do with a TyInst. Seems like it requires backtracking to handle correctly? Ughhhh\n" + <> prettyStr tInst + where + {- We need to "sanitize" the declarations being collected so that any Vars that reference a + declaration being lifted are transformed into a LiftedHole with the proper type annotation. + + ...also we never properly handled nested `let-` binding groups in the first place and this + ought to fix that. + + These are all declarations that will be *removed* from their original context, so we don't + need to return an Exp of any sort (the relevant expressions will be embedded into the decls + inside the resulting `ToLift`) + -} + collectFromNestedDeclarations :: + Set (Ident, Int) -> + Set (BVar PurusType) -> + Set (BVar (KindOf PurusType)) -> + [MonoBind] -> + (Set ToLift, Set (Ident, Int)) + collectFromNestedDeclarations vis termBound typeBound liftThese = trace "collectFromNested" $ foldBinds go (S.empty, vis) liftThese + where + go :: (Set ToLift, Set (Ident, Int)) -> (Ident, Int) -> MonoScoped -> (Set ToLift, Set (Ident, Int)) + go (liftAcc, visAcc) (nm, indx) scoped = + let (insideLifted, insideBody, visAcc') = collect visAcc dict termBound typeBound (stripSkolemsFromExpr $ toExp scoped) + here = ToLift termBound typeBound (S.singleton $ NonRecursive nm indx (fromExp insideBody)) + in (S.insert here (insideLifted <> liftAcc), visAcc') + + goField :: + (Set ToLift, [(PSString, MonoExp)], Set (Ident, Int)) -> + (PSString, MonoExp) -> + (Set ToLift, [(PSString, MonoExp)], Set (Ident, Int)) + goField (liftAcc, fieldAcc, vis) (nm, fld) = case collect vis dict boundVars boundTyVars fld of + (bnds, fld', vis1) -> (bnds <> liftAcc, (nm, fld') : fieldAcc, vis1) + + collectFromAlts :: + (Set ToLift, [MonoAlt], Set (Ident, Int)) -> + [MonoAlt] -> + (Set ToLift, [MonoAlt], Set (Ident, Int)) + collectFromAlts acc [] = acc + collectFromAlts (liftAcc, altAcc, visAcc) (UnguardedAlt pat scoped : rest) = + let boundInPat = extractPatVarBinders pat + boundVars' = foldr S.insert boundVars boundInPat + (bnds, unscoped, vis1) = collect visAcc dict boundVars' boundTyVars (stripSkolemsFromExpr . toExp $ scoped) + rescoped = abstract (\case B bvx -> Just bvx; _ -> Nothing) unscoped + thisAlt = UnguardedAlt pat rescoped + acc' = (liftAcc <> bnds, altAcc <> [thisAlt], vis1) + in collectFromAlts acc' rest + + extractPatVarBinders :: + Pat WithObjects PurusType (Exp WithObjects PurusType) (Vars PurusType) -> + [BVar PurusType] + extractPatVarBinders = \case + VarP idnt ix t -> [BVar ix t idnt] + WildP -> [] + LitP (ObjectL _ ps) -> concatMap (extractPatVarBinders . snd) ps + _ -> [] + +mkModDict :: Inline (Map (Ident, Int) MonoScoped) +mkModDict = do + decls <- asks moduleDecls + pure $ foldBinds (\acc nm b -> M.insert nm b acc) M.empty decls + +{- NOTE 1: + + We need three different functions, each of which is (modulo the Inline monad) + morally a function :: Exp -> Exp + + 1) We need a function that updates call sites in the body of the expression(s) inside the + scope of the original let- bound declaration we're lifting. This situation is distinct from + updating the call sites in *other lifted expressions*, because in the original body context, + we are applying variables which *must* be in scope already, and so should use the *original* + "was-in-scope-before-lifting-but-is-out-of-scope-after-lifting" BVars (which we have acces to). + + 2) We need a function that updates call sites *in all lifted expressions* , i.e. (but not exclusively) + other members of the mutually recursive binding group in which the declaration being lifted is defined (this + might also occur for other lifted expressions inside the scope of the binding being lifted). + + Here, we need to generate new unique indices for the variables being applied, which must be done in the + 'Inline' monad. We can generate a Map from the old indices to the new indices "all at once" for the totality of + lifted declarations and pass it around. + + Furthermore, because the new(ly re-indexed) variables must be added as lambda arguments on the LHS of *each* + other lifted declaration, they must (to preserve global uniqueness) be specific to each lifted declaration. + + 3) We need a function that modifies the declaration being lifted with additional lambdas (at the *front*, I think that's easier) + for each new variable which may have been bound in the original context but is free in the lifted declaration + (prior to this transformation). We need to ensure that: + - a: The newly introduced binders contain variables with *fresh* indices + - b: The "stale" variables (which at this point have the original indices from the scope where they + are first bound in the context we are lifting *from*) are updated with the corresponding fresh indices + - c: Any self-recursive calls to the function declaration being lifted are supplied with fresh arguments. + + In practice we combine 2) and 3) + + This is all somewhat complicated by the fact that we cannot deduce the *deep* set of dependencies + from the structure of a particular to-be-lifted declaration. This is confusing, so to illustrate + the point, consider: + + ``` + f :: Int -> Boolean + f x = h x 3 + where + h a b = g a <= j 4 b + j c d = c + g d + g a = if h a x then j x 1 else x * x + ``` + + In our AST, this desugars to (something like): + + ``` + f :: Int -> Boolean + f = \(x: Int) -> + let h a b = g a <= j 4 b + j c d = c + g d + g a = if h a x then j x 1 else x * x + in h x 3 + ``` + + The bound variable 'x' occurs *directly* in the body of `g` and in no other let-bound declaration. + A naive attempt at lifting might yield: + + ``` + let h a b = g a <= j 4 b + j c d = c + g d + g x a = if h a x then j x 1 else x * x + in (...) + ``` + + But this is wrong! (If you're reading this, try to spot the error for a second before moving to the next paragraph.) + + The problem with this attempt at lifting is that `g` occurs in both `h` and `j`, and so both `h` and `j` + need to take an additional argument and apply it to the `g` contained within their declaration body. + + The point of this example is to demonstrate that the full dependencies of a given declaration must be known + (where full means: the direct dependencies *and* any dependencies of the direct one, and recursively, etc). + + `getDeep` (...if it works...) fetches those dependencies for us (and this is why we had to construct all of those maps above). +-} diff --git a/src/Language/Purus/Pipeline/Lift/Types.hs b/src/Language/Purus/Pipeline/Lift/Types.hs new file mode 100644 index 000000000..19c5caa3f --- /dev/null +++ b/src/Language/Purus/Pipeline/Lift/Types.hs @@ -0,0 +1,154 @@ +module Language.Purus.Pipeline.Lift.Types where + +import Prelude + +import Data.Set (Set) +import Data.Text (Text) + +import Data.Set qualified as S + +import Language.PureScript.CoreFn.Expr (PurusType) +import Language.PureScript.CoreFn.TypeLike +import Language.PureScript.Names ( + Ident (GenIdent, Ident), + ModuleName (ModuleName), + Qualified (Qualified), + QualifiedBy (ByModuleName), + runIdent, + ) + +import Language.Purus.Debug (prettify) +import Language.Purus.IR +import Language.Purus.IR.Utils +import Language.Purus.Pretty.Common + +import Bound (Scope, Var (F)) +import Prettyprinter + +-- sorry Koz i really want to be able to fit type sigs on one line +type MonoExp = Exp WithObjects PurusType (Vars PurusType) +type MonoScoped = Scope (BVar PurusType) (Exp WithObjects PurusType) (Vars PurusType) +type MonoBind = BindE PurusType (Exp WithObjects PurusType) (Vars PurusType) +type MonoAlt = Alt WithObjects PurusType (Exp WithObjects PurusType) (Vars PurusType) + +{- The thing that our Lift function gives us. + + This is essentially equivalent to a LetE expression, + but it's useful to keep the lifted declarations separate from + the body expression, since we'll be inlining and monomorphizing + with those declarations. +-} +data LiftResult = LiftResult + { liftedDecls :: [MonoBind] + , trimmedExp :: MonoExp + } + +{- When we lift expressions, we have to abstract any types mentioned in the + expressions which are well-scoped in the original context we are lifting from, + but are no longer in scope in the lifted expression. + + This will usually turn a non-quantified expression into a quantified expression. + + This is bad. It can (e.g.) cause case expressions that return functions to have + branches with *different* types. E.g. + + ```haskell + -- Assume there's a (y :: a) for some a in scope + let f :: Int -> a -> a + f x t = (...) + in case (z :: Maybe Int) of + Just w -> f w + Nothing -> \_ -> y + + -- f gets lifted to: + f :: forall (t1 :: Type). Int -> t1 -> t1 + f = /\(t1 :: Type) -> (...) + ``` + + In a situation like that, we lack sufficient information to "force" the type to its "original" + form. In this particular example, it is not even clear how we could possibly know what + `t1` needs to be instantiated to (well ok *we*, i.e., competent human beings, can know it + but it's not clear that a general procedure for recovering the information from the context exists) + + The easiest solution here is to pack that information into variables. Either bound or free variables + would work here, but we can use the ModuleName field in the Qualified Ident inside of an FVar to + very clearly indicate that a "hole" representing an inline target exists. + + This pattern synonym (it's bidirectional btw) allows us to construct and deconstruct a + representation of those "holes". + + NOTE: This will break a bunch of stuff, as up to this point we haven't been using FVars for anything + meaningful. But that should be OK, since all of these FVars will be eliminated during inlining + (and it's very easy to throw a *useful* error if we made a mistake and missed one) +-} +pattern LiftedHole :: Text -> Integer -> t -> FVar t +pattern LiftedHole nm indx ty = + FVar + ty + ( Qualified + (ByModuleName (ModuleName "$LIFTED")) -- just has to be an arbitrary illegal module name + (GenIdent (Just nm) indx) + ) + +pattern LiftedHoleTerm :: Text -> Integer -> t -> Exp x t (Vars t) +pattern LiftedHoleTerm nm indx ty = V (F (LiftedHole nm indx ty)) + +-- concrete representation, avoid manual Text<->Ident & Integer<->Int conversion +data Hole t = Hole Ident Int t + +toHole :: Exp x t (Vars t) -> Maybe (Hole t) +toHole (LiftedHoleTerm nm indx ty) = Just $ Hole (Ident nm) (fromIntegral indx) ty +toHole _ = Nothing + +fromHole :: Hole t -> Exp x t (Vars t) +fromHole (Hole hId hIx hTy) = LiftedHoleTerm (runIdent hId) (fromIntegral hIx) hTy + +-- dunno if we should ignore the type? +fillsHole :: BVar t -> Exp x t (Vars t) -> Bool +fillsHole (BVar bvIx _ bvIdent) = \case + LiftedHoleTerm (Ident -> i) (fromIntegral -> indx) _ -> bvIx == indx && bvIdent == i + _ -> False + +unHole :: Hole t -> (Ident, Int) +unHole (Hole hId hIx _) = (hId, hIx) + +instance Pretty LiftResult where + pretty (LiftResult decls expr) = + let mkPrettyDeclWithTySig acc (i, u) scoped = + let unscoped = toExp scoped + ty = expTy id unscoped + prettyBody = pretty (NonRecursive i u scoped) + prettySig = pretty i <::> pretty ty + prettyWithSig = align $ vcat [prettySig, prettyBody, hardline] + in prettyWithSig : acc + + prettyDecls = foldBinds mkPrettyDeclWithTySig [] decls + in align $ + vcat + [ "let" + , indent 2 . align . vcat $ prettyDecls + , "in" <+> align (pretty expr) + ] + +{- Intermediate data type for recording the scope at the + place where a group of declarations occurs in the AST. + + Without this scope information, lifting is impossible. +-} +data ToLift = ToLift + { varScopeAtDecl :: Set (BVar PurusType) + , tyVarScopeAtDecl :: Set (BVar (KindOf PurusType)) + , declarations :: Set MonoBind + } + deriving (Show, Eq, Ord) + +instance Pretty ToLift where + pretty ToLift {..} = + pretty $ + prettify + [ "------ToLift-------" + , "Var Scope:\n" <> prettyStr (S.toList varScopeAtDecl) + , "Ty Var Scope:\n " <> prettyStr (S.toList tyVarScopeAtDecl) + , "Decls:\n" <> prettyStr (S.toList declarations) + , "-------------------" + ] diff --git a/src/Language/Purus/Pipeline/Monad.hs b/src/Language/Purus/Pipeline/Monad.hs new file mode 100644 index 000000000..e320e0275 --- /dev/null +++ b/src/Language/Purus/Pipeline/Monad.hs @@ -0,0 +1,160 @@ +{- Various concrete monads used by the pipeline components. There's probably a more elegant solution, + but this works well-enough for now. + + DesugarCore and Inline run in the monads with those names. + + Lift runs in the Inline monad. + + DesugarObjects runs in `Counter` (it only needs access to the stream of uniques) + + GenerateDatatypes, EliminateCases, and CompileToPIR run in the PlutusContext Monad. + + Intantiate is pure. +-} +{-# LANGUAGE StandaloneDeriving #-} +{-# LANGUAGE StarIsType #-} +{-# LANGUAGE TemplateHaskell #-} +{-# LANGUAGE UndecidableInstances #-} + +module Language.Purus.Pipeline.Monad where + +import Prelude + +import Data.Map (Map) +import Data.Map qualified as M + +import Language.PureScript.CoreFn.Ann (Ann) +import Language.PureScript.CoreFn.Expr (PurusType) +import Language.PureScript.CoreFn.Module (Module) +import Language.PureScript.Names (Ident, ModuleName) +import Language.Purus.IR.Utils (IR_Decl) +import Language.Purus.Types (DatatypeDictionary) + +import Control.Lens.Operators ((%=), (+=), (.=)) +import Control.Lens.TH (makeLenses) +import Control.Monad.Except (MonadError) +import Control.Monad.Reader (MonadReader (..), MonadTrans (..)) +import Control.Monad.State ( + MonadState (get, put), + StateT (..), + evalStateT, + gets, + ) + +import Prettyprinter ( + Pretty (pretty), + align, + hardline, + indent, + vcat, + (<+>), + ) + +newtype CounterT m a = CounterT {runCounterT :: StateT Int m a} + deriving newtype (Functor, Applicative, Monad, MonadTrans) + deriving (MonadState Int) via (StateT Int m) + +deriving instance (MonadError e m) => MonadError e (CounterT m) +deriving instance (MonadReader r m) => MonadReader r (CounterT m) + +class MonadCounter (m :: * -> *) where + next :: m Int + +instance (Monad m) => MonadCounter (CounterT m) where + next = CounterT $ do + s <- get + id += 1 + pure s + +instance (Monad m) => MonadCounter (StateT s (CounterT m)) where + next = lift next + +{- The different compiler monads are primarily distinguished by their State type, + this is a way to generalize that. +-} +newtype PurusM s a = PurusM {runPurusM :: StateT s (CounterT (Either String)) a} + deriving newtype (Functor, Applicative, Monad, MonadCounter, MonadError String, MonadState s) + +instance MonadReader r (PurusM r) where + ask = get + + local f act = do + s <- get + id %= f + res <- act + id .= s + pure res + + reader f = gets f + +evalPurusM :: s -> PurusM s a -> CounterT (Either String) a +evalPurusM s pm = evalStateT (runPurusM pm) s + +runStatePurusM :: s -> PurusM s a -> CounterT (Either String) (a, s) +runStatePurusM s pm = runStateT (runPurusM pm) s + +{- See explanation in Language.Purus.Pipeline.Desugar for why we need two scopes -} +data DesugarContext = DesugarContext {_globalScope :: Map ModuleName (Map Ident Int), _localScope :: Map Ident Int} + deriving (Show, Eq) + +initDesugarContext :: DesugarContext +initDesugarContext = DesugarContext M.empty M.empty + +instance Pretty DesugarContext where + pretty (DesugarContext globals locals) = + let globals' = + align + . vcat + . fmap (\(a, b) -> pretty a <+> ":=" <+> b <> hardline) + . M.toList + $ indent 2 + . align + . vcat + . map pretty + . M.toList + <$> globals + + locals' = align . vcat . map pretty . M.toList $ locals + in "DesugarContext:" + <> hardline + <> "Globals:" + <> indent 2 globals' + <> hardline + <> "Locals:" + <> indent 2 locals' + <> hardline + + +makeLenses ''DesugarContext + +newtype DesugarCore a = DesugarCore (PurusM DesugarContext a) + deriving newtype + ( Functor + , Applicative + , Monad + , MonadError String + , MonadCounter + , MonadState DesugarContext + , MonadReader DesugarContext + ) + +runDesugarCore :: DesugarCore a -> CounterT (Either String) (a, DesugarContext) +runDesugarCore (DesugarCore psm) = runStatePurusM initDesugarContext psm + +newtype Inline a = Inline (PurusM (Module IR_Decl PurusType PurusType Ann) a) + deriving newtype (Functor, Applicative, Monad, MonadError String, MonadCounter, MonadReader (Module IR_Decl PurusType PurusType Ann)) + +runInline :: Module IR_Decl PurusType PurusType Ann -> Inline a -> CounterT (Either String) a +runInline modl (Inline psm) = evalPurusM modl psm + +newtype PlutusContext a = PlutusContext (PurusM DatatypeDictionary a) + deriving newtype (Functor, Applicative, Monad, MonadError String, MonadCounter, MonadState DatatypeDictionary, MonadReader DatatypeDictionary) + +runPlutusContext :: DatatypeDictionary -> PlutusContext a -> CounterT (Either String) a +runPlutusContext dtdict (PlutusContext psm) = evalPurusM dtdict psm + +newtype Counter a = Counter (PurusM () a) + deriving newtype (Functor, Applicative, Monad, MonadError String, MonadCounter) + +runCounter :: Counter a -> CounterT (Either String) a +runCounter (Counter psm) = evalPurusM () psm diff --git a/src/Language/Purus/Pretty.hs b/src/Language/Purus/Pretty.hs new file mode 100644 index 000000000..c93a814e1 --- /dev/null +++ b/src/Language/Purus/Pretty.hs @@ -0,0 +1,79 @@ +module Language.Purus.Pretty ( + module PRETTY, + ppType, + smartRender, + writeModule, + prettyModuleTxt, + prettyModuleStr, + renderExpr, + renderExprStr, + prettyTypeStr, +) where + +import Prelude hiding ((<>)) + +import Data.Text (Text) +import Data.Text qualified as T + +import System.IO (Handle) + +import Language.PureScript.CoreFn.Expr ( + Bind, + Expr (..), + ) +import Language.PureScript.CoreFn.Module (Module) +import Language.PureScript.Types (Type (..)) + +import Language.Purus.Pretty.Common as PRETTY +import Language.Purus.Pretty.Expr as PRETTY +import Language.Purus.Pretty.Types as PRETTY + +import Prettyprinter ( + Doc, + Pretty (pretty), + defaultLayoutOptions, + layoutPretty, + layoutSmart, + ) +import Prettyprinter.Render.Text (renderIO, renderStrict) + +{- Rewritten prettyprinter that uses a modern printer library & is less convoluted. + + We primarily need this for writing the "prettified" CoreFn files for development purposes. + The existing printer is extremely difficult to modify for our needs (e.g. there isn't a clear way to force + an expression or type to print on one line). Because reading the CoreFn output is necessary + to ensure correctness, it's important that we get get something legible. +-} + +-- TODO: Remove +ppType :: (Show a) => Int -> Type a -> String +ppType _ t = prettyTypeStr t + +-- TODO (maybe): It wouldn't be too hard to determine the terminal width and write a +-- display function that prints correctly-formatted-for-the-size +smartRender :: Doc ann -> Text +smartRender = renderStrict . layoutPretty defaultLayoutOptions + +writeModule :: (Pretty k, Pretty t, Show a) => Handle -> Module (Bind a) k t a -> IO () +writeModule h m = + renderIO h + . layoutSmart defaultLayoutOptions + $ prettyModule m + +prettyModuleTxt :: (Pretty k, Pretty t, Show a) => Module (Bind a) k t a -> Text +prettyModuleTxt = renderStrict . layoutPretty defaultLayoutOptions . prettyModule + +prettyModuleStr :: (Pretty k, Pretty t, Show a) => Module (Bind a) k t a -> String +prettyModuleStr = T.unpack . prettyModuleTxt + +renderExpr :: (Show a) => Expr a -> Text +renderExpr = smartRender . asDynamic prettyValue + +renderExprStr :: (Show a) => Expr a -> String +renderExprStr = T.unpack . renderExpr + +{- TYPES (move later) -} + +-- TODO: Move +instance (Show a) => Pretty (Type a) where + pretty t = pretty $ prettyTypeStr t diff --git a/src/Language/Purus/Pretty/Common.hs b/src/Language/Purus/Pretty/Common.hs new file mode 100644 index 000000000..3fac9aa24 --- /dev/null +++ b/src/Language/Purus/Pretty/Common.hs @@ -0,0 +1,225 @@ +{-# OPTIONS_GHC -Wno-deferred-out-of-scope-variables #-} +{-# OPTIONS_GHC -Wno-orphans #-} + +module Language.Purus.Pretty.Common where + +import Prelude hiding ((<>)) + +import Control.Monad.Reader (MonadReader (ask), Reader, runReader) + +import Language.PureScript.CoreFn.Expr ( + Expr (..), + ) +import Language.PureScript.Label (Label (..)) +import Language.PureScript.Names (Ident, ModuleName, runModuleName, showIdent) +import Language.PureScript.PSString (PSString, decodeStringWithReplacement) + +import Data.Text qualified as T +import Prettyprinter ( + Doc, + Pretty (pretty), + align, + brackets, + comma, + defaultLayoutOptions, + flatAlt, + group, + hardline, + hcat, + hsep, + indent, + layoutPretty, + lbrace, + line, + lparen, + pipe, + punctuate, + rbrace, + rparen, + space, + vcat, + vsep, + (<+>), + (<>), + ) +import Prettyprinter.Render.Text (renderStrict) + +prettyStr :: (Pretty a) => a -> String +prettyStr = T.unpack . renderStrict . layoutPretty defaultLayoutOptions . pretty + +docString :: Doc a -> String +docString = T.unpack . renderStrict . layoutPretty defaultLayoutOptions + +{- One thing that we often wish to do, but cannot easily do either with + the Prettyprinter library or the ancient lib PureScript uses, is to + *force* particular sub-expressions to print on a single line. + + (`Prettyprinter.group` does give us the ability to express: "Try to + print this on one line, but if you can't, use the multi-line format", and we + use that when choosing between one- and multi-line formats.) + + This gives us a nice little abstraction for convenient auto-formatting + (single line/multi line) where we want it, while also giving us the ability to + override particular locations in the AST that we want to force to one-line (e.g. case + expression binders, applied types, etc). +-} +data LineFormat + = OneLine -- *DEFINITELY* Print on one line, even if doing so exceeds the page width + | MultiLine -- *Possibly* Print multiple lines. + deriving (Show, Eq) + +-- A document with a structure that depends on a formatting context +type Printer ann = Reader LineFormat (Doc ann) + +-- Convenience type +type Formatter = forall a ann. (a -> Printer ann) -> a -> Doc ann + +-- runReader with flipped arguments (how it should be!) +runPrinter :: LineFormat -> Printer ann -> Doc ann +runPrinter fmt p = runReader p fmt + +asOneLine :: Formatter +asOneLine p x = runPrinter OneLine (p x) + +-- Helper for dynamic formatting. `asMultiLine` doesn't make sense (we always want to choose +-- between single and multiline formats in a context where we aren't forcing a one-line format) +asDynamic :: Formatter +asDynamic p x = group $ align $ flatAlt (runPrinter MultiLine (p x)) (runPrinter OneLine (p x)) + +-- Applies the supplied function to the Doc if we're in a Multiline context. +-- Primarily used for correct formatting of Records/Rows/Objects +onMultiline :: (Doc ann -> Doc ann) -> Doc ann -> Printer ann +onMultiline f doc = + ask >>= \case + OneLine -> pure doc + MultiLine -> pure . f $ doc + +-- For docs w/ a structure that does not vary based on the line format options +-- Used primarily for `let` expressions (where we want uniformity) +ignoreFmt :: Doc ann -> Printer ann +ignoreFmt doc = printer doc doc + +-- Choose between hsep and vsep based on the context +fmtSep :: [Doc ann] -> Printer ann +fmtSep docs = + ask >>= \case + OneLine -> pure $ hsep docs + MultiLine -> pure $ vsep docs + +-- Choose between hcat and vcat based on the context +fmtCat :: [Doc ann] -> Printer ann +fmtCat docs = + ask >>= \case + OneLine -> pure $ hcat docs + MultiLine -> pure $ vcat docs + +-- Choose between newline + indent or no change, depending on the context. +-- NOTE: This is kind of the whole reason we need LineFormat + the Reader monad. +-- `group` isn't sufficient here +fmtIndent :: Doc ann -> Printer ann +fmtIndent doc = + ask >>= \case + OneLine -> pure doc + MultiLine -> pure $ line <> indent 2 doc + +-- Helper function for constructing a printer expr +printer :: Doc ann -> Doc ann -> Printer ann +printer one multi = + ask >>= \case + OneLine -> pure one + MultiLine -> pure multi + +{- Higher-order Printers for Row Types, Record Types, and Object lits -} + +-- Helper for open rows. The `| r` part requires special handling. +withOpenRow :: forall ann. Doc ann -> Doc ann -> ([Doc ann], Doc ann) -> Printer ann +withOpenRow l r (fields, open) = do + fmtFields <- onMultiline (indent 2) =<< fmtSep (punctuate comma fields') + group . align <$> fmtSep [l, fmtFields, r] -- fmtFields + where + fields' = + foldr + ( \x acc -> case acc of + [] -> [hsep [x, pipe <+> open]] + xs -> x : xs + ) + [] + fields + +openRow :: ([Doc ann], Doc ann) -> Printer ann +openRow = withOpenRow lparen rparen + +openRecord :: ([Doc ann], Doc ann) -> Printer ann +openRecord = withOpenRow lbrace rbrace + +-- Printer for record like things (Object literals, record types) +recordLike :: [Doc ann] -> Printer ann +recordLike fields = do + fields' <- onMultiline (indent 2) =<< fmtSep (punctuate comma fields) + group . align <$> fmtSep [lbrace, fields', rbrace] + +{- Misc Utils and custom combinators. + Most of these are just for readability. (a <:> type), + to me anyway, is a lot easier on the eyes than + (a <> ":" <> space <> type) +-} +commaSep :: [Doc ann] -> Doc ann +commaSep = vsep . punctuate comma + +-- Our "special" type annotations are indicated w/ a single colon. +(<:>) :: Doc ann -> Doc ann -> Doc ann +a <:> b = hcat [a, ":"] <+> b + +-- Actual type annotations & signatures (that are in the source explicitly or +-- inferred by the compiler before we get the AST) are indicated in the normal way, +-- that is, with '::' +(<::>) :: Doc ann -> Doc ann -> Doc ann +a <::> b = a <+> "::" <+> b + +(<=>) :: Doc ann -> Doc ann -> Doc ann +a <=> b = a <+> "=" <+> b + +-- Forces a line break. Shouldn't be used except in cases where we want to ignore +-- the dynamic formatting (e.g. case expressions) +() :: Doc ann -> Doc ann -> Doc ann +a b = a <+> hardline <+> b + +arrow :: Doc ann +arrow = "->" + +lam :: Doc ann +lam = "\\" + +-- Like `list` but forces one line format. +oneLineList :: [Doc ann] -> Doc ann +oneLineList = brackets . hcat . punctuate (comma <> space) + +-- Splits an `App` expr into a function/ctor and a list of arguments. +analyzeApp :: Expr a -> Maybe (Expr a, [Expr a]) +analyzeApp t = (,appArgs t) <$> appFun t + where + appArgs :: Expr a -> [Expr a] + appArgs (App _ t1 t2) = appArgs t1 <> [t2] + appArgs _ = [] + + appFun :: Expr a -> Maybe (Expr a) + appFun (App _ t1 _) = go t1 + where + go (App _ tx _) = case appFun tx of + Nothing -> Just tx + Just tx' -> Just tx' + go other = Just other + appFun _ = Nothing + +-- TODO: Move to modules where types are defined +instance Pretty Ident where + pretty = pretty . showIdent + +instance Pretty PSString where + pretty = pretty . decodeStringWithReplacement + +instance Pretty ModuleName where + pretty = pretty . runModuleName + +instance Pretty Label where + pretty = pretty . runLabel diff --git a/src/Language/Purus/Pretty/Expr.hs b/src/Language/Purus/Pretty/Expr.hs new file mode 100644 index 000000000..271649e20 --- /dev/null +++ b/src/Language/Purus/Pretty/Expr.hs @@ -0,0 +1,373 @@ +{-# LANGUAGE ScopedTypeVariables #-} +{-# LANGUAGE TypeApplications #-} + +module Language.Purus.Pretty.Expr where + +import Prelude hiding ((<>)) + +import Control.Monad.Reader (MonadReader (ask), runReader) +import Data.Bifunctor (Bifunctor (..)) +import Data.Map (Map) +import Data.Map qualified as M +import Data.Text (Text) +import Data.Text qualified as T + +import Language.PureScript.AST.Literals (Literal (..)) +import Language.PureScript.CoreFn.Binders (Binder (..)) +import Language.PureScript.CoreFn.Expr ( + Bind (..), + CaseAlternative (CaseAlternative), + Expr (..), + Guard, + ) +import Language.PureScript.CoreFn.Module +import Language.PureScript.Environment ( + DataDeclType (..), + getFunArgTy, + ) +import Language.PureScript.Names (Ident, ModuleName, ProperName (..), disqualify, runIdent, showIdent, showQualified) +import Language.PureScript.PSString (PSString, decodeStringWithReplacement, prettyPrintString) + +import Language.PureScript.CoreFn.TypeLike +import Language.PureScript.Environment (function, pattern (:->)) +import Language.PureScript.Types (SourceType) +import Language.Purus.Pretty.Common ( + LineFormat (MultiLine, OneLine), + Printer, + analyzeApp, + arrow, + asDynamic, + asOneLine, + commaSep, + fmtCat, + fmtIndent, + fmtSep, + ignoreFmt, + lam, + oneLineList, + printer, + recordLike, + (), + (<::>), + (<:>), + (<=>), + ) +import Language.Purus.Pretty.Types (prettyType) +import Prettyprinter ( + Doc, + Pretty (pretty), + align, + colon, + dot, + flatAlt, + group, + hardline, + hcat, + hsep, + indent, + line, + list, + parens, + punctuate, + space, + vcat, + viaShow, + vsep, + (<+>), + (<>), + ) + +foldl1x :: (Foldable t) => String -> (a -> a -> a) -> t a -> a +foldl1x msg f xs + | null xs = Prelude.error msg + | otherwise = foldl1 f xs + +exprType :: (Show a) => Expr a -> SourceType +exprType = \case + Literal _ ty _ -> ty + Accessor _ ty _ _ -> ty + ObjectUpdate _ ty _ _ _ -> ty + Abs _ ty _ _ -> ty + App _ t1 t2 -> appType t1 t2 + Var _ ty __ -> ty + Case _ ty _ _ -> ty + Let _ _ e -> exprType e + +appType :: (Show a) => Expr a -> Expr a -> SourceType +appType fe ae = case stripQuantifiers' fTy of + ([], ft) -> + let numArgs = length argTypes + in foldl1x "appType first branch (CoreFn.Utils)" function . drop numArgs . splitFunTyParts $ ft + (xs, ft) -> + let funArgs = splitFunTyParts ft -- funArgTypes ft + dict = mkInstanceMap M.empty xs argTypes funArgs + numArgs = length argTypes + in quantify + . foldl1x "" function + . drop numArgs + . splitFunTyParts + . replaceAllTypeVars (M.toList dict) + $ ft + where + stripQuantifiers' :: SourceType -> ([Text], SourceType) + stripQuantifiers' st = first (map (\(_, b, _) -> b)) $ stripQuantifiers st + + (f, args) = appFunArgs fe ae + fTy = exprType f + argTypes = exprType <$> args + + mkInstanceMap :: Map Text SourceType -> [Text] -> [SourceType] -> [SourceType] -> Map Text SourceType + mkInstanceMap acc [] _ _ = acc + mkInstanceMap acc _ [] _ = acc + mkInstanceMap acc _ _ [] = acc + mkInstanceMap acc (var : vars) (mt : mts) (pt : pts) = case instantiates var mt pt of + Nothing -> + mkInstanceMap acc [var] mts pts + <> mkInstanceMap M.empty vars (mt : mts) (pt : pts) + Just t -> mkInstanceMap (M.insert var t acc) vars (mt : mts) (pt : pts) + +appFunArgs :: Expr a -> Expr a -> (Expr a, [Expr a]) +appFunArgs f args = (appFun f, appArgs f args) + where + appArgs :: Expr a -> Expr a -> [Expr a] + appArgs (App _ t1 t2) t3 = appArgs t1 t2 <> [t3] + appArgs _ t3 = [t3] + + appFun :: Expr a -> Expr a + appFun (App _ t1 _) = appFun t1 + appFun res = res + +-- TODO: Pretty print the datatypes too +prettyModule :: (Pretty k, Pretty t, Pretty b) => Module b k t a -> Doc ann +prettyModule (Module _ _ modName modPath modImports modExports modReExports modForeign modDecls modDatatypes) = + vsep + [ pretty modName <+> parens (pretty modPath) + , line <> "Imported Modules: " <> spacer + , indent 2 . commaSep $ pretty . snd <$> modImports + , line <> "Exports: " <> spacer + , indent 2 . commaSep $ pretty <$> modExports -- hang 2? + , line <> "Re-Exports: " <> spacer + , indent 2 . commaSep $ goReExport <$> M.toList modReExports + , line <> "Foreign: " <> spacer + , indent 2 . commaSep . map pretty $ modForeign + , line <> "Datatypes: " <> spacer + , prettyDatatypes modDatatypes <> line + , line <> "Declarations: " <> spacer + , vcat . punctuate line $ pretty <$> modDecls + ] + where + spacer = line <> pretty (T.pack $ replicate 30 '-') + goReExport :: (ModuleName, [Ident]) -> Doc ann + goReExport (mn', idents) = vcat $ flip map idents $ \i -> pretty mn' <> "." <> pretty i + +instance (Pretty k, Pretty t) => Pretty (Datatypes k t) where + pretty = prettyDatatypes + +prettyDatatypes :: forall k t ann. (Pretty k, Pretty t) => Datatypes k t -> Doc ann +prettyDatatypes (Datatypes tDict _) = vcat . punctuate line $ map prettyDataDecl (M.elems tDict) + +prettyDeclType :: DataDeclType -> Doc ann +prettyDeclType = \case + Data -> "data" + Newtype -> "newtype" + +prefix :: Doc ann -> [Doc ann] -> [Doc ann] +prefix sep [] = [] +prefix sep [x] = [x] +prefix sep (x : xs) = x : goPrefix xs + where + goPrefix [] = [] + goPrefix (y : ys) = (sep <> y) : goPrefix ys + +instance (Pretty k, Pretty t) => Pretty (DataDecl k t) where + pretty = prettyDataDecl + +prettyDataDecl :: forall k t ann. (Pretty k, Pretty t) => DataDecl k t -> Doc ann +prettyDataDecl (DataDecl newtypeOrData qName args ctors) = + let dType = prettyDeclType newtypeOrData + tName = pretty $ runProperName (disqualify qName) + mkArg :: (Text, k) -> Doc ann + mkArg (txt, k) = parens (pretty txt <::> pretty k) + dArgs = hsep $ mkArg <$> args + dCtors = indent 2 . vcat $ prefix "| " $ prettyCtorDecl <$> ctors + in dType <+> tName <+> dArgs <=> line <> dCtors + +prettyCtorDecl :: (Pretty t) => CtorDecl t -> Doc ann +prettyCtorDecl (CtorDecl nm fs) = + pretty (runIdent $ disqualify nm) <+> hsep (parens . pretty . snd <$> fs) + +-- Is a printer for consistency mainly +prettyObjectKey :: PSString -> Printer ann +prettyObjectKey = pure . pretty . decodeStringWithReplacement + +prettyObject :: forall a ann. (Show a) => [(PSString, Maybe (Expr a))] -> Printer ann +prettyObject fields = do + fields' <- traverse prettyProperty fields + recordLike fields' + where + prettyProperty :: (PSString, Maybe (Expr a)) -> Printer ann + prettyProperty (key, value) = do + key' <- prettyObjectKey key + props' <- maybe (pure $ pretty @Text "_") prettyValue value + pure (key' <:> props') + +prettyUpdateEntry :: (Show a) => PSString -> Expr a -> Printer ann +prettyUpdateEntry key val = do + key' <- prettyObjectKey key + val' <- prettyValue val + pure $ key' <=> val' + +-- | Pretty-print an expression +prettyValue :: (Show a) => Expr a -> Printer ann +prettyValue (Accessor _ _ prop val) = do + prop' <- prettyObjectKey prop + val' <- prettyValueAtom val + fmtCat [val', hcat [dot, prop']] +prettyValue (ObjectUpdate _ _ty o _copyFields ps) = do + obj <- prettyValueAtom o + updateEntries <- traverse goUpdateEntry ps >>= recordLike + pure $ obj <+> updateEntries + where + goUpdateEntry = uncurry prettyUpdateEntry +prettyValue app@(App _ t1 t2) = case analyzeApp app of + Just (fun, args) -> do + atom <- fmtSep =<< traverse prettyValueAtom (fun : args) + pure . group . align $ atom + -- ty <- prettyType $ appType t1 t2 + -- pure . group . align $ parens (atom <:> ty) + {- TODO: change back + ask >>= \case + OneLine -> pure . group . align . hsep . map (asOneLine prettyValueAtom) $ (fun:args) + MultiLine -> pure . group . align . vsep . map (asDynamic prettyValueAtom) $ (fun:args) -} + Nothing -> error "App isn't an App (impossible)" +prettyValue (Abs _ ty arg val) = do + ty' <- prettyType (getFunArgTy ty) + body' <- fmtIndent =<< prettyValue val + pure $ + lam + <> parens (align $ pretty (showIdent arg) <:> ty') + <+> arrow + <+> body' +-- TODO: Actually implement the one line bracketed format for case exps (I think PS is the same as Haskell?) +prettyValue (Case _ _ values binders) = + pure $ + "case" + <+> group (hsep scrutinees) + <+> "of" + indent 2 (vcat $ map group branches) + where + scrutinees = asOneLine prettyValueAtom <$> values + branches = group . asDynamic prettyCaseAlternative <$> binders +-- technically we could have a one line version of this but that's ugly af imo +prettyValue (Let _ ds val) = + pure . align $ + vcat + [ "let" + , indent 2 . vcat $ asDynamic prettyDeclaration <$> ds + , "in" <+> align (asDynamic prettyValue val) + ] +prettyValue (Literal _ ty l) = ask >>= \case OneLine -> oneLine; MultiLine -> multiLine + where + -- No type anns for object literals (already annotated in the fields, makes too ugly) + oneLine = pure . parens $ asOneLine prettyLiteralValue l <:> asOneLine prettyType ty + multiLine = pure . parens $ asDynamic prettyLiteralValue l <:> asDynamic prettyType ty +prettyValue expr@Var {} = prettyValueAtom expr + +-- | Pretty-print an atomic expression, adding parentheses if necessary. +prettyValueAtom :: forall a ann. (Show a) => Expr a -> Printer ann +prettyValueAtom lit@(Literal _ _ l) = prettyValue lit -- prettyLiteralValue l +prettyValueAtom (Var _ ty ident) = + prettyType ty >>= \ty' -> + pure . parens $ pretty (showIdent (disqualify ident)) <:> ty' +prettyValueAtom expr = do + -- TODO change this back (need more anns for testing) + v <- prettyValue expr + -- t <- prettyType (exprType expr) + pure $ parens v -- <:> t) + +prettyLiteralValue :: forall a ann. (Show a) => Literal (Expr a) -> Printer ann +prettyLiteralValue (NumericLiteral n) = ignoreFmt $ pretty $ either show show n +prettyLiteralValue (StringLiteral s) = ignoreFmt $ pretty . T.unpack $ prettyPrintString s +prettyLiteralValue (CharLiteral c) = ignoreFmt $ viaShow . show $ c +prettyLiteralValue (BooleanLiteral True) = ignoreFmt "true" +prettyLiteralValue (BooleanLiteral False) = ignoreFmt "false" +prettyLiteralValue (ListLiteral xs) = printer oneLine multiLine + where + oneLine = oneLineList $ asOneLine prettyValue <$> xs + -- N.B. I think it makes more sense to ensure that list *elements* are always oneLine + multiLine = list $ asOneLine prettyValue <$> xs +prettyLiteralValue (ObjectLiteral ps) = prettyObject $ second Just `map` ps + +instance (Show a) => Pretty (Bind a) where + pretty = asDynamic id . prettyDeclaration + +prettyDeclaration :: forall a ann. (Show a) => Bind a -> Printer ann +prettyDeclaration b = case b of + NonRec _ ident expr -> goBind ident expr + Rec bindings -> vcat <$> traverse (\((_, ident), expr) -> goBind ident expr) bindings + where + goBind :: Ident -> Expr a -> Printer ann + goBind ident expr = do + inner' <- goInner ident expr + let ty' = asOneLine prettyType (exprType expr) + pure $ + pretty ident <::> ty' + <> hardline + <> inner' + goInner :: Ident -> Expr a -> Printer ann + goInner ident expr = do + fmt <- ask + let ind docs = runReader (fmtIndent docs) fmt + f g = pretty ident <=> g (asDynamic prettyValue expr) + pure $ group $ flatAlt (f ind) (f id) + +prettyCaseAlternative :: forall a ann. (Show a) => CaseAlternative a -> Printer ann +prettyCaseAlternative (CaseAlternative binders result) = do + let binders' = asOneLine prettyBinderAtom <$> binders + result' <- prettyResult result + pure $ hsep binders' <> result' + where + prettyResult :: Either [(Guard a, Expr a)] (Expr a) -> Printer ann + prettyResult = \case + Left ges -> vcat <$> traverse prettyGuardedValueSep' ges + Right exp' -> do + body' <- prettyValue exp' >>= fmtIndent + pure $ space <> arrow <+> body' + + prettyGuardedValueSep' :: (Guard a, Expr a) -> Printer ann + prettyGuardedValueSep' (guardE, resultE) = do + guardE' <- prettyValue guardE + resultE' <- prettyValue resultE + pure $ " | " <> guardE' <+> arrow <+> resultE' + +prettyBinderAtom :: Binder a -> Printer ann +prettyBinderAtom (NullBinder _) = pure "_" +prettyBinderAtom (LiteralBinder _ l) = prettyLiteralBinder l +prettyBinderAtom (VarBinder _ ident _) = pure $ pretty ident +prettyBinderAtom (ConstructorBinder _ _ ctor []) = pure . pretty $ runProperName (disqualify ctor) +prettyBinderAtom b@ConstructorBinder {} = prettyBinder b +prettyBinderAtom (NamedBinder _ ident binder) = do + binder' <- prettyBinder binder + pure $ pretty ident <> "@" <> binder' + +prettyLiteralBinder :: Literal (Binder a) -> Printer ann +prettyLiteralBinder (StringLiteral str) = pure . pretty $ prettyPrintString str +prettyLiteralBinder (CharLiteral c) = pure $ viaShow c +prettyLiteralBinder (NumericLiteral num) = pure $ either pretty pretty num +prettyLiteralBinder (BooleanLiteral True) = pure "true" +prettyLiteralBinder (BooleanLiteral False) = pure "false" +prettyLiteralBinder (ObjectLiteral bs) = recordLike =<< traverse prettyObjectPropertyBinder bs + where + prettyObjectPropertyBinder :: (PSString, Binder a) -> Printer ann + prettyObjectPropertyBinder (key, binder) = do + key' <- prettyObjectKey key + binder' <- prettyBinder binder + pure $ key' <:> binder' +prettyLiteralBinder (ListLiteral bs) = list <$> traverse prettyBinder bs + +prettyBinder :: Binder a -> Printer ann +prettyBinder (ConstructorBinder _ _ ctor []) = pure . pretty $ runProperName (disqualify ctor) +prettyBinder (ConstructorBinder _ _ ctor args) = do + args' <- fmtSep =<< traverse prettyBinderAtom args + pure $ pretty (runProperName (disqualify ctor)) <+> args' -- fmtSep fmt (asFmt fmt prettyBinderAtom <$> args) +prettyBinder b = prettyBinderAtom b diff --git a/src/Language/Purus/Pretty/Types.hs b/src/Language/Purus/Pretty/Types.hs new file mode 100644 index 000000000..1ed86792d --- /dev/null +++ b/src/Language/Purus/Pretty/Types.hs @@ -0,0 +1,162 @@ +module Language.Purus.Pretty.Types (prettyType, prettyTypeStr, prettyTypeTxt) where + +import Prelude hiding ((<>)) + +import Control.Monad.Reader (MonadReader (ask), Reader) +import Data.Bifunctor (Bifunctor (..), first) +import Data.Text (Text) + +import Language.PureScript.Environment ( + tyFunction, + tyRecord, + pattern ListT, + ) +import Language.PureScript.Names (OpName (..), ProperName (..), showQualified) +import Language.PureScript.PSString (prettyPrintString) +import Language.PureScript.Types (Constraint (..), Type (..), TypeVarVisibility (..), WildcardData (..), eqType) + +import Language.Purus.Pretty.Common ( + LineFormat, + Printer, + arrow, + asOneLine, + fmtSep, + openRecord, + openRow, + recordLike, + runPrinter, + (<::>), + ) +import Prettyprinter ( + Doc, + Pretty (pretty), + group, + hcat, + hsep, + parens, + tupled, + (<+>), + (<>), + ) + +-- need for debugging + +import Data.Text qualified as T +import Prettyprinter ( + defaultLayoutOptions, + layoutPretty, + ) +import Prettyprinter.Render.Text (renderStrict) + +prettyType :: forall a ann. (Show a) => Type a -> Printer ann +prettyType t = + group <$> case t of + ListT tx -> do + -- this is a stupid hack, figure out the proper fix later + inner <- parens <$> prettyType tx + pure $ "List" <+> inner + TUnknown _ n -> pure $ "t" <> pretty n + TypeVar _ txt ki -> do + ki' <- prettyType ki + pure $ parens (pretty txt <::> ki') + TypeLevelString _ pss -> pure . pretty . prettyPrintString $ pss + TypeLevelInt _ i -> pure $ pretty i + TypeWildcard _ wcd -> case wcd of + HoleWildcard txt -> pure $ "?" <> pretty txt + _ -> pure "_" + TypeConstructor _ qPropName -> pure . pretty . showQualified runProperName $ qPropName + TypeOp _ opName -> pure . pretty $ showQualified runOpName opName + TypeApp _ t1 t2 -> goTypeApp t1 t2 + KindApp _ k1 k2 -> do + k1' <- prettyType k1 + k2' <- prettyType k2 + pure $ k1' <> ("@" <> k2') + ForAll _ vis var mKind inner' _ -> case stripQuantifiers inner' of + (quantified, inner) -> goForall ([(vis, var, mKind)] <> quantified) inner + ConstrainedType _ cstrnt innertype -> do + cstrnt' <- prettyConstraint cstrnt + inner' <- prettyType innertype + pure . group $ cstrnt' <+> "=>" <+> inner' + Skolem _ var _ i _ -> pure $ pretty var <> "*" <> pretty i + REmpty _ -> pure "{}" + rcons@RCons {} -> either openRow (pure . tupled) =<< rowFields rcons + -- this might be backwards + KindedType _ ty kind -> do + ty' <- prettyType ty + kind' <- prettyType kind + pure . parens $ ty' <::> kind' -- prettyType ty fmt <::> prettyType kind fmt + + -- not sure what this is? + BinaryNoParensType _ op l r -> do + l' <- prettyType l + op' <- prettyType op + r' <- prettyType r + pure $ l' <+> op' <+> r' -- prettyType l fmt <+> prettyType op fmt <+> prettyType r fmt + ParensInType _ ty -> parens <$> prettyType ty + where + goForall :: [(TypeVarVisibility, Text, (Type a))] -> Type a -> Printer ann + goForall xs inner = do + boundVars <- fmtSep =<< traverse renderBoundVar xs + inner' <- prettyType inner + pure $ + "forall" <+> boundVars <> "." <+> inner' + + prefixVis :: TypeVarVisibility -> Doc ann -> Doc ann + prefixVis vis tv = case vis of + TypeVarVisible -> hcat ["@", tv] + TypeVarInvisible -> tv + + renderBoundVar :: (TypeVarVisibility, Text, (Type a)) -> Printer ann + renderBoundVar (vis, var, k) = do + ty' <- prettyType k + pure . parens $ prefixVis vis (pretty var) <::> ty' + + stripQuantifiers :: Type a -> ([(TypeVarVisibility, Text, (Type a))], Type a) + stripQuantifiers = \case + ForAll _ vis var mk inner _ -> first ((vis, var, mk) :) $ stripQuantifiers inner + other -> ([], other) + + goTypeApp :: Type a -> Type a -> Printer ann + goTypeApp (TypeApp _ f a) b + | eqType f tyFunction = do + a' <- prettyType a + b' <- parens <$> prettyType b + parens <$> fmtSep [a' <+> arrow, b'] + | otherwise = do + f' <- goTypeApp f a + b' <- parens <$> prettyType b + pure $ parens $ f' <+> b' + goTypeApp o ty@RCons {} + | eqType o tyRecord = + either openRecord recordLike =<< rowFields ty + goTypeApp a b = fmap parens $ fmtSep =<< sequence [prettyType a, parens <$> prettyType b] + + rowFields :: Type a -> Reader LineFormat (Either ([Doc ann], Doc ann) [Doc ann]) + rowFields = \case + RCons _ lbl ty rest -> do + fmt <- ask + let f = ((pretty lbl <::> runPrinter fmt (prettyType ty)) :) + rest' <- rowFields rest + pure $ bimap (first f) f rest' + REmpty _ -> pure $ Right [] + KindApp _ REmpty {} _ -> pure $ Right [] -- REmpty is sometimes wrapped in a kind app + TypeVar _ txt k -> do + k' <- prettyType k + pure $ Left ([], parens (pretty txt <::> k')) + other -> Right . pure <$> prettyType other -- error $ "Malformed row fields: \n" <> prettyTypeStr other + +prettyConstraint :: forall a ann. (Show a) => Constraint a -> Printer ann +prettyConstraint Constraint {..} = do + let classNm = pretty $ showQualified runProperName constraintClass + argTypes <- hsep <$> traverse prettyType constraintArgs + pure . group $ classNm <+> argTypes + +-- TODO For debugging, remove later +smartRender :: Doc ann -> Text +smartRender = renderStrict . layoutPretty defaultLayoutOptions + +prettyTypeStr :: forall a. (Show a) => Type a -> String +prettyTypeStr = T.unpack . smartRender . asOneLine prettyType + +prettyTypeTxt :: forall a. (Show a) => Type a -> Text +prettyTypeTxt = smartRender . asOneLine prettyType diff --git a/src/Language/Purus/Prim/Data.hs b/src/Language/Purus/Prim/Data.hs new file mode 100644 index 000000000..0d399565b --- /dev/null +++ b/src/Language/Purus/Prim/Data.hs @@ -0,0 +1,186 @@ +{- Contains primitive Purus datatypes. + + Unlike PureScript, where (e.g.) `true/false` are + morally "foreign imports" and `Array` is an opaque primitive type, + our `Boolean` and `Array` (TODO: CHANGE THE NAME TO LIST) are + real algebraic datatypes with constructors & so on, and therefore + we need to provide definitions for their constructors. + + We also create tuples here. They're directly exposed to users + (albeit in the somewhat ugly Tuple1, Tuple2, ... form), but, more importantly, + we need tuples (qua anonymous products) to eliminate Records (which + Plutus has no notion of). + +-} + +module Language.Purus.Prim.Data where + +import Prelude + +import Data.Map (Map) +import Data.Map qualified as M + +import Data.Text (Text) +import Data.Text qualified as T + +import Language.PureScript.AST.SourcePos (SourceAnn, pattern NullSourceAnn) +import Language.PureScript.Constants.Prim qualified as C +import Language.PureScript.CoreFn.Desugar.Utils (properToIdent) +import Language.PureScript.CoreFn.Expr +import Language.PureScript.CoreFn.Module ( + CtorDecl (CtorDecl), + DataDecl (DataDecl), + Datatypes (Datatypes), + dDataTyName, + ) +import Language.PureScript.Environment ( + DataDeclType (Data), + kindType, + mkTupleTyName, + ) +import Language.PureScript.Names ( + Ident (Ident, UnusedIdent), + ProperName, + ProperNameType (TypeName), + Qualified (..), + QualifiedBy (ByModuleName), + ) +import Language.PureScript.Types (SourceType, Type (..)) + +import Language.Purus.Config (maxTupleSize) +import Language.Purus.IR ( + Kind (KindType), + Ty (TyApp, TyCon, TyVar), + ) + +import Control.Lens ((<&>), (^.)) + +pattern ListCons :: Qualified Ident +pattern ListCons = Qualified (ByModuleName C.M_Prim) (Ident "Cons") + +pattern ListNil :: Qualified Ident +pattern ListNil = Qualified (ByModuleName C.M_Prim) (Ident "Nil") + +mkProdFields :: [t] -> [(Ident, t)] +mkProdFields = map (UnusedIdent,) + +na :: SourceAnn +na = NullSourceAnn + +primData :: Datatypes Kind Ty +primData = tupleDatatypes <> Datatypes tDict cDict + where + tDict :: Map (Qualified (ProperName 'TypeName)) (DataDecl Kind Ty) + tDict = + M.fromList $ + map + (\x -> (x ^. dDataTyName, x)) + [ DataDecl + Data + C.List + [("a", KindType)] + [ CtorDecl ListNil [] + , CtorDecl ListCons $ mkProdFields [TyVar "a" KindType, TyApp (TyCon C.List) (TyVar "a" KindType)] + ] + , DataDecl + Data + C.Boolean + [] + [ CtorDecl (properToIdent <$> C.C_False) [] + , CtorDecl (properToIdent <$> C.C_True) [] + ] + ] + + cDict :: Map (Qualified Ident) (Qualified (ProperName 'TypeName)) + cDict = + M.fromList + [ (ListCons, C.List) + , (ListNil, C.List) + , (properToIdent <$> C.C_True, C.Boolean) + , (properToIdent <$> C.C_False, C.Boolean) + ] + +tupleDatatypes :: Datatypes Kind Ty +tupleDatatypes = Datatypes (M.fromList tupleTypes) (M.fromList tupleCtors) + where + tupleTypes :: [(Qualified (ProperName 'TypeName), DataDecl Kind Ty)] + tupleTypes = flip map [0 .. maxTupleSize] $ \(n :: Int) -> + let tyNm = mkTupleTyName n + ctorNm = mkTupleCtorIdent n + argKinds = mkTupleArgKinds n + ctorTvArgs = mkTupleCtorTvArgs n + in (tyNm, DataDecl Data tyNm argKinds [CtorDecl ctorNm ctorTvArgs]) + + tupleCtors :: [(Qualified Ident, Qualified (ProperName 'TypeName))] + tupleCtors = [0 .. maxTupleSize] <&> \x -> (mkTupleCtorIdent x, mkTupleTyName x) + + mkTupleCtorIdent :: Int -> Qualified Ident + mkTupleCtorIdent n = properToIdent <$> mkTupleTyName n + + vars :: Int -> [Text] + vars n = map (\x -> "t" <> T.pack (show x)) [1 .. n] + + mkTupleArgKinds :: Int -> [(Text, Kind)] + mkTupleArgKinds = fmap (,KindType) . vars + + mkTupleCtorTvArgs :: Int -> [(Ident, Ty)] + mkTupleCtorTvArgs = mkProdFields . map (flip TyVar KindType) . vars + +primDataPS :: Datatypes PurusType PurusType +primDataPS = tupleDatatypesPS <> Datatypes tDict cDict + where + tDict :: Map (Qualified (ProperName 'TypeName)) (DataDecl PurusType PurusType) + tDict = + M.fromList $ + map + (\x -> (x ^. dDataTyName, x)) + [ DataDecl + Data + C.List + [("a", kindType)] + [ CtorDecl ListNil [] + , CtorDecl ListCons $ mkProdFields [TypeVar na "a" kindType, TypeApp na (TypeConstructor na C.List) (TypeVar na "a" kindType)] + ] + , DataDecl + Data + C.Boolean + [] + [ CtorDecl (properToIdent <$> C.C_False) [] + , CtorDecl (properToIdent <$> C.C_True) [] + ] + ] + + cDict :: Map (Qualified Ident) (Qualified (ProperName 'TypeName)) + cDict = + M.fromList + [ (ListCons, C.List) + , (ListNil, C.List) + , (properToIdent <$> C.C_True, C.Boolean) + , (properToIdent <$> C.C_False, C.Boolean) + ] + +tupleDatatypesPS :: Datatypes PurusType PurusType +tupleDatatypesPS = Datatypes (M.fromList tupleTypes) (M.fromList tupleCtors) + where + tupleTypes :: [(Qualified (ProperName 'TypeName), DataDecl PurusType PurusType)] + tupleTypes = flip map [0 .. maxTupleSize] $ \(n :: Int) -> + let tyNm = mkTupleTyName n + ctorNm = mkTupleCtorIdent n + argKinds = mkTupleArgKinds n + ctorTvArgs = mkTupleCtorTvArgs n + in (tyNm, DataDecl Data tyNm argKinds [CtorDecl ctorNm ctorTvArgs]) + + tupleCtors :: [(Qualified Ident, Qualified (ProperName 'TypeName))] + tupleCtors = [0 .. maxTupleSize] <&> \x -> (mkTupleCtorIdent x, mkTupleTyName x) + + mkTupleCtorIdent :: Int -> Qualified Ident + mkTupleCtorIdent n = properToIdent <$> mkTupleTyName n + + vars :: Int -> [Text] + vars n = map (\x -> "t" <> T.pack (show x)) [1 .. n] + + mkTupleArgKinds :: Int -> [(Text, SourceType)] + mkTupleArgKinds = fmap (,kindType) . vars + + mkTupleCtorTvArgs :: Int -> [(Ident, Type SourceAnn)] + mkTupleCtorTvArgs = mkProdFields . map (\v -> TypeVar na v kindType) . vars diff --git a/src/Language/Purus/Prim/Ledger.hs b/src/Language/Purus/Prim/Ledger.hs new file mode 100644 index 000000000..b3a967e17 --- /dev/null +++ b/src/Language/Purus/Prim/Ledger.hs @@ -0,0 +1,549 @@ +{-# LANGUAGE TypeApplications #-} + +module Language.Purus.Prim.Ledger ( + ledgerTypes, + ledgerCons, + ledgerConstructorsEnv, + ledgerConstructorsEnvReadable, +) where + +import Data.Map qualified as M + +import Data.Bifunctor (first) +import Data.List (foldl') +import Language.PureScript.AST.SourcePos (SourceAnn, nullSourceAnn) +import Language.PureScript.CoreFn.Module ( + CtorDecl (CtorDecl), + DataDecl (DataDecl), + ) +import Language.PureScript.CoreFn.TypeLike (TypeLike (applyType, funTy), quantify) +import Language.PureScript.Environment ( + DataDeclType (Newtype), + TypeKind (DataType), + kindType, + (-:>), + ) +import Language.PureScript.Names ( + Ident, + ProperName (ProperName, runProperName), + ProperNameType (ConstructorName, TypeName), + Qualified, + coerceProperName, + disqualify, + runIdent, + ) +import Language.PureScript.Types ( + SourceType, + Type (TypeConstructor, TypeVar), + ) +import Language.Purus.IR () +import Language.Purus.Prim.LedgerData (ledgerDecls) +import Language.Purus.Prim.Utils ( + arm, + listOf, + mapOf, + maybeOf, + monoType, + mononym, + newtypeOf, + nominalVar, + polyNewtypeOf, + polyRecordType, + polySumType, + polyType, + primName, + recordType, + sumType, + tuple2Of, + tyApp, + tyCon, + tyVar, builtinTyCon, + ) +import Prelude + +import Language.Purus.Pretty.Common (docString) +import Prettyprinter ( + Pretty (pretty), + hardline, + punctuate, + vcat, + (<+>), + ) + +-- | Ledger API (V2) types, as per https://github.com/IntersectMBO/plutus/blob/master/plutus-ledger-api/src/PlutusLedgerApi/V2.hs +ledgerTypes :: [(Qualified (ProperName 'TypeName), (Type SourceAnn, TypeKind))] +ledgerTypes = + [ -- Context types + scriptContextType + , scriptPurposeType + , -- Bytes + ledgerBytesType + , -- Certificates + dcertType + , -- Credentials + stakingCredentialType + , credentialType + , -- Value + valueType + , currencySymbolType + , tokenNameType + , lovelaceType + , -- Time + posixTimeType + , -- No POSIXTimeRange, people can use the actual type instead of a synonym + -- Types for representing transactions + addressType + , pubKeyHashType + , txIdType + , txInfoType + , txOutType + , txOutRefType + , txInInfoType + , outputDatumType + , -- Intervals + intervalType + , extendedType + , upperBoundType + , lowerBoundType + , -- Association maps + assocMapType + , -- Newtypes and hash types + scriptHashType + , redeemerType + , redeemerHashType + , datumType + , datumHashType + -- Primitive Maybe + , maybeType + ] + +-- | Ledger API (V2) constructors, as per https://github.com/IntersectMBO/plutus/blob/master/plutus-ledger-api/src/PlutusLedgerApi/V2.hs +ledgerCons :: [(Qualified Ident, Qualified (ProperName 'TypeName))] +ledgerCons = + [ -- Context types + scriptContextCon + , mintingCon + , spendingCon + , rewardingCon + , certifyingCon + , -- Bytes + ledgerBytesCon + , -- Certificates + dcertDelegRegKeyCon + , dcertDelegDeRegKeyCon + , dcertDelegDelegateCon + , dcertPoolRegisterCon + , dcertPoolRetireCon + , dcertGenesisCon + , dcertMirCon + , -- Credentials + stakingHashCon + , stakingPtrCon + , pubKeyCredentialCon + , scriptCredentialCon + , -- Value + valueCon + , currencySymbolCon + , tokenNameCon + , lovelaceCon + , -- Time + posixTimeCon + , -- Types for representing transactions + addressCon + , pubKeyHashCon + , txIdCon + , txInfoCon + , txOutCon + , txOutRefCon + , txInInfoCon + , noOutputDatumCon + , outputDatumHashCon + , outputDatumCon + , -- Intervals + intervalCon + , negInfCon + , finiteCon + , posInfCon + , upperBoundCon + , lowerBoundCon + , -- Association maps + assocMapCon + , -- Newtypes and hash types + scriptHashCon + , redeemerCon + , redeemerHashCon + , datumCon + , datumHashCon + -- Primitive Maybe + , nothingCon + , justCon + ] + +scriptContextType :: (Qualified (ProperName 'TypeName), (Type SourceAnn, TypeKind)) +scriptContextType = + monoType "ScriptContext" + . recordType "ScriptContext" + $ [ ("txInfo", tyCon "TxInfo") + , ("purpose", tyCon "ScriptPurpose") + ] + +scriptContextCon :: (Qualified Ident, Qualified (ProperName 'TypeName)) +scriptContextCon = mononym "ScriptContext" + +scriptPurposeType :: (Qualified (ProperName 'TypeName), (Type SourceAnn, TypeKind)) +scriptPurposeType = + monoType "ScriptPurpose" + . sumType + $ [ ("Minting", [tyCon "CurrencySymbol"]) + , ("Spending", [tyCon "TxOutRef"]) + , ("Rewarding", [tyCon "StakingCredential"]) + , ("Certifying", [tyCon "DCert"]) + ] + +mintingCon :: (Qualified Ident, Qualified (ProperName 'TypeName)) +mintingCon = arm "Minting" "ScriptPurpose" + +spendingCon :: (Qualified Ident, Qualified (ProperName 'TypeName)) +spendingCon = arm "Spending" "ScriptPurpose" + +rewardingCon :: (Qualified Ident, Qualified (ProperName 'TypeName)) +rewardingCon = arm "Rewarding" "ScriptPurpose" + +certifyingCon :: (Qualified Ident, Qualified (ProperName 'TypeName)) +certifyingCon = arm "Certifying" "ScriptPurpose" + +ledgerBytesType :: (Qualified (ProperName 'TypeName), (Type SourceAnn, TypeKind)) +ledgerBytesType = newtypeOf "LedgerBytes" (builtinTyCon "BuiltinByteString") + +ledgerBytesCon :: (Qualified Ident, Qualified (ProperName 'TypeName)) +ledgerBytesCon = mononym "LedgerBytes" + +dcertType :: (Qualified (ProperName 'TypeName), (Type SourceAnn, TypeKind)) +dcertType = + monoType "DCert" + . sumType + $ [ ("DCertDelegRegKey", [tyCon "StakingCredential"]) + , ("DCertDelegDeRegKey", [tyCon "StakingCredential"]) + , ("DCertDelegDelegate", [tyCon "StakingCredential", tyCon "PubKeyHash"]) + , ("DCertPoolRegister", [tyCon "PubKeyHash", tyCon "PubKeyHash"]) + , ("DCertPoolRetire", [tyCon "PubKeyHash", tyCon "Int"]) + , ("DCertGenesis", []) + , ("DCertMir", []) + ] + +dcertDelegRegKeyCon :: (Qualified Ident, Qualified (ProperName 'TypeName)) +dcertDelegRegKeyCon = arm "DCertDelegRegKey" "DCert" + +dcertDelegDeRegKeyCon :: (Qualified Ident, Qualified (ProperName 'TypeName)) +dcertDelegDeRegKeyCon = arm "DCertDelegDeRegKey" "DCert" + +dcertDelegDelegateCon :: (Qualified Ident, Qualified (ProperName 'TypeName)) +dcertDelegDelegateCon = arm "DCertDelegDelegate" "DCert" + +dcertPoolRegisterCon :: (Qualified Ident, Qualified (ProperName 'TypeName)) +dcertPoolRegisterCon = arm "DCertPoolRegister" "DCert" + +dcertPoolRetireCon :: (Qualified Ident, Qualified (ProperName 'TypeName)) +dcertPoolRetireCon = arm "DCertPoolRetire" "DCert" + +dcertGenesisCon :: (Qualified Ident, Qualified (ProperName 'TypeName)) +dcertGenesisCon = arm "DCertGenesis" "DCert" + +dcertMirCon :: (Qualified Ident, Qualified (ProperName 'TypeName)) +dcertMirCon = arm "DCertMir" "DCert" + +stakingCredentialType :: (Qualified (ProperName 'TypeName), (Type SourceAnn, TypeKind)) +stakingCredentialType = + monoType "StakingCredential" + . sumType + $ [ ("StakingHash", [tyCon "Credential"]) + , ("StakingPtr", [tyCon "Int", tyCon "Int", tyCon "Int"]) + ] + +stakingHashCon :: (Qualified Ident, Qualified (ProperName 'TypeName)) +stakingHashCon = arm "StakingHash" "StakingCredential" + +stakingPtrCon :: (Qualified Ident, Qualified (ProperName 'TypeName)) +stakingPtrCon = arm "StakingPtr" "StakingCredential" + +credentialType :: (Qualified (ProperName 'TypeName), (Type SourceAnn, TypeKind)) +credentialType = + monoType "Credential" + . sumType + $ [ ("PubKeyCredential", [tyCon "PubKeyHash"]) + , ("ScriptCredential", [tyCon "ScriptHash"]) + ] + +pubKeyCredentialCon :: (Qualified Ident, Qualified (ProperName 'TypeName)) +pubKeyCredentialCon = arm "PubKeyCredential" "Credential" + +scriptCredentialCon :: (Qualified Ident, Qualified (ProperName 'TypeName)) +scriptCredentialCon = arm "ScriptCredential" "Credential" + +valueType :: (Qualified (ProperName 'TypeName), (Type SourceAnn, TypeKind)) +valueType = newtypeOf "Value" (mapOf (tyCon "CurrencySymbol") (mapOf (tyCon "TokenName") (tyCon "Int"))) + +valueCon :: (Qualified Ident, Qualified (ProperName 'TypeName)) +valueCon = mononym "Value" + +currencySymbolType :: (Qualified (ProperName 'TypeName), (Type SourceAnn, TypeKind)) +currencySymbolType = newtypeOf "CurrencySymbol" (builtinTyCon "BuiltinByteString") + +currencySymbolCon :: (Qualified Ident, Qualified (ProperName 'TypeName)) +currencySymbolCon = mononym "CurrencySymbol" + +tokenNameType :: (Qualified (ProperName 'TypeName), (Type SourceAnn, TypeKind)) +tokenNameType = newtypeOf "TokenName" (builtinTyCon "BuiltinByteString") + +tokenNameCon :: (Qualified Ident, Qualified (ProperName 'TypeName)) +tokenNameCon = mononym "TokenName" + +lovelaceType :: (Qualified (ProperName 'TypeName), (Type SourceAnn, TypeKind)) +lovelaceType = newtypeOf "Lovelace" (tyCon "Int") + +lovelaceCon :: (Qualified Ident, Qualified (ProperName 'TypeName)) +lovelaceCon = mononym "Lovelace" + +posixTimeType :: (Qualified (ProperName 'TypeName), (Type SourceAnn, TypeKind)) +posixTimeType = newtypeOf "POSIXTime" (tyCon "Int") + +posixTimeCon :: (Qualified Ident, Qualified (ProperName 'TypeName)) +posixTimeCon = mononym "POSIXTime" + +addressType :: (Qualified (ProperName 'TypeName), (Type SourceAnn, TypeKind)) +addressType = + monoType "Address" + . recordType "Address" + $ [ ("credential", tyCon "Credential") + , ("stakingCredential", maybeOf (tyCon "StakingCredential")) + ] + +addressCon :: (Qualified Ident, Qualified (ProperName 'TypeName)) +addressCon = mononym "Address" + +pubKeyHashType :: (Qualified (ProperName 'TypeName), (Type SourceAnn, TypeKind)) +pubKeyHashType = newtypeOf "PubKeyHash" (builtinTyCon "BuiltinByteString") + +pubKeyHashCon :: (Qualified Ident, Qualified (ProperName 'TypeName)) +pubKeyHashCon = mononym "PubKeyHash" + +txIdType :: (Qualified (ProperName 'TypeName), (Type SourceAnn, TypeKind)) +txIdType = newtypeOf "TxId" (builtinTyCon "BuiltinByteString") + +txIdCon :: (Qualified Ident, Qualified (ProperName 'TypeName)) +txIdCon = mononym "TxId" + +txInfoType :: (Qualified (ProperName 'TypeName), (Type SourceAnn, TypeKind)) +txInfoType = + monoType "TxInfo" + . recordType "TxInfo" + $ [ ("inputs", listOf (tyCon "TxInInfo")) + , ("referenceInputs", listOf (tyCon "TxInInfo")) + , ("outputs", listOf (tyCon "TxOut")) + , ("fee", tyCon "Value") + , ("mint", tyCon "Value") + , ("dCert", listOf (tyCon "DCert")) + , ("wdrl", mapOf (tyCon "StakingCredential") (tyCon "Int")) + , ("validRange", tyApp (tyCon "Interval") (tyCon "POSIXTime")) + , ("signatories", listOf (tyCon "PubKeyHash")) + , ("redeemers", mapOf (tyCon "ScriptPurpose") (tyCon "Redeemer")) + , ("data", mapOf (tyCon "DatumHash") (tyCon "Datum")) + , ("id", tyCon "TxId") + ] + +txInfoCon :: (Qualified Ident, Qualified (ProperName 'TypeName)) +txInfoCon = mononym "TxInfo" + +txOutType :: (Qualified (ProperName 'TypeName), (Type SourceAnn, TypeKind)) +txOutType = + monoType "TxOut" + . recordType "TxOut" + $ [ ("address", tyCon "Address") + , ("value", tyCon "Value") + , ("datum", tyCon "OutputDatum") + , ("referenceScript", maybeOf (tyCon "ScriptHash")) + ] + +txOutCon :: (Qualified Ident, Qualified (ProperName 'TypeName)) +txOutCon = mononym "TxOut" + +txOutRefType :: (Qualified (ProperName 'TypeName), (Type SourceAnn, TypeKind)) +txOutRefType = + monoType "TxOutRef" + . recordType "TxOutRef" + $ [ ("id", tyCon "TxId") + , ("idx", tyCon "Int") + ] + +txOutRefCon :: (Qualified Ident, Qualified (ProperName 'TypeName)) +txOutRefCon = mononym "TxOutRef" + +txInInfoType :: (Qualified (ProperName 'TypeName), (Type SourceAnn, TypeKind)) +txInInfoType = + monoType "TxInInfo" + . recordType "TxInInfo" + $ [ ("txOutRef", tyCon "TxOutRef") + , ("resolved", tyCon "TxOut") + ] + +txInInfoCon :: (Qualified Ident, Qualified (ProperName 'TypeName)) +txInInfoCon = mononym "TxInInfo" + +outputDatumType :: (Qualified (ProperName 'TypeName), (Type SourceAnn, TypeKind)) +outputDatumType = + monoType "OutputDatum" + . sumType + $ [ ("NoOutputDatum", []) + , ("OutputDatumHash", [tyCon "DatumHash"]) + , ("OutputDatum", [tyCon "Datum"]) + ] + +noOutputDatumCon :: (Qualified Ident, Qualified (ProperName 'TypeName)) +noOutputDatumCon = arm "NoOutputDatum" "OutputDatum" + +outputDatumHashCon :: (Qualified Ident, Qualified (ProperName 'TypeName)) +outputDatumHashCon = arm "OutputDatumHash" "OutputDatum" + +outputDatumCon :: (Qualified Ident, Qualified (ProperName 'TypeName)) +outputDatumCon = mononym "OutputDatum" + +intervalType :: (Qualified (ProperName 'TypeName), (Type SourceAnn, TypeKind)) +intervalType = + polyType "Interval" ["a"] + . polyRecordType "Interval" ["a"] + $ [ ("from", tyApp (tyCon "LowerBound") (tyVar "a")) + , ("to", tyApp (tyCon "UpperBound") (tyVar "a")) + ] + +intervalCon :: (Qualified Ident, Qualified (ProperName 'TypeName)) +intervalCon = mononym "Interval" + +extendedType :: (Qualified (ProperName 'TypeName), (Type SourceAnn, TypeKind)) +extendedType = + polyType "Extended" ["a"] + . polySumType ["a"] + $ [ ("NegInf", []) + , ("Finite", [tyVar "a"]) + , ("PosInf", []) + ] + +negInfCon :: (Qualified Ident, Qualified (ProperName 'TypeName)) +negInfCon = arm "NegInf" "Extended" + +finiteCon :: (Qualified Ident, Qualified (ProperName 'TypeName)) +finiteCon = arm "Finite" "Extended" + +posInfCon :: (Qualified Ident, Qualified (ProperName 'TypeName)) +posInfCon = arm "PosInf" "Extended" + +upperBoundType :: (Qualified (ProperName 'TypeName), (Type SourceAnn, TypeKind)) +upperBoundType = polyNewtypeOf "UpperBound" ["a"] (tyApp (tyCon "Extended") (tyVar "a")) + +upperBoundCon :: (Qualified Ident, Qualified (ProperName 'TypeName)) +upperBoundCon = mononym "UpperBound" + +lowerBoundType :: (Qualified (ProperName 'TypeName), (Type SourceAnn, TypeKind)) +lowerBoundType = polyNewtypeOf "LowerBound" ["a"] (tyApp (tyCon "Extended") (tyVar "a")) + +lowerBoundCon :: (Qualified Ident, Qualified (ProperName 'TypeName)) +lowerBoundCon = mononym "LowerBound" + +assocMapType :: (Qualified (ProperName 'TypeName), (Type SourceAnn, TypeKind)) +assocMapType = + ( primName "AssocMap" + , + ( kindType -:> kindType -:> kindType + , DataType + Newtype + [nominalVar "k", nominalVar "v"] + [(ProperName "AssocMap", [listOf (tuple2Of (tyVar "k") (tyVar "v"))])] + ) + ) + +assocMapCon :: (Qualified Ident, Qualified (ProperName 'TypeName)) +assocMapCon = mononym "AssocMap" + +scriptHashType :: (Qualified (ProperName 'TypeName), (Type SourceAnn, TypeKind)) +scriptHashType = newtypeOf "ScriptHash" (tyCon "BuiltinByteString") + +scriptHashCon :: (Qualified Ident, Qualified (ProperName 'TypeName)) +scriptHashCon = mononym "ScriptHash" + +redeemerType :: (Qualified (ProperName 'TypeName), (Type SourceAnn, TypeKind)) +redeemerType = newtypeOf "Redeemer" (builtinTyCon "BuiltinData") + +redeemerCon :: (Qualified Ident, Qualified (ProperName 'TypeName)) +redeemerCon = mononym "Redeemer" + +redeemerHashType :: (Qualified (ProperName 'TypeName), (Type SourceAnn, TypeKind)) +redeemerHashType = newtypeOf "RedeemerHash" (builtinTyCon "BuiltinByteString") + +redeemerHashCon :: (Qualified Ident, Qualified (ProperName 'TypeName)) +redeemerHashCon = mononym "RedeemerHash" + +datumType :: (Qualified (ProperName 'TypeName), (Type SourceAnn, TypeKind)) +datumType = newtypeOf "Datum" (builtinTyCon "BuiltinData") + +datumCon :: (Qualified Ident, Qualified (ProperName 'TypeName)) +datumCon = mononym "Datum" + +datumHashType :: (Qualified (ProperName 'TypeName), (Type SourceAnn, TypeKind)) +datumHashType = newtypeOf "DatumHash" (builtinTyCon "BuiltinByteString") + +datumHashCon :: (Qualified Ident, Qualified (ProperName 'TypeName)) +datumHashCon = mononym "DatumHash" + +maybeType :: (Qualified (ProperName 'TypeName), (Type SourceAnn, TypeKind)) +maybeType = + polyType "Maybe" ["a"] . + polySumType ["a"] $ [ + ("Nothing", []), + ("Just", [tyVar "a"]) + ] + +nothingCon :: (Qualified Ident, Qualified (ProperName 'TypeName)) +nothingCon = arm "Nothing" "Maybe" + +justCon :: (Qualified Ident, Qualified (ProperName 'TypeName)) +justCon = arm "Just" "Maybe" + +ledgerConstructorsEnv :: + M.Map + (Qualified (ProperName 'ConstructorName)) + (DataDeclType, ProperName 'TypeName, SourceType, [Ident]) +ledgerConstructorsEnv = M.fromList $ concatMap go ledgerDecls + where + go :: + (Qualified (ProperName 'TypeName), DataDecl SourceType SourceType) -> + [ ( Qualified (ProperName 'ConstructorName) + , (DataDeclType, ProperName 'TypeName, SourceType, [Ident]) + ) + ] + go (tn, DataDecl declType _tn dArgs dCtors) = goCtor <$> dCtors + where + goCtor :: + CtorDecl SourceType -> + (Qualified (ProperName 'ConstructorName), (DataDeclType, ProperName 'TypeName, SourceType, [Ident])) + goCtor (CtorDecl nm fields) = + let qCtorNm = coerceProperName @_ @'ConstructorName . ProperName . runIdent <$> nm + (fIds, fTys) = unzip fields + tCon = TypeConstructor nullSourceAnn tn + tcTyVars = uncurry (TypeVar nullSourceAnn) <$> dArgs + tyConAppliedToArgs = foldl' applyType tCon tcTyVars + constructorFnType = quantify $ foldr funTy tyConAppliedToArgs fTys + in (qCtorNm, (declType, disqualify tn, constructorFnType, fIds)) + +-- stupid utility to let us manually verify correctness by giving us a readable representation +ledgerConstructorsEnvReadable :: String +ledgerConstructorsEnvReadable = + docString + . (<> hardline) + . vcat + . punctuate hardline + . fmap + ( (\(a, b) -> pretty a <+> "::" <+> pretty b) + . first (runProperName . disqualify) + ) + . M.toList + $ (\(_, _, t, _) -> t) + <$> ledgerConstructorsEnv diff --git a/src/Language/Purus/Prim/LedgerData.hs b/src/Language/Purus/Prim/LedgerData.hs new file mode 100644 index 000000000..832a1309e --- /dev/null +++ b/src/Language/Purus/Prim/LedgerData.hs @@ -0,0 +1,284 @@ +module Language.Purus.Prim.LedgerData where + +import Language.PureScript.AST.SourcePos (nullSourceAnn) +import Language.PureScript.CoreFn.Module ( + CtorDecl (CtorDecl), + DataDecl (DataDecl), + ) +import Language.PureScript.Environment ( + DataDeclType (Data), + TypeKind (DataType), + kindType, + ) +import Language.PureScript.Names ( + Ident (Ident, UnusedIdent), + ModuleName (ModuleName), + ProperName (ProperName), + ProperNameType (ConstructorName, TypeName), + Qualified (Qualified), + QualifiedBy (ByModuleName), + ) +import Language.PureScript.Types ( + SourceType, + Type (TypeApp, TypeVar), + ) +import Prelude + +import Language.Purus.Prim.Utils ( + listTy, + mapTy, + maybeTy, + newtypeDecl, + polyNewtypeDecl, + polyRecordDecl, + primIdent, + primName, + primTyCon, + recordDecl, + sumDecl, + tuple2Ty, builtinTyCon, + ) + +-- | Ledger API data declarations, as per https://github.com/IntersectMBO/plutus/blob/master/plutus-ledger-api/src/PlutusLedgerApi/V2.hs +ledgerDecls :: [(Qualified (ProperName 'TypeName), DataDecl SourceType SourceType)] +ledgerDecls = + [ -- Context types + scriptContextDecl + , scriptPurposeDecl + , -- Bytes + ledgerBytesDecl + , -- Certificates + dcertDecl + , -- Credentials + stakingCredentialDecl + , credentialDecl + , -- Value + valueDecl + , currencySymbolDecl + , tokenNameDecl + , lovelaceDecl + , -- Time + posixTimeDecl + , -- No POSIXTimeRange, people can use the actual type instead of a synonym + -- Types for representing transactions + addressDecl + , pubKeyHashDecl + , txIdDecl + , txInfoDecl + , txOutDecl + , txOutRefDecl + , txInInfoDecl + , outputDatumDecl + , -- Intervals + intervalDecl + , extendedDecl + , upperBoundDecl + , lowerBoundDecl + , -- Association maps + assocMapDecl + , -- Newtypes and hash types + scriptHashDecl + , redeemerDecl + , redeemerHashDecl + , datumDecl + , datumHashDecl + -- Primitive Maybe + , maybeDecl + ] + +scriptContextDecl :: (Qualified (ProperName 'TypeName), DataDecl SourceType SourceType) +scriptContextDecl = + recordDecl + "ScriptContext" + [ ("txInfo", primTyCon "TxInfo") + , ("purpose", primTyCon "ScriptPurpose") + ] + +scriptPurposeDecl :: (Qualified (ProperName 'TypeName), DataDecl SourceType SourceType) +scriptPurposeDecl = + sumDecl + "ScriptPurpose" + [ ("Minting", [primTyCon "CurrencySymbol"]) + , ("Spending", [primTyCon "TxOutRef"]) + , ("Rewarding", [primTyCon "StakingCredential"]) + , ("Certifying", [primTyCon "DCert"]) + ] + +ledgerBytesDecl :: (Qualified (ProperName 'TypeName), DataDecl SourceType SourceType) +ledgerBytesDecl = newtypeDecl "LedgerBytes" . builtinTyCon $ "BuiltinByteString" + +dcertDecl :: (Qualified (ProperName 'TypeName), DataDecl SourceType SourceType) +dcertDecl = + sumDecl + "DCert" + [ ("DCertDelegRegKey", [primTyCon "StakingCredential"]) + , ("DCertDelegDeRegKey", [primTyCon "StakingCredential"]) + , ("DCertDelegDelegate", [primTyCon "StakingCredential", primTyCon "PubKeyHash"]) + , ("DCertPoolRegister", [primTyCon "PubKeyHash", primTyCon "PubKeyHash"]) + , ("DCertPoolRetire", [primTyCon "PubKeyHash", primTyCon "Int"]) + , ("DCertGenesis", []) + , ("DCertMir", []) + ] + +stakingCredentialDecl :: (Qualified (ProperName 'TypeName), DataDecl SourceType SourceType) +stakingCredentialDecl = + sumDecl + "StakingCredential" + [ ("StakingHash", [primTyCon "Credential"]) + , ("StakingPtr", [primTyCon "Int", primTyCon "Int", primTyCon "Int"]) + ] + +credentialDecl :: (Qualified (ProperName 'TypeName), DataDecl SourceType SourceType) +credentialDecl = + sumDecl + "Credential" + [ ("PubKeyCredential", [primTyCon "PubKeyHash"]) + , ("ScriptCredential", [primTyCon "ScriptHash"]) + ] + +valueDecl :: (Qualified (ProperName 'TypeName), DataDecl SourceType SourceType) +valueDecl = + newtypeDecl "Value" + . mapTy (primTyCon "CurrencySymbol") + . mapTy (primTyCon "TokenName") + . primTyCon + $ "Int" + +currencySymbolDecl :: (Qualified (ProperName 'TypeName), DataDecl SourceType SourceType) +currencySymbolDecl = newtypeDecl "CurrencySymbol" . builtinTyCon $ "BuiltinByteString" + +tokenNameDecl :: (Qualified (ProperName 'TypeName), DataDecl SourceType SourceType) +tokenNameDecl = newtypeDecl "TokenName" . builtinTyCon $ "BuiltinByteString" + +lovelaceDecl :: (Qualified (ProperName 'TypeName), DataDecl SourceType SourceType) +lovelaceDecl = newtypeDecl "Lovelace" . primTyCon $ "Int" + +posixTimeDecl :: (Qualified (ProperName 'TypeName), DataDecl SourceType SourceType) +posixTimeDecl = newtypeDecl "POSIXTime" . primTyCon $ "Int" + +addressDecl :: (Qualified (ProperName 'TypeName), DataDecl SourceType SourceType) +addressDecl = + recordDecl + "Address" + [ ("credential", primTyCon "Credential") + , ("stakingCredential", maybeTy . primTyCon $ "StakingCredential") + ] + +pubKeyHashDecl :: (Qualified (ProperName 'TypeName), DataDecl SourceType SourceType) +pubKeyHashDecl = newtypeDecl "PubKeyHash" . builtinTyCon $ "BuiltinByteString" + +txIdDecl :: (Qualified (ProperName 'TypeName), DataDecl SourceType SourceType) +txIdDecl = newtypeDecl "TxId" . builtinTyCon $ "BuiltinByteString" + +txInfoDecl :: (Qualified (ProperName 'TypeName), DataDecl SourceType SourceType) +txInfoDecl = + recordDecl + "TxInfo" + [ ("inputs", listTy . primTyCon $ "TxInInfo") + , ("referenceInputs", listTy . primTyCon $ "TxInInfo") + , ("outputs", listTy . primTyCon $ "TxOut") + , ("fee", primTyCon "Value") + , ("mint", primTyCon "Value") + , ("dCert", listTy . primTyCon $ "DCert") + , ("wdrl", mapTy (primTyCon "StakingCredential") (primTyCon "Int")) + , ("validRange", TypeApp nullSourceAnn (primTyCon "Interval") (primTyCon "POSIXTime")) + , ("signatories", listTy . primTyCon $ "PubKeyHash") + , ("redeemers", mapTy (primTyCon "ScriptPurpose") (primTyCon "Redeemer")) + , ("data", mapTy (primTyCon "DatumHash") (primTyCon "Datum")) + , ("id", primTyCon "TxId") + ] + +txOutDecl :: (Qualified (ProperName 'TypeName), DataDecl SourceType SourceType) +txOutDecl = + recordDecl + "TxOut" + [ ("address", primTyCon "Address") + , ("value", primTyCon "Value") + , ("datum", primTyCon "OutputDatum") + , ("referenceScript", maybeTy . primTyCon $ "ScriptHash") + ] + +txOutRefDecl :: (Qualified (ProperName 'TypeName), DataDecl SourceType SourceType) +txOutRefDecl = + recordDecl + "TxOutRef" + [ ("id", primTyCon "TxId") + , ("idx", primTyCon "Int") + ] + +txInInfoDecl :: (Qualified (ProperName 'TypeName), DataDecl SourceType SourceType) +txInInfoDecl = + recordDecl + "TxInInfo" + [ ("txOutRef", primTyCon "TxOutRef") + , ("resolved", primTyCon "TxOut") + ] + +outputDatumDecl :: (Qualified (ProperName 'TypeName), DataDecl SourceType SourceType) +outputDatumDecl = + sumDecl + "OutputDatum" + [ ("NoOutputDatum", []) + , ("OutputDatumHash", [primTyCon "DatumHash"]) + , ("OutputDatum", [primTyCon "Datum"]) + ] + +intervalDecl :: (Qualified (ProperName 'TypeName), DataDecl SourceType SourceType) +intervalDecl = + polyRecordDecl + "Interval" + ["a"] + [ ("from", TypeApp nullSourceAnn (primTyCon "LowerBound") (TypeVar nullSourceAnn "a" kindType)) + , ("to", TypeApp nullSourceAnn (primTyCon "UpperBound") (TypeVar nullSourceAnn "a" kindType)) + ] + +extendedDecl :: (Qualified (ProperName 'TypeName), DataDecl SourceType SourceType) +extendedDecl = + let name = primName "Extended" + in ( name + , DataDecl + Data + name + [("a", kindType)] + [ CtorDecl (primIdent "NegInf") [] + , CtorDecl (primIdent "Finite") [(UnusedIdent, TypeVar nullSourceAnn "a" kindType)] + , CtorDecl (primIdent "PosInf") [] + ] + ) + +upperBoundDecl :: (Qualified (ProperName 'TypeName), DataDecl SourceType SourceType) +upperBoundDecl = polyNewtypeDecl "UpperBound" ["a"] (TypeApp nullSourceAnn (primTyCon "Extended") (TypeVar nullSourceAnn "a" kindType)) + +lowerBoundDecl :: (Qualified (ProperName 'TypeName), DataDecl SourceType SourceType) +lowerBoundDecl = polyNewtypeDecl "LowerBound" ["a"] (TypeApp nullSourceAnn (primTyCon "Extended") (TypeVar nullSourceAnn "a" kindType)) + +assocMapDecl :: (Qualified (ProperName 'TypeName), DataDecl SourceType SourceType) +assocMapDecl = polyNewtypeDecl "AssocMap" ["k", "v"] (listTy (tuple2Ty (TypeVar nullSourceAnn "k" kindType) (TypeVar nullSourceAnn "v" kindType))) + +scriptHashDecl :: (Qualified (ProperName 'TypeName), DataDecl SourceType SourceType) +scriptHashDecl = newtypeDecl "ScriptHash" . builtinTyCon $ "BuiltinByteString" + +redeemerDecl :: (Qualified (ProperName 'TypeName), DataDecl SourceType SourceType) +redeemerDecl = newtypeDecl "Redeemer" . builtinTyCon $ "BuiltinData" + +redeemerHashDecl :: (Qualified (ProperName 'TypeName), DataDecl SourceType SourceType) +redeemerHashDecl = newtypeDecl "RedeemerHash" . builtinTyCon $ "BuiltinByteString" + +datumDecl :: (Qualified (ProperName 'TypeName), DataDecl SourceType SourceType) +datumDecl = newtypeDecl "Datum" . builtinTyCon $ "BuiltinData" + +datumHashDecl :: (Qualified (ProperName 'TypeName), DataDecl SourceType SourceType) +datumHashDecl = newtypeDecl "DatumHash" . builtinTyCon $ "BuiltinByteString" + +maybeDecl :: (Qualified (ProperName 'TypeName), DataDecl SourceType SourceType) +maybeDecl = + let name = primName "Maybe" + in ( name + , DataDecl + Data + name + [("a", kindType)] + [ CtorDecl (primIdent "Nothing") [] + , CtorDecl (primIdent "Just") [(UnusedIdent, TypeVar nullSourceAnn "a" kindType)] + ] + ) diff --git a/src/Language/Purus/Prim/Utils.hs b/src/Language/Purus/Prim/Utils.hs new file mode 100644 index 000000000..b08df1dc5 --- /dev/null +++ b/src/Language/Purus/Prim/Utils.hs @@ -0,0 +1,227 @@ +module Language.Purus.Prim.Utils where + +-- Helpers + +import Data.Text (Text) +import Language.PureScript.AST.SourcePos (SourceAnn, nullSourceAnn) +import Language.PureScript.Constants.Prim qualified as C +import Language.PureScript.CoreFn.Module ( + CtorDecl (CtorDecl), + DataDecl (DataDecl), + ) +import Language.PureScript.Environment ( + DataDeclType (Data, Newtype), + TypeKind (DataType), + kindType, + (-:>), + ) +import Language.PureScript.Label (Label) +import Language.PureScript.Names ( + Ident (Ident, UnusedIdent), + ModuleName (ModuleName), + ProperName (..), + ProperNameType (ConstructorName, TypeName), + Qualified (Qualified), + QualifiedBy (ByModuleName), + ) +import Language.PureScript.Roles (Role (Nominal)) +import Language.PureScript.Types ( + SourceType, + Type (RCons, REmpty, TypeApp, TypeConstructor, TypeVar), + ) +import Prelude + +-- | Converts a ProperName to an Ident. Duplicated here to break a module cycle. +properToIdent :: ProperName a -> Ident +properToIdent = Ident . runProperName + +monoType :: Text -> TypeKind -> (Qualified (ProperName 'TypeName), (Type SourceAnn, TypeKind)) +monoType tyName tyDef = (primName tyName, (kindType, tyDef)) + +polyType :: Text -> [Text] -> TypeKind -> (Qualified (ProperName 'TypeName), (Type SourceAnn, TypeKind)) +polyType tyName vars tyDef = (primName tyName, (go vars, tyDef)) + where + go :: [Text] -> Type SourceAnn + go = \case + [] -> kindType + (_ : vs) -> kindType -:> go vs + +builtinName :: Text -> Qualified (ProperName 'TypeName) +builtinName nm = Qualified (ByModuleName (ModuleName "Builtin")) (ProperName nm) + +primName :: Text -> Qualified (ProperName 'TypeName) +primName tyName = Qualified (ByModuleName (ModuleName "Prim")) (ProperName tyName) + +recordType :: Text -> [(Label, Type SourceAnn)] -> TypeKind +recordType conName fields = DataType Newtype [] [(ProperName conName, [mkRecordT . go $ fields])] + where + go :: [(Label, Type SourceAnn)] -> Type SourceAnn + go = \case + [] -> REmpty nullSourceAnn + ((fName, fType) : xs) -> RCons nullSourceAnn fName fType $ go xs + +polyRecordType :: Text -> [Text] -> [(Label, Type SourceAnn)] -> TypeKind +polyRecordType conName vars fields = + DataType Newtype (fmap nominalVar vars) [(ProperName conName, [mkRecordT . go $ fields])] + where + go :: [(Label, Type SourceAnn)] -> Type SourceAnn + go = \case + [] -> REmpty nullSourceAnn + ((fName, fType) : xs) -> RCons nullSourceAnn fName fType $ go xs + +tyCon :: Text -> Type SourceAnn +tyCon = TypeConstructor nullSourceAnn . primName + +tyConBuiltin :: Text -> Type SourceAnn +tyConBuiltin = TypeConstructor nullSourceAnn . builtinName + +mkRecordT :: Type SourceAnn -> Type SourceAnn +mkRecordT = TypeApp nullSourceAnn (TypeConstructor nullSourceAnn C.Record) + +sumType :: [(Text, [Type SourceAnn])] -> TypeKind +sumType = DataType Data [] . fmap go + where + go :: (Text, [Type SourceAnn]) -> (ProperName 'ConstructorName, [Type SourceAnn]) + go (varName, varArgs) = (ProperName varName, varArgs) + +sumDecl :: Text -> [(Text, [SourceType])] -> (Qualified (ProperName 'TypeName), DataDecl SourceType SourceType) +sumDecl tyName arms = + let tyName' = primName tyName + in (tyName', DataDecl Data tyName' [] . fmap go $ arms) + where + go :: (Text, [SourceType]) -> CtorDecl SourceType + go (conName, tys) = CtorDecl (primIdent conName) (fmap (UnusedIdent,) tys) + +newtypeOf :: Text -> Type SourceAnn -> (Qualified (ProperName 'TypeName), (Type SourceAnn, TypeKind)) +newtypeOf tyName def = + (primName tyName, (kindType, DataType Newtype [] [(ProperName tyName, [def])])) + +polyNewtypeOf :: Text -> [Text] -> Type SourceAnn -> (Qualified (ProperName 'TypeName), (Type SourceAnn, TypeKind)) +polyNewtypeOf tyName vars def = + (primName tyName, (go vars, DataType Newtype (fmap nominalVar vars) [(ProperName tyName, [def])])) + where + go :: [Text] -> Type SourceAnn + go = \case + [] -> kindType + (_ : vs) -> kindType -:> go vs + +mapOf :: Type SourceAnn -> Type SourceAnn -> Type SourceAnn +mapOf keyT = tyApp (tyApp (tyCon "AssocMap") keyT) + +tyApp :: Type SourceAnn -> Type SourceAnn -> Type SourceAnn +tyApp f = TypeApp nullSourceAnn f + +maybeOf :: Type SourceAnn -> Type SourceAnn +maybeOf = tyApp (tyCon "Maybe") + +listOf :: Type SourceAnn -> Type SourceAnn +listOf = tyApp (tyCon "List") + +tuple2Of :: Type SourceAnn -> Type SourceAnn -> Type SourceAnn +tuple2Of x = tyApp (tyApp (tyCon "Tuple2") x) + +nominalVar :: Text -> (Text, Type SourceAnn, Role) +nominalVar varName = (varName, kindType, Nominal) + +tyVar :: Text -> Type SourceAnn +tyVar varName = TypeVar nullSourceAnn varName kindType + +rowFromFields :: [(Label, SourceType)] -> SourceType +rowFromFields [] = REmpty nullSourceAnn +rowFromFields ((l, t) : rest) = RCons nullSourceAnn l t $ rowFromFields rest + +recordFromFields :: [(Label, SourceType)] -> SourceType +recordFromFields = mkRecordT . rowFromFields + +polySumType :: [Text] -> [(Text, [Type SourceAnn])] -> TypeKind +polySumType vars = DataType Data (fmap nominalVar vars) . fmap go + where + go :: (Text, [Type SourceAnn]) -> (ProperName 'ConstructorName, [Type SourceAnn]) + go (varName, varArgs) = (ProperName varName, varArgs) + +recordDecl :: Text -> [(Label, SourceType)] -> (Qualified (ProperName 'TypeName), DataDecl SourceType SourceType) +recordDecl tyName fields = + let tyName' = primName tyName + in ( tyName' + , DataDecl + Newtype + tyName' + [] + [ CtorDecl + (properToIdent <$> tyName') + [(UnusedIdent, recordFromFields fields)] + ] + ) + +polyRecordDecl :: + Text -> + [Text] -> + [(Label, SourceType)] -> + (Qualified (ProperName 'TypeName), DataDecl SourceType SourceType) +polyRecordDecl tyName vars fields = + let tyName' = primName tyName + in ( tyName' + , DataDecl + Newtype + tyName' + (fmap (,kindType) vars) + [ CtorDecl + (properToIdent <$> tyName') + [(UnusedIdent, recordFromFields fields)] + ] + ) + +newtypeDecl :: Text -> SourceType -> (Qualified (ProperName 'TypeName), DataDecl SourceType SourceType) +newtypeDecl tyName def = + let tyName' = primName tyName + in ( tyName' + , DataDecl + Newtype + tyName' + [] + [ CtorDecl + (properToIdent <$> tyName') + [(UnusedIdent, def)] + ] + ) + +polyNewtypeDecl :: Text -> [Text] -> SourceType -> (Qualified (ProperName 'TypeName), DataDecl SourceType SourceType) +polyNewtypeDecl tyName vars def = + let tyName' = primName tyName + in ( tyName' + , DataDecl + Newtype + tyName' + (fmap (,kindType) vars) + [ CtorDecl + (properToIdent <$> tyName') + [(UnusedIdent, def)] + ] + ) + +mapTy :: SourceType -> SourceType -> SourceType +mapTy k = TypeApp nullSourceAnn (TypeApp nullSourceAnn (TypeConstructor nullSourceAnn (primName "AssocMap")) k) + +primTyCon :: Text -> SourceType +primTyCon = TypeConstructor nullSourceAnn . primName + +builtinTyCon :: Text -> SourceType +builtinTyCon = TypeConstructor nullSourceAnn . builtinName + +maybeTy :: SourceType -> SourceType +maybeTy = TypeApp nullSourceAnn (TypeConstructor nullSourceAnn . primName $ "Maybe") + +listTy :: SourceType -> SourceType +listTy = TypeApp nullSourceAnn (TypeConstructor nullSourceAnn . primName $ "List") + +tuple2Ty :: SourceType -> SourceType -> SourceType +tuple2Ty x = TypeApp nullSourceAnn (TypeApp nullSourceAnn (primTyCon "Tuple2") x) + +primIdent :: Text -> Qualified Ident +primIdent name = Qualified (ByModuleName (ModuleName "Prim")) (Ident name) + +mononym :: Text -> (Qualified Ident, Qualified (ProperName 'TypeName)) +mononym tyName = (primIdent tyName, primName tyName) + +arm :: Text -> Text -> (Qualified Ident, Qualified (ProperName 'TypeName)) +arm conName tyName = (primIdent conName, primName tyName) diff --git a/src/Language/Purus/TH.hs b/src/Language/Purus/TH.hs new file mode 100644 index 000000000..318677704 --- /dev/null +++ b/src/Language/Purus/TH.hs @@ -0,0 +1,179 @@ +{-# LANGUAGE TypeApplications #-} +{-# LANGUAGE StandaloneDeriving #-} +{-# LANGUAGE TemplateHaskellQuotes #-} +{-# LANGUAGE DeriveLift #-} +{-# OPTIONS_GHC -Wno-orphans #-} +{-# OPTIONS_GHC -Wno-implicit-lift #-} + +module Language.Purus.TH ( + ctDecodeModule + ) where + +import Prelude +import Language.Haskell.TH (Exp, Q) +import Control.Monad.IO.Class (liftIO) +import Data.Aeson (eitherDecodeFileStrict') +import Language.PureScript.CoreFn.Module ( + Module (Module), + Datatypes (Datatypes), + DataDecl (DataDecl), + CtorDecl (CtorDecl) + ) +import Language.PureScript.Types ( + Type (TUnknown, + TypeVar, + TypeLevelString, + TypeLevelInt, + TypeWildcard, + TypeConstructor, + TypeOp, + TypeApp, + KindApp, + ForAll, + ConstrainedType, + Skolem, + REmpty, + RCons, + KindedType, + BinaryNoParensType, + ParensInType), + Constraint (Constraint), + ConstraintData (PartialConstraintData), + WildcardData (HoleWildcard, UnnamedWildcard, IgnoredWildcard), + SkolemScope (SkolemScope), + TypeVarVisibility (TypeVarVisible, TypeVarInvisible) + ) +import Language.PureScript.CoreFn.Ann (Ann) +import Language.PureScript.AST.SourcePos ( + SourceAnn, + SourcePos (SourcePos), + SourceSpan (SourceSpan) + ) +import Language.PureScript.CoreFn.Expr ( + Bind (NonRec, Rec), + Expr (Literal, + Accessor, + ObjectUpdate, + Abs, + App, + Var, + Case, + Let), + CaseAlternative (CaseAlternative) + ) +import Language.PureScript.CoreFn.FromJSON () +import Language.Haskell.TH.Syntax (Lift) +import Language.PureScript.Names ( + Qualified (Qualified), + Ident (Ident, GenIdent, UnusedIdent, InternalIdent), + InternalIdentData (RuntimeLazyFactory, Lazy), + QualifiedBy (BySourcePos, ByModuleName), + ModuleName (ModuleName), + ProperName (ProperName), + ProperNameType (TypeName, ClassName, ConstructorName), + OpName (OpName), + OpNameType (TypeOpName), + ) +import Language.PureScript.Comments ( + Comment (LineComment, BlockComment) + ) +import Language.PureScript.Label (Label (Label)) +import Language.PureScript.Environment ( + DataDeclType (Data, Newtype) + ) +import Language.PureScript.AST.Literals ( + Literal (NumericLiteral, + StringLiteral, + CharLiteral, + BooleanLiteral, + ListLiteral, + ObjectLiteral + ) + ) +import Language.PureScript.CoreFn.Binders ( + Binder (NullBinder, + LiteralBinder, + VarBinder, + ConstructorBinder, + NamedBinder + ) + ) +import Language.PureScript.CoreFn.Meta ( + Meta (IsConstructor, + IsNewtype, + IsTypeClassConstructor, + IsForeign, + IsWhere, + IsSyntheticApp + ), + ConstructorType (ProductType, SumType) + ) + +deriving stock instance Lift InternalIdentData + +deriving stock instance Lift Ident + +deriving stock instance Lift SourcePos + +deriving stock instance Lift ModuleName + +deriving stock instance Lift QualifiedBy + +deriving stock instance Lift a => Lift (Qualified a) + +deriving stock instance Lift (ProperName 'TypeName) + +deriving stock instance Lift (OpName 'TypeOpName) + +deriving stock instance Lift (ProperName 'ClassName) + +deriving stock instance Lift ConstraintData + +deriving stock instance Lift SourceSpan + +deriving stock instance Lift Comment + +deriving stock instance Lift (Constraint SourceAnn) + +deriving stock instance Lift WildcardData + +deriving stock instance Lift SkolemScope + +deriving stock instance Lift TypeVarVisibility + +deriving stock instance Lift Label + +deriving stock instance Lift (Type SourceAnn) + +deriving stock instance Lift (CtorDecl (Type SourceAnn)) + +deriving stock instance Lift DataDeclType + +deriving stock instance Lift (DataDecl (Type SourceAnn) (Type SourceAnn)) + +deriving stock instance Lift (Datatypes (Type SourceAnn) (Type SourceAnn)) + +deriving stock instance Lift a => Lift (Literal a) + +deriving stock instance Lift (ProperName 'ConstructorName) + +deriving stock instance Lift ConstructorType + +deriving stock instance Lift Meta + +deriving stock instance Lift (Binder Ann) + +deriving stock instance Lift (CaseAlternative Ann) + +deriving stock instance Lift (Expr Ann) + +deriving stock instance Lift (Bind Ann) + +deriving stock instance Lift (Module (Bind Ann) (Type SourceAnn) (Type SourceAnn) Ann) + +ctDecodeModule :: FilePath -> Q Exp +ctDecodeModule fp = do + decoded <- liftIO $ eitherDecodeFileStrict' @(Module (Bind Ann) (Type SourceAnn) (Type SourceAnn) Ann) fp + case decoded of + Left err -> fail $ "Cannot construct a Module from " <> fp <> "\nReason: " <> err + Right res -> [| res |] diff --git a/src/Language/Purus/Types.hs b/src/Language/Purus/Types.hs new file mode 100644 index 000000000..214dcef5c --- /dev/null +++ b/src/Language/Purus/Types.hs @@ -0,0 +1,56 @@ +{-# LANGUAGE TemplateHaskell #-} + +module Language.Purus.Types where + +import Prelude + +import Data.Map (Map) +import Data.Map qualified as M + +import Data.Text (Text) + +import Language.PureScript.Names ( + Ident, + ProperName, + ProperNameType (TypeName), + Qualified, + ) + +import PlutusCore qualified as PLC +import PlutusIR qualified as PIR + +import Control.Lens.TH (makeLenses) + +type PIRDatatype = + PIR.Datatype + PIR.TyName + PIR.Name + PLC.DefaultUni + () + +type PIRType = PIR.Type PIR.TyName PLC.DefaultUni () + +type PIRTerm = PIR.Term PIR.TyName PIR.Name PLC.DefaultUni PLC.DefaultFun () + +type PLCTerm = PLC.Term PLC.TyName PLC.Name PLC.DefaultUni PLC.DefaultFun () + +data DatatypeDictionary = DatatypeDictionary + { _pirDatatypes :: Map (Qualified (ProperName 'TypeName)) PIRDatatype + -- ^ The datatype declarations & their corresponding PS type name + , _constrNames :: Map (Qualified Ident) (PIR.Name, Int) + -- ^ Map from PS Constructors (free variables) to PLC Names (w/ a unique) & constructor indices + , _tyNames :: Map (Qualified (ProperName 'TypeName)) PIR.TyName + -- ^ Map from PS Type names to PLC Type Names (w/ a unique) + , _tyVars :: Map Text PIR.TyName + -- ^ Locally bound type variables, to be used with `withLocalTyVars` + , _vars :: Map Text PIR.Name + -- ^ Locally bound variables. This is only used when we need to introduce new variables during conversion + , _destructors :: Map (Qualified (ProperName 'TypeName)) PIR.Name + -- ^ Map from a PS type name to the name of the case destructor + } + +initDatatypeDict :: DatatypeDictionary +initDatatypeDict = DatatypeDictionary M.empty M.empty M.empty M.empty M.empty M.empty + +-- jfc why didn't i makeLenses everywhere +makeLenses ''DatatypeDictionary diff --git a/src/Language/Purus/Utils.hs b/src/Language/Purus/Utils.hs new file mode 100644 index 000000000..e8e6ed6d5 --- /dev/null +++ b/src/Language/Purus/Utils.hs @@ -0,0 +1,112 @@ +module Language.Purus.Utils where + +import Prelude + +import Language.PureScript.AST.SourcePos (SourceAnn) +import Language.PureScript.Label (Label (runLabel)) +import Language.PureScript.PSString (PSString) +import Language.PureScript.Types (RowListItem (rowListLabel), rowToList) + +import Language.PureScript.CoreFn.Ann (Ann) +import Language.PureScript.CoreFn.Expr (Bind, PurusType) +import Language.PureScript.CoreFn.FromJSON () +import Language.PureScript.CoreFn.Module (Module (..)) +import Language.PureScript.Names ( + Ident (Ident), + Qualified (..), + pattern ByNullSourcePos, + ) + +import Language.Purus.Debug (doTrace) +import Language.Purus.IR (BVar, BindE (..), Exp) +import Language.Purus.IR.Utils (IR_Decl, Vars, WithObjects, foldBinds, toExp) + +import Control.Exception (throwIO) + +import Data.List (find) + +import Data.Map (Map) +import Data.Map qualified as M + +import Data.Text (Text) +import Data.Text qualified as T + +import Data.Aeson qualified as Aeson + +import Bound (Scope) + +{- IO utility. Reads a CoreFn module from a source file. + +-} +decodeModuleIO :: FilePath -> IO (Module (Bind Ann) PurusType PurusType Ann) +decodeModuleIO path = + Aeson.eitherDecodeFileStrict' path >>= \case + Left err -> throwIO $ userError err + Right modx -> pure modx + +{- Turns a Row Type into a Map of field names to Row item data. + + NOTE: Be sure to unwrap the enclosing record if you're working w/ a + record type. +-} +mkFieldMap :: PurusType -> Map PSString (RowListItem SourceAnn) +mkFieldMap fs = M.fromList $ (\x -> (runLabel (rowListLabel x), x)) <$> (fst . rowToList $ fs) + +{- Find the body of a declaration with the given name in the given module. + +-} +findMain :: + forall k. + Text -> + Module IR_Decl k PurusType Ann -> + Maybe ((Ident, Int), Scope (BVar PurusType) (Exp WithObjects PurusType) (Vars PurusType)) +findMain nm Module {..} = doTrace "findDeclBody" ("NAME: " <> T.unpack nm) $ findMain' (Ident nm) moduleDecls + +findMain' :: + forall x ty. + Ident -> + [BindE ty (Exp x ty) (Vars ty)] -> + Maybe ((Ident, Int), Scope (BVar ty) (Exp x ty) (Vars ty)) +findMain' ident binds = case findInlineDeclGroup ident binds of + Nothing -> Nothing + Just decl -> case decl of + NonRecursive nrid nrix e -> Just ((nrid, nrix), e) + Recursive xs -> case find (\x -> fst (fst x) == ident) xs of + Nothing -> Nothing + Just ((idnt, indx), e) -> Just ((idnt, indx), e) + +{- Find the declaration *group* to which a given identifier belongs. +-} +findInlineDeclGroup :: + Ident -> + [BindE ty (Exp x ty) a] -> + Maybe (BindE ty (Exp x ty) a) +findInlineDeclGroup _ [] = Nothing +findInlineDeclGroup ident (NonRecursive ident' bvix expr : rest) + | ident == ident' = Just $ NonRecursive ident' bvix expr + | otherwise = findInlineDeclGroup ident rest +findInlineDeclGroup ident (Recursive xs : rest) = case find (\x -> fst (fst x) == ident) xs of + Nothing -> findInlineDeclGroup ident rest + Just _ -> Just (Recursive xs) + +qualifyNull :: a -> Qualified a +qualifyNull = Qualified ByNullSourcePos + +-- +findDeclBodyWithIndex :: + Ident -> + Int -> + [BindE ty (Exp x ty) (Vars ty)] -> + Maybe (Exp x ty (Vars ty)) +findDeclBodyWithIndex nm i binds = + foldBinds go Nothing binds + where + go :: + Maybe (Exp x ty (Vars ty)) -> + (Ident, Int) -> + Scope (BVar ty) (Exp x ty) (Vars ty) -> + Maybe (Exp x ty (Vars ty)) + go (Just res) _ _ = Just res + go Nothing (nm', i') body + | nm' == nm && i' == i = Just (toExp body) + | otherwise = Nothing diff --git a/src/System/IO/UTF8.hs b/src/System/IO/UTF8.hs index 9ac916cf9..56559b84e 100644 --- a/src/System/IO/UTF8.hs +++ b/src/System/IO/UTF8.hs @@ -10,14 +10,15 @@ import Data.Text (Text) import Data.Text.Encoding qualified as TE import Protolude (ordNub) --- | Unfortunately ByteString's readFile does not convert line endings on --- Windows, so we have to do it ourselves +{- | Unfortunately ByteString's readFile does not convert line endings on +Windows, so we have to do it ourselves +-} fixCRLF :: BS.ByteString -> BS.ByteString fixCRLF = BSL.toStrict . BSS.replace "\r\n" ("\n" :: BS.ByteString) readUTF8FilesT :: [FilePath] -> IO [(FilePath, Text)] readUTF8FilesT = - traverse (\inFile -> (inFile, ) <$> readUTF8FileT inFile) . ordNub + traverse (\inFile -> (inFile,) <$> readUTF8FileT inFile) . ordNub readUTF8FileT :: FilePath -> IO Text readUTF8FileT inFile = diff --git a/tests/Language/PureScript/Ide/RebuildSpec.hs b/tests/Language/PureScript/Ide/RebuildSpec.hs index 93a0cabe5..7da70065c 100644 --- a/tests/Language/PureScript/Ide/RebuildSpec.hs +++ b/tests/Language/PureScript/Ide/RebuildSpec.hs @@ -15,7 +15,7 @@ import System.Directory (doesFileExist, removePathForcibly) import Test.Hspec (Spec, describe, it, shouldBe, shouldSatisfy) defaultTarget :: Set P.CodegenTarget -defaultTarget = Set.singleton P.JS +defaultTarget = Set.singleton P.CoreFn load :: [Text] -> Command load = LoadSync . map Test.mn diff --git a/tests/Main.hs b/tests/Main.hs index b8f6ea979..6b8ec2c0e 100644 --- a/tests/Main.hs +++ b/tests/Main.hs @@ -21,6 +21,7 @@ import TestSourceMaps qualified import TestMake qualified import TestUtils qualified import TestGraph qualified +import TestPurus (shouldPassTests) import System.IO (hSetEncoding, stdout, stderr, utf8) @@ -28,21 +29,26 @@ main :: IO () main = do hSetEncoding stdout utf8 hSetEncoding stderr utf8 + shouldPassTests {- do + hSetEncoding stdout utf8 + hSetEncoding stderr utf8 TestUtils.updateSupportCode + shouldPassTests hspec $ do describe "cst" TestCst.spec describe "ast" TestAst.spec - describe "ide" TestIde.spec + -- describe "ide" TestIde.spec beforeAll TestUtils.setupSupportModules $ do describe "compiler" TestCompiler.spec - describe "sourcemaps" TestSourceMaps.spec + -- describe "sourcemaps" TestSourceMaps.spec describe "make" TestMake.spec - describe "psci" TestPsci.spec + -- describe "psci" TestPsci.spec describe "corefn" TestCoreFn.spec - describe "docs" TestDocs.spec - describe "prim-docs" TestPrimDocs.spec - describe "publish" TestPscPublish.spec + -- describe "docs" TestDocs.spec + -- describe "prim-docs" TestPrimDocs.spec + -- describe "publish" TestPscPublish.spec describe "hierarchy" TestHierarchy.spec - describe "graph" TestGraph.spec + -- describe "graph" TestGraph.spec +-} diff --git a/tests/TestAst.hs b/tests/TestAst.hs index bb2e88044..c36491366 100644 --- a/tests/TestAst.hs +++ b/tests/TestAst.hs @@ -80,7 +80,7 @@ genTypeAnnotatedWith genTypeAnn genConstraintAnn = genType where genSkolemScope = SkolemScope <$> arbitrary genType :: Gen (Type a) - genType = genericArbitraryRecG (genTypeAnn :+ generatorEnvironment) uniform `withBaseCase` (TypeVar <$> genTypeAnn <*> genText) + genType = genericArbitraryRecG (genTypeAnn :+ generatorEnvironment) uniform `withBaseCase` (TypeVar <$> genTypeAnn <*> genText <*> genType) -- FIXME: generate "real" kinds genWildcardData :: Gen WildcardData genWildcardData = genericArbitraryUG genText diff --git a/tests/TestCoreFn.hs b/tests/TestCoreFn.hs index 588c6817b..ddf7b1747 100644 --- a/tests/TestCoreFn.hs +++ b/tests/TestCoreFn.hs @@ -17,14 +17,17 @@ import Language.PureScript.CoreFn.FromJSON (moduleFromJSON) import Language.PureScript.CoreFn.ToJSON (moduleToJSON) import Language.PureScript.Names (pattern ByNullSourcePos, Ident(..), ModuleName(..), ProperName(..), Qualified(..), QualifiedBy(..)) import Language.PureScript.PSString (mkString) +import Language.PureScript.Environment +import Language.PureScript.Types import Test.Hspec (Spec, context, shouldBe, shouldSatisfy, specify) +import Language.PureScript.CoreFn.Desugar.Utils (purusTy) -parseModule :: Value -> Result (Version, Module Ann) +parseModule :: Value -> Result (Version, Module (Bind Ann) SourceType SourceType Ann) parseModule = parse moduleFromJSON -- convert a module to its json CoreFn representation and back -parseMod :: Module Ann -> Result (Module Ann) +parseMod :: Module (Bind Ann) SourceType SourceType Ann -> Result (Module (Bind Ann) SourceType SourceType Ann) parseMod m = let v = Version [0] [] in snd <$> parseModule (moduleToJSON v m) @@ -33,8 +36,10 @@ isSuccess :: Result a -> Bool isSuccess (Success _) = True isSuccess _ = False +-- TODO: Fix spec :: Spec -spec = context "CoreFnFromJson" $ do +spec = pure () {- + context "CoreFnFromJson" $ do let mn = ModuleName "Example.Main" mp = "src/Example/Main.purs" ss = SourceSpan mp (SourcePos 0 0) (SourcePos 0 0) @@ -102,16 +107,17 @@ spec = context "CoreFnFromJson" $ do context "Expr" $ do specify "should parse literals" $ do let m = Module ss [] mn mp [] [] M.empty [] - [ NonRec ann (Ident "x1") $ Literal ann (NumericLiteral (Left 1)) - , NonRec ann (Ident "x2") $ Literal ann (NumericLiteral (Right 1.0)) - , NonRec ann (Ident "x3") $ Literal ann (StringLiteral (mkString "abc")) - , NonRec ann (Ident "x4") $ Literal ann (CharLiteral 'c') - , NonRec ann (Ident "x5") $ Literal ann (BooleanLiteral True) - , NonRec ann (Ident "x6") $ Literal ann (ArrayLiteral [Literal ann (CharLiteral 'a')]) - , NonRec ann (Ident "x7") $ Literal ann (ObjectLiteral [(mkString "a", Literal ann (CharLiteral 'a'))]) + [ NonRec ann (Ident "x1") $ Literal ann (purusTy tyInt) (NumericLiteral (Left 1)) + , NonRec ann (Ident "x2") $ Literal ann (purusTy tyNumber) (NumericLiteral (Right 1.0)) + , NonRec ann (Ident "x3") $ Literal ann (purusTy tyString) (StringLiteral (mkString "abc")) + , NonRec ann (Ident "x4") $ Literal ann (purusTy tyChar) (CharLiteral 'c') + , NonRec ann (Ident "x5") $ Literal ann (purusTy tyBoolean) (BooleanLiteral True) + , NonRec ann (Ident "x6") $ Literal ann (arrayT tyChar) (ArrayLiteral [Literal ann (purusTy tyChar) (CharLiteral 'a')]) + -- TODO: Need helpers to make the type + -- , NonRec ann (Ident "x7") $ Literal ann (ObjectLiteral [(mkString "a", Literal ann (CharLiteral 'a'))]) ] parseMod m `shouldSatisfy` isSuccess - +{- don't have the tools to write type sigs, TODO come back an fix specify "should parse Constructor" $ do let m = Module ss [] mn mp [] [] M.empty [] [ NonRec ann (Ident "constructor") $ Constructor ann (ProperName "Either") (ProperName "Left") [Ident "value0"] ] @@ -256,7 +262,7 @@ spec = context "CoreFnFromJson" $ do ] ] parseMod m `shouldSatisfy` isSuccess - + -} context "Comments" $ do specify "should parse LineComment" $ do let m = Module ss [ LineComment "line" ] mn mp [] [] M.empty [] [] @@ -265,3 +271,4 @@ spec = context "CoreFnFromJson" $ do specify "should parse BlockComment" $ do let m = Module ss [ BlockComment "block" ] mn mp [] [] M.empty [] [] parseMod m `shouldSatisfy` isSuccess +-} diff --git a/tests/TestDocs.hs b/tests/TestDocs.hs index d2b805ff0..0882610f6 100644 --- a/tests/TestDocs.hs +++ b/tests/TestDocs.hs @@ -945,7 +945,7 @@ testCases = hasTypeVar varName = getAny . P.everythingOnTypes (<>) (Any . isVar varName) - isVar varName (P.TypeVar _ name) | varName == T.unpack name = True + isVar varName (P.TypeVar _ name _) | varName == T.unpack name = True isVar _ _ = False renderedType expected ty = diff --git a/tests/TestMake.hs b/tests/TestMake.hs index 610e8465c..6cd5347f4 100644 --- a/tests/TestMake.hs +++ b/tests/TestMake.hs @@ -164,7 +164,7 @@ spec = do let modulePath = sourcesDir "Module.purs" moduleContent1 = "module Module where\nx :: Int\nx = 1" moduleContent2 = moduleContent1 <> "\ny :: Int\ny = 1" - optsWithDocs = P.defaultOptions { P.optionsCodegenTargets = Set.fromList [P.JS, P.Docs] } + optsWithDocs = P.defaultOptions { P.optionsCodegenTargets = Set.fromList [P.CoreFn, P.Docs] } go opts = compileWithOptions opts [modulePath] >>= assertSuccess oneSecond = 10 ^ (6::Int) -- microseconds. diff --git a/tests/TestPurus.hs b/tests/TestPurus.hs new file mode 100644 index 000000000..a02d2142b --- /dev/null +++ b/tests/TestPurus.hs @@ -0,0 +1,152 @@ +{-# LANGUAGE TypeApplications #-} +module TestPurus where + +import Prelude +import Data.Text (Text) +import Command.Compile ( compileForTests, PSCMakeOptions(..) ) +import Control.Monad (when,unless) +import System.FilePath +import Language.PureScript qualified as P +import Data.Set qualified as S +import Data.Foldable (traverse_) +import System.Directory (removeDirectoryRecursive, doesDirectoryExist, createDirectory) +import System.FilePath.Glob qualified as Glob +import Data.Function (on) +import Data.List (sortBy, stripPrefix, groupBy) +import Language.Purus.Make +import Language.Purus.Eval +import PlutusIR.Core.Instance.Pretty.Readable (prettyPirReadable) + +shouldPassTests :: IO () +shouldPassTests = do + traverse_ runPurusDefault shouldPass + -- let misc = "./tests/purus/passing/Misc/output/Lib/index.cfn" + {- UPLC tests disabled atm while we rewrite stuff + + uplc1 <- declToUPLC misc "main" + writeFile "./tests/purus/passing/Misc/output/Lib/main.plc" (show uplc1) + uplc2 <- declToUPLC misc "minus" + writeFile "./tests/purus/passing/Misc/output/Lib/fakeminus.plc" (show uplc2) + defaultMain $ + runPLCProgramTest + "mainTest" + (EvaluationSuccess (Constant () (Some (ValueOf DefaultUniInteger 2))),[]) + misc + "main" + -} +runPurus :: P.CodegenTarget -> FilePath -> IO () +runPurus target dir = do + outDirExists <- doesDirectoryExist outputDir + when (target /= P.CheckCoreFn) $ do + when outDirExists $ do + removeDirectoryRecursive outputDir + createDirectory outputDir + unless outDirExists $ createDirectory outputDir + files <- concat <$> getTestFiles dir + print files + print ("Compiling " <> dir) + compileForTests (makeOpts files) + print ("Done with " <> dir) + where + outputDir = dir "output" + + makeOpts :: [FilePath] -> PSCMakeOptions + makeOpts files = PSCMakeOptions { + pscmInput = files, + pscmExclude = [], + pscmOutputDir = outputDir, + pscmOpts = purusOpts, + pscmUsePrefix = False, + pscmJSONErrors = False + } + + purusOpts :: P.Options + purusOpts = P.Options { + optionsVerboseErrors = True, + optionsNoComments = True, + optionsCodegenTargets = S.singleton target + } + +runPurusDefault :: FilePath -> IO () +runPurusDefault path = runPurus P.CoreFn path + +runPurusGolden :: FilePath -> IO () +runPurusGolden path = runPurus P.CheckCoreFn path + +runFullPipeline :: FilePath -> Text -> Text -> IO () +runFullPipeline targetDir mainModuleName mainFunctionName = do + runPurusDefault targetDir + pir <- make targetDir mainModuleName mainFunctionName Nothing + result <- evaluateTerm pir + print $ prettyPirReadable result + + +shouldPass :: [FilePath] +shouldPass = map (prefix ) paths + where + prefix = "tests/purus/passing" + paths = [ + "2018", + "2138", + "2609", + "4035", + "4101", + "4105", + "4200", + "4310", + "ClassRefSyntax", + "Coercible", + "DctorOperatorAlias", + "Demo", + "ExplicitImportReExport", + "ExportExplicit", + "ExportExplicit2", + "ForeignKind", + "Import", + "ImportExplicit", + "ImportQualified", + "InstanceUnnamedSimilarClassName", + "ModuleDeps", + "Misc", + "NonOrphanInstanceFunDepExtra", + "NonOrphanInstanceMulti", + "PendingConflictingImports", + "PendingConflictingImports2", + "RedefinedFixity", + "ReExportQualified", + "ResolvableScopeConflict", + "ResolvableScopeConflict2", + "ResolvableScopeConflict3", + "RowSyntax", + "ShadowedModuleName", + "TransitiveImport", + "prelude" + ] + + +getTestFiles :: FilePath -> IO [[FilePath]] +getTestFiles testDir = do + let dir = testDir + getFiles dir <$> testGlob dir + where + -- A glob for all purs and js files within a test directory + testGlob :: FilePath -> IO [FilePath] + testGlob = Glob.globDir1 (Glob.compile "**/*.purs") + -- Groups the test files so that a top-level file can have dependencies in a + -- subdirectory of the same name. The inner tuple contains a list of the + -- .purs files and the .js files for the test case. + getFiles :: FilePath -> [FilePath] -> [[FilePath]] + getFiles baseDir + = map (filter ((== ".purs") . takeExtensions) . map (baseDir )) + . groupBy ((==) `on` extractPrefix) + . sortBy (compare `on` extractPrefix) + . map (makeRelative baseDir) + -- Extracts the filename part of a .purs file, or if the file is in a + -- subdirectory, the first part of that directory path. + extractPrefix :: FilePath -> FilePath + extractPrefix fp = + let dir = takeDirectory fp + ext = reverse ".purs" + in if dir == "." + then maybe fp reverse $ stripPrefix ext $ reverse fp + else dir diff --git a/tests/TestSourceMaps.hs b/tests/TestSourceMaps.hs index 5b91017d5..ae931b886 100644 --- a/tests/TestSourceMaps.hs +++ b/tests/TestSourceMaps.hs @@ -67,7 +67,7 @@ assertCompilesToExpectedValidOutput support inputFiles = do where compilationOptions :: P.Options - compilationOptions = P.defaultOptions { P.optionsCodegenTargets = Set.fromList [P.JS, P.JSSourceMap] } + compilationOptions = P.defaultOptions { P.optionsCodegenTargets = Set.fromList [P.CoreFn] } -- | Fails the test if the produced source maps are not valid. sourceMapIsValid :: FilePath -> Expectation diff --git a/tests/purs/docs/output/ChildDeclOrder/docs.json b/tests/purs/docs/output/ChildDeclOrder/docs.json new file mode 100644 index 000000000..480bc67b0 --- /dev/null +++ b/tests/purs/docs/output/ChildDeclOrder/docs.json @@ -0,0 +1 @@ +{"comments":null,"declarations":[{"children":[{"comments":null,"info":{"arguments":[],"declType":"dataConstructor"},"sourceSpan":{"end":[8,10],"name":"/home/gnumonik/code/work/purus/tests/purs/docs/src/ChildDeclOrder.purs","start":[8,3]},"title":"First"},{"comments":null,"info":{"arguments":[],"declType":"dataConstructor"},"sourceSpan":{"end":[9,11],"name":"/home/gnumonik/code/work/purus/tests/purs/docs/src/ChildDeclOrder.purs","start":[9,3]},"title":"Second"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["ChildDeclOrder"],"Show"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["ChildDeclOrder"],"Two"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[19,15],"name":"/home/gnumonik/code/work/purus/tests/purs/docs/src/ChildDeclOrder.purs","start":[18,1]},"title":"showTwo"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["ChildDeclOrder"],"Foo"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["ChildDeclOrder"],"Two"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[23,16],"name":"/home/gnumonik/code/work/purus/tests/purs/docs/src/ChildDeclOrder.purs","start":[21,1]},"title":"fooTwo"}],"comments":null,"info":{"dataDeclType":"data","declType":"data","roles":[],"typeArguments":[]},"kind":null,"sourceSpan":{"end":[9,11],"name":"/home/gnumonik/code/work/purus/tests/purs/docs/src/ChildDeclOrder.purs","start":[7,1]},"title":"Two"},{"children":[{"comments":null,"info":{"declType":"typeClassMember","type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim"],"String"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[12,22],"name":"/home/gnumonik/code/work/purus/tests/purs/docs/src/ChildDeclOrder.purs","start":[12,3]},"title":"show"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["ChildDeclOrder"],"Show"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["ChildDeclOrder"],"Two"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[19,15],"name":"/home/gnumonik/code/work/purus/tests/purs/docs/src/ChildDeclOrder.purs","start":[18,1]},"title":"showTwo"}],"comments":null,"info":{"arguments":[["a",null]],"declType":"typeClass","fundeps":[],"superclasses":[]},"kind":null,"sourceSpan":{"end":[12,22],"name":"/home/gnumonik/code/work/purus/tests/purs/docs/src/ChildDeclOrder.purs","start":[11,1]},"title":"Show"},{"children":[{"comments":null,"info":{"declType":"typeClassMember","type":{"annotation":[],"contents":"a","tag":"TypeVar"}},"sourceSpan":{"end":[15,12],"name":"/home/gnumonik/code/work/purus/tests/purs/docs/src/ChildDeclOrder.purs","start":[15,3]},"title":"foo1"},{"comments":null,"info":{"declType":"typeClassMember","type":{"annotation":[],"contents":"a","tag":"TypeVar"}},"sourceSpan":{"end":[16,12],"name":"/home/gnumonik/code/work/purus/tests/purs/docs/src/ChildDeclOrder.purs","start":[16,3]},"title":"foo2"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["ChildDeclOrder"],"Foo"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["ChildDeclOrder"],"Two"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[23,16],"name":"/home/gnumonik/code/work/purus/tests/purs/docs/src/ChildDeclOrder.purs","start":[21,1]},"title":"fooTwo"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["ChildDeclOrder"],"Foo"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[27,11],"name":"/home/gnumonik/code/work/purus/tests/purs/docs/src/ChildDeclOrder.purs","start":[25,1]},"title":"fooInt"}],"comments":null,"info":{"arguments":[["a",null]],"declType":"typeClass","fundeps":[],"superclasses":[]},"kind":null,"sourceSpan":{"end":[16,12],"name":"/home/gnumonik/code/work/purus/tests/purs/docs/src/ChildDeclOrder.purs","start":[14,1]},"title":"Foo"}],"name":"ChildDeclOrder","reExports":[]} \ No newline at end of file diff --git a/tests/purs/docs/output/ChildDeclOrder/externs.cbor b/tests/purs/docs/output/ChildDeclOrder/externs.cbor new file mode 100644 index 000000000..78989a901 Binary files /dev/null and b/tests/purs/docs/output/ChildDeclOrder/externs.cbor differ diff --git a/tests/purs/docs/output/Clash/docs.json b/tests/purs/docs/output/Clash/docs.json new file mode 100644 index 000000000..ac362d7c5 --- /dev/null +++ b/tests/purs/docs/output/Clash/docs.json @@ -0,0 +1 @@ +{"comments":null,"declarations":[],"name":"Clash","reExports":[]} \ No newline at end of file diff --git a/tests/purs/docs/output/Clash/externs.cbor b/tests/purs/docs/output/Clash/externs.cbor new file mode 100644 index 000000000..0c1777bb7 Binary files /dev/null and b/tests/purs/docs/output/Clash/externs.cbor differ diff --git a/tests/purs/docs/output/Clash1/docs.json b/tests/purs/docs/output/Clash1/docs.json new file mode 100644 index 000000000..649a175bd --- /dev/null +++ b/tests/purs/docs/output/Clash1/docs.json @@ -0,0 +1 @@ +{"comments":null,"declarations":[],"name":"Clash1","reExports":[]} \ No newline at end of file diff --git a/tests/purs/docs/output/Clash1/externs.cbor b/tests/purs/docs/output/Clash1/externs.cbor new file mode 100644 index 000000000..5d2fc758d Binary files /dev/null and b/tests/purs/docs/output/Clash1/externs.cbor differ diff --git a/tests/purs/docs/output/Clash1a/docs.json b/tests/purs/docs/output/Clash1a/docs.json new file mode 100644 index 000000000..f03805552 --- /dev/null +++ b/tests/purs/docs/output/Clash1a/docs.json @@ -0,0 +1 @@ +{"comments":null,"declarations":[{"children":[],"comments":null,"info":{"declType":"value","type":{"annotation":[],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}},"kind":null,"sourceSpan":{"end":[3,13],"name":"/home/gnumonik/code/work/purus/tests/purs/docs/src/Clash1a.purs","start":[3,1]},"title":"value"},{"children":[],"comments":null,"info":{"arguments":[],"declType":"typeSynonym","type":{"annotation":[],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}},"kind":null,"sourceSpan":{"end":[6,17],"name":"/home/gnumonik/code/work/purus/tests/purs/docs/src/Clash1a.purs","start":[6,1]},"title":"Type'"},{"children":[{"comments":null,"info":{"declType":"typeClassMember","type":{"annotation":[],"contents":"a","tag":"TypeVar"}},"sourceSpan":{"end":[9,23],"name":"/home/gnumonik/code/work/purus/tests/purs/docs/src/Clash1a.purs","start":[9,3]},"title":"typeClassMember"}],"comments":null,"info":{"arguments":[["a",null]],"declType":"typeClass","fundeps":[],"superclasses":[]},"kind":null,"sourceSpan":{"end":[9,23],"name":"/home/gnumonik/code/work/purus/tests/purs/docs/src/Clash1a.purs","start":[8,1]},"title":"TypeClass"}],"name":"Clash1a","reExports":[]} \ No newline at end of file diff --git a/tests/purs/docs/output/Clash1a/externs.cbor b/tests/purs/docs/output/Clash1a/externs.cbor new file mode 100644 index 000000000..e5be38fe9 Binary files /dev/null and b/tests/purs/docs/output/Clash1a/externs.cbor differ diff --git a/tests/purs/docs/output/Clash2/docs.json b/tests/purs/docs/output/Clash2/docs.json new file mode 100644 index 000000000..671c27201 --- /dev/null +++ b/tests/purs/docs/output/Clash2/docs.json @@ -0,0 +1 @@ +{"comments":null,"declarations":[],"name":"Clash2","reExports":[]} \ No newline at end of file diff --git a/tests/purs/docs/output/Clash2/externs.cbor b/tests/purs/docs/output/Clash2/externs.cbor new file mode 100644 index 000000000..0b407088b Binary files /dev/null and b/tests/purs/docs/output/Clash2/externs.cbor differ diff --git a/tests/purs/docs/output/Clash2a/docs.json b/tests/purs/docs/output/Clash2a/docs.json new file mode 100644 index 000000000..26b2b19bf --- /dev/null +++ b/tests/purs/docs/output/Clash2a/docs.json @@ -0,0 +1 @@ +{"comments":null,"declarations":[{"children":[],"comments":null,"info":{"declType":"value","type":{"annotation":[],"contents":[["Prim"],"String"],"tag":"TypeConstructor"}},"kind":null,"sourceSpan":{"end":[3,16],"name":"/home/gnumonik/code/work/purus/tests/purs/docs/src/Clash2a.purs","start":[3,1]},"title":"value"},{"children":[],"comments":null,"info":{"arguments":[],"declType":"typeSynonym","type":{"annotation":[],"contents":[["Prim"],"String"],"tag":"TypeConstructor"}},"kind":null,"sourceSpan":{"end":[6,20],"name":"/home/gnumonik/code/work/purus/tests/purs/docs/src/Clash2a.purs","start":[6,1]},"title":"Type'"},{"children":[{"comments":null,"info":{"declType":"typeClassMember","type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"TypeApp"}},"sourceSpan":{"end":[9,28],"name":"/home/gnumonik/code/work/purus/tests/purs/docs/src/Clash2a.purs","start":[9,3]},"title":"typeClassMember"}],"comments":null,"info":{"arguments":[["a",null],["b",null]],"declType":"typeClass","fundeps":[],"superclasses":[]},"kind":null,"sourceSpan":{"end":[9,28],"name":"/home/gnumonik/code/work/purus/tests/purs/docs/src/Clash2a.purs","start":[8,1]},"title":"TypeClass"}],"name":"Clash2a","reExports":[]} \ No newline at end of file diff --git a/tests/purs/docs/output/Clash2a/externs.cbor b/tests/purs/docs/output/Clash2a/externs.cbor new file mode 100644 index 000000000..b6dbda314 Binary files /dev/null and b/tests/purs/docs/output/Clash2a/externs.cbor differ diff --git a/tests/purs/docs/output/ConstrainedArgument/docs.json b/tests/purs/docs/output/ConstrainedArgument/docs.json new file mode 100644 index 000000000..657aa8438 --- /dev/null +++ b/tests/purs/docs/output/ConstrainedArgument/docs.json @@ -0,0 +1 @@ +{"comments":null,"declarations":[{"children":[],"comments":null,"info":{"arguments":[["t",{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}]],"declType":"typeClass","fundeps":[],"superclasses":[]},"kind":null,"sourceSpan":{"end":[3,22],"name":"/home/gnumonik/code/work/purus/tests/purs/docs/src/ConstrainedArgument.purs","start":[3,1]},"title":"Foo"},{"children":[],"comments":null,"info":{"arguments":[],"declType":"typeSynonym","type":{"annotation":[],"contents":{"identifier":"a","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":{"annotation":[],"contents":[{"constraintAnn":[],"constraintArgs":[],"constraintClass":[["Prim"],"Partial"],"constraintData":null,"constraintKindArgs":[]},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"ConstrainedType"},"tag":"ParensInType"}],"tag":"TypeApp"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"kind":null,"sourceSpan":{"end":[5,54],"name":"/home/gnumonik/code/work/purus/tests/purs/docs/src/ConstrainedArgument.purs","start":[5,1]},"title":"WithoutArgs"},{"children":[],"comments":null,"info":{"arguments":[],"declType":"typeSynonym","type":{"annotation":[],"contents":{"identifier":"a","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":{"annotation":[],"contents":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"a","tag":"TypeVar"}],"constraintClass":[["ConstrainedArgument"],"Foo"],"constraintData":null,"constraintKindArgs":[]},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"ConstrainedType"},"tag":"ParensInType"}],"tag":"TypeApp"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"kind":null,"sourceSpan":{"end":[6,52],"name":"/home/gnumonik/code/work/purus/tests/purs/docs/src/ConstrainedArgument.purs","start":[6,1]},"title":"WithArgs"},{"children":[],"comments":null,"info":{"arguments":[],"declType":"typeSynonym","type":{"annotation":[],"contents":{"identifier":"a","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":{"annotation":[],"contents":[{"constraintAnn":[],"constraintArgs":[],"constraintClass":[["Prim"],"Partial"],"constraintData":null,"constraintKindArgs":[]},{"annotation":[],"contents":[{"constraintAnn":[],"constraintArgs":[],"constraintClass":[["Prim"],"Partial"],"constraintData":null,"constraintKindArgs":[]},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"ConstrainedType"}],"tag":"ConstrainedType"},"tag":"ParensInType"}],"tag":"TypeApp"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"kind":null,"sourceSpan":{"end":[7,65],"name":"/home/gnumonik/code/work/purus/tests/purs/docs/src/ConstrainedArgument.purs","start":[7,1]},"title":"MultiWithoutArgs"},{"children":[],"comments":null,"info":{"arguments":[],"declType":"typeSynonym","type":{"annotation":[],"contents":{"identifier":"a","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"b","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":{"annotation":[],"contents":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"a","tag":"TypeVar"}],"constraintClass":[["ConstrainedArgument"],"Foo"],"constraintData":null,"constraintKindArgs":[]},{"annotation":[],"contents":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"b","tag":"TypeVar"}],"constraintClass":[["ConstrainedArgument"],"Foo"],"constraintData":null,"constraintKindArgs":[]},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"ConstrainedType"}],"tag":"ConstrainedType"},"tag":"ParensInType"}],"tag":"TypeApp"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"kind":null,"sourceSpan":{"end":[8,63],"name":"/home/gnumonik/code/work/purus/tests/purs/docs/src/ConstrainedArgument.purs","start":[8,1]},"title":"MultiWithArgs"}],"name":"ConstrainedArgument","reExports":[]} \ No newline at end of file diff --git a/tests/purs/docs/output/ConstrainedArgument/externs.cbor b/tests/purs/docs/output/ConstrainedArgument/externs.cbor new file mode 100644 index 000000000..167560479 Binary files /dev/null and b/tests/purs/docs/output/ConstrainedArgument/externs.cbor differ diff --git a/tests/purs/docs/output/Data.Newtype/docs.json b/tests/purs/docs/output/Data.Newtype/docs.json new file mode 100644 index 000000000..1e88e304d --- /dev/null +++ b/tests/purs/docs/output/Data.Newtype/docs.json @@ -0,0 +1 @@ +{"comments":null,"declarations":[{"children":[],"comments":null,"info":{"arguments":[["t",null],["a",null]],"declType":"typeClass","fundeps":[[["t"],["a"]]],"superclasses":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"t","tag":"TypeVar"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"constraintClass":[["Prim","Coerce"],"Coercible"],"constraintData":null,"constraintKindArgs":[]}]},"kind":null,"sourceSpan":{"end":[6,44],"name":"bower_components/purescript-newtype/src/Data/Newtype.purs","start":[6,1]},"title":"Newtype"}],"name":"Data.Newtype","reExports":[]} \ No newline at end of file diff --git a/tests/purs/docs/output/Data.Newtype/externs.cbor b/tests/purs/docs/output/Data.Newtype/externs.cbor new file mode 100644 index 000000000..d097afa15 Binary files /dev/null and b/tests/purs/docs/output/Data.Newtype/externs.cbor differ diff --git a/tests/purs/docs/output/DeclOrder/docs.json b/tests/purs/docs/output/DeclOrder/docs.json new file mode 100644 index 000000000..437aad1c7 --- /dev/null +++ b/tests/purs/docs/output/DeclOrder/docs.json @@ -0,0 +1 @@ +{"comments":null,"declarations":[{"children":[],"comments":null,"info":{"arguments":[],"declType":"typeClass","fundeps":[],"superclasses":[]},"kind":null,"sourceSpan":{"end":[16,8],"name":"/home/gnumonik/code/work/purus/tests/purs/docs/src/DeclOrder.purs","start":[16,1]},"title":"A"},{"children":[],"comments":null,"info":{"declType":"value","type":{"annotation":[],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}},"kind":null,"sourceSpan":{"end":[10,7],"name":"/home/gnumonik/code/work/purus/tests/purs/docs/src/DeclOrder.purs","start":[10,1]},"title":"x1"},{"children":[],"comments":null,"info":{"dataDeclType":"data","declType":"data","roles":[],"typeArguments":[]},"kind":null,"sourceSpan":{"end":[13,8],"name":"/home/gnumonik/code/work/purus/tests/purs/docs/src/DeclOrder.purs","start":[13,1]},"title":"X2"},{"children":[],"comments":null,"info":{"declType":"value","type":{"annotation":[],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}},"kind":null,"sourceSpan":{"end":[11,7],"name":"/home/gnumonik/code/work/purus/tests/purs/docs/src/DeclOrder.purs","start":[11,1]},"title":"x3"},{"children":[],"comments":null,"info":{"dataDeclType":"data","declType":"data","roles":[],"typeArguments":[]},"kind":null,"sourceSpan":{"end":[14,8],"name":"/home/gnumonik/code/work/purus/tests/purs/docs/src/DeclOrder.purs","start":[14,1]},"title":"X4"},{"children":[],"comments":null,"info":{"arguments":[],"declType":"typeClass","fundeps":[],"superclasses":[]},"kind":null,"sourceSpan":{"end":[17,8],"name":"/home/gnumonik/code/work/purus/tests/purs/docs/src/DeclOrder.purs","start":[17,1]},"title":"B"}],"name":"DeclOrder","reExports":[]} \ No newline at end of file diff --git a/tests/purs/docs/output/DeclOrder/externs.cbor b/tests/purs/docs/output/DeclOrder/externs.cbor new file mode 100644 index 000000000..302b96cca Binary files /dev/null and b/tests/purs/docs/output/DeclOrder/externs.cbor differ diff --git a/tests/purs/docs/output/DeclOrderNoExportList/docs.json b/tests/purs/docs/output/DeclOrderNoExportList/docs.json new file mode 100644 index 000000000..4585db7cd --- /dev/null +++ b/tests/purs/docs/output/DeclOrderNoExportList/docs.json @@ -0,0 +1 @@ +{"comments":null,"declarations":[{"children":[],"comments":null,"info":{"declType":"value","type":{"annotation":[],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}},"kind":null,"sourceSpan":{"end":[3,7],"name":"/home/gnumonik/code/work/purus/tests/purs/docs/src/DeclOrderNoExportList.purs","start":[3,1]},"title":"x1"},{"children":[],"comments":null,"info":{"declType":"value","type":{"annotation":[],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}},"kind":null,"sourceSpan":{"end":[4,7],"name":"/home/gnumonik/code/work/purus/tests/purs/docs/src/DeclOrderNoExportList.purs","start":[4,1]},"title":"x3"},{"children":[],"comments":null,"info":{"dataDeclType":"data","declType":"data","roles":[],"typeArguments":[]},"kind":null,"sourceSpan":{"end":[6,8],"name":"/home/gnumonik/code/work/purus/tests/purs/docs/src/DeclOrderNoExportList.purs","start":[6,1]},"title":"X2"},{"children":[],"comments":null,"info":{"dataDeclType":"data","declType":"data","roles":[],"typeArguments":[]},"kind":null,"sourceSpan":{"end":[7,8],"name":"/home/gnumonik/code/work/purus/tests/purs/docs/src/DeclOrderNoExportList.purs","start":[7,1]},"title":"X4"},{"children":[],"comments":null,"info":{"arguments":[],"declType":"typeClass","fundeps":[],"superclasses":[]},"kind":null,"sourceSpan":{"end":[9,8],"name":"/home/gnumonik/code/work/purus/tests/purs/docs/src/DeclOrderNoExportList.purs","start":[9,1]},"title":"A"},{"children":[],"comments":null,"info":{"arguments":[],"declType":"typeClass","fundeps":[],"superclasses":[]},"kind":null,"sourceSpan":{"end":[10,8],"name":"/home/gnumonik/code/work/purus/tests/purs/docs/src/DeclOrderNoExportList.purs","start":[10,1]},"title":"B"}],"name":"DeclOrderNoExportList","reExports":[]} \ No newline at end of file diff --git a/tests/purs/docs/output/DeclOrderNoExportList/externs.cbor b/tests/purs/docs/output/DeclOrderNoExportList/externs.cbor new file mode 100644 index 000000000..95a721b4c Binary files /dev/null and b/tests/purs/docs/output/DeclOrderNoExportList/externs.cbor differ diff --git a/tests/purs/docs/output/DocComments/docs.json b/tests/purs/docs/output/DocComments/docs.json new file mode 100644 index 000000000..8b91fa549 --- /dev/null +++ b/tests/purs/docs/output/DocComments/docs.json @@ -0,0 +1 @@ +{"comments":null,"declarations":[{"children":[],"comments":"This declaration has a code block:\n\n example == 0\n\nHere we are really testing that the leading whitespace is not stripped, as\nthis ensures that we don't accidentally change code blocks into normal\nparagraphs.\n","info":{"declType":"value","type":{"annotation":[],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}},"kind":null,"sourceSpan":{"end":[10,15],"name":"/home/gnumonik/code/work/purus/tests/purs/docs/src/DocComments.purs","start":[10,1]},"title":"example"}],"name":"DocComments","reExports":[]} \ No newline at end of file diff --git a/tests/purs/docs/output/DocComments/externs.cbor b/tests/purs/docs/output/DocComments/externs.cbor new file mode 100644 index 000000000..0b5155fb8 Binary files /dev/null and b/tests/purs/docs/output/DocComments/externs.cbor differ diff --git a/tests/purs/docs/output/DocCommentsClassMethod/docs.json b/tests/purs/docs/output/DocCommentsClassMethod/docs.json new file mode 100644 index 000000000..0a4032caa --- /dev/null +++ b/tests/purs/docs/output/DocCommentsClassMethod/docs.json @@ -0,0 +1 @@ +{"comments":null,"declarations":[{"children":[{"comments":"class method comment\n","info":{"declType":"typeClassMember","type":{"annotation":[],"contents":"a","tag":"TypeVar"}},"sourceSpan":{"end":[5,11],"name":"/home/gnumonik/code/work/purus/tests/purs/docs/src/DocCommentsClassMethod.purs","start":[5,3]},"title":"bar"},{"comments":null,"info":{"declType":"typeClassMember","type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"String"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}},"sourceSpan":{"end":[6,21],"name":"/home/gnumonik/code/work/purus/tests/purs/docs/src/DocCommentsClassMethod.purs","start":[6,3]},"title":"baz"}],"comments":null,"info":{"arguments":[["a",null]],"declType":"typeClass","fundeps":[],"superclasses":[]},"kind":null,"sourceSpan":{"end":[6,21],"name":"/home/gnumonik/code/work/purus/tests/purs/docs/src/DocCommentsClassMethod.purs","start":[3,1]},"title":"Foo"}],"name":"DocCommentsClassMethod","reExports":[]} \ No newline at end of file diff --git a/tests/purs/docs/output/DocCommentsClassMethod/externs.cbor b/tests/purs/docs/output/DocCommentsClassMethod/externs.cbor new file mode 100644 index 000000000..48a89d460 Binary files /dev/null and b/tests/purs/docs/output/DocCommentsClassMethod/externs.cbor differ diff --git a/tests/purs/docs/output/DocCommentsDataConstructor/docs.json b/tests/purs/docs/output/DocCommentsDataConstructor/docs.json new file mode 100644 index 000000000..cd0421dff --- /dev/null +++ b/tests/purs/docs/output/DocCommentsDataConstructor/docs.json @@ -0,0 +1 @@ +{"comments":null,"declarations":[{"children":[{"comments":"data constructor comment\n","info":{"arguments":[],"declType":"dataConstructor"},"sourceSpan":{"end":[5,8],"name":"/home/gnumonik/code/work/purus/tests/purs/docs/src/DocCommentsDataConstructor.purs","start":[5,3]},"title":"Bar"},{"comments":null,"info":{"arguments":[],"declType":"dataConstructor"},"sourceSpan":{"end":[6,8],"name":"/home/gnumonik/code/work/purus/tests/purs/docs/src/DocCommentsDataConstructor.purs","start":[6,3]},"title":"Baz"}],"comments":null,"info":{"dataDeclType":"data","declType":"data","roles":[],"typeArguments":[]},"kind":null,"sourceSpan":{"end":[6,8],"name":"/home/gnumonik/code/work/purus/tests/purs/docs/src/DocCommentsDataConstructor.purs","start":[3,1]},"title":"Foo"},{"children":[{"comments":null,"info":{"arguments":[{"annotation":[],"contents":"a","tag":"TypeVar"}],"declType":"dataConstructor"},"sourceSpan":{"end":[9,15],"name":"/home/gnumonik/code/work/purus/tests/purs/docs/src/DocCommentsDataConstructor.purs","start":[9,3]},"title":"ComplexBar"},{"comments":"another data constructor comment\n","info":{"arguments":[{"annotation":[],"contents":"a","tag":"TypeVar"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"declType":"dataConstructor"},"sourceSpan":{"end":[11,15],"name":"/home/gnumonik/code/work/purus/tests/purs/docs/src/DocCommentsDataConstructor.purs","start":[11,3]},"title":"ComplexBaz"}],"comments":null,"info":{"dataDeclType":"data","declType":"data","roles":["Representational","Representational"],"typeArguments":[["a",null],["b",null]]},"kind":null,"sourceSpan":{"end":[11,19],"name":"/home/gnumonik/code/work/purus/tests/purs/docs/src/DocCommentsDataConstructor.purs","start":[8,1]},"title":"ComplexFoo"},{"children":[{"comments":"newtype data constructor comment\n","info":{"arguments":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[],"contents":["newtypeBar",{"annotation":[],"contents":[["Prim"],"String"],"tag":"TypeConstructor"},{"annotation":[],"tag":"REmpty"}],"tag":"RCons"}],"tag":"TypeApp"}],"declType":"dataConstructor"},"sourceSpan":{"end":[15,40],"name":"/home/gnumonik/code/work/purus/tests/purs/docs/src/DocCommentsDataConstructor.purs","start":[15,3]},"title":"NewtypeFoo"}],"comments":null,"info":{"dataDeclType":"newtype","declType":"data","roles":[],"typeArguments":[]},"kind":null,"sourceSpan":{"end":[15,40],"name":"/home/gnumonik/code/work/purus/tests/purs/docs/src/DocCommentsDataConstructor.purs","start":[13,1]},"title":"NewtypeFoo"}],"name":"DocCommentsDataConstructor","reExports":[]} \ No newline at end of file diff --git a/tests/purs/docs/output/DocCommentsDataConstructor/externs.cbor b/tests/purs/docs/output/DocCommentsDataConstructor/externs.cbor new file mode 100644 index 000000000..147159eef Binary files /dev/null and b/tests/purs/docs/output/DocCommentsDataConstructor/externs.cbor differ diff --git a/tests/purs/docs/output/DocCommentsMerge/docs.json b/tests/purs/docs/output/DocCommentsMerge/docs.json new file mode 100644 index 000000000..50a2c34cb --- /dev/null +++ b/tests/purs/docs/output/DocCommentsMerge/docs.json @@ -0,0 +1 @@ +{"comments":null,"declarations":[{"children":[{"comments":null,"info":{"arguments":[],"declType":"dataConstructor"},"sourceSpan":{"end":[4,25],"name":"/home/gnumonik/code/work/purus/tests/purs/docs/src/DocCommentsMerge.purs","start":[4,15]},"title":"DataOnly"}],"comments":"decl\n","info":{"dataDeclType":"data","declType":"data","roles":[],"typeArguments":[]},"kind":null,"sourceSpan":{"end":[4,25],"name":"/home/gnumonik/code/work/purus/tests/purs/docs/src/DocCommentsMerge.purs","start":[4,1]},"title":"DataOnly"},{"children":[{"comments":null,"info":{"arguments":[],"declType":"dataConstructor"},"sourceSpan":{"end":[8,33],"name":"/home/gnumonik/code/work/purus/tests/purs/docs/src/DocCommentsMerge.purs","start":[8,19]},"title":"KindOnlyData"}],"comments":"kind\n","info":{"dataDeclType":"data","declType":"data","roles":[],"typeArguments":[]},"kind":null,"sourceSpan":{"end":[8,33],"name":"/home/gnumonik/code/work/purus/tests/purs/docs/src/DocCommentsMerge.purs","start":[8,1]},"title":"KindOnlyData"},{"children":[{"comments":null,"info":{"arguments":[],"declType":"dataConstructor"},"sourceSpan":{"end":[13,31],"name":"/home/gnumonik/code/work/purus/tests/purs/docs/src/DocCommentsMerge.purs","start":[13,18]},"title":"KindAndData"}],"comments":"kind\n\ndecl\n","info":{"dataDeclType":"data","declType":"data","roles":[],"typeArguments":[]},"kind":null,"sourceSpan":{"end":[13,31],"name":"/home/gnumonik/code/work/purus/tests/purs/docs/src/DocCommentsMerge.purs","start":[13,1]},"title":"KindAndData"},{"children":[{"comments":null,"info":{"arguments":[{"annotation":[],"contents":"a","tag":"TypeVar"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"declType":"dataConstructor"},"sourceSpan":{"end":[15,37],"name":"/home/gnumonik/code/work/purus/tests/purs/docs/src/DocCommentsMerge.purs","start":[15,23]},"title":"DataRoleOnly"}],"comments":"role\n","info":{"dataDeclType":"data","declType":"data","roles":["Representational","Representational"],"typeArguments":[["a",null],["b",null]]},"kind":null,"sourceSpan":{"end":[15,41],"name":"/home/gnumonik/code/work/purus/tests/purs/docs/src/DocCommentsMerge.purs","start":[15,1]},"title":"DataRoleOnly"},{"children":[{"comments":null,"info":{"arguments":[{"annotation":[],"contents":"a","tag":"TypeVar"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"declType":"dataConstructor"},"sourceSpan":{"end":[20,35],"name":"/home/gnumonik/code/work/purus/tests/purs/docs/src/DocCommentsMerge.purs","start":[20,22]},"title":"DataAndRole"}],"comments":"decl\n\nrole\n","info":{"dataDeclType":"data","declType":"data","roles":["Representational","Representational"],"typeArguments":[["a",null],["b",null]]},"kind":null,"sourceSpan":{"end":[20,39],"name":"/home/gnumonik/code/work/purus/tests/purs/docs/src/DocCommentsMerge.purs","start":[20,1]},"title":"DataAndRole"},{"children":[{"comments":null,"info":{"arguments":[],"declType":"dataConstructor"},"sourceSpan":{"end":[26,51],"name":"/home/gnumonik/code/work/purus/tests/purs/docs/src/DocCommentsMerge.purs","start":[26,29]},"title":"KindOnlyDataRoleOnly"}],"comments":"kind\n\nrole\n","info":{"dataDeclType":"data","declType":"data","roles":["Representational"],"typeArguments":[["a",null]]},"kind":null,"sourceSpan":{"end":[26,51],"name":"/home/gnumonik/code/work/purus/tests/purs/docs/src/DocCommentsMerge.purs","start":[26,1]},"title":"KindOnlyDataRoleOnly"},{"children":[{"comments":null,"info":{"arguments":[],"declType":"dataConstructor"},"sourceSpan":{"end":[33,41],"name":"/home/gnumonik/code/work/purus/tests/purs/docs/src/DocCommentsMerge.purs","start":[33,24]},"title":"KindDataAndRole"}],"comments":"kind\n\ndecl\n\nrole\n","info":{"dataDeclType":"data","declType":"data","roles":["Representational"],"typeArguments":[["a",null]]},"kind":null,"sourceSpan":{"end":[33,41],"name":"/home/gnumonik/code/work/purus/tests/purs/docs/src/DocCommentsMerge.purs","start":[33,1]},"title":"KindDataAndRole"},{"children":[],"comments":"decl\n","info":{"dataDeclType":"data","declType":"data","roles":[],"typeArguments":[]},"kind":null,"sourceSpan":{"end":[40,36],"name":"/home/gnumonik/code/work/purus/tests/purs/docs/src/DocCommentsMerge.purs","start":[40,1]},"title":"FFIOnly"},{"children":[],"comments":"role\n","info":{"dataDeclType":"data","declType":"data","roles":["Representational"],"typeArguments":[["t0",null]]},"kind":null,"sourceSpan":{"end":[42,48],"name":"/home/gnumonik/code/work/purus/tests/purs/docs/src/DocCommentsMerge.purs","start":[42,1]},"title":"FFIRoleOnly"},{"children":[],"comments":"decl\n\nrole\n","info":{"dataDeclType":"data","declType":"data","roles":["Representational"],"typeArguments":[["t0",null]]},"kind":null,"sourceSpan":{"end":[47,47],"name":"/home/gnumonik/code/work/purus/tests/purs/docs/src/DocCommentsMerge.purs","start":[47,1]},"title":"FFIAndRole"},{"children":[{"comments":null,"info":{"arguments":[{"annotation":[],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"declType":"dataConstructor"},"sourceSpan":{"end":[54,38],"name":"/home/gnumonik/code/work/purus/tests/purs/docs/src/DocCommentsMerge.purs","start":[54,21]},"title":"NewtypeOnly"}],"comments":"decl\n","info":{"dataDeclType":"newtype","declType":"data","roles":[],"typeArguments":[]},"kind":null,"sourceSpan":{"end":[54,38],"name":"/home/gnumonik/code/work/purus/tests/purs/docs/src/DocCommentsMerge.purs","start":[54,1]},"title":"NewtypeOnly"},{"children":[{"comments":null,"info":{"arguments":[{"annotation":[],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"declType":"dataConstructor"},"sourceSpan":{"end":[58,46],"name":"/home/gnumonik/code/work/purus/tests/purs/docs/src/DocCommentsMerge.purs","start":[58,25]},"title":"KindOnlyNewtype"}],"comments":"kind\n","info":{"dataDeclType":"newtype","declType":"data","roles":[],"typeArguments":[]},"kind":null,"sourceSpan":{"end":[58,46],"name":"/home/gnumonik/code/work/purus/tests/purs/docs/src/DocCommentsMerge.purs","start":[58,1]},"title":"KindOnlyNewtype"},{"children":[{"comments":null,"info":{"arguments":[{"annotation":[],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"declType":"dataConstructor"},"sourceSpan":{"end":[63,48],"name":"/home/gnumonik/code/work/purus/tests/purs/docs/src/DocCommentsMerge.purs","start":[63,28]},"title":"KindAndNewtype"}],"comments":"kind\n\ndecl\n","info":{"dataDeclType":"newtype","declType":"data","roles":["Phantom","Phantom"],"typeArguments":[["a",null],["b",null]]},"kind":null,"sourceSpan":{"end":[63,48],"name":"/home/gnumonik/code/work/purus/tests/purs/docs/src/DocCommentsMerge.purs","start":[63,1]},"title":"KindAndNewtype"},{"children":[{"comments":null,"info":{"arguments":[{"annotation":[],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"declType":"dataConstructor"},"sourceSpan":{"end":[65,50],"name":"/home/gnumonik/code/work/purus/tests/purs/docs/src/DocCommentsMerge.purs","start":[65,29]},"title":"NewtypeRoleOnly"}],"comments":"role\n","info":{"dataDeclType":"newtype","declType":"data","roles":["Representational","Representational"],"typeArguments":[["a",null],["b",null]]},"kind":{"keyword":"newtype","kind":{"annotation":[],"contents":{"identifier":"k1","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"k2","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"k1","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"k2","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"sourceSpan":{"end":[65,50],"name":"/home/gnumonik/code/work/purus/tests/purs/docs/src/DocCommentsMerge.purs","start":[65,1]},"title":"NewtypeRoleOnly"},{"children":[{"comments":null,"info":{"arguments":[{"annotation":[],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"declType":"dataConstructor"},"sourceSpan":{"end":[70,48],"name":"/home/gnumonik/code/work/purus/tests/purs/docs/src/DocCommentsMerge.purs","start":[70,28]},"title":"NewtypeAndRole"}],"comments":"decl\n\nrole\n","info":{"dataDeclType":"newtype","declType":"data","roles":["Representational","Representational"],"typeArguments":[["a",null],["b",null]]},"kind":{"keyword":"newtype","kind":{"annotation":[],"contents":{"identifier":"k1","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"k2","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"k1","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"k2","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"sourceSpan":{"end":[70,48],"name":"/home/gnumonik/code/work/purus/tests/purs/docs/src/DocCommentsMerge.purs","start":[70,1]},"title":"NewtypeAndRole"},{"children":[{"comments":null,"info":{"arguments":[{"annotation":[],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"declType":"dataConstructor"},"sourceSpan":{"end":[76,66],"name":"/home/gnumonik/code/work/purus/tests/purs/docs/src/DocCommentsMerge.purs","start":[76,37]},"title":"KindOnlyNewtypeRoleOnly"}],"comments":"kind\n\nrole\n","info":{"dataDeclType":"newtype","declType":"data","roles":["Representational","Representational"],"typeArguments":[["a",null],["b",null]]},"kind":null,"sourceSpan":{"end":[76,66],"name":"/home/gnumonik/code/work/purus/tests/purs/docs/src/DocCommentsMerge.purs","start":[76,1]},"title":"KindOnlyNewtypeRoleOnly"},{"children":[{"comments":null,"info":{"arguments":[{"annotation":[],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"declType":"dataConstructor"},"sourceSpan":{"end":[83,56],"name":"/home/gnumonik/code/work/purus/tests/purs/docs/src/DocCommentsMerge.purs","start":[83,32]},"title":"KindNewtypeAndRole"}],"comments":"kind\n\ndecl\n\nrole\n","info":{"dataDeclType":"newtype","declType":"data","roles":["Representational","Representational"],"typeArguments":[["a",null],["b",null]]},"kind":null,"sourceSpan":{"end":[83,56],"name":"/home/gnumonik/code/work/purus/tests/purs/docs/src/DocCommentsMerge.purs","start":[83,1]},"title":"KindNewtypeAndRole"},{"children":[],"comments":"decl\n","info":{"arguments":[],"declType":"typeSynonym","type":{"annotation":[],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}},"kind":null,"sourceSpan":{"end":[90,20],"name":"/home/gnumonik/code/work/purus/tests/purs/docs/src/DocCommentsMerge.purs","start":[90,1]},"title":"TypeOnly"},{"children":[],"comments":"kind\n","info":{"arguments":[["a",null],["b",null]],"declType":"typeSynonym","type":{"annotation":[],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}},"kind":null,"sourceSpan":{"end":[94,28],"name":"/home/gnumonik/code/work/purus/tests/purs/docs/src/DocCommentsMerge.purs","start":[94,1]},"title":"KindOnlyType"},{"children":[],"comments":"kind\n\ndecl\n","info":{"arguments":[["a",null],["b",null]],"declType":"typeSynonym","type":{"annotation":[],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}},"kind":null,"sourceSpan":{"end":[99,27],"name":"/home/gnumonik/code/work/purus/tests/purs/docs/src/DocCommentsMerge.purs","start":[99,1]},"title":"KindAndType"},{"children":[],"comments":"decl\n","info":{"arguments":[],"declType":"typeClass","fundeps":[],"superclasses":[]},"kind":null,"sourceSpan":{"end":[106,16],"name":"/home/gnumonik/code/work/purus/tests/purs/docs/src/DocCommentsMerge.purs","start":[106,1]},"title":"ClassOnly"},{"children":[],"comments":"kind\n","info":{"arguments":[],"declType":"typeClass","fundeps":[],"superclasses":[]},"kind":null,"sourceSpan":{"end":[110,20],"name":"/home/gnumonik/code/work/purus/tests/purs/docs/src/DocCommentsMerge.purs","start":[110,1]},"title":"KindOnlyClass"},{"children":[{"comments":null,"info":{"declType":"typeClassMember","type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim"],"String"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[116,33],"name":"/home/gnumonik/code/work/purus/tests/purs/docs/src/DocCommentsMerge.purs","start":[116,3]},"title":"fooKindAndClass"}],"comments":"kind\n\ndecl\n","info":{"arguments":[["a",null]],"declType":"typeClass","fundeps":[],"superclasses":[]},"kind":null,"sourceSpan":{"end":[116,33],"name":"/home/gnumonik/code/work/purus/tests/purs/docs/src/DocCommentsMerge.purs","start":[115,1]},"title":"KindAndClass"}],"name":"DocCommentsMerge","reExports":[]} \ No newline at end of file diff --git a/tests/purs/docs/output/DocCommentsMerge/externs.cbor b/tests/purs/docs/output/DocCommentsMerge/externs.cbor new file mode 100644 index 000000000..051a46476 Binary files /dev/null and b/tests/purs/docs/output/DocCommentsMerge/externs.cbor differ diff --git a/tests/purs/docs/output/DuplicateNames/docs.json b/tests/purs/docs/output/DuplicateNames/docs.json new file mode 100644 index 000000000..a5818bdce --- /dev/null +++ b/tests/purs/docs/output/DuplicateNames/docs.json @@ -0,0 +1 @@ +{"comments":null,"declarations":[{"children":[],"comments":null,"info":{"declType":"value","type":{"annotation":[],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}},"kind":null,"sourceSpan":{"end":[8,12],"name":"/home/gnumonik/code/work/purus/tests/purs/docs/src/DuplicateNames.purs","start":[8,1]},"title":"unit"}],"name":"DuplicateNames","reExports":[]} \ No newline at end of file diff --git a/tests/purs/docs/output/DuplicateNames/externs.cbor b/tests/purs/docs/output/DuplicateNames/externs.cbor new file mode 100644 index 000000000..fed16aeaf Binary files /dev/null and b/tests/purs/docs/output/DuplicateNames/externs.cbor differ diff --git a/tests/purs/docs/output/Example/docs.json b/tests/purs/docs/output/Example/docs.json new file mode 100644 index 000000000..3b7928d1e --- /dev/null +++ b/tests/purs/docs/output/Example/docs.json @@ -0,0 +1 @@ +{"comments":null,"declarations":[],"name":"Example","reExports":[]} \ No newline at end of file diff --git a/tests/purs/docs/output/Example/externs.cbor b/tests/purs/docs/output/Example/externs.cbor new file mode 100644 index 000000000..82cb73033 Binary files /dev/null and b/tests/purs/docs/output/Example/externs.cbor differ diff --git a/tests/purs/docs/output/Example2/docs.json b/tests/purs/docs/output/Example2/docs.json new file mode 100644 index 000000000..e86440c92 --- /dev/null +++ b/tests/purs/docs/output/Example2/docs.json @@ -0,0 +1 @@ +{"comments":null,"declarations":[{"children":[],"comments":null,"info":{"declType":"value","type":{"annotation":[],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}},"kind":null,"sourceSpan":{"end":[3,11],"name":"/home/gnumonik/code/work/purus/tests/purs/docs/src/Example2.purs","start":[3,1]},"title":"one"},{"children":[],"comments":null,"info":{"declType":"value","type":{"annotation":[],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}},"kind":null,"sourceSpan":{"end":[6,11],"name":"/home/gnumonik/code/work/purus/tests/purs/docs/src/Example2.purs","start":[6,1]},"title":"two"}],"name":"Example2","reExports":[]} \ No newline at end of file diff --git a/tests/purs/docs/output/Example2/externs.cbor b/tests/purs/docs/output/Example2/externs.cbor new file mode 100644 index 000000000..cec286027 Binary files /dev/null and b/tests/purs/docs/output/Example2/externs.cbor differ diff --git a/tests/purs/docs/output/ExplicitExport/docs.json b/tests/purs/docs/output/ExplicitExport/docs.json new file mode 100644 index 000000000..2b4de0a0f --- /dev/null +++ b/tests/purs/docs/output/ExplicitExport/docs.json @@ -0,0 +1 @@ +{"comments":null,"declarations":[{"children":[],"comments":null,"info":{"declType":"value","type":{"annotation":[],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}},"kind":null,"sourceSpan":{"end":[3,11],"name":"/home/gnumonik/code/work/purus/tests/purs/docs/src/ExplicitExport.purs","start":[3,1]},"title":"one"}],"name":"ExplicitExport","reExports":[]} \ No newline at end of file diff --git a/tests/purs/docs/output/ExplicitExport/externs.cbor b/tests/purs/docs/output/ExplicitExport/externs.cbor new file mode 100644 index 000000000..fdbe3f32b Binary files /dev/null and b/tests/purs/docs/output/ExplicitExport/externs.cbor differ diff --git a/tests/purs/docs/output/ExplicitTypeSignatures/docs.json b/tests/purs/docs/output/ExplicitTypeSignatures/docs.json new file mode 100644 index 000000000..af44ace5c --- /dev/null +++ b/tests/purs/docs/output/ExplicitTypeSignatures/docs.json @@ -0,0 +1 @@ +{"comments":null,"declarations":[{"children":[],"comments":null,"info":{"declType":"value","type":{"annotation":[],"contents":{"identifier":"something","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"something","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"something","tag":"TypeVar"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"kind":null,"sourceSpan":{"end":[6,53],"name":"/home/gnumonik/code/work/purus/tests/purs/docs/src/ExplicitTypeSignatures.purs","start":[6,1]},"title":"explicit"},{"children":[],"comments":null,"info":{"declType":"value","type":{"annotation":[],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}},"kind":null,"sourceSpan":{"end":[12,11],"name":"/home/gnumonik/code/work/purus/tests/purs/docs/src/ExplicitTypeSignatures.purs","start":[12,1]},"title":"anInt"},{"children":[],"comments":null,"info":{"declType":"value","type":{"annotation":[],"contents":[["Prim"],"Number"],"tag":"TypeConstructor"}},"kind":null,"sourceSpan":{"end":[16,14],"name":"/home/gnumonik/code/work/purus/tests/purs/docs/src/ExplicitTypeSignatures.purs","start":[16,1]},"title":"aNumber"}],"name":"ExplicitTypeSignatures","reExports":[]} \ No newline at end of file diff --git a/tests/purs/docs/output/ExplicitTypeSignatures/externs.cbor b/tests/purs/docs/output/ExplicitTypeSignatures/externs.cbor new file mode 100644 index 000000000..befe86b04 Binary files /dev/null and b/tests/purs/docs/output/ExplicitTypeSignatures/externs.cbor differ diff --git a/tests/purs/docs/output/ImportedTwice/docs.json b/tests/purs/docs/output/ImportedTwice/docs.json new file mode 100644 index 000000000..f3b641419 --- /dev/null +++ b/tests/purs/docs/output/ImportedTwice/docs.json @@ -0,0 +1 @@ +{"comments":null,"declarations":[],"name":"ImportedTwice","reExports":[]} \ No newline at end of file diff --git a/tests/purs/docs/output/ImportedTwice/externs.cbor b/tests/purs/docs/output/ImportedTwice/externs.cbor new file mode 100644 index 000000000..3adb703a4 Binary files /dev/null and b/tests/purs/docs/output/ImportedTwice/externs.cbor differ diff --git a/tests/purs/docs/output/ImportedTwiceA/docs.json b/tests/purs/docs/output/ImportedTwiceA/docs.json new file mode 100644 index 000000000..8670212ba --- /dev/null +++ b/tests/purs/docs/output/ImportedTwiceA/docs.json @@ -0,0 +1 @@ +{"comments":null,"declarations":[],"name":"ImportedTwiceA","reExports":[]} \ No newline at end of file diff --git a/tests/purs/docs/output/ImportedTwiceA/externs.cbor b/tests/purs/docs/output/ImportedTwiceA/externs.cbor new file mode 100644 index 000000000..023d75f16 Binary files /dev/null and b/tests/purs/docs/output/ImportedTwiceA/externs.cbor differ diff --git a/tests/purs/docs/output/ImportedTwiceB/docs.json b/tests/purs/docs/output/ImportedTwiceB/docs.json new file mode 100644 index 000000000..307c9ca1d --- /dev/null +++ b/tests/purs/docs/output/ImportedTwiceB/docs.json @@ -0,0 +1 @@ +{"comments":null,"declarations":[{"children":[],"comments":null,"info":{"declType":"value","type":{"annotation":[],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}},"kind":null,"sourceSpan":{"end":[3,11],"name":"/home/gnumonik/code/work/purus/tests/purs/docs/src/ImportedTwiceB.purs","start":[3,1]},"title":"foo"}],"name":"ImportedTwiceB","reExports":[]} \ No newline at end of file diff --git a/tests/purs/docs/output/ImportedTwiceB/externs.cbor b/tests/purs/docs/output/ImportedTwiceB/externs.cbor new file mode 100644 index 000000000..0b1e2ecf7 Binary files /dev/null and b/tests/purs/docs/output/ImportedTwiceB/externs.cbor differ diff --git a/tests/purs/docs/output/MultiVirtual/docs.json b/tests/purs/docs/output/MultiVirtual/docs.json new file mode 100644 index 000000000..423056c12 --- /dev/null +++ b/tests/purs/docs/output/MultiVirtual/docs.json @@ -0,0 +1 @@ +{"comments":null,"declarations":[],"name":"MultiVirtual","reExports":[]} \ No newline at end of file diff --git a/tests/purs/docs/output/MultiVirtual/externs.cbor b/tests/purs/docs/output/MultiVirtual/externs.cbor new file mode 100644 index 000000000..9eabf0d2c Binary files /dev/null and b/tests/purs/docs/output/MultiVirtual/externs.cbor differ diff --git a/tests/purs/docs/output/MultiVirtual1/docs.json b/tests/purs/docs/output/MultiVirtual1/docs.json new file mode 100644 index 000000000..4bce7c214 --- /dev/null +++ b/tests/purs/docs/output/MultiVirtual1/docs.json @@ -0,0 +1 @@ +{"comments":null,"declarations":[{"children":[],"comments":null,"info":{"declType":"value","type":{"annotation":[],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}},"kind":null,"sourceSpan":{"end":[3,11],"name":"/home/gnumonik/code/work/purus/tests/purs/docs/src/MultiVirtual1.purs","start":[3,1]},"title":"foo"}],"name":"MultiVirtual1","reExports":[]} \ No newline at end of file diff --git a/tests/purs/docs/output/MultiVirtual1/externs.cbor b/tests/purs/docs/output/MultiVirtual1/externs.cbor new file mode 100644 index 000000000..878d80167 Binary files /dev/null and b/tests/purs/docs/output/MultiVirtual1/externs.cbor differ diff --git a/tests/purs/docs/output/MultiVirtual2/docs.json b/tests/purs/docs/output/MultiVirtual2/docs.json new file mode 100644 index 000000000..a273f8840 --- /dev/null +++ b/tests/purs/docs/output/MultiVirtual2/docs.json @@ -0,0 +1 @@ +{"comments":null,"declarations":[{"children":[],"comments":null,"info":{"declType":"value","type":{"annotation":[],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}},"kind":null,"sourceSpan":{"end":[8,11],"name":"/home/gnumonik/code/work/purus/tests/purs/docs/src/MultiVirtual2.purs","start":[8,1]},"title":"bar"}],"name":"MultiVirtual2","reExports":[]} \ No newline at end of file diff --git a/tests/purs/docs/output/MultiVirtual2/externs.cbor b/tests/purs/docs/output/MultiVirtual2/externs.cbor new file mode 100644 index 000000000..600285115 Binary files /dev/null and b/tests/purs/docs/output/MultiVirtual2/externs.cbor differ diff --git a/tests/purs/docs/output/MultiVirtual3/docs.json b/tests/purs/docs/output/MultiVirtual3/docs.json new file mode 100644 index 000000000..9e5faf55a --- /dev/null +++ b/tests/purs/docs/output/MultiVirtual3/docs.json @@ -0,0 +1 @@ +{"comments":null,"declarations":[{"children":[],"comments":null,"info":{"declType":"value","type":{"annotation":[],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}},"kind":null,"sourceSpan":{"end":[3,11],"name":"/home/gnumonik/code/work/purus/tests/purs/docs/src/MultiVirtual3.purs","start":[3,1]},"title":"baz"}],"name":"MultiVirtual3","reExports":[]} \ No newline at end of file diff --git a/tests/purs/docs/output/MultiVirtual3/externs.cbor b/tests/purs/docs/output/MultiVirtual3/externs.cbor new file mode 100644 index 000000000..e5c6a14a7 Binary files /dev/null and b/tests/purs/docs/output/MultiVirtual3/externs.cbor differ diff --git a/tests/purs/docs/output/NewOperators/docs.json b/tests/purs/docs/output/NewOperators/docs.json new file mode 100644 index 000000000..af17c5000 --- /dev/null +++ b/tests/purs/docs/output/NewOperators/docs.json @@ -0,0 +1 @@ +{"comments":null,"declarations":[],"name":"NewOperators","reExports":[]} \ No newline at end of file diff --git a/tests/purs/docs/output/NewOperators/externs.cbor b/tests/purs/docs/output/NewOperators/externs.cbor new file mode 100644 index 000000000..254a70467 Binary files /dev/null and b/tests/purs/docs/output/NewOperators/externs.cbor differ diff --git a/tests/purs/docs/output/NewOperators2/docs.json b/tests/purs/docs/output/NewOperators2/docs.json new file mode 100644 index 000000000..b35cbd56c --- /dev/null +++ b/tests/purs/docs/output/NewOperators2/docs.json @@ -0,0 +1 @@ +{"comments":null,"declarations":[{"children":[],"comments":null,"info":{"alias":[["NewOperators2"],{"Right":{"Left":{"Ident":"_compose"}}}],"declType":"alias","fixity":{"associativity":"infixl","precedence":8}},"kind":null,"sourceSpan":{"end":[3,25],"name":"/home/gnumonik/code/work/purus/tests/purs/docs/src/NewOperators2.purs","start":[3,1]},"title":"(>>>)"},{"children":[],"comments":null,"info":{"declType":"value","type":{"annotation":[],"contents":{"identifier":"a","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"b","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"c","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"c","tag":"TypeVar"}],"tag":"TypeApp"},"tag":"ParensInType"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"TypeApp"},"tag":"ParensInType"}],"tag":"TypeApp"},{"annotation":[],"contents":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"c","tag":"TypeVar"}],"tag":"TypeApp"},"tag":"ParensInType"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"kind":null,"sourceSpan":{"end":[5,59],"name":"/home/gnumonik/code/work/purus/tests/purs/docs/src/NewOperators2.purs","start":[5,1]},"title":"_compose"}],"name":"NewOperators2","reExports":[]} \ No newline at end of file diff --git a/tests/purs/docs/output/NewOperators2/externs.cbor b/tests/purs/docs/output/NewOperators2/externs.cbor new file mode 100644 index 000000000..8aab6236a Binary files /dev/null and b/tests/purs/docs/output/NewOperators2/externs.cbor differ diff --git a/tests/purs/docs/output/NotAllCtors/docs.json b/tests/purs/docs/output/NotAllCtors/docs.json new file mode 100644 index 000000000..e81e9b947 --- /dev/null +++ b/tests/purs/docs/output/NotAllCtors/docs.json @@ -0,0 +1 @@ +{"comments":null,"declarations":[],"name":"NotAllCtors","reExports":[]} \ No newline at end of file diff --git a/tests/purs/docs/output/NotAllCtors/externs.cbor b/tests/purs/docs/output/NotAllCtors/externs.cbor new file mode 100644 index 000000000..ae2d59d82 Binary files /dev/null and b/tests/purs/docs/output/NotAllCtors/externs.cbor differ diff --git a/tests/purs/docs/output/OperatorSection/docs.json b/tests/purs/docs/output/OperatorSection/docs.json new file mode 100644 index 000000000..ab1f932f9 --- /dev/null +++ b/tests/purs/docs/output/OperatorSection/docs.json @@ -0,0 +1 @@ +{"comments":null,"declarations":[{"children":[{"comments":null,"info":{"arguments":[],"declType":"dataConstructor"},"sourceSpan":{"end":[3,18],"name":"/home/gnumonik/code/work/purus/tests/purs/docs/src/OperatorSection.purs","start":[3,13]},"title":"Nil"},{"comments":null,"info":{"arguments":[{"annotation":[],"contents":"a","tag":"TypeVar"},{"annotation":[],"contents":{"annotation":[],"contents":[{"annotation":[],"contents":[["OperatorSection"],"List"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},"tag":"ParensInType"}],"declType":"dataConstructor"},"sourceSpan":{"end":[3,25],"name":"/home/gnumonik/code/work/purus/tests/purs/docs/src/OperatorSection.purs","start":[3,19]},"title":"Cons"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["OperatorSection"],"Foldable"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["OperatorSection"],"List"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[16,21],"name":"/home/gnumonik/code/work/purus/tests/purs/docs/src/OperatorSection.purs","start":[10,1]},"title":""}],"comments":null,"info":{"dataDeclType":"data","declType":"data","roles":["Representational"],"typeArguments":[["a",null]]},"kind":null,"sourceSpan":{"end":[3,36],"name":"/home/gnumonik/code/work/purus/tests/purs/docs/src/OperatorSection.purs","start":[3,1]},"title":"List"},{"children":[],"comments":null,"info":{"alias":[["OperatorSection"],{"Right":{"Right":"Cons"}}],"declType":"alias","fixity":{"associativity":"infixr","precedence":6}},"kind":null,"sourceSpan":{"end":[5,19],"name":"/home/gnumonik/code/work/purus/tests/purs/docs/src/OperatorSection.purs","start":[5,1]},"title":"(:)"},{"children":[{"comments":null,"info":{"declType":"typeClassMember","type":{"annotation":[],"contents":{"identifier":"a","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"b","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},"tag":"ParensInType"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":"f","tag":"TypeVar"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"sourceSpan":{"end":[8,54],"name":"/home/gnumonik/code/work/purus/tests/purs/docs/src/OperatorSection.purs","start":[8,3]},"title":"foldl"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["OperatorSection"],"Foldable"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["OperatorSection"],"List"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[16,21],"name":"/home/gnumonik/code/work/purus/tests/purs/docs/src/OperatorSection.purs","start":[10,1]},"title":""}],"comments":null,"info":{"arguments":[["f",null]],"declType":"typeClass","fundeps":[],"superclasses":[]},"kind":{"keyword":"class","kind":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim"],"Constraint"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[8,54],"name":"/home/gnumonik/code/work/purus/tests/purs/docs/src/OperatorSection.purs","start":[7,1]},"title":"Foldable"}],"name":"OperatorSection","reExports":[]} \ No newline at end of file diff --git a/tests/purs/docs/output/OperatorSection/externs.cbor b/tests/purs/docs/output/OperatorSection/externs.cbor new file mode 100644 index 000000000..c3acf5342 Binary files /dev/null and b/tests/purs/docs/output/OperatorSection/externs.cbor differ diff --git a/tests/purs/docs/output/Prelude/docs.json b/tests/purs/docs/output/Prelude/docs.json new file mode 100644 index 000000000..7f58206cc --- /dev/null +++ b/tests/purs/docs/output/Prelude/docs.json @@ -0,0 +1 @@ +{"comments":null,"declarations":[{"children":[{"comments":null,"info":{"arguments":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[],"tag":"REmpty"}],"tag":"TypeApp"}],"declType":"dataConstructor"},"sourceSpan":{"end":[3,23],"name":"bower_components/purescript-prelude/src/Prelude.purs","start":[3,14]},"title":"Unit"}],"comments":null,"info":{"dataDeclType":"newtype","declType":"data","roles":[],"typeArguments":[]},"kind":null,"sourceSpan":{"end":[3,23],"name":"bower_components/purescript-prelude/src/Prelude.purs","start":[3,1]},"title":"Unit"},{"children":[],"comments":null,"info":{"declType":"value","type":{"annotation":[],"contents":[["Prelude"],"Unit"],"tag":"TypeConstructor"}},"kind":null,"sourceSpan":{"end":[5,13],"name":"bower_components/purescript-prelude/src/Prelude.purs","start":[5,1]},"title":"unit"},{"children":[{"comments":null,"info":{"arguments":[],"declType":"dataConstructor"},"sourceSpan":{"end":[8,21],"name":"bower_components/purescript-prelude/src/Prelude.purs","start":[8,15]},"title":"True"},{"comments":null,"info":{"arguments":[],"declType":"dataConstructor"},"sourceSpan":{"end":[8,29],"name":"bower_components/purescript-prelude/src/Prelude.purs","start":[8,22]},"title":"False"}],"comments":null,"info":{"dataDeclType":"data","declType":"data","roles":[],"typeArguments":[]},"kind":null,"sourceSpan":{"end":[8,29],"name":"bower_components/purescript-prelude/src/Prelude.purs","start":[8,1]},"title":"Boolean2"}],"name":"Prelude","reExports":[]} \ No newline at end of file diff --git a/tests/purs/docs/output/Prelude/externs.cbor b/tests/purs/docs/output/Prelude/externs.cbor new file mode 100644 index 000000000..fea0cc416 Binary files /dev/null and b/tests/purs/docs/output/Prelude/externs.cbor differ diff --git a/tests/purs/docs/output/Prim.Boolean/docs.json b/tests/purs/docs/output/Prim.Boolean/docs.json new file mode 100644 index 000000000..c98a89d5d --- /dev/null +++ b/tests/purs/docs/output/Prim.Boolean/docs.json @@ -0,0 +1 @@ +{"comments":"The Prim.Boolean module is embedded in the PureScript compiler. Unlike `Prim`, it is not imported implicitly. It contains a type level `Boolean` data structure.","declarations":[{"children":[],"comments":"The 'True' boolean type.\n","info":{"declType":"externData","kind":{"annotation":[],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"},"roles":[]},"kind":null,"sourceSpan":null,"title":"True"},{"children":[],"comments":"The 'False' boolean type.\n","info":{"declType":"externData","kind":{"annotation":[],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"},"roles":[]},"kind":null,"sourceSpan":null,"title":"False"}],"name":"Prim.Boolean","reExports":[]} \ No newline at end of file diff --git a/tests/purs/docs/output/Prim.Coerce/docs.json b/tests/purs/docs/output/Prim.Coerce/docs.json new file mode 100644 index 000000000..b05ecf299 --- /dev/null +++ b/tests/purs/docs/output/Prim.Coerce/docs.json @@ -0,0 +1 @@ +{"comments":"The Prim.Coerce module is embedded in the PureScript compiler. Unlike `Prim`, it is not imported implicitly. It contains an automatically solved type class for coercing types that have provably-identical runtime representations with [purescript-safe-coerce](https://pursuit.purescript.org/packages/purescript-safe-coerce).","declarations":[{"children":[],"comments":"Coercible is a two-parameter type class that has instances for types `a`\nand `b` if the compiler can infer that they have the same representation.\nCoercible constraints are solved according to the following rules:\n\n* _reflexivity_, any type has the same representation as itself:\n`Coercible a a` holds.\n\n* _symmetry_, if a type `a` can be coerced to some other type `b`, then `b`\ncan also be coerced back to `a`: `Coercible a b` implies `Coercible b a`.\n\n* _transitivity_, if a type `a` can be coerced to some other type `b` which\ncan be coerced to some other type `c`, then `a` can also be coerced to `c`:\n`Coercible a b` and `Coercible b c` imply `Coercible a c`.\n\n* Newtypes can be freely wrapped and unwrapped when their constructor is\nin scope:\n\n newtype Age = Age Int\n\n`Coercible Int Age` and `Coercible Age Int` hold since `Age` has the same\nruntime representation than `Int`.\n\nNewtype constructors have to be in scope to preserve abstraction. It's\ncommon to declare a newtype to encode some invariants (non emptiness of\narrays with `Data.Array.NonEmpty.NonEmptyArray` for example), hide its\nconstructor and export smart constructors instead. Without this restriction,\nthe guarantees provided by such newtypes would be void.\n\n* If none of the above are applicable, two types of kind `Type` may be\ncoercible, but only if their heads are the same. For example,\n`Coercible (Maybe a) (Either a b)` does not hold because `Maybe` and\n`Either` are different. Those types don't share a common runtime\nrepresentation so coercing between them would be unsafe. In addition their\narguments may need to be identical or coercible, depending on the _roles_\nof the head's type parameters. Roles are documented in [the PureScript\nlanguage reference](https://github.com/purescript/documentation/blob/master/language/Roles.md).\n\nCoercible being polykinded, we can also coerce more than types of kind `Type`:\n\n* Rows are coercible when they have the same labels, when the corresponding\npairs of types are coercible and when their tails are coercible:\n`Coercible ( label :: a | r ) ( label :: b | s )` holds when\n`Coercible a b` and `Coercible r s` do. Closed rows cannot be coerced to\nopen rows.\n\n* Higher kinded types are coercible if they are coercible when fully\nsaturated: `Coercible (f :: _ -> Type) (g :: _ -> Type)` holds when\n`Coercible (f a) (g a)` does.\n\nThis rule may seem puzzling since there is no term of type `_ -> Type` to\napply `coerce` to, but it is necessary when coercing types with higher\nkinded parameters.\n","info":{"arguments":[["a",{"annotation":[],"contents":"k","tag":"TypeVar"}],["b",{"annotation":[],"contents":"k","tag":"TypeVar"}]],"declType":"typeClass","fundeps":[],"superclasses":[]},"kind":null,"sourceSpan":null,"title":"Coercible"}],"name":"Prim.Coerce","reExports":[]} \ No newline at end of file diff --git a/tests/purs/docs/output/Prim.Int/docs.json b/tests/purs/docs/output/Prim.Int/docs.json new file mode 100644 index 000000000..ddd7dbd32 --- /dev/null +++ b/tests/purs/docs/output/Prim.Int/docs.json @@ -0,0 +1 @@ +{"comments":"The Prim.Int module is embedded in the PureScript compiler. Unlike `Prim`, it is not imported implicitly. It contains automatically solved type classes for working with type-level intural numbers.","declarations":[{"children":[],"comments":"Compiler solved type class for adding type-level `Int`s.\n","info":{"arguments":[["left",{"annotation":[],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],["right",{"annotation":[],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],["sum",{"annotation":[],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}]],"declType":"typeClass","fundeps":[[["left","right"],["sum"]],[["left","sum"],["right"]],[["right","sum"],["left"]]],"superclasses":[]},"kind":null,"sourceSpan":null,"title":"Add"},{"children":[],"comments":"Compiler solved type class for comparing two type-level `Int`s.\nProduces an `Ordering`.\n","info":{"arguments":[["left",{"annotation":[],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],["right",{"annotation":[],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],["ordering",{"annotation":[],"contents":[["Prim","Ordering"],"Ordering"],"tag":"TypeConstructor"}]],"declType":"typeClass","fundeps":[[["left","right"],["ordering"]]],"superclasses":[]},"kind":null,"sourceSpan":null,"title":"Compare"},{"children":[],"comments":"Compiler solved type class for multiplying type-level `Int`s.\n","info":{"arguments":[["left",{"annotation":[],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],["right",{"annotation":[],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],["product",{"annotation":[],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}]],"declType":"typeClass","fundeps":[[["left","right"],["product"]]],"superclasses":[]},"kind":null,"sourceSpan":null,"title":"Mul"},{"children":[],"comments":"Compiler solved type class for converting a type-level `Int` into a type-level `String` (i.e. `Symbol`).\n","info":{"arguments":[["int",{"annotation":[],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],["string",{"annotation":[],"contents":[["Prim"],"Symbol"],"tag":"TypeConstructor"}]],"declType":"typeClass","fundeps":[[["int"],["string"]]],"superclasses":[]},"kind":null,"sourceSpan":null,"title":"ToString"}],"name":"Prim.Int","reExports":[]} \ No newline at end of file diff --git a/tests/purs/docs/output/Prim.Ordering/docs.json b/tests/purs/docs/output/Prim.Ordering/docs.json new file mode 100644 index 000000000..48e6b141f --- /dev/null +++ b/tests/purs/docs/output/Prim.Ordering/docs.json @@ -0,0 +1 @@ +{"comments":"The Prim.Ordering module is embedded in the PureScript compiler. Unlike `Prim`, it is not imported implicitly. It contains a type level `Ordering` data structure.","declarations":[{"children":[],"comments":"The `Ordering` kind represents the three possibilities of comparing two\ntypes of the same kind: `LT` (less than), `EQ` (equal to), and\n`GT` (greater than).\n","info":{"declType":"externData","kind":{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"roles":[]},"kind":null,"sourceSpan":null,"title":"Ordering"},{"children":[],"comments":"The 'less than' ordering type.\n","info":{"declType":"externData","kind":{"annotation":[],"contents":[["Prim","Ordering"],"Ordering"],"tag":"TypeConstructor"},"roles":[]},"kind":null,"sourceSpan":null,"title":"LT"},{"children":[],"comments":"The 'equal to' ordering type.\n","info":{"declType":"externData","kind":{"annotation":[],"contents":[["Prim","Ordering"],"Ordering"],"tag":"TypeConstructor"},"roles":[]},"kind":null,"sourceSpan":null,"title":"EQ"},{"children":[],"comments":"The 'greater than' ordering type.\n","info":{"declType":"externData","kind":{"annotation":[],"contents":[["Prim","Ordering"],"Ordering"],"tag":"TypeConstructor"},"roles":[]},"kind":null,"sourceSpan":null,"title":"GT"}],"name":"Prim.Ordering","reExports":[]} \ No newline at end of file diff --git a/tests/purs/docs/output/Prim.Row/docs.json b/tests/purs/docs/output/Prim.Row/docs.json new file mode 100644 index 000000000..081b2d363 --- /dev/null +++ b/tests/purs/docs/output/Prim.Row/docs.json @@ -0,0 +1 @@ +{"comments":"The Prim.Row module is embedded in the PureScript compiler. Unlike `Prim`, it is not imported implicitly. It contains automatically solved type classes for working with row types.","declarations":[{"children":[],"comments":"The Union type class is used to compute the union of two rows of types\n(left-biased, including duplicates).\n\nThe third type argument represents the union of the first two.\n","info":{"arguments":[["left",{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Row"],"tag":"TypeConstructor"},{"annotation":[],"contents":"k","tag":"TypeVar"}],"tag":"TypeApp"}],["right",{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Row"],"tag":"TypeConstructor"},{"annotation":[],"contents":"k","tag":"TypeVar"}],"tag":"TypeApp"}],["union",{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Row"],"tag":"TypeConstructor"},{"annotation":[],"contents":"k","tag":"TypeVar"}],"tag":"TypeApp"}]],"declType":"typeClass","fundeps":[[["left","right"],["union"]],[["right","union"],["left"]],[["union","left"],["right"]]],"superclasses":[]},"kind":null,"sourceSpan":null,"title":"Union"},{"children":[],"comments":"The Nub type class is used to remove duplicate labels from rows.\n","info":{"arguments":[["original",{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Row"],"tag":"TypeConstructor"},{"annotation":[],"contents":"k","tag":"TypeVar"}],"tag":"TypeApp"}],["nubbed",{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Row"],"tag":"TypeConstructor"},{"annotation":[],"contents":"k","tag":"TypeVar"}],"tag":"TypeApp"}]],"declType":"typeClass","fundeps":[[["original"],["nubbed"]]],"superclasses":[]},"kind":null,"sourceSpan":null,"title":"Nub"},{"children":[],"comments":"The Lacks type class asserts that a label does not occur in a given row.\n","info":{"arguments":[["label",{"annotation":[],"contents":[["Prim"],"Symbol"],"tag":"TypeConstructor"}],["row",{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Row"],"tag":"TypeConstructor"},{"annotation":[],"contents":"k","tag":"TypeVar"}],"tag":"TypeApp"}]],"declType":"typeClass","fundeps":[],"superclasses":[]},"kind":null,"sourceSpan":null,"title":"Lacks"},{"children":[],"comments":"The Cons type class is a 4-way relation which asserts that one row of\ntypes can be obtained from another by inserting a new label/type pair on\nthe left.\n","info":{"arguments":[["label",{"annotation":[],"contents":[["Prim"],"Symbol"],"tag":"TypeConstructor"}],["a",{"annotation":[],"contents":"k","tag":"TypeVar"}],["tail",{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Row"],"tag":"TypeConstructor"},{"annotation":[],"contents":"k","tag":"TypeVar"}],"tag":"TypeApp"}],["row",{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Row"],"tag":"TypeConstructor"},{"annotation":[],"contents":"k","tag":"TypeVar"}],"tag":"TypeApp"}]],"declType":"typeClass","fundeps":[[["label","a","tail"],["row"]],[["label","row"],["a","tail"]]],"superclasses":[]},"kind":null,"sourceSpan":null,"title":"Cons"}],"name":"Prim.Row","reExports":[]} \ No newline at end of file diff --git a/tests/purs/docs/output/Prim.RowList/docs.json b/tests/purs/docs/output/Prim.RowList/docs.json new file mode 100644 index 000000000..1ea89a442 --- /dev/null +++ b/tests/purs/docs/output/Prim.RowList/docs.json @@ -0,0 +1 @@ +{"comments":"The Prim.RowList module is embedded in the PureScript compiler. Unlike `Prim`, it is not imported implicitly. It contains a type level list (`RowList`) that represents an ordered view of a row of types.","declarations":[{"children":[],"comments":"A type level list representation of a row of types.\n","info":{"declType":"externData","kind":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"roles":[]},"kind":null,"sourceSpan":null,"title":"RowList"},{"children":[],"comments":"Constructs a new `RowList` from a label, a type, and an existing tail\n`RowList`. E.g: `Cons \"x\" Int (Cons \"y\" Int Nil)`.\n","info":{"declType":"externData","kind":{"annotation":[],"contents":{"identifier":"k","kind":{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Symbol"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"k","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim","RowList"],"RowList"],"tag":"TypeConstructor"},{"annotation":[],"contents":"k","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim","RowList"],"RowList"],"tag":"TypeConstructor"},{"annotation":[],"contents":"k","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"roles":[]},"kind":null,"sourceSpan":null,"title":"Cons"},{"children":[],"comments":"The empty `RowList`.\n","info":{"declType":"externData","kind":{"annotation":[],"contents":{"identifier":"k","kind":{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim","RowList"],"RowList"],"tag":"TypeConstructor"},{"annotation":[],"contents":"k","tag":"TypeVar"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"roles":[]},"kind":null,"sourceSpan":null,"title":"Nil"},{"children":[],"comments":"Compiler solved type class for generating a `RowList` from a closed row\nof types. Entries are sorted by label and duplicates are preserved in\nthe order they appeared in the row.\n","info":{"arguments":[["row",{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Row"],"tag":"TypeConstructor"},{"annotation":[],"contents":"k","tag":"TypeVar"}],"tag":"TypeApp"}],["list",{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim","RowList"],"RowList"],"tag":"TypeConstructor"},{"annotation":[],"contents":"k","tag":"TypeVar"}],"tag":"TypeApp"}]],"declType":"typeClass","fundeps":[[["row"],["list"]]],"superclasses":[]},"kind":null,"sourceSpan":null,"title":"RowToList"}],"name":"Prim.RowList","reExports":[]} \ No newline at end of file diff --git a/tests/purs/docs/output/Prim.Symbol/docs.json b/tests/purs/docs/output/Prim.Symbol/docs.json new file mode 100644 index 000000000..e2bc9ff2a --- /dev/null +++ b/tests/purs/docs/output/Prim.Symbol/docs.json @@ -0,0 +1 @@ +{"comments":"The Prim.Symbol module is embedded in the PureScript compiler. Unlike `Prim`, it is not imported implicitly. It contains automatically solved type classes for working with `Symbols`.","declarations":[{"children":[],"comments":"Compiler solved type class for appending `Symbol`s together.\n","info":{"arguments":[["left",{"annotation":[],"contents":[["Prim"],"Symbol"],"tag":"TypeConstructor"}],["right",{"annotation":[],"contents":[["Prim"],"Symbol"],"tag":"TypeConstructor"}],["appended",{"annotation":[],"contents":[["Prim"],"Symbol"],"tag":"TypeConstructor"}]],"declType":"typeClass","fundeps":[[["left","right"],["appended"]],[["right","appended"],["left"]],[["appended","left"],["right"]]],"superclasses":[]},"kind":null,"sourceSpan":null,"title":"Append"},{"children":[],"comments":"Compiler solved type class for comparing two `Symbol`s.\nProduces an `Ordering`.\n","info":{"arguments":[["left",{"annotation":[],"contents":[["Prim"],"Symbol"],"tag":"TypeConstructor"}],["right",{"annotation":[],"contents":[["Prim"],"Symbol"],"tag":"TypeConstructor"}],["ordering",{"annotation":[],"contents":[["Prim","Ordering"],"Ordering"],"tag":"TypeConstructor"}]],"declType":"typeClass","fundeps":[[["left","right"],["ordering"]]],"superclasses":[]},"kind":null,"sourceSpan":null,"title":"Compare"},{"children":[],"comments":"Compiler solved type class for either splitting up a symbol into its\nhead and tail or for combining a head and tail into a new symbol.\nRequires the head to be a single character and the combined string\ncannot be empty.\n","info":{"arguments":[["head",{"annotation":[],"contents":[["Prim"],"Symbol"],"tag":"TypeConstructor"}],["tail",{"annotation":[],"contents":[["Prim"],"Symbol"],"tag":"TypeConstructor"}],["symbol",{"annotation":[],"contents":[["Prim"],"Symbol"],"tag":"TypeConstructor"}]],"declType":"typeClass","fundeps":[[["head","tail"],["symbol"]],[["symbol"],["head","tail"]]],"superclasses":[]},"kind":null,"sourceSpan":null,"title":"Cons"}],"name":"Prim.Symbol","reExports":[]} \ No newline at end of file diff --git a/tests/purs/docs/output/Prim.TypeError/docs.json b/tests/purs/docs/output/Prim.TypeError/docs.json new file mode 100644 index 000000000..86ca13721 --- /dev/null +++ b/tests/purs/docs/output/Prim.TypeError/docs.json @@ -0,0 +1 @@ +{"comments":"The Prim.TypeError module is embedded in the PureScript compiler. Unlike `Prim`, it is not imported implicitly. It contains type classes that provide custom type error and warning functionality.","declarations":[{"children":[],"comments":"The Warn type class allows a custom compiler warning to be displayed.\n\nFor more information, see\n[the Custom Type Errors guide](https://github.com/purescript/documentation/blob/master/guides/Custom-Type-Errors.md).\n","info":{"arguments":[["message",{"annotation":[],"contents":[["Prim","TypeError"],"Doc"],"tag":"TypeConstructor"}]],"declType":"typeClass","fundeps":[],"superclasses":[]},"kind":null,"sourceSpan":null,"title":"Warn"},{"children":[],"comments":"The Fail type class is part of the custom type errors feature. To provide\na custom type error when someone tries to use a particular instance,\nwrite that instance out with a Fail constraint.\n\nFor more information, see\n[the Custom Type Errors guide](https://github.com/purescript/documentation/blob/master/guides/Custom-Type-Errors.md).\n","info":{"arguments":[["message",{"annotation":[],"contents":[["Prim","TypeError"],"Doc"],"tag":"TypeConstructor"}]],"declType":"typeClass","fundeps":[],"superclasses":[]},"kind":null,"sourceSpan":null,"title":"Fail"},{"children":[],"comments":"`Doc` is the kind of type-level documents.\n\nThis kind is used with the `Fail` and `Warn` type classes.\nBuild up a `Doc` with `Text`, `Quote`, `QuoteLabel`, `Beside`, and `Above`.\n","info":{"declType":"externData","kind":{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"roles":[]},"kind":null,"sourceSpan":null,"title":"Doc"},{"children":[],"comments":"The Text type constructor makes a Doc from a Symbol\nto be used in a custom type error.\n\nFor more information, see\n[the Custom Type Errors guide](https://github.com/purescript/documentation/blob/master/guides/Custom-Type-Errors.md).\n","info":{"declType":"externData","kind":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Symbol"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim","TypeError"],"Doc"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"roles":[]},"kind":null,"sourceSpan":null,"title":"Text"},{"children":[],"comments":"The Quote type constructor renders any concrete type as a Doc\nto be used in a custom type error.\n\nFor more information, see\n[the Custom Type Errors guide](https://github.com/purescript/documentation/blob/master/guides/Custom-Type-Errors.md).\n","info":{"declType":"externData","kind":{"annotation":[],"contents":{"identifier":"k","kind":{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"k","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim","TypeError"],"Doc"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"roles":[]},"kind":null,"sourceSpan":null,"title":"Quote"},{"children":[],"comments":"The `QuoteLabel` type constructor will produce a `Doc` when given a `Symbol`. When the resulting `Doc` is rendered\nfor a `Warn` or `Fail` constraint, a syntactically valid label will be produced, escaping with quotes as needed.\n\nFor more information, see\n[the Custom Type Errors guide](https://github.com/purescript/documentation/blob/master/guides/Custom-Type-Errors.md).\n","info":{"declType":"externData","kind":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Symbol"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim","TypeError"],"Doc"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"roles":[]},"kind":null,"sourceSpan":null,"title":"QuoteLabel"},{"children":[],"comments":"The Beside type constructor combines two Docs horizontally\nto be used in a custom type error.\n\nFor more information, see\n[the Custom Type Errors guide](https://github.com/purescript/documentation/blob/master/guides/Custom-Type-Errors.md).\n","info":{"declType":"externData","kind":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim","TypeError"],"Doc"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim","TypeError"],"Doc"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim","TypeError"],"Doc"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"roles":[]},"kind":null,"sourceSpan":null,"title":"Beside"},{"children":[],"comments":"The Above type constructor combines two Docs vertically\nin a custom type error.\n\nFor more information, see\n[the Custom Type Errors guide](https://github.com/purescript/documentation/blob/master/guides/Custom-Type-Errors.md).\n","info":{"declType":"externData","kind":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim","TypeError"],"Doc"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim","TypeError"],"Doc"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim","TypeError"],"Doc"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"roles":[]},"kind":null,"sourceSpan":null,"title":"Above"}],"name":"Prim.TypeError","reExports":[]} \ No newline at end of file diff --git a/tests/purs/docs/output/Prim/docs.json b/tests/purs/docs/output/Prim/docs.json new file mode 100644 index 000000000..8a8ee9e8a --- /dev/null +++ b/tests/purs/docs/output/Prim/docs.json @@ -0,0 +1 @@ +{"comments":"The `Prim` module is embedded in the PureScript compiler in order to provide compiler support for certain types — for example, value literals, or syntax sugar. It is implicitly imported unqualified in every module except those that list it as a qualified import.\n\n`Prim` does not include additional built-in types and kinds that are defined deeper in the compiler such as Type wildcards (e.g. `f :: _ -> Int`) and Quantified Types. Rather, these are documented in [the PureScript language reference](https://github.com/purescript/documentation/blob/master/language/Types.md).\n","declarations":[{"children":[],"comments":"A function, which takes values of the type specified by the first type\nparameter, and returns values of the type specified by the second.\nIn the JavaScript backend, this is a standard JavaScript Function.\n\nThe type constructor `(->)` is syntactic sugar for this type constructor.\nIt is recommended to use `(->)` rather than `Function`, where possible.\n\nThat is, prefer this:\n\n f :: Number -> Number\n\nto either of these:\n\n f :: Function Number Number\n f :: (->) Number Number\n","info":{"declType":"externData","kind":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"roles":[]},"kind":null,"sourceSpan":null,"title":"Function"},{"children":[],"comments":"An Array: a data structure supporting efficient random access. In\nthe JavaScript backend, values of this type are represented as JavaScript\nArrays at runtime.\n\nConstruct values using literals:\n\n x = [1,2,3,4,5] :: Array Int\n","info":{"declType":"externData","kind":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"roles":[]},"kind":null,"sourceSpan":null,"title":"Array"},{"children":[],"comments":"The type of records whose fields are known at compile time. In the\nJavaScript backend, values of this type are represented as JavaScript\nObjects at runtime.\n\nThe type signature here means that the `Record` type constructor takes\na row of concrete types. For example:\n\n type Person = Record (name :: String, age :: Number)\n\nThe syntactic sugar with curly braces `{ }` is generally preferred, though:\n\n type Person = { name :: String, age :: Number }\n\nThe row associates a type to each label which appears in the record.\n\n_Technical note_: PureScript allows duplicate labels in rows, and the\nmeaning of `Record r` is based on the _first_ occurrence of each label in\nthe row `r`.\n","info":{"declType":"externData","kind":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Row"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"roles":[]},"kind":null,"sourceSpan":null,"title":"Record"},{"children":[],"comments":"A double precision floating point number (IEEE 754).\n\nConstruct values of this type with literals.\nNegative literals must be wrapped in parentheses if the negation sign could be mistaken\nfor an infix operator:\n\n x = 35.23 :: Number\n y = -1.224e6 :: Number\n z = exp (-1.0) :: Number\n","info":{"declType":"externData","kind":{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"roles":[]},"kind":null,"sourceSpan":null,"title":"Number"},{"children":[],"comments":"A 32-bit signed integer. See the `purescript-integers` package for details\nof how this is accomplished when compiling to JavaScript.\n\nConstruct values of this type with literals. Hexadecimal syntax is supported.\nNegative literals must be wrapped in parentheses if the negation sign could be mistaken\nfor an infix operator:\n\n x = -23 :: Int\n y = 0x17 :: Int\n z = complement (-24) :: Int\n\nIntegers used as types are considered to have kind `Int`.\nUnlike value-level `Int`s, which must be representable as a 32-bit signed integer,\ntype-level `Int`s are unbounded. Hexadecimal support is also supported at the type level.\n\n type One :: Int\n type One = 1\n \n type Beyond32BitSignedInt :: Int\n type Beyond32BitSignedInt = 2147483648\n \n type HexInt :: Int\n type HexInt = 0x17\n\nNegative integer literals at the type level must be\nwrapped in parentheses if the negation sign could be mistaken for an infix operator.\n\n type NegativeOne = -1\n foo :: Proxy (-1) -> ...\n","info":{"declType":"externData","kind":{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"roles":[]},"kind":null,"sourceSpan":null,"title":"Int"},{"children":[],"comments":"A String. As in JavaScript, String values represent sequences of UTF-16\ncode units, which are not required to form a valid encoding of Unicode\ntext (for example, lone surrogates are permitted).\n\nConstruct values of this type with literals, using double quotes `\"`:\n\n x = \"hello, world\" :: String\n\nMulti-line string literals are also supported with triple quotes (`\"\"\"`):\n\n x = \"\"\"multi\n line\"\"\"\n\nAt the type level, string literals represent types with kind `Symbol`.\nThese types will have kind `String` in a future release:\n\n type Hello :: Symbol\n type Hello = \"Hello, world\"\n","info":{"declType":"externData","kind":{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"roles":[]},"kind":null,"sourceSpan":null,"title":"String"},{"children":[],"comments":"A single character (UTF-16 code unit). The JavaScript representation is a\nnormal `String`, which is guaranteed to contain one code unit. This means\nthat astral plane characters (i.e. those with code point values greater\nthan `0xFFFF`) cannot be represented as `Char` values.\n\nConstruct values of this type with literals, using single quotes `'`:\n\n x = 'a' :: Char\n","info":{"declType":"externData","kind":{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"roles":[]},"kind":null,"sourceSpan":null,"title":"Char"},{"children":[],"comments":"A JavaScript Boolean value.\n\nConstruct values of this type with the literals `true` and `false`.\n\nThe `True` and `False` types defined in `Prim.Boolean` have this type as their kind.\n","info":{"declType":"externData","kind":{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"roles":[]},"kind":null,"sourceSpan":null,"title":"Boolean"},{"children":[],"comments":"The Partial type class is used to indicate that a function is *partial,*\nthat is, it is not defined for all inputs. In practice, attempting to use\na partial function with a bad input will usually cause an error to be\nthrown, although it is not safe to assume that this will happen in all\ncases. For more information, see\n[purescript-partial](https://pursuit.purescript.org/packages/purescript-partial/).\n","info":{"arguments":[],"declType":"typeClass","fundeps":[],"superclasses":[]},"kind":null,"sourceSpan":null,"title":"Partial"},{"children":[],"comments":"`Type` is the kind of all proper types: those that classify value-level terms.\nFor example the type `Boolean` has kind `Type`; denoted by `Boolean :: Type`.\n","info":{"declType":"externData","kind":{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"roles":[]},"kind":null,"sourceSpan":null,"title":"Type"},{"children":[],"comments":"`Constraint` is the kind of type class constraints.\nFor example, a type class declaration like this:\n\n class Semigroup a where\n append :: a -> a -> a\n\nhas the kind signature:\n\n class Semigroup :: Type -> Constraint\n","info":{"declType":"externData","kind":{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"roles":[]},"kind":null,"sourceSpan":null,"title":"Constraint"},{"children":[],"comments":"`Symbol` is the kind of type-level strings.\n\nConstruct types of this kind using the same literal syntax as documented\nfor strings.\n\n type Hello :: Symbol\n type Hello = \"Hello, world\"\n\n","info":{"declType":"externData","kind":{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"roles":[]},"kind":null,"sourceSpan":null,"title":"Symbol"},{"children":[],"comments":"`Row` is the kind constructor of label-indexed types which map type-level strings to other types.\nThe most common use of `Row` is `Row Type`, a row mapping labels to basic (of kind `Type`) types:\n\n type ExampleRow :: Row Type\n type ExampleRow = ( name :: String, values :: Array Int )\n\nThis is the kind of `Row` expected by the `Record` type constructor.\nMore advanced row kinds like `Row (Type -> Type)` are used much less frequently.\n","info":{"declType":"externData","kind":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"roles":[]},"kind":null,"sourceSpan":null,"title":"Row"}],"name":"Prim","reExports":[]} \ No newline at end of file diff --git a/tests/purs/docs/output/PrimSubmodules/docs.json b/tests/purs/docs/output/PrimSubmodules/docs.json new file mode 100644 index 000000000..997894766 --- /dev/null +++ b/tests/purs/docs/output/PrimSubmodules/docs.json @@ -0,0 +1 @@ +{"comments":null,"declarations":[{"children":[{"comments":null,"info":{"arguments":[{"annotation":[],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"declType":"dataConstructor"},"sourceSpan":{"end":[5,33],"name":"/home/gnumonik/code/work/purus/tests/purs/docs/src/PrimSubmodules.purs","start":[5,28]},"title":"Lol"}],"comments":null,"info":{"dataDeclType":"data","declType":"data","roles":["Phantom"],"typeArguments":[["a",{"annotation":[],"contents":[["Prim","Ordering"],"Ordering"],"tag":"TypeConstructor"}]]},"kind":{"keyword":"data","kind":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim","Ordering"],"Ordering"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[5,37],"name":"/home/gnumonik/code/work/purus/tests/purs/docs/src/PrimSubmodules.purs","start":[5,1]},"title":"Lol"},{"children":[],"comments":null,"info":{"declType":"value","type":{"annotation":[],"contents":[{"annotation":[],"contents":[["PrimSubmodules"],"Lol"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim","Ordering"],"LT"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"kind":null,"sourceSpan":{"end":[7,14],"name":"/home/gnumonik/code/work/purus/tests/purs/docs/src/PrimSubmodules.purs","start":[7,1]},"title":"x"},{"children":[],"comments":null,"info":{"declType":"value","type":{"annotation":[],"contents":[{"annotation":[],"contents":[["PrimSubmodules"],"Lol"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim","Ordering"],"EQ"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"kind":null,"sourceSpan":{"end":[10,14],"name":"/home/gnumonik/code/work/purus/tests/purs/docs/src/PrimSubmodules.purs","start":[10,1]},"title":"y"}],"name":"PrimSubmodules","reExports":[]} \ No newline at end of file diff --git a/tests/purs/docs/output/PrimSubmodules/externs.cbor b/tests/purs/docs/output/PrimSubmodules/externs.cbor new file mode 100644 index 000000000..b1d5370b3 Binary files /dev/null and b/tests/purs/docs/output/PrimSubmodules/externs.cbor differ diff --git a/tests/purs/docs/output/ReExportedTypeClass/docs.json b/tests/purs/docs/output/ReExportedTypeClass/docs.json new file mode 100644 index 000000000..8e58c1266 --- /dev/null +++ b/tests/purs/docs/output/ReExportedTypeClass/docs.json @@ -0,0 +1 @@ +{"comments":null,"declarations":[],"name":"ReExportedTypeClass","reExports":[]} \ No newline at end of file diff --git a/tests/purs/docs/output/ReExportedTypeClass/externs.cbor b/tests/purs/docs/output/ReExportedTypeClass/externs.cbor new file mode 100644 index 000000000..af14223b9 Binary files /dev/null and b/tests/purs/docs/output/ReExportedTypeClass/externs.cbor differ diff --git a/tests/purs/docs/output/RoleAnnotationDocs/docs.json b/tests/purs/docs/output/RoleAnnotationDocs/docs.json new file mode 100644 index 000000000..cc36f7aa1 --- /dev/null +++ b/tests/purs/docs/output/RoleAnnotationDocs/docs.json @@ -0,0 +1 @@ +{"comments":null,"declarations":[{"children":[{"comments":null,"info":{"arguments":[],"declType":"dataConstructor"},"sourceSpan":{"end":[3,25],"name":"/home/gnumonik/code/work/purus/tests/purs/docs/src/RoleAnnotationDocs.purs","start":[3,18]},"title":"D_RNP"}],"comments":null,"info":{"dataDeclType":"data","declType":"data","roles":["Representational","Nominal","Phantom"],"typeArguments":[["a",null],["b",null],["c",null]]},"kind":{"keyword":"data","kind":{"annotation":[],"contents":{"identifier":"k1","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"k2","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"k3","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"k1","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"k2","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"k3","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"sourceSpan":{"end":[3,25],"name":"/home/gnumonik/code/work/purus/tests/purs/docs/src/RoleAnnotationDocs.purs","start":[3,1]},"title":"D_RNP"},{"children":[{"comments":null,"info":{"arguments":[],"declType":"dataConstructor"},"sourceSpan":{"end":[6,25],"name":"/home/gnumonik/code/work/purus/tests/purs/docs/src/RoleAnnotationDocs.purs","start":[6,18]},"title":"D_NPR"}],"comments":null,"info":{"dataDeclType":"data","declType":"data","roles":["Nominal","Phantom","Representational"],"typeArguments":[["a",null],["b",null],["c",null]]},"kind":{"keyword":"data","kind":{"annotation":[],"contents":{"identifier":"k1","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"k2","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"k3","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"k1","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"k2","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"k3","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"sourceSpan":{"end":[6,25],"name":"/home/gnumonik/code/work/purus/tests/purs/docs/src/RoleAnnotationDocs.purs","start":[6,1]},"title":"D_NPR"},{"children":[{"comments":null,"info":{"arguments":[],"declType":"dataConstructor"},"sourceSpan":{"end":[9,25],"name":"/home/gnumonik/code/work/purus/tests/purs/docs/src/RoleAnnotationDocs.purs","start":[9,18]},"title":"D_PRN"}],"comments":null,"info":{"dataDeclType":"data","declType":"data","roles":["Phantom","Representational","Nominal"],"typeArguments":[["a",null],["b",null],["c",null]]},"kind":{"keyword":"data","kind":{"annotation":[],"contents":{"identifier":"k1","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"k2","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"k3","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"k1","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"k2","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"k3","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"sourceSpan":{"end":[9,25],"name":"/home/gnumonik/code/work/purus/tests/purs/docs/src/RoleAnnotationDocs.purs","start":[9,1]},"title":"D_PRN"},{"children":[],"comments":null,"info":{"dataDeclType":"data","declType":"data","roles":["Nominal","Nominal","Nominal"],"typeArguments":[["t0",null],["t1",null],["t2",null]]},"kind":null,"sourceSpan":{"end":[12,60],"name":"/home/gnumonik/code/work/purus/tests/purs/docs/src/RoleAnnotationDocs.purs","start":[12,1]},"title":"FFI_NNN"},{"children":[],"comments":null,"info":{"dataDeclType":"data","declType":"data","roles":["Representational","Nominal","Phantom"],"typeArguments":[["t0",null],["t1",null],["t2",null]]},"kind":null,"sourceSpan":{"end":[14,60],"name":"/home/gnumonik/code/work/purus/tests/purs/docs/src/RoleAnnotationDocs.purs","start":[14,1]},"title":"FFI_RNP"},{"children":[],"comments":null,"info":{"dataDeclType":"data","declType":"data","roles":["Representational","Nominal","Phantom"],"typeArguments":[["t0",null],["t1",null],["t2",null]]},"kind":{"keyword":"data","kind":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"tag":"ParensInType"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[17,74],"name":"/home/gnumonik/code/work/purus/tests/purs/docs/src/RoleAnnotationDocs.purs","start":[17,1]},"title":"FFI_Higher1"},{"children":[],"comments":null,"info":{"dataDeclType":"data","declType":"data","roles":["Representational","Nominal","Phantom"],"typeArguments":[["t0",null],["t1",null],["t2",null]]},"kind":{"keyword":"data","kind":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"tag":"ParensInType"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[20,74],"name":"/home/gnumonik/code/work/purus/tests/purs/docs/src/RoleAnnotationDocs.purs","start":[20,1]},"title":"FFI_Higher2"},{"children":[],"comments":null,"info":{"dataDeclType":"data","declType":"data","roles":["Representational","Nominal","Phantom"],"typeArguments":[["t0",null],["t1",null],["t2",null]]},"kind":{"keyword":"data","kind":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"tag":"ParensInType"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[23,74],"name":"/home/gnumonik/code/work/purus/tests/purs/docs/src/RoleAnnotationDocs.purs","start":[23,1]},"title":"FFI_Higher3"},{"children":[],"comments":null,"info":{"dataDeclType":"data","declType":"data","roles":["Representational","Nominal","Phantom"],"typeArguments":[["t0",null],["t1",null],["t2",null]]},"kind":{"keyword":"data","kind":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[],"contents":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"tag":"ParensInType"}],"tag":"TypeApp"},"tag":"ParensInType"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[26,84],"name":"/home/gnumonik/code/work/purus/tests/purs/docs/src/RoleAnnotationDocs.purs","start":[26,1]},"title":"FFI_Higher4"},{"children":[],"comments":null,"info":{"dataDeclType":"data","declType":"data","roles":["Representational","Nominal","Phantom"],"typeArguments":[["t0",null],["t1",null],["t2",null]]},"kind":null,"sourceSpan":{"end":[29,69],"name":"/home/gnumonik/code/work/purus/tests/purs/docs/src/RoleAnnotationDocs.purs","start":[29,1]},"title":"FFI_HeadParens"},{"children":[],"comments":null,"info":{"dataDeclType":"data","declType":"data","roles":["Representational","Nominal","Phantom"],"typeArguments":[["t0",null],["t1",null],["t2",null]]},"kind":null,"sourceSpan":{"end":[32,69],"name":"/home/gnumonik/code/work/purus/tests/purs/docs/src/RoleAnnotationDocs.purs","start":[32,1]},"title":"FFI_TailParens"},{"children":[],"comments":null,"info":{"dataDeclType":"data","declType":"data","roles":["Representational","Nominal","Phantom"],"typeArguments":[["t0",null],["t1",null],["t2",null]]},"kind":null,"sourceSpan":{"end":[35,70],"name":"/home/gnumonik/code/work/purus/tests/purs/docs/src/RoleAnnotationDocs.purs","start":[35,1]},"title":"FFI_WholeParens"}],"name":"RoleAnnotationDocs","reExports":[]} \ No newline at end of file diff --git a/tests/purs/docs/output/RoleAnnotationDocs/externs.cbor b/tests/purs/docs/output/RoleAnnotationDocs/externs.cbor new file mode 100644 index 000000000..b24fe45fb Binary files /dev/null and b/tests/purs/docs/output/RoleAnnotationDocs/externs.cbor differ diff --git a/tests/purs/docs/output/Shebang1Undocumented/docs.json b/tests/purs/docs/output/Shebang1Undocumented/docs.json new file mode 100644 index 000000000..3f932ff23 --- /dev/null +++ b/tests/purs/docs/output/Shebang1Undocumented/docs.json @@ -0,0 +1 @@ +{"comments":null,"declarations":[],"name":"Shebang1Undocumented","reExports":[]} \ No newline at end of file diff --git a/tests/purs/docs/output/Shebang1Undocumented/externs.cbor b/tests/purs/docs/output/Shebang1Undocumented/externs.cbor new file mode 100644 index 000000000..8b32266ac Binary files /dev/null and b/tests/purs/docs/output/Shebang1Undocumented/externs.cbor differ diff --git a/tests/purs/docs/output/Shebang2Undocumented/docs.json b/tests/purs/docs/output/Shebang2Undocumented/docs.json new file mode 100644 index 000000000..6f8b85418 --- /dev/null +++ b/tests/purs/docs/output/Shebang2Undocumented/docs.json @@ -0,0 +1 @@ +{"comments":null,"declarations":[],"name":"Shebang2Undocumented","reExports":[]} \ No newline at end of file diff --git a/tests/purs/docs/output/Shebang2Undocumented/externs.cbor b/tests/purs/docs/output/Shebang2Undocumented/externs.cbor new file mode 100644 index 000000000..27886059f Binary files /dev/null and b/tests/purs/docs/output/Shebang2Undocumented/externs.cbor differ diff --git a/tests/purs/docs/output/Shebang3Undocumented/docs.json b/tests/purs/docs/output/Shebang3Undocumented/docs.json new file mode 100644 index 000000000..336925e7e --- /dev/null +++ b/tests/purs/docs/output/Shebang3Undocumented/docs.json @@ -0,0 +1 @@ +{"comments":"Normal doc comment\n","declarations":[],"name":"Shebang3Undocumented","reExports":[]} \ No newline at end of file diff --git a/tests/purs/docs/output/Shebang3Undocumented/externs.cbor b/tests/purs/docs/output/Shebang3Undocumented/externs.cbor new file mode 100644 index 000000000..34225a263 Binary files /dev/null and b/tests/purs/docs/output/Shebang3Undocumented/externs.cbor differ diff --git a/tests/purs/docs/output/Shebang4Undocumented/docs.json b/tests/purs/docs/output/Shebang4Undocumented/docs.json new file mode 100644 index 000000000..c9c4729fd --- /dev/null +++ b/tests/purs/docs/output/Shebang4Undocumented/docs.json @@ -0,0 +1 @@ +{"comments":"Normal doc comment\n","declarations":[],"name":"Shebang4Undocumented","reExports":[]} \ No newline at end of file diff --git a/tests/purs/docs/output/Shebang4Undocumented/externs.cbor b/tests/purs/docs/output/Shebang4Undocumented/externs.cbor new file mode 100644 index 000000000..7a29351de Binary files /dev/null and b/tests/purs/docs/output/Shebang4Undocumented/externs.cbor differ diff --git a/tests/purs/docs/output/SolitaryTypeClassMember/docs.json b/tests/purs/docs/output/SolitaryTypeClassMember/docs.json new file mode 100644 index 000000000..85c3f288a --- /dev/null +++ b/tests/purs/docs/output/SolitaryTypeClassMember/docs.json @@ -0,0 +1 @@ +{"comments":null,"declarations":[],"name":"SolitaryTypeClassMember","reExports":[]} \ No newline at end of file diff --git a/tests/purs/docs/output/SolitaryTypeClassMember/externs.cbor b/tests/purs/docs/output/SolitaryTypeClassMember/externs.cbor new file mode 100644 index 000000000..e6771340f Binary files /dev/null and b/tests/purs/docs/output/SolitaryTypeClassMember/externs.cbor differ diff --git a/tests/purs/docs/output/SomeTypeClass/docs.json b/tests/purs/docs/output/SomeTypeClass/docs.json new file mode 100644 index 000000000..e35c68466 --- /dev/null +++ b/tests/purs/docs/output/SomeTypeClass/docs.json @@ -0,0 +1 @@ +{"comments":null,"declarations":[{"children":[{"comments":null,"info":{"declType":"typeClassMember","type":{"annotation":[],"contents":"a","tag":"TypeVar"}},"sourceSpan":{"end":[5,14],"name":"/home/gnumonik/code/work/purus/tests/purs/docs/src/SomeTypeClass.purs","start":[5,3]},"title":"member"}],"comments":null,"info":{"arguments":[["a",null]],"declType":"typeClass","fundeps":[],"superclasses":[]},"kind":null,"sourceSpan":{"end":[5,14],"name":"/home/gnumonik/code/work/purus/tests/purs/docs/src/SomeTypeClass.purs","start":[4,1]},"title":"SomeClass"}],"name":"SomeTypeClass","reExports":[]} \ No newline at end of file diff --git a/tests/purs/docs/output/SomeTypeClass/externs.cbor b/tests/purs/docs/output/SomeTypeClass/externs.cbor new file mode 100644 index 000000000..0e2781cac Binary files /dev/null and b/tests/purs/docs/output/SomeTypeClass/externs.cbor differ diff --git a/tests/purs/docs/output/Transitive1/docs.json b/tests/purs/docs/output/Transitive1/docs.json new file mode 100644 index 000000000..5242e712f --- /dev/null +++ b/tests/purs/docs/output/Transitive1/docs.json @@ -0,0 +1 @@ +{"comments":null,"declarations":[],"name":"Transitive1","reExports":[]} \ No newline at end of file diff --git a/tests/purs/docs/output/Transitive1/externs.cbor b/tests/purs/docs/output/Transitive1/externs.cbor new file mode 100644 index 000000000..0ba9ff3f1 Binary files /dev/null and b/tests/purs/docs/output/Transitive1/externs.cbor differ diff --git a/tests/purs/docs/output/Transitive2/docs.json b/tests/purs/docs/output/Transitive2/docs.json new file mode 100644 index 000000000..30edc30bf --- /dev/null +++ b/tests/purs/docs/output/Transitive2/docs.json @@ -0,0 +1 @@ +{"comments":null,"declarations":[],"name":"Transitive2","reExports":[]} \ No newline at end of file diff --git a/tests/purs/docs/output/Transitive2/externs.cbor b/tests/purs/docs/output/Transitive2/externs.cbor new file mode 100644 index 000000000..35ff4cd8c Binary files /dev/null and b/tests/purs/docs/output/Transitive2/externs.cbor differ diff --git a/tests/purs/docs/output/Transitive3/docs.json b/tests/purs/docs/output/Transitive3/docs.json new file mode 100644 index 000000000..a641aeb10 --- /dev/null +++ b/tests/purs/docs/output/Transitive3/docs.json @@ -0,0 +1 @@ +{"comments":null,"declarations":[{"children":[],"comments":null,"info":{"declType":"value","type":{"annotation":[],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}},"kind":null,"sourceSpan":{"end":[3,19],"name":"/home/gnumonik/code/work/purus/tests/purs/docs/src/Transitive3.purs","start":[3,1]},"title":"transitive3"}],"name":"Transitive3","reExports":[]} \ No newline at end of file diff --git a/tests/purs/docs/output/Transitive3/externs.cbor b/tests/purs/docs/output/Transitive3/externs.cbor new file mode 100644 index 000000000..4e65b40b3 Binary files /dev/null and b/tests/purs/docs/output/Transitive3/externs.cbor differ diff --git a/tests/purs/docs/output/TypeClassWithoutMembers/docs.json b/tests/purs/docs/output/TypeClassWithoutMembers/docs.json new file mode 100644 index 000000000..a3fa17ce9 --- /dev/null +++ b/tests/purs/docs/output/TypeClassWithoutMembers/docs.json @@ -0,0 +1 @@ +{"comments":null,"declarations":[],"name":"TypeClassWithoutMembers","reExports":[]} \ No newline at end of file diff --git a/tests/purs/docs/output/TypeClassWithoutMembers/externs.cbor b/tests/purs/docs/output/TypeClassWithoutMembers/externs.cbor new file mode 100644 index 000000000..72e8d9ba0 Binary files /dev/null and b/tests/purs/docs/output/TypeClassWithoutMembers/externs.cbor differ diff --git a/tests/purs/docs/output/TypeClassWithoutMembersIntermediate/docs.json b/tests/purs/docs/output/TypeClassWithoutMembersIntermediate/docs.json new file mode 100644 index 000000000..91527f23e --- /dev/null +++ b/tests/purs/docs/output/TypeClassWithoutMembersIntermediate/docs.json @@ -0,0 +1 @@ +{"comments":null,"declarations":[],"name":"TypeClassWithoutMembersIntermediate","reExports":[]} \ No newline at end of file diff --git a/tests/purs/docs/output/TypeClassWithoutMembersIntermediate/externs.cbor b/tests/purs/docs/output/TypeClassWithoutMembersIntermediate/externs.cbor new file mode 100644 index 000000000..9510eb1e9 Binary files /dev/null and b/tests/purs/docs/output/TypeClassWithoutMembersIntermediate/externs.cbor differ diff --git a/tests/purs/docs/output/TypeSynonym/docs.json b/tests/purs/docs/output/TypeSynonym/docs.json new file mode 100644 index 000000000..30c14134c --- /dev/null +++ b/tests/purs/docs/output/TypeSynonym/docs.json @@ -0,0 +1 @@ +{"comments":null,"declarations":[{"children":[],"comments":null,"info":{"arguments":[],"declType":"typeSynonym","type":{"annotation":[],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}},"kind":null,"sourceSpan":{"end":[3,17],"name":"/home/gnumonik/code/work/purus/tests/purs/docs/src/TypeSynonym.purs","start":[3,1]},"title":"MyInt"}],"name":"TypeSynonym","reExports":[]} \ No newline at end of file diff --git a/tests/purs/docs/output/TypeSynonym/externs.cbor b/tests/purs/docs/output/TypeSynonym/externs.cbor new file mode 100644 index 000000000..82954073f Binary files /dev/null and b/tests/purs/docs/output/TypeSynonym/externs.cbor differ diff --git a/tests/purs/docs/output/UTF8/docs.json b/tests/purs/docs/output/UTF8/docs.json new file mode 100644 index 000000000..b030f0329 --- /dev/null +++ b/tests/purs/docs/output/UTF8/docs.json @@ -0,0 +1 @@ +{"comments":null,"declarations":[{"children":[],"comments":"üÜäÄ 😰\n","info":{"declType":"value","type":{"annotation":[],"contents":[["Prelude"],"Unit"],"tag":"TypeConstructor"}},"kind":null,"sourceSpan":{"end":[6,14],"name":"/home/gnumonik/code/work/purus/tests/purs/docs/src/UTF8.purs","start":[6,1]},"title":"thing"}],"name":"UTF8","reExports":[]} \ No newline at end of file diff --git a/tests/purs/docs/output/UTF8/externs.cbor b/tests/purs/docs/output/UTF8/externs.cbor new file mode 100644 index 000000000..e7106600d Binary files /dev/null and b/tests/purs/docs/output/UTF8/externs.cbor differ diff --git a/tests/purs/docs/output/Virtual/docs.json b/tests/purs/docs/output/Virtual/docs.json new file mode 100644 index 000000000..ddca12e24 --- /dev/null +++ b/tests/purs/docs/output/Virtual/docs.json @@ -0,0 +1 @@ +{"comments":null,"declarations":[],"name":"Virtual","reExports":[]} \ No newline at end of file diff --git a/tests/purs/docs/output/Virtual/externs.cbor b/tests/purs/docs/output/Virtual/externs.cbor new file mode 100644 index 000000000..9602050ca Binary files /dev/null and b/tests/purs/docs/output/Virtual/externs.cbor differ diff --git a/tests/purs/docs/output/package.json b/tests/purs/docs/output/package.json new file mode 100644 index 000000000..7c34deb58 --- /dev/null +++ b/tests/purs/docs/output/package.json @@ -0,0 +1 @@ +{"type":"module"} \ No newline at end of file diff --git a/tests/purs/failing/2379/Lib.purs b/tests/purs/failing/2379/Lib.purs index eb69e862a..986f9d383 100644 --- a/tests/purs/failing/2379/Lib.purs +++ b/tests/purs/failing/2379/Lib.purs @@ -5,5 +5,5 @@ class X a where class Y a -instance xArray :: Y a => X (Array a) where +instance xList :: Y a => X (List a) where x _ = "[]" diff --git a/tests/purs/failing/2534.purs b/tests/purs/failing/2534.purs index a4a4f2786..ba6ed07c1 100644 --- a/tests/purs/failing/2534.purs +++ b/tests/purs/failing/2534.purs @@ -1,8 +1,8 @@ -- @shouldFailWith InfiniteType module Main where -foo :: Array Int -> Int +foo :: List Int -> Int foo xs = go xs where - go :: Array _ -> Int + go :: List _ -> Int go [] = 0 go xs = go [xs] diff --git a/tests/purs/failing/2542.purs b/tests/purs/failing/2542.purs index 9c2b347ec..b4abd78ab 100644 --- a/tests/purs/failing/2542.purs +++ b/tests/purs/failing/2542.purs @@ -1,9 +1,9 @@ -- @shouldFailWith UndefinedTypeVariable module Main where -type T = forall a. Array a +type T = forall a. List a foo :: T foo = bar where - bar :: Array a + bar :: List a bar = [] diff --git a/tests/purs/failing/3275-BindingGroupErrorPos.purs b/tests/purs/failing/3275-BindingGroupErrorPos.purs index 171790645..9137fe683 100644 --- a/tests/purs/failing/3275-BindingGroupErrorPos.purs +++ b/tests/purs/failing/3275-BindingGroupErrorPos.purs @@ -6,7 +6,7 @@ module BindingGroupErrorPos where import Prelude -type Result = Array Int +type Result = List Int wrong :: Int -> Result String wrong n = wrong (n - 1) diff --git a/tests/purs/failing/3531-5.purs b/tests/purs/failing/3531-5.purs index 5c19ed374..2ca614bdf 100644 --- a/tests/purs/failing/3531-5.purs +++ b/tests/purs/failing/3531-5.purs @@ -6,7 +6,7 @@ data Proxy a = Proxy class C a b where c :: Proxy a -> Proxy b -> Boolean -instance C String (Array a) where +instance C String (List a) where c _ _ = true else instance c2 :: C String a where c _ _ = false diff --git a/tests/purs/failing/3531-6.purs b/tests/purs/failing/3531-6.purs index 204ef158a..229b94590 100644 --- a/tests/purs/failing/3531-6.purs +++ b/tests/purs/failing/3531-6.purs @@ -6,7 +6,7 @@ data Proxy a = Proxy class C a b where c :: Proxy a -> Proxy b -> Boolean -instance C String (Array a) where +instance C String (List a) where c _ _ = true else instance c2 :: C String a where c _ _ = false diff --git a/tests/purs/failing/4019-1.purs b/tests/purs/failing/4019-1.purs index 8b79a9908..ca783fba9 100644 --- a/tests/purs/failing/4019-1.purs +++ b/tests/purs/failing/4019-1.purs @@ -19,8 +19,8 @@ foreign import data K2 :: Type foreign import data D1 :: K1 foreign import data D2 :: K2 -foo :: Indexed Array D1 D2 Int +foo :: Indexed List D1 D2 Int foo = Indexed [1] -bar :: Indexed Array D1 D2 Int +bar :: Indexed List D1 D2 Int bar = imap identity foo diff --git a/tests/purs/failing/4019-2.purs b/tests/purs/failing/4019-2.purs index f30ea6128..d582885a5 100644 --- a/tests/purs/failing/4019-2.purs +++ b/tests/purs/failing/4019-2.purs @@ -19,8 +19,8 @@ foreign import data K2 :: Type foreign import data D1 :: K1 foreign import data D2 :: K2 -foo :: Indexed Array D1 D2 Int +foo :: Indexed List D1 D2 Int foo = Indexed [1] -bar :: Indexed Array D1 D2 Int -bar = imap identity (Indexed [1] :: Indexed Array D1 D2 Int) +bar :: Indexed List D1 D2 Int +bar = imap identity (Indexed [1] :: Indexed List D1 D2 Int) diff --git a/tests/purs/failing/4466.purs b/tests/purs/failing/4466.purs index 1c3d75db3..31daccbd0 100644 --- a/tests/purs/failing/4466.purs +++ b/tests/purs/failing/4466.purs @@ -3,14 +3,14 @@ module Main where import Prelude -import Data.Array as Array +import Data.List as List import Data.Maybe (Maybe(..)) data Sound = Moo | Quack | Bark type Animal = { sound :: Sound } -animalFunc :: Array Animal -> Unit +animalFunc :: List Animal -> Unit animalFunc animals - | Just { sound } <- animals # Array.find \{ sound: Moo } -> true = unit + | Just { sound } <- animals # List.find \{ sound: Moo } -> true = unit | otherwise = unit diff --git a/tests/purs/failing/Arrays.purs b/tests/purs/failing/Arrays.purs index cb0261663..1abaf1ab4 100644 --- a/tests/purs/failing/Arrays.purs +++ b/tests/purs/failing/Arrays.purs @@ -1,6 +1,6 @@ -- @shouldFailWith TypesDoNotUnify module Main where -foreign import ix :: forall a. Array a -> Int -> a +foreign import ix :: forall a. List a -> Int -> a test = \arr -> arr `ix` (0 `ix` 0) diff --git a/tests/purs/failing/CoercibleRepresentational2.purs b/tests/purs/failing/CoercibleRepresentational2.purs index e74d5a009..3d2c425f4 100644 --- a/tests/purs/failing/CoercibleRepresentational2.purs +++ b/tests/purs/failing/CoercibleRepresentational2.purs @@ -3,7 +3,7 @@ module Main where import Safe.Coerce (coerce) -data Arr1 a = Arr1 (Array a) +data Arr1 a = Arr1 (List a) arr1ToArr1 :: Arr1 Int -> Arr1 String arr1ToArr1 = coerce diff --git a/tests/purs/failing/FoldableInstance10.purs b/tests/purs/failing/FoldableInstance10.purs index c191a4d46..64f285a09 100644 --- a/tests/purs/failing/FoldableInstance10.purs +++ b/tests/purs/failing/FoldableInstance10.purs @@ -7,5 +7,5 @@ import Data.Foldable (class Foldable) foreign import data Variant :: Row Type -> Type -data Test a = Test (Variant (left :: a, right :: Array a)) +data Test a = Test (Variant (left :: a, right :: List a)) derive instance Foldable Test diff --git a/tests/purs/failing/NewtypeInstance6.purs b/tests/purs/failing/NewtypeInstance6.purs index 5833b1a38..d46e36141 100644 --- a/tests/purs/failing/NewtypeInstance6.purs +++ b/tests/purs/failing/NewtypeInstance6.purs @@ -3,6 +3,6 @@ module Main where import Prelude -newtype X a b = X (Array b) +newtype X a b = X (List b) derive newtype instance functorX :: Functor X diff --git a/tests/purs/failing/PASTrumpsKDNU1.purs b/tests/purs/failing/PASTrumpsKDNU1.purs index e12b642aa..108bc0107 100644 --- a/tests/purs/failing/PASTrumpsKDNU1.purs +++ b/tests/purs/failing/PASTrumpsKDNU1.purs @@ -11,5 +11,5 @@ import Prelude data Proxy :: forall k. k -> Type data Proxy a = Proxy -f :: forall a. Proxy (Show a => (~>) Array) +f :: forall a. Proxy (Show a => (~>) List) f = Proxy diff --git a/tests/purs/failing/PASTrumpsKDNU2.purs b/tests/purs/failing/PASTrumpsKDNU2.purs index 00fb71a69..a59d06a92 100644 --- a/tests/purs/failing/PASTrumpsKDNU2.purs +++ b/tests/purs/failing/PASTrumpsKDNU2.purs @@ -6,5 +6,5 @@ import Prelude data Proxy :: forall k. k -> Type data Proxy a = Proxy -f :: forall (a :: (~>) Array). Proxy a -> Proxy a +f :: forall (a :: (~>) List). Proxy a -> Proxy a f x = x diff --git a/tests/purs/failing/PASTrumpsKDNU3.purs b/tests/purs/failing/PASTrumpsKDNU3.purs index fddb4a547..f524c7b43 100644 --- a/tests/purs/failing/PASTrumpsKDNU3.purs +++ b/tests/purs/failing/PASTrumpsKDNU3.purs @@ -6,5 +6,5 @@ import Prelude data Proxy :: forall k. k -> Type data Proxy a = Proxy -p :: Proxy (forall a. (~>) Array) +p :: Proxy (forall a. (~>) List) p = Proxy diff --git a/tests/purs/failing/PASTrumpsKDNU4.purs b/tests/purs/failing/PASTrumpsKDNU4.purs index 13f9a0f2a..9923f7706 100644 --- a/tests/purs/failing/PASTrumpsKDNU4.purs +++ b/tests/purs/failing/PASTrumpsKDNU4.purs @@ -3,4 +3,4 @@ module Main where import Prelude -data D (a :: (~>) Array) = D +data D (a :: (~>) List) = D diff --git a/tests/purs/failing/PASTrumpsKDNU5.purs b/tests/purs/failing/PASTrumpsKDNU5.purs index 99bfa4ab4..39f80ac90 100644 --- a/tests/purs/failing/PASTrumpsKDNU5.purs +++ b/tests/purs/failing/PASTrumpsKDNU5.purs @@ -3,4 +3,4 @@ module Main where import Prelude -newtype N = N ((~>) Array) +newtype N = N ((~>) List) diff --git a/tests/purs/failing/PASTrumpsKDNU6.purs b/tests/purs/failing/PASTrumpsKDNU6.purs index 5bfb6a80e..0630d4e6b 100644 --- a/tests/purs/failing/PASTrumpsKDNU6.purs +++ b/tests/purs/failing/PASTrumpsKDNU6.purs @@ -3,4 +3,4 @@ module Main where import Prelude -type T (a :: (~>) Array) = Int +type T (a :: (~>) List) = Int diff --git a/tests/purs/failing/PASTrumpsKDNU7.purs b/tests/purs/failing/PASTrumpsKDNU7.purs index 434ed1140..2e83f09c4 100644 --- a/tests/purs/failing/PASTrumpsKDNU7.purs +++ b/tests/purs/failing/PASTrumpsKDNU7.purs @@ -3,4 +3,4 @@ module Main where import Prelude -class C (a :: (~>) Array) +class C (a :: (~>) List) diff --git a/tests/purs/failing/Superclasses5.purs b/tests/purs/failing/Superclasses5.purs index 5bbfae69e..6cd60e230 100644 --- a/tests/purs/failing/Superclasses5.purs +++ b/tests/purs/failing/Superclasses5.purs @@ -8,19 +8,19 @@ import Effect.Console (logShow) class Su a where su :: a -> a -class Su (Array a) <= Cl a where +class Su (List a) <= Cl a where cl :: a -> a -> a instance suNumber :: Su Number where su n = n + 1.0 -instance suArray :: Su a => Su (Array a) where +instance suList :: Su a => Su (List a) where su [x] = [su x] instance clNumber :: Cl Number where cl n m = n + m -test :: forall a. Cl a => a -> Array a +test :: forall a. Cl a => a -> List a test x = su [cl x x] main = logShow $ test 10.0 diff --git a/tests/purs/failing/TypeSynonyms.purs b/tests/purs/failing/TypeSynonyms.purs index 6afcde41e..dab10c805 100644 --- a/tests/purs/failing/TypeSynonyms.purs +++ b/tests/purs/failing/TypeSynonyms.purs @@ -3,6 +3,6 @@ module Main where import Prelude -type T1 = Array T2 +type T1 = List T2 type T2 = T1 diff --git a/tests/purs/failing/TypeSynonyms10.purs b/tests/purs/failing/TypeSynonyms10.purs index 85c490b0c..b03c3e19c 100644 --- a/tests/purs/failing/TypeSynonyms10.purs +++ b/tests/purs/failing/TypeSynonyms10.purs @@ -5,4 +5,4 @@ import Prelude type F (a :: Type) = a -newtype N = N (F ((~>) Array)) +newtype N = N (F ((~>) List)) diff --git a/tests/purs/failing/TypeSynonyms9.purs b/tests/purs/failing/TypeSynonyms9.purs index e80ce7871..a2c2b54d8 100644 --- a/tests/purs/failing/TypeSynonyms9.purs +++ b/tests/purs/failing/TypeSynonyms9.purs @@ -4,4 +4,4 @@ module Main where import Prelude newtype A (a :: (Type -> Type) -> Type -> Type) = A String -newtype B = B (A ((~>) Array)) +newtype B = B (A ((~>) List)) diff --git a/tests/purs/optimize/RecursiveInstances.purs b/tests/purs/optimize/RecursiveInstances.purs index 071960903..31153c6ae 100644 --- a/tests/purs/optimize/RecursiveInstances.purs +++ b/tests/purs/optimize/RecursiveInstances.purs @@ -8,7 +8,7 @@ import Type.Prelude (class IsSymbol, Proxy(..), reflectSymbol) class FindKeysAux :: forall k. RL.RowList k -> Constraint class FindKeysAux a where - findKeysAux :: Proxy a -> Array String + findKeysAux :: Proxy a -> List String instance FindKeysAux RL.Nil where findKeysAux _ = [] @@ -16,7 +16,7 @@ instance FindKeysAux RL.Nil where else instance (IsSymbol l, FindKeysAux r) => FindKeysAux (RL.Cons l t r) where findKeysAux _ = [ reflectSymbol (Proxy :: Proxy l) ] <> findKeysAux (Proxy :: Proxy r) -findKeys :: forall r rl. RL.RowToList r rl => FindKeysAux rl => Proxy r -> Array String +findKeys :: forall r rl. RL.RowToList r rl => FindKeysAux rl => Proxy r -> List String findKeys _ = findKeysAux (Proxy :: Proxy rl) findKeys1 = findKeys (Proxy :: Proxy (a :: Unit)) diff --git a/tests/purs/passing/1110.purs b/tests/purs/passing/1110.purs index 047adc046..0adb736fa 100644 --- a/tests/purs/passing/1110.purs +++ b/tests/purs/passing/1110.purs @@ -17,10 +17,10 @@ type Z t = forall x. t x -> (forall a. t a) -> t x class C t where c :: Z t -instance cA :: C Array where +instance cA :: C List where c x _ = x -test2 :: forall m. Monad m => m { ccc :: Z Array } -test2 = pure { ccc: (c :: Z Array) } +test2 :: forall m. Monad m => m { ccc :: Z List } +test2 = pure { ccc: (c :: Z List) } main = log "Done" diff --git a/tests/purs/passing/1991.purs b/tests/purs/passing/1991.purs index b98d2ea96..37ec2cf87 100644 --- a/tests/purs/passing/1991.purs +++ b/tests/purs/passing/1991.purs @@ -3,17 +3,17 @@ module Main where import Prelude import Effect.Console (log) -singleton :: forall a. a -> Array a +singleton :: forall a. a -> List a singleton x = [x] -empty :: forall a. Array a +empty :: forall a. List a empty = [] -foldMap :: forall a m. Semigroup m => (a -> m) -> Array a -> m +foldMap :: forall a m. Semigroup m => (a -> m) -> List a -> m foldMap f [a, b, c, d, e] = f a <> f b <> f c <> f d <> f e foldMap f xs = foldMap f xs -- spin, not used -regression :: Array Int +regression :: List Int regression = let as = [1,2,3,4,5] as' = foldMap (\x -> if 1 < x && x < 4 then singleton x else empty) as diff --git a/tests/purs/passing/2288.purs b/tests/purs/passing/2288.purs index cab96bd15..f9a990124 100644 --- a/tests/purs/passing/2288.purs +++ b/tests/purs/passing/2288.purs @@ -3,11 +3,11 @@ module Main where import Prelude import Effect import Effect.Console -import Data.Array -import Data.Array.Partial as P +import Data.List +import Data.List.Partial as P import Partial.Unsafe -length :: forall a. Array a -> Int +length :: forall a. List a -> Int length = go 0 where go acc arr = if null arr diff --git a/tests/purs/passing/2689.purs b/tests/purs/passing/2689.purs index 08e6851e3..e59841f06 100644 --- a/tests/purs/passing/2689.purs +++ b/tests/purs/passing/2689.purs @@ -2,7 +2,7 @@ module Main where import Prelude import Effect.Console -import Data.Array.Partial +import Data.List.Partial import Partial.Unsafe sumTCObug = go identity where @@ -17,7 +17,7 @@ sumTCObug' = go identity where go f 0 = f go f n = go (\a -> n + a) 0 -count :: forall a. (a -> Boolean) -> Array a -> Int +count :: forall a. (a -> Boolean) -> List a -> Int count p = count' 0 where count' acc [] = acc count' acc xs = diff --git a/tests/purs/passing/3114.purs b/tests/purs/passing/3114.purs index f49e7e6a3..266cd62a3 100644 --- a/tests/purs/passing/3114.purs +++ b/tests/purs/passing/3114.purs @@ -33,10 +33,10 @@ main = do -- without the type signature, this would complain about -- Could not match type - -- Array + -- List -- with type -- Tuple String - -- while trying to match the type FProxy Array + -- while trying to match the type FProxy List -- with type FProxy (Tuple String) -- while solving type class constraint -- Prim.RowCons "baz" diff --git a/tests/purs/passing/3125.purs b/tests/purs/passing/3125.purs index 152e86d01..45910dd08 100644 --- a/tests/purs/passing/3125.purs +++ b/tests/purs/passing/3125.purs @@ -12,5 +12,5 @@ memptyB = B l r where r _ = mempty main = do - logShow $ case (memptyB :: B (Int -> Array Unit)) of B l r -> l 0 == r 0 + logShow $ case (memptyB :: B (Int -> List Unit)) of B l r -> l 0 == r 0 log "Done" diff --git a/tests/purs/passing/4179.purs b/tests/purs/passing/4179.purs index 4d105ede5..b1a76f051 100644 --- a/tests/purs/passing/4179.purs +++ b/tests/purs/passing/4179.purs @@ -69,5 +69,5 @@ main = do assertEqual { actual: bravo, expected: 1 } runtimeImport "InitializationError" \err3 -> do - assertEqual { actual: err3, expected: Just "ReferenceError: alphaArray was needed before it finished initializing (module InitializationError, line 0)" } -- TODO: fix the 0 + assertEqual { actual: err3, expected: Just "ReferenceError: alphaList was needed before it finished initializing (module InitializationError, line 0)" } -- TODO: fix the 0 log "Done" diff --git a/tests/purs/passing/4179/InitializationError.purs b/tests/purs/passing/4179/InitializationError.purs index 0368b48ea..dfd9bd614 100644 --- a/tests/purs/passing/4179/InitializationError.purs +++ b/tests/purs/passing/4179/InitializationError.purs @@ -8,7 +8,7 @@ class Bravo a <= Charlie a charlieAlpha :: forall a. Charlie a => a Int -> a Int charlieAlpha = alpha -instance alphaArray :: Alpha Array where +instance alphaList :: Alpha List where alpha = charlieAlpha -instance Bravo Array -instance Charlie Array +instance Bravo List +instance Charlie List diff --git a/tests/purs/passing/4180.purs b/tests/purs/passing/4180.purs index aff735959..4a7e80f5c 100644 --- a/tests/purs/passing/4180.purs +++ b/tests/purs/passing/4180.purs @@ -5,7 +5,7 @@ import Effect.Console (log) class C (t :: Type) instance C (f a) -f :: C (Array String) => Int +f :: C (List String) => Int f = 0 v :: Int diff --git a/tests/purs/passing/Ado.purs b/tests/purs/passing/Ado.purs index 4bb1c5d61..b072a4933 100644 --- a/tests/purs/passing/Ado.purs +++ b/tests/purs/passing/Ado.purs @@ -64,7 +64,7 @@ test11 = \_ -> ado x <- pure 1 y <- pure "A" z <- pure [] - in show (x :: Int) <> y <> show (z :: Array Int) + in show (x :: Int) <> y <> show (z :: List Int) main = do r <- Ref.new "X" diff --git a/tests/purs/passing/ArrayType.purs b/tests/purs/passing/ArrayType.purs index b801b930e..02038960d 100644 --- a/tests/purs/passing/ArrayType.purs +++ b/tests/purs/passing/ArrayType.purs @@ -6,7 +6,7 @@ import Effect.Console (log) class Pointed p where point :: forall a. a -> p a -instance pointedArray :: Pointed Array where +instance pointedList :: Pointed List where point a = [a] main = log "Done" diff --git a/tests/purs/passing/BigFunction.purs b/tests/purs/passing/BigFunction.purs index b83642c4b..0c123f862 100644 --- a/tests/purs/passing/BigFunction.purs +++ b/tests/purs/passing/BigFunction.purs @@ -2,15 +2,15 @@ module Main where import Prelude import Data.Maybe -import Data.Array(index) +import Data.List(index) import Effect.Console(log) main = let x = f [] in log "Done" -lookup :: forall a. Int -> Array a -> Maybe a +lookup :: forall a. Int -> List a -> Maybe a lookup = flip index -f :: Array (Array Int) -> Int +f :: List (List Int) -> Int f [] = 0 f [m] | Just x <- lookup 1 m = x f [m, mm] | Just x <- lookup 1 m, Just xx <- lookup 11 mm = x + xx diff --git a/tests/purs/passing/BindersInFunctions.purs b/tests/purs/passing/BindersInFunctions.purs index d1fda599e..a6d925c81 100644 --- a/tests/purs/passing/BindersInFunctions.purs +++ b/tests/purs/passing/BindersInFunctions.purs @@ -6,7 +6,7 @@ import Test.Assert (assert') import Effect (Effect) import Effect.Console (log) -snd :: forall a. Partial => Array a -> a +snd :: forall a. Partial => List a -> a snd = \[_, y] -> y main :: Effect _ diff --git a/tests/purs/passing/CheckSynonymBug.purs b/tests/purs/passing/CheckSynonymBug.purs index 0a664d076..1884a45f7 100644 --- a/tests/purs/passing/CheckSynonymBug.purs +++ b/tests/purs/passing/CheckSynonymBug.purs @@ -3,10 +3,10 @@ module Main where import Prelude import Effect.Console (log) -length :: forall a. Array a -> Int +length :: forall a. List a -> Int length _ = 0 -type Foo a = Array a +type Foo a = List a foo _ = length ([] :: Foo Number) diff --git a/tests/purs/passing/Coercible.purs b/tests/purs/passing/Coercible.purs index 62e5507f9..043de8306 100644 --- a/tests/purs/passing/Coercible.purs +++ b/tests/purs/passing/Coercible.purs @@ -38,8 +38,8 @@ stringToNt1 = coerce toNT1 :: forall a. Coercible a String => a -> NTString1 toNT1 = coerce -toNT1Array :: forall a. Coercible a (Array String) => a -> Array NTString1 -toNT1Array = coerce +toNT1List :: forall a. Coercible a (List String) => a -> List NTString1 +toNT1List = coerce newtype NTString2 = NTString2 String @@ -200,7 +200,7 @@ rec8ToRec8 = coerce rec8ToRec8' :: forall r s. Coercible r s => Rec8 r Int -> Rec8 s (Id1 Int) rec8ToRec8' = coerce -data Arr1 a b = Arr1 (Array a) (Array b) +data Arr1 a b = Arr1 (List a) (List b) arr1ToArr1 :: Arr1 Int String -> Arr1 (Id1 Int) (Id2 String) arr1ToArr1 = coerce diff --git a/tests/purs/passing/ConstraintParsingIssue.purs b/tests/purs/passing/ConstraintParsingIssue.purs index 04ad2cdbf..1ef54f6fb 100644 --- a/tests/purs/passing/ConstraintParsingIssue.purs +++ b/tests/purs/passing/ConstraintParsingIssue.purs @@ -4,6 +4,6 @@ import Effect.Console class X a -instance x :: X (Array (Array a)) => X (Array a) +instance x :: X (List (List a)) => X (List a) main = log "Done" diff --git a/tests/purs/passing/DerivingBifunctor.purs b/tests/purs/passing/DerivingBifunctor.purs index e5f7fc86a..0fbff019b 100644 --- a/tests/purs/passing/DerivingBifunctor.purs +++ b/tests/purs/passing/DerivingBifunctor.purs @@ -11,11 +11,11 @@ import Effect.Console (log) data Test f a b = Test0 - | Test1 (Array a) b - | Test2 Int (forall a. Array a -> Array a) + | Test1 (List a) b + | Test2 Int (forall a. List a -> List a) | Test3 Int (f a b) (f a Int) (f Int b) - | Test4 (Array (Tuple a Int)) (Tuple b Int) - | Test5 { nested :: Array { x :: f { a :: a } { b :: b } } } + | Test4 (List (Tuple a Int)) (Tuple b Int) + | Test5 { nested :: List { x :: f { a :: a } { b :: b } } } derive instance Bifunctor f => Bifunctor (Test f) derive instance Bifoldable f => Bifoldable (Test f) derive instance Bitraversable f => Bitraversable (Test f) diff --git a/tests/purs/passing/DerivingContravariant.purs b/tests/purs/passing/DerivingContravariant.purs index 7816e5b31..065723dba 100644 --- a/tests/purs/passing/DerivingContravariant.purs +++ b/tests/purs/passing/DerivingContravariant.purs @@ -11,10 +11,10 @@ data Test f a = Test0 | Test1 (Predicate a) | Test2 (Predicate (Predicate (Predicate a))) - | Test3 Int (forall a. Array a -> Array a) + | Test3 Int (forall a. List a -> List a) | Test4 Int (f a) - | Test5 (Array (a -> Int)) (Tuple (Predicate a) Int) - | Test6 { nested :: Array { x :: f { a :: a } } } + | Test5 (List (a -> Int)) (Tuple (Predicate a) Int) + | Test6 { nested :: List { x :: f { a :: a } } } derive instance Contravariant f => Contravariant (Test f) main = log "Done" diff --git a/tests/purs/passing/DerivingFoldable.purs b/tests/purs/passing/DerivingFoldable.purs index 0b9461c66..ae133b671 100644 --- a/tests/purs/passing/DerivingFoldable.purs +++ b/tests/purs/passing/DerivingFoldable.purs @@ -9,26 +9,26 @@ import Test.Assert -- not their order in definition type RecordFields f a = { a :: a - , zArrayA :: Array a + , zListA :: List a , fa :: f a , ignore :: Int - , arrayIgnore :: Array Int + , arrayIgnore :: List Int , fIgnore :: f Int } data M f a = M0 - | M1 a (Array a) - | M2 Int (forall a. Array a -> Array a) + | M1 a (List a) + | M2 Int (forall a. List a -> List a) | M3 (f a) | M4 (RecordFields f a) | M5 { nested :: RecordFields f a } - | M6 Int a (Array Int) (Array a) (f a) (f Int) (RecordFields f a) { nested :: RecordFields f a } + | M6 Int a (List Int) (List a) (f a) (f Int) (RecordFields f a) { nested :: RecordFields f a } | M7 (f (f { nested :: RecordFields f a })) derive instance foldableM :: Foldable f => Foldable (M f) -type MArrStr = M Array String +type MArrStr = M List String foldlStr :: forall f. Foldable f => f String -> String foldlStr = foldl (\acc next -> acc <> "<" <> next) "Start" @@ -48,10 +48,10 @@ m5 = M5 { nested: recordValue } :: MArrStr m6 = M6 1 "a" [] ["b"] ["c"] [] recordValue { nested: recordValue } :: MArrStr m7 = M7 [[{ nested: recordValue }]] :: MArrStr -recordValue :: RecordFields Array String +recordValue :: RecordFields List String recordValue = { a: "a" - , zArrayA: ["c"] + , zListA: ["c"] , fa: ["b"] , ignore: 1 , arrayIgnore: [2, 3] diff --git a/tests/purs/passing/DerivingFunctor.purs b/tests/purs/passing/DerivingFunctor.purs index de40593ad..09ed57873 100644 --- a/tests/purs/passing/DerivingFunctor.purs +++ b/tests/purs/passing/DerivingFunctor.purs @@ -9,28 +9,28 @@ import Test.Assert type RecordFields f a = { a :: a - , zArrayA :: Array a + , zListA :: List a , fa :: f a , ignore :: Int - , recursiveA :: Array (Tuple Int (Array a)) - , arrayIgnore :: Array Int + , recursiveA :: List (Tuple Int (List a)) + , arrayIgnore :: List Int , fIgnore :: f Int , empty :: {} } data M f a - = M0 a (Array a) + = M0 a (List a) | M1 Int | M2 (f a) | M3 (RecordFields f a) | M4 { nested :: RecordFields f a } - | M5 Int a (Array Int) (Array a) (f a) (f Int) (RecordFields f a) { nested :: RecordFields f a } - | M6 (Array (Array (Array a))) + | M5 Int a (List Int) (List a) (f a) (f Int) (RecordFields f a) { nested :: RecordFields f a } + | M6 (List (List (List a))) derive instance eqM :: (Eq1 f, Eq a) => Eq (M f a) derive instance functorM :: Functor f => Functor (M f) -type MA = M Array +type MA = M List m0L = M0 0 [1, 2] :: MA Int m0R = M0 "0" ["1", "2"] :: MA String @@ -50,11 +50,11 @@ m4R = M4 { nested: recordValueR } :: MA String m5L = M5 0 1 [2, 3] [3, 4] [5, 6] [7, 8] recordValueL { nested: recordValueL } :: MA Int m5R = M5 0 "1" [2, 3] ["3", "4"] ["5", "6"] [7, 8] recordValueR { nested: recordValueR } :: MA String -recordValueL :: RecordFields Array Int -recordValueL = { a: 71, zArrayA: [72], fa: [73], ignore: 91, recursiveA: [ Tuple 1 [1], Tuple 2 [2] ], arrayIgnore: [92, 93], fIgnore: [94], empty: {} } +recordValueL :: RecordFields List Int +recordValueL = { a: 71, zListA: [72], fa: [73], ignore: 91, recursiveA: [ Tuple 1 [1], Tuple 2 [2] ], arrayIgnore: [92, 93], fIgnore: [94], empty: {} } -recordValueR :: RecordFields Array String -recordValueR = { a: "71", zArrayA: ["72"], fa: ["73"], ignore: 91, recursiveA: [ Tuple 1 ["1"], Tuple 2 ["2"] ], arrayIgnore: [92, 93], fIgnore: [94], empty: {} } +recordValueR :: RecordFields List String +recordValueR = { a: "71", zListA: ["72"], fa: ["73"], ignore: 91, recursiveA: [ Tuple 1 ["1"], Tuple 2 ["2"] ], arrayIgnore: [92, 93], fIgnore: [94], empty: {} } m6L = M6 [[[1, 2]]] :: MA Int m6R = M6 [[["1", "2"]]] :: MA String @@ -80,7 +80,7 @@ f1Test = do Fun1 left' = map fn $ Fun1 left left' 1 2 == right 1 2 -data Fun2 a = Fun2 (Int -> Int -> Array (Array a)) +data Fun2 a = Fun2 (Int -> Int -> List (List a)) derive instance Functor Fun2 f2Test = do @@ -92,7 +92,7 @@ f2Test = do Fun2 left' = map fn $ Fun2 left left' 1 2 == right 1 2 -data Fun3 f a = Fun3 (Unit -> Array (f (Array { nested :: RecordFields f a }))) +data Fun3 f a = Fun3 (Unit -> List (f (List { nested :: RecordFields f a }))) derive instance Functor f => Functor (Fun3 f) f3Test = do diff --git a/tests/purs/passing/DerivingFunctorFromBi.purs b/tests/purs/passing/DerivingFunctorFromBi.purs index f19bc3c91..9e883df25 100644 --- a/tests/purs/passing/DerivingFunctorFromBi.purs +++ b/tests/purs/passing/DerivingFunctorFromBi.purs @@ -9,8 +9,8 @@ import Effect.Console (log) data Test a = Test1 (Tuple a Int) - | Test2 (Tuple (Array a) a) - | Test3 { x :: Tuple { a :: a } Int, y :: Tuple { a :: Array a } { a :: a } } + | Test2 (Tuple (List a) a) + | Test3 { x :: Tuple { a :: a } Int, y :: Tuple { a :: List a } { a :: a } } derive instance Functor Test derive instance Foldable Test derive instance Traversable Test diff --git a/tests/purs/passing/DerivingFunctorFromPro.purs b/tests/purs/passing/DerivingFunctorFromPro.purs index dc038e9c0..6908a9edb 100644 --- a/tests/purs/passing/DerivingFunctorFromPro.purs +++ b/tests/purs/passing/DerivingFunctorFromPro.purs @@ -9,7 +9,7 @@ import Prelude import Effect.Console (log) data Test a - = Test1 ((Array a -> Int) -> Int) + = Test1 ((List a -> Int) -> Int) | Test2 { f :: ({ a :: a } -> Int) -> Int } derive instance Functor Test diff --git a/tests/purs/passing/DerivingProfunctor.purs b/tests/purs/passing/DerivingProfunctor.purs index b8a1cf95b..04db0dc1b 100644 --- a/tests/purs/passing/DerivingProfunctor.purs +++ b/tests/purs/passing/DerivingProfunctor.purs @@ -10,10 +10,10 @@ import Effect.Console (log) data Test f a b = Test0 | Test1 (Predicate a) b - | Test2 Int (forall a. Array a -> Array a) + | Test2 Int (forall a. List a -> List a) | Test3 Int (f a b) (f a Int) (f Int b) - | Test4 (Array (a -> Int)) (Tuple b Int) - | Test5 { nested :: Array { x :: f { a :: a } { b :: b } } } + | Test4 (List (a -> Int)) (Tuple b Int) + | Test5 { nested :: List { x :: f { a :: a } { b :: b } } } derive instance Profunctor f => Profunctor (Test f) main = log "Done" diff --git a/tests/purs/passing/DerivingTraversable.purs b/tests/purs/passing/DerivingTraversable.purs index c7ef3cb8a..8701f9e59 100644 --- a/tests/purs/passing/DerivingTraversable.purs +++ b/tests/purs/passing/DerivingTraversable.purs @@ -12,21 +12,21 @@ import Test.Assert -- not their order in definition type RecordFields f a = { a :: a - , zArrayA :: Array a + , zListA :: List a , fa :: f a , ignore :: Int - , arrayIgnore :: Array Int + , arrayIgnore :: List Int , fIgnore :: f Int } data M f a = M0 - | M1 a (Array a) + | M1 a (List a) | M2 Int | M3 (f a) | M4 (RecordFields f a) | M5 { nested :: RecordFields f a } - | M6 Int a (Array Int) (Array a) (f a) (f Int) (RecordFields f a) { nested :: RecordFields f a } + | M6 Int a (List Int) (List a) (f a) (f Int) (RecordFields f a) { nested :: RecordFields f a } | M7 (f (f { nested :: RecordFields f a })) -- Note: all 4 of these constraints are needed to compile this code @@ -40,12 +40,12 @@ derive instance Functor f => Functor (M f) derive instance Foldable f => Foldable (M f) derive instance Traversable f => Traversable (M f) -type MArrStr = M Array String +type MArrStr = M List String -traverseStr :: forall f. Traversable f => f String -> Array (f String) +traverseStr :: forall f. Traversable f => f String -> List (f String) traverseStr = traverse pure -sequenceStr :: forall f. Traversable f => f (Array String) -> Array (f String) +sequenceStr :: forall f. Traversable f => f (List String) -> List (f String) sequenceStr = sequence m0 = M0 :: MArrStr @@ -57,17 +57,17 @@ m5 = M5 { nested: recordValue } :: MArrStr m6 = M6 1 "a" [] ["b"] ["c"] [] recordValue { nested: recordValue } :: MArrStr m7 = M7 [ [ { nested: recordValue } ] ] :: MArrStr -recordValue :: RecordFields Array String +recordValue :: RecordFields List String recordValue = { a: "a" - , zArrayA: ["c"] + , zListA: ["c"] , fa: ["b"] , ignore: 1 , arrayIgnore: [2, 3] , fIgnore: [4] } -type MArrArrStr = M Array (Array String) +type MArrArrStr = M List (List String) m0' = M0 :: MArrArrStr m1' = M1 ["a"] [["b"], ["c"]] :: MArrArrStr @@ -78,10 +78,10 @@ m5' = M5 { nested: recordValue' } :: MArrArrStr m6' = M6 1 ["a"] [] [["b"]] [["c"]] [] recordValue' { nested: recordValue' } :: MArrArrStr m7' = M7 [ [ { nested: recordValue' } ] ] :: MArrArrStr -recordValue' :: RecordFields Array (Array String) +recordValue' :: RecordFields List (List String) recordValue' = { a: ["a"] - , zArrayA: [["c"]] + , zListA: [["c"]] , fa: [["b"]] , ignore: 1 , arrayIgnore: [2, 3] diff --git a/tests/purs/passing/EmptyDataDecls.purs b/tests/purs/passing/EmptyDataDecls.purs index a52c6005c..486e71348 100644 --- a/tests/purs/passing/EmptyDataDecls.purs +++ b/tests/purs/passing/EmptyDataDecls.purs @@ -7,14 +7,14 @@ import Effect.Console (log) data Z data S n -data ArrayBox n a = ArrayBox (Array a) +data ListBox n a = ListBox (List a) -nil :: forall a. ArrayBox Z a -nil = ArrayBox [] +nil :: forall a. ListBox Z a +nil = ListBox [] -cons' :: forall a n. a -> ArrayBox n a -> ArrayBox (S n) a -cons' x (ArrayBox xs) = ArrayBox $ append [x] xs +cons' :: forall a n. a -> ListBox n a -> ListBox (S n) a +cons' x (ListBox xs) = ListBox $ append [x] xs main = case cons' 1 $ cons' 2 $ cons' 3 nil of - ArrayBox [1, 2, 3] -> log "Done" + ListBox [1, 2, 3] -> log "Done" _ -> assert' "Failed" false diff --git a/tests/purs/passing/EmptyTypeClass.purs b/tests/purs/passing/EmptyTypeClass.purs index 2bb5cbc4f..870d89b2f 100644 --- a/tests/purs/passing/EmptyTypeClass.purs +++ b/tests/purs/passing/EmptyTypeClass.purs @@ -4,7 +4,7 @@ import Prelude import Effect import Effect.Console -head :: forall a. Partial => Array a -> a +head :: forall a. Partial => List a -> a head [x] = x main :: Effect _ diff --git a/tests/purs/passing/FunWithFunDeps.purs b/tests/purs/passing/FunWithFunDeps.purs index 7a3e90eff..2a3bfe653 100644 --- a/tests/purs/passing/FunWithFunDeps.purs +++ b/tests/purs/passing/FunWithFunDeps.purs @@ -32,7 +32,7 @@ foreign import fappendImpl :: forall l r o e. FVect l e -> FVect r e -> FVect o fflatten :: forall f s t o. NatMult f s o => FVect f (FVect s t) -> FVect o t fflatten = fflattenImpl foreign import fflattenImpl :: forall f s t o. FVect f (FVect s t) -> FVect o t -foreign import ftoArray :: forall n e. FVect n e -> Array e +foreign import ftoList :: forall n e. FVect n e -> List e -- should be able to figure these out fsingleton x = fcons x fnil diff --git a/tests/purs/passing/InstanceChain.purs b/tests/purs/passing/InstanceChain.purs index 7039afb1c..1222b5d97 100644 --- a/tests/purs/passing/InstanceChain.purs +++ b/tests/purs/passing/InstanceChain.purs @@ -17,10 +17,10 @@ argEg0 :: Proxy Int argEg0 = arg (Proxy :: Proxy Int) argEg1 :: Proxy Int -argEg1 = arg (Proxy :: Proxy (Array Int)) +argEg1 = arg (Proxy :: Proxy (List Int)) argEg2 :: Proxy Int -argEg2 = arg (Proxy :: Proxy (Boolean -> Array Int)) +argEg2 = arg (Proxy :: Proxy (Boolean -> List Int)) class IsEq l r o | l r -> o @@ -38,10 +38,10 @@ isEqEg0 :: Proxy True isEqEg0 = isEq (Proxy :: Proxy Int) (Proxy :: Proxy Int) isEqEg1 :: Proxy True -isEqEg1 = isEq (Proxy :: Proxy (Array Int)) (Proxy :: Proxy (Array Int)) +isEqEg1 = isEq (Proxy :: Proxy (List Int)) (Proxy :: Proxy (List Int)) isEqEg2 :: Proxy False -isEqEg2 = isEq (Proxy :: Proxy (Array Int)) (Proxy :: Proxy (Array Boolean)) +isEqEg2 = isEq (Proxy :: Proxy (List Int)) (Proxy :: Proxy (List Boolean)) -- example chain in which we should only commit to `isStringElse` once we've diff --git a/tests/purs/passing/InstanceNamesGenerated.purs b/tests/purs/passing/InstanceNamesGenerated.purs index 21e7981a9..1de36ef6b 100644 --- a/tests/purs/passing/InstanceNamesGenerated.purs +++ b/tests/purs/passing/InstanceNamesGenerated.purs @@ -43,7 +43,7 @@ class HigherKindedTypeParams :: (Type -> Type) -> (Type -> Type) -> Constraint class HigherKindedTypeParams f g where hktp :: f Int -> g Int -> Int -instance HigherKindedTypeParams Array (Either Int) where +instance HigherKindedTypeParams List (Either Int) where hktp _ _ = 0 @@ -51,9 +51,9 @@ class HigherKindedTypeParamsChain :: (Type -> Type) -> (Type -> Type) -> Constra class HigherKindedTypeParamsChain f g where hktpChain :: f Int -> g Int -> Int -instance HigherKindedTypeParamsChain Array (Either Int) where +instance HigherKindedTypeParamsChain List (Either Int) where hktpChain _ _ = 0 -else instance HigherKindedTypeParamsChain (Either Int) Array where +else instance HigherKindedTypeParamsChain (Either Int) List where hktpChain _ _ = 0 diff --git a/tests/purs/passing/KindedType.purs b/tests/purs/passing/KindedType.purs index 709c6a718..d550cff6c 100644 --- a/tests/purs/passing/KindedType.purs +++ b/tests/purs/passing/KindedType.purs @@ -7,7 +7,7 @@ type Star2Star f = f :: Type -> Type type Star t = t :: Type -test1 :: Star2Star Array String +test1 :: Star2Star List String test1 = ["test"] f :: Star (String -> String) @@ -17,12 +17,12 @@ test2 = f "test" data Proxy (f :: Type -> Type) = Proxy -test3 :: Proxy Array +test3 :: Proxy List test3 = Proxy type Test (f :: Type -> Type) = f String -test4 :: Test Array +test4 :: Test List test4 = ["test"] class Clazz (a :: Type) where diff --git a/tests/purs/passing/LetPattern.purs b/tests/purs/passing/LetPattern.purs index 799e22f54..c8ff9c0ce 100644 --- a/tests/purs/passing/LetPattern.purs +++ b/tests/purs/passing/LetPattern.purs @@ -54,14 +54,14 @@ patternDoDataIgnored = do let Y _ x _ = Y 789 "world, hello" true pure $ x == "world, hello" -patternArray :: Boolean -patternArray = unsafePartial $ +patternList :: Boolean +patternList = unsafePartial $ let [a, b] = [1, 2] in a == 1 && b == 2 -patternDoArray :: Effect Boolean -patternDoArray = unsafePartial do +patternDoList :: Effect Boolean +patternDoList = unsafePartial do let [a, b] = [1, 2] pure $ a == 1 && b == 2 @@ -181,8 +181,8 @@ main = do assert' "constructor pattern with ignorances" patternDataIgnored assert' "constructor pattern (data) with do" =<< patternDoData assert' "constructor pattern with ignorances and do" =<< patternDoDataIgnored - assert' "array pattern" patternArray - assert' "array pattern with do" =<< patternDoArray + assert' "array pattern" patternList + assert' "array pattern with do" =<< patternDoList assert' "multiple patterns" patternMultiple assert' "multiple patterns with do" =<< patternDoMultiple assert' "multiple patterns with normal let's" patternMultipleWithNormal diff --git a/tests/purs/passing/NewtypeInstance.purs b/tests/purs/passing/NewtypeInstance.purs index d2a1b333f..90d71ebfa 100644 --- a/tests/purs/passing/NewtypeInstance.purs +++ b/tests/purs/passing/NewtypeInstance.purs @@ -14,26 +14,26 @@ derive newtype instance showX :: Show X derive newtype instance eqX :: Eq X derive newtype instance ordX :: Ord X -newtype Y a = Y (Array a) +newtype Y a = Y (List a) derive newtype instance showY :: Show (Y String) class Singleton a b where singleton :: a -> b -instance singletonArray :: Singleton a (Array a) where +instance singletonList :: Singleton a (List a) where singleton x = [x] derive newtype instance singletonY :: Singleton a (Y a) -newtype MyArray a = MyArray (Array a) +newtype MyList a = MyList (List a) -derive newtype instance showMyArray :: Show a => Show (MyArray a) -derive newtype instance functorMyArray :: Functor MyArray +derive newtype instance showMyList :: Show a => Show (MyList a) +derive newtype instance functorMyList :: Functor MyList -newtype ProxyArray x a = ProxyArray (Array a) +newtype ProxyList x a = ProxyList (List a) -derive newtype instance functorProxyArray :: Functor (ProxyArray x) +derive newtype instance functorProxyList :: Functor (ProxyList x) class (Monad m, Monoid w) <= MonadWriter w m | m -> w where tell :: w -> m Unit @@ -51,7 +51,7 @@ derive newtype instance monadMyWriter :: Monoid w => Monad (MyWriter w) derive newtype instance monadWriterMyWriter :: Monoid w => MonadWriter w (MyWriter w) type Syn' w a = MyWriter w a -newtype Syn a = Syn (Syn' (MyArray Int) a) +newtype Syn a = Syn (Syn' (MyList Int) a) derive newtype instance functorSyn :: Functor Syn data Proxy2 a b = Proxy2 @@ -64,5 +64,5 @@ derive newtype instance Functor Foo main = do logShow (X "test") logShow (singleton "test" :: Y String) - logShow (map show (MyArray [1, 2, 3])) + logShow (map show (MyList [1, 2, 3])) log "Done" diff --git a/tests/purs/passing/Operators.purs b/tests/purs/passing/Operators.purs index bcb3c1130..f3e0cb706 100644 --- a/tests/purs/passing/Operators.purs +++ b/tests/purs/passing/Operators.purs @@ -49,7 +49,7 @@ test9 = Other.foo @@ "Hello World" test10 = "Hello" `Other.baz` "World" -op5 :: forall a. Array a -> Array a -> Array a +op5 :: forall a. List a -> List a -> List a op5 = \as -> \bs -> as infix 4 op5 as ... diff --git a/tests/purs/passing/ParensInTypedBinder.purs b/tests/purs/passing/ParensInTypedBinder.purs index 43573f118..283a7ca33 100644 --- a/tests/purs/passing/ParensInTypedBinder.purs +++ b/tests/purs/passing/ParensInTypedBinder.purs @@ -4,10 +4,10 @@ import Prelude import Effect (Effect) import Effect.Console (log) -foo :: Array Int +foo :: List Int foo = do - xss :: Array (Array Int) <- [[[1,2,3], [4, 5]], [[6]]] - xs :: Array Int <- xss + xss :: List (List Int) <- [[[1,2,3], [4, 5]], [[6]]] + xs :: List Int <- xss xs main :: Effect Unit diff --git a/tests/purs/passing/Patterns.purs b/tests/purs/passing/Patterns.purs index 91289794c..c4e888f4f 100644 --- a/tests/purs/passing/Patterns.purs +++ b/tests/purs/passing/Patterns.purs @@ -16,7 +16,7 @@ h = \o -> case o of a@[_,_,_] -> a _ -> [] -isDesc :: Array Number -> Boolean +isDesc :: List Number -> Boolean isDesc [x, y] | x > y = true isDesc _ = false diff --git a/tests/purs/passing/TCO.purs b/tests/purs/passing/TCO.purs index d1a1fa983..d2cce7d66 100644 --- a/tests/purs/passing/TCO.purs +++ b/tests/purs/passing/TCO.purs @@ -3,7 +3,7 @@ module Main where import Prelude import Effect.Console (log, logShow) import Control.Monad.Rec.Class -import Data.Array ((..), span, length) +import Data.List ((..), span, length) main = do let f x = x + 1 @@ -14,8 +14,8 @@ main = do logShow (applyN 3 f v) logShow (applyN 4 f v) - let largeArray = 1..10000 - logShow (length (span (\_ -> true) largeArray).init) + let largeList = 1..10000 + logShow (length (span (\_ -> true) largeList).init) logShow (tailRec (\n -> if n < 10000 then Loop (n + 1) else Done 42) 0) diff --git a/tests/purs/passing/TypeSynonymInData.purs b/tests/purs/passing/TypeSynonymInData.purs index a003f1ffb..cf77c4b4b 100644 --- a/tests/purs/passing/TypeSynonymInData.purs +++ b/tests/purs/passing/TypeSynonymInData.purs @@ -3,7 +3,7 @@ module Main where import Prelude import Effect.Console (log) -type A a = Array a +type A a = List a data Foo a = Foo (A a) | Bar diff --git a/tests/purs/passing/TypeSynonyms.purs b/tests/purs/passing/TypeSynonyms.purs index d8567b992..36da1572a 100644 --- a/tests/purs/passing/TypeSynonyms.purs +++ b/tests/purs/passing/TypeSynonyms.purs @@ -25,6 +25,6 @@ fst = test1 :: forall a b c. Lens (Pair (Pair a b) c) a test1 = composeLenses fst fst -newtype N = N (Array ~> Array) +newtype N = N (List ~> List) main = log "Done" diff --git a/tests/purs/passing/VTAsClassHeads.purs b/tests/purs/passing/VTAsClassHeads.purs index a25d7c456..c6b314cac 100644 --- a/tests/purs/passing/VTAsClassHeads.purs +++ b/tests/purs/passing/VTAsClassHeads.purs @@ -1,8 +1,8 @@ module Main where import Prelude -import Data.Array as Array -import Data.Array.NonEmpty as NEA +import Data.List as List +import Data.List.NonEmpty as NEA import Data.Maybe (Maybe(..)) import Data.Either (Either(..), either) import Data.Foldable (traverse_) @@ -189,8 +189,8 @@ main = do , multiWithBidiFDsRightWorks , mainClassWorks ] - case NEA.fromArray $ Array.catMaybes arr' of + case NEA.fromList $ List.catMaybes arr' of Just errs -> - log $ "Errors..." <> (Array.intercalate "\n" $ NEA.toArray errs) + log $ "Errors..." <> (List.intercalate "\n" $ NEA.toList errs) Nothing -> log "Done" diff --git a/tests/purs/psci/BasicEval.purs b/tests/purs/psci/BasicEval.purs index 1a909cd41..d2d31e2a8 100644 --- a/tests/purs/psci/BasicEval.purs +++ b/tests/purs/psci/BasicEval.purs @@ -1,5 +1,5 @@ import Prelude -import Data.Array +import Data.List -- @shouldEvaluateTo 3628800 let fac n = foldl mul 1 (1..n) in fac 10 diff --git a/tests/purs/psci/Multiline.purs b/tests/purs/psci/Multiline.purs index aa023827b..b2ad7d464 100644 --- a/tests/purs/psci/Multiline.purs +++ b/tests/purs/psci/Multiline.purs @@ -1,6 +1,6 @@ -- @paste import Prelude -import Data.Array +import Data.List -- @paste -- @paste diff --git a/tests/purs/publish/basic-example/output/Data.Boolean/docs.json b/tests/purs/publish/basic-example/output/Data.Boolean/docs.json new file mode 100644 index 000000000..4b9dac24f --- /dev/null +++ b/tests/purs/publish/basic-example/output/Data.Boolean/docs.json @@ -0,0 +1 @@ +{"comments":null,"declarations":[{"children":[],"comments":"An alias for `true`, which can be useful in guard clauses:\n\n```purescript\nmax x y | x >= y = x\n | otherwise = y\n```\n","info":{"declType":"value","type":{"annotation":[],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}},"kind":null,"sourceSpan":{"end":[9,21],"name":"../../../support/bower_components/purescript-prelude/src/Data/Boolean.purs","start":[9,1]},"title":"otherwise"}],"name":"Data.Boolean","reExports":[]} \ No newline at end of file diff --git a/tests/purs/publish/basic-example/output/Data.Boolean/externs.cbor b/tests/purs/publish/basic-example/output/Data.Boolean/externs.cbor new file mode 100644 index 000000000..bb86c4eb0 Binary files /dev/null and b/tests/purs/publish/basic-example/output/Data.Boolean/externs.cbor differ diff --git a/tests/purs/publish/basic-example/output/Data.NaturalTransformation/docs.json b/tests/purs/publish/basic-example/output/Data.NaturalTransformation/docs.json new file mode 100644 index 000000000..1a0d63b1f --- /dev/null +++ b/tests/purs/publish/basic-example/output/Data.NaturalTransformation/docs.json @@ -0,0 +1 @@ +{"comments":null,"declarations":[{"children":[],"comments":"A type for natural transformations.\n\nA natural transformation is a mapping between type constructors of kind\n`k -> Type`, for any kind `k`, where the mapping operation has no ability\nto manipulate the inner values.\n\nAn example of this is the `fromFoldable` function provided in\n`purescript-lists`, where some foldable structure containing values of\ntype `a` is converted into a `List a`.\n\nThe definition of a natural transformation in category theory states that\n`f` and `g` should be functors, but the `Functor` constraint is not\nenforced here; that the types are of kind `k -> Type` is enough for our\npurposes.\n","info":{"arguments":[["f",null],["g",null]],"declType":"typeSynonym","type":{"annotation":[],"contents":{"identifier":"a","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":"f","tag":"TypeVar"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":"g","tag":"TypeVar"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"kind":{"keyword":"type","kind":{"annotation":[],"contents":{"identifier":"k","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"k","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"tag":"ParensInType"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"k","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"tag":"ParensInType"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"sourceSpan":{"end":[18,54],"name":"../../../support/bower_components/purescript-prelude/src/Data/NaturalTransformation.purs","start":[18,1]},"title":"NaturalTransformation"},{"children":[],"comments":null,"info":{"alias":[["Data","NaturalTransformation"],{"Left":"NaturalTransformation"}],"declType":"alias","fixity":{"associativity":"infixr","precedence":4}},"kind":null,"sourceSpan":{"end":[20,42],"name":"../../../support/bower_components/purescript-prelude/src/Data/NaturalTransformation.purs","start":[20,1]},"title":"type (~>)"}],"name":"Data.NaturalTransformation","reExports":[]} \ No newline at end of file diff --git a/tests/purs/publish/basic-example/output/Data.NaturalTransformation/externs.cbor b/tests/purs/publish/basic-example/output/Data.NaturalTransformation/externs.cbor new file mode 100644 index 000000000..9f7bc8598 Binary files /dev/null and b/tests/purs/publish/basic-example/output/Data.NaturalTransformation/externs.cbor differ diff --git a/tests/purs/publish/basic-example/output/Data.Symbol/docs.json b/tests/purs/publish/basic-example/output/Data.Symbol/docs.json new file mode 100644 index 000000000..897b7f059 --- /dev/null +++ b/tests/purs/publish/basic-example/output/Data.Symbol/docs.json @@ -0,0 +1 @@ +{"comments":null,"declarations":[{"children":[{"comments":null,"info":{"declType":"typeClassMember","type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Type","Proxy"],"Proxy"],"tag":"TypeConstructor"},{"annotation":[],"contents":"sym","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim"],"String"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[11,39],"name":"../../../support/bower_components/purescript-prelude/src/Data/Symbol.purs","start":[11,3]},"title":"reflectSymbol"}],"comments":"A class for known symbols\n","info":{"arguments":[["sym",{"annotation":[],"contents":[["Prim"],"Symbol"],"tag":"TypeConstructor"}]],"declType":"typeClass","fundeps":[],"superclasses":[]},"kind":{"keyword":"class","kind":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Symbol"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim"],"Constraint"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[11,39],"name":"../../../support/bower_components/purescript-prelude/src/Data/Symbol.purs","start":[10,1]},"title":"IsSymbol"},{"children":[],"comments":null,"info":{"declType":"value","type":{"annotation":[],"contents":{"identifier":"r","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"String"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":{"annotation":[],"contents":{"identifier":"sym","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"sym","tag":"TypeVar"}],"constraintClass":[["Data","Symbol"],"IsSymbol"],"constraintData":null,"constraintKindArgs":[]},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Type","Proxy"],"Proxy"],"tag":"TypeConstructor"},{"annotation":[],"contents":"sym","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":"r","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"ConstrainedType"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"tag":"ParensInType"}],"tag":"TypeApp"},{"annotation":[],"contents":"r","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"kind":null,"sourceSpan":{"end":[16,85],"name":"../../../support/bower_components/purescript-prelude/src/Data/Symbol.purs","start":[16,1]},"title":"reifySymbol"}],"name":"Data.Symbol","reExports":[]} \ No newline at end of file diff --git a/tests/purs/publish/basic-example/output/Data.Symbol/externs.cbor b/tests/purs/publish/basic-example/output/Data.Symbol/externs.cbor new file mode 100644 index 000000000..492076dc7 Binary files /dev/null and b/tests/purs/publish/basic-example/output/Data.Symbol/externs.cbor differ diff --git a/tests/purs/publish/basic-example/output/Data.Unit/docs.json b/tests/purs/publish/basic-example/output/Data.Unit/docs.json new file mode 100644 index 000000000..0298cd858 --- /dev/null +++ b/tests/purs/publish/basic-example/output/Data.Unit/docs.json @@ -0,0 +1 @@ +{"comments":null,"declarations":[{"children":[],"comments":"The `Unit` type has a single inhabitant, called `unit`. It represents\nvalues with no computational content.\n\n`Unit` is often used, wrapped in a monadic type constructor, as the\nreturn type of a computation where only the _effects_ are important.\n\nWhen returning a value of type `Unit` from an FFI function, it is\nrecommended to use `undefined`, or not return a value at all.\n","info":{"dataDeclType":"data","declType":"data","roles":[],"typeArguments":[]},"kind":null,"sourceSpan":{"end":[11,33],"name":"../../../support/bower_components/purescript-prelude/src/Data/Unit.purs","start":[11,1]},"title":"Unit"},{"children":[],"comments":"`unit` is the sole inhabitant of the `Unit` type.\n","info":{"declType":"value","type":{"annotation":[],"contents":[["Data","Unit"],"Unit"],"tag":"TypeConstructor"}},"kind":null,"sourceSpan":{"end":[14,28],"name":"../../../support/bower_components/purescript-prelude/src/Data/Unit.purs","start":[14,1]},"title":"unit"}],"name":"Data.Unit","reExports":[]} \ No newline at end of file diff --git a/tests/purs/publish/basic-example/output/Data.Unit/externs.cbor b/tests/purs/publish/basic-example/output/Data.Unit/externs.cbor new file mode 100644 index 000000000..4df11d7e6 Binary files /dev/null and b/tests/purs/publish/basic-example/output/Data.Unit/externs.cbor differ diff --git a/tests/purs/publish/basic-example/output/Data.Void/docs.json b/tests/purs/publish/basic-example/output/Data.Void/docs.json new file mode 100644 index 000000000..cb068053e --- /dev/null +++ b/tests/purs/publish/basic-example/output/Data.Void/docs.json @@ -0,0 +1 @@ +{"comments":null,"declarations":[{"children":[],"comments":"An uninhabited data type. In other words, one can never create\na runtime value of type `Void` because no such value exists.\n\n`Void` is useful to eliminate the possibility of a value being created.\nFor example, a value of type `Either Void Boolean` can never have\na Left value created in PureScript.\n\nThis should not be confused with the keyword `void` that commonly appears in\nC-family languages, such as Java:\n```\npublic class Foo {\n void doSomething() { System.out.println(\"hello world!\"); }\n}\n```\n\nIn PureScript, one often uses `Unit` to achieve similar effects as\nthe `void` of C-family languages above.\n","info":{"dataDeclType":"newtype","declType":"data","roles":[],"typeArguments":[]},"kind":null,"sourceSpan":{"end":[20,25],"name":"../../../support/bower_components/purescript-prelude/src/Data/Void.purs","start":[20,1]},"title":"Void"},{"children":[],"comments":"Eliminator for the `Void` type.\nUseful for stating that some code branch is impossible because you've\n\"acquired\" a value of type `Void` (which you can't).\n\n```purescript\nrightOnly :: forall t . Either Void t -> t\nrightOnly (Left v) = absurd v\nrightOnly (Right t) = t\n```\n","info":{"declType":"value","type":{"annotation":[],"contents":{"identifier":"a","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Data","Void"],"Void"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"kind":null,"sourceSpan":{"end":[31,30],"name":"../../../support/bower_components/purescript-prelude/src/Data/Void.purs","start":[31,1]},"title":"absurd"}],"name":"Data.Void","reExports":[]} \ No newline at end of file diff --git a/tests/purs/publish/basic-example/output/Data.Void/externs.cbor b/tests/purs/publish/basic-example/output/Data.Void/externs.cbor new file mode 100644 index 000000000..0e5571ef9 Binary files /dev/null and b/tests/purs/publish/basic-example/output/Data.Void/externs.cbor differ diff --git a/tests/purs/publish/basic-example/output/Prim.Boolean/docs.json b/tests/purs/publish/basic-example/output/Prim.Boolean/docs.json new file mode 100644 index 000000000..c98a89d5d --- /dev/null +++ b/tests/purs/publish/basic-example/output/Prim.Boolean/docs.json @@ -0,0 +1 @@ +{"comments":"The Prim.Boolean module is embedded in the PureScript compiler. Unlike `Prim`, it is not imported implicitly. It contains a type level `Boolean` data structure.","declarations":[{"children":[],"comments":"The 'True' boolean type.\n","info":{"declType":"externData","kind":{"annotation":[],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"},"roles":[]},"kind":null,"sourceSpan":null,"title":"True"},{"children":[],"comments":"The 'False' boolean type.\n","info":{"declType":"externData","kind":{"annotation":[],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"},"roles":[]},"kind":null,"sourceSpan":null,"title":"False"}],"name":"Prim.Boolean","reExports":[]} \ No newline at end of file diff --git a/tests/purs/publish/basic-example/output/Prim.Coerce/docs.json b/tests/purs/publish/basic-example/output/Prim.Coerce/docs.json new file mode 100644 index 000000000..b05ecf299 --- /dev/null +++ b/tests/purs/publish/basic-example/output/Prim.Coerce/docs.json @@ -0,0 +1 @@ +{"comments":"The Prim.Coerce module is embedded in the PureScript compiler. Unlike `Prim`, it is not imported implicitly. It contains an automatically solved type class for coercing types that have provably-identical runtime representations with [purescript-safe-coerce](https://pursuit.purescript.org/packages/purescript-safe-coerce).","declarations":[{"children":[],"comments":"Coercible is a two-parameter type class that has instances for types `a`\nand `b` if the compiler can infer that they have the same representation.\nCoercible constraints are solved according to the following rules:\n\n* _reflexivity_, any type has the same representation as itself:\n`Coercible a a` holds.\n\n* _symmetry_, if a type `a` can be coerced to some other type `b`, then `b`\ncan also be coerced back to `a`: `Coercible a b` implies `Coercible b a`.\n\n* _transitivity_, if a type `a` can be coerced to some other type `b` which\ncan be coerced to some other type `c`, then `a` can also be coerced to `c`:\n`Coercible a b` and `Coercible b c` imply `Coercible a c`.\n\n* Newtypes can be freely wrapped and unwrapped when their constructor is\nin scope:\n\n newtype Age = Age Int\n\n`Coercible Int Age` and `Coercible Age Int` hold since `Age` has the same\nruntime representation than `Int`.\n\nNewtype constructors have to be in scope to preserve abstraction. It's\ncommon to declare a newtype to encode some invariants (non emptiness of\narrays with `Data.Array.NonEmpty.NonEmptyArray` for example), hide its\nconstructor and export smart constructors instead. Without this restriction,\nthe guarantees provided by such newtypes would be void.\n\n* If none of the above are applicable, two types of kind `Type` may be\ncoercible, but only if their heads are the same. For example,\n`Coercible (Maybe a) (Either a b)` does not hold because `Maybe` and\n`Either` are different. Those types don't share a common runtime\nrepresentation so coercing between them would be unsafe. In addition their\narguments may need to be identical or coercible, depending on the _roles_\nof the head's type parameters. Roles are documented in [the PureScript\nlanguage reference](https://github.com/purescript/documentation/blob/master/language/Roles.md).\n\nCoercible being polykinded, we can also coerce more than types of kind `Type`:\n\n* Rows are coercible when they have the same labels, when the corresponding\npairs of types are coercible and when their tails are coercible:\n`Coercible ( label :: a | r ) ( label :: b | s )` holds when\n`Coercible a b` and `Coercible r s` do. Closed rows cannot be coerced to\nopen rows.\n\n* Higher kinded types are coercible if they are coercible when fully\nsaturated: `Coercible (f :: _ -> Type) (g :: _ -> Type)` holds when\n`Coercible (f a) (g a)` does.\n\nThis rule may seem puzzling since there is no term of type `_ -> Type` to\napply `coerce` to, but it is necessary when coercing types with higher\nkinded parameters.\n","info":{"arguments":[["a",{"annotation":[],"contents":"k","tag":"TypeVar"}],["b",{"annotation":[],"contents":"k","tag":"TypeVar"}]],"declType":"typeClass","fundeps":[],"superclasses":[]},"kind":null,"sourceSpan":null,"title":"Coercible"}],"name":"Prim.Coerce","reExports":[]} \ No newline at end of file diff --git a/tests/purs/publish/basic-example/output/Prim.Int/docs.json b/tests/purs/publish/basic-example/output/Prim.Int/docs.json new file mode 100644 index 000000000..ddd7dbd32 --- /dev/null +++ b/tests/purs/publish/basic-example/output/Prim.Int/docs.json @@ -0,0 +1 @@ +{"comments":"The Prim.Int module is embedded in the PureScript compiler. Unlike `Prim`, it is not imported implicitly. It contains automatically solved type classes for working with type-level intural numbers.","declarations":[{"children":[],"comments":"Compiler solved type class for adding type-level `Int`s.\n","info":{"arguments":[["left",{"annotation":[],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],["right",{"annotation":[],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],["sum",{"annotation":[],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}]],"declType":"typeClass","fundeps":[[["left","right"],["sum"]],[["left","sum"],["right"]],[["right","sum"],["left"]]],"superclasses":[]},"kind":null,"sourceSpan":null,"title":"Add"},{"children":[],"comments":"Compiler solved type class for comparing two type-level `Int`s.\nProduces an `Ordering`.\n","info":{"arguments":[["left",{"annotation":[],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],["right",{"annotation":[],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],["ordering",{"annotation":[],"contents":[["Prim","Ordering"],"Ordering"],"tag":"TypeConstructor"}]],"declType":"typeClass","fundeps":[[["left","right"],["ordering"]]],"superclasses":[]},"kind":null,"sourceSpan":null,"title":"Compare"},{"children":[],"comments":"Compiler solved type class for multiplying type-level `Int`s.\n","info":{"arguments":[["left",{"annotation":[],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],["right",{"annotation":[],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],["product",{"annotation":[],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}]],"declType":"typeClass","fundeps":[[["left","right"],["product"]]],"superclasses":[]},"kind":null,"sourceSpan":null,"title":"Mul"},{"children":[],"comments":"Compiler solved type class for converting a type-level `Int` into a type-level `String` (i.e. `Symbol`).\n","info":{"arguments":[["int",{"annotation":[],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],["string",{"annotation":[],"contents":[["Prim"],"Symbol"],"tag":"TypeConstructor"}]],"declType":"typeClass","fundeps":[[["int"],["string"]]],"superclasses":[]},"kind":null,"sourceSpan":null,"title":"ToString"}],"name":"Prim.Int","reExports":[]} \ No newline at end of file diff --git a/tests/purs/publish/basic-example/output/Prim.Ordering/docs.json b/tests/purs/publish/basic-example/output/Prim.Ordering/docs.json new file mode 100644 index 000000000..48e6b141f --- /dev/null +++ b/tests/purs/publish/basic-example/output/Prim.Ordering/docs.json @@ -0,0 +1 @@ +{"comments":"The Prim.Ordering module is embedded in the PureScript compiler. Unlike `Prim`, it is not imported implicitly. It contains a type level `Ordering` data structure.","declarations":[{"children":[],"comments":"The `Ordering` kind represents the three possibilities of comparing two\ntypes of the same kind: `LT` (less than), `EQ` (equal to), and\n`GT` (greater than).\n","info":{"declType":"externData","kind":{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"roles":[]},"kind":null,"sourceSpan":null,"title":"Ordering"},{"children":[],"comments":"The 'less than' ordering type.\n","info":{"declType":"externData","kind":{"annotation":[],"contents":[["Prim","Ordering"],"Ordering"],"tag":"TypeConstructor"},"roles":[]},"kind":null,"sourceSpan":null,"title":"LT"},{"children":[],"comments":"The 'equal to' ordering type.\n","info":{"declType":"externData","kind":{"annotation":[],"contents":[["Prim","Ordering"],"Ordering"],"tag":"TypeConstructor"},"roles":[]},"kind":null,"sourceSpan":null,"title":"EQ"},{"children":[],"comments":"The 'greater than' ordering type.\n","info":{"declType":"externData","kind":{"annotation":[],"contents":[["Prim","Ordering"],"Ordering"],"tag":"TypeConstructor"},"roles":[]},"kind":null,"sourceSpan":null,"title":"GT"}],"name":"Prim.Ordering","reExports":[]} \ No newline at end of file diff --git a/tests/purs/publish/basic-example/output/Prim.Row/docs.json b/tests/purs/publish/basic-example/output/Prim.Row/docs.json new file mode 100644 index 000000000..081b2d363 --- /dev/null +++ b/tests/purs/publish/basic-example/output/Prim.Row/docs.json @@ -0,0 +1 @@ +{"comments":"The Prim.Row module is embedded in the PureScript compiler. Unlike `Prim`, it is not imported implicitly. It contains automatically solved type classes for working with row types.","declarations":[{"children":[],"comments":"The Union type class is used to compute the union of two rows of types\n(left-biased, including duplicates).\n\nThe third type argument represents the union of the first two.\n","info":{"arguments":[["left",{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Row"],"tag":"TypeConstructor"},{"annotation":[],"contents":"k","tag":"TypeVar"}],"tag":"TypeApp"}],["right",{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Row"],"tag":"TypeConstructor"},{"annotation":[],"contents":"k","tag":"TypeVar"}],"tag":"TypeApp"}],["union",{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Row"],"tag":"TypeConstructor"},{"annotation":[],"contents":"k","tag":"TypeVar"}],"tag":"TypeApp"}]],"declType":"typeClass","fundeps":[[["left","right"],["union"]],[["right","union"],["left"]],[["union","left"],["right"]]],"superclasses":[]},"kind":null,"sourceSpan":null,"title":"Union"},{"children":[],"comments":"The Nub type class is used to remove duplicate labels from rows.\n","info":{"arguments":[["original",{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Row"],"tag":"TypeConstructor"},{"annotation":[],"contents":"k","tag":"TypeVar"}],"tag":"TypeApp"}],["nubbed",{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Row"],"tag":"TypeConstructor"},{"annotation":[],"contents":"k","tag":"TypeVar"}],"tag":"TypeApp"}]],"declType":"typeClass","fundeps":[[["original"],["nubbed"]]],"superclasses":[]},"kind":null,"sourceSpan":null,"title":"Nub"},{"children":[],"comments":"The Lacks type class asserts that a label does not occur in a given row.\n","info":{"arguments":[["label",{"annotation":[],"contents":[["Prim"],"Symbol"],"tag":"TypeConstructor"}],["row",{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Row"],"tag":"TypeConstructor"},{"annotation":[],"contents":"k","tag":"TypeVar"}],"tag":"TypeApp"}]],"declType":"typeClass","fundeps":[],"superclasses":[]},"kind":null,"sourceSpan":null,"title":"Lacks"},{"children":[],"comments":"The Cons type class is a 4-way relation which asserts that one row of\ntypes can be obtained from another by inserting a new label/type pair on\nthe left.\n","info":{"arguments":[["label",{"annotation":[],"contents":[["Prim"],"Symbol"],"tag":"TypeConstructor"}],["a",{"annotation":[],"contents":"k","tag":"TypeVar"}],["tail",{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Row"],"tag":"TypeConstructor"},{"annotation":[],"contents":"k","tag":"TypeVar"}],"tag":"TypeApp"}],["row",{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Row"],"tag":"TypeConstructor"},{"annotation":[],"contents":"k","tag":"TypeVar"}],"tag":"TypeApp"}]],"declType":"typeClass","fundeps":[[["label","a","tail"],["row"]],[["label","row"],["a","tail"]]],"superclasses":[]},"kind":null,"sourceSpan":null,"title":"Cons"}],"name":"Prim.Row","reExports":[]} \ No newline at end of file diff --git a/tests/purs/publish/basic-example/output/Prim.RowList/docs.json b/tests/purs/publish/basic-example/output/Prim.RowList/docs.json new file mode 100644 index 000000000..1ea89a442 --- /dev/null +++ b/tests/purs/publish/basic-example/output/Prim.RowList/docs.json @@ -0,0 +1 @@ +{"comments":"The Prim.RowList module is embedded in the PureScript compiler. Unlike `Prim`, it is not imported implicitly. It contains a type level list (`RowList`) that represents an ordered view of a row of types.","declarations":[{"children":[],"comments":"A type level list representation of a row of types.\n","info":{"declType":"externData","kind":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"roles":[]},"kind":null,"sourceSpan":null,"title":"RowList"},{"children":[],"comments":"Constructs a new `RowList` from a label, a type, and an existing tail\n`RowList`. E.g: `Cons \"x\" Int (Cons \"y\" Int Nil)`.\n","info":{"declType":"externData","kind":{"annotation":[],"contents":{"identifier":"k","kind":{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Symbol"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"k","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim","RowList"],"RowList"],"tag":"TypeConstructor"},{"annotation":[],"contents":"k","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim","RowList"],"RowList"],"tag":"TypeConstructor"},{"annotation":[],"contents":"k","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"roles":[]},"kind":null,"sourceSpan":null,"title":"Cons"},{"children":[],"comments":"The empty `RowList`.\n","info":{"declType":"externData","kind":{"annotation":[],"contents":{"identifier":"k","kind":{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim","RowList"],"RowList"],"tag":"TypeConstructor"},{"annotation":[],"contents":"k","tag":"TypeVar"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"roles":[]},"kind":null,"sourceSpan":null,"title":"Nil"},{"children":[],"comments":"Compiler solved type class for generating a `RowList` from a closed row\nof types. Entries are sorted by label and duplicates are preserved in\nthe order they appeared in the row.\n","info":{"arguments":[["row",{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Row"],"tag":"TypeConstructor"},{"annotation":[],"contents":"k","tag":"TypeVar"}],"tag":"TypeApp"}],["list",{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim","RowList"],"RowList"],"tag":"TypeConstructor"},{"annotation":[],"contents":"k","tag":"TypeVar"}],"tag":"TypeApp"}]],"declType":"typeClass","fundeps":[[["row"],["list"]]],"superclasses":[]},"kind":null,"sourceSpan":null,"title":"RowToList"}],"name":"Prim.RowList","reExports":[]} \ No newline at end of file diff --git a/tests/purs/publish/basic-example/output/Prim.Symbol/docs.json b/tests/purs/publish/basic-example/output/Prim.Symbol/docs.json new file mode 100644 index 000000000..e2bc9ff2a --- /dev/null +++ b/tests/purs/publish/basic-example/output/Prim.Symbol/docs.json @@ -0,0 +1 @@ +{"comments":"The Prim.Symbol module is embedded in the PureScript compiler. Unlike `Prim`, it is not imported implicitly. It contains automatically solved type classes for working with `Symbols`.","declarations":[{"children":[],"comments":"Compiler solved type class for appending `Symbol`s together.\n","info":{"arguments":[["left",{"annotation":[],"contents":[["Prim"],"Symbol"],"tag":"TypeConstructor"}],["right",{"annotation":[],"contents":[["Prim"],"Symbol"],"tag":"TypeConstructor"}],["appended",{"annotation":[],"contents":[["Prim"],"Symbol"],"tag":"TypeConstructor"}]],"declType":"typeClass","fundeps":[[["left","right"],["appended"]],[["right","appended"],["left"]],[["appended","left"],["right"]]],"superclasses":[]},"kind":null,"sourceSpan":null,"title":"Append"},{"children":[],"comments":"Compiler solved type class for comparing two `Symbol`s.\nProduces an `Ordering`.\n","info":{"arguments":[["left",{"annotation":[],"contents":[["Prim"],"Symbol"],"tag":"TypeConstructor"}],["right",{"annotation":[],"contents":[["Prim"],"Symbol"],"tag":"TypeConstructor"}],["ordering",{"annotation":[],"contents":[["Prim","Ordering"],"Ordering"],"tag":"TypeConstructor"}]],"declType":"typeClass","fundeps":[[["left","right"],["ordering"]]],"superclasses":[]},"kind":null,"sourceSpan":null,"title":"Compare"},{"children":[],"comments":"Compiler solved type class for either splitting up a symbol into its\nhead and tail or for combining a head and tail into a new symbol.\nRequires the head to be a single character and the combined string\ncannot be empty.\n","info":{"arguments":[["head",{"annotation":[],"contents":[["Prim"],"Symbol"],"tag":"TypeConstructor"}],["tail",{"annotation":[],"contents":[["Prim"],"Symbol"],"tag":"TypeConstructor"}],["symbol",{"annotation":[],"contents":[["Prim"],"Symbol"],"tag":"TypeConstructor"}]],"declType":"typeClass","fundeps":[[["head","tail"],["symbol"]],[["symbol"],["head","tail"]]],"superclasses":[]},"kind":null,"sourceSpan":null,"title":"Cons"}],"name":"Prim.Symbol","reExports":[]} \ No newline at end of file diff --git a/tests/purs/publish/basic-example/output/Prim.TypeError/docs.json b/tests/purs/publish/basic-example/output/Prim.TypeError/docs.json new file mode 100644 index 000000000..86ca13721 --- /dev/null +++ b/tests/purs/publish/basic-example/output/Prim.TypeError/docs.json @@ -0,0 +1 @@ +{"comments":"The Prim.TypeError module is embedded in the PureScript compiler. Unlike `Prim`, it is not imported implicitly. It contains type classes that provide custom type error and warning functionality.","declarations":[{"children":[],"comments":"The Warn type class allows a custom compiler warning to be displayed.\n\nFor more information, see\n[the Custom Type Errors guide](https://github.com/purescript/documentation/blob/master/guides/Custom-Type-Errors.md).\n","info":{"arguments":[["message",{"annotation":[],"contents":[["Prim","TypeError"],"Doc"],"tag":"TypeConstructor"}]],"declType":"typeClass","fundeps":[],"superclasses":[]},"kind":null,"sourceSpan":null,"title":"Warn"},{"children":[],"comments":"The Fail type class is part of the custom type errors feature. To provide\na custom type error when someone tries to use a particular instance,\nwrite that instance out with a Fail constraint.\n\nFor more information, see\n[the Custom Type Errors guide](https://github.com/purescript/documentation/blob/master/guides/Custom-Type-Errors.md).\n","info":{"arguments":[["message",{"annotation":[],"contents":[["Prim","TypeError"],"Doc"],"tag":"TypeConstructor"}]],"declType":"typeClass","fundeps":[],"superclasses":[]},"kind":null,"sourceSpan":null,"title":"Fail"},{"children":[],"comments":"`Doc` is the kind of type-level documents.\n\nThis kind is used with the `Fail` and `Warn` type classes.\nBuild up a `Doc` with `Text`, `Quote`, `QuoteLabel`, `Beside`, and `Above`.\n","info":{"declType":"externData","kind":{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"roles":[]},"kind":null,"sourceSpan":null,"title":"Doc"},{"children":[],"comments":"The Text type constructor makes a Doc from a Symbol\nto be used in a custom type error.\n\nFor more information, see\n[the Custom Type Errors guide](https://github.com/purescript/documentation/blob/master/guides/Custom-Type-Errors.md).\n","info":{"declType":"externData","kind":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Symbol"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim","TypeError"],"Doc"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"roles":[]},"kind":null,"sourceSpan":null,"title":"Text"},{"children":[],"comments":"The Quote type constructor renders any concrete type as a Doc\nto be used in a custom type error.\n\nFor more information, see\n[the Custom Type Errors guide](https://github.com/purescript/documentation/blob/master/guides/Custom-Type-Errors.md).\n","info":{"declType":"externData","kind":{"annotation":[],"contents":{"identifier":"k","kind":{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"k","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim","TypeError"],"Doc"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"roles":[]},"kind":null,"sourceSpan":null,"title":"Quote"},{"children":[],"comments":"The `QuoteLabel` type constructor will produce a `Doc` when given a `Symbol`. When the resulting `Doc` is rendered\nfor a `Warn` or `Fail` constraint, a syntactically valid label will be produced, escaping with quotes as needed.\n\nFor more information, see\n[the Custom Type Errors guide](https://github.com/purescript/documentation/blob/master/guides/Custom-Type-Errors.md).\n","info":{"declType":"externData","kind":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Symbol"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim","TypeError"],"Doc"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"roles":[]},"kind":null,"sourceSpan":null,"title":"QuoteLabel"},{"children":[],"comments":"The Beside type constructor combines two Docs horizontally\nto be used in a custom type error.\n\nFor more information, see\n[the Custom Type Errors guide](https://github.com/purescript/documentation/blob/master/guides/Custom-Type-Errors.md).\n","info":{"declType":"externData","kind":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim","TypeError"],"Doc"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim","TypeError"],"Doc"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim","TypeError"],"Doc"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"roles":[]},"kind":null,"sourceSpan":null,"title":"Beside"},{"children":[],"comments":"The Above type constructor combines two Docs vertically\nin a custom type error.\n\nFor more information, see\n[the Custom Type Errors guide](https://github.com/purescript/documentation/blob/master/guides/Custom-Type-Errors.md).\n","info":{"declType":"externData","kind":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim","TypeError"],"Doc"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim","TypeError"],"Doc"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim","TypeError"],"Doc"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"roles":[]},"kind":null,"sourceSpan":null,"title":"Above"}],"name":"Prim.TypeError","reExports":[]} \ No newline at end of file diff --git a/tests/purs/publish/basic-example/output/Prim/docs.json b/tests/purs/publish/basic-example/output/Prim/docs.json new file mode 100644 index 000000000..8a8ee9e8a --- /dev/null +++ b/tests/purs/publish/basic-example/output/Prim/docs.json @@ -0,0 +1 @@ +{"comments":"The `Prim` module is embedded in the PureScript compiler in order to provide compiler support for certain types — for example, value literals, or syntax sugar. It is implicitly imported unqualified in every module except those that list it as a qualified import.\n\n`Prim` does not include additional built-in types and kinds that are defined deeper in the compiler such as Type wildcards (e.g. `f :: _ -> Int`) and Quantified Types. Rather, these are documented in [the PureScript language reference](https://github.com/purescript/documentation/blob/master/language/Types.md).\n","declarations":[{"children":[],"comments":"A function, which takes values of the type specified by the first type\nparameter, and returns values of the type specified by the second.\nIn the JavaScript backend, this is a standard JavaScript Function.\n\nThe type constructor `(->)` is syntactic sugar for this type constructor.\nIt is recommended to use `(->)` rather than `Function`, where possible.\n\nThat is, prefer this:\n\n f :: Number -> Number\n\nto either of these:\n\n f :: Function Number Number\n f :: (->) Number Number\n","info":{"declType":"externData","kind":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"roles":[]},"kind":null,"sourceSpan":null,"title":"Function"},{"children":[],"comments":"An Array: a data structure supporting efficient random access. In\nthe JavaScript backend, values of this type are represented as JavaScript\nArrays at runtime.\n\nConstruct values using literals:\n\n x = [1,2,3,4,5] :: Array Int\n","info":{"declType":"externData","kind":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"roles":[]},"kind":null,"sourceSpan":null,"title":"Array"},{"children":[],"comments":"The type of records whose fields are known at compile time. In the\nJavaScript backend, values of this type are represented as JavaScript\nObjects at runtime.\n\nThe type signature here means that the `Record` type constructor takes\na row of concrete types. For example:\n\n type Person = Record (name :: String, age :: Number)\n\nThe syntactic sugar with curly braces `{ }` is generally preferred, though:\n\n type Person = { name :: String, age :: Number }\n\nThe row associates a type to each label which appears in the record.\n\n_Technical note_: PureScript allows duplicate labels in rows, and the\nmeaning of `Record r` is based on the _first_ occurrence of each label in\nthe row `r`.\n","info":{"declType":"externData","kind":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Row"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"roles":[]},"kind":null,"sourceSpan":null,"title":"Record"},{"children":[],"comments":"A double precision floating point number (IEEE 754).\n\nConstruct values of this type with literals.\nNegative literals must be wrapped in parentheses if the negation sign could be mistaken\nfor an infix operator:\n\n x = 35.23 :: Number\n y = -1.224e6 :: Number\n z = exp (-1.0) :: Number\n","info":{"declType":"externData","kind":{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"roles":[]},"kind":null,"sourceSpan":null,"title":"Number"},{"children":[],"comments":"A 32-bit signed integer. See the `purescript-integers` package for details\nof how this is accomplished when compiling to JavaScript.\n\nConstruct values of this type with literals. Hexadecimal syntax is supported.\nNegative literals must be wrapped in parentheses if the negation sign could be mistaken\nfor an infix operator:\n\n x = -23 :: Int\n y = 0x17 :: Int\n z = complement (-24) :: Int\n\nIntegers used as types are considered to have kind `Int`.\nUnlike value-level `Int`s, which must be representable as a 32-bit signed integer,\ntype-level `Int`s are unbounded. Hexadecimal support is also supported at the type level.\n\n type One :: Int\n type One = 1\n \n type Beyond32BitSignedInt :: Int\n type Beyond32BitSignedInt = 2147483648\n \n type HexInt :: Int\n type HexInt = 0x17\n\nNegative integer literals at the type level must be\nwrapped in parentheses if the negation sign could be mistaken for an infix operator.\n\n type NegativeOne = -1\n foo :: Proxy (-1) -> ...\n","info":{"declType":"externData","kind":{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"roles":[]},"kind":null,"sourceSpan":null,"title":"Int"},{"children":[],"comments":"A String. As in JavaScript, String values represent sequences of UTF-16\ncode units, which are not required to form a valid encoding of Unicode\ntext (for example, lone surrogates are permitted).\n\nConstruct values of this type with literals, using double quotes `\"`:\n\n x = \"hello, world\" :: String\n\nMulti-line string literals are also supported with triple quotes (`\"\"\"`):\n\n x = \"\"\"multi\n line\"\"\"\n\nAt the type level, string literals represent types with kind `Symbol`.\nThese types will have kind `String` in a future release:\n\n type Hello :: Symbol\n type Hello = \"Hello, world\"\n","info":{"declType":"externData","kind":{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"roles":[]},"kind":null,"sourceSpan":null,"title":"String"},{"children":[],"comments":"A single character (UTF-16 code unit). The JavaScript representation is a\nnormal `String`, which is guaranteed to contain one code unit. This means\nthat astral plane characters (i.e. those with code point values greater\nthan `0xFFFF`) cannot be represented as `Char` values.\n\nConstruct values of this type with literals, using single quotes `'`:\n\n x = 'a' :: Char\n","info":{"declType":"externData","kind":{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"roles":[]},"kind":null,"sourceSpan":null,"title":"Char"},{"children":[],"comments":"A JavaScript Boolean value.\n\nConstruct values of this type with the literals `true` and `false`.\n\nThe `True` and `False` types defined in `Prim.Boolean` have this type as their kind.\n","info":{"declType":"externData","kind":{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"roles":[]},"kind":null,"sourceSpan":null,"title":"Boolean"},{"children":[],"comments":"The Partial type class is used to indicate that a function is *partial,*\nthat is, it is not defined for all inputs. In practice, attempting to use\na partial function with a bad input will usually cause an error to be\nthrown, although it is not safe to assume that this will happen in all\ncases. For more information, see\n[purescript-partial](https://pursuit.purescript.org/packages/purescript-partial/).\n","info":{"arguments":[],"declType":"typeClass","fundeps":[],"superclasses":[]},"kind":null,"sourceSpan":null,"title":"Partial"},{"children":[],"comments":"`Type` is the kind of all proper types: those that classify value-level terms.\nFor example the type `Boolean` has kind `Type`; denoted by `Boolean :: Type`.\n","info":{"declType":"externData","kind":{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"roles":[]},"kind":null,"sourceSpan":null,"title":"Type"},{"children":[],"comments":"`Constraint` is the kind of type class constraints.\nFor example, a type class declaration like this:\n\n class Semigroup a where\n append :: a -> a -> a\n\nhas the kind signature:\n\n class Semigroup :: Type -> Constraint\n","info":{"declType":"externData","kind":{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"roles":[]},"kind":null,"sourceSpan":null,"title":"Constraint"},{"children":[],"comments":"`Symbol` is the kind of type-level strings.\n\nConstruct types of this kind using the same literal syntax as documented\nfor strings.\n\n type Hello :: Symbol\n type Hello = \"Hello, world\"\n\n","info":{"declType":"externData","kind":{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"roles":[]},"kind":null,"sourceSpan":null,"title":"Symbol"},{"children":[],"comments":"`Row` is the kind constructor of label-indexed types which map type-level strings to other types.\nThe most common use of `Row` is `Row Type`, a row mapping labels to basic (of kind `Type`) types:\n\n type ExampleRow :: Row Type\n type ExampleRow = ( name :: String, values :: Array Int )\n\nThis is the kind of `Row` expected by the `Record` type constructor.\nMore advanced row kinds like `Row (Type -> Type)` are used much less frequently.\n","info":{"declType":"externData","kind":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"roles":[]},"kind":null,"sourceSpan":null,"title":"Row"}],"name":"Prim","reExports":[]} \ No newline at end of file diff --git a/tests/purs/publish/basic-example/output/Record.Unsafe/docs.json b/tests/purs/publish/basic-example/output/Record.Unsafe/docs.json new file mode 100644 index 000000000..cf0f390d7 --- /dev/null +++ b/tests/purs/publish/basic-example/output/Record.Unsafe/docs.json @@ -0,0 +1 @@ +{"comments":"The functions in this module are highly unsafe as they treat records like\nstringly-keyed maps and can coerce the row of labels that a record has.\n\nThese function are intended for situations where there is some other way of\nproving things about the structure of the record - for example, when using\n`RowToList`. **They should never be used for general record manipulation.**\n","declarations":[{"children":[],"comments":"Checks if a record has a key, using a string for the key.\n","info":{"declType":"value","type":{"annotation":[],"contents":{"identifier":"r1","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"String"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[],"contents":"r1","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"kind":null,"sourceSpan":{"end":[10,70],"name":"../../../support/bower_components/purescript-prelude/src/Record/Unsafe.purs","start":[10,1]},"title":"unsafeHas"},{"children":[],"comments":"Unsafely gets a value from a record, using a string for the key.\n\nIf the key does not exist this will cause a runtime error elsewhere.\n","info":{"declType":"value","type":{"annotation":[],"contents":{"identifier":"r","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"a","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"String"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[],"contents":"r","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"kind":null,"sourceSpan":{"end":[15,64],"name":"../../../support/bower_components/purescript-prelude/src/Record/Unsafe.purs","start":[15,1]},"title":"unsafeGet"},{"children":[],"comments":"Unsafely sets a value on a record, using a string for the key.\n\nThe output record's row is unspecified so can be coerced to any row. If the\noutput type is incorrect it will cause a runtime error elsewhere.\n","info":{"declType":"value","type":{"annotation":[],"contents":{"identifier":"r1","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"r2","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"a","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"String"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[],"contents":"r1","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[],"contents":"r2","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"kind":null,"sourceSpan":{"end":[21,82],"name":"../../../support/bower_components/purescript-prelude/src/Record/Unsafe.purs","start":[21,1]},"title":"unsafeSet"},{"children":[],"comments":"Unsafely removes a value on a record, using a string for the key.\n\nThe output record's row is unspecified so can be coerced to any row. If the\noutput type is incorrect it will cause a runtime error elsewhere.\n","info":{"declType":"value","type":{"annotation":[],"contents":{"identifier":"r1","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"r2","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"String"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[],"contents":"r1","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[],"contents":"r2","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"kind":null,"sourceSpan":{"end":[27,78],"name":"../../../support/bower_components/purescript-prelude/src/Record/Unsafe.purs","start":[27,1]},"title":"unsafeDelete"}],"name":"Record.Unsafe","reExports":[]} \ No newline at end of file diff --git a/tests/purs/publish/basic-example/output/Record.Unsafe/externs.cbor b/tests/purs/publish/basic-example/output/Record.Unsafe/externs.cbor new file mode 100644 index 000000000..aebd6a329 Binary files /dev/null and b/tests/purs/publish/basic-example/output/Record.Unsafe/externs.cbor differ diff --git a/tests/purs/publish/basic-example/output/Safe.Coerce/docs.json b/tests/purs/publish/basic-example/output/Safe.Coerce/docs.json new file mode 100644 index 000000000..7c20e9bca --- /dev/null +++ b/tests/purs/publish/basic-example/output/Safe.Coerce/docs.json @@ -0,0 +1 @@ +{"comments":null,"declarations":[{"children":[],"comments":"Coerce a value of one type to a value of some other type, without changing\nits runtime representation. This function behaves identically to\n`unsafeCoerce` at runtime. Unlike `unsafeCoerce`, it is safe, because the\n`Coercible` constraint prevents any use of this function from compiling\nunless the compiler can prove that the two types have the same runtime\nrepresentation.\n\nOne application for this function is to avoid doing work that you know is a\nno-op because of newtypes. For example, if you have an `Array (Conj a)` and you\nwant an `Array (Disj a)`, you could do `Data.Array.map (un Conj >>> Disj)`, but\nthis performs an unnecessary traversal of the array, with O(n) cost.\n`coerce` accomplishes the same with only O(1) cost:\n\n```purescript\nmapConjToDisj :: forall a. Array (Conj a) -> Array (Disj a)\nmapConjToDisj = coerce\n```\n","info":{"declType":"value","type":{"annotation":[],"contents":{"identifier":"a","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"b","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"a","tag":"TypeVar"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"constraintClass":[["Prim","Coerce"],"Coercible"],"constraintData":null,"constraintKindArgs":[]},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"ConstrainedType"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"kind":null,"sourceSpan":{"end":[26,46],"name":"../../../support/bower_components/purescript-safe-coerce/src/Safe/Coerce.purs","start":[26,1]},"title":"coerce"}],"name":"Safe.Coerce","reExports":[]} \ No newline at end of file diff --git a/tests/purs/publish/basic-example/output/Safe.Coerce/externs.cbor b/tests/purs/publish/basic-example/output/Safe.Coerce/externs.cbor new file mode 100644 index 000000000..d6a4f9afc Binary files /dev/null and b/tests/purs/publish/basic-example/output/Safe.Coerce/externs.cbor differ diff --git a/tests/purs/publish/basic-example/output/Type.Proxy/docs.json b/tests/purs/publish/basic-example/output/Type.Proxy/docs.json new file mode 100644 index 000000000..72099694e --- /dev/null +++ b/tests/purs/publish/basic-example/output/Type.Proxy/docs.json @@ -0,0 +1 @@ +{"comments":"The `Proxy` type and values are for situations where type information is\nrequired for an input to determine the type of an output, but where it is\nnot possible or convenient to provide a _value_ for the input.\n\nA hypothetical example: if you have a class that is used to handle the\nresult of an AJAX request, you may want to use this information to set the\nexpected content type of the request, so you might have a class something\nlike this:\n\n``` purescript\nclass AjaxResponse a where\n responseType :: a -> ResponseType\n fromResponse :: Foreign -> a\n```\n\nThe problem here is `responseType` requires a value of type `a`, but we\nwon't have a value of that type until the request has been completed. The\nsolution is to use a `Proxy` type instead:\n\n``` purescript\nclass AjaxResponse a where\n responseType :: Proxy a -> ResponseType\n fromResponse :: Foreign -> a\n```\n\nWe can now call `responseType (Proxy :: Proxy SomeContentType)` to produce\na `ResponseType` for `SomeContentType` without having to construct some\nempty version of `SomeContentType` first. In situations like this where\nthe `Proxy` type can be statically determined, it is recommended to pull\nout the definition to the top level and make a declaration like:\n\n``` purescript\n_SomeContentType :: Proxy SomeContentType\n_SomeContentType = Proxy\n```\n\nThat way the proxy value can be used as `responseType _SomeContentType`\nfor improved readability. However, this is not always possible, sometimes\nthe type required will be determined by a type variable. As PureScript has\nscoped type variables, we can do things like this:\n\n``` purescript\nmakeRequest :: URL -> ResponseType -> Aff _ Foreign\nmakeRequest = ...\n\nfetchData :: forall a. (AjaxResponse a) => URL -> Aff _ a\nfetchData url = fromResponse <$> makeRequest url (responseType (Proxy :: Proxy a))\n```\n","declarations":[{"children":[{"comments":null,"info":{"arguments":[],"declType":"dataConstructor"},"sourceSpan":{"end":[53,21],"name":"../../../support/bower_components/purescript-prelude/src/Type/Proxy.purs","start":[53,14]},"title":"Proxy"}],"comments":"Proxy type for all `kind`s.\n","info":{"dataDeclType":"data","declType":"data","roles":["Phantom"],"typeArguments":[["a",null]]},"kind":{"keyword":"data","kind":{"annotation":[],"contents":{"identifier":"k","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"k","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"sourceSpan":{"end":[53,21],"name":"../../../support/bower_components/purescript-prelude/src/Type/Proxy.purs","start":[53,1]},"title":"Proxy"}],"name":"Type.Proxy","reExports":[]} \ No newline at end of file diff --git a/tests/purs/publish/basic-example/output/Type.Proxy/externs.cbor b/tests/purs/publish/basic-example/output/Type.Proxy/externs.cbor new file mode 100644 index 000000000..c16541b99 Binary files /dev/null and b/tests/purs/publish/basic-example/output/Type.Proxy/externs.cbor differ diff --git a/tests/purs/publish/basic-example/output/Unsafe.Coerce/docs.json b/tests/purs/publish/basic-example/output/Unsafe.Coerce/docs.json new file mode 100644 index 000000000..efa181b46 --- /dev/null +++ b/tests/purs/publish/basic-example/output/Unsafe.Coerce/docs.json @@ -0,0 +1 @@ +{"comments":null,"declarations":[{"children":[],"comments":"A _highly unsafe_ function, which can be used to persuade the type system that\nany type is the same as any other type. When using this function, it is your\n(that is, the caller's) responsibility to ensure that the underlying\nrepresentation for both types is the same.\n\nBecause this function is extraordinarily flexible, type inference\ncan greatly suffer. It is highly recommended to define specializations of\nthis function rather than using it as-is. For example:\n\n```purescript\nfromBoolean :: Boolean -> Json\nfromBoolean = unsafeCoerce\n```\n\nThis way, you won't have any nasty surprises due to the inferred type being\ndifferent to what you expected.\n\nAfter the v0.14.0 PureScript release, some of what was accomplished via\n`unsafeCoerce` can now be accomplished via `coerce` from\n`purescript-safe-coerce`. See that library's documentation for more\ncontext.\n","info":{"declType":"value","type":{"annotation":[],"contents":{"identifier":"a","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"b","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"kind":null,"sourceSpan":{"end":[27,50],"name":"../../../support/bower_components/purescript-unsafe-coerce/src/Unsafe/Coerce.purs","start":[27,1]},"title":"unsafeCoerce"}],"name":"Unsafe.Coerce","reExports":[]} \ No newline at end of file diff --git a/tests/purs/publish/basic-example/output/Unsafe.Coerce/externs.cbor b/tests/purs/publish/basic-example/output/Unsafe.Coerce/externs.cbor new file mode 100644 index 000000000..78367c179 Binary files /dev/null and b/tests/purs/publish/basic-example/output/Unsafe.Coerce/externs.cbor differ diff --git a/tests/purs/publish/basic-example/output/package.json b/tests/purs/publish/basic-example/output/package.json new file mode 100644 index 000000000..7c34deb58 --- /dev/null +++ b/tests/purs/publish/basic-example/output/package.json @@ -0,0 +1 @@ +{"type":"module"} \ No newline at end of file diff --git a/tests/purs/warning/2542.purs b/tests/purs/warning/2542.purs index df7a68c4e..d6af5cc23 100644 --- a/tests/purs/warning/2542.purs +++ b/tests/purs/warning/2542.purs @@ -3,14 +3,14 @@ module Main where import Effect.Console -type T = forall a. Array a +type T = forall a. List a -- | Note: This should not raise a `ShadowedTypeVar` warning as the -- | type `a` introduced in `T` should not be in scope -- | in the definition of `bar`. foo :: T foo = bar where - bar :: forall a. Array a + bar :: forall a. List a bar = [] main = log "Done" diff --git a/tests/purs/warning/VTAsWildcardInferred.purs b/tests/purs/warning/VTAsWildcardInferred.purs index 4a5da616d..b924793ad 100644 --- a/tests/purs/warning/VTAsWildcardInferred.purs +++ b/tests/purs/warning/VTAsWildcardInferred.purs @@ -15,13 +15,13 @@ class Foo :: Type -> Type -> Type -> Constraint class Foo a b c | a -> b c where fooMember :: a -> b -wrap :: forall @a. Array a -> Array (Array a) +wrap :: forall @a. List a -> List (List a) wrap as = [as] -arrFooMember :: forall c. Array (Foo Int Boolean c => Int -> Boolean) +arrFooMember :: forall c. List (Foo Int Boolean c => Int -> Boolean) arrFooMember = [fooMember] -test2 :: forall c. Array (Array (Foo Int Boolean c => Int -> Boolean)) +test2 :: forall c. List (List (Foo Int Boolean c => Int -> Boolean)) test2 = wrap @(Foo Int Boolean _ => _) arrFooMember -- neither wildcard should warn IMO main :: Effect Unit diff --git a/tests/purus/passing/2018/A.purs b/tests/purus/passing/2018/A.purs new file mode 100644 index 000000000..bff4cd039 --- /dev/null +++ b/tests/purus/passing/2018/A.purs @@ -0,0 +1,7 @@ +module A where + +import B as Main + +-- Prior to the 2018 fix this would be detected as a cycle between A and Main. +foo ∷ Main.Foo → Main.Foo +foo x = x diff --git a/tests/purus/passing/2018/B.purs b/tests/purus/passing/2018/B.purs new file mode 100644 index 000000000..c87647d4c --- /dev/null +++ b/tests/purus/passing/2018/B.purs @@ -0,0 +1,3 @@ +module B where + +data Foo = X | Y diff --git a/tests/purus/passing/2018/output/A/A.cfn b/tests/purus/passing/2018/output/A/A.cfn new file mode 100644 index 000000000..0c55fca57 --- /dev/null +++ b/tests/purus/passing/2018/output/A/A.cfn @@ -0,0 +1 @@ +{"builtWith":"0.0.1","comments":[],"dataTypes":{"_ctorDict":[],"_tyDict":[]},"decls":[{"annotation":{"meta":null,"sourceSpan":{"end":[6,26],"start":[6,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[7,10],"start":[7,1]}},"argument":"x","body":{"annotation":{"meta":null,"sourceSpan":{"end":[7,10],"start":[7,9]}},"kind":"Var","type":{"annotation":[{"end":[6,15],"name":"tests/purus/passing/2018/A.purs","start":[6,7]},[]],"contents":[["B"],"Foo"],"tag":"TypeConstructor"},"value":{"identifier":"x","sourcePos":[7,1]}},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[6,15],"name":"tests/purus/passing/2018/A.purs","start":[6,7]},[]],"contents":[["B"],"Foo"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[6,26],"name":"tests/purus/passing/2018/A.purs","start":[6,18]},[]],"contents":[["B"],"Foo"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"identifier":"foo"}],"exports":["foo"],"foreign":[],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[3,17],"start":[3,1]}},"moduleName":["B"]},{"annotation":{"meta":null,"sourceSpan":{"end":[7,10],"start":[1,1]}},"moduleName":["Builtin"]},{"annotation":{"meta":null,"sourceSpan":{"end":[7,10],"start":[1,1]}},"moduleName":["Prim"]}],"moduleName":["A"],"modulePath":"tests/purus/passing/2018/A.purs","reExports":{},"sourceSpan":{"end":[7,10],"start":[1,1]}} \ No newline at end of file diff --git a/tests/purus/passing/2018/output/A/A.cfn.pretty b/tests/purus/passing/2018/output/A/A.cfn.pretty new file mode 100644 index 000000000..7d34d4ebb --- /dev/null +++ b/tests/purus/passing/2018/output/A/A.cfn.pretty @@ -0,0 +1,29 @@ +A (tests/purus/passing/2018/A.purs) + +Imported Modules: +------------------------------ + B, + Builtin, + Prim + +Exports: +------------------------------ + foo + +Re-Exports: +------------------------------ + + +Foreign: +------------------------------ + + +Datatypes: +------------------------------ + + + +Declarations: +------------------------------ +foo :: (B.Foo -> (B.Foo)) +foo = \(x: B.Foo) -> (x: B.Foo) \ No newline at end of file diff --git a/tests/purus/passing/2018/output/A/externs.cbor b/tests/purus/passing/2018/output/A/externs.cbor new file mode 100644 index 000000000..2fee4fdd4 Binary files /dev/null and b/tests/purus/passing/2018/output/A/externs.cbor differ diff --git a/tests/purus/passing/2018/output/B/B.cfn b/tests/purus/passing/2018/output/B/B.cfn new file mode 100644 index 000000000..7187ae43c --- /dev/null +++ b/tests/purus/passing/2018/output/B/B.cfn @@ -0,0 +1 @@ +{"builtWith":"0.0.1","comments":[],"dataTypes":{"_ctorDict":[[[["B"],{"Ident":"X"}],[["B"],"Foo"]],[[["B"],{"Ident":"Y"}],[["B"],"Foo"]]],"_tyDict":[[[["B"],"Foo"],{"_dDataArgs":[],"_dDataCtors":[{"_cdCtorFields":[],"_cdCtorName":[["B"],{"Ident":"X"}]},{"_cdCtorFields":[],"_cdCtorName":[["B"],{"Ident":"Y"}]}],"_dDataTyName":[["B"],"Foo"],"_dDeclType":"data"}]]},"decls":[],"exports":["X","Y"],"foreign":[],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[3,17],"start":[1,1]}},"moduleName":["Builtin"]},{"annotation":{"meta":null,"sourceSpan":{"end":[3,17],"start":[1,1]}},"moduleName":["Prim"]}],"moduleName":["B"],"modulePath":"tests/purus/passing/2018/B.purs","reExports":{},"sourceSpan":{"end":[3,17],"start":[1,1]}} \ No newline at end of file diff --git a/tests/purus/passing/2018/output/B/B.cfn.pretty b/tests/purus/passing/2018/output/B/B.cfn.pretty new file mode 100644 index 000000000..0dddc9d36 --- /dev/null +++ b/tests/purus/passing/2018/output/B/B.cfn.pretty @@ -0,0 +1,29 @@ +B (tests/purus/passing/2018/B.purs) + +Imported Modules: +------------------------------ + Builtin, + Prim + +Exports: +------------------------------ + X, + Y + +Re-Exports: +------------------------------ + + +Foreign: +------------------------------ + + +Datatypes: +------------------------------ +data Foo = + X + | Y + + +Declarations: +------------------------------ diff --git a/tests/purus/passing/2018/output/B/externs.cbor b/tests/purus/passing/2018/output/B/externs.cbor new file mode 100644 index 000000000..529f82b73 Binary files /dev/null and b/tests/purus/passing/2018/output/B/externs.cbor differ diff --git a/tests/purus/passing/2018/output/package.json b/tests/purus/passing/2018/output/package.json new file mode 100644 index 000000000..7c34deb58 --- /dev/null +++ b/tests/purus/passing/2018/output/package.json @@ -0,0 +1 @@ +{"type":"module"} \ No newline at end of file diff --git a/tests/purus/passing/2138/Lib.purs b/tests/purus/passing/2138/Lib.purs new file mode 100644 index 000000000..3c433e0b1 --- /dev/null +++ b/tests/purus/passing/2138/Lib.purs @@ -0,0 +1,3 @@ +module Lib (A(..), A) where + +data A = B | C diff --git a/tests/purus/passing/2138/output/Lib/Lib.cfn b/tests/purus/passing/2138/output/Lib/Lib.cfn new file mode 100644 index 000000000..7b85dbd0c --- /dev/null +++ b/tests/purus/passing/2138/output/Lib/Lib.cfn @@ -0,0 +1 @@ +{"builtWith":"0.0.1","comments":[],"dataTypes":{"_ctorDict":[[[["Lib"],{"Ident":"B"}],[["Lib"],"A"]],[[["Lib"],{"Ident":"C"}],[["Lib"],"A"]]],"_tyDict":[[[["Lib"],"A"],{"_dDataArgs":[],"_dDataCtors":[{"_cdCtorFields":[],"_cdCtorName":[["Lib"],{"Ident":"B"}]},{"_cdCtorFields":[],"_cdCtorName":[["Lib"],{"Ident":"C"}]}],"_dDataTyName":[["Lib"],"A"],"_dDeclType":"data"}]]},"decls":[],"exports":["B","C"],"foreign":[],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[3,15],"start":[1,1]}},"moduleName":["Builtin"]},{"annotation":{"meta":null,"sourceSpan":{"end":[3,15],"start":[1,1]}},"moduleName":["Prim"]}],"moduleName":["Lib"],"modulePath":"tests/purus/passing/2138/Lib.purs","reExports":{},"sourceSpan":{"end":[3,15],"start":[1,1]}} \ No newline at end of file diff --git a/tests/purus/passing/2138/output/Lib/Lib.cfn.pretty b/tests/purus/passing/2138/output/Lib/Lib.cfn.pretty new file mode 100644 index 000000000..fcc008eff --- /dev/null +++ b/tests/purus/passing/2138/output/Lib/Lib.cfn.pretty @@ -0,0 +1,29 @@ +Lib (tests/purus/passing/2138/Lib.purs) + +Imported Modules: +------------------------------ + Builtin, + Prim + +Exports: +------------------------------ + B, + C + +Re-Exports: +------------------------------ + + +Foreign: +------------------------------ + + +Datatypes: +------------------------------ +data A = + B + | C + + +Declarations: +------------------------------ diff --git a/tests/purus/passing/2138/output/Lib/externs.cbor b/tests/purus/passing/2138/output/Lib/externs.cbor new file mode 100644 index 000000000..c5437d9c9 Binary files /dev/null and b/tests/purus/passing/2138/output/Lib/externs.cbor differ diff --git a/tests/purus/passing/2138/output/package.json b/tests/purus/passing/2138/output/package.json new file mode 100644 index 000000000..7c34deb58 --- /dev/null +++ b/tests/purus/passing/2138/output/package.json @@ -0,0 +1 @@ +{"type":"module"} \ No newline at end of file diff --git a/tests/purus/passing/2609/Eg.purs b/tests/purus/passing/2609/Eg.purs new file mode 100644 index 000000000..cd6e73d34 --- /dev/null +++ b/tests/purus/passing/2609/Eg.purs @@ -0,0 +1,5 @@ +module Eg (Foo'(Bar'), (:->)) where + +data Foo' = Bar' Int Int + +infix 4 Bar' as :-> diff --git a/tests/purus/passing/2609/output/Eg/Eg.cfn b/tests/purus/passing/2609/output/Eg/Eg.cfn new file mode 100644 index 000000000..22918e472 --- /dev/null +++ b/tests/purus/passing/2609/output/Eg/Eg.cfn @@ -0,0 +1 @@ +{"builtWith":"0.0.1","comments":[],"dataTypes":{"_ctorDict":[[[["Eg"],{"Ident":"Bar'"}],[["Eg"],"Foo'"]]],"_tyDict":[[[["Eg"],"Foo'"],{"_dDataArgs":[],"_dDataCtors":[{"_cdCtorFields":[[{"Ident":"value0"},{"annotation":[{"end":[3,21],"name":"tests/purus/passing/2609/Eg.purs","start":[3,18]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],[{"Ident":"value1"},{"annotation":[{"end":[3,25],"name":"tests/purus/passing/2609/Eg.purs","start":[3,22]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}]],"_cdCtorName":[["Eg"],{"Ident":"Bar'"}]}],"_dDataTyName":[["Eg"],"Foo'"],"_dDeclType":"data"}]]},"decls":[],"exports":["Bar'"],"foreign":[],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[5,20],"start":[1,1]}},"moduleName":["Builtin"]},{"annotation":{"meta":null,"sourceSpan":{"end":[5,20],"start":[1,1]}},"moduleName":["Eg"]},{"annotation":{"meta":null,"sourceSpan":{"end":[5,20],"start":[1,1]}},"moduleName":["Prim"]}],"moduleName":["Eg"],"modulePath":"tests/purus/passing/2609/Eg.purs","reExports":{},"sourceSpan":{"end":[5,20],"start":[1,1]}} \ No newline at end of file diff --git a/tests/purus/passing/2609/output/Eg/Eg.cfn.pretty b/tests/purus/passing/2609/output/Eg/Eg.cfn.pretty new file mode 100644 index 000000000..2dae9d582 --- /dev/null +++ b/tests/purus/passing/2609/output/Eg/Eg.cfn.pretty @@ -0,0 +1,28 @@ +Eg (tests/purus/passing/2609/Eg.purs) + +Imported Modules: +------------------------------ + Builtin, + Eg, + Prim + +Exports: +------------------------------ + Bar' + +Re-Exports: +------------------------------ + + +Foreign: +------------------------------ + + +Datatypes: +------------------------------ +data Foo' = + Bar' (Prim.Int) (Prim.Int) + + +Declarations: +------------------------------ diff --git a/tests/purus/passing/2609/output/Eg/externs.cbor b/tests/purus/passing/2609/output/Eg/externs.cbor new file mode 100644 index 000000000..b34925f9c Binary files /dev/null and b/tests/purus/passing/2609/output/Eg/externs.cbor differ diff --git a/tests/purus/passing/2609/output/package.json b/tests/purus/passing/2609/output/package.json new file mode 100644 index 000000000..7c34deb58 --- /dev/null +++ b/tests/purus/passing/2609/output/package.json @@ -0,0 +1 @@ +{"type":"module"} \ No newline at end of file diff --git a/tests/purus/passing/4035/Other.purs b/tests/purus/passing/4035/Other.purs new file mode 100644 index 000000000..fd4201ab2 --- /dev/null +++ b/tests/purus/passing/4035/Other.purs @@ -0,0 +1,5 @@ +module Other where + + +type Id :: Type -> Type +type Id (a :: Type) = a diff --git a/tests/purus/passing/4035/output/Other/Other.cfn b/tests/purus/passing/4035/output/Other/Other.cfn new file mode 100644 index 000000000..1ef999aef --- /dev/null +++ b/tests/purus/passing/4035/output/Other/Other.cfn @@ -0,0 +1 @@ +{"builtWith":"0.0.1","comments":[],"dataTypes":{"_ctorDict":[],"_tyDict":[]},"decls":[],"exports":[],"foreign":[],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[5,24],"start":[1,1]}},"moduleName":["Builtin"]},{"annotation":{"meta":null,"sourceSpan":{"end":[5,24],"start":[1,1]}},"moduleName":["Prim"]}],"moduleName":["Other"],"modulePath":"tests/purus/passing/4035/Other.purs","reExports":{},"sourceSpan":{"end":[5,24],"start":[1,1]}} \ No newline at end of file diff --git a/tests/purus/passing/4035/output/Other/Other.cfn.pretty b/tests/purus/passing/4035/output/Other/Other.cfn.pretty new file mode 100644 index 000000000..8144b1aac --- /dev/null +++ b/tests/purus/passing/4035/output/Other/Other.cfn.pretty @@ -0,0 +1,26 @@ +Other (tests/purus/passing/4035/Other.purs) + +Imported Modules: +------------------------------ + Builtin, + Prim + +Exports: +------------------------------ + + +Re-Exports: +------------------------------ + + +Foreign: +------------------------------ + + +Datatypes: +------------------------------ + + + +Declarations: +------------------------------ diff --git a/tests/purus/passing/4035/output/Other/externs.cbor b/tests/purus/passing/4035/output/Other/externs.cbor new file mode 100644 index 000000000..d2cf89da1 Binary files /dev/null and b/tests/purus/passing/4035/output/Other/externs.cbor differ diff --git a/tests/purus/passing/4035/output/package.json b/tests/purus/passing/4035/output/package.json new file mode 100644 index 000000000..7c34deb58 --- /dev/null +++ b/tests/purus/passing/4035/output/package.json @@ -0,0 +1 @@ +{"type":"module"} \ No newline at end of file diff --git a/tests/purus/passing/4101/Lib.purs b/tests/purus/passing/4101/Lib.purs new file mode 100644 index 000000000..7cc9b79bb --- /dev/null +++ b/tests/purus/passing/4101/Lib.purs @@ -0,0 +1,9 @@ +module Lib where + +-- newtype Const :: forall (j :: Type) (k :: j). Type -> k -> Type +newtype Const (a :: Type) (b :: Type) = Const a + +data Unit = Unit + +type CONST = Const +type UNIT = CONST Unit diff --git a/tests/purus/passing/4101/output/Lib/Lib.cfn b/tests/purus/passing/4101/output/Lib/Lib.cfn new file mode 100644 index 000000000..8114fe9f2 --- /dev/null +++ b/tests/purus/passing/4101/output/Lib/Lib.cfn @@ -0,0 +1 @@ +{"builtWith":"0.0.1","comments":[],"dataTypes":{"_ctorDict":[[[["Lib"],{"Ident":"Const"}],[["Lib"],"Const"]],[[["Lib"],{"Ident":"Unit"}],[["Lib"],"Unit"]]],"_tyDict":[[[["Lib"],"Const"],{"_dDataArgs":[["a",{"annotation":[{"end":[4,25],"name":"tests/purus/passing/4101/Lib.purs","start":[4,21]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],["b",{"annotation":[{"end":[4,37],"name":"tests/purus/passing/4101/Lib.purs","start":[4,33]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}]],"_dDataCtors":[{"_cdCtorFields":[[{"Ident":"value0"},{"annotation":[{"end":[4,48],"name":"tests/purus/passing/4101/Lib.purs","start":[4,47]},[]],"contents":{"kind":{"annotation":[{"end":[4,25],"name":"tests/purus/passing/4101/Lib.purs","start":[4,21]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}]],"_cdCtorName":[["Lib"],{"Ident":"Const"}]}],"_dDataTyName":[["Lib"],"Const"],"_dDeclType":"newtype"}],[[["Lib"],"Unit"],{"_dDataArgs":[],"_dDataCtors":[{"_cdCtorFields":[],"_cdCtorName":[["Lib"],{"Ident":"Unit"}]}],"_dDataTyName":[["Lib"],"Unit"],"_dDeclType":"data"}]]},"decls":[],"exports":["Const","Unit"],"foreign":[],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[9,23],"start":[1,1]}},"moduleName":["Builtin"]},{"annotation":{"meta":null,"sourceSpan":{"end":[9,23],"start":[1,1]}},"moduleName":["Prim"]}],"moduleName":["Lib"],"modulePath":"tests/purus/passing/4101/Lib.purs","reExports":{},"sourceSpan":{"end":[9,23],"start":[1,1]}} \ No newline at end of file diff --git a/tests/purus/passing/4101/output/Lib/Lib.cfn.pretty b/tests/purus/passing/4101/output/Lib/Lib.cfn.pretty new file mode 100644 index 000000000..5617917c5 --- /dev/null +++ b/tests/purus/passing/4101/output/Lib/Lib.cfn.pretty @@ -0,0 +1,31 @@ +Lib (tests/purus/passing/4101/Lib.purs) + +Imported Modules: +------------------------------ + Builtin, + Prim + +Exports: +------------------------------ + Const, + Unit + +Re-Exports: +------------------------------ + + +Foreign: +------------------------------ + + +Datatypes: +------------------------------ +newtype Const (a :: Prim.Type) (b :: Prim.Type) = + Const ((a :: Prim.Type)) + +data Unit = + Unit + + +Declarations: +------------------------------ diff --git a/tests/purus/passing/4101/output/Lib/externs.cbor b/tests/purus/passing/4101/output/Lib/externs.cbor new file mode 100644 index 000000000..abb9001e4 Binary files /dev/null and b/tests/purus/passing/4101/output/Lib/externs.cbor differ diff --git a/tests/purus/passing/4101/output/package.json b/tests/purus/passing/4101/output/package.json new file mode 100644 index 000000000..7c34deb58 --- /dev/null +++ b/tests/purus/passing/4101/output/package.json @@ -0,0 +1 @@ +{"type":"module"} \ No newline at end of file diff --git a/tests/purus/passing/4105/Lib.purs b/tests/purus/passing/4105/Lib.purs new file mode 100644 index 000000000..e42dfdae2 --- /dev/null +++ b/tests/purus/passing/4105/Lib.purs @@ -0,0 +1,5 @@ +module Lib where + +type Template (col :: Type -> Type) = { bio :: col String } +type Identity (a :: Type) = a +type Patch = Template Identity diff --git a/tests/purus/passing/4105/output/Lib/Lib.cfn b/tests/purus/passing/4105/output/Lib/Lib.cfn new file mode 100644 index 000000000..bc0c25a72 --- /dev/null +++ b/tests/purus/passing/4105/output/Lib/Lib.cfn @@ -0,0 +1 @@ +{"builtWith":"0.0.1","comments":[],"dataTypes":{"_ctorDict":[],"_tyDict":[]},"decls":[],"exports":[],"foreign":[],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[5,31],"start":[1,1]}},"moduleName":["Builtin"]},{"annotation":{"meta":null,"sourceSpan":{"end":[5,31],"start":[1,1]}},"moduleName":["Prim"]}],"moduleName":["Lib"],"modulePath":"tests/purus/passing/4105/Lib.purs","reExports":{},"sourceSpan":{"end":[5,31],"start":[1,1]}} \ No newline at end of file diff --git a/tests/purus/passing/4105/output/Lib/Lib.cfn.pretty b/tests/purus/passing/4105/output/Lib/Lib.cfn.pretty new file mode 100644 index 000000000..f3d0d9f02 --- /dev/null +++ b/tests/purus/passing/4105/output/Lib/Lib.cfn.pretty @@ -0,0 +1,26 @@ +Lib (tests/purus/passing/4105/Lib.purs) + +Imported Modules: +------------------------------ + Builtin, + Prim + +Exports: +------------------------------ + + +Re-Exports: +------------------------------ + + +Foreign: +------------------------------ + + +Datatypes: +------------------------------ + + + +Declarations: +------------------------------ diff --git a/tests/purus/passing/4105/output/Lib/externs.cbor b/tests/purus/passing/4105/output/Lib/externs.cbor new file mode 100644 index 000000000..17d223ba2 Binary files /dev/null and b/tests/purus/passing/4105/output/Lib/externs.cbor differ diff --git a/tests/purus/passing/4105/output/package.json b/tests/purus/passing/4105/output/package.json new file mode 100644 index 000000000..7c34deb58 --- /dev/null +++ b/tests/purus/passing/4105/output/package.json @@ -0,0 +1 @@ +{"type":"module"} \ No newline at end of file diff --git a/tests/purus/passing/4200/Lib.purs b/tests/purus/passing/4200/Lib.purs new file mode 100644 index 000000000..11c30819a --- /dev/null +++ b/tests/purus/passing/4200/Lib.purs @@ -0,0 +1,7 @@ +module Lib where + +data T :: Type -> Type +data T (msg :: Type) = E + +type TAlias :: Type -> Type +type TAlias (msg :: Type) = T msg diff --git a/tests/purus/passing/4200/output/Lib/Lib.cfn b/tests/purus/passing/4200/output/Lib/Lib.cfn new file mode 100644 index 000000000..3d734d744 --- /dev/null +++ b/tests/purus/passing/4200/output/Lib/Lib.cfn @@ -0,0 +1 @@ +{"builtWith":"0.0.1","comments":[],"dataTypes":{"_ctorDict":[[[["Lib"],{"Ident":"E"}],[["Lib"],"T"]]],"_tyDict":[[[["Lib"],"T"],{"_dDataArgs":[["msg",{"annotation":[{"end":[4,20],"name":"tests/purus/passing/4200/Lib.purs","start":[4,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}]],"_dDataCtors":[{"_cdCtorFields":[],"_cdCtorName":[["Lib"],{"Ident":"E"}]}],"_dDataTyName":[["Lib"],"T"],"_dDeclType":"data"}]]},"decls":[],"exports":["E"],"foreign":[],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[7,34],"start":[1,1]}},"moduleName":["Builtin"]},{"annotation":{"meta":null,"sourceSpan":{"end":[7,34],"start":[1,1]}},"moduleName":["Prim"]}],"moduleName":["Lib"],"modulePath":"tests/purus/passing/4200/Lib.purs","reExports":{},"sourceSpan":{"end":[7,34],"start":[1,1]}} \ No newline at end of file diff --git a/tests/purus/passing/4200/output/Lib/Lib.cfn.pretty b/tests/purus/passing/4200/output/Lib/Lib.cfn.pretty new file mode 100644 index 000000000..0b2e17fb3 --- /dev/null +++ b/tests/purus/passing/4200/output/Lib/Lib.cfn.pretty @@ -0,0 +1,27 @@ +Lib (tests/purus/passing/4200/Lib.purs) + +Imported Modules: +------------------------------ + Builtin, + Prim + +Exports: +------------------------------ + E + +Re-Exports: +------------------------------ + + +Foreign: +------------------------------ + + +Datatypes: +------------------------------ +data T (msg :: Prim.Type) = + E + + +Declarations: +------------------------------ diff --git a/tests/purus/passing/4200/output/Lib/externs.cbor b/tests/purus/passing/4200/output/Lib/externs.cbor new file mode 100644 index 000000000..447aab508 Binary files /dev/null and b/tests/purus/passing/4200/output/Lib/externs.cbor differ diff --git a/tests/purus/passing/4200/output/package.json b/tests/purus/passing/4200/output/package.json new file mode 100644 index 000000000..7c34deb58 --- /dev/null +++ b/tests/purus/passing/4200/output/package.json @@ -0,0 +1 @@ +{"type":"module"} \ No newline at end of file diff --git a/tests/purus/passing/4310/Lib.purs b/tests/purus/passing/4310/Lib.purs new file mode 100644 index 000000000..e2567a5da --- /dev/null +++ b/tests/purus/passing/4310/Lib.purs @@ -0,0 +1,20 @@ +module Lib where + +data Tuple (a :: Type) (b :: Type) = Tuple a b + +infixr 6 Tuple as /\ +infixr 6 type Tuple as /\ + +mappend :: String -> String -> String +mappend _ _ = "mappend" + +infixr 5 mappend as <> + +class Test (a :: Type) where + runTest :: a -> String + +instance Test Int where + runTest _ = "4" + +instance forall (a :: Type) (b :: Type). (Test a, Test b) => Test (a /\ b) where + runTest (a /\ b) = runTest a <> runTest b diff --git a/tests/purus/passing/4310/output/Lib/Lib.cfn b/tests/purus/passing/4310/output/Lib/Lib.cfn new file mode 100644 index 000000000..3c8486661 --- /dev/null +++ b/tests/purus/passing/4310/output/Lib/Lib.cfn @@ -0,0 +1 @@ +{"builtWith":"0.0.1","comments":[],"dataTypes":{"_ctorDict":[[[["Lib"],{"Ident":"Test$Dict"}],[["Lib"],"Test$Dict"]],[[["Lib"],{"Ident":"Tuple"}],[["Lib"],"Tuple"]]],"_tyDict":[[[["Lib"],"Test$Dict"],{"_dDataArgs":[["a",{"annotation":[{"end":[13,22],"name":"tests/purus/passing/4310/Lib.purs","start":[13,18]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}]],"_dDataCtors":[{"_cdCtorFields":[[{"Ident":"dict"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["runTest",{"annotation":[{"end":[14,25],"name":"tests/purus/passing/4310/Lib.purs","start":[14,14]},[]],"contents":[{"annotation":[{"end":[14,25],"name":"tests/purus/passing/4310/Lib.purs","start":[14,14]},[]],"contents":[{"annotation":[{"end":[14,18],"name":"tests/purus/passing/4310/Lib.purs","start":[14,16]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[14,15],"name":"tests/purus/passing/4310/Lib.purs","start":[14,14]},[]],"contents":{"kind":{"annotation":[{"end":[13,22],"name":"tests/purus/passing/4310/Lib.purs","start":[13,18]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[14,25],"name":"tests/purus/passing/4310/Lib.purs","start":[14,19]},[]],"contents":[["Prim"],"String"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"tag":"REmpty"}],"tag":"RCons"}],"tag":"TypeApp"}]],"_cdCtorName":[["Lib"],{"Ident":"Test$Dict"}]}],"_dDataTyName":[["Lib"],"Test$Dict"],"_dDeclType":"newtype"}],[[["Lib"],"Tuple"],{"_dDataArgs":[["a",{"annotation":[{"end":[3,22],"name":"tests/purus/passing/4310/Lib.purs","start":[3,18]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],["b",{"annotation":[{"end":[3,34],"name":"tests/purus/passing/4310/Lib.purs","start":[3,30]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}]],"_dDataCtors":[{"_cdCtorFields":[[{"Ident":"value0"},{"annotation":[{"end":[3,45],"name":"tests/purus/passing/4310/Lib.purs","start":[3,44]},[]],"contents":{"kind":{"annotation":[{"end":[3,22],"name":"tests/purus/passing/4310/Lib.purs","start":[3,18]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],[{"Ident":"value1"},{"annotation":[{"end":[3,47],"name":"tests/purus/passing/4310/Lib.purs","start":[3,46]},[]],"contents":{"kind":{"annotation":[{"end":[3,34],"name":"tests/purus/passing/4310/Lib.purs","start":[3,30]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"b"},"tag":"TypeVar"}]],"_cdCtorName":[["Lib"],{"Ident":"Tuple"}]}],"_dDataTyName":[["Lib"],"Tuple"],"_dDeclType":"data"}]]},"decls":[{"annotation":{"meta":null,"sourceSpan":{"end":[17,18],"start":[16,1]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":{"metaType":"IsNewtype"},"sourceSpan":{"end":[17,18],"start":[16,1]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["runTest",{"annotation":[{"end":[14,25],"name":"tests/purus/passing/4310/Lib.purs","start":[14,14]},[]],"contents":[{"annotation":[{"end":[14,25],"name":"tests/purus/passing/4310/Lib.purs","start":[14,14]},[]],"contents":[{"annotation":[{"end":[14,18],"name":"tests/purus/passing/4310/Lib.purs","start":[14,16]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[16,18],"name":"tests/purus/passing/4310/Lib.purs","start":[16,15]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[14,25],"name":"tests/purus/passing/4310/Lib.purs","start":[14,19]},[]],"contents":[["Prim"],"String"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"tag":"REmpty"},{"annotation":[{"end":[14,18],"name":"tests/purus/passing/4310/Lib.purs","start":[14,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"KindApp"}],"tag":"RCons"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Lib"],"Test$Dict"],"tag":"TypeConstructor"},{"annotation":[{"end":[16,18],"name":"tests/purus/passing/4310/Lib.purs","start":[16,15]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"Test$Dict","moduleName":["Lib"]}},"annotation":{"meta":null,"sourceSpan":{"end":[17,18],"start":[16,1]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[17,18],"start":[16,1]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["runTest",{"annotation":[{"end":[14,25],"name":"tests/purus/passing/4310/Lib.purs","start":[14,14]},[]],"contents":[{"annotation":[{"end":[14,25],"name":"tests/purus/passing/4310/Lib.purs","start":[14,14]},[]],"contents":[{"annotation":[{"end":[14,18],"name":"tests/purus/passing/4310/Lib.purs","start":[14,16]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[16,18],"name":"tests/purus/passing/4310/Lib.purs","start":[16,15]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[14,25],"name":"tests/purus/passing/4310/Lib.purs","start":[14,19]},[]],"contents":[["Prim"],"String"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"tag":"REmpty"},{"annotation":[{"end":[14,18],"name":"tests/purus/passing/4310/Lib.purs","start":[14,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"KindApp"}],"tag":"RCons"}],"tag":"TypeApp"},"value":{"literalType":"ObjectLiteral","value":[["runTest",{"annotation":{"meta":null,"sourceSpan":{"end":[17,18],"start":[17,3]}},"argument":"v","body":{"annotation":{"meta":null,"sourceSpan":{"end":[17,18],"start":[17,15]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"String"],"tag":"TypeConstructor"},"value":{"literalType":"StringLiteral","value":"4"}},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[16,18],"name":"tests/purus/passing/4310/Lib.purs","start":[16,15]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[14,25],"name":"tests/purus/passing/4310/Lib.purs","start":[14,19]},[]],"contents":[["Prim"],"String"],"tag":"TypeConstructor"}],"tag":"TypeApp"}}]]}},"kind":"App"},"identifier":"testInt"},{"annotation":{"meta":null,"sourceSpan":{"end":[14,25],"start":[14,3]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[14,25],"start":[14,3]}},"argument":"dict","body":{"annotation":{"meta":null,"sourceSpan":{"end":[14,25],"start":[14,3]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":{"metaType":"IsNewtype"},"sourceSpan":{"end":[14,25],"start":[14,3]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[14,25],"start":[14,3]}},"binderType":"VarBinder","identifier":"v","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["runTest",{"annotation":[{"end":[14,25],"name":"tests/purus/passing/4310/Lib.purs","start":[14,14]},[]],"contents":[{"annotation":[{"end":[14,25],"name":"tests/purus/passing/4310/Lib.purs","start":[14,14]},[]],"contents":[{"annotation":[{"end":[14,18],"name":"tests/purus/passing/4310/Lib.purs","start":[14,16]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[13,22],"name":"tests/purus/passing/4310/Lib.purs","start":[13,18]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[14,25],"name":"tests/purus/passing/4310/Lib.purs","start":[14,19]},[]],"contents":[["Prim"],"String"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"tag":"REmpty"},{"annotation":[{"end":[14,18],"name":"tests/purus/passing/4310/Lib.purs","start":[14,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"KindApp"}],"tag":"RCons"}],"tag":"TypeApp"}}],"constructorName":{"identifier":"Test$Dict","moduleName":["Lib"]},"typeName":{"identifier":"Test$Dict","moduleName":["Lib"]}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[14,25],"start":[14,3]}},"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[14,25],"start":[14,3]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["runTest",{"annotation":[{"end":[14,25],"name":"tests/purus/passing/4310/Lib.purs","start":[14,14]},[]],"contents":[{"annotation":[{"end":[14,25],"name":"tests/purus/passing/4310/Lib.purs","start":[14,14]},[]],"contents":[{"annotation":[{"end":[14,18],"name":"tests/purus/passing/4310/Lib.purs","start":[14,16]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[13,22],"name":"tests/purus/passing/4310/Lib.purs","start":[13,18]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[14,25],"name":"tests/purus/passing/4310/Lib.purs","start":[14,19]},[]],"contents":[["Prim"],"String"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"tag":"REmpty"},{"annotation":[{"end":[14,18],"name":"tests/purus/passing/4310/Lib.purs","start":[14,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"KindApp"}],"tag":"RCons"}],"tag":"TypeApp"},"value":{"identifier":"v","sourcePos":[14,3]}},"fieldName":"runTest","kind":"Accessor","type":{"annotation":[{"end":[14,25],"name":"tests/purus/passing/4310/Lib.purs","start":[14,14]},[]],"contents":[{"annotation":[{"end":[14,25],"name":"tests/purus/passing/4310/Lib.purs","start":[14,14]},[]],"contents":[{"annotation":[{"end":[14,18],"name":"tests/purus/passing/4310/Lib.purs","start":[14,16]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[14,15],"name":"tests/purus/passing/4310/Lib.purs","start":[14,14]},[]],"contents":{"kind":{"annotation":[{"end":[13,22],"name":"tests/purus/passing/4310/Lib.purs","start":[13,18]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[14,25],"name":"tests/purus/passing/4310/Lib.purs","start":[14,19]},[]],"contents":[["Prim"],"String"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[14,25],"start":[14,3]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Lib"],"Test$Dict"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[13,22],"name":"tests/purus/passing/4310/Lib.purs","start":[13,18]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},"value":{"identifier":"dict","sourcePos":[0,0]}}],"kind":"Case","type":{"annotation":[{"end":[14,25],"name":"tests/purus/passing/4310/Lib.purs","start":[14,14]},[]],"contents":[{"annotation":[{"end":[14,25],"name":"tests/purus/passing/4310/Lib.purs","start":[14,14]},[]],"contents":[{"annotation":[{"end":[14,18],"name":"tests/purus/passing/4310/Lib.purs","start":[14,16]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[14,15],"name":"tests/purus/passing/4310/Lib.purs","start":[14,14]},[]],"contents":{"kind":{"annotation":[{"end":[13,22],"name":"tests/purus/passing/4310/Lib.purs","start":[13,18]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[14,25],"name":"tests/purus/passing/4310/Lib.purs","start":[14,19]},[]],"contents":[["Prim"],"String"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[13,22],"name":"tests/purus/passing/4310/Lib.purs","start":[13,18]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":1,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Lib"],"Test$Dict"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[13,22],"name":"tests/purus/passing/4310/Lib.purs","start":[13,18]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[14,25],"name":"tests/purus/passing/4310/Lib.purs","start":[14,14]},[]],"contents":[{"annotation":[{"end":[14,25],"name":"tests/purus/passing/4310/Lib.purs","start":[14,14]},[]],"contents":[{"annotation":[{"end":[14,18],"name":"tests/purus/passing/4310/Lib.purs","start":[14,16]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[14,15],"name":"tests/purus/passing/4310/Lib.purs","start":[14,14]},[]],"contents":{"kind":{"annotation":[{"end":[13,22],"name":"tests/purus/passing/4310/Lib.purs","start":[13,18]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[14,25],"name":"tests/purus/passing/4310/Lib.purs","start":[14,19]},[]],"contents":[["Prim"],"String"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarVisible"},"tag":"ForAll"}},"identifier":"runTest"},{"annotation":{"meta":null,"sourceSpan":{"end":[8,38],"start":[8,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[9,24],"start":[9,1]}},"argument":"v","body":{"annotation":{"meta":null,"sourceSpan":{"end":[9,24],"start":[9,1]}},"argument":"v1","body":{"annotation":{"meta":null,"sourceSpan":{"end":[9,24],"start":[9,15]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"String"],"tag":"TypeConstructor"},"value":{"literalType":"StringLiteral","value":"mappend"}},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[8,28],"name":"tests/purus/passing/4310/Lib.purs","start":[8,22]},[]],"contents":[["Prim"],"String"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[8,38],"name":"tests/purus/passing/4310/Lib.purs","start":[8,32]},[]],"contents":[["Prim"],"String"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[8,18],"name":"tests/purus/passing/4310/Lib.purs","start":[8,12]},[]],"contents":[["Prim"],"String"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[8,38],"name":"tests/purus/passing/4310/Lib.purs","start":[8,22]},[]],"contents":[{"annotation":[{"end":[8,38],"name":"tests/purus/passing/4310/Lib.purs","start":[8,22]},[]],"contents":[{"annotation":[{"end":[8,31],"name":"tests/purus/passing/4310/Lib.purs","start":[8,29]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[8,28],"name":"tests/purus/passing/4310/Lib.purs","start":[8,22]},[]],"contents":[["Prim"],"String"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[8,38],"name":"tests/purus/passing/4310/Lib.purs","start":[8,32]},[]],"contents":[["Prim"],"String"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"identifier":"mappend"},{"annotation":{"meta":null,"sourceSpan":{"end":[20,44],"start":[19,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"argument":"dictTest","body":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"argument":"dictTest1","body":{"abstraction":{"annotation":{"meta":{"metaType":"IsNewtype"},"sourceSpan":{"end":[20,44],"start":[19,1]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["runTest",{"annotation":[{"end":[14,25],"name":"tests/purus/passing/4310/Lib.purs","start":[14,14]},[]],"contents":[{"annotation":[{"end":[14,25],"name":"tests/purus/passing/4310/Lib.purs","start":[14,14]},[]],"contents":[{"annotation":[{"end":[14,18],"name":"tests/purus/passing/4310/Lib.purs","start":[14,16]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[20,44],"name":"tests/purus/passing/4310/Lib.purs","start":[19,1]},[]],"contents":[["Lib"],"Tuple"],"tag":"TypeConstructor"},{"annotation":[{"end":[19,69],"name":"tests/purus/passing/4310/Lib.purs","start":[19,68]},[]],"contents":{"kind":{"annotation":[{"end":[19,27],"name":"tests/purus/passing/4310/Lib.purs","start":[19,23]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[19,74],"name":"tests/purus/passing/4310/Lib.purs","start":[19,73]},[]],"contents":{"kind":{"annotation":[{"end":[19,39],"name":"tests/purus/passing/4310/Lib.purs","start":[19,35]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"b"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[14,25],"name":"tests/purus/passing/4310/Lib.purs","start":[14,19]},[]],"contents":[["Prim"],"String"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"tag":"REmpty"},{"annotation":[{"end":[14,18],"name":"tests/purus/passing/4310/Lib.purs","start":[14,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"KindApp"}],"tag":"RCons"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Lib"],"Test$Dict"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[20,44],"name":"tests/purus/passing/4310/Lib.purs","start":[19,1]},[]],"contents":[["Lib"],"Tuple"],"tag":"TypeConstructor"},{"annotation":[{"end":[19,69],"name":"tests/purus/passing/4310/Lib.purs","start":[19,68]},[]],"contents":{"kind":{"annotation":[{"end":[19,27],"name":"tests/purus/passing/4310/Lib.purs","start":[19,23]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[19,74],"name":"tests/purus/passing/4310/Lib.purs","start":[19,73]},[]],"contents":{"kind":{"annotation":[{"end":[19,39],"name":"tests/purus/passing/4310/Lib.purs","start":[19,35]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"b"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"Test$Dict","moduleName":["Lib"]}},"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["runTest",{"annotation":[{"end":[14,25],"name":"tests/purus/passing/4310/Lib.purs","start":[14,14]},[]],"contents":[{"annotation":[{"end":[14,25],"name":"tests/purus/passing/4310/Lib.purs","start":[14,14]},[]],"contents":[{"annotation":[{"end":[14,18],"name":"tests/purus/passing/4310/Lib.purs","start":[14,16]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[20,44],"name":"tests/purus/passing/4310/Lib.purs","start":[19,1]},[]],"contents":[["Lib"],"Tuple"],"tag":"TypeConstructor"},{"annotation":[{"end":[19,69],"name":"tests/purus/passing/4310/Lib.purs","start":[19,68]},[]],"contents":{"kind":{"annotation":[{"end":[19,27],"name":"tests/purus/passing/4310/Lib.purs","start":[19,23]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[19,74],"name":"tests/purus/passing/4310/Lib.purs","start":[19,73]},[]],"contents":{"kind":{"annotation":[{"end":[19,39],"name":"tests/purus/passing/4310/Lib.purs","start":[19,35]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"b"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[14,25],"name":"tests/purus/passing/4310/Lib.purs","start":[14,19]},[]],"contents":[["Prim"],"String"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"tag":"REmpty"},{"annotation":[{"end":[14,18],"name":"tests/purus/passing/4310/Lib.purs","start":[14,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"KindApp"}],"tag":"RCons"}],"tag":"TypeApp"},"value":{"literalType":"ObjectLiteral","value":[["runTest",{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"argument":"v","body":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":{"constructorType":"ProductType","identifiers":["value0","value1"],"metaType":"IsConstructor"},"sourceSpan":{"end":[20,16],"start":[20,14]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[20,13],"start":[20,12]}},"binderType":"VarBinder","identifier":"a","type":{"annotation":[{"end":[19,69],"name":"tests/purus/passing/4310/Lib.purs","start":[19,68]},[]],"contents":{"kind":{"annotation":[{"end":[19,27],"name":"tests/purus/passing/4310/Lib.purs","start":[19,23]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}},{"annotation":{"meta":null,"sourceSpan":{"end":[20,18],"start":[20,17]}},"binderType":"VarBinder","identifier":"b","type":{"annotation":[{"end":[19,74],"name":"tests/purus/passing/4310/Lib.purs","start":[19,73]},[]],"contents":{"kind":{"annotation":[{"end":[19,39],"name":"tests/purus/passing/4310/Lib.purs","start":[19,35]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"b"},"tag":"TypeVar"}}],"constructorName":{"identifier":"Tuple","moduleName":["Lib"]},"typeName":{"identifier":"Tuple","moduleName":["Lib"]}}],"expression":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[20,34],"start":[20,32]}},"kind":"Var","type":{"annotation":[{"end":[8,38],"name":"tests/purus/passing/4310/Lib.purs","start":[8,12]},[]],"contents":[{"annotation":[{"end":[8,38],"name":"tests/purus/passing/4310/Lib.purs","start":[8,12]},[]],"contents":[{"annotation":[{"end":[8,21],"name":"tests/purus/passing/4310/Lib.purs","start":[8,19]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[8,18],"name":"tests/purus/passing/4310/Lib.purs","start":[8,12]},[]],"contents":[["Prim"],"String"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[8,38],"name":"tests/purus/passing/4310/Lib.purs","start":[8,22]},[]],"contents":[{"annotation":[{"end":[8,38],"name":"tests/purus/passing/4310/Lib.purs","start":[8,22]},[]],"contents":[{"annotation":[{"end":[8,31],"name":"tests/purus/passing/4310/Lib.purs","start":[8,29]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[8,28],"name":"tests/purus/passing/4310/Lib.purs","start":[8,22]},[]],"contents":[["Prim"],"String"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[8,38],"name":"tests/purus/passing/4310/Lib.purs","start":[8,32]},[]],"contents":[["Prim"],"String"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"mappend","moduleName":["Lib"]}},"annotation":{"meta":null,"sourceSpan":{"end":[20,44],"start":[20,22]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[20,29],"start":[20,22]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[13,22],"name":"tests/purus/passing/4310/Lib.purs","start":[13,18]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":1,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Lib"],"Test$Dict"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[13,22],"name":"tests/purus/passing/4310/Lib.purs","start":[13,18]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[14,25],"name":"tests/purus/passing/4310/Lib.purs","start":[14,14]},[]],"contents":[{"annotation":[{"end":[14,25],"name":"tests/purus/passing/4310/Lib.purs","start":[14,14]},[]],"contents":[{"annotation":[{"end":[14,18],"name":"tests/purus/passing/4310/Lib.purs","start":[14,16]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[14,15],"name":"tests/purus/passing/4310/Lib.purs","start":[14,14]},[]],"contents":{"kind":{"annotation":[{"end":[13,22],"name":"tests/purus/passing/4310/Lib.purs","start":[13,18]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[14,25],"name":"tests/purus/passing/4310/Lib.purs","start":[14,19]},[]],"contents":[["Prim"],"String"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarVisible"},"tag":"ForAll"},"value":{"identifier":"runTest","moduleName":["Lib"]}},"annotation":{"meta":null,"sourceSpan":{"end":[20,31],"start":[20,22]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Lib"],"Test$Dict"],"tag":"TypeConstructor"},{"annotation":[{"end":[19,49],"name":"tests/purus/passing/4310/Lib.purs","start":[19,48]},[]],"contents":{"kind":{"annotation":[{"end":[19,27],"name":"tests/purus/passing/4310/Lib.purs","start":[19,23]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},"value":{"identifier":"dictTest","sourcePos":[0,0]}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[20,31],"start":[20,22]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[20,31],"start":[20,30]}},"kind":"Var","type":{"annotation":[{"end":[19,69],"name":"tests/purus/passing/4310/Lib.purs","start":[19,68]},[]],"contents":{"kind":{"annotation":[{"end":[19,27],"name":"tests/purus/passing/4310/Lib.purs","start":[19,23]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"},"value":{"identifier":"a","sourcePos":[20,12]}},"kind":"App"},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[20,44],"start":[20,22]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[20,42],"start":[20,35]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[13,22],"name":"tests/purus/passing/4310/Lib.purs","start":[13,18]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":1,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Lib"],"Test$Dict"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[13,22],"name":"tests/purus/passing/4310/Lib.purs","start":[13,18]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[14,25],"name":"tests/purus/passing/4310/Lib.purs","start":[14,14]},[]],"contents":[{"annotation":[{"end":[14,25],"name":"tests/purus/passing/4310/Lib.purs","start":[14,14]},[]],"contents":[{"annotation":[{"end":[14,18],"name":"tests/purus/passing/4310/Lib.purs","start":[14,16]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[14,15],"name":"tests/purus/passing/4310/Lib.purs","start":[14,14]},[]],"contents":{"kind":{"annotation":[{"end":[13,22],"name":"tests/purus/passing/4310/Lib.purs","start":[13,18]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[14,25],"name":"tests/purus/passing/4310/Lib.purs","start":[14,19]},[]],"contents":[["Prim"],"String"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarVisible"},"tag":"ForAll"},"value":{"identifier":"runTest","moduleName":["Lib"]}},"annotation":{"meta":null,"sourceSpan":{"end":[20,44],"start":[20,35]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Lib"],"Test$Dict"],"tag":"TypeConstructor"},{"annotation":[{"end":[19,57],"name":"tests/purus/passing/4310/Lib.purs","start":[19,56]},[]],"contents":{"kind":{"annotation":[{"end":[19,39],"name":"tests/purus/passing/4310/Lib.purs","start":[19,35]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"b"},"tag":"TypeVar"}],"tag":"TypeApp"},"value":{"identifier":"dictTest1","sourcePos":[0,0]}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[20,44],"start":[20,35]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[20,44],"start":[20,43]}},"kind":"Var","type":{"annotation":[{"end":[19,74],"name":"tests/purus/passing/4310/Lib.purs","start":[19,73]},[]],"contents":{"kind":{"annotation":[{"end":[19,39],"name":"tests/purus/passing/4310/Lib.purs","start":[19,35]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"b"},"tag":"TypeVar"},"value":{"identifier":"b","sourcePos":[20,17]}},"kind":"App"},"kind":"App"},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[20,44],"start":[20,3]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[20,44],"name":"tests/purus/passing/4310/Lib.purs","start":[19,1]},[]],"contents":[["Lib"],"Tuple"],"tag":"TypeConstructor"},{"annotation":[{"end":[19,69],"name":"tests/purus/passing/4310/Lib.purs","start":[19,68]},[]],"contents":{"kind":{"annotation":[{"end":[19,27],"name":"tests/purus/passing/4310/Lib.purs","start":[19,23]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[19,74],"name":"tests/purus/passing/4310/Lib.purs","start":[19,73]},[]],"contents":{"kind":{"annotation":[{"end":[19,39],"name":"tests/purus/passing/4310/Lib.purs","start":[19,35]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"b"},"tag":"TypeVar"}],"tag":"TypeApp"},"value":{"identifier":"v","sourcePos":[0,0]}}],"kind":"Case","type":{"annotation":[{"end":[14,25],"name":"tests/purus/passing/4310/Lib.purs","start":[14,19]},[]],"contents":[["Prim"],"String"],"tag":"TypeConstructor"}},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[20,44],"name":"tests/purus/passing/4310/Lib.purs","start":[19,1]},[]],"contents":[["Lib"],"Tuple"],"tag":"TypeConstructor"},{"annotation":[{"end":[19,69],"name":"tests/purus/passing/4310/Lib.purs","start":[19,68]},[]],"contents":{"kind":{"annotation":[{"end":[19,27],"name":"tests/purus/passing/4310/Lib.purs","start":[19,23]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[19,74],"name":"tests/purus/passing/4310/Lib.purs","start":[19,73]},[]],"contents":{"kind":{"annotation":[{"end":[19,39],"name":"tests/purus/passing/4310/Lib.purs","start":[19,35]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"b"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[14,25],"name":"tests/purus/passing/4310/Lib.purs","start":[14,19]},[]],"contents":[["Prim"],"String"],"tag":"TypeConstructor"}],"tag":"TypeApp"}}]]}},"kind":"App"},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Lib"],"Test$Dict"],"tag":"TypeConstructor"},{"annotation":[{"end":[19,57],"name":"tests/purus/passing/4310/Lib.purs","start":[19,56]},[]],"contents":{"kind":{"annotation":[{"end":[19,39],"name":"tests/purus/passing/4310/Lib.purs","start":[19,35]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"b"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Lib"],"Test$Dict"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[20,44],"name":"tests/purus/passing/4310/Lib.purs","start":[19,1]},[]],"contents":[["Lib"],"Tuple"],"tag":"TypeConstructor"},{"annotation":[{"end":[19,69],"name":"tests/purus/passing/4310/Lib.purs","start":[19,68]},[]],"contents":{"kind":{"annotation":[{"end":[19,27],"name":"tests/purus/passing/4310/Lib.purs","start":[19,23]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[19,74],"name":"tests/purus/passing/4310/Lib.purs","start":[19,73]},[]],"contents":{"kind":{"annotation":[{"end":[19,39],"name":"tests/purus/passing/4310/Lib.purs","start":[19,35]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"b"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[19,27],"name":"tests/purus/passing/4310/Lib.purs","start":[19,23]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":3,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"b","kind":{"annotation":[{"end":[19,39],"name":"tests/purus/passing/4310/Lib.purs","start":[19,35]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":2,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Lib"],"Test$Dict"],"tag":"TypeConstructor"},{"annotation":[{"end":[19,49],"name":"tests/purus/passing/4310/Lib.purs","start":[19,48]},[]],"contents":{"kind":{"annotation":[{"end":[19,27],"name":"tests/purus/passing/4310/Lib.purs","start":[19,23]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Lib"],"Test$Dict"],"tag":"TypeConstructor"},{"annotation":[{"end":[19,57],"name":"tests/purus/passing/4310/Lib.purs","start":[19,56]},[]],"contents":{"kind":{"annotation":[{"end":[19,39],"name":"tests/purus/passing/4310/Lib.purs","start":[19,35]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"b"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Lib"],"Test$Dict"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[20,44],"name":"tests/purus/passing/4310/Lib.purs","start":[19,1]},[]],"contents":[["Lib"],"Tuple"],"tag":"TypeConstructor"},{"annotation":[{"end":[19,69],"name":"tests/purus/passing/4310/Lib.purs","start":[19,68]},[]],"contents":{"kind":{"annotation":[{"end":[19,27],"name":"tests/purus/passing/4310/Lib.purs","start":[19,23]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[19,74],"name":"tests/purus/passing/4310/Lib.purs","start":[19,73]},[]],"contents":{"kind":{"annotation":[{"end":[19,39],"name":"tests/purus/passing/4310/Lib.purs","start":[19,35]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"b"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"identifier":"test/\\"}],"exports":["runTest","Tuple","mappend","testInt","test/\\"],"foreign":[],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[20,44],"start":[1,1]}},"moduleName":["Builtin"]},{"annotation":{"meta":null,"sourceSpan":{"end":[20,44],"start":[1,1]}},"moduleName":["Lib"]},{"annotation":{"meta":null,"sourceSpan":{"end":[20,44],"start":[1,1]}},"moduleName":["Prim"]}],"moduleName":["Lib"],"modulePath":"tests/purus/passing/4310/Lib.purs","reExports":{},"sourceSpan":{"end":[20,44],"start":[1,1]}} \ No newline at end of file diff --git a/tests/purus/passing/4310/output/Lib/Lib.cfn.pretty b/tests/purus/passing/4310/output/Lib/Lib.cfn.pretty new file mode 100644 index 000000000..dfd3255a4 --- /dev/null +++ b/tests/purus/passing/4310/output/Lib/Lib.cfn.pretty @@ -0,0 +1,84 @@ +Lib (tests/purus/passing/4310/Lib.purs) + +Imported Modules: +------------------------------ + Builtin, + Lib, + Prim + +Exports: +------------------------------ + runTest, + Tuple, + mappend, + testInt, + test/\ + +Re-Exports: +------------------------------ + + +Foreign: +------------------------------ + + +Datatypes: +------------------------------ +newtype Test$Dict (a :: Prim.Type) = + Test$Dict ({ runTest :: ((a :: Prim.Type) -> (Prim.String)) }) + +data Tuple (a :: Prim.Type) (b :: Prim.Type) = + Tuple ((a :: Prim.Type)) ((b :: Prim.Type)) + + +Declarations: +------------------------------ +testInt :: (Lib.Test$Dict (Prim.Int)) +testInt = + (Test$Dict: ({ runTest :: (Prim.Int -> (Prim.String)) } -> + ((Lib.Test$Dict (Prim.Int))))) + ({ runTest: \(v: Prim.Int) -> ("4": Prim.String) }: { + runTest :: (Prim.Int -> + (Prim.String)) + }) + +runTest :: forall (@a :: Prim.Type). ((Lib.Test$Dict ((a :: Prim.Type))) -> (((a :: Prim.Type) -> (Prim.String)))) +runTest = + \(dict: (Lib.Test$Dict ((a :: Prim.Type)))) -> + case (dict: (Lib.Test$Dict ((a :: Prim.Type)))) of + Test$Dict v -> + (v: { runTest :: ((a :: Prim.Type) -> (Prim.String)) }) + .runTest + +mappend :: (Prim.String -> ((Prim.String -> (Prim.String)))) +mappend = \(v: Prim.String) -> \(v1: Prim.String) -> ("mappend": Prim.String) + +test/\ :: forall (a :: Prim.Type) (b :: Prim.Type). ((Lib.Test$Dict ((a :: Prim.Type))) -> (((Lib.Test$Dict ((b :: Prim.Type))) -> ((Lib.Test$Dict (((Lib.Tuple ((a :: Prim.Type))) ((b :: Prim.Type))))))))) +test/\ = + \(dictTest: (Lib.Test$Dict ((a :: Prim.Type)))) -> + \(dictTest1: (Lib.Test$Dict ((b :: Prim.Type)))) -> + (Test$Dict: ({ + runTest :: (((Lib.Tuple + ((a :: Prim.Type))) ((b :: Prim.Type))) -> + (Prim.String)) + } -> + ((Lib.Test$Dict (((Lib.Tuple ((a :: Prim.Type))) ((b :: Prim.Type)))))))) + ({ + runTest: \(v: ((Lib.Tuple ((a :: Prim.Type))) ((b :: Prim.Type)))) -> + case (v: ((Lib.Tuple ((a :: Prim.Type))) ((b :: Prim.Type)))) of + Tuple a b -> + (mappend: (Prim.String -> ((Prim.String -> (Prim.String))))) + ((runTest: forall (@a :: Prim.Type). ((Lib.Test$Dict + ((a :: Prim.Type))) -> + (((a :: Prim.Type) -> (Prim.String))))) + (dictTest: (Lib.Test$Dict ((a :: Prim.Type)))) + (a: (a :: Prim.Type))) + ((runTest: forall (@a :: Prim.Type). ((Lib.Test$Dict + ((a :: Prim.Type))) -> + (((a :: Prim.Type) -> (Prim.String))))) + (dictTest1: (Lib.Test$Dict ((b :: Prim.Type)))) + (b: (b :: Prim.Type))) + }: { + runTest :: (((Lib.Tuple ((a :: Prim.Type))) ((b :: Prim.Type))) -> + (Prim.String)) + }) \ No newline at end of file diff --git a/tests/purus/passing/4310/output/Lib/externs.cbor b/tests/purus/passing/4310/output/Lib/externs.cbor new file mode 100644 index 000000000..456927f71 Binary files /dev/null and b/tests/purus/passing/4310/output/Lib/externs.cbor differ diff --git a/tests/purus/passing/4310/output/package.json b/tests/purus/passing/4310/output/package.json new file mode 100644 index 000000000..7c34deb58 --- /dev/null +++ b/tests/purus/passing/4310/output/package.json @@ -0,0 +1 @@ +{"type":"module"} \ No newline at end of file diff --git a/tests/purus/passing/ClassRefSyntax/Lib.purs b/tests/purus/passing/ClassRefSyntax/Lib.purs new file mode 100644 index 000000000..b044a4698 --- /dev/null +++ b/tests/purus/passing/ClassRefSyntax/Lib.purs @@ -0,0 +1,5 @@ +module Lib (class X, go) where + +class X (a :: Prim.Type) where + go :: a -> a + diff --git a/tests/purus/passing/ClassRefSyntax/output/Lib/Lib.cfn b/tests/purus/passing/ClassRefSyntax/output/Lib/Lib.cfn new file mode 100644 index 000000000..8d7ae6b9e --- /dev/null +++ b/tests/purus/passing/ClassRefSyntax/output/Lib/Lib.cfn @@ -0,0 +1 @@ +{"builtWith":"0.0.1","comments":[],"dataTypes":{"_ctorDict":[[[["Lib"],{"Ident":"X$Dict"}],[["Lib"],"X$Dict"]]],"_tyDict":[[[["Lib"],"X$Dict"],{"_dDataArgs":[["a",{"annotation":[{"end":[3,24],"name":"tests/purus/passing/ClassRefSyntax/Lib.purs","start":[3,15]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}]],"_dDataCtors":[{"_cdCtorFields":[[{"Ident":"dict"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["go",{"annotation":[{"end":[4,15],"name":"tests/purus/passing/ClassRefSyntax/Lib.purs","start":[4,9]},[]],"contents":[{"annotation":[{"end":[4,15],"name":"tests/purus/passing/ClassRefSyntax/Lib.purs","start":[4,9]},[]],"contents":[{"annotation":[{"end":[4,13],"name":"tests/purus/passing/ClassRefSyntax/Lib.purs","start":[4,11]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[4,10],"name":"tests/purus/passing/ClassRefSyntax/Lib.purs","start":[4,9]},[]],"contents":{"kind":{"annotation":[{"end":[3,24],"name":"tests/purus/passing/ClassRefSyntax/Lib.purs","start":[3,15]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[4,15],"name":"tests/purus/passing/ClassRefSyntax/Lib.purs","start":[4,14]},[]],"contents":{"kind":{"annotation":[{"end":[3,24],"name":"tests/purus/passing/ClassRefSyntax/Lib.purs","start":[3,15]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"tag":"REmpty"}],"tag":"RCons"}],"tag":"TypeApp"}]],"_cdCtorName":[["Lib"],{"Ident":"X$Dict"}]}],"_dDataTyName":[["Lib"],"X$Dict"],"_dDeclType":"newtype"}]]},"decls":[{"annotation":{"meta":null,"sourceSpan":{"end":[4,15],"start":[4,3]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[4,15],"start":[4,3]}},"argument":"dict","body":{"annotation":{"meta":null,"sourceSpan":{"end":[4,15],"start":[4,3]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":{"metaType":"IsNewtype"},"sourceSpan":{"end":[4,15],"start":[4,3]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[4,15],"start":[4,3]}},"binderType":"VarBinder","identifier":"v","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["go",{"annotation":[{"end":[4,15],"name":"tests/purus/passing/ClassRefSyntax/Lib.purs","start":[4,9]},[]],"contents":[{"annotation":[{"end":[4,15],"name":"tests/purus/passing/ClassRefSyntax/Lib.purs","start":[4,9]},[]],"contents":[{"annotation":[{"end":[4,13],"name":"tests/purus/passing/ClassRefSyntax/Lib.purs","start":[4,11]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[3,24],"name":"tests/purus/passing/ClassRefSyntax/Lib.purs","start":[3,15]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[3,24],"name":"tests/purus/passing/ClassRefSyntax/Lib.purs","start":[3,15]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"tag":"REmpty"},{"annotation":[{"end":[4,13],"name":"tests/purus/passing/ClassRefSyntax/Lib.purs","start":[4,11]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"KindApp"}],"tag":"RCons"}],"tag":"TypeApp"}}],"constructorName":{"identifier":"X$Dict","moduleName":["Lib"]},"typeName":{"identifier":"X$Dict","moduleName":["Lib"]}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[4,15],"start":[4,3]}},"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[4,15],"start":[4,3]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["go",{"annotation":[{"end":[4,15],"name":"tests/purus/passing/ClassRefSyntax/Lib.purs","start":[4,9]},[]],"contents":[{"annotation":[{"end":[4,15],"name":"tests/purus/passing/ClassRefSyntax/Lib.purs","start":[4,9]},[]],"contents":[{"annotation":[{"end":[4,13],"name":"tests/purus/passing/ClassRefSyntax/Lib.purs","start":[4,11]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[3,24],"name":"tests/purus/passing/ClassRefSyntax/Lib.purs","start":[3,15]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[3,24],"name":"tests/purus/passing/ClassRefSyntax/Lib.purs","start":[3,15]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"tag":"REmpty"},{"annotation":[{"end":[4,13],"name":"tests/purus/passing/ClassRefSyntax/Lib.purs","start":[4,11]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"KindApp"}],"tag":"RCons"}],"tag":"TypeApp"},"value":{"identifier":"v","sourcePos":[4,3]}},"fieldName":"go","kind":"Accessor","type":{"annotation":[{"end":[4,15],"name":"tests/purus/passing/ClassRefSyntax/Lib.purs","start":[4,9]},[]],"contents":[{"annotation":[{"end":[4,15],"name":"tests/purus/passing/ClassRefSyntax/Lib.purs","start":[4,9]},[]],"contents":[{"annotation":[{"end":[4,13],"name":"tests/purus/passing/ClassRefSyntax/Lib.purs","start":[4,11]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[4,10],"name":"tests/purus/passing/ClassRefSyntax/Lib.purs","start":[4,9]},[]],"contents":{"kind":{"annotation":[{"end":[3,24],"name":"tests/purus/passing/ClassRefSyntax/Lib.purs","start":[3,15]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[4,15],"name":"tests/purus/passing/ClassRefSyntax/Lib.purs","start":[4,14]},[]],"contents":{"kind":{"annotation":[{"end":[3,24],"name":"tests/purus/passing/ClassRefSyntax/Lib.purs","start":[3,15]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[4,15],"start":[4,3]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Lib"],"X$Dict"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[3,24],"name":"tests/purus/passing/ClassRefSyntax/Lib.purs","start":[3,15]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},"value":{"identifier":"dict","sourcePos":[0,0]}}],"kind":"Case","type":{"annotation":[{"end":[4,15],"name":"tests/purus/passing/ClassRefSyntax/Lib.purs","start":[4,9]},[]],"contents":[{"annotation":[{"end":[4,15],"name":"tests/purus/passing/ClassRefSyntax/Lib.purs","start":[4,9]},[]],"contents":[{"annotation":[{"end":[4,13],"name":"tests/purus/passing/ClassRefSyntax/Lib.purs","start":[4,11]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[4,10],"name":"tests/purus/passing/ClassRefSyntax/Lib.purs","start":[4,9]},[]],"contents":{"kind":{"annotation":[{"end":[3,24],"name":"tests/purus/passing/ClassRefSyntax/Lib.purs","start":[3,15]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[4,15],"name":"tests/purus/passing/ClassRefSyntax/Lib.purs","start":[4,14]},[]],"contents":{"kind":{"annotation":[{"end":[3,24],"name":"tests/purus/passing/ClassRefSyntax/Lib.purs","start":[3,15]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[3,24],"name":"tests/purus/passing/ClassRefSyntax/Lib.purs","start":[3,15]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":0,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Lib"],"X$Dict"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[3,24],"name":"tests/purus/passing/ClassRefSyntax/Lib.purs","start":[3,15]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[4,15],"name":"tests/purus/passing/ClassRefSyntax/Lib.purs","start":[4,9]},[]],"contents":[{"annotation":[{"end":[4,15],"name":"tests/purus/passing/ClassRefSyntax/Lib.purs","start":[4,9]},[]],"contents":[{"annotation":[{"end":[4,13],"name":"tests/purus/passing/ClassRefSyntax/Lib.purs","start":[4,11]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[4,10],"name":"tests/purus/passing/ClassRefSyntax/Lib.purs","start":[4,9]},[]],"contents":{"kind":{"annotation":[{"end":[3,24],"name":"tests/purus/passing/ClassRefSyntax/Lib.purs","start":[3,15]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[4,15],"name":"tests/purus/passing/ClassRefSyntax/Lib.purs","start":[4,14]},[]],"contents":{"kind":{"annotation":[{"end":[3,24],"name":"tests/purus/passing/ClassRefSyntax/Lib.purs","start":[3,15]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarVisible"},"tag":"ForAll"}},"identifier":"go"}],"exports":["go"],"foreign":[],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[4,15],"start":[1,1]}},"moduleName":["Builtin"]},{"annotation":{"meta":null,"sourceSpan":{"end":[4,15],"start":[1,1]}},"moduleName":["Lib"]},{"annotation":{"meta":null,"sourceSpan":{"end":[4,15],"start":[1,1]}},"moduleName":["Prim"]}],"moduleName":["Lib"],"modulePath":"tests/purus/passing/ClassRefSyntax/Lib.purs","reExports":{},"sourceSpan":{"end":[4,15],"start":[1,1]}} \ No newline at end of file diff --git a/tests/purus/passing/ClassRefSyntax/output/Lib/Lib.cfn.pretty b/tests/purus/passing/ClassRefSyntax/output/Lib/Lib.cfn.pretty new file mode 100644 index 000000000..9c3b36b48 --- /dev/null +++ b/tests/purus/passing/ClassRefSyntax/output/Lib/Lib.cfn.pretty @@ -0,0 +1,33 @@ +Lib (tests/purus/passing/ClassRefSyntax/Lib.purs) + +Imported Modules: +------------------------------ + Builtin, + Lib, + Prim + +Exports: +------------------------------ + go + +Re-Exports: +------------------------------ + + +Foreign: +------------------------------ + + +Datatypes: +------------------------------ +newtype X$Dict (a :: Prim.Type) = + X$Dict ({ go :: ((a :: Prim.Type) -> ((a :: Prim.Type))) }) + + +Declarations: +------------------------------ +go :: forall (@a :: Prim.Type). ((Lib.X$Dict ((a :: Prim.Type))) -> (((a :: Prim.Type) -> ((a :: Prim.Type))))) +go = + \(dict: (Lib.X$Dict ((a :: Prim.Type)))) -> + case (dict: (Lib.X$Dict ((a :: Prim.Type)))) of + X$Dict v -> (v: { go :: ((a :: Prim.Type) -> ((a :: Prim.Type))) }).go \ No newline at end of file diff --git a/tests/purus/passing/ClassRefSyntax/output/Lib/externs.cbor b/tests/purus/passing/ClassRefSyntax/output/Lib/externs.cbor new file mode 100644 index 000000000..0fe614aef Binary files /dev/null and b/tests/purus/passing/ClassRefSyntax/output/Lib/externs.cbor differ diff --git a/tests/purus/passing/ClassRefSyntax/output/package.json b/tests/purus/passing/ClassRefSyntax/output/package.json new file mode 100644 index 000000000..7c34deb58 --- /dev/null +++ b/tests/purus/passing/ClassRefSyntax/output/package.json @@ -0,0 +1 @@ +{"type":"module"} \ No newline at end of file diff --git a/tests/purus/passing/Coercible/Lib.purs b/tests/purus/passing/Coercible/Lib.purs new file mode 100644 index 000000000..84dc65018 --- /dev/null +++ b/tests/purus/passing/Coercible/Lib.purs @@ -0,0 +1,13 @@ +module Coercible.Lib + ( module Coercible.Lib2 + , NTLib1 (..) + , NTLib3 (..) + ) where + +import Coercible.Lib2 +import Prim (Type) + +newtype NTLib1 (a :: Type) = NTLib1 a + +newtype NTLib3 (a :: Type) (b :: Type) = NTLib3 a +type role NTLib3 representational representational diff --git a/tests/purus/passing/Coercible/Lib2.purs b/tests/purus/passing/Coercible/Lib2.purs new file mode 100644 index 000000000..547964773 --- /dev/null +++ b/tests/purus/passing/Coercible/Lib2.purs @@ -0,0 +1,5 @@ +module Coercible.Lib2 where + +import Prim (Type) + +newtype NTLib2 (a :: Type) = NTLib2 a diff --git a/tests/purus/passing/Coercible/output/Coercible.Lib/Coercible.Lib.cfn b/tests/purus/passing/Coercible/output/Coercible.Lib/Coercible.Lib.cfn new file mode 100644 index 000000000..f3c57ce4d --- /dev/null +++ b/tests/purus/passing/Coercible/output/Coercible.Lib/Coercible.Lib.cfn @@ -0,0 +1 @@ +{"builtWith":"0.0.1","comments":[],"dataTypes":{"_ctorDict":[[[["Coercible","Lib"],{"Ident":"NTLib1"}],[["Coercible","Lib"],"NTLib1"]],[[["Coercible","Lib"],{"Ident":"NTLib3"}],[["Coercible","Lib"],"NTLib3"]]],"_tyDict":[[[["Coercible","Lib"],"NTLib1"],{"_dDataArgs":[["a",{"annotation":[{"end":[10,26],"name":"tests/purus/passing/Coercible/Lib.purs","start":[10,22]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}]],"_dDataCtors":[{"_cdCtorFields":[[{"Ident":"value0"},{"annotation":[{"end":[10,38],"name":"tests/purus/passing/Coercible/Lib.purs","start":[10,37]},[]],"contents":{"kind":{"annotation":[{"end":[10,26],"name":"tests/purus/passing/Coercible/Lib.purs","start":[10,22]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}]],"_cdCtorName":[["Coercible","Lib"],{"Ident":"NTLib1"}]}],"_dDataTyName":[["Coercible","Lib"],"NTLib1"],"_dDeclType":"newtype"}],[[["Coercible","Lib"],"NTLib3"],{"_dDataArgs":[["a",{"annotation":[{"end":[12,26],"name":"tests/purus/passing/Coercible/Lib.purs","start":[12,22]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],["b",{"annotation":[{"end":[12,38],"name":"tests/purus/passing/Coercible/Lib.purs","start":[12,34]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}]],"_dDataCtors":[{"_cdCtorFields":[[{"Ident":"value0"},{"annotation":[{"end":[12,50],"name":"tests/purus/passing/Coercible/Lib.purs","start":[12,49]},[]],"contents":{"kind":{"annotation":[{"end":[12,26],"name":"tests/purus/passing/Coercible/Lib.purs","start":[12,22]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}]],"_cdCtorName":[["Coercible","Lib"],{"Ident":"NTLib3"}]}],"_dDataTyName":[["Coercible","Lib"],"NTLib3"],"_dDeclType":"newtype"}]]},"decls":[],"exports":["NTLib1","NTLib3"],"foreign":[],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[13,51],"start":[1,1]}},"moduleName":["Builtin"]},{"annotation":{"meta":null,"sourceSpan":{"end":[7,22],"start":[7,1]}},"moduleName":["Coercible","Lib2"]},{"annotation":{"meta":null,"sourceSpan":{"end":[8,19],"start":[8,1]}},"moduleName":["Prim"]}],"moduleName":["Coercible","Lib"],"modulePath":"tests/purus/passing/Coercible/Lib.purs","reExports":{"Coercible.Lib2":["NTLib2"]},"sourceSpan":{"end":[13,51],"start":[1,1]}} \ No newline at end of file diff --git a/tests/purus/passing/Coercible/output/Coercible.Lib/Coercible.Lib.cfn.pretty b/tests/purus/passing/Coercible/output/Coercible.Lib/Coercible.Lib.cfn.pretty new file mode 100644 index 000000000..0650d26e9 --- /dev/null +++ b/tests/purus/passing/Coercible/output/Coercible.Lib/Coercible.Lib.cfn.pretty @@ -0,0 +1,32 @@ +Coercible.Lib (tests/purus/passing/Coercible/Lib.purs) + +Imported Modules: +------------------------------ + Builtin, + Coercible.Lib2, + Prim + +Exports: +------------------------------ + NTLib1, + NTLib3 + +Re-Exports: +------------------------------ + Coercible.Lib2.NTLib2 + +Foreign: +------------------------------ + + +Datatypes: +------------------------------ +newtype NTLib1 (a :: Prim.Type) = + NTLib1 ((a :: Prim.Type)) + +newtype NTLib3 (a :: Prim.Type) (b :: Prim.Type) = + NTLib3 ((a :: Prim.Type)) + + +Declarations: +------------------------------ diff --git a/tests/purus/passing/Coercible/output/Coercible.Lib/externs.cbor b/tests/purus/passing/Coercible/output/Coercible.Lib/externs.cbor new file mode 100644 index 000000000..f6c084aee Binary files /dev/null and b/tests/purus/passing/Coercible/output/Coercible.Lib/externs.cbor differ diff --git a/tests/purus/passing/Coercible/output/Coercible.Lib2/Coercible.Lib2.cfn b/tests/purus/passing/Coercible/output/Coercible.Lib2/Coercible.Lib2.cfn new file mode 100644 index 000000000..8f6758dcb --- /dev/null +++ b/tests/purus/passing/Coercible/output/Coercible.Lib2/Coercible.Lib2.cfn @@ -0,0 +1 @@ +{"builtWith":"0.0.1","comments":[],"dataTypes":{"_ctorDict":[[[["Coercible","Lib2"],{"Ident":"NTLib2"}],[["Coercible","Lib2"],"NTLib2"]]],"_tyDict":[[[["Coercible","Lib2"],"NTLib2"],{"_dDataArgs":[["a",{"annotation":[{"end":[5,26],"name":"tests/purus/passing/Coercible/Lib2.purs","start":[5,22]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}]],"_dDataCtors":[{"_cdCtorFields":[[{"Ident":"value0"},{"annotation":[{"end":[5,38],"name":"tests/purus/passing/Coercible/Lib2.purs","start":[5,37]},[]],"contents":{"kind":{"annotation":[{"end":[5,26],"name":"tests/purus/passing/Coercible/Lib2.purs","start":[5,22]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}]],"_cdCtorName":[["Coercible","Lib2"],{"Ident":"NTLib2"}]}],"_dDataTyName":[["Coercible","Lib2"],"NTLib2"],"_dDeclType":"newtype"}]]},"decls":[],"exports":["NTLib2"],"foreign":[],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[5,38],"start":[1,1]}},"moduleName":["Builtin"]},{"annotation":{"meta":null,"sourceSpan":{"end":[3,19],"start":[3,1]}},"moduleName":["Prim"]}],"moduleName":["Coercible","Lib2"],"modulePath":"tests/purus/passing/Coercible/Lib2.purs","reExports":{},"sourceSpan":{"end":[5,38],"start":[1,1]}} \ No newline at end of file diff --git a/tests/purus/passing/Coercible/output/Coercible.Lib2/Coercible.Lib2.cfn.pretty b/tests/purus/passing/Coercible/output/Coercible.Lib2/Coercible.Lib2.cfn.pretty new file mode 100644 index 000000000..9bdb92256 --- /dev/null +++ b/tests/purus/passing/Coercible/output/Coercible.Lib2/Coercible.Lib2.cfn.pretty @@ -0,0 +1,27 @@ +Coercible.Lib2 (tests/purus/passing/Coercible/Lib2.purs) + +Imported Modules: +------------------------------ + Builtin, + Prim + +Exports: +------------------------------ + NTLib2 + +Re-Exports: +------------------------------ + + +Foreign: +------------------------------ + + +Datatypes: +------------------------------ +newtype NTLib2 (a :: Prim.Type) = + NTLib2 ((a :: Prim.Type)) + + +Declarations: +------------------------------ diff --git a/tests/purus/passing/Coercible/output/Coercible.Lib2/externs.cbor b/tests/purus/passing/Coercible/output/Coercible.Lib2/externs.cbor new file mode 100644 index 000000000..f311f76f6 Binary files /dev/null and b/tests/purus/passing/Coercible/output/Coercible.Lib2/externs.cbor differ diff --git a/tests/purus/passing/Coercible/output/package.json b/tests/purus/passing/Coercible/output/package.json new file mode 100644 index 000000000..7c34deb58 --- /dev/null +++ b/tests/purus/passing/Coercible/output/package.json @@ -0,0 +1 @@ +{"type":"module"} \ No newline at end of file diff --git a/tests/purus/passing/DctorOperatorAlias/List.purs b/tests/purus/passing/DctorOperatorAlias/List.purs new file mode 100644 index 000000000..58071d274 --- /dev/null +++ b/tests/purus/passing/DctorOperatorAlias/List.purs @@ -0,0 +1,5 @@ +module List where + +data List (a :: Type) = Cons a (List a) | Nil + +infixr 6 Cons as : diff --git a/tests/purus/passing/DctorOperatorAlias/output/List/List.cfn b/tests/purus/passing/DctorOperatorAlias/output/List/List.cfn new file mode 100644 index 000000000..067b3980c --- /dev/null +++ b/tests/purus/passing/DctorOperatorAlias/output/List/List.cfn @@ -0,0 +1 @@ +{"builtWith":"0.0.1","comments":[],"dataTypes":{"_ctorDict":[[[["List"],{"Ident":"Cons"}],[["List"],"List"]],[[["List"],{"Ident":"Nil"}],[["List"],"List"]]],"_tyDict":[[[["List"],"List"],{"_dDataArgs":[["a",{"annotation":[{"end":[3,21],"name":"tests/purus/passing/DctorOperatorAlias/List.purs","start":[3,17]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}]],"_dDataCtors":[{"_cdCtorFields":[[{"Ident":"value0"},{"annotation":[{"end":[3,31],"name":"tests/purus/passing/DctorOperatorAlias/List.purs","start":[3,30]},[]],"contents":{"kind":{"annotation":[{"end":[3,21],"name":"tests/purus/passing/DctorOperatorAlias/List.purs","start":[3,17]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],[{"Ident":"value1"},{"annotation":[{"end":[3,39],"name":"tests/purus/passing/DctorOperatorAlias/List.purs","start":[3,33]},[]],"contents":[{"annotation":[{"end":[3,37],"name":"tests/purus/passing/DctorOperatorAlias/List.purs","start":[3,33]},[]],"contents":[["List"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[3,39],"name":"tests/purus/passing/DctorOperatorAlias/List.purs","start":[3,38]},[]],"contents":{"kind":{"annotation":[{"end":[3,21],"name":"tests/purus/passing/DctorOperatorAlias/List.purs","start":[3,17]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}]],"_cdCtorName":[["List"],{"Ident":"Cons"}]},{"_cdCtorFields":[],"_cdCtorName":[["List"],{"Ident":"Nil"}]}],"_dDataTyName":[["List"],"List"],"_dDeclType":"data"}]]},"decls":[],"exports":["Cons","Nil"],"foreign":[],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[5,19],"start":[1,1]}},"moduleName":["Builtin"]},{"annotation":{"meta":null,"sourceSpan":{"end":[5,19],"start":[1,1]}},"moduleName":["List"]},{"annotation":{"meta":null,"sourceSpan":{"end":[5,19],"start":[1,1]}},"moduleName":["Prim"]}],"moduleName":["List"],"modulePath":"tests/purus/passing/DctorOperatorAlias/List.purs","reExports":{},"sourceSpan":{"end":[5,19],"start":[1,1]}} \ No newline at end of file diff --git a/tests/purus/passing/DctorOperatorAlias/output/List/List.cfn.pretty b/tests/purus/passing/DctorOperatorAlias/output/List/List.cfn.pretty new file mode 100644 index 000000000..7e1294237 --- /dev/null +++ b/tests/purus/passing/DctorOperatorAlias/output/List/List.cfn.pretty @@ -0,0 +1,30 @@ +List (tests/purus/passing/DctorOperatorAlias/List.purs) + +Imported Modules: +------------------------------ + Builtin, + List, + Prim + +Exports: +------------------------------ + Cons, + Nil + +Re-Exports: +------------------------------ + + +Foreign: +------------------------------ + + +Datatypes: +------------------------------ +data List (a :: Prim.Type) = + Cons ((a :: Prim.Type)) ((List.List ((a :: Prim.Type)))) + | Nil + + +Declarations: +------------------------------ diff --git a/tests/purus/passing/DctorOperatorAlias/output/List/externs.cbor b/tests/purus/passing/DctorOperatorAlias/output/List/externs.cbor new file mode 100644 index 000000000..efbf9cb83 Binary files /dev/null and b/tests/purus/passing/DctorOperatorAlias/output/List/externs.cbor differ diff --git a/tests/purus/passing/DctorOperatorAlias/output/package.json b/tests/purus/passing/DctorOperatorAlias/output/package.json new file mode 100644 index 000000000..7c34deb58 --- /dev/null +++ b/tests/purus/passing/DctorOperatorAlias/output/package.json @@ -0,0 +1 @@ +{"type":"module"} \ No newline at end of file diff --git a/tests/purus/passing/Demo/Demo.purs b/tests/purus/passing/Demo/Demo.purs new file mode 100644 index 000000000..fe70cc3b5 --- /dev/null +++ b/tests/purus/passing/Demo/Demo.purs @@ -0,0 +1,48 @@ +module Demo where + +{- Builtins -} +minus :: Int -> Int -> Int +minus = Builtin.subtractInteger +infixr 5 minus as - + +plus :: Int -> Int -> Int +plus = Builtin.addInteger +infixr 5 plus as + + +multiply :: Int -> Int -> Int +multiply = Builtin.multiplyInteger +infixr 5 multiply as * + +divide :: Int -> Int -> Int +divide = Builtin.divideInteger +infixr 5 divide as / + + +testMinus :: Int +testMinus = 10 - 6 + +testPlus :: Int +testPlus = 2 + 2 + +testMultiply :: Int +testMultiply = 2 * 2 + +testDivide :: Int +testDivide = 4 / 2 + +{- Data types -} +data Identitee (a :: Type) = Identitee a + +unIdentitee :: Identitee Int -> Int +unIdentitee = case _ of + Identitee x -> x + +testIdentitee = unIdentitee (Identitee 101) + +{- Validator -} +testValidator :: forall (a :: Type) (b :: Type) (c :: Type) + . a -> b -> c -> Boolean +testValidator datum redeemer context = True + +testValidatorApplied :: Boolean +testValidatorApplied = testValidator "datum" "redeemer" "context" diff --git a/tests/purus/passing/Demo/output/Demo/Demo.cfn b/tests/purus/passing/Demo/output/Demo/Demo.cfn new file mode 100644 index 000000000..540118e00 --- /dev/null +++ b/tests/purus/passing/Demo/output/Demo/Demo.cfn @@ -0,0 +1 @@ +{"builtWith":"0.0.1","comments":[],"dataTypes":{"_ctorDict":[[[["Demo"],{"Ident":"Identitee"}],[["Demo"],"Identitee"]]],"_tyDict":[[[["Demo"],"Identitee"],{"_dDataArgs":[["a",{"annotation":[{"end":[34,26],"name":"tests/purus/passing/Demo/Demo.purs","start":[34,22]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}]],"_dDataCtors":[{"_cdCtorFields":[[{"Ident":"value0"},{"annotation":[{"end":[34,41],"name":"tests/purus/passing/Demo/Demo.purs","start":[34,40]},[]],"contents":{"kind":{"annotation":[{"end":[34,26],"name":"tests/purus/passing/Demo/Demo.purs","start":[34,22]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}]],"_cdCtorName":[["Demo"],{"Ident":"Identitee"}]}],"_dDataTyName":[["Demo"],"Identitee"],"_dDeclType":"data"}]]},"decls":[{"annotation":{"meta":null,"sourceSpan":{"end":[36,36],"start":[36,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"argument":"v","body":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":{"constructorType":"ProductType","identifiers":["value0"],"metaType":"IsConstructor"},"sourceSpan":{"end":[38,14],"start":[38,3]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[38,14],"start":[38,13]}},"binderType":"VarBinder","identifier":"x","type":{"annotation":[{"end":[36,29],"name":"tests/purus/passing/Demo/Demo.purs","start":[36,26]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}}],"constructorName":{"identifier":"Identitee","moduleName":["Demo"]},"typeName":{"identifier":"Identitee","moduleName":["Demo"]}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[38,19],"start":[38,18]}},"kind":"Var","type":{"annotation":[{"end":[36,29],"name":"tests/purus/passing/Demo/Demo.purs","start":[36,26]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"identifier":"x","sourcePos":[38,13]}},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"kind":"Var","type":{"annotation":[{"end":[36,29],"name":"tests/purus/passing/Demo/Demo.purs","start":[36,16]},[]],"contents":[{"annotation":[{"end":[36,25],"name":"tests/purus/passing/Demo/Demo.purs","start":[36,16]},[]],"contents":[["Demo"],"Identitee"],"tag":"TypeConstructor"},{"annotation":[{"end":[36,29],"name":"tests/purus/passing/Demo/Demo.purs","start":[36,26]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"v","sourcePos":[0,0]}}],"kind":"Case","type":{"annotation":[{"end":[36,36],"name":"tests/purus/passing/Demo/Demo.purs","start":[36,33]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[36,29],"name":"tests/purus/passing/Demo/Demo.purs","start":[36,16]},[]],"contents":[{"annotation":[{"end":[36,25],"name":"tests/purus/passing/Demo/Demo.purs","start":[36,16]},[]],"contents":[["Demo"],"Identitee"],"tag":"TypeConstructor"},{"annotation":[{"end":[36,29],"name":"tests/purus/passing/Demo/Demo.purs","start":[36,26]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[36,36],"name":"tests/purus/passing/Demo/Demo.purs","start":[36,33]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"identifier":"unIdentitee"},{"annotation":{"meta":null,"sourceSpan":{"end":[44,39],"start":[43,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[45,45],"start":[45,1]}},"argument":"datum","body":{"annotation":{"meta":null,"sourceSpan":{"end":[45,45],"start":[45,1]}},"argument":"redeemer","body":{"annotation":{"meta":null,"sourceSpan":{"end":[45,45],"start":[45,1]}},"argument":"context","body":{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[45,45],"start":[45,41]}},"kind":"Var","type":{"annotation":[{"end":[44,39],"name":"tests/purus/passing/Demo/Demo.purs","start":[44,32]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"},"value":{"identifier":"True","moduleName":["Prim"]}},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[44,28],"name":"tests/purus/passing/Demo/Demo.purs","start":[44,27]},[]],"contents":{"kind":{"annotation":[{"end":[43,59],"name":"tests/purus/passing/Demo/Demo.purs","start":[43,55]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"c"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[44,39],"name":"tests/purus/passing/Demo/Demo.purs","start":[44,32]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[44,23],"name":"tests/purus/passing/Demo/Demo.purs","start":[44,22]},[]],"contents":{"kind":{"annotation":[{"end":[43,47],"name":"tests/purus/passing/Demo/Demo.purs","start":[43,43]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"b"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[44,39],"name":"tests/purus/passing/Demo/Demo.purs","start":[44,27]},[]],"contents":[{"annotation":[{"end":[44,39],"name":"tests/purus/passing/Demo/Demo.purs","start":[44,27]},[]],"contents":[{"annotation":[{"end":[44,31],"name":"tests/purus/passing/Demo/Demo.purs","start":[44,29]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[44,28],"name":"tests/purus/passing/Demo/Demo.purs","start":[44,27]},[]],"contents":{"kind":{"annotation":[{"end":[43,59],"name":"tests/purus/passing/Demo/Demo.purs","start":[43,55]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"c"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[44,39],"name":"tests/purus/passing/Demo/Demo.purs","start":[44,32]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"kind":"Abs","type":{"annotation":[{"end":[44,39],"name":"tests/purus/passing/Demo/Demo.purs","start":[43,18]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[43,35],"name":"tests/purus/passing/Demo/Demo.purs","start":[43,31]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":2,"type":{"annotation":[{"end":[44,39],"name":"tests/purus/passing/Demo/Demo.purs","start":[43,38]},[]],"contents":{"identifier":"b","kind":{"annotation":[{"end":[43,47],"name":"tests/purus/passing/Demo/Demo.purs","start":[43,43]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":1,"type":{"annotation":[{"end":[44,39],"name":"tests/purus/passing/Demo/Demo.purs","start":[43,50]},[]],"contents":{"identifier":"c","kind":{"annotation":[{"end":[43,59],"name":"tests/purus/passing/Demo/Demo.purs","start":[43,55]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":0,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[44,18],"name":"tests/purus/passing/Demo/Demo.purs","start":[44,17]},[]],"contents":{"kind":{"annotation":[{"end":[43,35],"name":"tests/purus/passing/Demo/Demo.purs","start":[43,31]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[44,39],"name":"tests/purus/passing/Demo/Demo.purs","start":[44,22]},[]],"contents":[{"annotation":[{"end":[44,39],"name":"tests/purus/passing/Demo/Demo.purs","start":[44,22]},[]],"contents":[{"annotation":[{"end":[44,26],"name":"tests/purus/passing/Demo/Demo.purs","start":[44,24]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[44,23],"name":"tests/purus/passing/Demo/Demo.purs","start":[44,22]},[]],"contents":{"kind":{"annotation":[{"end":[43,47],"name":"tests/purus/passing/Demo/Demo.purs","start":[43,43]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"b"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[44,39],"name":"tests/purus/passing/Demo/Demo.purs","start":[44,27]},[]],"contents":[{"annotation":[{"end":[44,39],"name":"tests/purus/passing/Demo/Demo.purs","start":[44,27]},[]],"contents":[{"annotation":[{"end":[44,31],"name":"tests/purus/passing/Demo/Demo.purs","start":[44,29]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[44,28],"name":"tests/purus/passing/Demo/Demo.purs","start":[44,27]},[]],"contents":{"kind":{"annotation":[{"end":[43,59],"name":"tests/purus/passing/Demo/Demo.purs","start":[43,55]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"c"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[44,39],"name":"tests/purus/passing/Demo/Demo.purs","start":[44,32]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"identifier":"testValidator"},{"annotation":{"meta":null,"sourceSpan":{"end":[47,32],"start":[47,1]}},"bindType":"NonRec","expression":{"abstraction":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[48,37],"start":[48,24]}},"kind":"Var","type":{"annotation":[{"end":[44,39],"name":"tests/purus/passing/Demo/Demo.purs","start":[43,18]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[43,35],"name":"tests/purus/passing/Demo/Demo.purs","start":[43,31]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":2,"type":{"annotation":[{"end":[44,39],"name":"tests/purus/passing/Demo/Demo.purs","start":[43,38]},[]],"contents":{"identifier":"b","kind":{"annotation":[{"end":[43,47],"name":"tests/purus/passing/Demo/Demo.purs","start":[43,43]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":1,"type":{"annotation":[{"end":[44,39],"name":"tests/purus/passing/Demo/Demo.purs","start":[43,50]},[]],"contents":{"identifier":"c","kind":{"annotation":[{"end":[43,59],"name":"tests/purus/passing/Demo/Demo.purs","start":[43,55]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":0,"type":{"annotation":[{"end":[44,39],"name":"tests/purus/passing/Demo/Demo.purs","start":[44,17]},[]],"contents":[{"annotation":[{"end":[44,39],"name":"tests/purus/passing/Demo/Demo.purs","start":[44,17]},[]],"contents":[{"annotation":[{"end":[44,21],"name":"tests/purus/passing/Demo/Demo.purs","start":[44,19]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[44,18],"name":"tests/purus/passing/Demo/Demo.purs","start":[44,17]},[]],"contents":{"kind":{"annotation":[{"end":[43,35],"name":"tests/purus/passing/Demo/Demo.purs","start":[43,31]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[44,39],"name":"tests/purus/passing/Demo/Demo.purs","start":[44,22]},[]],"contents":[{"annotation":[{"end":[44,39],"name":"tests/purus/passing/Demo/Demo.purs","start":[44,22]},[]],"contents":[{"annotation":[{"end":[44,26],"name":"tests/purus/passing/Demo/Demo.purs","start":[44,24]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[44,23],"name":"tests/purus/passing/Demo/Demo.purs","start":[44,22]},[]],"contents":{"kind":{"annotation":[{"end":[43,47],"name":"tests/purus/passing/Demo/Demo.purs","start":[43,43]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"b"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[44,39],"name":"tests/purus/passing/Demo/Demo.purs","start":[44,27]},[]],"contents":[{"annotation":[{"end":[44,39],"name":"tests/purus/passing/Demo/Demo.purs","start":[44,27]},[]],"contents":[{"annotation":[{"end":[44,31],"name":"tests/purus/passing/Demo/Demo.purs","start":[44,29]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[44,28],"name":"tests/purus/passing/Demo/Demo.purs","start":[44,27]},[]],"contents":{"kind":{"annotation":[{"end":[43,59],"name":"tests/purus/passing/Demo/Demo.purs","start":[43,55]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"c"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[44,39],"name":"tests/purus/passing/Demo/Demo.purs","start":[44,32]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"testValidator","moduleName":["Demo"]}},"annotation":{"meta":null,"sourceSpan":{"end":[48,45],"start":[48,24]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[48,45],"start":[48,38]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"String"],"tag":"TypeConstructor"},"value":{"literalType":"StringLiteral","value":"datum"}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[48,56],"start":[48,24]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[48,56],"start":[48,46]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"String"],"tag":"TypeConstructor"},"value":{"literalType":"StringLiteral","value":"redeemer"}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[48,66],"start":[48,24]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[48,66],"start":[48,57]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"String"],"tag":"TypeConstructor"},"value":{"literalType":"StringLiteral","value":"context"}},"kind":"App"},"identifier":"testValidatorApplied"},{"annotation":{"meta":null,"sourceSpan":{"end":[40,44],"start":[40,1]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[40,28],"start":[40,17]}},"kind":"Var","type":{"annotation":[{"end":[36,36],"name":"tests/purus/passing/Demo/Demo.purs","start":[36,16]},[]],"contents":[{"annotation":[{"end":[36,36],"name":"tests/purus/passing/Demo/Demo.purs","start":[36,16]},[]],"contents":[{"annotation":[{"end":[36,32],"name":"tests/purus/passing/Demo/Demo.purs","start":[36,30]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[36,29],"name":"tests/purus/passing/Demo/Demo.purs","start":[36,16]},[]],"contents":[{"annotation":[{"end":[36,25],"name":"tests/purus/passing/Demo/Demo.purs","start":[36,16]},[]],"contents":[["Demo"],"Identitee"],"tag":"TypeConstructor"},{"annotation":[{"end":[36,29],"name":"tests/purus/passing/Demo/Demo.purs","start":[36,26]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[36,36],"name":"tests/purus/passing/Demo/Demo.purs","start":[36,33]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"unIdentitee","moduleName":["Demo"]}},"annotation":{"meta":null,"sourceSpan":{"end":[40,44],"start":[40,17]}},"argument":{"abstraction":{"annotation":{"meta":{"constructorType":"ProductType","identifiers":["value0"],"metaType":"IsConstructor"},"sourceSpan":{"end":[40,39],"start":[40,30]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[34,26],"name":"tests/purus/passing/Demo/Demo.purs","start":[34,22]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":6,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[34,41],"name":"tests/purus/passing/Demo/Demo.purs","start":[34,40]},[]],"contents":{"kind":{"annotation":[{"end":[34,26],"name":"tests/purus/passing/Demo/Demo.purs","start":[34,22]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Demo"],"Identitee"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[34,26],"name":"tests/purus/passing/Demo/Demo.purs","start":[34,22]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarVisible"},"tag":"ForAll"},"value":{"identifier":"Identitee","moduleName":["Demo"]}},"annotation":{"meta":null,"sourceSpan":{"end":[40,43],"start":[40,30]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[40,43],"start":[40,40]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"literalType":"IntLiteral","value":101}},"kind":"App"},"kind":"App"},"identifier":"testIdentitee"},{"annotation":{"meta":null,"sourceSpan":{"end":[8,26],"start":[8,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[9,27],"start":[9,9]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"addInteger","moduleName":["Builtin"]}},"identifier":"plus"},{"annotation":{"meta":null,"sourceSpan":{"end":[24,16],"start":[24,1]}},"bindType":"NonRec","expression":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[25,15],"start":[25,14]}},"kind":"Var","type":{"annotation":[{"end":[8,26],"name":"tests/purus/passing/Demo/Demo.purs","start":[8,9]},[]],"contents":[{"annotation":[{"end":[8,26],"name":"tests/purus/passing/Demo/Demo.purs","start":[8,9]},[]],"contents":[{"annotation":[{"end":[8,15],"name":"tests/purus/passing/Demo/Demo.purs","start":[8,13]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[8,12],"name":"tests/purus/passing/Demo/Demo.purs","start":[8,9]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[8,26],"name":"tests/purus/passing/Demo/Demo.purs","start":[8,16]},[]],"contents":[{"annotation":[{"end":[8,26],"name":"tests/purus/passing/Demo/Demo.purs","start":[8,16]},[]],"contents":[{"annotation":[{"end":[8,22],"name":"tests/purus/passing/Demo/Demo.purs","start":[8,20]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[8,19],"name":"tests/purus/passing/Demo/Demo.purs","start":[8,16]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[8,26],"name":"tests/purus/passing/Demo/Demo.purs","start":[8,23]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"plus","moduleName":["Demo"]}},"annotation":{"meta":null,"sourceSpan":{"end":[25,17],"start":[25,12]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[25,13],"start":[25,12]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"literalType":"IntLiteral","value":2}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[25,17],"start":[25,12]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[25,17],"start":[25,16]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"literalType":"IntLiteral","value":2}},"kind":"App"},"identifier":"testPlus"},{"annotation":{"meta":null,"sourceSpan":{"end":[12,30],"start":[12,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[13,35],"start":[13,12]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"multiplyInteger","moduleName":["Builtin"]}},"identifier":"multiply"},{"annotation":{"meta":null,"sourceSpan":{"end":[27,20],"start":[27,1]}},"bindType":"NonRec","expression":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[28,19],"start":[28,18]}},"kind":"Var","type":{"annotation":[{"end":[12,30],"name":"tests/purus/passing/Demo/Demo.purs","start":[12,13]},[]],"contents":[{"annotation":[{"end":[12,30],"name":"tests/purus/passing/Demo/Demo.purs","start":[12,13]},[]],"contents":[{"annotation":[{"end":[12,19],"name":"tests/purus/passing/Demo/Demo.purs","start":[12,17]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[12,16],"name":"tests/purus/passing/Demo/Demo.purs","start":[12,13]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[12,30],"name":"tests/purus/passing/Demo/Demo.purs","start":[12,20]},[]],"contents":[{"annotation":[{"end":[12,30],"name":"tests/purus/passing/Demo/Demo.purs","start":[12,20]},[]],"contents":[{"annotation":[{"end":[12,26],"name":"tests/purus/passing/Demo/Demo.purs","start":[12,24]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[12,23],"name":"tests/purus/passing/Demo/Demo.purs","start":[12,20]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[12,30],"name":"tests/purus/passing/Demo/Demo.purs","start":[12,27]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"multiply","moduleName":["Demo"]}},"annotation":{"meta":null,"sourceSpan":{"end":[28,21],"start":[28,16]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[28,17],"start":[28,16]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"literalType":"IntLiteral","value":2}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[28,21],"start":[28,16]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[28,21],"start":[28,20]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"literalType":"IntLiteral","value":2}},"kind":"App"},"identifier":"testMultiply"},{"annotation":{"meta":null,"sourceSpan":{"end":[4,27],"start":[4,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[5,32],"start":[5,9]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"subtractInteger","moduleName":["Builtin"]}},"identifier":"minus"},{"annotation":{"meta":null,"sourceSpan":{"end":[21,17],"start":[21,1]}},"bindType":"NonRec","expression":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[22,17],"start":[22,16]}},"kind":"Var","type":{"annotation":[{"end":[4,27],"name":"tests/purus/passing/Demo/Demo.purs","start":[4,10]},[]],"contents":[{"annotation":[{"end":[4,27],"name":"tests/purus/passing/Demo/Demo.purs","start":[4,10]},[]],"contents":[{"annotation":[{"end":[4,16],"name":"tests/purus/passing/Demo/Demo.purs","start":[4,14]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[4,13],"name":"tests/purus/passing/Demo/Demo.purs","start":[4,10]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[4,27],"name":"tests/purus/passing/Demo/Demo.purs","start":[4,17]},[]],"contents":[{"annotation":[{"end":[4,27],"name":"tests/purus/passing/Demo/Demo.purs","start":[4,17]},[]],"contents":[{"annotation":[{"end":[4,23],"name":"tests/purus/passing/Demo/Demo.purs","start":[4,21]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[4,20],"name":"tests/purus/passing/Demo/Demo.purs","start":[4,17]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[4,27],"name":"tests/purus/passing/Demo/Demo.purs","start":[4,24]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"minus","moduleName":["Demo"]}},"annotation":{"meta":null,"sourceSpan":{"end":[22,19],"start":[22,13]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[22,15],"start":[22,13]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"literalType":"IntLiteral","value":10}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[22,19],"start":[22,13]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[22,19],"start":[22,18]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"literalType":"IntLiteral","value":6}},"kind":"App"},"identifier":"testMinus"},{"annotation":{"meta":null,"sourceSpan":{"end":[16,28],"start":[16,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[17,32],"start":[17,11]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"divideInteger","moduleName":["Builtin"]}},"identifier":"divide"},{"annotation":{"meta":null,"sourceSpan":{"end":[30,18],"start":[30,1]}},"bindType":"NonRec","expression":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[31,17],"start":[31,16]}},"kind":"Var","type":{"annotation":[{"end":[16,28],"name":"tests/purus/passing/Demo/Demo.purs","start":[16,11]},[]],"contents":[{"annotation":[{"end":[16,28],"name":"tests/purus/passing/Demo/Demo.purs","start":[16,11]},[]],"contents":[{"annotation":[{"end":[16,17],"name":"tests/purus/passing/Demo/Demo.purs","start":[16,15]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[16,14],"name":"tests/purus/passing/Demo/Demo.purs","start":[16,11]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[16,28],"name":"tests/purus/passing/Demo/Demo.purs","start":[16,18]},[]],"contents":[{"annotation":[{"end":[16,28],"name":"tests/purus/passing/Demo/Demo.purs","start":[16,18]},[]],"contents":[{"annotation":[{"end":[16,24],"name":"tests/purus/passing/Demo/Demo.purs","start":[16,22]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[16,21],"name":"tests/purus/passing/Demo/Demo.purs","start":[16,18]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[16,28],"name":"tests/purus/passing/Demo/Demo.purs","start":[16,25]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"divide","moduleName":["Demo"]}},"annotation":{"meta":null,"sourceSpan":{"end":[31,19],"start":[31,14]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[31,15],"start":[31,14]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"literalType":"IntLiteral","value":4}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[31,19],"start":[31,14]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[31,19],"start":[31,18]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"literalType":"IntLiteral","value":2}},"kind":"App"},"identifier":"testDivide"}],"exports":["minus","plus","multiply","divide","testMinus","testPlus","testMultiply","testDivide","Identitee","unIdentitee","testIdentitee","testValidator","testValidatorApplied"],"foreign":[],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[48,66],"start":[1,1]}},"moduleName":["Builtin"]},{"annotation":{"meta":null,"sourceSpan":{"end":[48,66],"start":[1,1]}},"moduleName":["Demo"]},{"annotation":{"meta":null,"sourceSpan":{"end":[48,66],"start":[1,1]}},"moduleName":["Prim"]}],"moduleName":["Demo"],"modulePath":"tests/purus/passing/Demo/Demo.purs","reExports":{},"sourceSpan":{"end":[48,66],"start":[1,1]}} \ No newline at end of file diff --git a/tests/purus/passing/Demo/output/Demo/Demo.cfn.pretty b/tests/purus/passing/Demo/output/Demo/Demo.cfn.pretty new file mode 100644 index 000000000..536892ac6 --- /dev/null +++ b/tests/purus/passing/Demo/output/Demo/Demo.cfn.pretty @@ -0,0 +1,99 @@ +Demo (tests/purus/passing/Demo/Demo.purs) + +Imported Modules: +------------------------------ + Builtin, + Demo, + Prim + +Exports: +------------------------------ + minus, + plus, + multiply, + divide, + testMinus, + testPlus, + testMultiply, + testDivide, + Identitee, + unIdentitee, + testIdentitee, + testValidator, + testValidatorApplied + +Re-Exports: +------------------------------ + + +Foreign: +------------------------------ + + +Datatypes: +------------------------------ +data Identitee (a :: Prim.Type) = + Identitee ((a :: Prim.Type)) + + +Declarations: +------------------------------ +unIdentitee :: ((Demo.Identitee (Prim.Int)) -> (Prim.Int)) +unIdentitee = + \(v: (Demo.Identitee (Prim.Int))) -> + case (v: (Demo.Identitee (Prim.Int))) of + Identitee x -> (x: Prim.Int) + +testValidator :: forall (a :: Prim.Type) (b :: Prim.Type) (c :: Prim.Type). ((a :: Prim.Type) -> (((b :: Prim.Type) -> (((c :: Prim.Type) -> (Prim.Boolean)))))) +testValidator = + \(datum: (a :: Prim.Type)) -> + \(redeemer: (b :: Prim.Type)) -> + \(context: (c :: Prim.Type)) -> + (True: Prim.Boolean) + +testValidatorApplied :: Prim.Boolean +testValidatorApplied = + (testValidator: forall (a :: Prim.Type) + (b :: Prim.Type) + (c :: Prim.Type). ((a :: Prim.Type) -> + (((b :: Prim.Type) -> (((c :: Prim.Type) -> (Prim.Boolean))))))) + ("datum": Prim.String) + ("redeemer": Prim.String) + ("context": Prim.String) + +testIdentitee :: Prim.Int +testIdentitee = + (unIdentitee: ((Demo.Identitee (Prim.Int)) -> (Prim.Int))) + ((Identitee: forall (@a :: Prim.Type). ((a :: Prim.Type) -> + ((Demo.Identitee ((a :: Prim.Type)))))) + (101: Prim.Int)) + +plus :: (Prim.Int -> ((Prim.Int -> (Prim.Int)))) +plus = (addInteger: (Prim.Int -> ((Prim.Int -> (Prim.Int))))) + +testPlus :: Prim.Int +testPlus = + (plus: (Prim.Int -> ((Prim.Int -> (Prim.Int))))) (2: Prim.Int) (2: Prim.Int) + +multiply :: (Prim.Int -> ((Prim.Int -> (Prim.Int)))) +multiply = (multiplyInteger: (Prim.Int -> ((Prim.Int -> (Prim.Int))))) + +testMultiply :: Prim.Int +testMultiply = + (multiply: (Prim.Int -> ((Prim.Int -> (Prim.Int))))) + (2: Prim.Int) + (2: Prim.Int) + +minus :: (Prim.Int -> ((Prim.Int -> (Prim.Int)))) +minus = (subtractInteger: (Prim.Int -> ((Prim.Int -> (Prim.Int))))) + +testMinus :: Prim.Int +testMinus = + (minus: (Prim.Int -> ((Prim.Int -> (Prim.Int))))) (10: Prim.Int) (6: Prim.Int) + +divide :: (Prim.Int -> ((Prim.Int -> (Prim.Int)))) +divide = (divideInteger: (Prim.Int -> ((Prim.Int -> (Prim.Int))))) + +testDivide :: Prim.Int +testDivide = + (divide: (Prim.Int -> ((Prim.Int -> (Prim.Int))))) (4: Prim.Int) (2: Prim.Int) \ No newline at end of file diff --git a/tests/purus/passing/Demo/output/Demo/externs.cbor b/tests/purus/passing/Demo/output/Demo/externs.cbor new file mode 100644 index 000000000..a65037fa4 Binary files /dev/null and b/tests/purus/passing/Demo/output/Demo/externs.cbor differ diff --git a/tests/purus/passing/Demo/output/package.json b/tests/purus/passing/Demo/output/package.json new file mode 100644 index 000000000..7c34deb58 --- /dev/null +++ b/tests/purus/passing/Demo/output/package.json @@ -0,0 +1 @@ +{"type":"module"} \ No newline at end of file diff --git a/tests/purus/passing/ExplicitImportReExport/Bar.purs b/tests/purus/passing/ExplicitImportReExport/Bar.purs new file mode 100644 index 000000000..5f8ef12ae --- /dev/null +++ b/tests/purus/passing/ExplicitImportReExport/Bar.purs @@ -0,0 +1,3 @@ +module Bar (module Foo) where + +import Foo diff --git a/tests/purus/passing/ExplicitImportReExport/Foo.purs b/tests/purus/passing/ExplicitImportReExport/Foo.purs new file mode 100644 index 000000000..d2c06e960 --- /dev/null +++ b/tests/purus/passing/ExplicitImportReExport/Foo.purs @@ -0,0 +1,4 @@ +module Foo where + +foo :: Int +foo = 3 diff --git a/tests/purus/passing/ExplicitImportReExport/output/Bar/Bar.cfn b/tests/purus/passing/ExplicitImportReExport/output/Bar/Bar.cfn new file mode 100644 index 000000000..11e4c814b --- /dev/null +++ b/tests/purus/passing/ExplicitImportReExport/output/Bar/Bar.cfn @@ -0,0 +1 @@ +{"builtWith":"0.0.1","comments":[],"dataTypes":{"_ctorDict":[],"_tyDict":[]},"decls":[],"exports":[],"foreign":[],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[3,11],"start":[1,1]}},"moduleName":["Builtin"]},{"annotation":{"meta":null,"sourceSpan":{"end":[3,11],"start":[3,1]}},"moduleName":["Foo"]},{"annotation":{"meta":null,"sourceSpan":{"end":[3,11],"start":[1,1]}},"moduleName":["Prim"]}],"moduleName":["Bar"],"modulePath":"tests/purus/passing/ExplicitImportReExport/Bar.purs","reExports":{"Foo":["foo"]},"sourceSpan":{"end":[3,11],"start":[1,1]}} \ No newline at end of file diff --git a/tests/purus/passing/ExplicitImportReExport/output/Bar/Bar.cfn.pretty b/tests/purus/passing/ExplicitImportReExport/output/Bar/Bar.cfn.pretty new file mode 100644 index 000000000..b482e5bed --- /dev/null +++ b/tests/purus/passing/ExplicitImportReExport/output/Bar/Bar.cfn.pretty @@ -0,0 +1,27 @@ +Bar (tests/purus/passing/ExplicitImportReExport/Bar.purs) + +Imported Modules: +------------------------------ + Builtin, + Foo, + Prim + +Exports: +------------------------------ + + +Re-Exports: +------------------------------ + Foo.foo + +Foreign: +------------------------------ + + +Datatypes: +------------------------------ + + + +Declarations: +------------------------------ diff --git a/tests/purus/passing/ExplicitImportReExport/output/Bar/externs.cbor b/tests/purus/passing/ExplicitImportReExport/output/Bar/externs.cbor new file mode 100644 index 000000000..9c12f3dd2 Binary files /dev/null and b/tests/purus/passing/ExplicitImportReExport/output/Bar/externs.cbor differ diff --git a/tests/purus/passing/ExplicitImportReExport/output/Foo/Foo.cfn b/tests/purus/passing/ExplicitImportReExport/output/Foo/Foo.cfn new file mode 100644 index 000000000..aa8a5e0a6 --- /dev/null +++ b/tests/purus/passing/ExplicitImportReExport/output/Foo/Foo.cfn @@ -0,0 +1 @@ +{"builtWith":"0.0.1","comments":[],"dataTypes":{"_ctorDict":[],"_tyDict":[]},"decls":[{"annotation":{"meta":null,"sourceSpan":{"end":[3,11],"start":[3,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[4,8],"start":[4,7]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"literalType":"IntLiteral","value":3}},"identifier":"foo"}],"exports":["foo"],"foreign":[],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[4,8],"start":[1,1]}},"moduleName":["Builtin"]},{"annotation":{"meta":null,"sourceSpan":{"end":[4,8],"start":[1,1]}},"moduleName":["Prim"]}],"moduleName":["Foo"],"modulePath":"tests/purus/passing/ExplicitImportReExport/Foo.purs","reExports":{},"sourceSpan":{"end":[4,8],"start":[1,1]}} \ No newline at end of file diff --git a/tests/purus/passing/ExplicitImportReExport/output/Foo/Foo.cfn.pretty b/tests/purus/passing/ExplicitImportReExport/output/Foo/Foo.cfn.pretty new file mode 100644 index 000000000..fa1a784aa --- /dev/null +++ b/tests/purus/passing/ExplicitImportReExport/output/Foo/Foo.cfn.pretty @@ -0,0 +1,28 @@ +Foo (tests/purus/passing/ExplicitImportReExport/Foo.purs) + +Imported Modules: +------------------------------ + Builtin, + Prim + +Exports: +------------------------------ + foo + +Re-Exports: +------------------------------ + + +Foreign: +------------------------------ + + +Datatypes: +------------------------------ + + + +Declarations: +------------------------------ +foo :: Prim.Int +foo = (3: Prim.Int) \ No newline at end of file diff --git a/tests/purus/passing/ExplicitImportReExport/output/Foo/externs.cbor b/tests/purus/passing/ExplicitImportReExport/output/Foo/externs.cbor new file mode 100644 index 000000000..82a0a00f0 Binary files /dev/null and b/tests/purus/passing/ExplicitImportReExport/output/Foo/externs.cbor differ diff --git a/tests/purus/passing/ExplicitImportReExport/output/package.json b/tests/purus/passing/ExplicitImportReExport/output/package.json new file mode 100644 index 000000000..7c34deb58 --- /dev/null +++ b/tests/purus/passing/ExplicitImportReExport/output/package.json @@ -0,0 +1 @@ +{"type":"module"} \ No newline at end of file diff --git a/tests/purus/passing/ExportExplicit/M1.purs b/tests/purus/passing/ExportExplicit/M1.purs new file mode 100644 index 000000000..5195d0e96 --- /dev/null +++ b/tests/purus/passing/ExportExplicit/M1.purs @@ -0,0 +1,10 @@ +module M1 (X(X, Y), Z(..), foo) where + +data X = X | Y +data Z = Z + +foo :: Int +foo = 0 + +bar :: Int +bar = 1 diff --git a/tests/purus/passing/ExportExplicit/output/M1/M1.cfn b/tests/purus/passing/ExportExplicit/output/M1/M1.cfn new file mode 100644 index 000000000..f8d8c70ca --- /dev/null +++ b/tests/purus/passing/ExportExplicit/output/M1/M1.cfn @@ -0,0 +1 @@ +{"builtWith":"0.0.1","comments":[],"dataTypes":{"_ctorDict":[[[["M1"],{"Ident":"X"}],[["M1"],"X"]],[[["M1"],{"Ident":"Y"}],[["M1"],"X"]],[[["M1"],{"Ident":"Z"}],[["M1"],"Z"]]],"_tyDict":[[[["M1"],"X"],{"_dDataArgs":[],"_dDataCtors":[{"_cdCtorFields":[],"_cdCtorName":[["M1"],{"Ident":"X"}]},{"_cdCtorFields":[],"_cdCtorName":[["M1"],{"Ident":"Y"}]}],"_dDataTyName":[["M1"],"X"],"_dDeclType":"data"}],[[["M1"],"Z"],{"_dDataArgs":[],"_dDataCtors":[{"_cdCtorFields":[],"_cdCtorName":[["M1"],{"Ident":"Z"}]}],"_dDataTyName":[["M1"],"Z"],"_dDeclType":"data"}]]},"decls":[{"annotation":{"meta":null,"sourceSpan":{"end":[6,11],"start":[6,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[7,8],"start":[7,7]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"literalType":"IntLiteral","value":0}},"identifier":"foo"},{"annotation":{"meta":null,"sourceSpan":{"end":[9,11],"start":[9,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[10,8],"start":[10,7]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"literalType":"IntLiteral","value":1}},"identifier":"bar"}],"exports":["X","Y","Z","foo"],"foreign":[],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[10,8],"start":[1,1]}},"moduleName":["Builtin"]},{"annotation":{"meta":null,"sourceSpan":{"end":[10,8],"start":[1,1]}},"moduleName":["Prim"]}],"moduleName":["M1"],"modulePath":"tests/purus/passing/ExportExplicit/M1.purs","reExports":{},"sourceSpan":{"end":[10,8],"start":[1,1]}} \ No newline at end of file diff --git a/tests/purus/passing/ExportExplicit/output/M1/M1.cfn.pretty b/tests/purus/passing/ExportExplicit/output/M1/M1.cfn.pretty new file mode 100644 index 000000000..13c8f781e --- /dev/null +++ b/tests/purus/passing/ExportExplicit/output/M1/M1.cfn.pretty @@ -0,0 +1,39 @@ +M1 (tests/purus/passing/ExportExplicit/M1.purs) + +Imported Modules: +------------------------------ + Builtin, + Prim + +Exports: +------------------------------ + X, + Y, + Z, + foo + +Re-Exports: +------------------------------ + + +Foreign: +------------------------------ + + +Datatypes: +------------------------------ +data X = + X + | Y + +data Z = + Z + + +Declarations: +------------------------------ +foo :: Prim.Int +foo = (0: Prim.Int) + +bar :: Prim.Int +bar = (1: Prim.Int) \ No newline at end of file diff --git a/tests/purus/passing/ExportExplicit/output/M1/externs.cbor b/tests/purus/passing/ExportExplicit/output/M1/externs.cbor new file mode 100644 index 000000000..d9611677b Binary files /dev/null and b/tests/purus/passing/ExportExplicit/output/M1/externs.cbor differ diff --git a/tests/purus/passing/ExportExplicit/output/package.json b/tests/purus/passing/ExportExplicit/output/package.json new file mode 100644 index 000000000..7c34deb58 --- /dev/null +++ b/tests/purus/passing/ExportExplicit/output/package.json @@ -0,0 +1 @@ +{"type":"module"} \ No newline at end of file diff --git a/tests/purus/passing/ExportExplicit2/M1.purs b/tests/purus/passing/ExportExplicit2/M1.purs new file mode 100644 index 000000000..aa78149f1 --- /dev/null +++ b/tests/purus/passing/ExportExplicit2/M1.purs @@ -0,0 +1,7 @@ +module M1 (bar) where + +foo :: Int +foo = 0 + +bar :: Int +bar = foo diff --git a/tests/purus/passing/ExportExplicit2/output/M1/M1.cfn b/tests/purus/passing/ExportExplicit2/output/M1/M1.cfn new file mode 100644 index 000000000..0d86b8f94 --- /dev/null +++ b/tests/purus/passing/ExportExplicit2/output/M1/M1.cfn @@ -0,0 +1 @@ +{"builtWith":"0.0.1","comments":[],"dataTypes":{"_ctorDict":[],"_tyDict":[]},"decls":[{"annotation":{"meta":null,"sourceSpan":{"end":[3,11],"start":[3,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[4,8],"start":[4,7]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"literalType":"IntLiteral","value":0}},"identifier":"foo"},{"annotation":{"meta":null,"sourceSpan":{"end":[6,11],"start":[6,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[7,10],"start":[7,7]}},"kind":"Var","type":{"annotation":[{"end":[3,11],"name":"tests/purus/passing/ExportExplicit2/M1.purs","start":[3,8]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"identifier":"foo","moduleName":["M1"]}},"identifier":"bar"}],"exports":["bar"],"foreign":[],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[7,10],"start":[1,1]}},"moduleName":["Builtin"]},{"annotation":{"meta":null,"sourceSpan":{"end":[7,10],"start":[1,1]}},"moduleName":["M1"]},{"annotation":{"meta":null,"sourceSpan":{"end":[7,10],"start":[1,1]}},"moduleName":["Prim"]}],"moduleName":["M1"],"modulePath":"tests/purus/passing/ExportExplicit2/M1.purs","reExports":{},"sourceSpan":{"end":[7,10],"start":[1,1]}} \ No newline at end of file diff --git a/tests/purus/passing/ExportExplicit2/output/M1/M1.cfn.pretty b/tests/purus/passing/ExportExplicit2/output/M1/M1.cfn.pretty new file mode 100644 index 000000000..be16e58b2 --- /dev/null +++ b/tests/purus/passing/ExportExplicit2/output/M1/M1.cfn.pretty @@ -0,0 +1,32 @@ +M1 (tests/purus/passing/ExportExplicit2/M1.purs) + +Imported Modules: +------------------------------ + Builtin, + M1, + Prim + +Exports: +------------------------------ + bar + +Re-Exports: +------------------------------ + + +Foreign: +------------------------------ + + +Datatypes: +------------------------------ + + + +Declarations: +------------------------------ +foo :: Prim.Int +foo = (0: Prim.Int) + +bar :: Prim.Int +bar = (foo: Prim.Int) \ No newline at end of file diff --git a/tests/purus/passing/ExportExplicit2/output/M1/externs.cbor b/tests/purus/passing/ExportExplicit2/output/M1/externs.cbor new file mode 100644 index 000000000..b665d9a86 Binary files /dev/null and b/tests/purus/passing/ExportExplicit2/output/M1/externs.cbor differ diff --git a/tests/purus/passing/ExportExplicit2/output/package.json b/tests/purus/passing/ExportExplicit2/output/package.json new file mode 100644 index 000000000..7c34deb58 --- /dev/null +++ b/tests/purus/passing/ExportExplicit2/output/package.json @@ -0,0 +1 @@ +{"type":"module"} \ No newline at end of file diff --git a/tests/purus/passing/ForeignKind/Lib.purs b/tests/purus/passing/ForeignKind/Lib.purs new file mode 100644 index 000000000..957268776 --- /dev/null +++ b/tests/purus/passing/ForeignKind/Lib.purs @@ -0,0 +1,59 @@ +module ForeignKinds.Lib where -- (Nat, Kinded, Zero, Succ, N0, N1, N2, N3, NatProxy(..), class AddNat, addNat, proxy1, proxy2) where + +-- declaration + +data Nat + +-- use in foreign data + +foreign import data Zero :: Nat +foreign import data Succ :: Nat -> Nat + +-- use in data + +data NatProxy (t :: Nat) = NatProxy + +-- use in type sig + +succProxy :: forall (n :: Nat). NatProxy n -> NatProxy (Succ n) +succProxy _ = NatProxy + +-- use in alias + +type Kinded (f :: Nat) = f :: Nat + +type KindedZero = Kinded Zero + +type N0 = Zero +type N1 = Succ N0 +type N2 = Succ N1 +type N3 = Succ N2 + +-- use of alias + +proxy0 :: NatProxy N0 +proxy0 = NatProxy + +proxy1 :: NatProxy N1 +proxy1 = NatProxy + +proxy2 :: NatProxy N2 +proxy2 = NatProxy + +proxy3 :: NatProxy N3 +proxy3 = NatProxy + +-- use in class + +-- TODO: Don't require annotations in fundep +class AddNat (l :: Nat) (r :: Nat) (o :: Nat) | l -> r o + +instance forall (r :: Nat). AddNat Zero r r + + +-- TODO: Bind kinds +instance forall (l :: Nat) (r :: Nat) (o :: Nat). AddNat l r o + => AddNat (Succ l) r (Succ o) + +addNat :: forall (l :: Nat) (r :: Nat) (o :: Nat). AddNat l r o => NatProxy l -> NatProxy r -> NatProxy o +addNat _ _ = NatProxy diff --git a/tests/purus/passing/ForeignKind/output/ForeignKinds.Lib/ForeignKinds.Lib.cfn b/tests/purus/passing/ForeignKind/output/ForeignKinds.Lib/ForeignKinds.Lib.cfn new file mode 100644 index 000000000..1ee40ddcd --- /dev/null +++ b/tests/purus/passing/ForeignKind/output/ForeignKinds.Lib/ForeignKinds.Lib.cfn @@ -0,0 +1 @@ +{"builtWith":"0.0.1","comments":[],"dataTypes":{"_ctorDict":[[[["ForeignKinds","Lib"],{"Ident":"AddNat$Dict"}],[["ForeignKinds","Lib"],"AddNat$Dict"]],[[["ForeignKinds","Lib"],{"Ident":"NatProxy"}],[["ForeignKinds","Lib"],"NatProxy"]]],"_tyDict":[[[["ForeignKinds","Lib"],"AddNat$Dict"],{"_dDataArgs":[["l",{"annotation":[{"end":[49,23],"name":"tests/purus/passing/ForeignKind/Lib.purs","start":[49,20]},[]],"contents":[["ForeignKinds","Lib"],"Nat"],"tag":"TypeConstructor"}],["r",{"annotation":[{"end":[49,34],"name":"tests/purus/passing/ForeignKind/Lib.purs","start":[49,31]},[]],"contents":[["ForeignKinds","Lib"],"Nat"],"tag":"TypeConstructor"}],["o",{"annotation":[{"end":[49,45],"name":"tests/purus/passing/ForeignKind/Lib.purs","start":[49,42]},[]],"contents":[["ForeignKinds","Lib"],"Nat"],"tag":"TypeConstructor"}]],"_dDataCtors":[{"_cdCtorFields":[[{"Ident":"dict"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"tag":"REmpty"}],"tag":"TypeApp"}]],"_cdCtorName":[["ForeignKinds","Lib"],{"Ident":"AddNat$Dict"}]}],"_dDataTyName":[["ForeignKinds","Lib"],"AddNat$Dict"],"_dDeclType":"newtype"}],[[["ForeignKinds","Lib"],"Nat"],{"_dDataArgs":[],"_dDataCtors":[],"_dDataTyName":[["ForeignKinds","Lib"],"Nat"],"_dDeclType":"data"}],[[["ForeignKinds","Lib"],"NatProxy"],{"_dDataArgs":[["t",{"annotation":[{"end":[14,24],"name":"tests/purus/passing/ForeignKind/Lib.purs","start":[14,21]},[]],"contents":[["ForeignKinds","Lib"],"Nat"],"tag":"TypeConstructor"}]],"_dDataCtors":[{"_cdCtorFields":[],"_cdCtorName":[["ForeignKinds","Lib"],{"Ident":"NatProxy"}]}],"_dDataTyName":[["ForeignKinds","Lib"],"NatProxy"],"_dDeclType":"data"}]]},"decls":[{"annotation":{"meta":null,"sourceSpan":{"end":[51,44],"start":[51,1]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":{"metaType":"IsNewtype"},"sourceSpan":{"end":[51,44],"start":[51,1]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"tag":"REmpty"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"KindApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["ForeignKinds","Lib"],"AddNat$Dict"],"tag":"TypeConstructor"},{"annotation":[{"end":[51,40],"name":"tests/purus/passing/ForeignKind/Lib.purs","start":[51,36]},[]],"contents":[["ForeignKinds","Lib"],"Zero"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[51,42],"name":"tests/purus/passing/ForeignKind/Lib.purs","start":[51,41]},[]],"contents":{"kind":{"annotation":[{"end":[51,26],"name":"tests/purus/passing/ForeignKind/Lib.purs","start":[51,23]},[]],"contents":[["ForeignKinds","Lib"],"Nat"],"tag":"TypeConstructor"},"var":"r"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[51,42],"name":"tests/purus/passing/ForeignKind/Lib.purs","start":[51,41]},[]],"contents":{"kind":{"annotation":[{"end":[51,26],"name":"tests/purus/passing/ForeignKind/Lib.purs","start":[51,23]},[]],"contents":[["ForeignKinds","Lib"],"Nat"],"tag":"TypeConstructor"},"var":"r"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"AddNat$Dict","moduleName":["ForeignKinds","Lib"]}},"annotation":{"meta":null,"sourceSpan":{"end":[51,44],"start":[51,1]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[51,44],"start":[51,1]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"tag":"REmpty"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"KindApp"}],"tag":"TypeApp"},"value":{"literalType":"ObjectLiteral","value":[]}},"kind":"App"},"identifier":"addNatZero"},{"annotation":{"meta":null,"sourceSpan":{"end":[56,32],"start":[55,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"argument":"$__unused","body":{"abstraction":{"annotation":{"meta":{"metaType":"IsNewtype"},"sourceSpan":{"end":[56,32],"start":[55,1]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"tag":"REmpty"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"KindApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["ForeignKinds","Lib"],"AddNat$Dict"],"tag":"TypeConstructor"},{"annotation":[{"end":[56,20],"name":"tests/purus/passing/ForeignKind/Lib.purs","start":[56,14]},[]],"contents":[{"annotation":[{"end":[56,18],"name":"tests/purus/passing/ForeignKind/Lib.purs","start":[56,14]},[]],"contents":[["ForeignKinds","Lib"],"Succ"],"tag":"TypeConstructor"},{"annotation":[{"end":[56,20],"name":"tests/purus/passing/ForeignKind/Lib.purs","start":[56,19]},[]],"contents":{"kind":{"annotation":[{"end":[55,26],"name":"tests/purus/passing/ForeignKind/Lib.purs","start":[55,23]},[]],"contents":[["ForeignKinds","Lib"],"Nat"],"tag":"TypeConstructor"},"var":"l"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[56,23],"name":"tests/purus/passing/ForeignKind/Lib.purs","start":[56,22]},[]],"contents":{"kind":{"annotation":[{"end":[55,37],"name":"tests/purus/passing/ForeignKind/Lib.purs","start":[55,34]},[]],"contents":[["ForeignKinds","Lib"],"Nat"],"tag":"TypeConstructor"},"var":"r"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[56,31],"name":"tests/purus/passing/ForeignKind/Lib.purs","start":[56,25]},[]],"contents":[{"annotation":[{"end":[56,29],"name":"tests/purus/passing/ForeignKind/Lib.purs","start":[56,25]},[]],"contents":[["ForeignKinds","Lib"],"Succ"],"tag":"TypeConstructor"},{"annotation":[{"end":[56,31],"name":"tests/purus/passing/ForeignKind/Lib.purs","start":[56,30]},[]],"contents":{"kind":{"annotation":[{"end":[55,48],"name":"tests/purus/passing/ForeignKind/Lib.purs","start":[55,45]},[]],"contents":[["ForeignKinds","Lib"],"Nat"],"tag":"TypeConstructor"},"var":"o"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"AddNat$Dict","moduleName":["ForeignKinds","Lib"]}},"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"tag":"REmpty"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"KindApp"}],"tag":"TypeApp"},"value":{"literalType":"ObjectLiteral","value":[]}},"kind":"App"},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"l","kind":{"annotation":[{"end":[55,26],"name":"tests/purus/passing/ForeignKind/Lib.purs","start":[55,23]},[]],"contents":[["ForeignKinds","Lib"],"Nat"],"tag":"TypeConstructor"},"skolem":7,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"r","kind":{"annotation":[{"end":[55,37],"name":"tests/purus/passing/ForeignKind/Lib.purs","start":[55,34]},[]],"contents":[["ForeignKinds","Lib"],"Nat"],"tag":"TypeConstructor"},"skolem":6,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"o","kind":{"annotation":[{"end":[55,48],"name":"tests/purus/passing/ForeignKind/Lib.purs","start":[55,45]},[]],"contents":[["ForeignKinds","Lib"],"Nat"],"tag":"TypeConstructor"},"skolem":5,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["ForeignKinds","Lib"],"AddNat$Dict"],"tag":"TypeConstructor"},{"annotation":[{"end":[55,59],"name":"tests/purus/passing/ForeignKind/Lib.purs","start":[55,58]},[]],"contents":{"kind":{"annotation":[{"end":[55,26],"name":"tests/purus/passing/ForeignKind/Lib.purs","start":[55,23]},[]],"contents":[["ForeignKinds","Lib"],"Nat"],"tag":"TypeConstructor"},"var":"l"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[55,61],"name":"tests/purus/passing/ForeignKind/Lib.purs","start":[55,60]},[]],"contents":{"kind":{"annotation":[{"end":[55,37],"name":"tests/purus/passing/ForeignKind/Lib.purs","start":[55,34]},[]],"contents":[["ForeignKinds","Lib"],"Nat"],"tag":"TypeConstructor"},"var":"r"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[55,63],"name":"tests/purus/passing/ForeignKind/Lib.purs","start":[55,62]},[]],"contents":{"kind":{"annotation":[{"end":[55,48],"name":"tests/purus/passing/ForeignKind/Lib.purs","start":[55,45]},[]],"contents":[["ForeignKinds","Lib"],"Nat"],"tag":"TypeConstructor"},"var":"o"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["ForeignKinds","Lib"],"AddNat$Dict"],"tag":"TypeConstructor"},{"annotation":[{"end":[56,20],"name":"tests/purus/passing/ForeignKind/Lib.purs","start":[56,14]},[]],"contents":[{"annotation":[{"end":[56,18],"name":"tests/purus/passing/ForeignKind/Lib.purs","start":[56,14]},[]],"contents":[["ForeignKinds","Lib"],"Succ"],"tag":"TypeConstructor"},{"annotation":[{"end":[56,20],"name":"tests/purus/passing/ForeignKind/Lib.purs","start":[56,19]},[]],"contents":{"kind":{"annotation":[{"end":[55,26],"name":"tests/purus/passing/ForeignKind/Lib.purs","start":[55,23]},[]],"contents":[["ForeignKinds","Lib"],"Nat"],"tag":"TypeConstructor"},"var":"l"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[56,23],"name":"tests/purus/passing/ForeignKind/Lib.purs","start":[56,22]},[]],"contents":{"kind":{"annotation":[{"end":[55,37],"name":"tests/purus/passing/ForeignKind/Lib.purs","start":[55,34]},[]],"contents":[["ForeignKinds","Lib"],"Nat"],"tag":"TypeConstructor"},"var":"r"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[56,31],"name":"tests/purus/passing/ForeignKind/Lib.purs","start":[56,25]},[]],"contents":[{"annotation":[{"end":[56,29],"name":"tests/purus/passing/ForeignKind/Lib.purs","start":[56,25]},[]],"contents":[["ForeignKinds","Lib"],"Succ"],"tag":"TypeConstructor"},{"annotation":[{"end":[56,31],"name":"tests/purus/passing/ForeignKind/Lib.purs","start":[56,30]},[]],"contents":{"kind":{"annotation":[{"end":[55,48],"name":"tests/purus/passing/ForeignKind/Lib.purs","start":[55,45]},[]],"contents":[["ForeignKinds","Lib"],"Nat"],"tag":"TypeConstructor"},"var":"o"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"identifier":"addNatSuccSucc"},{"annotation":{"meta":null,"sourceSpan":{"end":[18,64],"start":[18,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[19,23],"start":[19,1]}},"argument":"v","body":{"annotation":{"meta":{"constructorType":"ProductType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[19,23],"start":[19,15]}},"kind":"Var","type":{"annotation":[{"end":[18,64],"name":"tests/purus/passing/ForeignKind/Lib.purs","start":[18,47]},[]],"contents":[{"annotation":[{"end":[18,55],"name":"tests/purus/passing/ForeignKind/Lib.purs","start":[18,47]},[]],"contents":[["ForeignKinds","Lib"],"NatProxy"],"tag":"TypeConstructor"},{"annotation":[{"end":[18,63],"name":"tests/purus/passing/ForeignKind/Lib.purs","start":[18,57]},[]],"contents":[{"annotation":[{"end":[18,61],"name":"tests/purus/passing/ForeignKind/Lib.purs","start":[18,57]},[]],"contents":[["ForeignKinds","Lib"],"Succ"],"tag":"TypeConstructor"},{"annotation":[{"end":[18,63],"name":"tests/purus/passing/ForeignKind/Lib.purs","start":[18,62]},[]],"contents":{"kind":{"annotation":[{"end":[18,30],"name":"tests/purus/passing/ForeignKind/Lib.purs","start":[18,27]},[]],"contents":[["ForeignKinds","Lib"],"Nat"],"tag":"TypeConstructor"},"var":"n"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"NatProxy","moduleName":["ForeignKinds","Lib"]}},"kind":"Abs","type":{"annotation":[{"end":[18,64],"name":"tests/purus/passing/ForeignKind/Lib.purs","start":[18,14]},[]],"contents":{"identifier":"n","kind":{"annotation":[{"end":[18,30],"name":"tests/purus/passing/ForeignKind/Lib.purs","start":[18,27]},[]],"contents":[["ForeignKinds","Lib"],"Nat"],"tag":"TypeConstructor"},"skolem":14,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[18,43],"name":"tests/purus/passing/ForeignKind/Lib.purs","start":[18,33]},[]],"contents":[{"annotation":[{"end":[18,41],"name":"tests/purus/passing/ForeignKind/Lib.purs","start":[18,33]},[]],"contents":[["ForeignKinds","Lib"],"NatProxy"],"tag":"TypeConstructor"},{"annotation":[{"end":[18,43],"name":"tests/purus/passing/ForeignKind/Lib.purs","start":[18,42]},[]],"contents":{"kind":{"annotation":[{"end":[18,30],"name":"tests/purus/passing/ForeignKind/Lib.purs","start":[18,27]},[]],"contents":[["ForeignKinds","Lib"],"Nat"],"tag":"TypeConstructor"},"var":"n"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[18,64],"name":"tests/purus/passing/ForeignKind/Lib.purs","start":[18,47]},[]],"contents":[{"annotation":[{"end":[18,55],"name":"tests/purus/passing/ForeignKind/Lib.purs","start":[18,47]},[]],"contents":[["ForeignKinds","Lib"],"NatProxy"],"tag":"TypeConstructor"},{"annotation":[{"end":[18,63],"name":"tests/purus/passing/ForeignKind/Lib.purs","start":[18,57]},[]],"contents":[{"annotation":[{"end":[18,61],"name":"tests/purus/passing/ForeignKind/Lib.purs","start":[18,57]},[]],"contents":[["ForeignKinds","Lib"],"Succ"],"tag":"TypeConstructor"},{"annotation":[{"end":[18,63],"name":"tests/purus/passing/ForeignKind/Lib.purs","start":[18,62]},[]],"contents":{"kind":{"annotation":[{"end":[18,30],"name":"tests/purus/passing/ForeignKind/Lib.purs","start":[18,27]},[]],"contents":[["ForeignKinds","Lib"],"Nat"],"tag":"TypeConstructor"},"var":"n"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"identifier":"succProxy"},{"annotation":{"meta":null,"sourceSpan":{"end":[43,22],"start":[43,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":{"constructorType":"ProductType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[44,18],"start":[44,10]}},"kind":"Var","type":{"annotation":[{"end":[43,22],"name":"tests/purus/passing/ForeignKind/Lib.purs","start":[43,11]},[]],"contents":[{"annotation":[{"end":[43,19],"name":"tests/purus/passing/ForeignKind/Lib.purs","start":[43,11]},[]],"contents":[["ForeignKinds","Lib"],"NatProxy"],"tag":"TypeConstructor"},{"annotation":[{"end":[30,18],"name":"tests/purus/passing/ForeignKind/Lib.purs","start":[30,11]},[]],"contents":[{"annotation":[{"end":[30,15],"name":"tests/purus/passing/ForeignKind/Lib.purs","start":[30,11]},[]],"contents":[["ForeignKinds","Lib"],"Succ"],"tag":"TypeConstructor"},{"annotation":[{"end":[29,18],"name":"tests/purus/passing/ForeignKind/Lib.purs","start":[29,11]},[]],"contents":[{"annotation":[{"end":[29,15],"name":"tests/purus/passing/ForeignKind/Lib.purs","start":[29,11]},[]],"contents":[["ForeignKinds","Lib"],"Succ"],"tag":"TypeConstructor"},{"annotation":[{"end":[28,18],"name":"tests/purus/passing/ForeignKind/Lib.purs","start":[28,11]},[]],"contents":[{"annotation":[{"end":[28,15],"name":"tests/purus/passing/ForeignKind/Lib.purs","start":[28,11]},[]],"contents":[["ForeignKinds","Lib"],"Succ"],"tag":"TypeConstructor"},{"annotation":[{"end":[27,15],"name":"tests/purus/passing/ForeignKind/Lib.purs","start":[27,11]},[]],"contents":[["ForeignKinds","Lib"],"Zero"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"NatProxy","moduleName":["ForeignKinds","Lib"]}},"identifier":"proxy3"},{"annotation":{"meta":null,"sourceSpan":{"end":[40,22],"start":[40,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":{"constructorType":"ProductType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[41,18],"start":[41,10]}},"kind":"Var","type":{"annotation":[{"end":[40,22],"name":"tests/purus/passing/ForeignKind/Lib.purs","start":[40,11]},[]],"contents":[{"annotation":[{"end":[40,19],"name":"tests/purus/passing/ForeignKind/Lib.purs","start":[40,11]},[]],"contents":[["ForeignKinds","Lib"],"NatProxy"],"tag":"TypeConstructor"},{"annotation":[{"end":[29,18],"name":"tests/purus/passing/ForeignKind/Lib.purs","start":[29,11]},[]],"contents":[{"annotation":[{"end":[29,15],"name":"tests/purus/passing/ForeignKind/Lib.purs","start":[29,11]},[]],"contents":[["ForeignKinds","Lib"],"Succ"],"tag":"TypeConstructor"},{"annotation":[{"end":[28,18],"name":"tests/purus/passing/ForeignKind/Lib.purs","start":[28,11]},[]],"contents":[{"annotation":[{"end":[28,15],"name":"tests/purus/passing/ForeignKind/Lib.purs","start":[28,11]},[]],"contents":[["ForeignKinds","Lib"],"Succ"],"tag":"TypeConstructor"},{"annotation":[{"end":[27,15],"name":"tests/purus/passing/ForeignKind/Lib.purs","start":[27,11]},[]],"contents":[["ForeignKinds","Lib"],"Zero"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"NatProxy","moduleName":["ForeignKinds","Lib"]}},"identifier":"proxy2"},{"annotation":{"meta":null,"sourceSpan":{"end":[37,22],"start":[37,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":{"constructorType":"ProductType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[38,18],"start":[38,10]}},"kind":"Var","type":{"annotation":[{"end":[37,22],"name":"tests/purus/passing/ForeignKind/Lib.purs","start":[37,11]},[]],"contents":[{"annotation":[{"end":[37,19],"name":"tests/purus/passing/ForeignKind/Lib.purs","start":[37,11]},[]],"contents":[["ForeignKinds","Lib"],"NatProxy"],"tag":"TypeConstructor"},{"annotation":[{"end":[28,18],"name":"tests/purus/passing/ForeignKind/Lib.purs","start":[28,11]},[]],"contents":[{"annotation":[{"end":[28,15],"name":"tests/purus/passing/ForeignKind/Lib.purs","start":[28,11]},[]],"contents":[["ForeignKinds","Lib"],"Succ"],"tag":"TypeConstructor"},{"annotation":[{"end":[27,15],"name":"tests/purus/passing/ForeignKind/Lib.purs","start":[27,11]},[]],"contents":[["ForeignKinds","Lib"],"Zero"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"NatProxy","moduleName":["ForeignKinds","Lib"]}},"identifier":"proxy1"},{"annotation":{"meta":null,"sourceSpan":{"end":[34,22],"start":[34,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":{"constructorType":"ProductType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[35,18],"start":[35,10]}},"kind":"Var","type":{"annotation":[{"end":[34,22],"name":"tests/purus/passing/ForeignKind/Lib.purs","start":[34,11]},[]],"contents":[{"annotation":[{"end":[34,19],"name":"tests/purus/passing/ForeignKind/Lib.purs","start":[34,11]},[]],"contents":[["ForeignKinds","Lib"],"NatProxy"],"tag":"TypeConstructor"},{"annotation":[{"end":[27,15],"name":"tests/purus/passing/ForeignKind/Lib.purs","start":[27,11]},[]],"contents":[["ForeignKinds","Lib"],"Zero"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"NatProxy","moduleName":["ForeignKinds","Lib"]}},"identifier":"proxy0"},{"annotation":{"meta":null,"sourceSpan":{"end":[58,106],"start":[58,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"argument":"$__unused","body":{"annotation":{"meta":null,"sourceSpan":{"end":[59,22],"start":[59,1]}},"argument":"v","body":{"annotation":{"meta":null,"sourceSpan":{"end":[59,22],"start":[59,1]}},"argument":"v1","body":{"annotation":{"meta":{"constructorType":"ProductType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[59,22],"start":[59,14]}},"kind":"Var","type":{"annotation":[{"end":[58,106],"name":"tests/purus/passing/ForeignKind/Lib.purs","start":[58,96]},[]],"contents":[{"annotation":[{"end":[58,104],"name":"tests/purus/passing/ForeignKind/Lib.purs","start":[58,96]},[]],"contents":[["ForeignKinds","Lib"],"NatProxy"],"tag":"TypeConstructor"},{"annotation":[{"end":[58,106],"name":"tests/purus/passing/ForeignKind/Lib.purs","start":[58,105]},[]],"contents":{"kind":{"annotation":[{"end":[58,49],"name":"tests/purus/passing/ForeignKind/Lib.purs","start":[58,46]},[]],"contents":[["ForeignKinds","Lib"],"Nat"],"tag":"TypeConstructor"},"var":"o"},"tag":"TypeVar"}],"tag":"TypeApp"},"value":{"identifier":"NatProxy","moduleName":["ForeignKinds","Lib"]}},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[58,92],"name":"tests/purus/passing/ForeignKind/Lib.purs","start":[58,82]},[]],"contents":[{"annotation":[{"end":[58,90],"name":"tests/purus/passing/ForeignKind/Lib.purs","start":[58,82]},[]],"contents":[["ForeignKinds","Lib"],"NatProxy"],"tag":"TypeConstructor"},{"annotation":[{"end":[58,92],"name":"tests/purus/passing/ForeignKind/Lib.purs","start":[58,91]},[]],"contents":{"kind":{"annotation":[{"end":[58,38],"name":"tests/purus/passing/ForeignKind/Lib.purs","start":[58,35]},[]],"contents":[["ForeignKinds","Lib"],"Nat"],"tag":"TypeConstructor"},"var":"r"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[58,106],"name":"tests/purus/passing/ForeignKind/Lib.purs","start":[58,96]},[]],"contents":[{"annotation":[{"end":[58,104],"name":"tests/purus/passing/ForeignKind/Lib.purs","start":[58,96]},[]],"contents":[["ForeignKinds","Lib"],"NatProxy"],"tag":"TypeConstructor"},{"annotation":[{"end":[58,106],"name":"tests/purus/passing/ForeignKind/Lib.purs","start":[58,105]},[]],"contents":{"kind":{"annotation":[{"end":[58,49],"name":"tests/purus/passing/ForeignKind/Lib.purs","start":[58,46]},[]],"contents":[["ForeignKinds","Lib"],"Nat"],"tag":"TypeConstructor"},"var":"o"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[58,78],"name":"tests/purus/passing/ForeignKind/Lib.purs","start":[58,68]},[]],"contents":[{"annotation":[{"end":[58,76],"name":"tests/purus/passing/ForeignKind/Lib.purs","start":[58,68]},[]],"contents":[["ForeignKinds","Lib"],"NatProxy"],"tag":"TypeConstructor"},{"annotation":[{"end":[58,78],"name":"tests/purus/passing/ForeignKind/Lib.purs","start":[58,77]},[]],"contents":{"kind":{"annotation":[{"end":[58,27],"name":"tests/purus/passing/ForeignKind/Lib.purs","start":[58,24]},[]],"contents":[["ForeignKinds","Lib"],"Nat"],"tag":"TypeConstructor"},"var":"l"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[58,106],"name":"tests/purus/passing/ForeignKind/Lib.purs","start":[58,82]},[]],"contents":[{"annotation":[{"end":[58,106],"name":"tests/purus/passing/ForeignKind/Lib.purs","start":[58,82]},[]],"contents":[{"annotation":[{"end":[58,95],"name":"tests/purus/passing/ForeignKind/Lib.purs","start":[58,93]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[58,92],"name":"tests/purus/passing/ForeignKind/Lib.purs","start":[58,82]},[]],"contents":[{"annotation":[{"end":[58,90],"name":"tests/purus/passing/ForeignKind/Lib.purs","start":[58,82]},[]],"contents":[["ForeignKinds","Lib"],"NatProxy"],"tag":"TypeConstructor"},{"annotation":[{"end":[58,92],"name":"tests/purus/passing/ForeignKind/Lib.purs","start":[58,91]},[]],"contents":{"kind":{"annotation":[{"end":[58,38],"name":"tests/purus/passing/ForeignKind/Lib.purs","start":[58,35]},[]],"contents":[["ForeignKinds","Lib"],"Nat"],"tag":"TypeConstructor"},"var":"r"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[58,106],"name":"tests/purus/passing/ForeignKind/Lib.purs","start":[58,96]},[]],"contents":[{"annotation":[{"end":[58,104],"name":"tests/purus/passing/ForeignKind/Lib.purs","start":[58,96]},[]],"contents":[["ForeignKinds","Lib"],"NatProxy"],"tag":"TypeConstructor"},{"annotation":[{"end":[58,106],"name":"tests/purus/passing/ForeignKind/Lib.purs","start":[58,105]},[]],"contents":{"kind":{"annotation":[{"end":[58,49],"name":"tests/purus/passing/ForeignKind/Lib.purs","start":[58,46]},[]],"contents":[["ForeignKinds","Lib"],"Nat"],"tag":"TypeConstructor"},"var":"o"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"kind":"Abs","type":{"annotation":[{"end":[58,106],"name":"tests/purus/passing/ForeignKind/Lib.purs","start":[58,11]},[]],"contents":{"identifier":"l","kind":{"annotation":[{"end":[58,27],"name":"tests/purus/passing/ForeignKind/Lib.purs","start":[58,24]},[]],"contents":[["ForeignKinds","Lib"],"Nat"],"tag":"TypeConstructor"},"skolem":23,"type":{"annotation":[{"end":[58,106],"name":"tests/purus/passing/ForeignKind/Lib.purs","start":[58,30]},[]],"contents":{"identifier":"r","kind":{"annotation":[{"end":[58,38],"name":"tests/purus/passing/ForeignKind/Lib.purs","start":[58,35]},[]],"contents":[["ForeignKinds","Lib"],"Nat"],"tag":"TypeConstructor"},"skolem":22,"type":{"annotation":[{"end":[58,106],"name":"tests/purus/passing/ForeignKind/Lib.purs","start":[58,41]},[]],"contents":{"identifier":"o","kind":{"annotation":[{"end":[58,49],"name":"tests/purus/passing/ForeignKind/Lib.purs","start":[58,46]},[]],"contents":[["ForeignKinds","Lib"],"Nat"],"tag":"TypeConstructor"},"skolem":21,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["ForeignKinds","Lib"],"AddNat$Dict"],"tag":"TypeConstructor"},{"annotation":[{"end":[58,60],"name":"tests/purus/passing/ForeignKind/Lib.purs","start":[58,59]},[]],"contents":{"kind":{"annotation":[{"end":[58,27],"name":"tests/purus/passing/ForeignKind/Lib.purs","start":[58,24]},[]],"contents":[["ForeignKinds","Lib"],"Nat"],"tag":"TypeConstructor"},"var":"l"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[58,62],"name":"tests/purus/passing/ForeignKind/Lib.purs","start":[58,61]},[]],"contents":{"kind":{"annotation":[{"end":[58,38],"name":"tests/purus/passing/ForeignKind/Lib.purs","start":[58,35]},[]],"contents":[["ForeignKinds","Lib"],"Nat"],"tag":"TypeConstructor"},"var":"r"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[58,64],"name":"tests/purus/passing/ForeignKind/Lib.purs","start":[58,63]},[]],"contents":{"kind":{"annotation":[{"end":[58,49],"name":"tests/purus/passing/ForeignKind/Lib.purs","start":[58,46]},[]],"contents":[["ForeignKinds","Lib"],"Nat"],"tag":"TypeConstructor"},"var":"o"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[58,106],"name":"tests/purus/passing/ForeignKind/Lib.purs","start":[58,68]},[]],"contents":[{"annotation":[{"end":[58,106],"name":"tests/purus/passing/ForeignKind/Lib.purs","start":[58,68]},[]],"contents":[{"annotation":[{"end":[58,81],"name":"tests/purus/passing/ForeignKind/Lib.purs","start":[58,79]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[58,78],"name":"tests/purus/passing/ForeignKind/Lib.purs","start":[58,68]},[]],"contents":[{"annotation":[{"end":[58,76],"name":"tests/purus/passing/ForeignKind/Lib.purs","start":[58,68]},[]],"contents":[["ForeignKinds","Lib"],"NatProxy"],"tag":"TypeConstructor"},{"annotation":[{"end":[58,78],"name":"tests/purus/passing/ForeignKind/Lib.purs","start":[58,77]},[]],"contents":{"kind":{"annotation":[{"end":[58,27],"name":"tests/purus/passing/ForeignKind/Lib.purs","start":[58,24]},[]],"contents":[["ForeignKinds","Lib"],"Nat"],"tag":"TypeConstructor"},"var":"l"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[58,106],"name":"tests/purus/passing/ForeignKind/Lib.purs","start":[58,82]},[]],"contents":[{"annotation":[{"end":[58,106],"name":"tests/purus/passing/ForeignKind/Lib.purs","start":[58,82]},[]],"contents":[{"annotation":[{"end":[58,95],"name":"tests/purus/passing/ForeignKind/Lib.purs","start":[58,93]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[58,92],"name":"tests/purus/passing/ForeignKind/Lib.purs","start":[58,82]},[]],"contents":[{"annotation":[{"end":[58,90],"name":"tests/purus/passing/ForeignKind/Lib.purs","start":[58,82]},[]],"contents":[["ForeignKinds","Lib"],"NatProxy"],"tag":"TypeConstructor"},{"annotation":[{"end":[58,92],"name":"tests/purus/passing/ForeignKind/Lib.purs","start":[58,91]},[]],"contents":{"kind":{"annotation":[{"end":[58,38],"name":"tests/purus/passing/ForeignKind/Lib.purs","start":[58,35]},[]],"contents":[["ForeignKinds","Lib"],"Nat"],"tag":"TypeConstructor"},"var":"r"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[58,106],"name":"tests/purus/passing/ForeignKind/Lib.purs","start":[58,96]},[]],"contents":[{"annotation":[{"end":[58,104],"name":"tests/purus/passing/ForeignKind/Lib.purs","start":[58,96]},[]],"contents":[["ForeignKinds","Lib"],"NatProxy"],"tag":"TypeConstructor"},{"annotation":[{"end":[58,106],"name":"tests/purus/passing/ForeignKind/Lib.purs","start":[58,105]},[]],"contents":{"kind":{"annotation":[{"end":[58,49],"name":"tests/purus/passing/ForeignKind/Lib.purs","start":[58,46]},[]],"contents":[["ForeignKinds","Lib"],"Nat"],"tag":"TypeConstructor"},"var":"o"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"identifier":"addNat"}],"exports":["NatProxy","succProxy","proxy0","proxy1","proxy2","proxy3","addNat","addNatZero","addNatSuccSucc"],"foreign":[],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[59,22],"start":[1,1]}},"moduleName":["Builtin"]},{"annotation":{"meta":null,"sourceSpan":{"end":[59,22],"start":[1,1]}},"moduleName":["ForeignKinds","Lib"]},{"annotation":{"meta":null,"sourceSpan":{"end":[59,22],"start":[1,1]}},"moduleName":["Prim"]}],"moduleName":["ForeignKinds","Lib"],"modulePath":"tests/purus/passing/ForeignKind/Lib.purs","reExports":{},"sourceSpan":{"end":[59,22],"start":[1,1]}} \ No newline at end of file diff --git a/tests/purus/passing/ForeignKind/output/ForeignKinds.Lib/ForeignKinds.Lib.cfn.pretty b/tests/purus/passing/ForeignKind/output/ForeignKinds.Lib/ForeignKinds.Lib.cfn.pretty new file mode 100644 index 000000000..89ea78094 --- /dev/null +++ b/tests/purus/passing/ForeignKind/output/ForeignKinds.Lib/ForeignKinds.Lib.cfn.pretty @@ -0,0 +1,93 @@ +ForeignKinds.Lib (tests/purus/passing/ForeignKind/Lib.purs) + +Imported Modules: +------------------------------ + Builtin, + ForeignKinds.Lib, + Prim + +Exports: +------------------------------ + NatProxy, + succProxy, + proxy0, + proxy1, + proxy2, + proxy3, + addNat, + addNatZero, + addNatSuccSucc + +Re-Exports: +------------------------------ + + +Foreign: +------------------------------ + + +Datatypes: +------------------------------ +newtype AddNat$Dict (l :: ForeignKinds.Lib.Nat) (r :: ForeignKinds.Lib.Nat) (o :: ForeignKinds.Lib.Nat) = + AddNat$Dict ((Prim.Record ({}))) + +data Nat = + + +data NatProxy (t :: ForeignKinds.Lib.Nat) = + NatProxy + + +Declarations: +------------------------------ +addNatZero :: (((ForeignKinds.Lib.AddNat$Dict (ForeignKinds.Lib.Zero)) ((r :: ForeignKinds.Lib.Nat))) ((r :: ForeignKinds.Lib.Nat))) +addNatZero = + (AddNat$Dict: ((Prim.Record ({}@Prim.Type)) -> + ((((ForeignKinds.Lib.AddNat$Dict + (ForeignKinds.Lib.Zero)) ((r :: ForeignKinds.Lib.Nat))) ((r :: ForeignKinds.Lib.Nat)))))) + ({ }: (Prim.Record ({}@Prim.Type))) + +addNatSuccSucc :: forall (l :: ForeignKinds.Lib.Nat) (r :: ForeignKinds.Lib.Nat) (o :: ForeignKinds.Lib.Nat). ((((ForeignKinds.Lib.AddNat$Dict ((l :: ForeignKinds.Lib.Nat))) ((r :: ForeignKinds.Lib.Nat))) ((o :: ForeignKinds.Lib.Nat))) -> ((((ForeignKinds.Lib.AddNat$Dict ((ForeignKinds.Lib.Succ ((l :: ForeignKinds.Lib.Nat))))) ((r :: ForeignKinds.Lib.Nat))) ((ForeignKinds.Lib.Succ ((o :: ForeignKinds.Lib.Nat))))))) +addNatSuccSucc = + \($__unused: (((ForeignKinds.Lib.AddNat$Dict + ((l :: ForeignKinds.Lib.Nat))) ((r :: ForeignKinds.Lib.Nat))) ((o :: ForeignKinds.Lib.Nat)))) -> + (AddNat$Dict: ((Prim.Record ({}@Prim.Type)) -> + ((((ForeignKinds.Lib.AddNat$Dict + ((ForeignKinds.Lib.Succ + ((l :: ForeignKinds.Lib.Nat))))) ((r :: ForeignKinds.Lib.Nat))) ((ForeignKinds.Lib.Succ + ((o :: ForeignKinds.Lib.Nat)))))))) + ({ }: (Prim.Record ({}@Prim.Type))) + +succProxy :: forall (n :: ForeignKinds.Lib.Nat). ((ForeignKinds.Lib.NatProxy ((n :: ForeignKinds.Lib.Nat))) -> ((ForeignKinds.Lib.NatProxy ((ForeignKinds.Lib.Succ ((n :: ForeignKinds.Lib.Nat))))))) +succProxy = + \(v: (ForeignKinds.Lib.NatProxy ((n :: ForeignKinds.Lib.Nat)))) -> + (NatProxy: (ForeignKinds.Lib.NatProxy + ((ForeignKinds.Lib.Succ ((n :: ForeignKinds.Lib.Nat)))))) + +proxy3 :: (ForeignKinds.Lib.NatProxy ((ForeignKinds.Lib.Succ ((ForeignKinds.Lib.Succ ((ForeignKinds.Lib.Succ (ForeignKinds.Lib.Zero)))))))) +proxy3 = + (NatProxy: (ForeignKinds.Lib.NatProxy + ((ForeignKinds.Lib.Succ + ((ForeignKinds.Lib.Succ + ((ForeignKinds.Lib.Succ (ForeignKinds.Lib.Zero))))))))) + +proxy2 :: (ForeignKinds.Lib.NatProxy ((ForeignKinds.Lib.Succ ((ForeignKinds.Lib.Succ (ForeignKinds.Lib.Zero)))))) +proxy2 = + (NatProxy: (ForeignKinds.Lib.NatProxy + ((ForeignKinds.Lib.Succ ((ForeignKinds.Lib.Succ (ForeignKinds.Lib.Zero))))))) + +proxy1 :: (ForeignKinds.Lib.NatProxy ((ForeignKinds.Lib.Succ (ForeignKinds.Lib.Zero)))) +proxy1 = + (NatProxy: (ForeignKinds.Lib.NatProxy + ((ForeignKinds.Lib.Succ (ForeignKinds.Lib.Zero))))) + +proxy0 :: (ForeignKinds.Lib.NatProxy (ForeignKinds.Lib.Zero)) +proxy0 = (NatProxy: (ForeignKinds.Lib.NatProxy (ForeignKinds.Lib.Zero))) + +addNat :: forall (l :: ForeignKinds.Lib.Nat) (r :: ForeignKinds.Lib.Nat) (o :: ForeignKinds.Lib.Nat). ((((ForeignKinds.Lib.AddNat$Dict ((l :: ForeignKinds.Lib.Nat))) ((r :: ForeignKinds.Lib.Nat))) ((o :: ForeignKinds.Lib.Nat))) -> (((ForeignKinds.Lib.NatProxy ((l :: ForeignKinds.Lib.Nat))) -> (((ForeignKinds.Lib.NatProxy ((r :: ForeignKinds.Lib.Nat))) -> ((ForeignKinds.Lib.NatProxy ((o :: ForeignKinds.Lib.Nat))))))))) +addNat = + \($__unused: (((ForeignKinds.Lib.AddNat$Dict + ((l :: ForeignKinds.Lib.Nat))) ((r :: ForeignKinds.Lib.Nat))) ((o :: ForeignKinds.Lib.Nat)))) -> + \(v: (ForeignKinds.Lib.NatProxy ((l :: ForeignKinds.Lib.Nat)))) -> + \(v1: (ForeignKinds.Lib.NatProxy ((r :: ForeignKinds.Lib.Nat)))) -> + (NatProxy: (ForeignKinds.Lib.NatProxy ((o :: ForeignKinds.Lib.Nat)))) \ No newline at end of file diff --git a/tests/purus/passing/ForeignKind/output/ForeignKinds.Lib/externs.cbor b/tests/purus/passing/ForeignKind/output/ForeignKinds.Lib/externs.cbor new file mode 100644 index 000000000..8c9f97c5b Binary files /dev/null and b/tests/purus/passing/ForeignKind/output/ForeignKinds.Lib/externs.cbor differ diff --git a/tests/purus/passing/ForeignKind/output/package.json b/tests/purus/passing/ForeignKind/output/package.json new file mode 100644 index 000000000..7c34deb58 --- /dev/null +++ b/tests/purus/passing/ForeignKind/output/package.json @@ -0,0 +1 @@ +{"type":"module"} \ No newline at end of file diff --git a/tests/purus/passing/Import/M1.purs b/tests/purus/passing/Import/M1.purs new file mode 100644 index 000000000..ccc699e1c --- /dev/null +++ b/tests/purus/passing/Import/M1.purs @@ -0,0 +1,6 @@ +module M1 where + +id :: forall (a :: Type). a -> a +id = \x -> x + +foo = id diff --git a/tests/purus/passing/Import/M2.purs b/tests/purus/passing/Import/M2.purs new file mode 100644 index 000000000..a6a9846e7 --- /dev/null +++ b/tests/purus/passing/Import/M2.purs @@ -0,0 +1,5 @@ +module M2 where + +import M1 + +main = \_ -> foo 42 diff --git a/tests/purus/passing/Import/output/M1/M1.cfn b/tests/purus/passing/Import/output/M1/M1.cfn new file mode 100644 index 000000000..e06cddb3a --- /dev/null +++ b/tests/purus/passing/Import/output/M1/M1.cfn @@ -0,0 +1 @@ +{"builtWith":"0.0.1","comments":[],"dataTypes":{"_ctorDict":[],"_tyDict":[]},"decls":[{"annotation":{"meta":null,"sourceSpan":{"end":[3,33],"start":[3,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[4,8],"start":[4,7]}},"argument":"x","body":{"annotation":{"meta":null,"sourceSpan":{"end":[4,13],"start":[4,12]}},"kind":"Var","type":{"annotation":[{"end":[3,28],"name":"tests/purus/passing/Import/M1.purs","start":[3,27]},[]],"contents":{"kind":{"annotation":[{"end":[3,24],"name":"tests/purus/passing/Import/M1.purs","start":[3,20]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"},"value":{"identifier":"x","sourcePos":[4,7]}},"kind":"Abs","type":{"annotation":[{"end":[3,33],"name":"tests/purus/passing/Import/M1.purs","start":[3,7]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[3,24],"name":"tests/purus/passing/Import/M1.purs","start":[3,20]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":0,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[3,28],"name":"tests/purus/passing/Import/M1.purs","start":[3,27]},[]],"contents":{"kind":{"annotation":[{"end":[3,24],"name":"tests/purus/passing/Import/M1.purs","start":[3,20]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[3,33],"name":"tests/purus/passing/Import/M1.purs","start":[3,32]},[]],"contents":{"kind":{"annotation":[{"end":[3,24],"name":"tests/purus/passing/Import/M1.purs","start":[3,20]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"identifier":"id"},{"annotation":{"meta":null,"sourceSpan":{"end":[6,9],"start":[6,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[6,9],"start":[6,7]}},"kind":"Var","type":{"annotation":[{"end":[3,33],"name":"tests/purus/passing/Import/M1.purs","start":[3,7]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[3,24],"name":"tests/purus/passing/Import/M1.purs","start":[3,20]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":0,"type":{"annotation":[{"end":[3,33],"name":"tests/purus/passing/Import/M1.purs","start":[3,27]},[]],"contents":[{"annotation":[{"end":[3,33],"name":"tests/purus/passing/Import/M1.purs","start":[3,27]},[]],"contents":[{"annotation":[{"end":[3,31],"name":"tests/purus/passing/Import/M1.purs","start":[3,29]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[3,28],"name":"tests/purus/passing/Import/M1.purs","start":[3,27]},[]],"contents":{"kind":{"annotation":[{"end":[3,24],"name":"tests/purus/passing/Import/M1.purs","start":[3,20]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[3,33],"name":"tests/purus/passing/Import/M1.purs","start":[3,32]},[]],"contents":{"kind":{"annotation":[{"end":[3,24],"name":"tests/purus/passing/Import/M1.purs","start":[3,20]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"id","moduleName":["M1"]}},"identifier":"foo"}],"exports":["id","foo"],"foreign":[],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[6,9],"start":[1,1]}},"moduleName":["Builtin"]},{"annotation":{"meta":null,"sourceSpan":{"end":[6,9],"start":[1,1]}},"moduleName":["M1"]},{"annotation":{"meta":null,"sourceSpan":{"end":[6,9],"start":[1,1]}},"moduleName":["Prim"]}],"moduleName":["M1"],"modulePath":"tests/purus/passing/Import/M1.purs","reExports":{},"sourceSpan":{"end":[6,9],"start":[1,1]}} \ No newline at end of file diff --git a/tests/purus/passing/Import/output/M1/M1.cfn.pretty b/tests/purus/passing/Import/output/M1/M1.cfn.pretty new file mode 100644 index 000000000..c2ba96901 --- /dev/null +++ b/tests/purus/passing/Import/output/M1/M1.cfn.pretty @@ -0,0 +1,33 @@ +M1 (tests/purus/passing/Import/M1.purs) + +Imported Modules: +------------------------------ + Builtin, + M1, + Prim + +Exports: +------------------------------ + id, + foo + +Re-Exports: +------------------------------ + + +Foreign: +------------------------------ + + +Datatypes: +------------------------------ + + + +Declarations: +------------------------------ +id :: forall (a :: Prim.Type). ((a :: Prim.Type) -> ((a :: Prim.Type))) +id = \(x: (a :: Prim.Type)) -> (x: (a :: Prim.Type)) + +foo :: forall (a :: Prim.Type). ((a :: Prim.Type) -> ((a :: Prim.Type))) +foo = (id: forall (a :: Prim.Type). ((a :: Prim.Type) -> ((a :: Prim.Type)))) \ No newline at end of file diff --git a/tests/purus/passing/Import/output/M1/externs.cbor b/tests/purus/passing/Import/output/M1/externs.cbor new file mode 100644 index 000000000..11c6f36c3 Binary files /dev/null and b/tests/purus/passing/Import/output/M1/externs.cbor differ diff --git a/tests/purus/passing/Import/output/M2/M2.cfn b/tests/purus/passing/Import/output/M2/M2.cfn new file mode 100644 index 000000000..880ebfe14 --- /dev/null +++ b/tests/purus/passing/Import/output/M2/M2.cfn @@ -0,0 +1 @@ +{"builtWith":"0.0.1","comments":[],"dataTypes":{"_ctorDict":[],"_tyDict":[]},"decls":[{"annotation":{"meta":null,"sourceSpan":{"end":[5,20],"start":[5,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"argument":"v","body":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[5,17],"start":[5,14]}},"kind":"Var","type":{"annotation":[{"end":[3,33],"name":"tests/purus/passing/Import/M1.purs","start":[3,7]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[3,24],"name":"tests/purus/passing/Import/M1.purs","start":[3,20]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":0,"type":{"annotation":[{"end":[3,33],"name":"tests/purus/passing/Import/M1.purs","start":[3,27]},[]],"contents":[{"annotation":[{"end":[3,33],"name":"tests/purus/passing/Import/M1.purs","start":[3,27]},[]],"contents":[{"annotation":[{"end":[3,31],"name":"tests/purus/passing/Import/M1.purs","start":[3,29]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[3,28],"name":"tests/purus/passing/Import/M1.purs","start":[3,27]},[]],"contents":{"kind":{"annotation":[{"end":[3,24],"name":"tests/purus/passing/Import/M1.purs","start":[3,20]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[3,33],"name":"tests/purus/passing/Import/M1.purs","start":[3,32]},[]],"contents":{"kind":{"annotation":[{"end":[3,24],"name":"tests/purus/passing/Import/M1.purs","start":[3,20]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"foo","moduleName":["M1"]}},"annotation":{"meta":null,"sourceSpan":{"end":[5,20],"start":[5,14]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[5,20],"start":[5,18]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"literalType":"IntLiteral","value":42}},"kind":"App"},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"t1","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"t1"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"identifier":"main"}],"exports":["main"],"foreign":[],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[5,20],"start":[1,1]}},"moduleName":["Builtin"]},{"annotation":{"meta":null,"sourceSpan":{"end":[5,20],"start":[1,1]}},"moduleName":["M1"]},{"annotation":{"meta":null,"sourceSpan":{"end":[5,20],"start":[1,1]}},"moduleName":["Prim"]}],"moduleName":["M2"],"modulePath":"tests/purus/passing/Import/M2.purs","reExports":{},"sourceSpan":{"end":[5,20],"start":[1,1]}} \ No newline at end of file diff --git a/tests/purus/passing/Import/output/M2/M2.cfn.pretty b/tests/purus/passing/Import/output/M2/M2.cfn.pretty new file mode 100644 index 000000000..6c0926f46 --- /dev/null +++ b/tests/purus/passing/Import/output/M2/M2.cfn.pretty @@ -0,0 +1,32 @@ +M2 (tests/purus/passing/Import/M2.purs) + +Imported Modules: +------------------------------ + Builtin, + M1, + Prim + +Exports: +------------------------------ + main + +Re-Exports: +------------------------------ + + +Foreign: +------------------------------ + + +Datatypes: +------------------------------ + + + +Declarations: +------------------------------ +main :: forall (t1 :: Prim.Type). ((t1 :: Prim.Type) -> (Prim.Int)) +main = + \(v: (t1 :: Prim.Type)) -> + (foo: forall (a :: Prim.Type). ((a :: Prim.Type) -> ((a :: Prim.Type)))) + (42: Prim.Int) \ No newline at end of file diff --git a/tests/purus/passing/Import/output/M2/externs.cbor b/tests/purus/passing/Import/output/M2/externs.cbor new file mode 100644 index 000000000..f68dbd637 Binary files /dev/null and b/tests/purus/passing/Import/output/M2/externs.cbor differ diff --git a/tests/purus/passing/Import/output/package.json b/tests/purus/passing/Import/output/package.json new file mode 100644 index 000000000..7c34deb58 --- /dev/null +++ b/tests/purus/passing/Import/output/package.json @@ -0,0 +1 @@ +{"type":"module"} \ No newline at end of file diff --git a/tests/purus/passing/ImportExplicit/M1.purs b/tests/purus/passing/ImportExplicit/M1.purs new file mode 100644 index 000000000..cf27f2df6 --- /dev/null +++ b/tests/purus/passing/ImportExplicit/M1.purs @@ -0,0 +1,4 @@ +module M1 where + +data X = X | Y +data Z = Z diff --git a/tests/purus/passing/ImportExplicit/output/M1/M1.cfn b/tests/purus/passing/ImportExplicit/output/M1/M1.cfn new file mode 100644 index 000000000..6516290e9 --- /dev/null +++ b/tests/purus/passing/ImportExplicit/output/M1/M1.cfn @@ -0,0 +1 @@ +{"builtWith":"0.0.1","comments":[],"dataTypes":{"_ctorDict":[[[["M1"],{"Ident":"X"}],[["M1"],"X"]],[[["M1"],{"Ident":"Y"}],[["M1"],"X"]],[[["M1"],{"Ident":"Z"}],[["M1"],"Z"]]],"_tyDict":[[[["M1"],"X"],{"_dDataArgs":[],"_dDataCtors":[{"_cdCtorFields":[],"_cdCtorName":[["M1"],{"Ident":"X"}]},{"_cdCtorFields":[],"_cdCtorName":[["M1"],{"Ident":"Y"}]}],"_dDataTyName":[["M1"],"X"],"_dDeclType":"data"}],[[["M1"],"Z"],{"_dDataArgs":[],"_dDataCtors":[{"_cdCtorFields":[],"_cdCtorName":[["M1"],{"Ident":"Z"}]}],"_dDataTyName":[["M1"],"Z"],"_dDeclType":"data"}]]},"decls":[],"exports":["X","Y","Z"],"foreign":[],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[4,11],"start":[1,1]}},"moduleName":["Builtin"]},{"annotation":{"meta":null,"sourceSpan":{"end":[4,11],"start":[1,1]}},"moduleName":["Prim"]}],"moduleName":["M1"],"modulePath":"tests/purus/passing/ImportExplicit/M1.purs","reExports":{},"sourceSpan":{"end":[4,11],"start":[1,1]}} \ No newline at end of file diff --git a/tests/purus/passing/ImportExplicit/output/M1/M1.cfn.pretty b/tests/purus/passing/ImportExplicit/output/M1/M1.cfn.pretty new file mode 100644 index 000000000..c0dc12cfc --- /dev/null +++ b/tests/purus/passing/ImportExplicit/output/M1/M1.cfn.pretty @@ -0,0 +1,33 @@ +M1 (tests/purus/passing/ImportExplicit/M1.purs) + +Imported Modules: +------------------------------ + Builtin, + Prim + +Exports: +------------------------------ + X, + Y, + Z + +Re-Exports: +------------------------------ + + +Foreign: +------------------------------ + + +Datatypes: +------------------------------ +data X = + X + | Y + +data Z = + Z + + +Declarations: +------------------------------ diff --git a/tests/purus/passing/ImportExplicit/output/M1/externs.cbor b/tests/purus/passing/ImportExplicit/output/M1/externs.cbor new file mode 100644 index 000000000..5699a961d Binary files /dev/null and b/tests/purus/passing/ImportExplicit/output/M1/externs.cbor differ diff --git a/tests/purus/passing/ImportExplicit/output/package.json b/tests/purus/passing/ImportExplicit/output/package.json new file mode 100644 index 000000000..7c34deb58 --- /dev/null +++ b/tests/purus/passing/ImportExplicit/output/package.json @@ -0,0 +1 @@ +{"type":"module"} \ No newline at end of file diff --git a/tests/purus/passing/ImportQualified/M1.purs b/tests/purus/passing/ImportQualified/M1.purs new file mode 100644 index 000000000..719a1a03e --- /dev/null +++ b/tests/purus/passing/ImportQualified/M1.purs @@ -0,0 +1,3 @@ +module M1 where + +log x = x diff --git a/tests/purus/passing/ImportQualified/output/M1/M1.cfn b/tests/purus/passing/ImportQualified/output/M1/M1.cfn new file mode 100644 index 000000000..5de44a1ca --- /dev/null +++ b/tests/purus/passing/ImportQualified/output/M1/M1.cfn @@ -0,0 +1 @@ +{"builtWith":"0.0.1","comments":[],"dataTypes":{"_ctorDict":[],"_tyDict":[]},"decls":[{"annotation":{"meta":null,"sourceSpan":{"end":[3,10],"start":[3,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[3,10],"start":[3,1]}},"argument":"x","body":{"annotation":{"meta":null,"sourceSpan":{"end":[3,10],"start":[3,9]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"t1"},"tag":"TypeVar"},"value":{"identifier":"x","sourcePos":[3,1]}},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"t1","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"t1"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"t1"},"tag":"TypeVar"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"identifier":"log"}],"exports":["log"],"foreign":[],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[3,10],"start":[1,1]}},"moduleName":["Builtin"]},{"annotation":{"meta":null,"sourceSpan":{"end":[3,10],"start":[1,1]}},"moduleName":["Prim"]}],"moduleName":["M1"],"modulePath":"tests/purus/passing/ImportQualified/M1.purs","reExports":{},"sourceSpan":{"end":[3,10],"start":[1,1]}} \ No newline at end of file diff --git a/tests/purus/passing/ImportQualified/output/M1/M1.cfn.pretty b/tests/purus/passing/ImportQualified/output/M1/M1.cfn.pretty new file mode 100644 index 000000000..c09b42821 --- /dev/null +++ b/tests/purus/passing/ImportQualified/output/M1/M1.cfn.pretty @@ -0,0 +1,28 @@ +M1 (tests/purus/passing/ImportQualified/M1.purs) + +Imported Modules: +------------------------------ + Builtin, + Prim + +Exports: +------------------------------ + log + +Re-Exports: +------------------------------ + + +Foreign: +------------------------------ + + +Datatypes: +------------------------------ + + + +Declarations: +------------------------------ +log :: forall (t1 :: Prim.Type). ((t1 :: Prim.Type) -> ((t1 :: Prim.Type))) +log = \(x: (t1 :: Prim.Type)) -> (x: (t1 :: Prim.Type)) \ No newline at end of file diff --git a/tests/purus/passing/ImportQualified/output/M1/externs.cbor b/tests/purus/passing/ImportQualified/output/M1/externs.cbor new file mode 100644 index 000000000..53093f766 Binary files /dev/null and b/tests/purus/passing/ImportQualified/output/M1/externs.cbor differ diff --git a/tests/purus/passing/ImportQualified/output/package.json b/tests/purus/passing/ImportQualified/output/package.json new file mode 100644 index 000000000..7c34deb58 --- /dev/null +++ b/tests/purus/passing/ImportQualified/output/package.json @@ -0,0 +1 @@ +{"type":"module"} \ No newline at end of file diff --git a/tests/purus/passing/InstanceUnnamedSimilarClassName/ImportedClassName.purs b/tests/purus/passing/InstanceUnnamedSimilarClassName/ImportedClassName.purs new file mode 100644 index 000000000..917c18f05 --- /dev/null +++ b/tests/purus/passing/InstanceUnnamedSimilarClassName/ImportedClassName.purs @@ -0,0 +1,4 @@ +module ImportedClassName where + +class ClassName (a :: Type) where + foo :: a -> Int diff --git a/tests/purus/passing/InstanceUnnamedSimilarClassName/output/ImportedClassName/ImportedClassName.cfn b/tests/purus/passing/InstanceUnnamedSimilarClassName/output/ImportedClassName/ImportedClassName.cfn new file mode 100644 index 000000000..a75b840d1 --- /dev/null +++ b/tests/purus/passing/InstanceUnnamedSimilarClassName/output/ImportedClassName/ImportedClassName.cfn @@ -0,0 +1 @@ +{"builtWith":"0.0.1","comments":[],"dataTypes":{"_ctorDict":[[[["ImportedClassName"],{"Ident":"ClassName$Dict"}],[["ImportedClassName"],"ClassName$Dict"]]],"_tyDict":[[[["ImportedClassName"],"ClassName$Dict"],{"_dDataArgs":[["a",{"annotation":[{"end":[3,27],"name":"tests/purus/passing/InstanceUnnamedSimilarClassName/ImportedClassName.purs","start":[3,23]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}]],"_dDataCtors":[{"_cdCtorFields":[[{"Ident":"dict"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["foo",{"annotation":[{"end":[4,18],"name":"tests/purus/passing/InstanceUnnamedSimilarClassName/ImportedClassName.purs","start":[4,10]},[]],"contents":[{"annotation":[{"end":[4,18],"name":"tests/purus/passing/InstanceUnnamedSimilarClassName/ImportedClassName.purs","start":[4,10]},[]],"contents":[{"annotation":[{"end":[4,14],"name":"tests/purus/passing/InstanceUnnamedSimilarClassName/ImportedClassName.purs","start":[4,12]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[4,11],"name":"tests/purus/passing/InstanceUnnamedSimilarClassName/ImportedClassName.purs","start":[4,10]},[]],"contents":{"kind":{"annotation":[{"end":[3,27],"name":"tests/purus/passing/InstanceUnnamedSimilarClassName/ImportedClassName.purs","start":[3,23]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[4,18],"name":"tests/purus/passing/InstanceUnnamedSimilarClassName/ImportedClassName.purs","start":[4,15]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"tag":"REmpty"}],"tag":"RCons"}],"tag":"TypeApp"}]],"_cdCtorName":[["ImportedClassName"],{"Ident":"ClassName$Dict"}]}],"_dDataTyName":[["ImportedClassName"],"ClassName$Dict"],"_dDeclType":"newtype"}]]},"decls":[{"annotation":{"meta":null,"sourceSpan":{"end":[4,18],"start":[4,3]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[4,18],"start":[4,3]}},"argument":"dict","body":{"annotation":{"meta":null,"sourceSpan":{"end":[4,18],"start":[4,3]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":{"metaType":"IsNewtype"},"sourceSpan":{"end":[4,18],"start":[4,3]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[4,18],"start":[4,3]}},"binderType":"VarBinder","identifier":"v","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["foo",{"annotation":[{"end":[4,18],"name":"tests/purus/passing/InstanceUnnamedSimilarClassName/ImportedClassName.purs","start":[4,10]},[]],"contents":[{"annotation":[{"end":[4,18],"name":"tests/purus/passing/InstanceUnnamedSimilarClassName/ImportedClassName.purs","start":[4,10]},[]],"contents":[{"annotation":[{"end":[4,14],"name":"tests/purus/passing/InstanceUnnamedSimilarClassName/ImportedClassName.purs","start":[4,12]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[3,27],"name":"tests/purus/passing/InstanceUnnamedSimilarClassName/ImportedClassName.purs","start":[3,23]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[4,18],"name":"tests/purus/passing/InstanceUnnamedSimilarClassName/ImportedClassName.purs","start":[4,15]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"tag":"REmpty"},{"annotation":[{"end":[4,14],"name":"tests/purus/passing/InstanceUnnamedSimilarClassName/ImportedClassName.purs","start":[4,12]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"KindApp"}],"tag":"RCons"}],"tag":"TypeApp"}}],"constructorName":{"identifier":"ClassName$Dict","moduleName":["ImportedClassName"]},"typeName":{"identifier":"ClassName$Dict","moduleName":["ImportedClassName"]}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[4,18],"start":[4,3]}},"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[4,18],"start":[4,3]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["foo",{"annotation":[{"end":[4,18],"name":"tests/purus/passing/InstanceUnnamedSimilarClassName/ImportedClassName.purs","start":[4,10]},[]],"contents":[{"annotation":[{"end":[4,18],"name":"tests/purus/passing/InstanceUnnamedSimilarClassName/ImportedClassName.purs","start":[4,10]},[]],"contents":[{"annotation":[{"end":[4,14],"name":"tests/purus/passing/InstanceUnnamedSimilarClassName/ImportedClassName.purs","start":[4,12]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[3,27],"name":"tests/purus/passing/InstanceUnnamedSimilarClassName/ImportedClassName.purs","start":[3,23]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[4,18],"name":"tests/purus/passing/InstanceUnnamedSimilarClassName/ImportedClassName.purs","start":[4,15]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"tag":"REmpty"},{"annotation":[{"end":[4,14],"name":"tests/purus/passing/InstanceUnnamedSimilarClassName/ImportedClassName.purs","start":[4,12]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"KindApp"}],"tag":"RCons"}],"tag":"TypeApp"},"value":{"identifier":"v","sourcePos":[4,3]}},"fieldName":"foo","kind":"Accessor","type":{"annotation":[{"end":[4,18],"name":"tests/purus/passing/InstanceUnnamedSimilarClassName/ImportedClassName.purs","start":[4,10]},[]],"contents":[{"annotation":[{"end":[4,18],"name":"tests/purus/passing/InstanceUnnamedSimilarClassName/ImportedClassName.purs","start":[4,10]},[]],"contents":[{"annotation":[{"end":[4,14],"name":"tests/purus/passing/InstanceUnnamedSimilarClassName/ImportedClassName.purs","start":[4,12]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[4,11],"name":"tests/purus/passing/InstanceUnnamedSimilarClassName/ImportedClassName.purs","start":[4,10]},[]],"contents":{"kind":{"annotation":[{"end":[3,27],"name":"tests/purus/passing/InstanceUnnamedSimilarClassName/ImportedClassName.purs","start":[3,23]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[4,18],"name":"tests/purus/passing/InstanceUnnamedSimilarClassName/ImportedClassName.purs","start":[4,15]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[4,18],"start":[4,3]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["ImportedClassName"],"ClassName$Dict"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[3,27],"name":"tests/purus/passing/InstanceUnnamedSimilarClassName/ImportedClassName.purs","start":[3,23]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},"value":{"identifier":"dict","sourcePos":[0,0]}}],"kind":"Case","type":{"annotation":[{"end":[4,18],"name":"tests/purus/passing/InstanceUnnamedSimilarClassName/ImportedClassName.purs","start":[4,10]},[]],"contents":[{"annotation":[{"end":[4,18],"name":"tests/purus/passing/InstanceUnnamedSimilarClassName/ImportedClassName.purs","start":[4,10]},[]],"contents":[{"annotation":[{"end":[4,14],"name":"tests/purus/passing/InstanceUnnamedSimilarClassName/ImportedClassName.purs","start":[4,12]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[4,11],"name":"tests/purus/passing/InstanceUnnamedSimilarClassName/ImportedClassName.purs","start":[4,10]},[]],"contents":{"kind":{"annotation":[{"end":[3,27],"name":"tests/purus/passing/InstanceUnnamedSimilarClassName/ImportedClassName.purs","start":[3,23]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[4,18],"name":"tests/purus/passing/InstanceUnnamedSimilarClassName/ImportedClassName.purs","start":[4,15]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[3,27],"name":"tests/purus/passing/InstanceUnnamedSimilarClassName/ImportedClassName.purs","start":[3,23]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":0,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["ImportedClassName"],"ClassName$Dict"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[3,27],"name":"tests/purus/passing/InstanceUnnamedSimilarClassName/ImportedClassName.purs","start":[3,23]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[4,18],"name":"tests/purus/passing/InstanceUnnamedSimilarClassName/ImportedClassName.purs","start":[4,10]},[]],"contents":[{"annotation":[{"end":[4,18],"name":"tests/purus/passing/InstanceUnnamedSimilarClassName/ImportedClassName.purs","start":[4,10]},[]],"contents":[{"annotation":[{"end":[4,14],"name":"tests/purus/passing/InstanceUnnamedSimilarClassName/ImportedClassName.purs","start":[4,12]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[4,11],"name":"tests/purus/passing/InstanceUnnamedSimilarClassName/ImportedClassName.purs","start":[4,10]},[]],"contents":{"kind":{"annotation":[{"end":[3,27],"name":"tests/purus/passing/InstanceUnnamedSimilarClassName/ImportedClassName.purs","start":[3,23]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[4,18],"name":"tests/purus/passing/InstanceUnnamedSimilarClassName/ImportedClassName.purs","start":[4,15]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarVisible"},"tag":"ForAll"}},"identifier":"foo"}],"exports":["foo"],"foreign":[],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[4,18],"start":[1,1]}},"moduleName":["Builtin"]},{"annotation":{"meta":null,"sourceSpan":{"end":[4,18],"start":[1,1]}},"moduleName":["ImportedClassName"]},{"annotation":{"meta":null,"sourceSpan":{"end":[4,18],"start":[1,1]}},"moduleName":["Prim"]}],"moduleName":["ImportedClassName"],"modulePath":"tests/purus/passing/InstanceUnnamedSimilarClassName/ImportedClassName.purs","reExports":{},"sourceSpan":{"end":[4,18],"start":[1,1]}} \ No newline at end of file diff --git a/tests/purus/passing/InstanceUnnamedSimilarClassName/output/ImportedClassName/ImportedClassName.cfn.pretty b/tests/purus/passing/InstanceUnnamedSimilarClassName/output/ImportedClassName/ImportedClassName.cfn.pretty new file mode 100644 index 000000000..9b9c79827 --- /dev/null +++ b/tests/purus/passing/InstanceUnnamedSimilarClassName/output/ImportedClassName/ImportedClassName.cfn.pretty @@ -0,0 +1,33 @@ +ImportedClassName (tests/purus/passing/InstanceUnnamedSimilarClassName/ImportedClassName.purs) + +Imported Modules: +------------------------------ + Builtin, + ImportedClassName, + Prim + +Exports: +------------------------------ + foo + +Re-Exports: +------------------------------ + + +Foreign: +------------------------------ + + +Datatypes: +------------------------------ +newtype ClassName$Dict (a :: Prim.Type) = + ClassName$Dict ({ foo :: ((a :: Prim.Type) -> (Prim.Int)) }) + + +Declarations: +------------------------------ +foo :: forall (@a :: Prim.Type). ((ImportedClassName.ClassName$Dict ((a :: Prim.Type))) -> (((a :: Prim.Type) -> (Prim.Int)))) +foo = + \(dict: (ImportedClassName.ClassName$Dict ((a :: Prim.Type)))) -> + case (dict: (ImportedClassName.ClassName$Dict ((a :: Prim.Type)))) of + ClassName$Dict v -> (v: { foo :: ((a :: Prim.Type) -> (Prim.Int)) }).foo \ No newline at end of file diff --git a/tests/purus/passing/InstanceUnnamedSimilarClassName/output/ImportedClassName/externs.cbor b/tests/purus/passing/InstanceUnnamedSimilarClassName/output/ImportedClassName/externs.cbor new file mode 100644 index 000000000..b9baa5bb3 Binary files /dev/null and b/tests/purus/passing/InstanceUnnamedSimilarClassName/output/ImportedClassName/externs.cbor differ diff --git a/tests/purus/passing/InstanceUnnamedSimilarClassName/output/package.json b/tests/purus/passing/InstanceUnnamedSimilarClassName/output/package.json new file mode 100644 index 000000000..7c34deb58 --- /dev/null +++ b/tests/purus/passing/InstanceUnnamedSimilarClassName/output/package.json @@ -0,0 +1 @@ +{"type":"module"} \ No newline at end of file diff --git a/tests/purus/passing/Misc/Lib.purs b/tests/purus/passing/Misc/Lib.purs new file mode 100644 index 000000000..0420fe312 --- /dev/null +++ b/tests/purus/passing/Misc/Lib.purs @@ -0,0 +1,412 @@ +module Lib where + +import Prim + +testCons :: List Int +testCons = Prim.Cons 1 Nil + + +class TestClass (a :: Type) where + testMethod :: a -> Boolean + +instance TestClass Int where + testMethod x = True + +testTestClass :: Boolean +testTestClass = testMethod 3 + +class Eq (a :: Type) where + eq :: a -> a -> Boolean + +minus :: Int -> Int -> Int +minus _ _ = 42 + +instance Eq Int where + eq _ _ = true + +testEq :: Boolean +testEq = eq 1 2 + +testTuple :: Tuple3 Int Int Boolean +testTuple = Tuple3 1 2 True + +{- Tomasz's Counterexample -} +workingEven :: Int -> Int +workingEven n = + if n `eq` 0 then 1 + else 42 + +brokenEven :: Int -> Int -- N.B. shouldn't be broken anymore :) +brokenEven n = + if n `eq` 0 then 1 + else brokenEven (n `minus` 2) + +data Option (a :: Type) = Some a | Nada + +opt2Int :: Option Int -> Int +opt2Int = case _ of + Some i -> i + Nada -> 0 + +testOpt2Int :: Int +testOpt2Int = opt2Int (Some 3) + +data Identitee (a :: Type) = Identitee a + +unIdentitee :: Identitee Int -> Int +unIdentitee = case _ of + Identitee x -> x + +testIdentitee = unIdentitee (Identitee 101) +-- Multi Param +class Eq2 (a :: Type) (b :: Type) where + eq2 :: a -> b -> Boolean + +instance Eq2 Int Boolean where + eq2 _ _ = true + +testEq2 :: Boolean +testEq2 = eq2 101 false + +{- Binders (also tests a bunch of other things by happenstance) -} + +-- Unit test type for inferBinder' +data TestBinderSum = + ConInt Int + -- | ConInts (List Int) + -- | ConBoolean Boolean + | ConString String + | ConChar Char + | ConNested TestBinderSum + | ConQuantified (forall (x :: Type). x -> Int) + | ConConstrained (forall (x :: Type). Eq x => x -> Int) -- kind of nonsensical + | ConObject {objField :: Int} + | ConObjectQuantified {objFieldQ :: forall (x :: Type). x -> Int} + +testBinders :: TestBinderSum -> Int +testBinders x = case x of + ConInt a -> a -- ConstructorBinder enclosing VarBinder + -- ConInts ([3] :: List Int) -> 2 -- List LitBinder, TypedBinder + -- ConInts [a,b] -> b -- VarBinders enclosed in List LitBinder + -- ConBoolean true -> 4 -- Bool LitBinder + ConChar _ -> 5 -- Char LitBinder + ConNested conNest -> case conNest of -- Nested ConstructorBinders + ConInt n -> n + _ -> 2 + ConQuantified f -> f "hello" + ConConstrained g -> g 2 + ConNested other -> 7 + ConObject obj -> obj.objField + ConObjectQuantified objQ -> objQ.objFieldQ "world" + ConObject objs -> case objs of + {objField: f} -> f + other -> 0 + +testBindersCase :: Int +testBindersCase = testBinders (ConInt 2) + +{- Binding groups (with and w/o type anns) -} +mutuallyRecursiveBindingGroup :: Int +mutuallyRecursiveBindingGroup = + let f :: Int -> Int + f x = g 2 + h :: Int -> Int -> Int + h x y = f y + g :: Int -> Int + g y = h (f y) 3 + in g 3 + +mutuallyRecursiveBindingGroupNoTypes :: Int +mutuallyRecursiveBindingGroupNoTypes = + let f' x = g' 2 + h' x y = y + g' y = h' (f' y) 3 + in g' 3 + +nestedBinds :: Int +nestedBinds = + let f :: Int -> Int + f _ = 4 + + g :: forall (a :: Type). a -> Int + g _ = 5 + + h = let i = g "hello" + j = f i + in f j + in h + +{- Data declarations -} +data ADataRec = ADataRec {hello :: Int, world :: Boolean} + +newtype ANewtypeRec = ANewTypeRec {foo :: Int} + +data ASum = Constr1 Int | Constr2 Boolean + +{- lits -} +anIntLit :: Int +anIntLit = 1 + +aStringLit :: String +aStringLit = "woop" + +aVal :: Int +aVal = 1 + +testasum :: ASum -> Int +testasum x = case x of + Constr1 y -> 1 + Constr2 z -> 2 + + +aBool :: Boolean +aBool = true + +aList :: List Int +aList = [1,2,3,4,5] + +aList2 :: List Int +aList2 = Cons 1 (Cons 2 Nil) + +{- Functions -} + +aFunction :: forall (x :: Type). x -> (forall (y :: Type). y -> Int) -> Int +aFunction any f = f any + +aFunction2 :: Int -> List Int +aFunction2 x = [x,1] + +aFunction3 :: Int -> Int +aFunction3 x = if (eq x 2) then 4 else 1 + +aFunction4 :: forall (r :: Row Type). {a :: Int | r} -> Int +aFunction4 r = r.a + +aFunction5 :: Int +aFunction5 = aFunction4 {a: 2} + +aFunction6 :: Int +aFunction6 = aFunction [] go + where + go :: forall (z :: Type). z -> Int + go _ = 10 + +-- main = aFunction4 {a: 2, b: 3} + +recF1 :: forall (x :: Type). x -> Int +recF1 x = recG1 x + +recG1 :: forall (x :: Type). x -> Int +recG1 x = recF1 x + +testBuiltin :: Int +testBuiltin = Builtin.addInteger 1 2 + +main = aFunction4 {a: 101, b: "hello"} -- recF1 "hello" + +-- main2 = ConBoolean true + +plus :: Int -> Int -> Int +plus a b = Builtin.addInteger a b + +infixr 5 plus as + + +infixr 5 Builtin.multiplyInteger as * + +fakeLT :: Int -> Int -> Boolean +fakeLT _ _ = True + +infixr 5 fakeLT as <= + +testPlus = plus 1 1 + +-- main = plus 1 1 + +guardedCase :: Int -> Int -> Int +guardedCase w x = case w, x of + y, z | eq y 2 + , aPred y + , eq z 0 + , eq y nestedBinds -> 2 + _, _ -> 0 + +nestedApplications :: Int +nestedApplications = i (f (g (h 2))) 4 + where + i x _ = x + f x = x + g _ = 5 + h = case _ of + 2 -> 3 + _ -> 5 + +{- Objects -} + +anObj :: {foo :: Int} +anObj = {foo: 3} + +objUpdate :: {foo :: Int} +objUpdate = anObj {foo = 4} + +polyInObj :: {bar :: forall (x :: Type). x -> Int, baz :: Int} +polyInObj = {bar: go, baz : 100} + where + go :: forall (y :: Type). y -> Int + go _ = 5 + +polyInObjMatch :: Int +polyInObjMatch = case polyInObj of + {bar: f, baz: _} -> f "hello" + +aPred :: Int -> Boolean +aPred _ = true + +cons :: forall (a :: Type). a -> List a -> List a +cons x xs = [x] + +emptyList = [] + +consEmptyList1 = cons 1 emptyList + +consEmptyList2 = cons "hello" emptyList + +id :: forall (t :: Type). t -> t +id x = x + +testId = id 2 + +objForall :: forall (a :: Type) (b :: Type). {getIdA :: a -> a, getIdB :: b -> b} +objForall = {getIdA: id, getIdB: id} + +arrForall :: List (forall (a :: Type). a -> a) +arrForall = [id] + +{- We should probably just remove guarded case branches, see slack msg +guardedCase :: Int +guardedCase = case polyInObj of + {bar: _, baz: x} + | eq @Int x 4 -> x + _ -> 0 +-} + +{- +id :: forall a. a -> a +id a = a + +-- Works with signature, throws without +-- inner :: { getId :: forall a. a -> a} +inner = {getId: id} +-} + +class Eq a <= Ord (a :: Type) where + compare :: a -> a -> Int + +instance Ord Int where + compare _ _ = 42 + +testEqViaOrd :: forall (a :: Type). Ord a => a -> a -> Boolean +testEqViaOrd a b = eq a b + +testValidator :: forall (a :: Type) (b :: Type) (c :: Type) + . a -> b -> c -> Boolean +testValidator datum redeemer context = True + +testValidatorApplied :: Boolean +testValidatorApplied = testValidator "datum" "redeemer" "context" + +testForLift :: Int -> Boolean +testForLift x = h x 3 + where + h a b = g a <= j 4 b + j c d = c + g d + g a = if h a x then j x 1 else x * x + +testForLiftPoly :: forall (a :: Type). a -> Boolean +testForLiftPoly x = h x True + where + q :: a + q = x + + h :: a -> Boolean -> Boolean + h a b = if g a then i q else j a b + where + i :: forall (b :: Type). b -> Boolean + i z = False + + j :: a -> Boolean -> Boolean + j c d = if d then d else g c + + g :: a -> Boolean + g y = True + +testForLiftPolyApplied = testForLiftPoly "hello" + +or :: Boolean -> Boolean -> Boolean +or b1 b2 = if b1 then True else b2 + +infixr 5 or as || + +not :: Boolean -> Boolean +not b = if b then False else True + +and :: Boolean -> Boolean -> Boolean +and p q = not (not p || not q) -- i think? rly tired atm + +infixr 6 and as && + +iff :: Boolean -> Boolean -> Boolean +iff p q = (p && q) || (not p && not q) + +infix 5 iff as === + +ghcInlinerPaperEx :: Boolean +ghcInlinerPaperEx = p + where + p = q False + h x = f True && x + g x = h x === False + f x = g (not x) + q x = g (x=== not x) + +kozsTwoSCCEx :: Boolean +kozsTwoSCCEx = + let z = True + a x = b x && x + b x = x && c x && h x + c x = not (f x && b x) + f x = not (g x) + g x = not (h x) && not x + h x = not (f x) + in a z && b z && c z && f z && g z && h z + + +testLedgerTypes :: DCert +testLedgerTypes = DCertMir + +litPattern :: Int -> Boolean +litPattern n = case n of + 0 -> False + 1 -> True + 2 -> True + 3 -> True + 4 -> True + _ -> False + +litPatternApplied :: Boolean +litPatternApplied = litPattern 5 + +irrPattern :: Int -> Int +irrPattern n = case n of + _ -> 2 + +someData :: Builtin.BuiltinData +someData = Builtin.iData 1 + +someDataList :: Builtin.BuiltinList Builtin.BuiltinData +someDataList = Builtin.mkCons someData (Builtin.mkNilData Prim.unit) + +isNullSomeDataList :: Boolean +isNullSomeDataList = Builtin.nullList someDataList + +plutusIFTE :: Builtin.BuiltinData +plutusIFTE = Builtin.ifThenElse True someData (Builtin.trace "BOOM!" someData) diff --git a/tests/purus/passing/Misc/Prelude.purs b/tests/purus/passing/Misc/Prelude.purs new file mode 100644 index 000000000..e4d54c09d --- /dev/null +++ b/tests/purus/passing/Misc/Prelude.purs @@ -0,0 +1,25 @@ +module Prelude where + + +data Bool + = True + | False + +and :: Bool -> Bool -> Bool +and True True = True +and _ _ = False + +or :: Bool -> Bool -> Bool +or True _ = True +or _ True = True +or _ _ = False + +not :: Bool -> Bool +not True = False +not False = True + +data List (a :: Type) = Nil | Cons a (List a) + +appendList :: forall (a :: Type). List a -> List a -> List a +appendList Nil ys = ys +appendList (Cons x xs) ys = Cons x (appendList xs ys) diff --git a/tests/purus/passing/Misc/output/Lib/Lib.cfn b/tests/purus/passing/Misc/output/Lib/Lib.cfn new file mode 100644 index 000000000..f6f59a756 --- /dev/null +++ b/tests/purus/passing/Misc/output/Lib/Lib.cfn @@ -0,0 +1 @@ +{"builtWith":"0.0.1","comments":[],"dataTypes":{"_ctorDict":[[[["Lib"],{"Ident":"ADataRec"}],[["Lib"],"ADataRec"]],[[["Lib"],{"Ident":"ANewTypeRec"}],[["Lib"],"ANewtypeRec"]],[[["Lib"],{"Ident":"ConChar"}],[["Lib"],"TestBinderSum"]],[[["Lib"],{"Ident":"ConConstrained"}],[["Lib"],"TestBinderSum"]],[[["Lib"],{"Ident":"ConInt"}],[["Lib"],"TestBinderSum"]],[[["Lib"],{"Ident":"ConNested"}],[["Lib"],"TestBinderSum"]],[[["Lib"],{"Ident":"ConObject"}],[["Lib"],"TestBinderSum"]],[[["Lib"],{"Ident":"ConObjectQuantified"}],[["Lib"],"TestBinderSum"]],[[["Lib"],{"Ident":"ConQuantified"}],[["Lib"],"TestBinderSum"]],[[["Lib"],{"Ident":"ConString"}],[["Lib"],"TestBinderSum"]],[[["Lib"],{"Ident":"Constr1"}],[["Lib"],"ASum"]],[[["Lib"],{"Ident":"Constr2"}],[["Lib"],"ASum"]],[[["Lib"],{"Ident":"Eq$Dict"}],[["Lib"],"Eq$Dict"]],[[["Lib"],{"Ident":"Eq2$Dict"}],[["Lib"],"Eq2$Dict"]],[[["Lib"],{"Ident":"Identitee"}],[["Lib"],"Identitee"]],[[["Lib"],{"Ident":"Nada"}],[["Lib"],"Option"]],[[["Lib"],{"Ident":"Ord$Dict"}],[["Lib"],"Ord$Dict"]],[[["Lib"],{"Ident":"Some"}],[["Lib"],"Option"]],[[["Lib"],{"Ident":"TestClass$Dict"}],[["Lib"],"TestClass$Dict"]]],"_tyDict":[[[["Lib"],"ADataRec"],{"_dDataArgs":[],"_dDataCtors":[{"_cdCtorFields":[[{"Ident":"value0"},{"annotation":[{"end":[140,58],"name":"tests/purus/passing/Misc/Lib.purs","start":[140,26]},[]],"contents":[{"annotation":[{"end":[140,27],"name":"tests/purus/passing/Misc/Lib.purs","start":[140,26]},[]],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[{"end":[140,39],"name":"tests/purus/passing/Misc/Lib.purs","start":[140,27]},[]],"contents":["hello",{"annotation":[{"end":[140,39],"name":"tests/purus/passing/Misc/Lib.purs","start":[140,36]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},{"annotation":[{"end":[140,57],"name":"tests/purus/passing/Misc/Lib.purs","start":[140,41]},[]],"contents":["world",{"annotation":[{"end":[140,57],"name":"tests/purus/passing/Misc/Lib.purs","start":[140,50]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"},{"annotation":[{"end":[140,58],"name":"tests/purus/passing/Misc/Lib.purs","start":[140,57]},[]],"tag":"REmpty"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"TypeApp"}]],"_cdCtorName":[["Lib"],{"Ident":"ADataRec"}]}],"_dDataTyName":[["Lib"],"ADataRec"],"_dDeclType":"data"}],[[["Lib"],"ANewtypeRec"],{"_dDataArgs":[],"_dDataCtors":[{"_cdCtorFields":[[{"Ident":"value0"},{"annotation":[{"end":[142,47],"name":"tests/purus/passing/Misc/Lib.purs","start":[142,35]},[]],"contents":[{"annotation":[{"end":[142,36],"name":"tests/purus/passing/Misc/Lib.purs","start":[142,35]},[]],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[{"end":[142,46],"name":"tests/purus/passing/Misc/Lib.purs","start":[142,36]},[]],"contents":["foo",{"annotation":[{"end":[142,46],"name":"tests/purus/passing/Misc/Lib.purs","start":[142,43]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},{"annotation":[{"end":[142,47],"name":"tests/purus/passing/Misc/Lib.purs","start":[142,46]},[]],"tag":"REmpty"}],"tag":"RCons"}],"tag":"TypeApp"}]],"_cdCtorName":[["Lib"],{"Ident":"ANewTypeRec"}]}],"_dDataTyName":[["Lib"],"ANewtypeRec"],"_dDeclType":"newtype"}],[[["Lib"],"ASum"],{"_dDataArgs":[],"_dDataCtors":[{"_cdCtorFields":[[{"Ident":"value0"},{"annotation":[{"end":[144,24],"name":"tests/purus/passing/Misc/Lib.purs","start":[144,21]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}]],"_cdCtorName":[["Lib"],{"Ident":"Constr1"}]},{"_cdCtorFields":[[{"Ident":"value0"},{"annotation":[{"end":[144,42],"name":"tests/purus/passing/Misc/Lib.purs","start":[144,35]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}]],"_cdCtorName":[["Lib"],{"Ident":"Constr2"}]}],"_dDataTyName":[["Lib"],"ASum"],"_dDeclType":"data"}],[[["Lib"],"Eq$Dict"],{"_dDataArgs":[["a",{"annotation":[{"end":[18,20],"name":"tests/purus/passing/Misc/Lib.purs","start":[18,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}]],"_dDataCtors":[{"_cdCtorFields":[[{"Ident":"dict"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["eq",{"annotation":[{"end":[19,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[19,9]},[]],"contents":[{"annotation":[{"end":[19,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[19,9]},[]],"contents":[{"annotation":[{"end":[19,13],"name":"tests/purus/passing/Misc/Lib.purs","start":[19,11]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[19,10],"name":"tests/purus/passing/Misc/Lib.purs","start":[19,9]},[]],"contents":{"kind":{"annotation":[{"end":[18,20],"name":"tests/purus/passing/Misc/Lib.purs","start":[18,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[19,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[19,14]},[]],"contents":[{"annotation":[{"end":[19,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[19,14]},[]],"contents":[{"annotation":[{"end":[19,18],"name":"tests/purus/passing/Misc/Lib.purs","start":[19,16]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[19,15],"name":"tests/purus/passing/Misc/Lib.purs","start":[19,14]},[]],"contents":{"kind":{"annotation":[{"end":[18,20],"name":"tests/purus/passing/Misc/Lib.purs","start":[18,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[19,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[19,19]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"tag":"REmpty"}],"tag":"RCons"}],"tag":"TypeApp"}]],"_cdCtorName":[["Lib"],{"Ident":"Eq$Dict"}]}],"_dDataTyName":[["Lib"],"Eq$Dict"],"_dDeclType":"newtype"}],[[["Lib"],"Eq2$Dict"],{"_dDataArgs":[["a",{"annotation":[{"end":[62,21],"name":"tests/purus/passing/Misc/Lib.purs","start":[62,17]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],["b",{"annotation":[{"end":[62,33],"name":"tests/purus/passing/Misc/Lib.purs","start":[62,29]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}]],"_dDataCtors":[{"_cdCtorFields":[[{"Ident":"dict"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["eq2",{"annotation":[{"end":[63,27],"name":"tests/purus/passing/Misc/Lib.purs","start":[63,10]},[]],"contents":[{"annotation":[{"end":[63,27],"name":"tests/purus/passing/Misc/Lib.purs","start":[63,10]},[]],"contents":[{"annotation":[{"end":[63,14],"name":"tests/purus/passing/Misc/Lib.purs","start":[63,12]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[63,11],"name":"tests/purus/passing/Misc/Lib.purs","start":[63,10]},[]],"contents":{"kind":{"annotation":[{"end":[62,21],"name":"tests/purus/passing/Misc/Lib.purs","start":[62,17]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[63,27],"name":"tests/purus/passing/Misc/Lib.purs","start":[63,15]},[]],"contents":[{"annotation":[{"end":[63,27],"name":"tests/purus/passing/Misc/Lib.purs","start":[63,15]},[]],"contents":[{"annotation":[{"end":[63,19],"name":"tests/purus/passing/Misc/Lib.purs","start":[63,17]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[63,16],"name":"tests/purus/passing/Misc/Lib.purs","start":[63,15]},[]],"contents":{"kind":{"annotation":[{"end":[62,33],"name":"tests/purus/passing/Misc/Lib.purs","start":[62,29]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"b"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[63,27],"name":"tests/purus/passing/Misc/Lib.purs","start":[63,20]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"tag":"REmpty"}],"tag":"RCons"}],"tag":"TypeApp"}]],"_cdCtorName":[["Lib"],{"Ident":"Eq2$Dict"}]}],"_dDataTyName":[["Lib"],"Eq2$Dict"],"_dDeclType":"newtype"}],[[["Lib"],"Identitee"],{"_dDataArgs":[["a",{"annotation":[{"end":[54,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[54,22]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}]],"_dDataCtors":[{"_cdCtorFields":[[{"Ident":"value0"},{"annotation":[{"end":[54,41],"name":"tests/purus/passing/Misc/Lib.purs","start":[54,40]},[]],"contents":{"kind":{"annotation":[{"end":[54,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[54,22]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}]],"_cdCtorName":[["Lib"],{"Ident":"Identitee"}]}],"_dDataTyName":[["Lib"],"Identitee"],"_dDeclType":"data"}],[[["Lib"],"Option"],{"_dDataArgs":[["a",{"annotation":[{"end":[44,23],"name":"tests/purus/passing/Misc/Lib.purs","start":[44,19]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}]],"_dDataCtors":[{"_cdCtorFields":[[{"Ident":"value0"},{"annotation":[{"end":[44,33],"name":"tests/purus/passing/Misc/Lib.purs","start":[44,32]},[]],"contents":{"kind":{"annotation":[{"end":[44,23],"name":"tests/purus/passing/Misc/Lib.purs","start":[44,19]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}]],"_cdCtorName":[["Lib"],{"Ident":"Some"}]},{"_cdCtorFields":[],"_cdCtorName":[["Lib"],{"Ident":"Nada"}]}],"_dDataTyName":[["Lib"],"Option"],"_dDeclType":"data"}],[[["Lib"],"Ord$Dict"],{"_dDataArgs":[["a",{"annotation":[{"end":[301,29],"name":"tests/purus/passing/Misc/Lib.purs","start":[301,25]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}]],"_dDataCtors":[{"_cdCtorFields":[[{"Ident":"dict"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["compare",{"annotation":[{"end":[302,27],"name":"tests/purus/passing/Misc/Lib.purs","start":[302,14]},[]],"contents":[{"annotation":[{"end":[302,27],"name":"tests/purus/passing/Misc/Lib.purs","start":[302,14]},[]],"contents":[{"annotation":[{"end":[302,18],"name":"tests/purus/passing/Misc/Lib.purs","start":[302,16]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[302,15],"name":"tests/purus/passing/Misc/Lib.purs","start":[302,14]},[]],"contents":{"kind":{"annotation":[{"end":[301,29],"name":"tests/purus/passing/Misc/Lib.purs","start":[301,25]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[302,27],"name":"tests/purus/passing/Misc/Lib.purs","start":[302,19]},[]],"contents":[{"annotation":[{"end":[302,27],"name":"tests/purus/passing/Misc/Lib.purs","start":[302,19]},[]],"contents":[{"annotation":[{"end":[302,23],"name":"tests/purus/passing/Misc/Lib.purs","start":[302,21]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[302,20],"name":"tests/purus/passing/Misc/Lib.purs","start":[302,19]},[]],"contents":{"kind":{"annotation":[{"end":[301,29],"name":"tests/purus/passing/Misc/Lib.purs","start":[301,25]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[302,27],"name":"tests/purus/passing/Misc/Lib.purs","start":[302,24]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["Eq0",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"tag":"REmpty"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Lib"],"Eq$Dict"],"tag":"TypeConstructor"},{"annotation":[{"end":[301,11],"name":"tests/purus/passing/Misc/Lib.purs","start":[301,10]},[]],"contents":{"kind":{"annotation":[{"end":[301,29],"name":"tests/purus/passing/Misc/Lib.purs","start":[301,25]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"tag":"REmpty"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"TypeApp"}]],"_cdCtorName":[["Lib"],{"Ident":"Ord$Dict"}]}],"_dDataTyName":[["Lib"],"Ord$Dict"],"_dDeclType":"newtype"}],[[["Lib"],"TestBinderSum"],{"_dDataArgs":[],"_dDataCtors":[{"_cdCtorFields":[[{"Ident":"value0"},{"annotation":[{"end":[75,15],"name":"tests/purus/passing/Misc/Lib.purs","start":[75,12]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}]],"_cdCtorName":[["Lib"],{"Ident":"ConInt"}]},{"_cdCtorFields":[[{"Ident":"value0"},{"annotation":[{"end":[78,21],"name":"tests/purus/passing/Misc/Lib.purs","start":[78,15]},[]],"contents":[["Prim"],"String"],"tag":"TypeConstructor"}]],"_cdCtorName":[["Lib"],{"Ident":"ConString"}]},{"_cdCtorFields":[[{"Ident":"value0"},{"annotation":[{"end":[79,17],"name":"tests/purus/passing/Misc/Lib.purs","start":[79,13]},[]],"contents":[["Prim"],"Char"],"tag":"TypeConstructor"}]],"_cdCtorName":[["Lib"],{"Ident":"ConChar"}]},{"_cdCtorFields":[[{"Ident":"value0"},{"annotation":[{"end":[80,28],"name":"tests/purus/passing/Misc/Lib.purs","start":[80,15]},[]],"contents":[["Lib"],"TestBinderSum"],"tag":"TypeConstructor"}]],"_cdCtorName":[["Lib"],{"Ident":"ConNested"}]},{"_cdCtorFields":[[{"Ident":"value0"},{"annotation":[{"end":[81,48],"name":"tests/purus/passing/Misc/Lib.purs","start":[81,20]},[]],"contents":{"identifier":"x","kind":{"annotation":[{"end":[81,37],"name":"tests/purus/passing/Misc/Lib.purs","start":[81,33]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[81,48],"name":"tests/purus/passing/Misc/Lib.purs","start":[81,40]},[]],"contents":[{"annotation":[{"end":[81,48],"name":"tests/purus/passing/Misc/Lib.purs","start":[81,40]},[]],"contents":[{"annotation":[{"end":[81,44],"name":"tests/purus/passing/Misc/Lib.purs","start":[81,42]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[81,41],"name":"tests/purus/passing/Misc/Lib.purs","start":[81,40]},[]],"contents":{"kind":{"annotation":[{"end":[81,37],"name":"tests/purus/passing/Misc/Lib.purs","start":[81,33]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"x"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[81,48],"name":"tests/purus/passing/Misc/Lib.purs","start":[81,45]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}]],"_cdCtorName":[["Lib"],{"Ident":"ConQuantified"}]},{"_cdCtorFields":[[{"Ident":"value0"},{"annotation":[{"end":[82,57],"name":"tests/purus/passing/Misc/Lib.purs","start":[82,21]},[]],"contents":{"identifier":"x","kind":{"annotation":[{"end":[82,38],"name":"tests/purus/passing/Misc/Lib.purs","start":[82,34]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Lib"],"Eq$Dict"],"tag":"TypeConstructor"},{"annotation":[{"end":[82,45],"name":"tests/purus/passing/Misc/Lib.purs","start":[82,44]},[]],"contents":{"kind":{"annotation":[{"end":[82,38],"name":"tests/purus/passing/Misc/Lib.purs","start":[82,34]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"x"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[82,57],"name":"tests/purus/passing/Misc/Lib.purs","start":[82,49]},[]],"contents":[{"annotation":[{"end":[82,57],"name":"tests/purus/passing/Misc/Lib.purs","start":[82,49]},[]],"contents":[{"annotation":[{"end":[82,53],"name":"tests/purus/passing/Misc/Lib.purs","start":[82,51]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[82,50],"name":"tests/purus/passing/Misc/Lib.purs","start":[82,49]},[]],"contents":{"kind":{"annotation":[{"end":[82,38],"name":"tests/purus/passing/Misc/Lib.purs","start":[82,34]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"x"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[82,57],"name":"tests/purus/passing/Misc/Lib.purs","start":[82,54]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}]],"_cdCtorName":[["Lib"],{"Ident":"ConConstrained"}]},{"_cdCtorFields":[[{"Ident":"value0"},{"annotation":[{"end":[83,32],"name":"tests/purus/passing/Misc/Lib.purs","start":[83,15]},[]],"contents":[{"annotation":[{"end":[83,16],"name":"tests/purus/passing/Misc/Lib.purs","start":[83,15]},[]],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[{"end":[83,31],"name":"tests/purus/passing/Misc/Lib.purs","start":[83,16]},[]],"contents":["objField",{"annotation":[{"end":[83,31],"name":"tests/purus/passing/Misc/Lib.purs","start":[83,28]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},{"annotation":[{"end":[83,32],"name":"tests/purus/passing/Misc/Lib.purs","start":[83,31]},[]],"tag":"REmpty"}],"tag":"RCons"}],"tag":"TypeApp"}]],"_cdCtorName":[["Lib"],{"Ident":"ConObject"}]},{"_cdCtorFields":[[{"Ident":"value0"},{"annotation":[{"end":[84,68],"name":"tests/purus/passing/Misc/Lib.purs","start":[84,25]},[]],"contents":[{"annotation":[{"end":[84,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[84,25]},[]],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[{"end":[84,67],"name":"tests/purus/passing/Misc/Lib.purs","start":[84,26]},[]],"contents":["objFieldQ",{"annotation":[{"end":[84,67],"name":"tests/purus/passing/Misc/Lib.purs","start":[84,39]},[]],"contents":{"identifier":"x","kind":{"annotation":[{"end":[84,56],"name":"tests/purus/passing/Misc/Lib.purs","start":[84,52]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[84,67],"name":"tests/purus/passing/Misc/Lib.purs","start":[84,59]},[]],"contents":[{"annotation":[{"end":[84,67],"name":"tests/purus/passing/Misc/Lib.purs","start":[84,59]},[]],"contents":[{"annotation":[{"end":[84,63],"name":"tests/purus/passing/Misc/Lib.purs","start":[84,61]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[84,60],"name":"tests/purus/passing/Misc/Lib.purs","start":[84,59]},[]],"contents":{"kind":{"annotation":[{"end":[84,56],"name":"tests/purus/passing/Misc/Lib.purs","start":[84,52]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"x"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[84,67],"name":"tests/purus/passing/Misc/Lib.purs","start":[84,64]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},{"annotation":[{"end":[84,68],"name":"tests/purus/passing/Misc/Lib.purs","start":[84,67]},[]],"tag":"REmpty"}],"tag":"RCons"}],"tag":"TypeApp"}]],"_cdCtorName":[["Lib"],{"Ident":"ConObjectQuantified"}]}],"_dDataTyName":[["Lib"],"TestBinderSum"],"_dDeclType":"data"}],[[["Lib"],"TestClass$Dict"],{"_dDataArgs":[["a",{"annotation":[{"end":[9,27],"name":"tests/purus/passing/Misc/Lib.purs","start":[9,23]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}]],"_dDataCtors":[{"_cdCtorFields":[[{"Ident":"dict"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["testMethod",{"annotation":[{"end":[10,29],"name":"tests/purus/passing/Misc/Lib.purs","start":[10,17]},[]],"contents":[{"annotation":[{"end":[10,29],"name":"tests/purus/passing/Misc/Lib.purs","start":[10,17]},[]],"contents":[{"annotation":[{"end":[10,21],"name":"tests/purus/passing/Misc/Lib.purs","start":[10,19]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[10,18],"name":"tests/purus/passing/Misc/Lib.purs","start":[10,17]},[]],"contents":{"kind":{"annotation":[{"end":[9,27],"name":"tests/purus/passing/Misc/Lib.purs","start":[9,23]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[10,29],"name":"tests/purus/passing/Misc/Lib.purs","start":[10,22]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"tag":"REmpty"}],"tag":"RCons"}],"tag":"TypeApp"}]],"_cdCtorName":[["Lib"],{"Ident":"TestClass$Dict"}]}],"_dDataTyName":[["Lib"],"TestClass$Dict"],"_dDeclType":"newtype"}]]},"decls":[{"annotation":{"meta":null,"sourceSpan":{"end":[13,22],"start":[12,1]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":{"metaType":"IsNewtype"},"sourceSpan":{"end":[13,22],"start":[12,1]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["testMethod",{"annotation":[{"end":[10,29],"name":"tests/purus/passing/Misc/Lib.purs","start":[10,17]},[]],"contents":[{"annotation":[{"end":[10,29],"name":"tests/purus/passing/Misc/Lib.purs","start":[10,17]},[]],"contents":[{"annotation":[{"end":[10,21],"name":"tests/purus/passing/Misc/Lib.purs","start":[10,19]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[12,23],"name":"tests/purus/passing/Misc/Lib.purs","start":[12,20]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[10,29],"name":"tests/purus/passing/Misc/Lib.purs","start":[10,22]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"tag":"REmpty"},{"annotation":[{"end":[10,21],"name":"tests/purus/passing/Misc/Lib.purs","start":[10,19]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"KindApp"}],"tag":"RCons"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Lib"],"TestClass$Dict"],"tag":"TypeConstructor"},{"annotation":[{"end":[12,23],"name":"tests/purus/passing/Misc/Lib.purs","start":[12,20]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"TestClass$Dict","moduleName":["Lib"]}},"annotation":{"meta":null,"sourceSpan":{"end":[13,22],"start":[12,1]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[13,22],"start":[12,1]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["testMethod",{"annotation":[{"end":[10,29],"name":"tests/purus/passing/Misc/Lib.purs","start":[10,17]},[]],"contents":[{"annotation":[{"end":[10,29],"name":"tests/purus/passing/Misc/Lib.purs","start":[10,17]},[]],"contents":[{"annotation":[{"end":[10,21],"name":"tests/purus/passing/Misc/Lib.purs","start":[10,19]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[12,23],"name":"tests/purus/passing/Misc/Lib.purs","start":[12,20]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[10,29],"name":"tests/purus/passing/Misc/Lib.purs","start":[10,22]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"tag":"REmpty"},{"annotation":[{"end":[10,21],"name":"tests/purus/passing/Misc/Lib.purs","start":[10,19]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"KindApp"}],"tag":"RCons"}],"tag":"TypeApp"},"value":{"literalType":"ObjectLiteral","value":[["testMethod",{"annotation":{"meta":null,"sourceSpan":{"end":[13,22],"start":[13,3]}},"argument":"x","body":{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[13,22],"start":[13,18]}},"kind":"Var","type":{"annotation":[{"end":[10,29],"name":"tests/purus/passing/Misc/Lib.purs","start":[10,22]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"},"value":{"identifier":"True","moduleName":["Prim"]}},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[12,23],"name":"tests/purus/passing/Misc/Lib.purs","start":[12,20]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[10,29],"name":"tests/purus/passing/Misc/Lib.purs","start":[10,22]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"}}]]}},"kind":"App"},"identifier":"testClassInt"},{"annotation":{"meta":null,"sourceSpan":{"end":[25,16],"start":[24,1]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":{"metaType":"IsNewtype"},"sourceSpan":{"end":[25,16],"start":[24,1]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["eq",{"annotation":[{"end":[19,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[19,9]},[]],"contents":[{"annotation":[{"end":[19,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[19,9]},[]],"contents":[{"annotation":[{"end":[19,13],"name":"tests/purus/passing/Misc/Lib.purs","start":[19,11]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[24,16],"name":"tests/purus/passing/Misc/Lib.purs","start":[24,13]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[19,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[19,14]},[]],"contents":[{"annotation":[{"end":[19,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[19,14]},[]],"contents":[{"annotation":[{"end":[19,18],"name":"tests/purus/passing/Misc/Lib.purs","start":[19,16]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[24,16],"name":"tests/purus/passing/Misc/Lib.purs","start":[24,13]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[19,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[19,19]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"tag":"REmpty"},{"annotation":[{"end":[19,13],"name":"tests/purus/passing/Misc/Lib.purs","start":[19,11]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"KindApp"}],"tag":"RCons"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Lib"],"Eq$Dict"],"tag":"TypeConstructor"},{"annotation":[{"end":[24,16],"name":"tests/purus/passing/Misc/Lib.purs","start":[24,13]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"Eq$Dict","moduleName":["Lib"]}},"annotation":{"meta":null,"sourceSpan":{"end":[25,16],"start":[24,1]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[25,16],"start":[24,1]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["eq",{"annotation":[{"end":[19,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[19,9]},[]],"contents":[{"annotation":[{"end":[19,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[19,9]},[]],"contents":[{"annotation":[{"end":[19,13],"name":"tests/purus/passing/Misc/Lib.purs","start":[19,11]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[24,16],"name":"tests/purus/passing/Misc/Lib.purs","start":[24,13]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[19,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[19,14]},[]],"contents":[{"annotation":[{"end":[19,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[19,14]},[]],"contents":[{"annotation":[{"end":[19,18],"name":"tests/purus/passing/Misc/Lib.purs","start":[19,16]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[24,16],"name":"tests/purus/passing/Misc/Lib.purs","start":[24,13]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[19,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[19,19]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"tag":"REmpty"},{"annotation":[{"end":[19,13],"name":"tests/purus/passing/Misc/Lib.purs","start":[19,11]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"KindApp"}],"tag":"RCons"}],"tag":"TypeApp"},"value":{"literalType":"ObjectLiteral","value":[["eq",{"annotation":{"meta":null,"sourceSpan":{"end":[25,16],"start":[25,3]}},"argument":"v","body":{"annotation":{"meta":null,"sourceSpan":{"end":[25,16],"start":[25,3]}},"argument":"v1","body":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"},"value":{"identifier":"True","moduleName":["Prim"]}},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[24,16],"name":"tests/purus/passing/Misc/Lib.purs","start":[24,13]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[19,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[19,19]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[24,16],"name":"tests/purus/passing/Misc/Lib.purs","start":[24,13]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[19,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[19,14]},[]],"contents":[{"annotation":[{"end":[19,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[19,14]},[]],"contents":[{"annotation":[{"end":[19,18],"name":"tests/purus/passing/Misc/Lib.purs","start":[19,16]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[24,16],"name":"tests/purus/passing/Misc/Lib.purs","start":[24,13]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[19,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[19,19]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}}]]}},"kind":"App"},"identifier":"eqInt"},{"annotation":{"meta":null,"sourceSpan":{"end":[305,19],"start":[304,1]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":{"metaType":"IsNewtype"},"sourceSpan":{"end":[305,19],"start":[304,1]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["compare",{"annotation":[{"end":[302,27],"name":"tests/purus/passing/Misc/Lib.purs","start":[302,14]},[]],"contents":[{"annotation":[{"end":[302,27],"name":"tests/purus/passing/Misc/Lib.purs","start":[302,14]},[]],"contents":[{"annotation":[{"end":[302,18],"name":"tests/purus/passing/Misc/Lib.purs","start":[302,16]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[304,17],"name":"tests/purus/passing/Misc/Lib.purs","start":[304,14]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[302,27],"name":"tests/purus/passing/Misc/Lib.purs","start":[302,19]},[]],"contents":[{"annotation":[{"end":[302,27],"name":"tests/purus/passing/Misc/Lib.purs","start":[302,19]},[]],"contents":[{"annotation":[{"end":[302,23],"name":"tests/purus/passing/Misc/Lib.purs","start":[302,21]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[304,17],"name":"tests/purus/passing/Misc/Lib.purs","start":[304,14]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[302,27],"name":"tests/purus/passing/Misc/Lib.purs","start":[302,24]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["Eq0",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"tag":"REmpty"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"KindApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Lib"],"Eq$Dict"],"tag":"TypeConstructor"},{"annotation":[{"end":[304,17],"name":"tests/purus/passing/Misc/Lib.purs","start":[304,14]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"tag":"REmpty"},{"annotation":[{"end":[302,18],"name":"tests/purus/passing/Misc/Lib.purs","start":[302,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"KindApp"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Lib"],"Ord$Dict"],"tag":"TypeConstructor"},{"annotation":[{"end":[304,17],"name":"tests/purus/passing/Misc/Lib.purs","start":[304,14]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"Ord$Dict","moduleName":["Lib"]}},"annotation":{"meta":null,"sourceSpan":{"end":[305,19],"start":[304,1]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[305,19],"start":[304,1]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["compare",{"annotation":[{"end":[302,27],"name":"tests/purus/passing/Misc/Lib.purs","start":[302,14]},[]],"contents":[{"annotation":[{"end":[302,27],"name":"tests/purus/passing/Misc/Lib.purs","start":[302,14]},[]],"contents":[{"annotation":[{"end":[302,18],"name":"tests/purus/passing/Misc/Lib.purs","start":[302,16]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[304,17],"name":"tests/purus/passing/Misc/Lib.purs","start":[304,14]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[302,27],"name":"tests/purus/passing/Misc/Lib.purs","start":[302,19]},[]],"contents":[{"annotation":[{"end":[302,27],"name":"tests/purus/passing/Misc/Lib.purs","start":[302,19]},[]],"contents":[{"annotation":[{"end":[302,23],"name":"tests/purus/passing/Misc/Lib.purs","start":[302,21]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[304,17],"name":"tests/purus/passing/Misc/Lib.purs","start":[304,14]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[302,27],"name":"tests/purus/passing/Misc/Lib.purs","start":[302,24]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["Eq0",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"tag":"REmpty"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"KindApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Lib"],"Eq$Dict"],"tag":"TypeConstructor"},{"annotation":[{"end":[304,17],"name":"tests/purus/passing/Misc/Lib.purs","start":[304,14]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"tag":"REmpty"},{"annotation":[{"end":[302,18],"name":"tests/purus/passing/Misc/Lib.purs","start":[302,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"KindApp"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"TypeApp"},"value":{"literalType":"ObjectLiteral","value":[["Eq0",{"annotation":{"meta":null,"sourceSpan":{"end":[305,19],"start":[304,1]}},"argument":"$__unused","body":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Lib"],"Eq$Dict"],"tag":"TypeConstructor"},{"annotation":[{"end":[304,17],"name":"tests/purus/passing/Misc/Lib.purs","start":[304,14]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"eqInt","moduleName":["Lib"]}},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"tag":"REmpty"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"KindApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Lib"],"Eq$Dict"],"tag":"TypeConstructor"},{"annotation":[{"end":[304,17],"name":"tests/purus/passing/Misc/Lib.purs","start":[304,14]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}}],["compare",{"annotation":{"meta":null,"sourceSpan":{"end":[305,19],"start":[305,3]}},"argument":"v","body":{"annotation":{"meta":null,"sourceSpan":{"end":[305,19],"start":[305,3]}},"argument":"v1","body":{"annotation":{"meta":null,"sourceSpan":{"end":[305,19],"start":[305,17]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"literalType":"IntLiteral","value":42}},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[304,17],"name":"tests/purus/passing/Misc/Lib.purs","start":[304,14]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[302,27],"name":"tests/purus/passing/Misc/Lib.purs","start":[302,24]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[304,17],"name":"tests/purus/passing/Misc/Lib.purs","start":[304,14]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[302,27],"name":"tests/purus/passing/Misc/Lib.purs","start":[302,19]},[]],"contents":[{"annotation":[{"end":[302,27],"name":"tests/purus/passing/Misc/Lib.purs","start":[302,19]},[]],"contents":[{"annotation":[{"end":[302,23],"name":"tests/purus/passing/Misc/Lib.purs","start":[302,21]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[304,17],"name":"tests/purus/passing/Misc/Lib.purs","start":[304,14]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[302,27],"name":"tests/purus/passing/Misc/Lib.purs","start":[302,24]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}}]]}},"kind":"App"},"identifier":"ordInt"},{"annotation":{"meta":null,"sourceSpan":{"end":[66,17],"start":[65,1]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":{"metaType":"IsNewtype"},"sourceSpan":{"end":[66,17],"start":[65,1]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["eq2",{"annotation":[{"end":[63,27],"name":"tests/purus/passing/Misc/Lib.purs","start":[63,10]},[]],"contents":[{"annotation":[{"end":[63,27],"name":"tests/purus/passing/Misc/Lib.purs","start":[63,10]},[]],"contents":[{"annotation":[{"end":[63,14],"name":"tests/purus/passing/Misc/Lib.purs","start":[63,12]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[65,17],"name":"tests/purus/passing/Misc/Lib.purs","start":[65,14]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[63,27],"name":"tests/purus/passing/Misc/Lib.purs","start":[63,15]},[]],"contents":[{"annotation":[{"end":[63,27],"name":"tests/purus/passing/Misc/Lib.purs","start":[63,15]},[]],"contents":[{"annotation":[{"end":[63,19],"name":"tests/purus/passing/Misc/Lib.purs","start":[63,17]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[65,25],"name":"tests/purus/passing/Misc/Lib.purs","start":[65,18]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[63,27],"name":"tests/purus/passing/Misc/Lib.purs","start":[63,20]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"tag":"REmpty"},{"annotation":[{"end":[63,14],"name":"tests/purus/passing/Misc/Lib.purs","start":[63,12]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"KindApp"}],"tag":"RCons"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Lib"],"Eq2$Dict"],"tag":"TypeConstructor"},{"annotation":[{"end":[65,17],"name":"tests/purus/passing/Misc/Lib.purs","start":[65,14]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[65,25],"name":"tests/purus/passing/Misc/Lib.purs","start":[65,18]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"Eq2$Dict","moduleName":["Lib"]}},"annotation":{"meta":null,"sourceSpan":{"end":[66,17],"start":[65,1]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[66,17],"start":[65,1]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["eq2",{"annotation":[{"end":[63,27],"name":"tests/purus/passing/Misc/Lib.purs","start":[63,10]},[]],"contents":[{"annotation":[{"end":[63,27],"name":"tests/purus/passing/Misc/Lib.purs","start":[63,10]},[]],"contents":[{"annotation":[{"end":[63,14],"name":"tests/purus/passing/Misc/Lib.purs","start":[63,12]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[65,17],"name":"tests/purus/passing/Misc/Lib.purs","start":[65,14]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[63,27],"name":"tests/purus/passing/Misc/Lib.purs","start":[63,15]},[]],"contents":[{"annotation":[{"end":[63,27],"name":"tests/purus/passing/Misc/Lib.purs","start":[63,15]},[]],"contents":[{"annotation":[{"end":[63,19],"name":"tests/purus/passing/Misc/Lib.purs","start":[63,17]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[65,25],"name":"tests/purus/passing/Misc/Lib.purs","start":[65,18]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[63,27],"name":"tests/purus/passing/Misc/Lib.purs","start":[63,20]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"tag":"REmpty"},{"annotation":[{"end":[63,14],"name":"tests/purus/passing/Misc/Lib.purs","start":[63,12]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"KindApp"}],"tag":"RCons"}],"tag":"TypeApp"},"value":{"literalType":"ObjectLiteral","value":[["eq2",{"annotation":{"meta":null,"sourceSpan":{"end":[66,17],"start":[66,3]}},"argument":"v","body":{"annotation":{"meta":null,"sourceSpan":{"end":[66,17],"start":[66,3]}},"argument":"v1","body":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"},"value":{"identifier":"True","moduleName":["Prim"]}},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[65,25],"name":"tests/purus/passing/Misc/Lib.purs","start":[65,18]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[63,27],"name":"tests/purus/passing/Misc/Lib.purs","start":[63,20]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[65,17],"name":"tests/purus/passing/Misc/Lib.purs","start":[65,14]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[63,27],"name":"tests/purus/passing/Misc/Lib.purs","start":[63,15]},[]],"contents":[{"annotation":[{"end":[63,27],"name":"tests/purus/passing/Misc/Lib.purs","start":[63,15]},[]],"contents":[{"annotation":[{"end":[63,19],"name":"tests/purus/passing/Misc/Lib.purs","start":[63,17]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[65,25],"name":"tests/purus/passing/Misc/Lib.purs","start":[65,18]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[63,27],"name":"tests/purus/passing/Misc/Lib.purs","start":[63,20]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}}]]}},"kind":"App"},"identifier":"eq2IntBoolean"},{"annotation":{"meta":null,"sourceSpan":{"end":[56,36],"start":[56,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"argument":"v","body":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":{"constructorType":"ProductType","identifiers":["value0"],"metaType":"IsConstructor"},"sourceSpan":{"end":[58,14],"start":[58,3]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[58,14],"start":[58,13]}},"binderType":"VarBinder","identifier":"x","type":{"annotation":[{"end":[56,29],"name":"tests/purus/passing/Misc/Lib.purs","start":[56,26]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}}],"constructorName":{"identifier":"Identitee","moduleName":["Lib"]},"typeName":{"identifier":"Identitee","moduleName":["Lib"]}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[58,19],"start":[58,18]}},"kind":"Var","type":{"annotation":[{"end":[56,29],"name":"tests/purus/passing/Misc/Lib.purs","start":[56,26]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"identifier":"x","sourcePos":[58,13]}},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"kind":"Var","type":{"annotation":[{"end":[56,29],"name":"tests/purus/passing/Misc/Lib.purs","start":[56,16]},[]],"contents":[{"annotation":[{"end":[56,25],"name":"tests/purus/passing/Misc/Lib.purs","start":[56,16]},[]],"contents":[["Lib"],"Identitee"],"tag":"TypeConstructor"},{"annotation":[{"end":[56,29],"name":"tests/purus/passing/Misc/Lib.purs","start":[56,26]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"v","sourcePos":[0,0]}}],"kind":"Case","type":{"annotation":[{"end":[56,36],"name":"tests/purus/passing/Misc/Lib.purs","start":[56,33]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[56,29],"name":"tests/purus/passing/Misc/Lib.purs","start":[56,16]},[]],"contents":[{"annotation":[{"end":[56,25],"name":"tests/purus/passing/Misc/Lib.purs","start":[56,16]},[]],"contents":[["Lib"],"Identitee"],"tag":"TypeConstructor"},{"annotation":[{"end":[56,29],"name":"tests/purus/passing/Misc/Lib.purs","start":[56,26]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[56,36],"name":"tests/purus/passing/Misc/Lib.purs","start":[56,33]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"identifier":"unIdentitee"},{"annotation":{"meta":null,"sourceSpan":{"end":[156,24],"start":[156,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[159,17],"start":[157,1]}},"argument":"x","body":{"annotation":{"meta":null,"sourceSpan":{"end":[159,17],"start":[157,14]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":["value0"],"metaType":"IsConstructor"},"sourceSpan":{"end":[158,12],"start":[158,3]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[158,12],"start":[158,11]}},"binderType":"VarBinder","identifier":"y","type":{"annotation":[{"end":[144,24],"name":"tests/purus/passing/Misc/Lib.purs","start":[144,21]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}}],"constructorName":{"identifier":"Constr1","moduleName":["Lib"]},"typeName":{"identifier":"ASum","moduleName":["Lib"]}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[158,17],"start":[158,16]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"literalType":"IntLiteral","value":1}},"isGuarded":false},{"binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":["value0"],"metaType":"IsConstructor"},"sourceSpan":{"end":[159,12],"start":[159,3]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[159,12],"start":[159,11]}},"binderType":"VarBinder","identifier":"z","type":{"annotation":[{"end":[144,42],"name":"tests/purus/passing/Misc/Lib.purs","start":[144,35]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}}],"constructorName":{"identifier":"Constr2","moduleName":["Lib"]},"typeName":{"identifier":"ASum","moduleName":["Lib"]}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[159,17],"start":[159,16]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"literalType":"IntLiteral","value":2}},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[157,20],"start":[157,19]}},"kind":"Var","type":{"annotation":[{"end":[156,17],"name":"tests/purus/passing/Misc/Lib.purs","start":[156,13]},[]],"contents":[["Lib"],"ASum"],"tag":"TypeConstructor"},"value":{"identifier":"x","sourcePos":[157,1]}}],"kind":"Case","type":{"annotation":[{"end":[156,24],"name":"tests/purus/passing/Misc/Lib.purs","start":[156,21]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[156,17],"name":"tests/purus/passing/Misc/Lib.purs","start":[156,13]},[]],"contents":[["Lib"],"ASum"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[156,24],"name":"tests/purus/passing/Misc/Lib.purs","start":[156,21]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"identifier":"testasum"},{"annotation":{"meta":null,"sourceSpan":{"end":[311,39],"start":[310,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[312,45],"start":[312,1]}},"argument":"datum","body":{"annotation":{"meta":null,"sourceSpan":{"end":[312,45],"start":[312,1]}},"argument":"redeemer","body":{"annotation":{"meta":null,"sourceSpan":{"end":[312,45],"start":[312,1]}},"argument":"context","body":{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[312,45],"start":[312,41]}},"kind":"Var","type":{"annotation":[{"end":[311,39],"name":"tests/purus/passing/Misc/Lib.purs","start":[311,32]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"},"value":{"identifier":"True","moduleName":["Prim"]}},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[311,28],"name":"tests/purus/passing/Misc/Lib.purs","start":[311,27]},[]],"contents":{"kind":{"annotation":[{"end":[310,59],"name":"tests/purus/passing/Misc/Lib.purs","start":[310,55]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"c"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[311,39],"name":"tests/purus/passing/Misc/Lib.purs","start":[311,32]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[311,23],"name":"tests/purus/passing/Misc/Lib.purs","start":[311,22]},[]],"contents":{"kind":{"annotation":[{"end":[310,47],"name":"tests/purus/passing/Misc/Lib.purs","start":[310,43]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"b"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[311,39],"name":"tests/purus/passing/Misc/Lib.purs","start":[311,27]},[]],"contents":[{"annotation":[{"end":[311,39],"name":"tests/purus/passing/Misc/Lib.purs","start":[311,27]},[]],"contents":[{"annotation":[{"end":[311,31],"name":"tests/purus/passing/Misc/Lib.purs","start":[311,29]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[311,28],"name":"tests/purus/passing/Misc/Lib.purs","start":[311,27]},[]],"contents":{"kind":{"annotation":[{"end":[310,59],"name":"tests/purus/passing/Misc/Lib.purs","start":[310,55]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"c"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[311,39],"name":"tests/purus/passing/Misc/Lib.purs","start":[311,32]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"kind":"Abs","type":{"annotation":[{"end":[311,39],"name":"tests/purus/passing/Misc/Lib.purs","start":[310,18]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[310,35],"name":"tests/purus/passing/Misc/Lib.purs","start":[310,31]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":7,"type":{"annotation":[{"end":[311,39],"name":"tests/purus/passing/Misc/Lib.purs","start":[310,38]},[]],"contents":{"identifier":"b","kind":{"annotation":[{"end":[310,47],"name":"tests/purus/passing/Misc/Lib.purs","start":[310,43]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":6,"type":{"annotation":[{"end":[311,39],"name":"tests/purus/passing/Misc/Lib.purs","start":[310,50]},[]],"contents":{"identifier":"c","kind":{"annotation":[{"end":[310,59],"name":"tests/purus/passing/Misc/Lib.purs","start":[310,55]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":5,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[311,18],"name":"tests/purus/passing/Misc/Lib.purs","start":[311,17]},[]],"contents":{"kind":{"annotation":[{"end":[310,35],"name":"tests/purus/passing/Misc/Lib.purs","start":[310,31]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[311,39],"name":"tests/purus/passing/Misc/Lib.purs","start":[311,22]},[]],"contents":[{"annotation":[{"end":[311,39],"name":"tests/purus/passing/Misc/Lib.purs","start":[311,22]},[]],"contents":[{"annotation":[{"end":[311,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[311,24]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[311,23],"name":"tests/purus/passing/Misc/Lib.purs","start":[311,22]},[]],"contents":{"kind":{"annotation":[{"end":[310,47],"name":"tests/purus/passing/Misc/Lib.purs","start":[310,43]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"b"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[311,39],"name":"tests/purus/passing/Misc/Lib.purs","start":[311,27]},[]],"contents":[{"annotation":[{"end":[311,39],"name":"tests/purus/passing/Misc/Lib.purs","start":[311,27]},[]],"contents":[{"annotation":[{"end":[311,31],"name":"tests/purus/passing/Misc/Lib.purs","start":[311,29]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[311,28],"name":"tests/purus/passing/Misc/Lib.purs","start":[311,27]},[]],"contents":{"kind":{"annotation":[{"end":[310,59],"name":"tests/purus/passing/Misc/Lib.purs","start":[310,55]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"c"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[311,39],"name":"tests/purus/passing/Misc/Lib.purs","start":[311,32]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"identifier":"testValidator"},{"annotation":{"meta":null,"sourceSpan":{"end":[314,32],"start":[314,1]}},"bindType":"NonRec","expression":{"abstraction":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[315,37],"start":[315,24]}},"kind":"Var","type":{"annotation":[{"end":[311,39],"name":"tests/purus/passing/Misc/Lib.purs","start":[310,18]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[310,35],"name":"tests/purus/passing/Misc/Lib.purs","start":[310,31]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":7,"type":{"annotation":[{"end":[311,39],"name":"tests/purus/passing/Misc/Lib.purs","start":[310,38]},[]],"contents":{"identifier":"b","kind":{"annotation":[{"end":[310,47],"name":"tests/purus/passing/Misc/Lib.purs","start":[310,43]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":6,"type":{"annotation":[{"end":[311,39],"name":"tests/purus/passing/Misc/Lib.purs","start":[310,50]},[]],"contents":{"identifier":"c","kind":{"annotation":[{"end":[310,59],"name":"tests/purus/passing/Misc/Lib.purs","start":[310,55]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":5,"type":{"annotation":[{"end":[311,39],"name":"tests/purus/passing/Misc/Lib.purs","start":[311,17]},[]],"contents":[{"annotation":[{"end":[311,39],"name":"tests/purus/passing/Misc/Lib.purs","start":[311,17]},[]],"contents":[{"annotation":[{"end":[311,21],"name":"tests/purus/passing/Misc/Lib.purs","start":[311,19]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[311,18],"name":"tests/purus/passing/Misc/Lib.purs","start":[311,17]},[]],"contents":{"kind":{"annotation":[{"end":[310,35],"name":"tests/purus/passing/Misc/Lib.purs","start":[310,31]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[311,39],"name":"tests/purus/passing/Misc/Lib.purs","start":[311,22]},[]],"contents":[{"annotation":[{"end":[311,39],"name":"tests/purus/passing/Misc/Lib.purs","start":[311,22]},[]],"contents":[{"annotation":[{"end":[311,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[311,24]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[311,23],"name":"tests/purus/passing/Misc/Lib.purs","start":[311,22]},[]],"contents":{"kind":{"annotation":[{"end":[310,47],"name":"tests/purus/passing/Misc/Lib.purs","start":[310,43]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"b"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[311,39],"name":"tests/purus/passing/Misc/Lib.purs","start":[311,27]},[]],"contents":[{"annotation":[{"end":[311,39],"name":"tests/purus/passing/Misc/Lib.purs","start":[311,27]},[]],"contents":[{"annotation":[{"end":[311,31],"name":"tests/purus/passing/Misc/Lib.purs","start":[311,29]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[311,28],"name":"tests/purus/passing/Misc/Lib.purs","start":[311,27]},[]],"contents":{"kind":{"annotation":[{"end":[310,59],"name":"tests/purus/passing/Misc/Lib.purs","start":[310,55]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"c"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[311,39],"name":"tests/purus/passing/Misc/Lib.purs","start":[311,32]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"testValidator","moduleName":["Lib"]}},"annotation":{"meta":null,"sourceSpan":{"end":[315,45],"start":[315,24]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[315,45],"start":[315,38]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"String"],"tag":"TypeConstructor"},"value":{"literalType":"StringLiteral","value":"datum"}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[315,56],"start":[315,24]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[315,56],"start":[315,46]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"String"],"tag":"TypeConstructor"},"value":{"literalType":"StringLiteral","value":"redeemer"}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[315,66],"start":[315,24]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[315,66],"start":[315,57]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"String"],"tag":"TypeConstructor"},"value":{"literalType":"StringLiteral","value":"context"}},"kind":"App"},"identifier":"testValidatorApplied"},{"annotation":{"meta":null,"sourceSpan":{"end":[30,36],"start":[30,1]}},"bindType":"NonRec","expression":{"abstraction":{"abstraction":{"abstraction":{"annotation":{"meta":{"constructorType":"ProductType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[31,19],"start":[31,13]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"t1","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":13,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"t2","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":12,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"t3","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":11,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"t1"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"t2"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"t3"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Tuple3"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"t1"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"t2"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"t3"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"Tuple3","moduleName":["Prim"]}},"annotation":{"meta":null,"sourceSpan":{"end":[31,21],"start":[31,13]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[31,21],"start":[31,20]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"literalType":"IntLiteral","value":1}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[31,23],"start":[31,13]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[31,23],"start":[31,22]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"literalType":"IntLiteral","value":2}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[31,28],"start":[31,13]}},"argument":{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[31,28],"start":[31,24]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"},"value":{"identifier":"True","moduleName":["Prim"]}},"kind":"App"},"identifier":"testTuple"},{"annotation":{"meta":null,"sourceSpan":{"end":[10,29],"start":[10,3]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[10,29],"start":[10,3]}},"argument":"dict","body":{"annotation":{"meta":null,"sourceSpan":{"end":[10,29],"start":[10,3]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":{"metaType":"IsNewtype"},"sourceSpan":{"end":[10,29],"start":[10,3]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[10,29],"start":[10,3]}},"binderType":"VarBinder","identifier":"v","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["testMethod",{"annotation":[{"end":[10,29],"name":"tests/purus/passing/Misc/Lib.purs","start":[10,17]},[]],"contents":[{"annotation":[{"end":[10,29],"name":"tests/purus/passing/Misc/Lib.purs","start":[10,17]},[]],"contents":[{"annotation":[{"end":[10,21],"name":"tests/purus/passing/Misc/Lib.purs","start":[10,19]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[9,27],"name":"tests/purus/passing/Misc/Lib.purs","start":[9,23]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[10,29],"name":"tests/purus/passing/Misc/Lib.purs","start":[10,22]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"tag":"REmpty"},{"annotation":[{"end":[10,21],"name":"tests/purus/passing/Misc/Lib.purs","start":[10,19]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"KindApp"}],"tag":"RCons"}],"tag":"TypeApp"}}],"constructorName":{"identifier":"TestClass$Dict","moduleName":["Lib"]},"typeName":{"identifier":"TestClass$Dict","moduleName":["Lib"]}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[10,29],"start":[10,3]}},"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[10,29],"start":[10,3]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["testMethod",{"annotation":[{"end":[10,29],"name":"tests/purus/passing/Misc/Lib.purs","start":[10,17]},[]],"contents":[{"annotation":[{"end":[10,29],"name":"tests/purus/passing/Misc/Lib.purs","start":[10,17]},[]],"contents":[{"annotation":[{"end":[10,21],"name":"tests/purus/passing/Misc/Lib.purs","start":[10,19]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[9,27],"name":"tests/purus/passing/Misc/Lib.purs","start":[9,23]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[10,29],"name":"tests/purus/passing/Misc/Lib.purs","start":[10,22]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"tag":"REmpty"},{"annotation":[{"end":[10,21],"name":"tests/purus/passing/Misc/Lib.purs","start":[10,19]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"KindApp"}],"tag":"RCons"}],"tag":"TypeApp"},"value":{"identifier":"v","sourcePos":[10,3]}},"fieldName":"testMethod","kind":"Accessor","type":{"annotation":[{"end":[10,29],"name":"tests/purus/passing/Misc/Lib.purs","start":[10,17]},[]],"contents":[{"annotation":[{"end":[10,29],"name":"tests/purus/passing/Misc/Lib.purs","start":[10,17]},[]],"contents":[{"annotation":[{"end":[10,21],"name":"tests/purus/passing/Misc/Lib.purs","start":[10,19]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[10,18],"name":"tests/purus/passing/Misc/Lib.purs","start":[10,17]},[]],"contents":{"kind":{"annotation":[{"end":[9,27],"name":"tests/purus/passing/Misc/Lib.purs","start":[9,23]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[10,29],"name":"tests/purus/passing/Misc/Lib.purs","start":[10,22]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[10,29],"start":[10,3]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Lib"],"TestClass$Dict"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[9,27],"name":"tests/purus/passing/Misc/Lib.purs","start":[9,23]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},"value":{"identifier":"dict","sourcePos":[0,0]}}],"kind":"Case","type":{"annotation":[{"end":[10,29],"name":"tests/purus/passing/Misc/Lib.purs","start":[10,17]},[]],"contents":[{"annotation":[{"end":[10,29],"name":"tests/purus/passing/Misc/Lib.purs","start":[10,17]},[]],"contents":[{"annotation":[{"end":[10,21],"name":"tests/purus/passing/Misc/Lib.purs","start":[10,19]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[10,18],"name":"tests/purus/passing/Misc/Lib.purs","start":[10,17]},[]],"contents":{"kind":{"annotation":[{"end":[9,27],"name":"tests/purus/passing/Misc/Lib.purs","start":[9,23]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[10,29],"name":"tests/purus/passing/Misc/Lib.purs","start":[10,22]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[9,27],"name":"tests/purus/passing/Misc/Lib.purs","start":[9,23]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":14,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Lib"],"TestClass$Dict"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[9,27],"name":"tests/purus/passing/Misc/Lib.purs","start":[9,23]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[10,29],"name":"tests/purus/passing/Misc/Lib.purs","start":[10,17]},[]],"contents":[{"annotation":[{"end":[10,29],"name":"tests/purus/passing/Misc/Lib.purs","start":[10,17]},[]],"contents":[{"annotation":[{"end":[10,21],"name":"tests/purus/passing/Misc/Lib.purs","start":[10,19]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[10,18],"name":"tests/purus/passing/Misc/Lib.purs","start":[10,17]},[]],"contents":{"kind":{"annotation":[{"end":[9,27],"name":"tests/purus/passing/Misc/Lib.purs","start":[9,23]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[10,29],"name":"tests/purus/passing/Misc/Lib.purs","start":[10,22]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarVisible"},"tag":"ForAll"}},"identifier":"testMethod"},{"annotation":{"meta":null,"sourceSpan":{"end":[15,25],"start":[15,1]}},"bindType":"NonRec","expression":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[16,27],"start":[16,17]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[9,27],"name":"tests/purus/passing/Misc/Lib.purs","start":[9,23]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":14,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Lib"],"TestClass$Dict"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[9,27],"name":"tests/purus/passing/Misc/Lib.purs","start":[9,23]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[10,29],"name":"tests/purus/passing/Misc/Lib.purs","start":[10,17]},[]],"contents":[{"annotation":[{"end":[10,29],"name":"tests/purus/passing/Misc/Lib.purs","start":[10,17]},[]],"contents":[{"annotation":[{"end":[10,21],"name":"tests/purus/passing/Misc/Lib.purs","start":[10,19]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[10,18],"name":"tests/purus/passing/Misc/Lib.purs","start":[10,17]},[]],"contents":{"kind":{"annotation":[{"end":[9,27],"name":"tests/purus/passing/Misc/Lib.purs","start":[9,23]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[10,29],"name":"tests/purus/passing/Misc/Lib.purs","start":[10,22]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarVisible"},"tag":"ForAll"},"value":{"identifier":"testMethod","moduleName":["Lib"]}},"annotation":{"meta":null,"sourceSpan":{"end":[16,29],"start":[16,17]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Lib"],"TestClass$Dict"],"tag":"TypeConstructor"},{"annotation":[{"end":[12,23],"name":"tests/purus/passing/Misc/Lib.purs","start":[12,20]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"testClassInt","moduleName":["Lib"]}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[16,29],"start":[16,17]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[16,29],"start":[16,28]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"literalType":"IntLiteral","value":3}},"kind":"App"},"identifier":"testTestClass"},{"annotation":{"meta":null,"sourceSpan":{"end":[383,25],"start":[383,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[384,27],"start":[384,19]}},"kind":"Var","type":{"annotation":[{"end":[383,25],"name":"tests/purus/passing/Misc/Lib.purs","start":[383,20]},[]],"contents":[["Prim"],"DCert"],"tag":"TypeConstructor"},"value":{"identifier":"DCertMir","moduleName":["Prim"]}},"identifier":"testLedgerTypes"},{"annotation":{"meta":null,"sourceSpan":{"end":[60,44],"start":[60,1]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[60,28],"start":[60,17]}},"kind":"Var","type":{"annotation":[{"end":[56,36],"name":"tests/purus/passing/Misc/Lib.purs","start":[56,16]},[]],"contents":[{"annotation":[{"end":[56,36],"name":"tests/purus/passing/Misc/Lib.purs","start":[56,16]},[]],"contents":[{"annotation":[{"end":[56,32],"name":"tests/purus/passing/Misc/Lib.purs","start":[56,30]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[56,29],"name":"tests/purus/passing/Misc/Lib.purs","start":[56,16]},[]],"contents":[{"annotation":[{"end":[56,25],"name":"tests/purus/passing/Misc/Lib.purs","start":[56,16]},[]],"contents":[["Lib"],"Identitee"],"tag":"TypeConstructor"},{"annotation":[{"end":[56,29],"name":"tests/purus/passing/Misc/Lib.purs","start":[56,26]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[56,36],"name":"tests/purus/passing/Misc/Lib.purs","start":[56,33]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"unIdentitee","moduleName":["Lib"]}},"annotation":{"meta":null,"sourceSpan":{"end":[60,44],"start":[60,17]}},"argument":{"abstraction":{"annotation":{"meta":{"constructorType":"ProductType","identifiers":["value0"],"metaType":"IsConstructor"},"sourceSpan":{"end":[60,39],"start":[60,30]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[54,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[54,22]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":15,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[54,41],"name":"tests/purus/passing/Misc/Lib.purs","start":[54,40]},[]],"contents":{"kind":{"annotation":[{"end":[54,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[54,22]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Lib"],"Identitee"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[54,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[54,22]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarVisible"},"tag":"ForAll"},"value":{"identifier":"Identitee","moduleName":["Lib"]}},"annotation":{"meta":null,"sourceSpan":{"end":[60,43],"start":[60,30]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[60,43],"start":[60,40]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"literalType":"IntLiteral","value":101}},"kind":"App"},"kind":"App"},"identifier":"testIdentitee"},{"annotation":{"meta":null,"sourceSpan":{"end":[324,52],"start":[324,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[340,15],"start":[325,1]}},"argument":"x","body":{"annotation":{"meta":{"metaType":"IsWhere"},"sourceSpan":{"end":[325,29],"start":[325,21]}},"binds":[{"annotation":{"meta":null,"sourceSpan":{"end":[327,11],"start":[327,5]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[328,10],"start":[328,9]}},"kind":"Var","type":{"annotation":[{"end":[324,41],"name":"tests/purus/passing/Misc/Lib.purs","start":[324,40]},[]],"contents":{"kind":{"annotation":[{"end":[324,37],"name":"tests/purus/passing/Misc/Lib.purs","start":[324,33]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"},"value":{"identifier":"x","sourcePos":[325,1]}},"identifier":"q"},{"annotation":{"meta":null,"sourceSpan":{"end":[339,22],"start":[339,5]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[340,15],"start":[340,5]}},"argument":"y","body":{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[340,15],"start":[340,11]}},"kind":"Var","type":{"annotation":[{"end":[339,22],"name":"tests/purus/passing/Misc/Lib.purs","start":[339,15]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"},"value":{"identifier":"True","moduleName":["Prim"]}},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["a",{"annotation":[{"end":[324,37],"name":"tests/purus/passing/Misc/Lib.purs","start":[324,33]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},3,17],"tag":"Skolem"}],"tag":"TypeApp"},{"annotation":[{"end":[339,22],"name":"tests/purus/passing/Misc/Lib.purs","start":[339,15]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"identifier":"g"},{"annotation":{"meta":null,"sourceSpan":{"end":[336,33],"start":[336,5]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[337,33],"start":[337,5]}},"argument":"c","body":{"annotation":{"meta":null,"sourceSpan":{"end":[337,33],"start":[337,5]}},"argument":"d","body":{"annotation":{"meta":null,"sourceSpan":{"end":[337,33],"start":[337,13]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"binderType":"ConstructorBinder","binders":[],"constructorName":{"identifier":"True","moduleName":["Prim"]},"typeName":{"identifier":"Boolean","moduleName":["Prim"]}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[337,24],"start":[337,23]}},"kind":"Var","type":{"annotation":[{"end":[336,22],"name":"tests/purus/passing/Misc/Lib.purs","start":[336,15]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"},"value":{"identifier":"d","sourcePos":[337,5]}},"isGuarded":false},{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[337,33],"start":[337,13]}},"binderType":"NullBinder"}],"expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[337,31],"start":[337,30]}},"kind":"Var","type":{"annotation":[{"end":[339,22],"name":"tests/purus/passing/Misc/Lib.purs","start":[339,10]},[]],"contents":[{"annotation":[{"end":[339,22],"name":"tests/purus/passing/Misc/Lib.purs","start":[339,10]},[]],"contents":[{"annotation":[{"end":[339,14],"name":"tests/purus/passing/Misc/Lib.purs","start":[339,12]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["a",{"annotation":[{"end":[324,37],"name":"tests/purus/passing/Misc/Lib.purs","start":[324,33]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},3,17],"tag":"Skolem"}],"tag":"TypeApp"},{"annotation":[{"end":[339,22],"name":"tests/purus/passing/Misc/Lib.purs","start":[339,15]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"g","sourcePos":[339,5]}},"annotation":{"meta":null,"sourceSpan":{"end":[337,33],"start":[337,30]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[337,33],"start":[337,32]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["a",{"annotation":[{"end":[324,37],"name":"tests/purus/passing/Misc/Lib.purs","start":[324,33]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},3,17],"tag":"Skolem"},"value":{"identifier":"c","sourcePos":[337,5]}},"kind":"App"},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[337,17],"start":[337,16]}},"kind":"Var","type":{"annotation":[{"end":[336,22],"name":"tests/purus/passing/Misc/Lib.purs","start":[336,15]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"},"value":{"identifier":"d","sourcePos":[337,5]}}],"kind":"Case","type":{"annotation":[{"end":[336,33],"name":"tests/purus/passing/Misc/Lib.purs","start":[336,26]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[336,22],"name":"tests/purus/passing/Misc/Lib.purs","start":[336,15]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[336,33],"name":"tests/purus/passing/Misc/Lib.purs","start":[336,26]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["a",{"annotation":[{"end":[324,37],"name":"tests/purus/passing/Misc/Lib.purs","start":[324,33]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},3,17],"tag":"Skolem"}],"tag":"TypeApp"},{"annotation":[{"end":[336,33],"name":"tests/purus/passing/Misc/Lib.purs","start":[336,15]},[]],"contents":[{"annotation":[{"end":[336,33],"name":"tests/purus/passing/Misc/Lib.purs","start":[336,15]},[]],"contents":[{"annotation":[{"end":[336,25],"name":"tests/purus/passing/Misc/Lib.purs","start":[336,23]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[336,22],"name":"tests/purus/passing/Misc/Lib.purs","start":[336,15]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[336,33],"name":"tests/purus/passing/Misc/Lib.purs","start":[336,26]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"identifier":"j"},{"annotation":{"meta":null,"sourceSpan":{"end":[330,33],"start":[330,5]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[334,21],"start":[331,5]}},"argument":"a","body":{"annotation":{"meta":null,"sourceSpan":{"end":[334,21],"start":[331,5]}},"argument":"b","body":{"annotation":{"meta":{"metaType":"IsWhere"},"sourceSpan":{"end":[331,40],"start":[331,13]}},"binds":[{"annotation":{"meta":null,"sourceSpan":{"end":[333,46],"start":[333,9]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[334,21],"start":[334,9]}},"argument":"z","body":{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[334,21],"start":[334,16]}},"kind":"Var","type":{"annotation":[{"end":[333,46],"name":"tests/purus/passing/Misc/Lib.purs","start":[333,39]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"},"value":{"identifier":"False","moduleName":["Prim"]}},"kind":"Abs","type":{"annotation":[{"end":[333,46],"name":"tests/purus/passing/Misc/Lib.purs","start":[333,14]},[]],"contents":{"identifier":"b","kind":{"annotation":[{"end":[333,31],"name":"tests/purus/passing/Misc/Lib.purs","start":[333,27]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":19,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[333,35],"name":"tests/purus/passing/Misc/Lib.purs","start":[333,34]},[]],"contents":{"kind":{"annotation":[{"end":[333,31],"name":"tests/purus/passing/Misc/Lib.purs","start":[333,27]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"b"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[333,46],"name":"tests/purus/passing/Misc/Lib.purs","start":[333,39]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"identifier":"i"}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[331,40],"start":[331,13]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"binderType":"ConstructorBinder","binders":[],"constructorName":{"identifier":"True","moduleName":["Prim"]},"typeName":{"identifier":"Boolean","moduleName":["Prim"]}}],"expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[331,26],"start":[331,25]}},"kind":"Var","type":{"annotation":[{"end":[333,46],"name":"tests/purus/passing/Misc/Lib.purs","start":[333,14]},[]],"contents":{"identifier":"b","kind":{"annotation":[{"end":[333,31],"name":"tests/purus/passing/Misc/Lib.purs","start":[333,27]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":19,"type":{"annotation":[{"end":[333,46],"name":"tests/purus/passing/Misc/Lib.purs","start":[333,34]},[]],"contents":[{"annotation":[{"end":[333,46],"name":"tests/purus/passing/Misc/Lib.purs","start":[333,34]},[]],"contents":[{"annotation":[{"end":[333,38],"name":"tests/purus/passing/Misc/Lib.purs","start":[333,36]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[333,35],"name":"tests/purus/passing/Misc/Lib.purs","start":[333,34]},[]],"contents":{"kind":{"annotation":[{"end":[333,31],"name":"tests/purus/passing/Misc/Lib.purs","start":[333,27]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"b"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[333,46],"name":"tests/purus/passing/Misc/Lib.purs","start":[333,39]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"i","sourcePos":[333,9]}},"annotation":{"meta":null,"sourceSpan":{"end":[331,28],"start":[331,25]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[331,28],"start":[331,27]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["a",{"annotation":[{"end":[324,37],"name":"tests/purus/passing/Misc/Lib.purs","start":[324,33]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},3,17],"tag":"Skolem"},"value":{"identifier":"q","sourcePos":[327,5]}},"kind":"App"},"isGuarded":false},{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[331,40],"start":[331,13]}},"binderType":"NullBinder"}],"expression":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[331,36],"start":[331,35]}},"kind":"Var","type":{"annotation":[{"end":[336,33],"name":"tests/purus/passing/Misc/Lib.purs","start":[336,10]},[]],"contents":[{"annotation":[{"end":[336,33],"name":"tests/purus/passing/Misc/Lib.purs","start":[336,10]},[]],"contents":[{"annotation":[{"end":[336,14],"name":"tests/purus/passing/Misc/Lib.purs","start":[336,12]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["a",{"annotation":[{"end":[324,37],"name":"tests/purus/passing/Misc/Lib.purs","start":[324,33]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},3,17],"tag":"Skolem"}],"tag":"TypeApp"},{"annotation":[{"end":[336,33],"name":"tests/purus/passing/Misc/Lib.purs","start":[336,15]},[]],"contents":[{"annotation":[{"end":[336,33],"name":"tests/purus/passing/Misc/Lib.purs","start":[336,15]},[]],"contents":[{"annotation":[{"end":[336,25],"name":"tests/purus/passing/Misc/Lib.purs","start":[336,23]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[336,22],"name":"tests/purus/passing/Misc/Lib.purs","start":[336,15]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[336,33],"name":"tests/purus/passing/Misc/Lib.purs","start":[336,26]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"j","sourcePos":[336,5]}},"annotation":{"meta":null,"sourceSpan":{"end":[331,38],"start":[331,35]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[331,38],"start":[331,37]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["a",{"annotation":[{"end":[324,37],"name":"tests/purus/passing/Misc/Lib.purs","start":[324,33]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},3,17],"tag":"Skolem"},"value":{"identifier":"a","sourcePos":[331,5]}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[331,40],"start":[331,35]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[331,40],"start":[331,39]}},"kind":"Var","type":{"annotation":[{"end":[330,22],"name":"tests/purus/passing/Misc/Lib.purs","start":[330,15]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"},"value":{"identifier":"b","sourcePos":[331,5]}},"kind":"App"},"isGuarded":false}],"caseExpressions":[{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[331,17],"start":[331,16]}},"kind":"Var","type":{"annotation":[{"end":[339,22],"name":"tests/purus/passing/Misc/Lib.purs","start":[339,10]},[]],"contents":[{"annotation":[{"end":[339,22],"name":"tests/purus/passing/Misc/Lib.purs","start":[339,10]},[]],"contents":[{"annotation":[{"end":[339,14],"name":"tests/purus/passing/Misc/Lib.purs","start":[339,12]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["a",{"annotation":[{"end":[324,37],"name":"tests/purus/passing/Misc/Lib.purs","start":[324,33]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},3,17],"tag":"Skolem"}],"tag":"TypeApp"},{"annotation":[{"end":[339,22],"name":"tests/purus/passing/Misc/Lib.purs","start":[339,15]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"g","sourcePos":[339,5]}},"annotation":{"meta":null,"sourceSpan":{"end":[331,19],"start":[331,16]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[331,19],"start":[331,18]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["a",{"annotation":[{"end":[324,37],"name":"tests/purus/passing/Misc/Lib.purs","start":[324,33]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},3,17],"tag":"Skolem"},"value":{"identifier":"a","sourcePos":[331,5]}},"kind":"App"}],"kind":"Case","type":{"annotation":[{"end":[330,33],"name":"tests/purus/passing/Misc/Lib.purs","start":[330,26]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}},"kind":"Let"},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[330,22],"name":"tests/purus/passing/Misc/Lib.purs","start":[330,15]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[330,33],"name":"tests/purus/passing/Misc/Lib.purs","start":[330,26]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["a",{"annotation":[{"end":[324,37],"name":"tests/purus/passing/Misc/Lib.purs","start":[324,33]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},3,17],"tag":"Skolem"}],"tag":"TypeApp"},{"annotation":[{"end":[330,33],"name":"tests/purus/passing/Misc/Lib.purs","start":[330,15]},[]],"contents":[{"annotation":[{"end":[330,33],"name":"tests/purus/passing/Misc/Lib.purs","start":[330,15]},[]],"contents":[{"annotation":[{"end":[330,25],"name":"tests/purus/passing/Misc/Lib.purs","start":[330,23]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[330,22],"name":"tests/purus/passing/Misc/Lib.purs","start":[330,15]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[330,33],"name":"tests/purus/passing/Misc/Lib.purs","start":[330,26]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"identifier":"h"}],"expression":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[325,22],"start":[325,21]}},"kind":"Var","type":{"annotation":[{"end":[330,33],"name":"tests/purus/passing/Misc/Lib.purs","start":[330,10]},[]],"contents":[{"annotation":[{"end":[330,33],"name":"tests/purus/passing/Misc/Lib.purs","start":[330,10]},[]],"contents":[{"annotation":[{"end":[330,14],"name":"tests/purus/passing/Misc/Lib.purs","start":[330,12]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["a",{"annotation":[{"end":[324,37],"name":"tests/purus/passing/Misc/Lib.purs","start":[324,33]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},3,17],"tag":"Skolem"}],"tag":"TypeApp"},{"annotation":[{"end":[330,33],"name":"tests/purus/passing/Misc/Lib.purs","start":[330,15]},[]],"contents":[{"annotation":[{"end":[330,33],"name":"tests/purus/passing/Misc/Lib.purs","start":[330,15]},[]],"contents":[{"annotation":[{"end":[330,25],"name":"tests/purus/passing/Misc/Lib.purs","start":[330,23]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[330,22],"name":"tests/purus/passing/Misc/Lib.purs","start":[330,15]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[330,33],"name":"tests/purus/passing/Misc/Lib.purs","start":[330,26]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"h","sourcePos":[330,5]}},"annotation":{"meta":null,"sourceSpan":{"end":[325,24],"start":[325,21]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[325,24],"start":[325,23]}},"kind":"Var","type":{"annotation":[{"end":[324,41],"name":"tests/purus/passing/Misc/Lib.purs","start":[324,40]},[]],"contents":{"kind":{"annotation":[{"end":[324,37],"name":"tests/purus/passing/Misc/Lib.purs","start":[324,33]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"},"value":{"identifier":"x","sourcePos":[325,1]}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[325,29],"start":[325,21]}},"argument":{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[325,29],"start":[325,25]}},"kind":"Var","type":{"annotation":[{"end":[330,22],"name":"tests/purus/passing/Misc/Lib.purs","start":[330,15]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"},"value":{"identifier":"True","moduleName":["Prim"]}},"kind":"App"},"kind":"Let"},"kind":"Abs","type":{"annotation":[{"end":[324,52],"name":"tests/purus/passing/Misc/Lib.purs","start":[324,20]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[324,37],"name":"tests/purus/passing/Misc/Lib.purs","start":[324,33]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":16,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[324,41],"name":"tests/purus/passing/Misc/Lib.purs","start":[324,40]},[]],"contents":{"kind":{"annotation":[{"end":[324,37],"name":"tests/purus/passing/Misc/Lib.purs","start":[324,33]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[324,52],"name":"tests/purus/passing/Misc/Lib.purs","start":[324,45]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"identifier":"testForLiftPoly"},{"annotation":{"meta":null,"sourceSpan":{"end":[342,49],"start":[342,1]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[342,41],"start":[342,26]}},"kind":"Var","type":{"annotation":[{"end":[324,52],"name":"tests/purus/passing/Misc/Lib.purs","start":[324,20]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[324,37],"name":"tests/purus/passing/Misc/Lib.purs","start":[324,33]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":16,"type":{"annotation":[{"end":[324,52],"name":"tests/purus/passing/Misc/Lib.purs","start":[324,40]},[]],"contents":[{"annotation":[{"end":[324,52],"name":"tests/purus/passing/Misc/Lib.purs","start":[324,40]},[]],"contents":[{"annotation":[{"end":[324,44],"name":"tests/purus/passing/Misc/Lib.purs","start":[324,42]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[324,41],"name":"tests/purus/passing/Misc/Lib.purs","start":[324,40]},[]],"contents":{"kind":{"annotation":[{"end":[324,37],"name":"tests/purus/passing/Misc/Lib.purs","start":[324,33]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[324,52],"name":"tests/purus/passing/Misc/Lib.purs","start":[324,45]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"testForLiftPoly","moduleName":["Lib"]}},"annotation":{"meta":null,"sourceSpan":{"end":[342,49],"start":[342,26]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[342,49],"start":[342,42]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"String"],"tag":"TypeConstructor"},"value":{"literalType":"StringLiteral","value":"hello"}},"kind":"App"},"identifier":"testForLiftPolyApplied"},{"annotation":{"meta":null,"sourceSpan":{"end":[5,21],"start":[5,1]}},"bindType":"NonRec","expression":{"abstraction":{"abstraction":{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[6,21],"start":[6,12]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"x","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":20,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"x"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"x"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"x"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"Cons","moduleName":["Prim"]}},"annotation":{"meta":null,"sourceSpan":{"end":[6,23],"start":[6,12]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[6,23],"start":[6,22]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"literalType":"IntLiteral","value":1}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[6,27],"start":[6,12]}},"argument":{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[6,27],"start":[6,24]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"Nil","moduleName":["Prim"]}},"kind":"App"},"identifier":"testCons"},{"annotation":{"meta":null,"sourceSpan":{"end":[202,19],"start":[202,1]}},"bindType":"NonRec","expression":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[203,33],"start":[203,15]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"addInteger","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[203,35],"start":[203,15]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[203,35],"start":[203,34]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"literalType":"IntLiteral","value":1}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[203,37],"start":[203,15]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[203,37],"start":[203,36]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"literalType":"IntLiteral","value":2}},"kind":"App"},"identifier":"testBuiltin"},{"annotation":{"meta":null,"sourceSpan":{"end":[86,37],"start":[86,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[103,21],"start":[87,1]}},"argument":"x","body":{"annotation":{"meta":null,"sourceSpan":{"end":[103,21],"start":[87,17]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":["value0"],"metaType":"IsConstructor"},"sourceSpan":{"end":[88,11],"start":[88,3]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[88,11],"start":[88,10]}},"binderType":"VarBinder","identifier":"a","type":{"annotation":[{"end":[75,15],"name":"tests/purus/passing/Misc/Lib.purs","start":[75,12]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}}],"constructorName":{"identifier":"ConInt","moduleName":["Lib"]},"typeName":{"identifier":"TestBinderSum","moduleName":["Lib"]}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[88,16],"start":[88,15]}},"kind":"Var","type":{"annotation":[{"end":[75,15],"name":"tests/purus/passing/Misc/Lib.purs","start":[75,12]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"identifier":"a","sourcePos":[88,10]}},"isGuarded":false},{"binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":["value0"],"metaType":"IsConstructor"},"sourceSpan":{"end":[92,12],"start":[92,3]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[92,12],"start":[92,11]}},"binderType":"NullBinder"}],"constructorName":{"identifier":"ConChar","moduleName":["Lib"]},"typeName":{"identifier":"TestBinderSum","moduleName":["Lib"]}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[92,17],"start":[92,16]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"literalType":"IntLiteral","value":5}},"isGuarded":false},{"binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":["value0"],"metaType":"IsConstructor"},"sourceSpan":{"end":[93,20],"start":[93,3]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[93,20],"start":[93,13]}},"binderType":"VarBinder","identifier":"conNest","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Lib"],"TestBinderSum"],"tag":"TypeConstructor"}}],"constructorName":{"identifier":"ConNested","moduleName":["Lib"]},"typeName":{"identifier":"TestBinderSum","moduleName":["Lib"]}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[95,11],"start":[93,24]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":["value0"],"metaType":"IsConstructor"},"sourceSpan":{"end":[94,13],"start":[94,5]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[94,13],"start":[94,12]}},"binderType":"VarBinder","identifier":"n","type":{"annotation":[{"end":[75,15],"name":"tests/purus/passing/Misc/Lib.purs","start":[75,12]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}}],"constructorName":{"identifier":"ConInt","moduleName":["Lib"]},"typeName":{"identifier":"TestBinderSum","moduleName":["Lib"]}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[94,18],"start":[94,17]}},"kind":"Var","type":{"annotation":[{"end":[75,15],"name":"tests/purus/passing/Misc/Lib.purs","start":[75,12]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"identifier":"n","sourcePos":[94,12]}},"isGuarded":false},{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[95,6],"start":[95,5]}},"binderType":"NullBinder"}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[95,11],"start":[95,10]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"literalType":"IntLiteral","value":2}},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[93,36],"start":[93,29]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Lib"],"TestBinderSum"],"tag":"TypeConstructor"},"value":{"identifier":"conNest","sourcePos":[93,13]}}],"kind":"Case","type":{"annotation":[{"end":[86,37],"name":"tests/purus/passing/Misc/Lib.purs","start":[86,34]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}},"isGuarded":false},{"binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":["value0"],"metaType":"IsConstructor"},"sourceSpan":{"end":[96,18],"start":[96,3]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[96,18],"start":[96,17]}},"binderType":"VarBinder","identifier":"f","type":{"annotation":[{"end":[81,48],"name":"tests/purus/passing/Misc/Lib.purs","start":[81,20]},[]],"contents":{"identifier":"x","kind":{"annotation":[{"end":[81,37],"name":"tests/purus/passing/Misc/Lib.purs","start":[81,33]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[81,48],"name":"tests/purus/passing/Misc/Lib.purs","start":[81,40]},[]],"contents":[{"annotation":[{"end":[81,48],"name":"tests/purus/passing/Misc/Lib.purs","start":[81,40]},[]],"contents":[{"annotation":[{"end":[81,44],"name":"tests/purus/passing/Misc/Lib.purs","start":[81,42]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[81,41],"name":"tests/purus/passing/Misc/Lib.purs","start":[81,40]},[]],"contents":{"kind":{"annotation":[{"end":[81,37],"name":"tests/purus/passing/Misc/Lib.purs","start":[81,33]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"x"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[81,48],"name":"tests/purus/passing/Misc/Lib.purs","start":[81,45]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}}],"constructorName":{"identifier":"ConQuantified","moduleName":["Lib"]},"typeName":{"identifier":"TestBinderSum","moduleName":["Lib"]}}],"expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[96,23],"start":[96,22]}},"kind":"Var","type":{"annotation":[{"end":[81,48],"name":"tests/purus/passing/Misc/Lib.purs","start":[81,20]},[]],"contents":{"identifier":"x","kind":{"annotation":[{"end":[81,37],"name":"tests/purus/passing/Misc/Lib.purs","start":[81,33]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[81,48],"name":"tests/purus/passing/Misc/Lib.purs","start":[81,40]},[]],"contents":[{"annotation":[{"end":[81,48],"name":"tests/purus/passing/Misc/Lib.purs","start":[81,40]},[]],"contents":[{"annotation":[{"end":[81,44],"name":"tests/purus/passing/Misc/Lib.purs","start":[81,42]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[81,41],"name":"tests/purus/passing/Misc/Lib.purs","start":[81,40]},[]],"contents":{"kind":{"annotation":[{"end":[81,37],"name":"tests/purus/passing/Misc/Lib.purs","start":[81,33]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"x"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[81,48],"name":"tests/purus/passing/Misc/Lib.purs","start":[81,45]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"f","sourcePos":[96,17]}},"annotation":{"meta":null,"sourceSpan":{"end":[96,31],"start":[96,22]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[96,31],"start":[96,24]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"String"],"tag":"TypeConstructor"},"value":{"literalType":"StringLiteral","value":"hello"}},"kind":"App"},"isGuarded":false},{"binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":["value0"],"metaType":"IsConstructor"},"sourceSpan":{"end":[97,19],"start":[97,3]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[97,19],"start":[97,18]}},"binderType":"VarBinder","identifier":"g","type":{"annotation":[{"end":[82,57],"name":"tests/purus/passing/Misc/Lib.purs","start":[82,21]},[]],"contents":{"identifier":"x","kind":{"annotation":[{"end":[82,38],"name":"tests/purus/passing/Misc/Lib.purs","start":[82,34]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Lib"],"Eq$Dict"],"tag":"TypeConstructor"},{"annotation":[{"end":[82,45],"name":"tests/purus/passing/Misc/Lib.purs","start":[82,44]},[]],"contents":{"kind":{"annotation":[{"end":[82,38],"name":"tests/purus/passing/Misc/Lib.purs","start":[82,34]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"x"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[82,57],"name":"tests/purus/passing/Misc/Lib.purs","start":[82,49]},[]],"contents":[{"annotation":[{"end":[82,57],"name":"tests/purus/passing/Misc/Lib.purs","start":[82,49]},[]],"contents":[{"annotation":[{"end":[82,53],"name":"tests/purus/passing/Misc/Lib.purs","start":[82,51]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[82,50],"name":"tests/purus/passing/Misc/Lib.purs","start":[82,49]},[]],"contents":{"kind":{"annotation":[{"end":[82,38],"name":"tests/purus/passing/Misc/Lib.purs","start":[82,34]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"x"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[82,57],"name":"tests/purus/passing/Misc/Lib.purs","start":[82,54]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}}],"constructorName":{"identifier":"ConConstrained","moduleName":["Lib"]},"typeName":{"identifier":"TestBinderSum","moduleName":["Lib"]}}],"expression":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[97,24],"start":[97,23]}},"kind":"Var","type":{"annotation":[{"end":[82,57],"name":"tests/purus/passing/Misc/Lib.purs","start":[82,21]},[]],"contents":{"identifier":"x","kind":{"annotation":[{"end":[82,38],"name":"tests/purus/passing/Misc/Lib.purs","start":[82,34]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Lib"],"Eq$Dict"],"tag":"TypeConstructor"},{"annotation":[{"end":[82,45],"name":"tests/purus/passing/Misc/Lib.purs","start":[82,44]},[]],"contents":{"kind":{"annotation":[{"end":[82,38],"name":"tests/purus/passing/Misc/Lib.purs","start":[82,34]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"x"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[82,57],"name":"tests/purus/passing/Misc/Lib.purs","start":[82,49]},[]],"contents":[{"annotation":[{"end":[82,57],"name":"tests/purus/passing/Misc/Lib.purs","start":[82,49]},[]],"contents":[{"annotation":[{"end":[82,53],"name":"tests/purus/passing/Misc/Lib.purs","start":[82,51]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[82,50],"name":"tests/purus/passing/Misc/Lib.purs","start":[82,49]},[]],"contents":{"kind":{"annotation":[{"end":[82,38],"name":"tests/purus/passing/Misc/Lib.purs","start":[82,34]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"x"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[82,57],"name":"tests/purus/passing/Misc/Lib.purs","start":[82,54]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"g","sourcePos":[97,18]}},"annotation":{"meta":null,"sourceSpan":{"end":[97,26],"start":[97,23]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Lib"],"Eq$Dict"],"tag":"TypeConstructor"},{"annotation":[{"end":[24,16],"name":"tests/purus/passing/Misc/Lib.purs","start":[24,13]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"eqInt","moduleName":["Lib"]}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[97,26],"start":[97,23]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[97,26],"start":[97,25]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"literalType":"IntLiteral","value":2}},"kind":"App"},"isGuarded":false},{"binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":["value0"],"metaType":"IsConstructor"},"sourceSpan":{"end":[98,18],"start":[98,3]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[98,18],"start":[98,13]}},"binderType":"VarBinder","identifier":"other","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Lib"],"TestBinderSum"],"tag":"TypeConstructor"}}],"constructorName":{"identifier":"ConNested","moduleName":["Lib"]},"typeName":{"identifier":"TestBinderSum","moduleName":["Lib"]}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[98,23],"start":[98,22]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"literalType":"IntLiteral","value":7}},"isGuarded":false},{"binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":["value0"],"metaType":"IsConstructor"},"sourceSpan":{"end":[99,16],"start":[99,3]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[99,16],"start":[99,13]}},"binderType":"VarBinder","identifier":"obj","type":{"annotation":[{"end":[83,32],"name":"tests/purus/passing/Misc/Lib.purs","start":[83,15]},[]],"contents":[{"annotation":[{"end":[83,16],"name":"tests/purus/passing/Misc/Lib.purs","start":[83,15]},[]],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[{"end":[83,31],"name":"tests/purus/passing/Misc/Lib.purs","start":[83,16]},[]],"contents":["objField",{"annotation":[{"end":[83,31],"name":"tests/purus/passing/Misc/Lib.purs","start":[83,28]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},{"annotation":[{"end":[83,32],"name":"tests/purus/passing/Misc/Lib.purs","start":[83,31]},[]],"contents":[{"annotation":[{"end":[83,32],"name":"tests/purus/passing/Misc/Lib.purs","start":[83,31]},[]],"tag":"REmpty"},{"annotation":[{"end":[83,31],"name":"tests/purus/passing/Misc/Lib.purs","start":[83,28]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"KindApp"}],"tag":"RCons"}],"tag":"TypeApp"}}],"constructorName":{"identifier":"ConObject","moduleName":["Lib"]},"typeName":{"identifier":"TestBinderSum","moduleName":["Lib"]}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[99,32],"start":[99,20]}},"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[99,23],"start":[99,20]}},"kind":"Var","type":{"annotation":[{"end":[83,32],"name":"tests/purus/passing/Misc/Lib.purs","start":[83,15]},[]],"contents":[{"annotation":[{"end":[83,16],"name":"tests/purus/passing/Misc/Lib.purs","start":[83,15]},[]],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[{"end":[83,31],"name":"tests/purus/passing/Misc/Lib.purs","start":[83,16]},[]],"contents":["objField",{"annotation":[{"end":[83,31],"name":"tests/purus/passing/Misc/Lib.purs","start":[83,28]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},{"annotation":[{"end":[83,32],"name":"tests/purus/passing/Misc/Lib.purs","start":[83,31]},[]],"contents":[{"annotation":[{"end":[83,32],"name":"tests/purus/passing/Misc/Lib.purs","start":[83,31]},[]],"tag":"REmpty"},{"annotation":[{"end":[83,31],"name":"tests/purus/passing/Misc/Lib.purs","start":[83,28]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"KindApp"}],"tag":"RCons"}],"tag":"TypeApp"},"value":{"identifier":"obj","sourcePos":[99,13]}},"fieldName":"objField","kind":"Accessor","type":{"annotation":[{"end":[86,37],"name":"tests/purus/passing/Misc/Lib.purs","start":[86,34]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}},"isGuarded":false},{"binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":["value0"],"metaType":"IsConstructor"},"sourceSpan":{"end":[100,27],"start":[100,3]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[100,27],"start":[100,23]}},"binderType":"VarBinder","identifier":"objQ","type":{"annotation":[{"end":[84,68],"name":"tests/purus/passing/Misc/Lib.purs","start":[84,25]},[]],"contents":[{"annotation":[{"end":[84,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[84,25]},[]],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[{"end":[84,67],"name":"tests/purus/passing/Misc/Lib.purs","start":[84,26]},[]],"contents":["objFieldQ",{"annotation":[{"end":[84,67],"name":"tests/purus/passing/Misc/Lib.purs","start":[84,39]},[]],"contents":{"identifier":"x","kind":{"annotation":[{"end":[84,56],"name":"tests/purus/passing/Misc/Lib.purs","start":[84,52]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[84,67],"name":"tests/purus/passing/Misc/Lib.purs","start":[84,59]},[]],"contents":[{"annotation":[{"end":[84,67],"name":"tests/purus/passing/Misc/Lib.purs","start":[84,59]},[]],"contents":[{"annotation":[{"end":[84,63],"name":"tests/purus/passing/Misc/Lib.purs","start":[84,61]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[84,60],"name":"tests/purus/passing/Misc/Lib.purs","start":[84,59]},[]],"contents":{"kind":{"annotation":[{"end":[84,56],"name":"tests/purus/passing/Misc/Lib.purs","start":[84,52]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"x"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[84,67],"name":"tests/purus/passing/Misc/Lib.purs","start":[84,64]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},{"annotation":[{"end":[84,68],"name":"tests/purus/passing/Misc/Lib.purs","start":[84,67]},[]],"contents":[{"annotation":[{"end":[84,68],"name":"tests/purus/passing/Misc/Lib.purs","start":[84,67]},[]],"tag":"REmpty"},{"annotation":[{"end":[84,67],"name":"tests/purus/passing/Misc/Lib.purs","start":[84,39]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"KindApp"}],"tag":"RCons"}],"tag":"TypeApp"}}],"constructorName":{"identifier":"ConObjectQuantified","moduleName":["Lib"]},"typeName":{"identifier":"TestBinderSum","moduleName":["Lib"]}}],"expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[100,45],"start":[100,31]}},"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[100,35],"start":[100,31]}},"kind":"Var","type":{"annotation":[{"end":[84,68],"name":"tests/purus/passing/Misc/Lib.purs","start":[84,25]},[]],"contents":[{"annotation":[{"end":[84,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[84,25]},[]],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[{"end":[84,67],"name":"tests/purus/passing/Misc/Lib.purs","start":[84,26]},[]],"contents":["objFieldQ",{"annotation":[{"end":[84,67],"name":"tests/purus/passing/Misc/Lib.purs","start":[84,39]},[]],"contents":{"identifier":"x","kind":{"annotation":[{"end":[84,56],"name":"tests/purus/passing/Misc/Lib.purs","start":[84,52]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[84,67],"name":"tests/purus/passing/Misc/Lib.purs","start":[84,59]},[]],"contents":[{"annotation":[{"end":[84,67],"name":"tests/purus/passing/Misc/Lib.purs","start":[84,59]},[]],"contents":[{"annotation":[{"end":[84,63],"name":"tests/purus/passing/Misc/Lib.purs","start":[84,61]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[84,60],"name":"tests/purus/passing/Misc/Lib.purs","start":[84,59]},[]],"contents":{"kind":{"annotation":[{"end":[84,56],"name":"tests/purus/passing/Misc/Lib.purs","start":[84,52]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"x"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[84,67],"name":"tests/purus/passing/Misc/Lib.purs","start":[84,64]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},{"annotation":[{"end":[84,68],"name":"tests/purus/passing/Misc/Lib.purs","start":[84,67]},[]],"contents":[{"annotation":[{"end":[84,68],"name":"tests/purus/passing/Misc/Lib.purs","start":[84,67]},[]],"tag":"REmpty"},{"annotation":[{"end":[84,67],"name":"tests/purus/passing/Misc/Lib.purs","start":[84,39]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"KindApp"}],"tag":"RCons"}],"tag":"TypeApp"},"value":{"identifier":"objQ","sourcePos":[100,23]}},"fieldName":"objFieldQ","kind":"Accessor","type":{"annotation":[{"end":[84,67],"name":"tests/purus/passing/Misc/Lib.purs","start":[84,59]},[]],"contents":[{"annotation":[{"end":[84,67],"name":"tests/purus/passing/Misc/Lib.purs","start":[84,59]},[]],"contents":[{"annotation":[{"end":[84,63],"name":"tests/purus/passing/Misc/Lib.purs","start":[84,61]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"String"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[84,67],"name":"tests/purus/passing/Misc/Lib.purs","start":[84,64]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"annotation":{"meta":null,"sourceSpan":{"end":[100,53],"start":[100,31]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[100,53],"start":[100,46]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"String"],"tag":"TypeConstructor"},"value":{"literalType":"StringLiteral","value":"world"}},"kind":"App"},"isGuarded":false},{"binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":["value0"],"metaType":"IsConstructor"},"sourceSpan":{"end":[101,17],"start":[101,3]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[101,17],"start":[101,13]}},"binderType":"VarBinder","identifier":"objs","type":{"annotation":[{"end":[83,32],"name":"tests/purus/passing/Misc/Lib.purs","start":[83,15]},[]],"contents":[{"annotation":[{"end":[83,16],"name":"tests/purus/passing/Misc/Lib.purs","start":[83,15]},[]],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[{"end":[83,31],"name":"tests/purus/passing/Misc/Lib.purs","start":[83,16]},[]],"contents":["objField",{"annotation":[{"end":[83,31],"name":"tests/purus/passing/Misc/Lib.purs","start":[83,28]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},{"annotation":[{"end":[83,32],"name":"tests/purus/passing/Misc/Lib.purs","start":[83,31]},[]],"contents":[{"annotation":[{"end":[83,32],"name":"tests/purus/passing/Misc/Lib.purs","start":[83,31]},[]],"tag":"REmpty"},{"annotation":[{"end":[83,31],"name":"tests/purus/passing/Misc/Lib.purs","start":[83,28]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"KindApp"}],"tag":"RCons"}],"tag":"TypeApp"}}],"constructorName":{"identifier":"ConObject","moduleName":["Lib"]},"typeName":{"identifier":"TestBinderSum","moduleName":["Lib"]}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[102,23],"start":[101,21]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[102,18],"start":[102,5]}},"binderType":"LiteralBinder","literal":{"literalType":"ObjectLiteral","value":[["objField",{"annotation":{"meta":null,"sourceSpan":{"end":[102,17],"start":[102,16]}},"binderType":"VarBinder","identifier":"f","type":{"annotation":[{"end":[83,31],"name":"tests/purus/passing/Misc/Lib.purs","start":[83,28]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}}]]}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[102,23],"start":[102,22]}},"kind":"Var","type":{"annotation":[{"end":[83,31],"name":"tests/purus/passing/Misc/Lib.purs","start":[83,28]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"identifier":"f","sourcePos":[102,16]}},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[101,30],"start":[101,26]}},"kind":"Var","type":{"annotation":[{"end":[83,32],"name":"tests/purus/passing/Misc/Lib.purs","start":[83,15]},[]],"contents":[{"annotation":[{"end":[83,16],"name":"tests/purus/passing/Misc/Lib.purs","start":[83,15]},[]],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[{"end":[83,31],"name":"tests/purus/passing/Misc/Lib.purs","start":[83,16]},[]],"contents":["objField",{"annotation":[{"end":[83,31],"name":"tests/purus/passing/Misc/Lib.purs","start":[83,28]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},{"annotation":[{"end":[83,32],"name":"tests/purus/passing/Misc/Lib.purs","start":[83,31]},[]],"contents":[{"annotation":[{"end":[83,32],"name":"tests/purus/passing/Misc/Lib.purs","start":[83,31]},[]],"tag":"REmpty"},{"annotation":[{"end":[83,31],"name":"tests/purus/passing/Misc/Lib.purs","start":[83,28]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"KindApp"}],"tag":"RCons"}],"tag":"TypeApp"},"value":{"identifier":"objs","sourcePos":[101,13]}}],"kind":"Case","type":{"annotation":[{"end":[86,37],"name":"tests/purus/passing/Misc/Lib.purs","start":[86,34]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}},"isGuarded":false},{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[103,8],"start":[103,3]}},"binderType":"VarBinder","identifier":"other","type":{"annotation":[{"end":[86,29],"name":"tests/purus/passing/Misc/Lib.purs","start":[86,16]},[]],"contents":[["Lib"],"TestBinderSum"],"tag":"TypeConstructor"}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[103,21],"start":[103,20]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"literalType":"IntLiteral","value":0}},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[87,23],"start":[87,22]}},"kind":"Var","type":{"annotation":[{"end":[86,29],"name":"tests/purus/passing/Misc/Lib.purs","start":[86,16]},[]],"contents":[["Lib"],"TestBinderSum"],"tag":"TypeConstructor"},"value":{"identifier":"x","sourcePos":[87,1]}}],"kind":"Case","type":{"annotation":[{"end":[86,37],"name":"tests/purus/passing/Misc/Lib.purs","start":[86,34]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[86,29],"name":"tests/purus/passing/Misc/Lib.purs","start":[86,16]},[]],"contents":[["Lib"],"TestBinderSum"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[86,37],"name":"tests/purus/passing/Misc/Lib.purs","start":[86,34]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"identifier":"testBinders"},{"annotation":{"meta":null,"sourceSpan":{"end":[105,23],"start":[105,1]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[106,30],"start":[106,19]}},"kind":"Var","type":{"annotation":[{"end":[86,37],"name":"tests/purus/passing/Misc/Lib.purs","start":[86,16]},[]],"contents":[{"annotation":[{"end":[86,37],"name":"tests/purus/passing/Misc/Lib.purs","start":[86,16]},[]],"contents":[{"annotation":[{"end":[86,33],"name":"tests/purus/passing/Misc/Lib.purs","start":[86,31]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[86,29],"name":"tests/purus/passing/Misc/Lib.purs","start":[86,16]},[]],"contents":[["Lib"],"TestBinderSum"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[86,37],"name":"tests/purus/passing/Misc/Lib.purs","start":[86,34]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"testBinders","moduleName":["Lib"]}},"annotation":{"meta":null,"sourceSpan":{"end":[106,41],"start":[106,19]}},"argument":{"abstraction":{"annotation":{"meta":{"constructorType":"SumType","identifiers":["value0"],"metaType":"IsConstructor"},"sourceSpan":{"end":[106,38],"start":[106,32]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[75,15],"name":"tests/purus/passing/Misc/Lib.purs","start":[75,12]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Lib"],"TestBinderSum"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"ConInt","moduleName":["Lib"]}},"annotation":{"meta":null,"sourceSpan":{"end":[106,40],"start":[106,32]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[106,40],"start":[106,39]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"literalType":"IntLiteral","value":2}},"kind":"App"},"kind":"App"},"identifier":"testBindersCase"},{"annotation":{"meta":null,"sourceSpan":{"end":[402,32],"start":[402,1]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[403,25],"start":[403,12]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"iData","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[403,27],"start":[403,12]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[403,27],"start":[403,26]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"literalType":"IntLiteral","value":1}},"kind":"App"},"identifier":"someData"},{"annotation":{"meta":null,"sourceSpan":{"end":[405,56],"start":[405,1]}},"bindType":"NonRec","expression":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[406,30],"start":[406,16]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"mkCons","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[406,39],"start":[406,16]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[406,39],"start":[406,31]}},"kind":"Var","type":{"annotation":[{"end":[402,32],"name":"tests/purus/passing/Misc/Lib.purs","start":[402,13]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"},"value":{"identifier":"someData","moduleName":["Lib"]}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[406,69],"start":[406,16]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[406,58],"start":[406,41]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Unit"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"mkNilData","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[406,68],"start":[406,41]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[406,68],"start":[406,59]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Unit"],"tag":"TypeConstructor"},"value":{"identifier":"unit","moduleName":["Prim"]}},"kind":"App"},"kind":"App"},"identifier":"someDataList"},{"bindType":"Rec","binds":[{"annotation":{"meta":null,"sourceSpan":{"end":[199,38],"start":[199,1]}},"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[200,18],"start":[200,1]}},"argument":"x","body":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[200,16],"start":[200,11]}},"kind":"Var","type":{"annotation":[{"end":[196,38],"name":"tests/purus/passing/Misc/Lib.purs","start":[196,10]},[]],"contents":{"identifier":"x","kind":{"annotation":[{"end":[196,27],"name":"tests/purus/passing/Misc/Lib.purs","start":[196,23]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":29,"type":{"annotation":[{"end":[196,38],"name":"tests/purus/passing/Misc/Lib.purs","start":[196,30]},[]],"contents":[{"annotation":[{"end":[196,38],"name":"tests/purus/passing/Misc/Lib.purs","start":[196,30]},[]],"contents":[{"annotation":[{"end":[196,34],"name":"tests/purus/passing/Misc/Lib.purs","start":[196,32]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[196,31],"name":"tests/purus/passing/Misc/Lib.purs","start":[196,30]},[]],"contents":{"kind":{"annotation":[{"end":[196,27],"name":"tests/purus/passing/Misc/Lib.purs","start":[196,23]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"x"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[196,38],"name":"tests/purus/passing/Misc/Lib.purs","start":[196,35]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"recF1","moduleName":["Lib"]}},"annotation":{"meta":null,"sourceSpan":{"end":[200,18],"start":[200,11]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[200,18],"start":[200,17]}},"kind":"Var","type":{"annotation":[{"end":[199,31],"name":"tests/purus/passing/Misc/Lib.purs","start":[199,30]},[]],"contents":{"kind":{"annotation":[{"end":[199,27],"name":"tests/purus/passing/Misc/Lib.purs","start":[199,23]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"x"},"tag":"TypeVar"},"value":{"identifier":"x","sourcePos":[200,1]}},"kind":"App"},"kind":"Abs","type":{"annotation":[{"end":[199,38],"name":"tests/purus/passing/Misc/Lib.purs","start":[199,10]},[]],"contents":{"identifier":"x","kind":{"annotation":[{"end":[199,27],"name":"tests/purus/passing/Misc/Lib.purs","start":[199,23]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":27,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[199,31],"name":"tests/purus/passing/Misc/Lib.purs","start":[199,30]},[]],"contents":{"kind":{"annotation":[{"end":[199,27],"name":"tests/purus/passing/Misc/Lib.purs","start":[199,23]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"x"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[199,38],"name":"tests/purus/passing/Misc/Lib.purs","start":[199,35]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"identifier":"recG1"},{"annotation":{"meta":null,"sourceSpan":{"end":[196,38],"start":[196,1]}},"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[197,18],"start":[197,1]}},"argument":"x","body":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[197,16],"start":[197,11]}},"kind":"Var","type":{"annotation":[{"end":[199,38],"name":"tests/purus/passing/Misc/Lib.purs","start":[199,10]},[]],"contents":{"identifier":"x","kind":{"annotation":[{"end":[199,27],"name":"tests/purus/passing/Misc/Lib.purs","start":[199,23]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":26,"type":{"annotation":[{"end":[199,38],"name":"tests/purus/passing/Misc/Lib.purs","start":[199,30]},[]],"contents":[{"annotation":[{"end":[199,38],"name":"tests/purus/passing/Misc/Lib.purs","start":[199,30]},[]],"contents":[{"annotation":[{"end":[199,34],"name":"tests/purus/passing/Misc/Lib.purs","start":[199,32]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[199,31],"name":"tests/purus/passing/Misc/Lib.purs","start":[199,30]},[]],"contents":{"kind":{"annotation":[{"end":[199,27],"name":"tests/purus/passing/Misc/Lib.purs","start":[199,23]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"x"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[199,38],"name":"tests/purus/passing/Misc/Lib.purs","start":[199,35]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"recG1","moduleName":["Lib"]}},"annotation":{"meta":null,"sourceSpan":{"end":[197,18],"start":[197,11]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[197,18],"start":[197,17]}},"kind":"Var","type":{"annotation":[{"end":[196,31],"name":"tests/purus/passing/Misc/Lib.purs","start":[196,30]},[]],"contents":{"kind":{"annotation":[{"end":[196,27],"name":"tests/purus/passing/Misc/Lib.purs","start":[196,23]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"x"},"tag":"TypeVar"},"value":{"identifier":"x","sourcePos":[197,1]}},"kind":"App"},"kind":"Abs","type":{"annotation":[{"end":[196,38],"name":"tests/purus/passing/Misc/Lib.purs","start":[196,10]},[]],"contents":{"identifier":"x","kind":{"annotation":[{"end":[196,27],"name":"tests/purus/passing/Misc/Lib.purs","start":[196,23]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":30,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[196,31],"name":"tests/purus/passing/Misc/Lib.purs","start":[196,30]},[]],"contents":{"kind":{"annotation":[{"end":[196,27],"name":"tests/purus/passing/Misc/Lib.purs","start":[196,23]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"x"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[196,38],"name":"tests/purus/passing/Misc/Lib.purs","start":[196,35]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"identifier":"recF1"}]},{"annotation":{"meta":null,"sourceSpan":{"end":[251,63],"start":[251,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":{"metaType":"IsWhere"},"sourceSpan":{"end":[252,33],"start":[252,13]}},"binds":[{"annotation":{"meta":null,"sourceSpan":{"end":[254,39],"start":[254,5]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[255,13],"start":[255,5]}},"argument":"v","body":{"annotation":{"meta":null,"sourceSpan":{"end":[255,13],"start":[255,12]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"literalType":"IntLiteral","value":5}},"kind":"Abs","type":{"annotation":[{"end":[254,39],"name":"tests/purus/passing/Misc/Lib.purs","start":[254,11]},[]],"contents":{"identifier":"y","kind":{"annotation":[{"end":[254,28],"name":"tests/purus/passing/Misc/Lib.purs","start":[254,24]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":34,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[254,32],"name":"tests/purus/passing/Misc/Lib.purs","start":[254,31]},[]],"contents":{"kind":{"annotation":[{"end":[254,28],"name":"tests/purus/passing/Misc/Lib.purs","start":[254,24]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"y"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[254,39],"name":"tests/purus/passing/Misc/Lib.purs","start":[254,36]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"identifier":"go"}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[252,33],"start":[252,13]}},"kind":"Literal","type":{"annotation":[{"end":[251,63],"name":"tests/purus/passing/Misc/Lib.purs","start":[251,14]},[]],"contents":[{"annotation":[{"end":[251,15],"name":"tests/purus/passing/Misc/Lib.purs","start":[251,14]},[]],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[{"end":[251,50],"name":"tests/purus/passing/Misc/Lib.purs","start":[251,15]},[]],"contents":["bar",{"annotation":[{"end":[251,50],"name":"tests/purus/passing/Misc/Lib.purs","start":[251,22]},[]],"contents":{"identifier":"x","kind":{"annotation":[{"end":[251,39],"name":"tests/purus/passing/Misc/Lib.purs","start":[251,35]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":32,"type":{"annotation":[{"end":[251,50],"name":"tests/purus/passing/Misc/Lib.purs","start":[251,42]},[]],"contents":[{"annotation":[{"end":[251,50],"name":"tests/purus/passing/Misc/Lib.purs","start":[251,42]},[]],"contents":[{"annotation":[{"end":[251,46],"name":"tests/purus/passing/Misc/Lib.purs","start":[251,44]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[251,43],"name":"tests/purus/passing/Misc/Lib.purs","start":[251,42]},[]],"contents":{"kind":{"annotation":[{"end":[251,39],"name":"tests/purus/passing/Misc/Lib.purs","start":[251,35]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"x"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[251,50],"name":"tests/purus/passing/Misc/Lib.purs","start":[251,47]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},{"annotation":[{"end":[251,62],"name":"tests/purus/passing/Misc/Lib.purs","start":[251,52]},[]],"contents":["baz",{"annotation":[{"end":[251,62],"name":"tests/purus/passing/Misc/Lib.purs","start":[251,59]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},{"annotation":[{"end":[251,63],"name":"tests/purus/passing/Misc/Lib.purs","start":[251,62]},[]],"contents":[{"annotation":[{"end":[251,63],"name":"tests/purus/passing/Misc/Lib.purs","start":[251,62]},[]],"tag":"REmpty"},{"annotation":[{"end":[251,50],"name":"tests/purus/passing/Misc/Lib.purs","start":[251,22]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"KindApp"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"TypeApp"},"value":{"literalType":"ObjectLiteral","value":[["baz",{"annotation":{"meta":null,"sourceSpan":{"end":[252,32],"start":[252,29]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"literalType":"IntLiteral","value":100}}],["bar",{"annotation":{"meta":null,"sourceSpan":{"end":[252,21],"start":[252,19]}},"kind":"Var","type":{"annotation":[{"end":[254,39],"name":"tests/purus/passing/Misc/Lib.purs","start":[254,11]},[]],"contents":{"identifier":"y","kind":{"annotation":[{"end":[254,28],"name":"tests/purus/passing/Misc/Lib.purs","start":[254,24]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":34,"type":{"annotation":[{"end":[254,39],"name":"tests/purus/passing/Misc/Lib.purs","start":[254,31]},[]],"contents":[{"annotation":[{"end":[254,39],"name":"tests/purus/passing/Misc/Lib.purs","start":[254,31]},[]],"contents":[{"annotation":[{"end":[254,35],"name":"tests/purus/passing/Misc/Lib.purs","start":[254,33]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[254,32],"name":"tests/purus/passing/Misc/Lib.purs","start":[254,31]},[]],"contents":{"kind":{"annotation":[{"end":[254,28],"name":"tests/purus/passing/Misc/Lib.purs","start":[254,24]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"y"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[254,39],"name":"tests/purus/passing/Misc/Lib.purs","start":[254,36]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"go","sourcePos":[254,5]}}]]}},"kind":"Let"},"identifier":"polyInObj"},{"annotation":{"meta":null,"sourceSpan":{"end":[257,22],"start":[257,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[259,32],"start":[258,18]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[259,19],"start":[259,3]}},"binderType":"LiteralBinder","literal":{"literalType":"ObjectLiteral","value":[["bar",{"annotation":{"meta":null,"sourceSpan":{"end":[259,10],"start":[259,9]}},"binderType":"VarBinder","identifier":"f","type":{"annotation":[{"end":[251,50],"name":"tests/purus/passing/Misc/Lib.purs","start":[251,22]},[]],"contents":{"identifier":"x","kind":{"annotation":[{"end":[251,39],"name":"tests/purus/passing/Misc/Lib.purs","start":[251,35]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":32,"type":{"annotation":[{"end":[251,50],"name":"tests/purus/passing/Misc/Lib.purs","start":[251,42]},[]],"contents":[{"annotation":[{"end":[251,50],"name":"tests/purus/passing/Misc/Lib.purs","start":[251,42]},[]],"contents":[{"annotation":[{"end":[251,46],"name":"tests/purus/passing/Misc/Lib.purs","start":[251,44]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[251,43],"name":"tests/purus/passing/Misc/Lib.purs","start":[251,42]},[]],"contents":{"kind":{"annotation":[{"end":[251,39],"name":"tests/purus/passing/Misc/Lib.purs","start":[251,35]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"x"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[251,50],"name":"tests/purus/passing/Misc/Lib.purs","start":[251,47]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}}],["baz",{"annotation":{"meta":null,"sourceSpan":{"end":[259,18],"start":[259,17]}},"binderType":"NullBinder"}]]}}],"expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[259,24],"start":[259,23]}},"kind":"Var","type":{"annotation":[{"end":[251,50],"name":"tests/purus/passing/Misc/Lib.purs","start":[251,22]},[]],"contents":{"identifier":"x","kind":{"annotation":[{"end":[251,39],"name":"tests/purus/passing/Misc/Lib.purs","start":[251,35]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":32,"type":{"annotation":[{"end":[251,50],"name":"tests/purus/passing/Misc/Lib.purs","start":[251,42]},[]],"contents":[{"annotation":[{"end":[251,50],"name":"tests/purus/passing/Misc/Lib.purs","start":[251,42]},[]],"contents":[{"annotation":[{"end":[251,46],"name":"tests/purus/passing/Misc/Lib.purs","start":[251,44]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[251,43],"name":"tests/purus/passing/Misc/Lib.purs","start":[251,42]},[]],"contents":{"kind":{"annotation":[{"end":[251,39],"name":"tests/purus/passing/Misc/Lib.purs","start":[251,35]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"x"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[251,50],"name":"tests/purus/passing/Misc/Lib.purs","start":[251,47]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"f","sourcePos":[259,9]}},"annotation":{"meta":null,"sourceSpan":{"end":[259,32],"start":[259,23]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[259,32],"start":[259,25]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"String"],"tag":"TypeConstructor"},"value":{"literalType":"StringLiteral","value":"hello"}},"kind":"App"},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[258,32],"start":[258,23]}},"kind":"Var","type":{"annotation":[{"end":[251,63],"name":"tests/purus/passing/Misc/Lib.purs","start":[251,14]},[]],"contents":[{"annotation":[{"end":[251,15],"name":"tests/purus/passing/Misc/Lib.purs","start":[251,14]},[]],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[{"end":[251,50],"name":"tests/purus/passing/Misc/Lib.purs","start":[251,15]},[]],"contents":["bar",{"annotation":[{"end":[251,50],"name":"tests/purus/passing/Misc/Lib.purs","start":[251,22]},[]],"contents":{"identifier":"x","kind":{"annotation":[{"end":[251,39],"name":"tests/purus/passing/Misc/Lib.purs","start":[251,35]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":32,"type":{"annotation":[{"end":[251,50],"name":"tests/purus/passing/Misc/Lib.purs","start":[251,42]},[]],"contents":[{"annotation":[{"end":[251,50],"name":"tests/purus/passing/Misc/Lib.purs","start":[251,42]},[]],"contents":[{"annotation":[{"end":[251,46],"name":"tests/purus/passing/Misc/Lib.purs","start":[251,44]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[251,43],"name":"tests/purus/passing/Misc/Lib.purs","start":[251,42]},[]],"contents":{"kind":{"annotation":[{"end":[251,39],"name":"tests/purus/passing/Misc/Lib.purs","start":[251,35]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"x"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[251,50],"name":"tests/purus/passing/Misc/Lib.purs","start":[251,47]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},{"annotation":[{"end":[251,62],"name":"tests/purus/passing/Misc/Lib.purs","start":[251,52]},[]],"contents":["baz",{"annotation":[{"end":[251,62],"name":"tests/purus/passing/Misc/Lib.purs","start":[251,59]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},{"annotation":[{"end":[251,63],"name":"tests/purus/passing/Misc/Lib.purs","start":[251,62]},[]],"contents":[{"annotation":[{"end":[251,63],"name":"tests/purus/passing/Misc/Lib.purs","start":[251,62]},[]],"tag":"REmpty"},{"annotation":[{"end":[251,50],"name":"tests/purus/passing/Misc/Lib.purs","start":[251,22]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"KindApp"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"TypeApp"},"value":{"identifier":"polyInObj","moduleName":["Lib"]}}],"kind":"Case","type":{"annotation":[{"end":[257,22],"name":"tests/purus/passing/Misc/Lib.purs","start":[257,19]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}},"identifier":"polyInObjMatch"},{"annotation":{"meta":null,"sourceSpan":{"end":[411,34],"start":[411,1]}},"bindType":"NonRec","expression":{"abstraction":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[412,32],"start":[412,14]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"x","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"x"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"x"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"x"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"ifThenElse","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[412,37],"start":[412,14]}},"argument":{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[412,37],"start":[412,33]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"},"value":{"identifier":"True","moduleName":["Prim"]}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[412,46],"start":[412,14]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[412,46],"start":[412,38]}},"kind":"Var","type":{"annotation":[{"end":[402,32],"name":"tests/purus/passing/Misc/Lib.purs","start":[402,13]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"},"value":{"identifier":"someData","moduleName":["Lib"]}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[412,79],"start":[412,14]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[412,61],"start":[412,48]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"x","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"String"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"x"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"x"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"trace","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[412,69],"start":[412,48]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[412,69],"start":[412,62]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"String"],"tag":"TypeConstructor"},"value":{"literalType":"StringLiteral","value":"BOOM!"}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[412,78],"start":[412,48]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[412,78],"start":[412,70]}},"kind":"Var","type":{"annotation":[{"end":[402,32],"name":"tests/purus/passing/Misc/Lib.purs","start":[402,13]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"},"value":{"identifier":"someData","moduleName":["Lib"]}},"kind":"App"},"kind":"App"},"identifier":"plutusIFTE"},{"annotation":{"meta":null,"sourceSpan":{"end":[209,26],"start":[209,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[210,34],"start":[210,1]}},"argument":"a","body":{"annotation":{"meta":null,"sourceSpan":{"end":[210,34],"start":[210,1]}},"argument":"b","body":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[210,30],"start":[210,12]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"addInteger","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[210,32],"start":[210,12]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[210,32],"start":[210,31]}},"kind":"Var","type":{"annotation":[{"end":[209,12],"name":"tests/purus/passing/Misc/Lib.purs","start":[209,9]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"identifier":"a","sourcePos":[210,1]}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[210,34],"start":[210,12]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[210,34],"start":[210,33]}},"kind":"Var","type":{"annotation":[{"end":[209,19],"name":"tests/purus/passing/Misc/Lib.purs","start":[209,16]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"identifier":"b","sourcePos":[210,1]}},"kind":"App"},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[209,19],"name":"tests/purus/passing/Misc/Lib.purs","start":[209,16]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[209,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[209,23]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[209,12],"name":"tests/purus/passing/Misc/Lib.purs","start":[209,9]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[209,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[209,16]},[]],"contents":[{"annotation":[{"end":[209,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[209,16]},[]],"contents":[{"annotation":[{"end":[209,22],"name":"tests/purus/passing/Misc/Lib.purs","start":[209,20]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[209,19],"name":"tests/purus/passing/Misc/Lib.purs","start":[209,16]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[209,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[209,23]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"identifier":"plus"},{"annotation":{"meta":null,"sourceSpan":{"end":[221,20],"start":[221,1]}},"bindType":"NonRec","expression":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[221,16],"start":[221,12]}},"kind":"Var","type":{"annotation":[{"end":[209,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[209,9]},[]],"contents":[{"annotation":[{"end":[209,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[209,9]},[]],"contents":[{"annotation":[{"end":[209,15],"name":"tests/purus/passing/Misc/Lib.purs","start":[209,13]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[209,12],"name":"tests/purus/passing/Misc/Lib.purs","start":[209,9]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[209,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[209,16]},[]],"contents":[{"annotation":[{"end":[209,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[209,16]},[]],"contents":[{"annotation":[{"end":[209,22],"name":"tests/purus/passing/Misc/Lib.purs","start":[209,20]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[209,19],"name":"tests/purus/passing/Misc/Lib.purs","start":[209,16]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[209,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[209,23]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"plus","moduleName":["Lib"]}},"annotation":{"meta":null,"sourceSpan":{"end":[221,18],"start":[221,12]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[221,18],"start":[221,17]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"literalType":"IntLiteral","value":1}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[221,20],"start":[221,12]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[221,20],"start":[221,19]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"literalType":"IntLiteral","value":1}},"kind":"App"},"identifier":"testPlus"},{"annotation":{"meta":null,"sourceSpan":{"end":[344,36],"start":[344,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[345,35],"start":[345,1]}},"argument":"b1","body":{"annotation":{"meta":null,"sourceSpan":{"end":[345,35],"start":[345,1]}},"argument":"b2","body":{"annotation":{"meta":null,"sourceSpan":{"end":[345,35],"start":[345,12]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"binderType":"ConstructorBinder","binders":[],"constructorName":{"identifier":"True","moduleName":["Prim"]},"typeName":{"identifier":"Boolean","moduleName":["Prim"]}}],"expression":{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[345,27],"start":[345,23]}},"kind":"Var","type":{"annotation":[{"end":[344,36],"name":"tests/purus/passing/Misc/Lib.purs","start":[344,29]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"},"value":{"identifier":"True","moduleName":["Prim"]}},"isGuarded":false},{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[345,35],"start":[345,12]}},"binderType":"NullBinder"}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[345,35],"start":[345,33]}},"kind":"Var","type":{"annotation":[{"end":[344,25],"name":"tests/purus/passing/Misc/Lib.purs","start":[344,18]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"},"value":{"identifier":"b2","sourcePos":[345,1]}},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[345,17],"start":[345,15]}},"kind":"Var","type":{"annotation":[{"end":[344,14],"name":"tests/purus/passing/Misc/Lib.purs","start":[344,7]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"},"value":{"identifier":"b1","sourcePos":[345,1]}}],"kind":"Case","type":{"annotation":[{"end":[344,36],"name":"tests/purus/passing/Misc/Lib.purs","start":[344,29]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[344,25],"name":"tests/purus/passing/Misc/Lib.purs","start":[344,18]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[344,36],"name":"tests/purus/passing/Misc/Lib.purs","start":[344,29]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[344,14],"name":"tests/purus/passing/Misc/Lib.purs","start":[344,7]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[344,36],"name":"tests/purus/passing/Misc/Lib.purs","start":[344,18]},[]],"contents":[{"annotation":[{"end":[344,36],"name":"tests/purus/passing/Misc/Lib.purs","start":[344,18]},[]],"contents":[{"annotation":[{"end":[344,28],"name":"tests/purus/passing/Misc/Lib.purs","start":[344,26]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[344,25],"name":"tests/purus/passing/Misc/Lib.purs","start":[344,18]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[344,36],"name":"tests/purus/passing/Misc/Lib.purs","start":[344,29]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"identifier":"or"},{"annotation":{"meta":null,"sourceSpan":{"end":[46,29],"start":[46,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"argument":"v","body":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":["value0"],"metaType":"IsConstructor"},"sourceSpan":{"end":[48,9],"start":[48,3]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[48,9],"start":[48,8]}},"binderType":"VarBinder","identifier":"i","type":{"annotation":[{"end":[46,22],"name":"tests/purus/passing/Misc/Lib.purs","start":[46,19]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}}],"constructorName":{"identifier":"Some","moduleName":["Lib"]},"typeName":{"identifier":"Option","moduleName":["Lib"]}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[48,14],"start":[48,13]}},"kind":"Var","type":{"annotation":[{"end":[46,22],"name":"tests/purus/passing/Misc/Lib.purs","start":[46,19]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"identifier":"i","sourcePos":[48,8]}},"isGuarded":false},{"binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[49,7],"start":[49,3]}},"binderType":"ConstructorBinder","binders":[],"constructorName":{"identifier":"Nada","moduleName":["Lib"]},"typeName":{"identifier":"Option","moduleName":["Lib"]}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[49,12],"start":[49,11]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"literalType":"IntLiteral","value":0}},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"kind":"Var","type":{"annotation":[{"end":[46,22],"name":"tests/purus/passing/Misc/Lib.purs","start":[46,12]},[]],"contents":[{"annotation":[{"end":[46,18],"name":"tests/purus/passing/Misc/Lib.purs","start":[46,12]},[]],"contents":[["Lib"],"Option"],"tag":"TypeConstructor"},{"annotation":[{"end":[46,22],"name":"tests/purus/passing/Misc/Lib.purs","start":[46,19]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"v","sourcePos":[0,0]}}],"kind":"Case","type":{"annotation":[{"end":[46,29],"name":"tests/purus/passing/Misc/Lib.purs","start":[46,26]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[46,22],"name":"tests/purus/passing/Misc/Lib.purs","start":[46,12]},[]],"contents":[{"annotation":[{"end":[46,18],"name":"tests/purus/passing/Misc/Lib.purs","start":[46,12]},[]],"contents":[["Lib"],"Option"],"tag":"TypeConstructor"},{"annotation":[{"end":[46,22],"name":"tests/purus/passing/Misc/Lib.purs","start":[46,19]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[46,29],"name":"tests/purus/passing/Misc/Lib.purs","start":[46,26]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"identifier":"opt2Int"},{"annotation":{"meta":null,"sourceSpan":{"end":[51,19],"start":[51,1]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[52,22],"start":[52,15]}},"kind":"Var","type":{"annotation":[{"end":[46,29],"name":"tests/purus/passing/Misc/Lib.purs","start":[46,12]},[]],"contents":[{"annotation":[{"end":[46,29],"name":"tests/purus/passing/Misc/Lib.purs","start":[46,12]},[]],"contents":[{"annotation":[{"end":[46,25],"name":"tests/purus/passing/Misc/Lib.purs","start":[46,23]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[46,22],"name":"tests/purus/passing/Misc/Lib.purs","start":[46,12]},[]],"contents":[{"annotation":[{"end":[46,18],"name":"tests/purus/passing/Misc/Lib.purs","start":[46,12]},[]],"contents":[["Lib"],"Option"],"tag":"TypeConstructor"},{"annotation":[{"end":[46,22],"name":"tests/purus/passing/Misc/Lib.purs","start":[46,19]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[46,29],"name":"tests/purus/passing/Misc/Lib.purs","start":[46,26]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"opt2Int","moduleName":["Lib"]}},"annotation":{"meta":null,"sourceSpan":{"end":[52,31],"start":[52,15]}},"argument":{"abstraction":{"annotation":{"meta":{"constructorType":"SumType","identifiers":["value0"],"metaType":"IsConstructor"},"sourceSpan":{"end":[52,28],"start":[52,24]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[44,23],"name":"tests/purus/passing/Misc/Lib.purs","start":[44,19]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":38,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[44,33],"name":"tests/purus/passing/Misc/Lib.purs","start":[44,32]},[]],"contents":{"kind":{"annotation":[{"end":[44,23],"name":"tests/purus/passing/Misc/Lib.purs","start":[44,19]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Lib"],"Option"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[44,23],"name":"tests/purus/passing/Misc/Lib.purs","start":[44,19]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarVisible"},"tag":"ForAll"},"value":{"identifier":"Some","moduleName":["Lib"]}},"annotation":{"meta":null,"sourceSpan":{"end":[52,30],"start":[52,24]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[52,30],"start":[52,29]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"literalType":"IntLiteral","value":3}},"kind":"App"},"kind":"App"},"identifier":"testOpt2Int"},{"annotation":{"meta":null,"sourceSpan":{"end":[349,26],"start":[349,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[350,34],"start":[350,1]}},"argument":"b","body":{"annotation":{"meta":null,"sourceSpan":{"end":[350,34],"start":[350,9]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"binderType":"ConstructorBinder","binders":[],"constructorName":{"identifier":"True","moduleName":["Prim"]},"typeName":{"identifier":"Boolean","moduleName":["Prim"]}}],"expression":{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[350,24],"start":[350,19]}},"kind":"Var","type":{"annotation":[{"end":[349,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[349,19]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"},"value":{"identifier":"False","moduleName":["Prim"]}},"isGuarded":false},{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[350,34],"start":[350,9]}},"binderType":"NullBinder"}],"expression":{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[350,34],"start":[350,30]}},"kind":"Var","type":{"annotation":[{"end":[349,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[349,19]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"},"value":{"identifier":"True","moduleName":["Prim"]}},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[350,13],"start":[350,12]}},"kind":"Var","type":{"annotation":[{"end":[349,15],"name":"tests/purus/passing/Misc/Lib.purs","start":[349,8]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"},"value":{"identifier":"b","sourcePos":[350,1]}}],"kind":"Case","type":{"annotation":[{"end":[349,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[349,19]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[349,15],"name":"tests/purus/passing/Misc/Lib.purs","start":[349,8]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[349,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[349,19]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"identifier":"not"},{"annotation":{"meta":null,"sourceSpan":{"end":[126,19],"start":[126,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[137,7],"start":[128,3]}},"binds":[{"annotation":{"meta":null,"sourceSpan":{"end":[131,41],"start":[131,8]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[132,15],"start":[132,8]}},"argument":"v","body":{"annotation":{"meta":null,"sourceSpan":{"end":[132,15],"start":[132,14]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"literalType":"IntLiteral","value":5}},"kind":"Abs","type":{"annotation":[{"end":[131,41],"name":"tests/purus/passing/Misc/Lib.purs","start":[131,13]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[131,30],"name":"tests/purus/passing/Misc/Lib.purs","start":[131,26]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":40,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[131,34],"name":"tests/purus/passing/Misc/Lib.purs","start":[131,33]},[]],"contents":{"kind":{"annotation":[{"end":[131,30],"name":"tests/purus/passing/Misc/Lib.purs","start":[131,26]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[131,41],"name":"tests/purus/passing/Misc/Lib.purs","start":[131,38]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"identifier":"g"},{"annotation":{"meta":null,"sourceSpan":{"end":[128,23],"start":[128,8]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[129,15],"start":[129,8]}},"argument":"v","body":{"annotation":{"meta":null,"sourceSpan":{"end":[129,15],"start":[129,14]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"literalType":"IntLiteral","value":4}},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[128,16],"name":"tests/purus/passing/Misc/Lib.purs","start":[128,13]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[128,23],"name":"tests/purus/passing/Misc/Lib.purs","start":[128,20]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"identifier":"f"},{"annotation":{"meta":null,"sourceSpan":{"end":[136,18],"start":[134,8]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[136,18],"start":[134,12]}},"binds":[{"annotation":{"meta":null,"sourceSpan":{"end":[134,29],"start":[134,16]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[134,21],"start":[134,20]}},"kind":"Var","type":{"annotation":[{"end":[131,41],"name":"tests/purus/passing/Misc/Lib.purs","start":[131,13]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[131,30],"name":"tests/purus/passing/Misc/Lib.purs","start":[131,26]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":40,"type":{"annotation":[{"end":[131,41],"name":"tests/purus/passing/Misc/Lib.purs","start":[131,33]},[]],"contents":[{"annotation":[{"end":[131,41],"name":"tests/purus/passing/Misc/Lib.purs","start":[131,33]},[]],"contents":[{"annotation":[{"end":[131,37],"name":"tests/purus/passing/Misc/Lib.purs","start":[131,35]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[131,34],"name":"tests/purus/passing/Misc/Lib.purs","start":[131,33]},[]],"contents":{"kind":{"annotation":[{"end":[131,30],"name":"tests/purus/passing/Misc/Lib.purs","start":[131,26]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[131,41],"name":"tests/purus/passing/Misc/Lib.purs","start":[131,38]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"g","sourcePos":[131,8]}},"annotation":{"meta":null,"sourceSpan":{"end":[134,29],"start":[134,20]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[134,29],"start":[134,22]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"String"],"tag":"TypeConstructor"},"value":{"literalType":"StringLiteral","value":"hello"}},"kind":"App"},"identifier":"i"},{"annotation":{"meta":null,"sourceSpan":{"end":[135,23],"start":[135,16]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[135,21],"start":[135,20]}},"kind":"Var","type":{"annotation":[{"end":[128,23],"name":"tests/purus/passing/Misc/Lib.purs","start":[128,13]},[]],"contents":[{"annotation":[{"end":[128,23],"name":"tests/purus/passing/Misc/Lib.purs","start":[128,13]},[]],"contents":[{"annotation":[{"end":[128,19],"name":"tests/purus/passing/Misc/Lib.purs","start":[128,17]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[128,16],"name":"tests/purus/passing/Misc/Lib.purs","start":[128,13]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[128,23],"name":"tests/purus/passing/Misc/Lib.purs","start":[128,20]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"f","sourcePos":[128,8]}},"annotation":{"meta":null,"sourceSpan":{"end":[135,23],"start":[135,20]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[135,23],"start":[135,22]}},"kind":"Var","type":{"annotation":[{"end":[131,41],"name":"tests/purus/passing/Misc/Lib.purs","start":[131,38]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"identifier":"i","sourcePos":[134,16]}},"kind":"App"},"identifier":"j"}],"expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[136,16],"start":[136,15]}},"kind":"Var","type":{"annotation":[{"end":[128,23],"name":"tests/purus/passing/Misc/Lib.purs","start":[128,13]},[]],"contents":[{"annotation":[{"end":[128,23],"name":"tests/purus/passing/Misc/Lib.purs","start":[128,13]},[]],"contents":[{"annotation":[{"end":[128,19],"name":"tests/purus/passing/Misc/Lib.purs","start":[128,17]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[128,16],"name":"tests/purus/passing/Misc/Lib.purs","start":[128,13]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[128,23],"name":"tests/purus/passing/Misc/Lib.purs","start":[128,20]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"f","sourcePos":[128,8]}},"annotation":{"meta":null,"sourceSpan":{"end":[136,18],"start":[136,15]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[136,18],"start":[136,17]}},"kind":"Var","type":{"annotation":[{"end":[128,23],"name":"tests/purus/passing/Misc/Lib.purs","start":[128,20]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"identifier":"j","sourcePos":[135,16]}},"kind":"App"},"kind":"Let"},"identifier":"h"}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[137,7],"start":[137,6]}},"kind":"Var","type":{"annotation":[{"end":[128,23],"name":"tests/purus/passing/Misc/Lib.purs","start":[128,20]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"identifier":"h","sourcePos":[134,8]}},"kind":"Let"},"identifier":"nestedBinds"},{"annotation":{"meta":null,"sourceSpan":{"end":[233,26],"start":[233,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":{"metaType":"IsWhere"},"sourceSpan":{"end":[234,39],"start":[234,22]}},"binds":[{"annotation":{"meta":null,"sourceSpan":{"end":[236,14],"start":[236,5]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[236,14],"start":[236,5]}},"argument":"x","body":{"annotation":{"meta":null,"sourceSpan":{"end":[236,14],"start":[236,5]}},"argument":"v","body":{"annotation":{"meta":null,"sourceSpan":{"end":[236,14],"start":[236,13]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"identifier":"x","sourcePos":[236,5]}},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"identifier":"i"},{"annotation":{"meta":null,"sourceSpan":{"end":[241,13],"start":[239,5]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"argument":"v","body":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[240,8],"start":[240,7]}},"binderType":"LiteralBinder","literal":{"literalType":"IntLiteral","value":2}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[240,13],"start":[240,12]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"literalType":"IntLiteral","value":3}},"isGuarded":false},{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[241,8],"start":[241,7]}},"binderType":"NullBinder"}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[241,13],"start":[241,12]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"literalType":"IntLiteral","value":5}},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"identifier":"v","sourcePos":[0,0]}}],"kind":"Case","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"identifier":"h"},{"annotation":{"meta":null,"sourceSpan":{"end":[238,12],"start":[238,5]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[238,12],"start":[238,5]}},"argument":"v","body":{"annotation":{"meta":null,"sourceSpan":{"end":[238,12],"start":[238,11]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"literalType":"IntLiteral","value":5}},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"identifier":"g"},{"annotation":{"meta":null,"sourceSpan":{"end":[237,12],"start":[237,5]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[237,12],"start":[237,5]}},"argument":"x","body":{"annotation":{"meta":null,"sourceSpan":{"end":[237,12],"start":[237,11]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"identifier":"x","sourcePos":[237,5]}},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"identifier":"f"}],"expression":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[234,23],"start":[234,22]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"i","sourcePos":[236,5]}},"annotation":{"meta":null,"sourceSpan":{"end":[234,37],"start":[234,22]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[234,26],"start":[234,25]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"f","sourcePos":[237,5]}},"annotation":{"meta":null,"sourceSpan":{"end":[234,36],"start":[234,25]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[234,29],"start":[234,28]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"g","sourcePos":[238,5]}},"annotation":{"meta":null,"sourceSpan":{"end":[234,35],"start":[234,28]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[234,32],"start":[234,31]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"h","sourcePos":[239,5]}},"annotation":{"meta":null,"sourceSpan":{"end":[234,34],"start":[234,31]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[234,34],"start":[234,33]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"literalType":"IntLiteral","value":2}},"kind":"App"},"kind":"App"},"kind":"App"},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[234,39],"start":[234,22]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[234,39],"start":[234,38]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"literalType":"IntLiteral","value":4}},"kind":"App"},"kind":"Let"},"identifier":"nestedApplications"},{"annotation":{"meta":null,"sourceSpan":{"end":[119,44],"start":[119,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[124,10],"start":[121,3]}},"binds":[{"annotation":{"meta":null,"sourceSpan":{"end":[122,17],"start":[122,7]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[122,17],"start":[122,7]}},"argument":"x","body":{"annotation":{"meta":null,"sourceSpan":{"end":[122,17],"start":[122,7]}},"argument":"y","body":{"annotation":{"meta":null,"sourceSpan":{"end":[122,17],"start":[122,16]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"identifier":"y","sourcePos":[122,7]}},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"identifier":"h'"},{"annotation":{"meta":null,"sourceSpan":{"end":[123,25],"start":[123,7]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[123,25],"start":[123,7]}},"argument":"y","body":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[123,16],"start":[123,14]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"h'","sourcePos":[122,7]}},"annotation":{"meta":null,"sourceSpan":{"end":[123,23],"start":[123,14]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[123,20],"start":[123,18]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"f'","sourcePos":[121,7]}},"annotation":{"meta":null,"sourceSpan":{"end":[123,22],"start":[123,18]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[123,22],"start":[123,21]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"identifier":"y","sourcePos":[123,7]}},"kind":"App"},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[123,25],"start":[123,14]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[123,25],"start":[123,24]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"literalType":"IntLiteral","value":3}},"kind":"App"},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"identifier":"g'"},{"annotation":{"meta":null,"sourceSpan":{"end":[121,18],"start":[121,7]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[121,18],"start":[121,7]}},"argument":"x","body":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[121,16],"start":[121,14]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"g'","sourcePos":[123,7]}},"annotation":{"meta":null,"sourceSpan":{"end":[121,18],"start":[121,14]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[121,18],"start":[121,17]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"literalType":"IntLiteral","value":2}},"kind":"App"},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"identifier":"f'"}],"expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[124,8],"start":[124,6]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"g'","sourcePos":[123,7]}},"annotation":{"meta":null,"sourceSpan":{"end":[124,10],"start":[124,6]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[124,10],"start":[124,9]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"literalType":"IntLiteral","value":3}},"kind":"App"},"kind":"Let"},"identifier":"mutuallyRecursiveBindingGroupNoTypes"},{"annotation":{"meta":null,"sourceSpan":{"end":[109,37],"start":[109,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[117,9],"start":[111,3]}},"binds":[{"annotation":{"meta":null,"sourceSpan":{"end":[113,29],"start":[113,7]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[114,18],"start":[114,7]}},"argument":"x","body":{"annotation":{"meta":null,"sourceSpan":{"end":[114,18],"start":[114,7]}},"argument":"y","body":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[114,16],"start":[114,15]}},"kind":"Var","type":{"annotation":[{"end":[111,22],"name":"tests/purus/passing/Misc/Lib.purs","start":[111,12]},[]],"contents":[{"annotation":[{"end":[111,22],"name":"tests/purus/passing/Misc/Lib.purs","start":[111,12]},[]],"contents":[{"annotation":[{"end":[111,18],"name":"tests/purus/passing/Misc/Lib.purs","start":[111,16]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[111,15],"name":"tests/purus/passing/Misc/Lib.purs","start":[111,12]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[111,22],"name":"tests/purus/passing/Misc/Lib.purs","start":[111,19]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"f","sourcePos":[111,7]}},"annotation":{"meta":null,"sourceSpan":{"end":[114,18],"start":[114,15]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[114,18],"start":[114,17]}},"kind":"Var","type":{"annotation":[{"end":[113,22],"name":"tests/purus/passing/Misc/Lib.purs","start":[113,19]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"identifier":"y","sourcePos":[114,7]}},"kind":"App"},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[113,22],"name":"tests/purus/passing/Misc/Lib.purs","start":[113,19]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[113,29],"name":"tests/purus/passing/Misc/Lib.purs","start":[113,26]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[113,15],"name":"tests/purus/passing/Misc/Lib.purs","start":[113,12]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[113,29],"name":"tests/purus/passing/Misc/Lib.purs","start":[113,19]},[]],"contents":[{"annotation":[{"end":[113,29],"name":"tests/purus/passing/Misc/Lib.purs","start":[113,19]},[]],"contents":[{"annotation":[{"end":[113,25],"name":"tests/purus/passing/Misc/Lib.purs","start":[113,23]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[113,22],"name":"tests/purus/passing/Misc/Lib.purs","start":[113,19]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[113,29],"name":"tests/purus/passing/Misc/Lib.purs","start":[113,26]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"identifier":"h"},{"annotation":{"meta":null,"sourceSpan":{"end":[115,22],"start":[115,7]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[116,22],"start":[116,7]}},"argument":"y","body":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[116,14],"start":[116,13]}},"kind":"Var","type":{"annotation":[{"end":[113,29],"name":"tests/purus/passing/Misc/Lib.purs","start":[113,12]},[]],"contents":[{"annotation":[{"end":[113,29],"name":"tests/purus/passing/Misc/Lib.purs","start":[113,12]},[]],"contents":[{"annotation":[{"end":[113,18],"name":"tests/purus/passing/Misc/Lib.purs","start":[113,16]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[113,15],"name":"tests/purus/passing/Misc/Lib.purs","start":[113,12]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[113,29],"name":"tests/purus/passing/Misc/Lib.purs","start":[113,19]},[]],"contents":[{"annotation":[{"end":[113,29],"name":"tests/purus/passing/Misc/Lib.purs","start":[113,19]},[]],"contents":[{"annotation":[{"end":[113,25],"name":"tests/purus/passing/Misc/Lib.purs","start":[113,23]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[113,22],"name":"tests/purus/passing/Misc/Lib.purs","start":[113,19]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[113,29],"name":"tests/purus/passing/Misc/Lib.purs","start":[113,26]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"h","sourcePos":[113,7]}},"annotation":{"meta":null,"sourceSpan":{"end":[116,20],"start":[116,13]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[116,17],"start":[116,16]}},"kind":"Var","type":{"annotation":[{"end":[111,22],"name":"tests/purus/passing/Misc/Lib.purs","start":[111,12]},[]],"contents":[{"annotation":[{"end":[111,22],"name":"tests/purus/passing/Misc/Lib.purs","start":[111,12]},[]],"contents":[{"annotation":[{"end":[111,18],"name":"tests/purus/passing/Misc/Lib.purs","start":[111,16]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[111,15],"name":"tests/purus/passing/Misc/Lib.purs","start":[111,12]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[111,22],"name":"tests/purus/passing/Misc/Lib.purs","start":[111,19]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"f","sourcePos":[111,7]}},"annotation":{"meta":null,"sourceSpan":{"end":[116,19],"start":[116,16]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[116,19],"start":[116,18]}},"kind":"Var","type":{"annotation":[{"end":[115,15],"name":"tests/purus/passing/Misc/Lib.purs","start":[115,12]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"identifier":"y","sourcePos":[116,7]}},"kind":"App"},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[116,22],"start":[116,13]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[116,22],"start":[116,21]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"literalType":"IntLiteral","value":3}},"kind":"App"},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[115,15],"name":"tests/purus/passing/Misc/Lib.purs","start":[115,12]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[115,22],"name":"tests/purus/passing/Misc/Lib.purs","start":[115,19]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"identifier":"g"},{"annotation":{"meta":null,"sourceSpan":{"end":[111,22],"start":[111,7]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[112,16],"start":[112,7]}},"argument":"x","body":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[112,14],"start":[112,13]}},"kind":"Var","type":{"annotation":[{"end":[115,22],"name":"tests/purus/passing/Misc/Lib.purs","start":[115,12]},[]],"contents":[{"annotation":[{"end":[115,22],"name":"tests/purus/passing/Misc/Lib.purs","start":[115,12]},[]],"contents":[{"annotation":[{"end":[115,18],"name":"tests/purus/passing/Misc/Lib.purs","start":[115,16]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[115,15],"name":"tests/purus/passing/Misc/Lib.purs","start":[115,12]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[115,22],"name":"tests/purus/passing/Misc/Lib.purs","start":[115,19]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"g","sourcePos":[115,7]}},"annotation":{"meta":null,"sourceSpan":{"end":[112,16],"start":[112,13]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[112,16],"start":[112,15]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"literalType":"IntLiteral","value":2}},"kind":"App"},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[111,15],"name":"tests/purus/passing/Misc/Lib.purs","start":[111,12]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[111,22],"name":"tests/purus/passing/Misc/Lib.purs","start":[111,19]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"identifier":"f"}],"expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[117,7],"start":[117,6]}},"kind":"Var","type":{"annotation":[{"end":[115,22],"name":"tests/purus/passing/Misc/Lib.purs","start":[115,12]},[]],"contents":[{"annotation":[{"end":[115,22],"name":"tests/purus/passing/Misc/Lib.purs","start":[115,12]},[]],"contents":[{"annotation":[{"end":[115,18],"name":"tests/purus/passing/Misc/Lib.purs","start":[115,16]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[115,15],"name":"tests/purus/passing/Misc/Lib.purs","start":[115,12]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[115,22],"name":"tests/purus/passing/Misc/Lib.purs","start":[115,19]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"g","sourcePos":[115,7]}},"annotation":{"meta":null,"sourceSpan":{"end":[117,9],"start":[117,6]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[117,9],"start":[117,8]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"literalType":"IntLiteral","value":3}},"kind":"App"},"kind":"Let"},"identifier":"mutuallyRecursiveBindingGroup"},{"annotation":{"meta":null,"sourceSpan":{"end":[21,27],"start":[21,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[22,15],"start":[22,1]}},"argument":"v","body":{"annotation":{"meta":null,"sourceSpan":{"end":[22,15],"start":[22,1]}},"argument":"v1","body":{"annotation":{"meta":null,"sourceSpan":{"end":[22,15],"start":[22,13]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"literalType":"IntLiteral","value":42}},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[21,20],"name":"tests/purus/passing/Misc/Lib.purs","start":[21,17]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[21,27],"name":"tests/purus/passing/Misc/Lib.purs","start":[21,24]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[21,13],"name":"tests/purus/passing/Misc/Lib.purs","start":[21,10]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[21,27],"name":"tests/purus/passing/Misc/Lib.purs","start":[21,17]},[]],"contents":[{"annotation":[{"end":[21,27],"name":"tests/purus/passing/Misc/Lib.purs","start":[21,17]},[]],"contents":[{"annotation":[{"end":[21,23],"name":"tests/purus/passing/Misc/Lib.purs","start":[21,21]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[21,20],"name":"tests/purus/passing/Misc/Lib.purs","start":[21,17]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[21,27],"name":"tests/purus/passing/Misc/Lib.purs","start":[21,24]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"identifier":"minus"},{"annotation":{"meta":null,"sourceSpan":{"end":[386,29],"start":[386,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[393,13],"start":[387,1]}},"argument":"n","body":{"annotation":{"meta":null,"sourceSpan":{"end":[393,13],"start":[387,16]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[388,4],"start":[388,3]}},"binderType":"LiteralBinder","literal":{"literalType":"IntLiteral","value":0}}],"expression":{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[388,13],"start":[388,8]}},"kind":"Var","type":{"annotation":[{"end":[386,29],"name":"tests/purus/passing/Misc/Lib.purs","start":[386,22]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"},"value":{"identifier":"False","moduleName":["Prim"]}},"isGuarded":false},{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[389,4],"start":[389,3]}},"binderType":"LiteralBinder","literal":{"literalType":"IntLiteral","value":1}}],"expression":{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[389,12],"start":[389,8]}},"kind":"Var","type":{"annotation":[{"end":[386,29],"name":"tests/purus/passing/Misc/Lib.purs","start":[386,22]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"},"value":{"identifier":"True","moduleName":["Prim"]}},"isGuarded":false},{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[390,4],"start":[390,3]}},"binderType":"LiteralBinder","literal":{"literalType":"IntLiteral","value":2}}],"expression":{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[390,12],"start":[390,8]}},"kind":"Var","type":{"annotation":[{"end":[386,29],"name":"tests/purus/passing/Misc/Lib.purs","start":[386,22]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"},"value":{"identifier":"True","moduleName":["Prim"]}},"isGuarded":false},{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[391,4],"start":[391,3]}},"binderType":"LiteralBinder","literal":{"literalType":"IntLiteral","value":3}}],"expression":{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[391,12],"start":[391,8]}},"kind":"Var","type":{"annotation":[{"end":[386,29],"name":"tests/purus/passing/Misc/Lib.purs","start":[386,22]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"},"value":{"identifier":"True","moduleName":["Prim"]}},"isGuarded":false},{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[392,4],"start":[392,3]}},"binderType":"LiteralBinder","literal":{"literalType":"IntLiteral","value":4}}],"expression":{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[392,12],"start":[392,8]}},"kind":"Var","type":{"annotation":[{"end":[386,29],"name":"tests/purus/passing/Misc/Lib.purs","start":[386,22]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"},"value":{"identifier":"True","moduleName":["Prim"]}},"isGuarded":false},{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[393,4],"start":[393,3]}},"binderType":"NullBinder"}],"expression":{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[393,13],"start":[393,8]}},"kind":"Var","type":{"annotation":[{"end":[386,29],"name":"tests/purus/passing/Misc/Lib.purs","start":[386,22]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"},"value":{"identifier":"False","moduleName":["Prim"]}},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[387,22],"start":[387,21]}},"kind":"Var","type":{"annotation":[{"end":[386,18],"name":"tests/purus/passing/Misc/Lib.purs","start":[386,15]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"identifier":"n","sourcePos":[387,1]}}],"kind":"Case","type":{"annotation":[{"end":[386,29],"name":"tests/purus/passing/Misc/Lib.purs","start":[386,22]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[386,18],"name":"tests/purus/passing/Misc/Lib.purs","start":[386,15]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[386,29],"name":"tests/purus/passing/Misc/Lib.purs","start":[386,22]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"identifier":"litPattern"},{"annotation":{"meta":null,"sourceSpan":{"end":[395,29],"start":[395,1]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[396,31],"start":[396,21]}},"kind":"Var","type":{"annotation":[{"end":[386,29],"name":"tests/purus/passing/Misc/Lib.purs","start":[386,15]},[]],"contents":[{"annotation":[{"end":[386,29],"name":"tests/purus/passing/Misc/Lib.purs","start":[386,15]},[]],"contents":[{"annotation":[{"end":[386,21],"name":"tests/purus/passing/Misc/Lib.purs","start":[386,19]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[386,18],"name":"tests/purus/passing/Misc/Lib.purs","start":[386,15]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[386,29],"name":"tests/purus/passing/Misc/Lib.purs","start":[386,22]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"litPattern","moduleName":["Lib"]}},"annotation":{"meta":null,"sourceSpan":{"end":[396,33],"start":[396,21]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[396,33],"start":[396,32]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"literalType":"IntLiteral","value":5}},"kind":"App"},"identifier":"litPatternApplied"},{"annotation":{"meta":null,"sourceSpan":{"end":[408,30],"start":[408,1]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[409,38],"start":[409,22]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"nullList","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[409,51],"start":[409,22]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[409,51],"start":[409,39]}},"kind":"Var","type":{"annotation":[{"end":[405,56],"name":"tests/purus/passing/Misc/Lib.purs","start":[405,17]},[]],"contents":[{"annotation":[{"end":[405,36],"name":"tests/purus/passing/Misc/Lib.purs","start":[405,17]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[405,56],"name":"tests/purus/passing/Misc/Lib.purs","start":[405,37]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"someDataList","moduleName":["Lib"]}},"kind":"App"},"identifier":"isNullSomeDataList"},{"annotation":{"meta":null,"sourceSpan":{"end":[398,25],"start":[398,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[400,9],"start":[399,1]}},"argument":"n","body":{"annotation":{"meta":null,"sourceSpan":{"end":[400,9],"start":[400,8]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"literalType":"IntLiteral","value":2}},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[398,18],"name":"tests/purus/passing/Misc/Lib.purs","start":[398,15]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[398,25],"name":"tests/purus/passing/Misc/Lib.purs","start":[398,22]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"identifier":"irrPattern"},{"annotation":{"meta":null,"sourceSpan":{"end":[273,33],"start":[273,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[274,9],"start":[274,1]}},"argument":"x","body":{"annotation":{"meta":null,"sourceSpan":{"end":[274,9],"start":[274,8]}},"kind":"Var","type":{"annotation":[{"end":[273,28],"name":"tests/purus/passing/Misc/Lib.purs","start":[273,27]},[]],"contents":{"kind":{"annotation":[{"end":[273,24],"name":"tests/purus/passing/Misc/Lib.purs","start":[273,20]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"t"},"tag":"TypeVar"},"value":{"identifier":"x","sourcePos":[274,1]}},"kind":"Abs","type":{"annotation":[{"end":[273,33],"name":"tests/purus/passing/Misc/Lib.purs","start":[273,7]},[]],"contents":{"identifier":"t","kind":{"annotation":[{"end":[273,24],"name":"tests/purus/passing/Misc/Lib.purs","start":[273,20]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":42,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[273,28],"name":"tests/purus/passing/Misc/Lib.purs","start":[273,27]},[]],"contents":{"kind":{"annotation":[{"end":[273,24],"name":"tests/purus/passing/Misc/Lib.purs","start":[273,20]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"t"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[273,33],"name":"tests/purus/passing/Misc/Lib.purs","start":[273,32]},[]],"contents":{"kind":{"annotation":[{"end":[273,24],"name":"tests/purus/passing/Misc/Lib.purs","start":[273,20]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"t"},"tag":"TypeVar"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"identifier":"id"},{"annotation":{"meta":null,"sourceSpan":{"end":[278,82],"start":[278,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[279,37],"start":[279,13]}},"kind":"Literal","type":{"annotation":[{"end":[278,82],"name":"tests/purus/passing/Misc/Lib.purs","start":[278,14]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[278,31],"name":"tests/purus/passing/Misc/Lib.purs","start":[278,27]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":45,"type":{"annotation":[{"end":[278,82],"name":"tests/purus/passing/Misc/Lib.purs","start":[278,34]},[]],"contents":{"identifier":"b","kind":{"annotation":[{"end":[278,43],"name":"tests/purus/passing/Misc/Lib.purs","start":[278,39]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":44,"type":{"annotation":[{"end":[278,82],"name":"tests/purus/passing/Misc/Lib.purs","start":[278,46]},[]],"contents":[{"annotation":[{"end":[278,47],"name":"tests/purus/passing/Misc/Lib.purs","start":[278,46]},[]],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[{"end":[278,63],"name":"tests/purus/passing/Misc/Lib.purs","start":[278,47]},[]],"contents":["getIdA",{"annotation":[{"end":[278,63],"name":"tests/purus/passing/Misc/Lib.purs","start":[278,57]},[]],"contents":[{"annotation":[{"end":[278,63],"name":"tests/purus/passing/Misc/Lib.purs","start":[278,57]},[]],"contents":[{"annotation":[{"end":[278,61],"name":"tests/purus/passing/Misc/Lib.purs","start":[278,59]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[278,58],"name":"tests/purus/passing/Misc/Lib.purs","start":[278,57]},[]],"contents":{"kind":{"annotation":[{"end":[278,31],"name":"tests/purus/passing/Misc/Lib.purs","start":[278,27]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[278,63],"name":"tests/purus/passing/Misc/Lib.purs","start":[278,62]},[]],"contents":{"kind":{"annotation":[{"end":[278,31],"name":"tests/purus/passing/Misc/Lib.purs","start":[278,27]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[278,81],"name":"tests/purus/passing/Misc/Lib.purs","start":[278,65]},[]],"contents":["getIdB",{"annotation":[{"end":[278,81],"name":"tests/purus/passing/Misc/Lib.purs","start":[278,75]},[]],"contents":[{"annotation":[{"end":[278,81],"name":"tests/purus/passing/Misc/Lib.purs","start":[278,75]},[]],"contents":[{"annotation":[{"end":[278,79],"name":"tests/purus/passing/Misc/Lib.purs","start":[278,77]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[278,76],"name":"tests/purus/passing/Misc/Lib.purs","start":[278,75]},[]],"contents":{"kind":{"annotation":[{"end":[278,43],"name":"tests/purus/passing/Misc/Lib.purs","start":[278,39]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"b"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[278,81],"name":"tests/purus/passing/Misc/Lib.purs","start":[278,80]},[]],"contents":{"kind":{"annotation":[{"end":[278,43],"name":"tests/purus/passing/Misc/Lib.purs","start":[278,39]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"b"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[278,82],"name":"tests/purus/passing/Misc/Lib.purs","start":[278,81]},[]],"contents":[{"annotation":[{"end":[278,82],"name":"tests/purus/passing/Misc/Lib.purs","start":[278,81]},[]],"tag":"REmpty"},{"annotation":[{"end":[278,61],"name":"tests/purus/passing/Misc/Lib.purs","start":[278,59]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"KindApp"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"literalType":"ObjectLiteral","value":[["getIdB",{"annotation":{"meta":null,"sourceSpan":{"end":[279,36],"start":[279,34]}},"kind":"Var","type":{"annotation":[{"end":[273,33],"name":"tests/purus/passing/Misc/Lib.purs","start":[273,7]},[]],"contents":{"identifier":"t","kind":{"annotation":[{"end":[273,24],"name":"tests/purus/passing/Misc/Lib.purs","start":[273,20]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":42,"type":{"annotation":[{"end":[273,33],"name":"tests/purus/passing/Misc/Lib.purs","start":[273,27]},[]],"contents":[{"annotation":[{"end":[273,33],"name":"tests/purus/passing/Misc/Lib.purs","start":[273,27]},[]],"contents":[{"annotation":[{"end":[273,31],"name":"tests/purus/passing/Misc/Lib.purs","start":[273,29]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[273,28],"name":"tests/purus/passing/Misc/Lib.purs","start":[273,27]},[]],"contents":{"kind":{"annotation":[{"end":[273,24],"name":"tests/purus/passing/Misc/Lib.purs","start":[273,20]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"t"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[273,33],"name":"tests/purus/passing/Misc/Lib.purs","start":[273,32]},[]],"contents":{"kind":{"annotation":[{"end":[273,24],"name":"tests/purus/passing/Misc/Lib.purs","start":[273,20]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"t"},"tag":"TypeVar"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"id","moduleName":["Lib"]}}],["getIdA",{"annotation":{"meta":null,"sourceSpan":{"end":[279,24],"start":[279,22]}},"kind":"Var","type":{"annotation":[{"end":[273,33],"name":"tests/purus/passing/Misc/Lib.purs","start":[273,7]},[]],"contents":{"identifier":"t","kind":{"annotation":[{"end":[273,24],"name":"tests/purus/passing/Misc/Lib.purs","start":[273,20]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":42,"type":{"annotation":[{"end":[273,33],"name":"tests/purus/passing/Misc/Lib.purs","start":[273,27]},[]],"contents":[{"annotation":[{"end":[273,33],"name":"tests/purus/passing/Misc/Lib.purs","start":[273,27]},[]],"contents":[{"annotation":[{"end":[273,31],"name":"tests/purus/passing/Misc/Lib.purs","start":[273,29]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[273,28],"name":"tests/purus/passing/Misc/Lib.purs","start":[273,27]},[]],"contents":{"kind":{"annotation":[{"end":[273,24],"name":"tests/purus/passing/Misc/Lib.purs","start":[273,20]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"t"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[273,33],"name":"tests/purus/passing/Misc/Lib.purs","start":[273,32]},[]],"contents":{"kind":{"annotation":[{"end":[273,24],"name":"tests/purus/passing/Misc/Lib.purs","start":[273,20]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"t"},"tag":"TypeVar"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"id","moduleName":["Lib"]}}]]}},"identifier":"objForall"},{"annotation":{"meta":null,"sourceSpan":{"end":[276,14],"start":[276,1]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[276,12],"start":[276,10]}},"kind":"Var","type":{"annotation":[{"end":[273,33],"name":"tests/purus/passing/Misc/Lib.purs","start":[273,7]},[]],"contents":{"identifier":"t","kind":{"annotation":[{"end":[273,24],"name":"tests/purus/passing/Misc/Lib.purs","start":[273,20]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":42,"type":{"annotation":[{"end":[273,33],"name":"tests/purus/passing/Misc/Lib.purs","start":[273,27]},[]],"contents":[{"annotation":[{"end":[273,33],"name":"tests/purus/passing/Misc/Lib.purs","start":[273,27]},[]],"contents":[{"annotation":[{"end":[273,31],"name":"tests/purus/passing/Misc/Lib.purs","start":[273,29]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[273,28],"name":"tests/purus/passing/Misc/Lib.purs","start":[273,27]},[]],"contents":{"kind":{"annotation":[{"end":[273,24],"name":"tests/purus/passing/Misc/Lib.purs","start":[273,20]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"t"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[273,33],"name":"tests/purus/passing/Misc/Lib.purs","start":[273,32]},[]],"contents":{"kind":{"annotation":[{"end":[273,24],"name":"tests/purus/passing/Misc/Lib.purs","start":[273,20]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"t"},"tag":"TypeVar"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"id","moduleName":["Lib"]}},"annotation":{"meta":null,"sourceSpan":{"end":[276,14],"start":[276,10]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[276,14],"start":[276,13]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"literalType":"IntLiteral","value":2}},"kind":"App"},"identifier":"testId"},{"annotation":{"meta":null,"sourceSpan":{"end":[216,32],"start":[216,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[217,18],"start":[217,1]}},"argument":"v","body":{"annotation":{"meta":null,"sourceSpan":{"end":[217,18],"start":[217,1]}},"argument":"v1","body":{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[217,18],"start":[217,14]}},"kind":"Var","type":{"annotation":[{"end":[216,32],"name":"tests/purus/passing/Misc/Lib.purs","start":[216,25]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"},"value":{"identifier":"True","moduleName":["Prim"]}},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[216,21],"name":"tests/purus/passing/Misc/Lib.purs","start":[216,18]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[216,32],"name":"tests/purus/passing/Misc/Lib.purs","start":[216,25]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[216,14],"name":"tests/purus/passing/Misc/Lib.purs","start":[216,11]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[216,32],"name":"tests/purus/passing/Misc/Lib.purs","start":[216,18]},[]],"contents":[{"annotation":[{"end":[216,32],"name":"tests/purus/passing/Misc/Lib.purs","start":[216,18]},[]],"contents":[{"annotation":[{"end":[216,24],"name":"tests/purus/passing/Misc/Lib.purs","start":[216,22]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[216,21],"name":"tests/purus/passing/Misc/Lib.purs","start":[216,18]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[216,32],"name":"tests/purus/passing/Misc/Lib.purs","start":[216,25]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"identifier":"fakeLT"},{"annotation":{"meta":null,"sourceSpan":{"end":[317,30],"start":[317,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[322,41],"start":[318,1]}},"argument":"x","body":{"annotation":{"meta":{"metaType":"IsWhere"},"sourceSpan":{"end":[318,22],"start":[318,17]}},"binds":[{"annotation":{"meta":null,"sourceSpan":{"end":[321,20],"start":[321,5]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[321,20],"start":[321,5]}},"argument":"c","body":{"annotation":{"meta":null,"sourceSpan":{"end":[321,20],"start":[321,5]}},"argument":"d","body":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[321,16],"start":[321,15]}},"kind":"Var","type":{"annotation":[{"end":[209,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[209,9]},[]],"contents":[{"annotation":[{"end":[209,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[209,9]},[]],"contents":[{"annotation":[{"end":[209,15],"name":"tests/purus/passing/Misc/Lib.purs","start":[209,13]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[209,12],"name":"tests/purus/passing/Misc/Lib.purs","start":[209,9]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[209,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[209,16]},[]],"contents":[{"annotation":[{"end":[209,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[209,16]},[]],"contents":[{"annotation":[{"end":[209,22],"name":"tests/purus/passing/Misc/Lib.purs","start":[209,20]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[209,19],"name":"tests/purus/passing/Misc/Lib.purs","start":[209,16]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[209,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[209,23]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"plus","moduleName":["Lib"]}},"annotation":{"meta":null,"sourceSpan":{"end":[321,20],"start":[321,13]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[321,14],"start":[321,13]}},"kind":"Var","type":{"annotation":[{"end":[209,12],"name":"tests/purus/passing/Misc/Lib.purs","start":[209,9]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"identifier":"c","sourcePos":[321,5]}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[321,20],"start":[321,13]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[321,18],"start":[321,17]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[317,19],"name":"tests/purus/passing/Misc/Lib.purs","start":[317,16]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[209,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[209,23]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"g","sourcePos":[322,5]}},"annotation":{"meta":null,"sourceSpan":{"end":[321,20],"start":[321,17]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[321,20],"start":[321,19]}},"kind":"Var","type":{"annotation":[{"end":[317,19],"name":"tests/purus/passing/Misc/Lib.purs","start":[317,16]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"identifier":"d","sourcePos":[321,5]}},"kind":"App"},"kind":"App"},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[317,19],"name":"tests/purus/passing/Misc/Lib.purs","start":[317,16]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[209,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[209,23]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[209,12],"name":"tests/purus/passing/Misc/Lib.purs","start":[209,9]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[317,19],"name":"tests/purus/passing/Misc/Lib.purs","start":[317,16]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[209,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[209,23]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"identifier":"j"},{"annotation":{"meta":null,"sourceSpan":{"end":[320,25],"start":[320,5]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[320,25],"start":[320,5]}},"argument":"a","body":{"annotation":{"meta":null,"sourceSpan":{"end":[320,25],"start":[320,5]}},"argument":"b","body":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[320,19],"start":[320,17]}},"kind":"Var","type":{"annotation":[{"end":[216,32],"name":"tests/purus/passing/Misc/Lib.purs","start":[216,11]},[]],"contents":[{"annotation":[{"end":[216,32],"name":"tests/purus/passing/Misc/Lib.purs","start":[216,11]},[]],"contents":[{"annotation":[{"end":[216,17],"name":"tests/purus/passing/Misc/Lib.purs","start":[216,15]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[216,14],"name":"tests/purus/passing/Misc/Lib.purs","start":[216,11]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[216,32],"name":"tests/purus/passing/Misc/Lib.purs","start":[216,18]},[]],"contents":[{"annotation":[{"end":[216,32],"name":"tests/purus/passing/Misc/Lib.purs","start":[216,18]},[]],"contents":[{"annotation":[{"end":[216,24],"name":"tests/purus/passing/Misc/Lib.purs","start":[216,22]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[216,21],"name":"tests/purus/passing/Misc/Lib.purs","start":[216,18]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[216,32],"name":"tests/purus/passing/Misc/Lib.purs","start":[216,25]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"fakeLT","moduleName":["Lib"]}},"annotation":{"meta":null,"sourceSpan":{"end":[320,25],"start":[320,13]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[320,14],"start":[320,13]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[317,19],"name":"tests/purus/passing/Misc/Lib.purs","start":[317,16]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[209,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[209,23]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"g","sourcePos":[322,5]}},"annotation":{"meta":null,"sourceSpan":{"end":[320,16],"start":[320,13]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[320,16],"start":[320,15]}},"kind":"Var","type":{"annotation":[{"end":[317,19],"name":"tests/purus/passing/Misc/Lib.purs","start":[317,16]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"identifier":"a","sourcePos":[320,5]}},"kind":"App"},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[320,25],"start":[320,13]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[320,21],"start":[320,20]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[209,12],"name":"tests/purus/passing/Misc/Lib.purs","start":[209,9]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[317,19],"name":"tests/purus/passing/Misc/Lib.purs","start":[317,16]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[209,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[209,23]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"j","sourcePos":[321,5]}},"annotation":{"meta":null,"sourceSpan":{"end":[320,23],"start":[320,20]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[320,23],"start":[320,22]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"literalType":"IntLiteral","value":4}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[320,25],"start":[320,20]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[320,25],"start":[320,24]}},"kind":"Var","type":{"annotation":[{"end":[317,19],"name":"tests/purus/passing/Misc/Lib.purs","start":[317,16]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"identifier":"b","sourcePos":[320,5]}},"kind":"App"},"kind":"App"},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[317,19],"name":"tests/purus/passing/Misc/Lib.purs","start":[317,16]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[216,32],"name":"tests/purus/passing/Misc/Lib.purs","start":[216,25]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[317,19],"name":"tests/purus/passing/Misc/Lib.purs","start":[317,16]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[317,19],"name":"tests/purus/passing/Misc/Lib.purs","start":[317,16]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[216,32],"name":"tests/purus/passing/Misc/Lib.purs","start":[216,25]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"identifier":"h"},{"annotation":{"meta":null,"sourceSpan":{"end":[322,41],"start":[322,5]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[322,41],"start":[322,5]}},"argument":"a","body":{"annotation":{"meta":null,"sourceSpan":{"end":[322,41],"start":[322,11]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"binderType":"ConstructorBinder","binders":[],"constructorName":{"identifier":"True","moduleName":["Prim"]},"typeName":{"identifier":"Boolean","moduleName":["Prim"]}}],"expression":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[322,26],"start":[322,25]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[209,12],"name":"tests/purus/passing/Misc/Lib.purs","start":[209,9]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[317,19],"name":"tests/purus/passing/Misc/Lib.purs","start":[317,16]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[209,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[209,23]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"j","sourcePos":[321,5]}},"annotation":{"meta":null,"sourceSpan":{"end":[322,28],"start":[322,25]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[322,28],"start":[322,27]}},"kind":"Var","type":{"annotation":[{"end":[317,19],"name":"tests/purus/passing/Misc/Lib.purs","start":[317,16]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"identifier":"x","sourcePos":[318,1]}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[322,30],"start":[322,25]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[322,30],"start":[322,29]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"literalType":"IntLiteral","value":1}},"kind":"App"},"isGuarded":false},{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[322,41],"start":[322,11]}},"binderType":"NullBinder"}],"expression":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[322,39],"start":[322,38]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"multiplyInteger","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[322,41],"start":[322,36]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[322,37],"start":[322,36]}},"kind":"Var","type":{"annotation":[{"end":[317,19],"name":"tests/purus/passing/Misc/Lib.purs","start":[317,16]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"identifier":"x","sourcePos":[318,1]}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[322,41],"start":[322,36]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[322,41],"start":[322,40]}},"kind":"Var","type":{"annotation":[{"end":[317,19],"name":"tests/purus/passing/Misc/Lib.purs","start":[317,16]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"identifier":"x","sourcePos":[318,1]}},"kind":"App"},"isGuarded":false}],"caseExpressions":[{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[322,15],"start":[322,14]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[317,19],"name":"tests/purus/passing/Misc/Lib.purs","start":[317,16]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[317,19],"name":"tests/purus/passing/Misc/Lib.purs","start":[317,16]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[216,32],"name":"tests/purus/passing/Misc/Lib.purs","start":[216,25]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"h","sourcePos":[320,5]}},"annotation":{"meta":null,"sourceSpan":{"end":[322,17],"start":[322,14]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[322,17],"start":[322,16]}},"kind":"Var","type":{"annotation":[{"end":[317,19],"name":"tests/purus/passing/Misc/Lib.purs","start":[317,16]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"identifier":"a","sourcePos":[322,5]}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[322,19],"start":[322,14]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[322,19],"start":[322,18]}},"kind":"Var","type":{"annotation":[{"end":[317,19],"name":"tests/purus/passing/Misc/Lib.purs","start":[317,16]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"identifier":"x","sourcePos":[318,1]}},"kind":"App"}],"kind":"Case","type":{"annotation":[{"end":[209,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[209,23]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[317,19],"name":"tests/purus/passing/Misc/Lib.purs","start":[317,16]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[209,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[209,23]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"identifier":"g"}],"expression":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[318,18],"start":[318,17]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[317,19],"name":"tests/purus/passing/Misc/Lib.purs","start":[317,16]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[317,19],"name":"tests/purus/passing/Misc/Lib.purs","start":[317,16]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[216,32],"name":"tests/purus/passing/Misc/Lib.purs","start":[216,25]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"h","sourcePos":[320,5]}},"annotation":{"meta":null,"sourceSpan":{"end":[318,20],"start":[318,17]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[318,20],"start":[318,19]}},"kind":"Var","type":{"annotation":[{"end":[317,19],"name":"tests/purus/passing/Misc/Lib.purs","start":[317,16]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"identifier":"x","sourcePos":[318,1]}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[318,22],"start":[318,17]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[318,22],"start":[318,21]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"literalType":"IntLiteral","value":3}},"kind":"App"},"kind":"Let"},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[317,19],"name":"tests/purus/passing/Misc/Lib.purs","start":[317,16]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[317,30],"name":"tests/purus/passing/Misc/Lib.purs","start":[317,23]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"identifier":"testForLift"},{"annotation":{"meta":null,"sourceSpan":{"end":[63,27],"start":[63,3]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[63,27],"start":[63,3]}},"argument":"dict","body":{"annotation":{"meta":null,"sourceSpan":{"end":[63,27],"start":[63,3]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":{"metaType":"IsNewtype"},"sourceSpan":{"end":[63,27],"start":[63,3]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[63,27],"start":[63,3]}},"binderType":"VarBinder","identifier":"v","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["eq2",{"annotation":[{"end":[63,27],"name":"tests/purus/passing/Misc/Lib.purs","start":[63,10]},[]],"contents":[{"annotation":[{"end":[63,27],"name":"tests/purus/passing/Misc/Lib.purs","start":[63,10]},[]],"contents":[{"annotation":[{"end":[63,14],"name":"tests/purus/passing/Misc/Lib.purs","start":[63,12]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[62,21],"name":"tests/purus/passing/Misc/Lib.purs","start":[62,17]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[63,27],"name":"tests/purus/passing/Misc/Lib.purs","start":[63,15]},[]],"contents":[{"annotation":[{"end":[63,27],"name":"tests/purus/passing/Misc/Lib.purs","start":[63,15]},[]],"contents":[{"annotation":[{"end":[63,19],"name":"tests/purus/passing/Misc/Lib.purs","start":[63,17]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[62,33],"name":"tests/purus/passing/Misc/Lib.purs","start":[62,29]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"b"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[63,27],"name":"tests/purus/passing/Misc/Lib.purs","start":[63,20]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"tag":"REmpty"},{"annotation":[{"end":[63,14],"name":"tests/purus/passing/Misc/Lib.purs","start":[63,12]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"KindApp"}],"tag":"RCons"}],"tag":"TypeApp"}}],"constructorName":{"identifier":"Eq2$Dict","moduleName":["Lib"]},"typeName":{"identifier":"Eq2$Dict","moduleName":["Lib"]}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[63,27],"start":[63,3]}},"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[63,27],"start":[63,3]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["eq2",{"annotation":[{"end":[63,27],"name":"tests/purus/passing/Misc/Lib.purs","start":[63,10]},[]],"contents":[{"annotation":[{"end":[63,27],"name":"tests/purus/passing/Misc/Lib.purs","start":[63,10]},[]],"contents":[{"annotation":[{"end":[63,14],"name":"tests/purus/passing/Misc/Lib.purs","start":[63,12]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[62,21],"name":"tests/purus/passing/Misc/Lib.purs","start":[62,17]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[63,27],"name":"tests/purus/passing/Misc/Lib.purs","start":[63,15]},[]],"contents":[{"annotation":[{"end":[63,27],"name":"tests/purus/passing/Misc/Lib.purs","start":[63,15]},[]],"contents":[{"annotation":[{"end":[63,19],"name":"tests/purus/passing/Misc/Lib.purs","start":[63,17]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[62,33],"name":"tests/purus/passing/Misc/Lib.purs","start":[62,29]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"b"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[63,27],"name":"tests/purus/passing/Misc/Lib.purs","start":[63,20]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"tag":"REmpty"},{"annotation":[{"end":[63,14],"name":"tests/purus/passing/Misc/Lib.purs","start":[63,12]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"KindApp"}],"tag":"RCons"}],"tag":"TypeApp"},"value":{"identifier":"v","sourcePos":[63,3]}},"fieldName":"eq2","kind":"Accessor","type":{"annotation":[{"end":[63,27],"name":"tests/purus/passing/Misc/Lib.purs","start":[63,10]},[]],"contents":[{"annotation":[{"end":[63,27],"name":"tests/purus/passing/Misc/Lib.purs","start":[63,10]},[]],"contents":[{"annotation":[{"end":[63,14],"name":"tests/purus/passing/Misc/Lib.purs","start":[63,12]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[63,11],"name":"tests/purus/passing/Misc/Lib.purs","start":[63,10]},[]],"contents":{"kind":{"annotation":[{"end":[62,21],"name":"tests/purus/passing/Misc/Lib.purs","start":[62,17]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[63,27],"name":"tests/purus/passing/Misc/Lib.purs","start":[63,15]},[]],"contents":[{"annotation":[{"end":[63,27],"name":"tests/purus/passing/Misc/Lib.purs","start":[63,15]},[]],"contents":[{"annotation":[{"end":[63,19],"name":"tests/purus/passing/Misc/Lib.purs","start":[63,17]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[63,16],"name":"tests/purus/passing/Misc/Lib.purs","start":[63,15]},[]],"contents":{"kind":{"annotation":[{"end":[62,33],"name":"tests/purus/passing/Misc/Lib.purs","start":[62,29]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"b"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[63,27],"name":"tests/purus/passing/Misc/Lib.purs","start":[63,20]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[63,27],"start":[63,3]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Lib"],"Eq2$Dict"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[62,21],"name":"tests/purus/passing/Misc/Lib.purs","start":[62,17]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[62,33],"name":"tests/purus/passing/Misc/Lib.purs","start":[62,29]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"b"},"tag":"TypeVar"}],"tag":"TypeApp"},"value":{"identifier":"dict","sourcePos":[0,0]}}],"kind":"Case","type":{"annotation":[{"end":[63,27],"name":"tests/purus/passing/Misc/Lib.purs","start":[63,10]},[]],"contents":[{"annotation":[{"end":[63,27],"name":"tests/purus/passing/Misc/Lib.purs","start":[63,10]},[]],"contents":[{"annotation":[{"end":[63,14],"name":"tests/purus/passing/Misc/Lib.purs","start":[63,12]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[63,11],"name":"tests/purus/passing/Misc/Lib.purs","start":[63,10]},[]],"contents":{"kind":{"annotation":[{"end":[62,21],"name":"tests/purus/passing/Misc/Lib.purs","start":[62,17]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[63,27],"name":"tests/purus/passing/Misc/Lib.purs","start":[63,15]},[]],"contents":[{"annotation":[{"end":[63,27],"name":"tests/purus/passing/Misc/Lib.purs","start":[63,15]},[]],"contents":[{"annotation":[{"end":[63,19],"name":"tests/purus/passing/Misc/Lib.purs","start":[63,17]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[63,16],"name":"tests/purus/passing/Misc/Lib.purs","start":[63,15]},[]],"contents":{"kind":{"annotation":[{"end":[62,33],"name":"tests/purus/passing/Misc/Lib.purs","start":[62,29]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"b"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[63,27],"name":"tests/purus/passing/Misc/Lib.purs","start":[63,20]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[62,21],"name":"tests/purus/passing/Misc/Lib.purs","start":[62,17]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":49,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"b","kind":{"annotation":[{"end":[62,33],"name":"tests/purus/passing/Misc/Lib.purs","start":[62,29]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":48,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Lib"],"Eq2$Dict"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[62,21],"name":"tests/purus/passing/Misc/Lib.purs","start":[62,17]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[62,33],"name":"tests/purus/passing/Misc/Lib.purs","start":[62,29]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"b"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[63,27],"name":"tests/purus/passing/Misc/Lib.purs","start":[63,10]},[]],"contents":[{"annotation":[{"end":[63,27],"name":"tests/purus/passing/Misc/Lib.purs","start":[63,10]},[]],"contents":[{"annotation":[{"end":[63,14],"name":"tests/purus/passing/Misc/Lib.purs","start":[63,12]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[63,11],"name":"tests/purus/passing/Misc/Lib.purs","start":[63,10]},[]],"contents":{"kind":{"annotation":[{"end":[62,21],"name":"tests/purus/passing/Misc/Lib.purs","start":[62,17]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[63,27],"name":"tests/purus/passing/Misc/Lib.purs","start":[63,15]},[]],"contents":[{"annotation":[{"end":[63,27],"name":"tests/purus/passing/Misc/Lib.purs","start":[63,15]},[]],"contents":[{"annotation":[{"end":[63,19],"name":"tests/purus/passing/Misc/Lib.purs","start":[63,17]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[63,16],"name":"tests/purus/passing/Misc/Lib.purs","start":[63,15]},[]],"contents":{"kind":{"annotation":[{"end":[62,33],"name":"tests/purus/passing/Misc/Lib.purs","start":[62,29]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"b"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[63,27],"name":"tests/purus/passing/Misc/Lib.purs","start":[63,20]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarVisible"},"tag":"ForAll"},"visibility":"TypeVarVisible"},"tag":"ForAll"}},"identifier":"eq2"},{"annotation":{"meta":null,"sourceSpan":{"end":[68,19],"start":[68,1]}},"bindType":"NonRec","expression":{"abstraction":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[69,14],"start":[69,11]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[62,21],"name":"tests/purus/passing/Misc/Lib.purs","start":[62,17]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":49,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"b","kind":{"annotation":[{"end":[62,33],"name":"tests/purus/passing/Misc/Lib.purs","start":[62,29]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":48,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Lib"],"Eq2$Dict"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[62,21],"name":"tests/purus/passing/Misc/Lib.purs","start":[62,17]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[62,33],"name":"tests/purus/passing/Misc/Lib.purs","start":[62,29]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"b"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[63,27],"name":"tests/purus/passing/Misc/Lib.purs","start":[63,10]},[]],"contents":[{"annotation":[{"end":[63,27],"name":"tests/purus/passing/Misc/Lib.purs","start":[63,10]},[]],"contents":[{"annotation":[{"end":[63,14],"name":"tests/purus/passing/Misc/Lib.purs","start":[63,12]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[63,11],"name":"tests/purus/passing/Misc/Lib.purs","start":[63,10]},[]],"contents":{"kind":{"annotation":[{"end":[62,21],"name":"tests/purus/passing/Misc/Lib.purs","start":[62,17]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[63,27],"name":"tests/purus/passing/Misc/Lib.purs","start":[63,15]},[]],"contents":[{"annotation":[{"end":[63,27],"name":"tests/purus/passing/Misc/Lib.purs","start":[63,15]},[]],"contents":[{"annotation":[{"end":[63,19],"name":"tests/purus/passing/Misc/Lib.purs","start":[63,17]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[63,16],"name":"tests/purus/passing/Misc/Lib.purs","start":[63,15]},[]],"contents":{"kind":{"annotation":[{"end":[62,33],"name":"tests/purus/passing/Misc/Lib.purs","start":[62,29]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"b"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[63,27],"name":"tests/purus/passing/Misc/Lib.purs","start":[63,20]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarVisible"},"tag":"ForAll"},"visibility":"TypeVarVisible"},"tag":"ForAll"},"value":{"identifier":"eq2","moduleName":["Lib"]}},"annotation":{"meta":null,"sourceSpan":{"end":[69,18],"start":[69,11]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Lib"],"Eq2$Dict"],"tag":"TypeConstructor"},{"annotation":[{"end":[65,17],"name":"tests/purus/passing/Misc/Lib.purs","start":[65,14]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[65,25],"name":"tests/purus/passing/Misc/Lib.purs","start":[65,18]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"eq2IntBoolean","moduleName":["Lib"]}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[69,18],"start":[69,11]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[69,18],"start":[69,15]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"literalType":"IntLiteral","value":101}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[69,24],"start":[69,11]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"},"value":{"identifier":"False","moduleName":["Prim"]}},"kind":"App"},"identifier":"testEq2"},{"annotation":{"meta":null,"sourceSpan":{"end":[19,26],"start":[19,3]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[19,26],"start":[19,3]}},"argument":"dict","body":{"annotation":{"meta":null,"sourceSpan":{"end":[19,26],"start":[19,3]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":{"metaType":"IsNewtype"},"sourceSpan":{"end":[19,26],"start":[19,3]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[19,26],"start":[19,3]}},"binderType":"VarBinder","identifier":"v","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["eq",{"annotation":[{"end":[19,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[19,9]},[]],"contents":[{"annotation":[{"end":[19,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[19,9]},[]],"contents":[{"annotation":[{"end":[19,13],"name":"tests/purus/passing/Misc/Lib.purs","start":[19,11]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[18,20],"name":"tests/purus/passing/Misc/Lib.purs","start":[18,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[19,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[19,14]},[]],"contents":[{"annotation":[{"end":[19,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[19,14]},[]],"contents":[{"annotation":[{"end":[19,18],"name":"tests/purus/passing/Misc/Lib.purs","start":[19,16]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[18,20],"name":"tests/purus/passing/Misc/Lib.purs","start":[18,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[19,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[19,19]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"tag":"REmpty"},{"annotation":[{"end":[19,13],"name":"tests/purus/passing/Misc/Lib.purs","start":[19,11]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"KindApp"}],"tag":"RCons"}],"tag":"TypeApp"}}],"constructorName":{"identifier":"Eq$Dict","moduleName":["Lib"]},"typeName":{"identifier":"Eq$Dict","moduleName":["Lib"]}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[19,26],"start":[19,3]}},"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[19,26],"start":[19,3]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["eq",{"annotation":[{"end":[19,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[19,9]},[]],"contents":[{"annotation":[{"end":[19,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[19,9]},[]],"contents":[{"annotation":[{"end":[19,13],"name":"tests/purus/passing/Misc/Lib.purs","start":[19,11]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[18,20],"name":"tests/purus/passing/Misc/Lib.purs","start":[18,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[19,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[19,14]},[]],"contents":[{"annotation":[{"end":[19,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[19,14]},[]],"contents":[{"annotation":[{"end":[19,18],"name":"tests/purus/passing/Misc/Lib.purs","start":[19,16]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[18,20],"name":"tests/purus/passing/Misc/Lib.purs","start":[18,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[19,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[19,19]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"tag":"REmpty"},{"annotation":[{"end":[19,13],"name":"tests/purus/passing/Misc/Lib.purs","start":[19,11]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"KindApp"}],"tag":"RCons"}],"tag":"TypeApp"},"value":{"identifier":"v","sourcePos":[19,3]}},"fieldName":"eq","kind":"Accessor","type":{"annotation":[{"end":[19,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[19,9]},[]],"contents":[{"annotation":[{"end":[19,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[19,9]},[]],"contents":[{"annotation":[{"end":[19,13],"name":"tests/purus/passing/Misc/Lib.purs","start":[19,11]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[19,10],"name":"tests/purus/passing/Misc/Lib.purs","start":[19,9]},[]],"contents":{"kind":{"annotation":[{"end":[18,20],"name":"tests/purus/passing/Misc/Lib.purs","start":[18,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[19,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[19,14]},[]],"contents":[{"annotation":[{"end":[19,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[19,14]},[]],"contents":[{"annotation":[{"end":[19,18],"name":"tests/purus/passing/Misc/Lib.purs","start":[19,16]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[19,15],"name":"tests/purus/passing/Misc/Lib.purs","start":[19,14]},[]],"contents":{"kind":{"annotation":[{"end":[18,20],"name":"tests/purus/passing/Misc/Lib.purs","start":[18,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[19,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[19,19]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[19,26],"start":[19,3]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Lib"],"Eq$Dict"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[18,20],"name":"tests/purus/passing/Misc/Lib.purs","start":[18,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},"value":{"identifier":"dict","sourcePos":[0,0]}}],"kind":"Case","type":{"annotation":[{"end":[19,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[19,9]},[]],"contents":[{"annotation":[{"end":[19,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[19,9]},[]],"contents":[{"annotation":[{"end":[19,13],"name":"tests/purus/passing/Misc/Lib.purs","start":[19,11]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[19,10],"name":"tests/purus/passing/Misc/Lib.purs","start":[19,9]},[]],"contents":{"kind":{"annotation":[{"end":[18,20],"name":"tests/purus/passing/Misc/Lib.purs","start":[18,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[19,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[19,14]},[]],"contents":[{"annotation":[{"end":[19,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[19,14]},[]],"contents":[{"annotation":[{"end":[19,18],"name":"tests/purus/passing/Misc/Lib.purs","start":[19,16]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[19,15],"name":"tests/purus/passing/Misc/Lib.purs","start":[19,14]},[]],"contents":{"kind":{"annotation":[{"end":[18,20],"name":"tests/purus/passing/Misc/Lib.purs","start":[18,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[19,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[19,19]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[18,20],"name":"tests/purus/passing/Misc/Lib.purs","start":[18,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":50,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Lib"],"Eq$Dict"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[18,20],"name":"tests/purus/passing/Misc/Lib.purs","start":[18,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[19,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[19,9]},[]],"contents":[{"annotation":[{"end":[19,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[19,9]},[]],"contents":[{"annotation":[{"end":[19,13],"name":"tests/purus/passing/Misc/Lib.purs","start":[19,11]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[19,10],"name":"tests/purus/passing/Misc/Lib.purs","start":[19,9]},[]],"contents":{"kind":{"annotation":[{"end":[18,20],"name":"tests/purus/passing/Misc/Lib.purs","start":[18,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[19,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[19,14]},[]],"contents":[{"annotation":[{"end":[19,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[19,14]},[]],"contents":[{"annotation":[{"end":[19,18],"name":"tests/purus/passing/Misc/Lib.purs","start":[19,16]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[19,15],"name":"tests/purus/passing/Misc/Lib.purs","start":[19,14]},[]],"contents":{"kind":{"annotation":[{"end":[18,20],"name":"tests/purus/passing/Misc/Lib.purs","start":[18,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[19,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[19,19]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarVisible"},"tag":"ForAll"}},"identifier":"eq"},{"annotation":{"meta":null,"sourceSpan":{"end":[27,18],"start":[27,1]}},"bindType":"NonRec","expression":{"abstraction":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[28,12],"start":[28,10]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[18,20],"name":"tests/purus/passing/Misc/Lib.purs","start":[18,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":50,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Lib"],"Eq$Dict"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[18,20],"name":"tests/purus/passing/Misc/Lib.purs","start":[18,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[19,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[19,9]},[]],"contents":[{"annotation":[{"end":[19,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[19,9]},[]],"contents":[{"annotation":[{"end":[19,13],"name":"tests/purus/passing/Misc/Lib.purs","start":[19,11]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[19,10],"name":"tests/purus/passing/Misc/Lib.purs","start":[19,9]},[]],"contents":{"kind":{"annotation":[{"end":[18,20],"name":"tests/purus/passing/Misc/Lib.purs","start":[18,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[19,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[19,14]},[]],"contents":[{"annotation":[{"end":[19,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[19,14]},[]],"contents":[{"annotation":[{"end":[19,18],"name":"tests/purus/passing/Misc/Lib.purs","start":[19,16]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[19,15],"name":"tests/purus/passing/Misc/Lib.purs","start":[19,14]},[]],"contents":{"kind":{"annotation":[{"end":[18,20],"name":"tests/purus/passing/Misc/Lib.purs","start":[18,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[19,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[19,19]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarVisible"},"tag":"ForAll"},"value":{"identifier":"eq","moduleName":["Lib"]}},"annotation":{"meta":null,"sourceSpan":{"end":[28,14],"start":[28,10]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Lib"],"Eq$Dict"],"tag":"TypeConstructor"},{"annotation":[{"end":[24,16],"name":"tests/purus/passing/Misc/Lib.purs","start":[24,13]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"eqInt","moduleName":["Lib"]}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[28,14],"start":[28,10]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[28,14],"start":[28,13]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"literalType":"IntLiteral","value":1}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[28,16],"start":[28,10]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[28,16],"start":[28,15]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"literalType":"IntLiteral","value":2}},"kind":"App"},"identifier":"testEq"},{"annotation":{"meta":null,"sourceSpan":{"end":[307,63],"start":[307,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"argument":"dictOrd","body":{"annotation":{"meta":null,"sourceSpan":{"end":[308,26],"start":[308,1]}},"argument":"a","body":{"annotation":{"meta":null,"sourceSpan":{"end":[308,26],"start":[308,1]}},"argument":"b","body":{"abstraction":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[308,22],"start":[308,20]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[18,20],"name":"tests/purus/passing/Misc/Lib.purs","start":[18,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":50,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Lib"],"Eq$Dict"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[18,20],"name":"tests/purus/passing/Misc/Lib.purs","start":[18,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[19,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[19,9]},[]],"contents":[{"annotation":[{"end":[19,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[19,9]},[]],"contents":[{"annotation":[{"end":[19,13],"name":"tests/purus/passing/Misc/Lib.purs","start":[19,11]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[19,10],"name":"tests/purus/passing/Misc/Lib.purs","start":[19,9]},[]],"contents":{"kind":{"annotation":[{"end":[18,20],"name":"tests/purus/passing/Misc/Lib.purs","start":[18,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[19,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[19,14]},[]],"contents":[{"annotation":[{"end":[19,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[19,14]},[]],"contents":[{"annotation":[{"end":[19,18],"name":"tests/purus/passing/Misc/Lib.purs","start":[19,16]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[19,15],"name":"tests/purus/passing/Misc/Lib.purs","start":[19,14]},[]],"contents":{"kind":{"annotation":[{"end":[18,20],"name":"tests/purus/passing/Misc/Lib.purs","start":[18,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[19,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[19,19]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarVisible"},"tag":"ForAll"},"value":{"identifier":"eq","moduleName":["Lib"]}},"annotation":{"meta":null,"sourceSpan":{"end":[308,24],"start":[308,20]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[308,24],"start":[308,20]}},"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Lib"],"Ord$Dict"],"tag":"TypeConstructor"},{"annotation":[{"end":[307,42],"name":"tests/purus/passing/Misc/Lib.purs","start":[307,41]},[]],"contents":{"kind":{"annotation":[{"end":[307,34],"name":"tests/purus/passing/Misc/Lib.purs","start":[307,30]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},"value":{"identifier":"dictOrd","sourcePos":[0,0]}},"fieldName":"Eq0","kind":"Accessor","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"tag":"REmpty"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"KindApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Lib"],"Eq$Dict"],"tag":"TypeConstructor"},{"annotation":[{"end":[301,11],"name":"tests/purus/passing/Misc/Lib.purs","start":[301,10]},[]],"contents":{"kind":{"annotation":[{"end":[301,29],"name":"tests/purus/passing/Misc/Lib.purs","start":[301,25]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"annotation":{"meta":null,"sourceSpan":{"end":[308,24],"start":[308,20]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[308,24],"start":[308,20]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"tag":"REmpty"}],"tag":"TypeApp"},"value":{"literalType":"ObjectLiteral","value":[]}},"kind":"App"},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[308,24],"start":[308,20]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[308,24],"start":[308,23]}},"kind":"Var","type":{"annotation":[{"end":[307,47],"name":"tests/purus/passing/Misc/Lib.purs","start":[307,46]},[]],"contents":{"kind":{"annotation":[{"end":[307,34],"name":"tests/purus/passing/Misc/Lib.purs","start":[307,30]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"},"value":{"identifier":"a","sourcePos":[308,1]}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[308,26],"start":[308,20]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[308,26],"start":[308,25]}},"kind":"Var","type":{"annotation":[{"end":[307,52],"name":"tests/purus/passing/Misc/Lib.purs","start":[307,51]},[]],"contents":{"kind":{"annotation":[{"end":[307,34],"name":"tests/purus/passing/Misc/Lib.purs","start":[307,30]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"},"value":{"identifier":"b","sourcePos":[308,1]}},"kind":"App"},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[307,52],"name":"tests/purus/passing/Misc/Lib.purs","start":[307,51]},[]],"contents":{"kind":{"annotation":[{"end":[307,34],"name":"tests/purus/passing/Misc/Lib.purs","start":[307,30]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[307,63],"name":"tests/purus/passing/Misc/Lib.purs","start":[307,56]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[307,47],"name":"tests/purus/passing/Misc/Lib.purs","start":[307,46]},[]],"contents":{"kind":{"annotation":[{"end":[307,34],"name":"tests/purus/passing/Misc/Lib.purs","start":[307,30]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[307,63],"name":"tests/purus/passing/Misc/Lib.purs","start":[307,51]},[]],"contents":[{"annotation":[{"end":[307,63],"name":"tests/purus/passing/Misc/Lib.purs","start":[307,51]},[]],"contents":[{"annotation":[{"end":[307,55],"name":"tests/purus/passing/Misc/Lib.purs","start":[307,53]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[307,52],"name":"tests/purus/passing/Misc/Lib.purs","start":[307,51]},[]],"contents":{"kind":{"annotation":[{"end":[307,34],"name":"tests/purus/passing/Misc/Lib.purs","start":[307,30]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[307,63],"name":"tests/purus/passing/Misc/Lib.purs","start":[307,56]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"kind":"Abs","type":{"annotation":[{"end":[307,63],"name":"tests/purus/passing/Misc/Lib.purs","start":[307,17]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[307,34],"name":"tests/purus/passing/Misc/Lib.purs","start":[307,30]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":51,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Lib"],"Ord$Dict"],"tag":"TypeConstructor"},{"annotation":[{"end":[307,42],"name":"tests/purus/passing/Misc/Lib.purs","start":[307,41]},[]],"contents":{"kind":{"annotation":[{"end":[307,34],"name":"tests/purus/passing/Misc/Lib.purs","start":[307,30]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[307,63],"name":"tests/purus/passing/Misc/Lib.purs","start":[307,46]},[]],"contents":[{"annotation":[{"end":[307,63],"name":"tests/purus/passing/Misc/Lib.purs","start":[307,46]},[]],"contents":[{"annotation":[{"end":[307,50],"name":"tests/purus/passing/Misc/Lib.purs","start":[307,48]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[307,47],"name":"tests/purus/passing/Misc/Lib.purs","start":[307,46]},[]],"contents":{"kind":{"annotation":[{"end":[307,34],"name":"tests/purus/passing/Misc/Lib.purs","start":[307,30]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[307,63],"name":"tests/purus/passing/Misc/Lib.purs","start":[307,51]},[]],"contents":[{"annotation":[{"end":[307,63],"name":"tests/purus/passing/Misc/Lib.purs","start":[307,51]},[]],"contents":[{"annotation":[{"end":[307,55],"name":"tests/purus/passing/Misc/Lib.purs","start":[307,53]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[307,52],"name":"tests/purus/passing/Misc/Lib.purs","start":[307,51]},[]],"contents":{"kind":{"annotation":[{"end":[307,34],"name":"tests/purus/passing/Misc/Lib.purs","start":[307,30]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[307,63],"name":"tests/purus/passing/Misc/Lib.purs","start":[307,56]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"identifier":"testEqViaOrd"},{"annotation":{"meta":null,"sourceSpan":{"end":[34,26],"start":[34,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[37,12],"start":[35,1]}},"argument":"n","body":{"annotation":{"meta":null,"sourceSpan":{"end":[37,12],"start":[36,5]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"binderType":"ConstructorBinder","binders":[],"constructorName":{"identifier":"True","moduleName":["Prim"]},"typeName":{"identifier":"Boolean","moduleName":["Prim"]}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[36,23],"start":[36,22]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"literalType":"IntLiteral","value":1}},"isGuarded":false},{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[37,12],"start":[36,5]}},"binderType":"NullBinder"}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[37,12],"start":[37,10]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"literalType":"IntLiteral","value":42}},"isGuarded":false}],"caseExpressions":[{"abstraction":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[36,13],"start":[36,11]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[18,20],"name":"tests/purus/passing/Misc/Lib.purs","start":[18,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":50,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Lib"],"Eq$Dict"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[18,20],"name":"tests/purus/passing/Misc/Lib.purs","start":[18,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[19,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[19,9]},[]],"contents":[{"annotation":[{"end":[19,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[19,9]},[]],"contents":[{"annotation":[{"end":[19,13],"name":"tests/purus/passing/Misc/Lib.purs","start":[19,11]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[19,10],"name":"tests/purus/passing/Misc/Lib.purs","start":[19,9]},[]],"contents":{"kind":{"annotation":[{"end":[18,20],"name":"tests/purus/passing/Misc/Lib.purs","start":[18,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[19,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[19,14]},[]],"contents":[{"annotation":[{"end":[19,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[19,14]},[]],"contents":[{"annotation":[{"end":[19,18],"name":"tests/purus/passing/Misc/Lib.purs","start":[19,16]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[19,15],"name":"tests/purus/passing/Misc/Lib.purs","start":[19,14]},[]],"contents":{"kind":{"annotation":[{"end":[18,20],"name":"tests/purus/passing/Misc/Lib.purs","start":[18,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[19,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[19,19]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarVisible"},"tag":"ForAll"},"value":{"identifier":"eq","moduleName":["Lib"]}},"annotation":{"meta":null,"sourceSpan":{"end":[36,16],"start":[36,8]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Lib"],"Eq$Dict"],"tag":"TypeConstructor"},{"annotation":[{"end":[24,16],"name":"tests/purus/passing/Misc/Lib.purs","start":[24,13]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"eqInt","moduleName":["Lib"]}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[36,16],"start":[36,8]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[36,9],"start":[36,8]}},"kind":"Var","type":{"annotation":[{"end":[34,19],"name":"tests/purus/passing/Misc/Lib.purs","start":[34,16]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"identifier":"n","sourcePos":[35,1]}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[36,16],"start":[36,8]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[36,16],"start":[36,15]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"literalType":"IntLiteral","value":0}},"kind":"App"}],"kind":"Case","type":{"annotation":[{"end":[34,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[34,23]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[34,19],"name":"tests/purus/passing/Misc/Lib.purs","start":[34,16]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[34,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[34,23]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"identifier":"workingEven"},{"annotation":{"meta":null,"sourceSpan":{"end":[267,15],"start":[267,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"t135"},"tag":"TypeVar"}],"tag":"TypeApp"},"value":{"identifier":"Nil","moduleName":["Prim"]}},"identifier":"emptyList"},{"annotation":{"meta":null,"sourceSpan":{"end":[264,50],"start":[264,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[265,16],"start":[265,1]}},"argument":"x","body":{"annotation":{"meta":null,"sourceSpan":{"end":[265,16],"start":[265,1]}},"argument":"xs","body":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"x","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"x"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"x"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"x"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"Cons","moduleName":["Prim"]}},"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[265,15],"start":[265,14]}},"kind":"Var","type":{"annotation":[{"end":[264,30],"name":"tests/purus/passing/Misc/Lib.purs","start":[264,29]},[]],"contents":{"kind":{"annotation":[{"end":[264,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[264,22]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"},"value":{"identifier":"x","sourcePos":[265,1]}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[264,50],"name":"tests/purus/passing/Misc/Lib.purs","start":[264,49]},[]],"contents":{"kind":{"annotation":[{"end":[264,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[264,22]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},"value":{"identifier":"Nil","moduleName":["Prim"]}},"kind":"App"},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[264,40],"name":"tests/purus/passing/Misc/Lib.purs","start":[264,34]},[]],"contents":[{"annotation":[{"end":[264,38],"name":"tests/purus/passing/Misc/Lib.purs","start":[264,34]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[264,40],"name":"tests/purus/passing/Misc/Lib.purs","start":[264,39]},[]],"contents":{"kind":{"annotation":[{"end":[264,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[264,22]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[264,50],"name":"tests/purus/passing/Misc/Lib.purs","start":[264,44]},[]],"contents":[{"annotation":[{"end":[264,48],"name":"tests/purus/passing/Misc/Lib.purs","start":[264,44]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[264,50],"name":"tests/purus/passing/Misc/Lib.purs","start":[264,49]},[]],"contents":{"kind":{"annotation":[{"end":[264,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[264,22]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"kind":"Abs","type":{"annotation":[{"end":[264,50],"name":"tests/purus/passing/Misc/Lib.purs","start":[264,9]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[264,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[264,22]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":53,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[264,30],"name":"tests/purus/passing/Misc/Lib.purs","start":[264,29]},[]],"contents":{"kind":{"annotation":[{"end":[264,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[264,22]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[264,50],"name":"tests/purus/passing/Misc/Lib.purs","start":[264,34]},[]],"contents":[{"annotation":[{"end":[264,50],"name":"tests/purus/passing/Misc/Lib.purs","start":[264,34]},[]],"contents":[{"annotation":[{"end":[264,43],"name":"tests/purus/passing/Misc/Lib.purs","start":[264,41]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[264,40],"name":"tests/purus/passing/Misc/Lib.purs","start":[264,34]},[]],"contents":[{"annotation":[{"end":[264,38],"name":"tests/purus/passing/Misc/Lib.purs","start":[264,34]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[264,40],"name":"tests/purus/passing/Misc/Lib.purs","start":[264,39]},[]],"contents":{"kind":{"annotation":[{"end":[264,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[264,22]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[264,50],"name":"tests/purus/passing/Misc/Lib.purs","start":[264,44]},[]],"contents":[{"annotation":[{"end":[264,48],"name":"tests/purus/passing/Misc/Lib.purs","start":[264,44]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[264,50],"name":"tests/purus/passing/Misc/Lib.purs","start":[264,49]},[]],"contents":{"kind":{"annotation":[{"end":[264,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[264,22]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"identifier":"cons"},{"annotation":{"meta":null,"sourceSpan":{"end":[269,34],"start":[269,1]}},"bindType":"NonRec","expression":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[269,22],"start":[269,18]}},"kind":"Var","type":{"annotation":[{"end":[264,50],"name":"tests/purus/passing/Misc/Lib.purs","start":[264,9]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[264,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[264,22]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":53,"type":{"annotation":[{"end":[264,50],"name":"tests/purus/passing/Misc/Lib.purs","start":[264,29]},[]],"contents":[{"annotation":[{"end":[264,50],"name":"tests/purus/passing/Misc/Lib.purs","start":[264,29]},[]],"contents":[{"annotation":[{"end":[264,33],"name":"tests/purus/passing/Misc/Lib.purs","start":[264,31]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[264,30],"name":"tests/purus/passing/Misc/Lib.purs","start":[264,29]},[]],"contents":{"kind":{"annotation":[{"end":[264,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[264,22]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[264,50],"name":"tests/purus/passing/Misc/Lib.purs","start":[264,34]},[]],"contents":[{"annotation":[{"end":[264,50],"name":"tests/purus/passing/Misc/Lib.purs","start":[264,34]},[]],"contents":[{"annotation":[{"end":[264,43],"name":"tests/purus/passing/Misc/Lib.purs","start":[264,41]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[264,40],"name":"tests/purus/passing/Misc/Lib.purs","start":[264,34]},[]],"contents":[{"annotation":[{"end":[264,38],"name":"tests/purus/passing/Misc/Lib.purs","start":[264,34]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[264,40],"name":"tests/purus/passing/Misc/Lib.purs","start":[264,39]},[]],"contents":{"kind":{"annotation":[{"end":[264,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[264,22]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[264,50],"name":"tests/purus/passing/Misc/Lib.purs","start":[264,44]},[]],"contents":[{"annotation":[{"end":[264,48],"name":"tests/purus/passing/Misc/Lib.purs","start":[264,44]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[264,50],"name":"tests/purus/passing/Misc/Lib.purs","start":[264,49]},[]],"contents":{"kind":{"annotation":[{"end":[264,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[264,22]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"cons","moduleName":["Lib"]}},"annotation":{"meta":null,"sourceSpan":{"end":[269,24],"start":[269,18]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[269,24],"start":[269,23]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"literalType":"IntLiteral","value":1}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[269,34],"start":[269,18]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[269,34],"start":[269,25]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"t135","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"t135"},"tag":"TypeVar"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"emptyList","moduleName":["Lib"]}},"kind":"App"},"identifier":"consEmptyList1"},{"annotation":{"meta":null,"sourceSpan":{"end":[271,40],"start":[271,1]}},"bindType":"NonRec","expression":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[271,22],"start":[271,18]}},"kind":"Var","type":{"annotation":[{"end":[264,50],"name":"tests/purus/passing/Misc/Lib.purs","start":[264,9]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[264,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[264,22]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":53,"type":{"annotation":[{"end":[264,50],"name":"tests/purus/passing/Misc/Lib.purs","start":[264,29]},[]],"contents":[{"annotation":[{"end":[264,50],"name":"tests/purus/passing/Misc/Lib.purs","start":[264,29]},[]],"contents":[{"annotation":[{"end":[264,33],"name":"tests/purus/passing/Misc/Lib.purs","start":[264,31]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[264,30],"name":"tests/purus/passing/Misc/Lib.purs","start":[264,29]},[]],"contents":{"kind":{"annotation":[{"end":[264,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[264,22]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[264,50],"name":"tests/purus/passing/Misc/Lib.purs","start":[264,34]},[]],"contents":[{"annotation":[{"end":[264,50],"name":"tests/purus/passing/Misc/Lib.purs","start":[264,34]},[]],"contents":[{"annotation":[{"end":[264,43],"name":"tests/purus/passing/Misc/Lib.purs","start":[264,41]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[264,40],"name":"tests/purus/passing/Misc/Lib.purs","start":[264,34]},[]],"contents":[{"annotation":[{"end":[264,38],"name":"tests/purus/passing/Misc/Lib.purs","start":[264,34]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[264,40],"name":"tests/purus/passing/Misc/Lib.purs","start":[264,39]},[]],"contents":{"kind":{"annotation":[{"end":[264,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[264,22]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[264,50],"name":"tests/purus/passing/Misc/Lib.purs","start":[264,44]},[]],"contents":[{"annotation":[{"end":[264,48],"name":"tests/purus/passing/Misc/Lib.purs","start":[264,44]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[264,50],"name":"tests/purus/passing/Misc/Lib.purs","start":[264,49]},[]],"contents":{"kind":{"annotation":[{"end":[264,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[264,22]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"cons","moduleName":["Lib"]}},"annotation":{"meta":null,"sourceSpan":{"end":[271,30],"start":[271,18]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[271,30],"start":[271,23]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"String"],"tag":"TypeConstructor"},"value":{"literalType":"StringLiteral","value":"hello"}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[271,40],"start":[271,18]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[271,40],"start":[271,31]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"t135","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"t135"},"tag":"TypeVar"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"emptyList","moduleName":["Lib"]}},"kind":"App"},"identifier":"consEmptyList2"},{"annotation":{"meta":null,"sourceSpan":{"end":[302,27],"start":[302,3]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[302,27],"start":[302,3]}},"argument":"dict","body":{"annotation":{"meta":null,"sourceSpan":{"end":[302,27],"start":[302,3]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":{"metaType":"IsNewtype"},"sourceSpan":{"end":[302,27],"start":[302,3]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[302,27],"start":[302,3]}},"binderType":"VarBinder","identifier":"v","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["compare",{"annotation":[{"end":[302,27],"name":"tests/purus/passing/Misc/Lib.purs","start":[302,14]},[]],"contents":[{"annotation":[{"end":[302,27],"name":"tests/purus/passing/Misc/Lib.purs","start":[302,14]},[]],"contents":[{"annotation":[{"end":[302,18],"name":"tests/purus/passing/Misc/Lib.purs","start":[302,16]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[301,29],"name":"tests/purus/passing/Misc/Lib.purs","start":[301,25]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[302,27],"name":"tests/purus/passing/Misc/Lib.purs","start":[302,19]},[]],"contents":[{"annotation":[{"end":[302,27],"name":"tests/purus/passing/Misc/Lib.purs","start":[302,19]},[]],"contents":[{"annotation":[{"end":[302,23],"name":"tests/purus/passing/Misc/Lib.purs","start":[302,21]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[301,29],"name":"tests/purus/passing/Misc/Lib.purs","start":[301,25]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[302,27],"name":"tests/purus/passing/Misc/Lib.purs","start":[302,24]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["Eq0",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"tag":"REmpty"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"KindApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Lib"],"Eq$Dict"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[301,29],"name":"tests/purus/passing/Misc/Lib.purs","start":[301,25]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"tag":"REmpty"},{"annotation":[{"end":[302,18],"name":"tests/purus/passing/Misc/Lib.purs","start":[302,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"KindApp"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"TypeApp"}}],"constructorName":{"identifier":"Ord$Dict","moduleName":["Lib"]},"typeName":{"identifier":"Ord$Dict","moduleName":["Lib"]}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[302,27],"start":[302,3]}},"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[302,27],"start":[302,3]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["compare",{"annotation":[{"end":[302,27],"name":"tests/purus/passing/Misc/Lib.purs","start":[302,14]},[]],"contents":[{"annotation":[{"end":[302,27],"name":"tests/purus/passing/Misc/Lib.purs","start":[302,14]},[]],"contents":[{"annotation":[{"end":[302,18],"name":"tests/purus/passing/Misc/Lib.purs","start":[302,16]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[301,29],"name":"tests/purus/passing/Misc/Lib.purs","start":[301,25]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[302,27],"name":"tests/purus/passing/Misc/Lib.purs","start":[302,19]},[]],"contents":[{"annotation":[{"end":[302,27],"name":"tests/purus/passing/Misc/Lib.purs","start":[302,19]},[]],"contents":[{"annotation":[{"end":[302,23],"name":"tests/purus/passing/Misc/Lib.purs","start":[302,21]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[301,29],"name":"tests/purus/passing/Misc/Lib.purs","start":[301,25]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[302,27],"name":"tests/purus/passing/Misc/Lib.purs","start":[302,24]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["Eq0",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"tag":"REmpty"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"KindApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Lib"],"Eq$Dict"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[301,29],"name":"tests/purus/passing/Misc/Lib.purs","start":[301,25]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"tag":"REmpty"},{"annotation":[{"end":[302,18],"name":"tests/purus/passing/Misc/Lib.purs","start":[302,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"KindApp"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"TypeApp"},"value":{"identifier":"v","sourcePos":[302,3]}},"fieldName":"compare","kind":"Accessor","type":{"annotation":[{"end":[302,27],"name":"tests/purus/passing/Misc/Lib.purs","start":[302,14]},[]],"contents":[{"annotation":[{"end":[302,27],"name":"tests/purus/passing/Misc/Lib.purs","start":[302,14]},[]],"contents":[{"annotation":[{"end":[302,18],"name":"tests/purus/passing/Misc/Lib.purs","start":[302,16]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[302,15],"name":"tests/purus/passing/Misc/Lib.purs","start":[302,14]},[]],"contents":{"kind":{"annotation":[{"end":[301,29],"name":"tests/purus/passing/Misc/Lib.purs","start":[301,25]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[302,27],"name":"tests/purus/passing/Misc/Lib.purs","start":[302,19]},[]],"contents":[{"annotation":[{"end":[302,27],"name":"tests/purus/passing/Misc/Lib.purs","start":[302,19]},[]],"contents":[{"annotation":[{"end":[302,23],"name":"tests/purus/passing/Misc/Lib.purs","start":[302,21]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[302,20],"name":"tests/purus/passing/Misc/Lib.purs","start":[302,19]},[]],"contents":{"kind":{"annotation":[{"end":[301,29],"name":"tests/purus/passing/Misc/Lib.purs","start":[301,25]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[302,27],"name":"tests/purus/passing/Misc/Lib.purs","start":[302,24]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[302,27],"start":[302,3]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Lib"],"Ord$Dict"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[301,29],"name":"tests/purus/passing/Misc/Lib.purs","start":[301,25]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},"value":{"identifier":"dict","sourcePos":[0,0]}}],"kind":"Case","type":{"annotation":[{"end":[302,27],"name":"tests/purus/passing/Misc/Lib.purs","start":[302,14]},[]],"contents":[{"annotation":[{"end":[302,27],"name":"tests/purus/passing/Misc/Lib.purs","start":[302,14]},[]],"contents":[{"annotation":[{"end":[302,18],"name":"tests/purus/passing/Misc/Lib.purs","start":[302,16]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[302,15],"name":"tests/purus/passing/Misc/Lib.purs","start":[302,14]},[]],"contents":{"kind":{"annotation":[{"end":[301,29],"name":"tests/purus/passing/Misc/Lib.purs","start":[301,25]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[302,27],"name":"tests/purus/passing/Misc/Lib.purs","start":[302,19]},[]],"contents":[{"annotation":[{"end":[302,27],"name":"tests/purus/passing/Misc/Lib.purs","start":[302,19]},[]],"contents":[{"annotation":[{"end":[302,23],"name":"tests/purus/passing/Misc/Lib.purs","start":[302,21]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[302,20],"name":"tests/purus/passing/Misc/Lib.purs","start":[302,19]},[]],"contents":{"kind":{"annotation":[{"end":[301,29],"name":"tests/purus/passing/Misc/Lib.purs","start":[301,25]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[302,27],"name":"tests/purus/passing/Misc/Lib.purs","start":[302,24]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[301,29],"name":"tests/purus/passing/Misc/Lib.purs","start":[301,25]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":57,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Lib"],"Ord$Dict"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[301,29],"name":"tests/purus/passing/Misc/Lib.purs","start":[301,25]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[302,27],"name":"tests/purus/passing/Misc/Lib.purs","start":[302,14]},[]],"contents":[{"annotation":[{"end":[302,27],"name":"tests/purus/passing/Misc/Lib.purs","start":[302,14]},[]],"contents":[{"annotation":[{"end":[302,18],"name":"tests/purus/passing/Misc/Lib.purs","start":[302,16]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[302,15],"name":"tests/purus/passing/Misc/Lib.purs","start":[302,14]},[]],"contents":{"kind":{"annotation":[{"end":[301,29],"name":"tests/purus/passing/Misc/Lib.purs","start":[301,25]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[302,27],"name":"tests/purus/passing/Misc/Lib.purs","start":[302,19]},[]],"contents":[{"annotation":[{"end":[302,27],"name":"tests/purus/passing/Misc/Lib.purs","start":[302,19]},[]],"contents":[{"annotation":[{"end":[302,23],"name":"tests/purus/passing/Misc/Lib.purs","start":[302,21]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[302,20],"name":"tests/purus/passing/Misc/Lib.purs","start":[302,19]},[]],"contents":{"kind":{"annotation":[{"end":[301,29],"name":"tests/purus/passing/Misc/Lib.purs","start":[301,25]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[302,27],"name":"tests/purus/passing/Misc/Lib.purs","start":[302,24]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarVisible"},"tag":"ForAll"}},"identifier":"compare"},{"bindType":"Rec","binds":[{"annotation":{"meta":null,"sourceSpan":{"end":[39,25],"start":[39,1]}},"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[42,34],"start":[40,1]}},"argument":"n","body":{"annotation":{"meta":null,"sourceSpan":{"end":[42,34],"start":[41,5]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"binderType":"ConstructorBinder","binders":[],"constructorName":{"identifier":"True","moduleName":["Prim"]},"typeName":{"identifier":"Boolean","moduleName":["Prim"]}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[41,23],"start":[41,22]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"literalType":"IntLiteral","value":1}},"isGuarded":false},{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[42,34],"start":[41,5]}},"binderType":"NullBinder"}],"expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[42,20],"start":[42,10]}},"kind":"Var","type":{"annotation":[{"end":[39,25],"name":"tests/purus/passing/Misc/Lib.purs","start":[39,15]},[]],"contents":[{"annotation":[{"end":[39,25],"name":"tests/purus/passing/Misc/Lib.purs","start":[39,15]},[]],"contents":[{"annotation":[{"end":[39,21],"name":"tests/purus/passing/Misc/Lib.purs","start":[39,19]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[39,18],"name":"tests/purus/passing/Misc/Lib.purs","start":[39,15]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[39,25],"name":"tests/purus/passing/Misc/Lib.purs","start":[39,22]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"brokenEven","moduleName":["Lib"]}},"annotation":{"meta":null,"sourceSpan":{"end":[42,34],"start":[42,10]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[42,30],"start":[42,25]}},"kind":"Var","type":{"annotation":[{"end":[21,27],"name":"tests/purus/passing/Misc/Lib.purs","start":[21,10]},[]],"contents":[{"annotation":[{"end":[21,27],"name":"tests/purus/passing/Misc/Lib.purs","start":[21,10]},[]],"contents":[{"annotation":[{"end":[21,16],"name":"tests/purus/passing/Misc/Lib.purs","start":[21,14]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[21,13],"name":"tests/purus/passing/Misc/Lib.purs","start":[21,10]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[21,27],"name":"tests/purus/passing/Misc/Lib.purs","start":[21,17]},[]],"contents":[{"annotation":[{"end":[21,27],"name":"tests/purus/passing/Misc/Lib.purs","start":[21,17]},[]],"contents":[{"annotation":[{"end":[21,23],"name":"tests/purus/passing/Misc/Lib.purs","start":[21,21]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[21,20],"name":"tests/purus/passing/Misc/Lib.purs","start":[21,17]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[21,27],"name":"tests/purus/passing/Misc/Lib.purs","start":[21,24]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"minus","moduleName":["Lib"]}},"annotation":{"meta":null,"sourceSpan":{"end":[42,33],"start":[42,22]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[42,23],"start":[42,22]}},"kind":"Var","type":{"annotation":[{"end":[39,18],"name":"tests/purus/passing/Misc/Lib.purs","start":[39,15]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"identifier":"n","sourcePos":[40,1]}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[42,33],"start":[42,22]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[42,33],"start":[42,32]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"literalType":"IntLiteral","value":2}},"kind":"App"},"kind":"App"},"isGuarded":false}],"caseExpressions":[{"abstraction":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[41,13],"start":[41,11]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[18,20],"name":"tests/purus/passing/Misc/Lib.purs","start":[18,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":50,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Lib"],"Eq$Dict"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[18,20],"name":"tests/purus/passing/Misc/Lib.purs","start":[18,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[19,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[19,9]},[]],"contents":[{"annotation":[{"end":[19,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[19,9]},[]],"contents":[{"annotation":[{"end":[19,13],"name":"tests/purus/passing/Misc/Lib.purs","start":[19,11]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[19,10],"name":"tests/purus/passing/Misc/Lib.purs","start":[19,9]},[]],"contents":{"kind":{"annotation":[{"end":[18,20],"name":"tests/purus/passing/Misc/Lib.purs","start":[18,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[19,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[19,14]},[]],"contents":[{"annotation":[{"end":[19,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[19,14]},[]],"contents":[{"annotation":[{"end":[19,18],"name":"tests/purus/passing/Misc/Lib.purs","start":[19,16]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[19,15],"name":"tests/purus/passing/Misc/Lib.purs","start":[19,14]},[]],"contents":{"kind":{"annotation":[{"end":[18,20],"name":"tests/purus/passing/Misc/Lib.purs","start":[18,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[19,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[19,19]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarVisible"},"tag":"ForAll"},"value":{"identifier":"eq","moduleName":["Lib"]}},"annotation":{"meta":null,"sourceSpan":{"end":[41,16],"start":[41,8]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Lib"],"Eq$Dict"],"tag":"TypeConstructor"},{"annotation":[{"end":[24,16],"name":"tests/purus/passing/Misc/Lib.purs","start":[24,13]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"eqInt","moduleName":["Lib"]}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[41,16],"start":[41,8]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[41,9],"start":[41,8]}},"kind":"Var","type":{"annotation":[{"end":[39,18],"name":"tests/purus/passing/Misc/Lib.purs","start":[39,15]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"identifier":"n","sourcePos":[40,1]}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[41,16],"start":[41,8]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[41,16],"start":[41,15]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"literalType":"IntLiteral","value":0}},"kind":"App"}],"kind":"Case","type":{"annotation":[{"end":[39,25],"name":"tests/purus/passing/Misc/Lib.purs","start":[39,22]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[39,18],"name":"tests/purus/passing/Misc/Lib.purs","start":[39,15]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[39,25],"name":"tests/purus/passing/Misc/Lib.purs","start":[39,22]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"identifier":"brokenEven"}]},{"annotation":{"meta":null,"sourceSpan":{"end":[281,48],"start":[281,1]}},"bindType":"NonRec","expression":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"x","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"x"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"x"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"x"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"Cons","moduleName":["Prim"]}},"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[282,16],"start":[282,14]}},"kind":"Var","type":{"annotation":[{"end":[273,33],"name":"tests/purus/passing/Misc/Lib.purs","start":[273,7]},[]],"contents":{"identifier":"t","kind":{"annotation":[{"end":[273,24],"name":"tests/purus/passing/Misc/Lib.purs","start":[273,20]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":42,"type":{"annotation":[{"end":[273,33],"name":"tests/purus/passing/Misc/Lib.purs","start":[273,27]},[]],"contents":[{"annotation":[{"end":[273,33],"name":"tests/purus/passing/Misc/Lib.purs","start":[273,27]},[]],"contents":[{"annotation":[{"end":[273,31],"name":"tests/purus/passing/Misc/Lib.purs","start":[273,29]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[273,28],"name":"tests/purus/passing/Misc/Lib.purs","start":[273,27]},[]],"contents":{"kind":{"annotation":[{"end":[273,24],"name":"tests/purus/passing/Misc/Lib.purs","start":[273,20]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"t"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[273,33],"name":"tests/purus/passing/Misc/Lib.purs","start":[273,32]},[]],"contents":{"kind":{"annotation":[{"end":[273,24],"name":"tests/purus/passing/Misc/Lib.purs","start":[273,20]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"t"},"tag":"TypeVar"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"id","moduleName":["Lib"]}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[281,47],"name":"tests/purus/passing/Misc/Lib.purs","start":[281,21]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[281,38],"name":"tests/purus/passing/Misc/Lib.purs","start":[281,34]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":58,"type":{"annotation":[{"end":[281,47],"name":"tests/purus/passing/Misc/Lib.purs","start":[281,41]},[]],"contents":[{"annotation":[{"end":[281,47],"name":"tests/purus/passing/Misc/Lib.purs","start":[281,41]},[]],"contents":[{"annotation":[{"end":[281,45],"name":"tests/purus/passing/Misc/Lib.purs","start":[281,43]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[281,42],"name":"tests/purus/passing/Misc/Lib.purs","start":[281,41]},[]],"contents":{"kind":{"annotation":[{"end":[281,38],"name":"tests/purus/passing/Misc/Lib.purs","start":[281,34]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[281,47],"name":"tests/purus/passing/Misc/Lib.purs","start":[281,46]},[]],"contents":{"kind":{"annotation":[{"end":[281,38],"name":"tests/purus/passing/Misc/Lib.purs","start":[281,34]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}],"tag":"TypeApp"},"value":{"identifier":"Nil","moduleName":["Prim"]}},"kind":"App"},"identifier":"arrForall"},{"annotation":{"meta":null,"sourceSpan":{"end":[352,37],"start":[352,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[353,31],"start":[353,1]}},"argument":"p","body":{"annotation":{"meta":null,"sourceSpan":{"end":[353,31],"start":[353,1]}},"argument":"q","body":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[353,14],"start":[353,11]}},"kind":"Var","type":{"annotation":[{"end":[349,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[349,8]},[]],"contents":[{"annotation":[{"end":[349,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[349,8]},[]],"contents":[{"annotation":[{"end":[349,18],"name":"tests/purus/passing/Misc/Lib.purs","start":[349,16]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[349,15],"name":"tests/purus/passing/Misc/Lib.purs","start":[349,8]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[349,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[349,19]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"not","moduleName":["Lib"]}},"annotation":{"meta":null,"sourceSpan":{"end":[353,31],"start":[353,11]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[353,24],"start":[353,22]}},"kind":"Var","type":{"annotation":[{"end":[344,36],"name":"tests/purus/passing/Misc/Lib.purs","start":[344,7]},[]],"contents":[{"annotation":[{"end":[344,36],"name":"tests/purus/passing/Misc/Lib.purs","start":[344,7]},[]],"contents":[{"annotation":[{"end":[344,17],"name":"tests/purus/passing/Misc/Lib.purs","start":[344,15]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[344,14],"name":"tests/purus/passing/Misc/Lib.purs","start":[344,7]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[344,36],"name":"tests/purus/passing/Misc/Lib.purs","start":[344,18]},[]],"contents":[{"annotation":[{"end":[344,36],"name":"tests/purus/passing/Misc/Lib.purs","start":[344,18]},[]],"contents":[{"annotation":[{"end":[344,28],"name":"tests/purus/passing/Misc/Lib.purs","start":[344,26]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[344,25],"name":"tests/purus/passing/Misc/Lib.purs","start":[344,18]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[344,36],"name":"tests/purus/passing/Misc/Lib.purs","start":[344,29]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"or","moduleName":["Lib"]}},"annotation":{"meta":null,"sourceSpan":{"end":[353,30],"start":[353,16]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[353,19],"start":[353,16]}},"kind":"Var","type":{"annotation":[{"end":[349,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[349,8]},[]],"contents":[{"annotation":[{"end":[349,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[349,8]},[]],"contents":[{"annotation":[{"end":[349,18],"name":"tests/purus/passing/Misc/Lib.purs","start":[349,16]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[349,15],"name":"tests/purus/passing/Misc/Lib.purs","start":[349,8]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[349,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[349,19]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"not","moduleName":["Lib"]}},"annotation":{"meta":null,"sourceSpan":{"end":[353,21],"start":[353,16]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[353,21],"start":[353,20]}},"kind":"Var","type":{"annotation":[{"end":[352,15],"name":"tests/purus/passing/Misc/Lib.purs","start":[352,8]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"},"value":{"identifier":"p","sourcePos":[353,1]}},"kind":"App"},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[353,30],"start":[353,16]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[353,28],"start":[353,25]}},"kind":"Var","type":{"annotation":[{"end":[349,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[349,8]},[]],"contents":[{"annotation":[{"end":[349,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[349,8]},[]],"contents":[{"annotation":[{"end":[349,18],"name":"tests/purus/passing/Misc/Lib.purs","start":[349,16]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[349,15],"name":"tests/purus/passing/Misc/Lib.purs","start":[349,8]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[349,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[349,19]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"not","moduleName":["Lib"]}},"annotation":{"meta":null,"sourceSpan":{"end":[353,30],"start":[353,25]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[353,30],"start":[353,29]}},"kind":"Var","type":{"annotation":[{"end":[352,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[352,19]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"},"value":{"identifier":"q","sourcePos":[353,1]}},"kind":"App"},"kind":"App"},"kind":"App"},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[352,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[352,19]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[352,37],"name":"tests/purus/passing/Misc/Lib.purs","start":[352,30]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[352,15],"name":"tests/purus/passing/Misc/Lib.purs","start":[352,8]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[352,37],"name":"tests/purus/passing/Misc/Lib.purs","start":[352,19]},[]],"contents":[{"annotation":[{"end":[352,37],"name":"tests/purus/passing/Misc/Lib.purs","start":[352,19]},[]],"contents":[{"annotation":[{"end":[352,29],"name":"tests/purus/passing/Misc/Lib.purs","start":[352,27]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[352,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[352,19]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[352,37],"name":"tests/purus/passing/Misc/Lib.purs","start":[352,30]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"identifier":"and"},{"annotation":{"meta":null,"sourceSpan":{"end":[357,37],"start":[357,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[358,39],"start":[358,1]}},"argument":"p","body":{"annotation":{"meta":null,"sourceSpan":{"end":[358,39],"start":[358,1]}},"argument":"q","body":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[358,22],"start":[358,20]}},"kind":"Var","type":{"annotation":[{"end":[344,36],"name":"tests/purus/passing/Misc/Lib.purs","start":[344,7]},[]],"contents":[{"annotation":[{"end":[344,36],"name":"tests/purus/passing/Misc/Lib.purs","start":[344,7]},[]],"contents":[{"annotation":[{"end":[344,17],"name":"tests/purus/passing/Misc/Lib.purs","start":[344,15]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[344,14],"name":"tests/purus/passing/Misc/Lib.purs","start":[344,7]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[344,36],"name":"tests/purus/passing/Misc/Lib.purs","start":[344,18]},[]],"contents":[{"annotation":[{"end":[344,36],"name":"tests/purus/passing/Misc/Lib.purs","start":[344,18]},[]],"contents":[{"annotation":[{"end":[344,28],"name":"tests/purus/passing/Misc/Lib.purs","start":[344,26]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[344,25],"name":"tests/purus/passing/Misc/Lib.purs","start":[344,18]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[344,36],"name":"tests/purus/passing/Misc/Lib.purs","start":[344,29]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"or","moduleName":["Lib"]}},"annotation":{"meta":null,"sourceSpan":{"end":[358,39],"start":[358,11]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[358,16],"start":[358,14]}},"kind":"Var","type":{"annotation":[{"end":[352,37],"name":"tests/purus/passing/Misc/Lib.purs","start":[352,8]},[]],"contents":[{"annotation":[{"end":[352,37],"name":"tests/purus/passing/Misc/Lib.purs","start":[352,8]},[]],"contents":[{"annotation":[{"end":[352,18],"name":"tests/purus/passing/Misc/Lib.purs","start":[352,16]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[352,15],"name":"tests/purus/passing/Misc/Lib.purs","start":[352,8]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[352,37],"name":"tests/purus/passing/Misc/Lib.purs","start":[352,19]},[]],"contents":[{"annotation":[{"end":[352,37],"name":"tests/purus/passing/Misc/Lib.purs","start":[352,19]},[]],"contents":[{"annotation":[{"end":[352,29],"name":"tests/purus/passing/Misc/Lib.purs","start":[352,27]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[352,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[352,19]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[352,37],"name":"tests/purus/passing/Misc/Lib.purs","start":[352,30]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"and","moduleName":["Lib"]}},"annotation":{"meta":null,"sourceSpan":{"end":[358,18],"start":[358,12]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[358,13],"start":[358,12]}},"kind":"Var","type":{"annotation":[{"end":[357,15],"name":"tests/purus/passing/Misc/Lib.purs","start":[357,8]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"},"value":{"identifier":"p","sourcePos":[358,1]}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[358,18],"start":[358,12]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[358,18],"start":[358,17]}},"kind":"Var","type":{"annotation":[{"end":[357,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[357,19]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"},"value":{"identifier":"q","sourcePos":[358,1]}},"kind":"App"},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[358,39],"start":[358,11]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[358,32],"start":[358,30]}},"kind":"Var","type":{"annotation":[{"end":[352,37],"name":"tests/purus/passing/Misc/Lib.purs","start":[352,8]},[]],"contents":[{"annotation":[{"end":[352,37],"name":"tests/purus/passing/Misc/Lib.purs","start":[352,8]},[]],"contents":[{"annotation":[{"end":[352,18],"name":"tests/purus/passing/Misc/Lib.purs","start":[352,16]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[352,15],"name":"tests/purus/passing/Misc/Lib.purs","start":[352,8]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[352,37],"name":"tests/purus/passing/Misc/Lib.purs","start":[352,19]},[]],"contents":[{"annotation":[{"end":[352,37],"name":"tests/purus/passing/Misc/Lib.purs","start":[352,19]},[]],"contents":[{"annotation":[{"end":[352,29],"name":"tests/purus/passing/Misc/Lib.purs","start":[352,27]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[352,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[352,19]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[352,37],"name":"tests/purus/passing/Misc/Lib.purs","start":[352,30]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"and","moduleName":["Lib"]}},"annotation":{"meta":null,"sourceSpan":{"end":[358,38],"start":[358,24]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[358,27],"start":[358,24]}},"kind":"Var","type":{"annotation":[{"end":[349,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[349,8]},[]],"contents":[{"annotation":[{"end":[349,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[349,8]},[]],"contents":[{"annotation":[{"end":[349,18],"name":"tests/purus/passing/Misc/Lib.purs","start":[349,16]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[349,15],"name":"tests/purus/passing/Misc/Lib.purs","start":[349,8]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[349,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[349,19]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"not","moduleName":["Lib"]}},"annotation":{"meta":null,"sourceSpan":{"end":[358,29],"start":[358,24]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[358,29],"start":[358,28]}},"kind":"Var","type":{"annotation":[{"end":[357,15],"name":"tests/purus/passing/Misc/Lib.purs","start":[357,8]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"},"value":{"identifier":"p","sourcePos":[358,1]}},"kind":"App"},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[358,38],"start":[358,24]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[358,36],"start":[358,33]}},"kind":"Var","type":{"annotation":[{"end":[349,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[349,8]},[]],"contents":[{"annotation":[{"end":[349,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[349,8]},[]],"contents":[{"annotation":[{"end":[349,18],"name":"tests/purus/passing/Misc/Lib.purs","start":[349,16]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[349,15],"name":"tests/purus/passing/Misc/Lib.purs","start":[349,8]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[349,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[349,19]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"not","moduleName":["Lib"]}},"annotation":{"meta":null,"sourceSpan":{"end":[358,38],"start":[358,33]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[358,38],"start":[358,37]}},"kind":"Var","type":{"annotation":[{"end":[357,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[357,19]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"},"value":{"identifier":"q","sourcePos":[358,1]}},"kind":"App"},"kind":"App"},"kind":"App"},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[357,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[357,19]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[357,37],"name":"tests/purus/passing/Misc/Lib.purs","start":[357,30]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[357,15],"name":"tests/purus/passing/Misc/Lib.purs","start":[357,8]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[357,37],"name":"tests/purus/passing/Misc/Lib.purs","start":[357,19]},[]],"contents":[{"annotation":[{"end":[357,37],"name":"tests/purus/passing/Misc/Lib.purs","start":[357,19]},[]],"contents":[{"annotation":[{"end":[357,29],"name":"tests/purus/passing/Misc/Lib.purs","start":[357,27]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[357,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[357,19]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[357,37],"name":"tests/purus/passing/Misc/Lib.purs","start":[357,30]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"identifier":"iff"},{"annotation":{"meta":null,"sourceSpan":{"end":[362,29],"start":[362,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":{"metaType":"IsWhere"},"sourceSpan":{"end":[363,22],"start":[363,21]}},"binds":[{"annotation":{"meta":null,"sourceSpan":{"end":[366,22],"start":[366,5]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[366,22],"start":[366,5]}},"argument":"x","body":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[366,20],"start":[366,18]}},"kind":"Var","type":{"annotation":[{"end":[352,37],"name":"tests/purus/passing/Misc/Lib.purs","start":[352,8]},[]],"contents":[{"annotation":[{"end":[352,37],"name":"tests/purus/passing/Misc/Lib.purs","start":[352,8]},[]],"contents":[{"annotation":[{"end":[352,18],"name":"tests/purus/passing/Misc/Lib.purs","start":[352,16]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[352,15],"name":"tests/purus/passing/Misc/Lib.purs","start":[352,8]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[352,37],"name":"tests/purus/passing/Misc/Lib.purs","start":[352,19]},[]],"contents":[{"annotation":[{"end":[352,37],"name":"tests/purus/passing/Misc/Lib.purs","start":[352,19]},[]],"contents":[{"annotation":[{"end":[352,29],"name":"tests/purus/passing/Misc/Lib.purs","start":[352,27]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[352,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[352,19]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[352,37],"name":"tests/purus/passing/Misc/Lib.purs","start":[352,30]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"and","moduleName":["Lib"]}},"annotation":{"meta":null,"sourceSpan":{"end":[366,22],"start":[366,11]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[366,12],"start":[366,11]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[349,15],"name":"tests/purus/passing/Misc/Lib.purs","start":[349,8]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[357,37],"name":"tests/purus/passing/Misc/Lib.purs","start":[357,30]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"f","sourcePos":[368,5]}},"annotation":{"meta":null,"sourceSpan":{"end":[366,17],"start":[366,11]}},"argument":{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[366,17],"start":[366,13]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"},"value":{"identifier":"True","moduleName":["Prim"]}},"kind":"App"},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[366,22],"start":[366,11]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[366,22],"start":[366,21]}},"kind":"Var","type":{"annotation":[{"end":[352,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[352,19]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"},"value":{"identifier":"x","sourcePos":[366,5]}},"kind":"App"},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[352,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[352,19]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[352,37],"name":"tests/purus/passing/Misc/Lib.purs","start":[352,30]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"identifier":"h"},{"annotation":{"meta":null,"sourceSpan":{"end":[367,24],"start":[367,5]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[367,24],"start":[367,5]}},"argument":"x","body":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[367,18],"start":[367,15]}},"kind":"Var","type":{"annotation":[{"end":[357,37],"name":"tests/purus/passing/Misc/Lib.purs","start":[357,8]},[]],"contents":[{"annotation":[{"end":[357,37],"name":"tests/purus/passing/Misc/Lib.purs","start":[357,8]},[]],"contents":[{"annotation":[{"end":[357,18],"name":"tests/purus/passing/Misc/Lib.purs","start":[357,16]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[357,15],"name":"tests/purus/passing/Misc/Lib.purs","start":[357,8]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[357,37],"name":"tests/purus/passing/Misc/Lib.purs","start":[357,19]},[]],"contents":[{"annotation":[{"end":[357,37],"name":"tests/purus/passing/Misc/Lib.purs","start":[357,19]},[]],"contents":[{"annotation":[{"end":[357,29],"name":"tests/purus/passing/Misc/Lib.purs","start":[357,27]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[357,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[357,19]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[357,37],"name":"tests/purus/passing/Misc/Lib.purs","start":[357,30]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"iff","moduleName":["Lib"]}},"annotation":{"meta":null,"sourceSpan":{"end":[367,24],"start":[367,11]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[367,12],"start":[367,11]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[352,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[352,19]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[352,37],"name":"tests/purus/passing/Misc/Lib.purs","start":[352,30]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"h","sourcePos":[366,5]}},"annotation":{"meta":null,"sourceSpan":{"end":[367,14],"start":[367,11]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[367,14],"start":[367,13]}},"kind":"Var","type":{"annotation":[{"end":[352,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[352,19]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"},"value":{"identifier":"x","sourcePos":[367,5]}},"kind":"App"},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[367,24],"start":[367,11]}},"argument":{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[367,24],"start":[367,19]}},"kind":"Var","type":{"annotation":[{"end":[357,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[357,19]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"},"value":{"identifier":"False","moduleName":["Prim"]}},"kind":"App"},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[352,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[352,19]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[357,37],"name":"tests/purus/passing/Misc/Lib.purs","start":[357,30]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"identifier":"g"},{"annotation":{"meta":null,"sourceSpan":{"end":[368,20],"start":[368,5]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[368,20],"start":[368,5]}},"argument":"x","body":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[368,12],"start":[368,11]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[352,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[352,19]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[357,37],"name":"tests/purus/passing/Misc/Lib.purs","start":[357,30]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"g","sourcePos":[367,5]}},"annotation":{"meta":null,"sourceSpan":{"end":[368,20],"start":[368,11]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[368,17],"start":[368,14]}},"kind":"Var","type":{"annotation":[{"end":[349,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[349,8]},[]],"contents":[{"annotation":[{"end":[349,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[349,8]},[]],"contents":[{"annotation":[{"end":[349,18],"name":"tests/purus/passing/Misc/Lib.purs","start":[349,16]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[349,15],"name":"tests/purus/passing/Misc/Lib.purs","start":[349,8]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[349,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[349,19]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"not","moduleName":["Lib"]}},"annotation":{"meta":null,"sourceSpan":{"end":[368,19],"start":[368,14]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[368,19],"start":[368,18]}},"kind":"Var","type":{"annotation":[{"end":[349,15],"name":"tests/purus/passing/Misc/Lib.purs","start":[349,8]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"},"value":{"identifier":"x","sourcePos":[368,5]}},"kind":"App"},"kind":"App"},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[349,15],"name":"tests/purus/passing/Misc/Lib.purs","start":[349,8]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[357,37],"name":"tests/purus/passing/Misc/Lib.purs","start":[357,30]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"identifier":"f"},{"annotation":{"meta":null,"sourceSpan":{"end":[369,25],"start":[369,5]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[369,25],"start":[369,5]}},"argument":"x","body":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[369,12],"start":[369,11]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[352,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[352,19]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[357,37],"name":"tests/purus/passing/Misc/Lib.purs","start":[357,30]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"g","sourcePos":[367,5]}},"annotation":{"meta":null,"sourceSpan":{"end":[369,25],"start":[369,11]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[369,18],"start":[369,15]}},"kind":"Var","type":{"annotation":[{"end":[357,37],"name":"tests/purus/passing/Misc/Lib.purs","start":[357,8]},[]],"contents":[{"annotation":[{"end":[357,37],"name":"tests/purus/passing/Misc/Lib.purs","start":[357,8]},[]],"contents":[{"annotation":[{"end":[357,18],"name":"tests/purus/passing/Misc/Lib.purs","start":[357,16]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[357,15],"name":"tests/purus/passing/Misc/Lib.purs","start":[357,8]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[357,37],"name":"tests/purus/passing/Misc/Lib.purs","start":[357,19]},[]],"contents":[{"annotation":[{"end":[357,37],"name":"tests/purus/passing/Misc/Lib.purs","start":[357,19]},[]],"contents":[{"annotation":[{"end":[357,29],"name":"tests/purus/passing/Misc/Lib.purs","start":[357,27]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[357,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[357,19]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[357,37],"name":"tests/purus/passing/Misc/Lib.purs","start":[357,30]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"iff","moduleName":["Lib"]}},"annotation":{"meta":null,"sourceSpan":{"end":[369,24],"start":[369,14]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[369,15],"start":[369,14]}},"kind":"Var","type":{"annotation":[{"end":[357,15],"name":"tests/purus/passing/Misc/Lib.purs","start":[357,8]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"},"value":{"identifier":"x","sourcePos":[369,5]}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[369,24],"start":[369,14]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[369,22],"start":[369,19]}},"kind":"Var","type":{"annotation":[{"end":[349,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[349,8]},[]],"contents":[{"annotation":[{"end":[349,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[349,8]},[]],"contents":[{"annotation":[{"end":[349,18],"name":"tests/purus/passing/Misc/Lib.purs","start":[349,16]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[349,15],"name":"tests/purus/passing/Misc/Lib.purs","start":[349,8]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[349,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[349,19]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"not","moduleName":["Lib"]}},"annotation":{"meta":null,"sourceSpan":{"end":[369,24],"start":[369,19]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[369,24],"start":[369,23]}},"kind":"Var","type":{"annotation":[{"end":[357,15],"name":"tests/purus/passing/Misc/Lib.purs","start":[357,8]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"},"value":{"identifier":"x","sourcePos":[369,5]}},"kind":"App"},"kind":"App"},"kind":"App"},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[357,15],"name":"tests/purus/passing/Misc/Lib.purs","start":[357,8]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[357,37],"name":"tests/purus/passing/Misc/Lib.purs","start":[357,30]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"identifier":"q"},{"annotation":{"meta":null,"sourceSpan":{"end":[365,16],"start":[365,5]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[365,10],"start":[365,9]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[357,15],"name":"tests/purus/passing/Misc/Lib.purs","start":[357,8]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[357,37],"name":"tests/purus/passing/Misc/Lib.purs","start":[357,30]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"q","sourcePos":[369,5]}},"annotation":{"meta":null,"sourceSpan":{"end":[365,16],"start":[365,9]}},"argument":{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[365,16],"start":[365,11]}},"kind":"Var","type":{"annotation":[{"end":[357,15],"name":"tests/purus/passing/Misc/Lib.purs","start":[357,8]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"},"value":{"identifier":"False","moduleName":["Prim"]}},"kind":"App"},"identifier":"p"}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[363,22],"start":[363,21]}},"kind":"Var","type":{"annotation":[{"end":[357,37],"name":"tests/purus/passing/Misc/Lib.purs","start":[357,30]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"},"value":{"identifier":"p","sourcePos":[365,5]}},"kind":"Let"},"identifier":"ghcInlinerPaperEx"},{"annotation":{"meta":null,"sourceSpan":{"end":[371,24],"start":[371,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[380,44],"start":[373,3]}},"binds":[{"annotation":{"meta":null,"sourceSpan":{"end":[373,15],"start":[373,7]}},"bindType":"NonRec","expression":{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[373,15],"start":[373,11]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"},"value":{"identifier":"True","moduleName":["Prim"]}},"identifier":"z"},{"annotation":{"meta":null,"sourceSpan":{"end":[379,22],"start":[379,7]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[379,22],"start":[379,7]}},"argument":"x","body":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[379,16],"start":[379,13]}},"kind":"Var","type":{"annotation":[{"end":[349,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[349,8]},[]],"contents":[{"annotation":[{"end":[349,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[349,8]},[]],"contents":[{"annotation":[{"end":[349,18],"name":"tests/purus/passing/Misc/Lib.purs","start":[349,16]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[349,15],"name":"tests/purus/passing/Misc/Lib.purs","start":[349,8]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[349,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[349,19]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"not","moduleName":["Lib"]}},"annotation":{"meta":null,"sourceSpan":{"end":[379,22],"start":[379,13]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[379,19],"start":[379,18]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[349,15],"name":"tests/purus/passing/Misc/Lib.purs","start":[349,8]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[349,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[349,19]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"f","sourcePos":[377,7]}},"annotation":{"meta":null,"sourceSpan":{"end":[379,21],"start":[379,18]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[379,21],"start":[379,20]}},"kind":"Var","type":{"annotation":[{"end":[349,15],"name":"tests/purus/passing/Misc/Lib.purs","start":[349,8]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"},"value":{"identifier":"x","sourcePos":[379,7]}},"kind":"App"},"kind":"App"},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[349,15],"name":"tests/purus/passing/Misc/Lib.purs","start":[349,8]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[349,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[349,19]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"identifier":"h"},{"annotation":{"meta":null,"sourceSpan":{"end":[378,32],"start":[378,7]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[378,32],"start":[378,7]}},"argument":"x","body":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[378,26],"start":[378,24]}},"kind":"Var","type":{"annotation":[{"end":[352,37],"name":"tests/purus/passing/Misc/Lib.purs","start":[352,8]},[]],"contents":[{"annotation":[{"end":[352,37],"name":"tests/purus/passing/Misc/Lib.purs","start":[352,8]},[]],"contents":[{"annotation":[{"end":[352,18],"name":"tests/purus/passing/Misc/Lib.purs","start":[352,16]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[352,15],"name":"tests/purus/passing/Misc/Lib.purs","start":[352,8]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[352,37],"name":"tests/purus/passing/Misc/Lib.purs","start":[352,19]},[]],"contents":[{"annotation":[{"end":[352,37],"name":"tests/purus/passing/Misc/Lib.purs","start":[352,19]},[]],"contents":[{"annotation":[{"end":[352,29],"name":"tests/purus/passing/Misc/Lib.purs","start":[352,27]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[352,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[352,19]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[352,37],"name":"tests/purus/passing/Misc/Lib.purs","start":[352,30]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"and","moduleName":["Lib"]}},"annotation":{"meta":null,"sourceSpan":{"end":[378,32],"start":[378,14]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[378,17],"start":[378,14]}},"kind":"Var","type":{"annotation":[{"end":[349,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[349,8]},[]],"contents":[{"annotation":[{"end":[349,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[349,8]},[]],"contents":[{"annotation":[{"end":[349,18],"name":"tests/purus/passing/Misc/Lib.purs","start":[349,16]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[349,15],"name":"tests/purus/passing/Misc/Lib.purs","start":[349,8]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[349,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[349,19]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"not","moduleName":["Lib"]}},"annotation":{"meta":null,"sourceSpan":{"end":[378,23],"start":[378,14]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[378,20],"start":[378,19]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[349,15],"name":"tests/purus/passing/Misc/Lib.purs","start":[349,8]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[349,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[349,19]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"h","sourcePos":[379,7]}},"annotation":{"meta":null,"sourceSpan":{"end":[378,22],"start":[378,19]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[378,22],"start":[378,21]}},"kind":"Var","type":{"annotation":[{"end":[349,15],"name":"tests/purus/passing/Misc/Lib.purs","start":[349,8]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"},"value":{"identifier":"x","sourcePos":[378,7]}},"kind":"App"},"kind":"App"},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[378,32],"start":[378,14]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[378,30],"start":[378,27]}},"kind":"Var","type":{"annotation":[{"end":[349,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[349,8]},[]],"contents":[{"annotation":[{"end":[349,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[349,8]},[]],"contents":[{"annotation":[{"end":[349,18],"name":"tests/purus/passing/Misc/Lib.purs","start":[349,16]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[349,15],"name":"tests/purus/passing/Misc/Lib.purs","start":[349,8]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[349,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[349,19]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"not","moduleName":["Lib"]}},"annotation":{"meta":null,"sourceSpan":{"end":[378,32],"start":[378,27]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[378,32],"start":[378,31]}},"kind":"Var","type":{"annotation":[{"end":[349,15],"name":"tests/purus/passing/Misc/Lib.purs","start":[349,8]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"},"value":{"identifier":"x","sourcePos":[378,7]}},"kind":"App"},"kind":"App"},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[349,15],"name":"tests/purus/passing/Misc/Lib.purs","start":[349,8]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[352,37],"name":"tests/purus/passing/Misc/Lib.purs","start":[352,30]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"identifier":"g"},{"annotation":{"meta":null,"sourceSpan":{"end":[377,22],"start":[377,7]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[377,22],"start":[377,7]}},"argument":"x","body":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[377,16],"start":[377,13]}},"kind":"Var","type":{"annotation":[{"end":[349,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[349,8]},[]],"contents":[{"annotation":[{"end":[349,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[349,8]},[]],"contents":[{"annotation":[{"end":[349,18],"name":"tests/purus/passing/Misc/Lib.purs","start":[349,16]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[349,15],"name":"tests/purus/passing/Misc/Lib.purs","start":[349,8]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[349,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[349,19]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"not","moduleName":["Lib"]}},"annotation":{"meta":null,"sourceSpan":{"end":[377,22],"start":[377,13]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[377,19],"start":[377,18]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[349,15],"name":"tests/purus/passing/Misc/Lib.purs","start":[349,8]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[352,37],"name":"tests/purus/passing/Misc/Lib.purs","start":[352,30]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"g","sourcePos":[378,7]}},"annotation":{"meta":null,"sourceSpan":{"end":[377,21],"start":[377,18]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[377,21],"start":[377,20]}},"kind":"Var","type":{"annotation":[{"end":[349,15],"name":"tests/purus/passing/Misc/Lib.purs","start":[349,8]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"},"value":{"identifier":"x","sourcePos":[377,7]}},"kind":"App"},"kind":"App"},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[349,15],"name":"tests/purus/passing/Misc/Lib.purs","start":[349,8]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[349,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[349,19]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"identifier":"f"},{"annotation":{"meta":null,"sourceSpan":{"end":[376,30],"start":[376,7]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[376,30],"start":[376,7]}},"argument":"x","body":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[376,17],"start":[376,14]}},"kind":"Var","type":{"annotation":[{"end":[349,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[349,8]},[]],"contents":[{"annotation":[{"end":[349,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[349,8]},[]],"contents":[{"annotation":[{"end":[349,18],"name":"tests/purus/passing/Misc/Lib.purs","start":[349,16]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[349,15],"name":"tests/purus/passing/Misc/Lib.purs","start":[349,8]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[349,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[349,19]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"not","moduleName":["Lib"]}},"annotation":{"meta":null,"sourceSpan":{"end":[376,30],"start":[376,14]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[376,25],"start":[376,23]}},"kind":"Var","type":{"annotation":[{"end":[352,37],"name":"tests/purus/passing/Misc/Lib.purs","start":[352,8]},[]],"contents":[{"annotation":[{"end":[352,37],"name":"tests/purus/passing/Misc/Lib.purs","start":[352,8]},[]],"contents":[{"annotation":[{"end":[352,18],"name":"tests/purus/passing/Misc/Lib.purs","start":[352,16]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[352,15],"name":"tests/purus/passing/Misc/Lib.purs","start":[352,8]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[352,37],"name":"tests/purus/passing/Misc/Lib.purs","start":[352,19]},[]],"contents":[{"annotation":[{"end":[352,37],"name":"tests/purus/passing/Misc/Lib.purs","start":[352,19]},[]],"contents":[{"annotation":[{"end":[352,29],"name":"tests/purus/passing/Misc/Lib.purs","start":[352,27]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[352,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[352,19]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[352,37],"name":"tests/purus/passing/Misc/Lib.purs","start":[352,30]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"and","moduleName":["Lib"]}},"annotation":{"meta":null,"sourceSpan":{"end":[376,29],"start":[376,19]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[376,20],"start":[376,19]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[349,15],"name":"tests/purus/passing/Misc/Lib.purs","start":[349,8]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[349,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[349,19]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"f","sourcePos":[377,7]}},"annotation":{"meta":null,"sourceSpan":{"end":[376,22],"start":[376,19]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[376,22],"start":[376,21]}},"kind":"Var","type":{"annotation":[{"end":[349,15],"name":"tests/purus/passing/Misc/Lib.purs","start":[349,8]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"},"value":{"identifier":"x","sourcePos":[376,7]}},"kind":"App"},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[376,29],"start":[376,19]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[376,27],"start":[376,26]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[352,15],"name":"tests/purus/passing/Misc/Lib.purs","start":[352,8]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[352,37],"name":"tests/purus/passing/Misc/Lib.purs","start":[352,30]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"b","sourcePos":[375,7]}},"annotation":{"meta":null,"sourceSpan":{"end":[376,29],"start":[376,26]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[376,29],"start":[376,28]}},"kind":"Var","type":{"annotation":[{"end":[349,15],"name":"tests/purus/passing/Misc/Lib.purs","start":[349,8]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"},"value":{"identifier":"x","sourcePos":[376,7]}},"kind":"App"},"kind":"App"},"kind":"App"},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[349,15],"name":"tests/purus/passing/Misc/Lib.purs","start":[349,8]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[349,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[349,19]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"identifier":"c"},{"annotation":{"meta":null,"sourceSpan":{"end":[375,30],"start":[375,7]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[375,30],"start":[375,7]}},"argument":"x","body":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[375,18],"start":[375,16]}},"kind":"Var","type":{"annotation":[{"end":[352,37],"name":"tests/purus/passing/Misc/Lib.purs","start":[352,8]},[]],"contents":[{"annotation":[{"end":[352,37],"name":"tests/purus/passing/Misc/Lib.purs","start":[352,8]},[]],"contents":[{"annotation":[{"end":[352,18],"name":"tests/purus/passing/Misc/Lib.purs","start":[352,16]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[352,15],"name":"tests/purus/passing/Misc/Lib.purs","start":[352,8]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[352,37],"name":"tests/purus/passing/Misc/Lib.purs","start":[352,19]},[]],"contents":[{"annotation":[{"end":[352,37],"name":"tests/purus/passing/Misc/Lib.purs","start":[352,19]},[]],"contents":[{"annotation":[{"end":[352,29],"name":"tests/purus/passing/Misc/Lib.purs","start":[352,27]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[352,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[352,19]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[352,37],"name":"tests/purus/passing/Misc/Lib.purs","start":[352,30]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"and","moduleName":["Lib"]}},"annotation":{"meta":null,"sourceSpan":{"end":[375,30],"start":[375,14]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[375,15],"start":[375,14]}},"kind":"Var","type":{"annotation":[{"end":[352,15],"name":"tests/purus/passing/Misc/Lib.purs","start":[352,8]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"},"value":{"identifier":"x","sourcePos":[375,7]}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[375,30],"start":[375,14]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[375,26],"start":[375,24]}},"kind":"Var","type":{"annotation":[{"end":[352,37],"name":"tests/purus/passing/Misc/Lib.purs","start":[352,8]},[]],"contents":[{"annotation":[{"end":[352,37],"name":"tests/purus/passing/Misc/Lib.purs","start":[352,8]},[]],"contents":[{"annotation":[{"end":[352,18],"name":"tests/purus/passing/Misc/Lib.purs","start":[352,16]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[352,15],"name":"tests/purus/passing/Misc/Lib.purs","start":[352,8]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[352,37],"name":"tests/purus/passing/Misc/Lib.purs","start":[352,19]},[]],"contents":[{"annotation":[{"end":[352,37],"name":"tests/purus/passing/Misc/Lib.purs","start":[352,19]},[]],"contents":[{"annotation":[{"end":[352,29],"name":"tests/purus/passing/Misc/Lib.purs","start":[352,27]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[352,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[352,19]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[352,37],"name":"tests/purus/passing/Misc/Lib.purs","start":[352,30]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"and","moduleName":["Lib"]}},"annotation":{"meta":null,"sourceSpan":{"end":[375,30],"start":[375,14]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[375,21],"start":[375,20]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[349,15],"name":"tests/purus/passing/Misc/Lib.purs","start":[349,8]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[349,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[349,19]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"c","sourcePos":[376,7]}},"annotation":{"meta":null,"sourceSpan":{"end":[375,23],"start":[375,20]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[375,23],"start":[375,22]}},"kind":"Var","type":{"annotation":[{"end":[352,15],"name":"tests/purus/passing/Misc/Lib.purs","start":[352,8]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"},"value":{"identifier":"x","sourcePos":[375,7]}},"kind":"App"},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[375,30],"start":[375,14]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[375,28],"start":[375,27]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[349,15],"name":"tests/purus/passing/Misc/Lib.purs","start":[349,8]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[349,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[349,19]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"h","sourcePos":[379,7]}},"annotation":{"meta":null,"sourceSpan":{"end":[375,30],"start":[375,27]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[375,30],"start":[375,29]}},"kind":"Var","type":{"annotation":[{"end":[352,15],"name":"tests/purus/passing/Misc/Lib.purs","start":[352,8]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"},"value":{"identifier":"x","sourcePos":[375,7]}},"kind":"App"},"kind":"App"},"kind":"App"},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[352,15],"name":"tests/purus/passing/Misc/Lib.purs","start":[352,8]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[352,37],"name":"tests/purus/passing/Misc/Lib.purs","start":[352,30]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"identifier":"b"},{"annotation":{"meta":null,"sourceSpan":{"end":[374,22],"start":[374,7]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[374,22],"start":[374,7]}},"argument":"x","body":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[374,20],"start":[374,18]}},"kind":"Var","type":{"annotation":[{"end":[352,37],"name":"tests/purus/passing/Misc/Lib.purs","start":[352,8]},[]],"contents":[{"annotation":[{"end":[352,37],"name":"tests/purus/passing/Misc/Lib.purs","start":[352,8]},[]],"contents":[{"annotation":[{"end":[352,18],"name":"tests/purus/passing/Misc/Lib.purs","start":[352,16]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[352,15],"name":"tests/purus/passing/Misc/Lib.purs","start":[352,8]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[352,37],"name":"tests/purus/passing/Misc/Lib.purs","start":[352,19]},[]],"contents":[{"annotation":[{"end":[352,37],"name":"tests/purus/passing/Misc/Lib.purs","start":[352,19]},[]],"contents":[{"annotation":[{"end":[352,29],"name":"tests/purus/passing/Misc/Lib.purs","start":[352,27]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[352,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[352,19]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[352,37],"name":"tests/purus/passing/Misc/Lib.purs","start":[352,30]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"and","moduleName":["Lib"]}},"annotation":{"meta":null,"sourceSpan":{"end":[374,22],"start":[374,14]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[374,15],"start":[374,14]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[352,15],"name":"tests/purus/passing/Misc/Lib.purs","start":[352,8]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[352,37],"name":"tests/purus/passing/Misc/Lib.purs","start":[352,30]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"b","sourcePos":[375,7]}},"annotation":{"meta":null,"sourceSpan":{"end":[374,17],"start":[374,14]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[374,17],"start":[374,16]}},"kind":"Var","type":{"annotation":[{"end":[349,15],"name":"tests/purus/passing/Misc/Lib.purs","start":[349,8]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"},"value":{"identifier":"x","sourcePos":[374,7]}},"kind":"App"},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[374,22],"start":[374,14]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[374,22],"start":[374,21]}},"kind":"Var","type":{"annotation":[{"end":[349,15],"name":"tests/purus/passing/Misc/Lib.purs","start":[349,8]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"},"value":{"identifier":"x","sourcePos":[374,7]}},"kind":"App"},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[349,15],"name":"tests/purus/passing/Misc/Lib.purs","start":[349,8]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[352,37],"name":"tests/purus/passing/Misc/Lib.purs","start":[352,30]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"identifier":"a"}],"expression":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[380,12],"start":[380,10]}},"kind":"Var","type":{"annotation":[{"end":[352,37],"name":"tests/purus/passing/Misc/Lib.purs","start":[352,8]},[]],"contents":[{"annotation":[{"end":[352,37],"name":"tests/purus/passing/Misc/Lib.purs","start":[352,8]},[]],"contents":[{"annotation":[{"end":[352,18],"name":"tests/purus/passing/Misc/Lib.purs","start":[352,16]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[352,15],"name":"tests/purus/passing/Misc/Lib.purs","start":[352,8]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[352,37],"name":"tests/purus/passing/Misc/Lib.purs","start":[352,19]},[]],"contents":[{"annotation":[{"end":[352,37],"name":"tests/purus/passing/Misc/Lib.purs","start":[352,19]},[]],"contents":[{"annotation":[{"end":[352,29],"name":"tests/purus/passing/Misc/Lib.purs","start":[352,27]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[352,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[352,19]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[352,37],"name":"tests/purus/passing/Misc/Lib.purs","start":[352,30]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"and","moduleName":["Lib"]}},"annotation":{"meta":null,"sourceSpan":{"end":[380,44],"start":[380,6]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[380,7],"start":[380,6]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[349,15],"name":"tests/purus/passing/Misc/Lib.purs","start":[349,8]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[352,37],"name":"tests/purus/passing/Misc/Lib.purs","start":[352,30]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"a","sourcePos":[374,7]}},"annotation":{"meta":null,"sourceSpan":{"end":[380,9],"start":[380,6]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[380,9],"start":[380,8]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"},"value":{"identifier":"z","sourcePos":[373,7]}},"kind":"App"},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[380,44],"start":[380,6]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[380,19],"start":[380,17]}},"kind":"Var","type":{"annotation":[{"end":[352,37],"name":"tests/purus/passing/Misc/Lib.purs","start":[352,8]},[]],"contents":[{"annotation":[{"end":[352,37],"name":"tests/purus/passing/Misc/Lib.purs","start":[352,8]},[]],"contents":[{"annotation":[{"end":[352,18],"name":"tests/purus/passing/Misc/Lib.purs","start":[352,16]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[352,15],"name":"tests/purus/passing/Misc/Lib.purs","start":[352,8]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[352,37],"name":"tests/purus/passing/Misc/Lib.purs","start":[352,19]},[]],"contents":[{"annotation":[{"end":[352,37],"name":"tests/purus/passing/Misc/Lib.purs","start":[352,19]},[]],"contents":[{"annotation":[{"end":[352,29],"name":"tests/purus/passing/Misc/Lib.purs","start":[352,27]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[352,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[352,19]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[352,37],"name":"tests/purus/passing/Misc/Lib.purs","start":[352,30]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"and","moduleName":["Lib"]}},"annotation":{"meta":null,"sourceSpan":{"end":[380,44],"start":[380,6]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[380,14],"start":[380,13]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[352,15],"name":"tests/purus/passing/Misc/Lib.purs","start":[352,8]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[352,37],"name":"tests/purus/passing/Misc/Lib.purs","start":[352,30]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"b","sourcePos":[375,7]}},"annotation":{"meta":null,"sourceSpan":{"end":[380,16],"start":[380,13]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[380,16],"start":[380,15]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"},"value":{"identifier":"z","sourcePos":[373,7]}},"kind":"App"},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[380,44],"start":[380,6]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[380,26],"start":[380,24]}},"kind":"Var","type":{"annotation":[{"end":[352,37],"name":"tests/purus/passing/Misc/Lib.purs","start":[352,8]},[]],"contents":[{"annotation":[{"end":[352,37],"name":"tests/purus/passing/Misc/Lib.purs","start":[352,8]},[]],"contents":[{"annotation":[{"end":[352,18],"name":"tests/purus/passing/Misc/Lib.purs","start":[352,16]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[352,15],"name":"tests/purus/passing/Misc/Lib.purs","start":[352,8]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[352,37],"name":"tests/purus/passing/Misc/Lib.purs","start":[352,19]},[]],"contents":[{"annotation":[{"end":[352,37],"name":"tests/purus/passing/Misc/Lib.purs","start":[352,19]},[]],"contents":[{"annotation":[{"end":[352,29],"name":"tests/purus/passing/Misc/Lib.purs","start":[352,27]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[352,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[352,19]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[352,37],"name":"tests/purus/passing/Misc/Lib.purs","start":[352,30]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"and","moduleName":["Lib"]}},"annotation":{"meta":null,"sourceSpan":{"end":[380,44],"start":[380,6]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[380,21],"start":[380,20]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[349,15],"name":"tests/purus/passing/Misc/Lib.purs","start":[349,8]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[349,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[349,19]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"c","sourcePos":[376,7]}},"annotation":{"meta":null,"sourceSpan":{"end":[380,23],"start":[380,20]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[380,23],"start":[380,22]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"},"value":{"identifier":"z","sourcePos":[373,7]}},"kind":"App"},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[380,44],"start":[380,6]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[380,33],"start":[380,31]}},"kind":"Var","type":{"annotation":[{"end":[352,37],"name":"tests/purus/passing/Misc/Lib.purs","start":[352,8]},[]],"contents":[{"annotation":[{"end":[352,37],"name":"tests/purus/passing/Misc/Lib.purs","start":[352,8]},[]],"contents":[{"annotation":[{"end":[352,18],"name":"tests/purus/passing/Misc/Lib.purs","start":[352,16]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[352,15],"name":"tests/purus/passing/Misc/Lib.purs","start":[352,8]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[352,37],"name":"tests/purus/passing/Misc/Lib.purs","start":[352,19]},[]],"contents":[{"annotation":[{"end":[352,37],"name":"tests/purus/passing/Misc/Lib.purs","start":[352,19]},[]],"contents":[{"annotation":[{"end":[352,29],"name":"tests/purus/passing/Misc/Lib.purs","start":[352,27]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[352,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[352,19]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[352,37],"name":"tests/purus/passing/Misc/Lib.purs","start":[352,30]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"and","moduleName":["Lib"]}},"annotation":{"meta":null,"sourceSpan":{"end":[380,44],"start":[380,6]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[380,28],"start":[380,27]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[349,15],"name":"tests/purus/passing/Misc/Lib.purs","start":[349,8]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[349,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[349,19]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"f","sourcePos":[377,7]}},"annotation":{"meta":null,"sourceSpan":{"end":[380,30],"start":[380,27]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[380,30],"start":[380,29]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"},"value":{"identifier":"z","sourcePos":[373,7]}},"kind":"App"},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[380,44],"start":[380,6]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[380,40],"start":[380,38]}},"kind":"Var","type":{"annotation":[{"end":[352,37],"name":"tests/purus/passing/Misc/Lib.purs","start":[352,8]},[]],"contents":[{"annotation":[{"end":[352,37],"name":"tests/purus/passing/Misc/Lib.purs","start":[352,8]},[]],"contents":[{"annotation":[{"end":[352,18],"name":"tests/purus/passing/Misc/Lib.purs","start":[352,16]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[352,15],"name":"tests/purus/passing/Misc/Lib.purs","start":[352,8]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[352,37],"name":"tests/purus/passing/Misc/Lib.purs","start":[352,19]},[]],"contents":[{"annotation":[{"end":[352,37],"name":"tests/purus/passing/Misc/Lib.purs","start":[352,19]},[]],"contents":[{"annotation":[{"end":[352,29],"name":"tests/purus/passing/Misc/Lib.purs","start":[352,27]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[352,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[352,19]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[352,37],"name":"tests/purus/passing/Misc/Lib.purs","start":[352,30]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"and","moduleName":["Lib"]}},"annotation":{"meta":null,"sourceSpan":{"end":[380,44],"start":[380,6]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[380,35],"start":[380,34]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[349,15],"name":"tests/purus/passing/Misc/Lib.purs","start":[349,8]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[352,37],"name":"tests/purus/passing/Misc/Lib.purs","start":[352,30]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"g","sourcePos":[378,7]}},"annotation":{"meta":null,"sourceSpan":{"end":[380,37],"start":[380,34]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[380,37],"start":[380,36]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"},"value":{"identifier":"z","sourcePos":[373,7]}},"kind":"App"},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[380,44],"start":[380,6]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[380,42],"start":[380,41]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[349,15],"name":"tests/purus/passing/Misc/Lib.purs","start":[349,8]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[349,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[349,19]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"h","sourcePos":[379,7]}},"annotation":{"meta":null,"sourceSpan":{"end":[380,44],"start":[380,41]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[380,44],"start":[380,43]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"},"value":{"identifier":"z","sourcePos":[373,7]}},"kind":"App"},"kind":"App"},"kind":"App"},"kind":"App"},"kind":"App"},"kind":"App"},"kind":"Let"},"identifier":"kozsTwoSCCEx"},{"annotation":{"meta":null,"sourceSpan":{"end":[245,22],"start":[245,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[246,17],"start":[246,9]}},"kind":"Literal","type":{"annotation":[{"end":[245,22],"name":"tests/purus/passing/Misc/Lib.purs","start":[245,10]},[]],"contents":[{"annotation":[{"end":[245,11],"name":"tests/purus/passing/Misc/Lib.purs","start":[245,10]},[]],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[{"end":[245,21],"name":"tests/purus/passing/Misc/Lib.purs","start":[245,11]},[]],"contents":["foo",{"annotation":[{"end":[245,21],"name":"tests/purus/passing/Misc/Lib.purs","start":[245,18]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},{"annotation":[{"end":[245,22],"name":"tests/purus/passing/Misc/Lib.purs","start":[245,21]},[]],"contents":[{"annotation":[{"end":[245,22],"name":"tests/purus/passing/Misc/Lib.purs","start":[245,21]},[]],"tag":"REmpty"},{"annotation":[{"end":[245,21],"name":"tests/purus/passing/Misc/Lib.purs","start":[245,18]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"KindApp"}],"tag":"RCons"}],"tag":"TypeApp"},"value":{"literalType":"ObjectLiteral","value":[["foo",{"annotation":{"meta":null,"sourceSpan":{"end":[246,16],"start":[246,15]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"literalType":"IntLiteral","value":3}}]]}},"identifier":"anObj"},{"annotation":{"meta":null,"sourceSpan":{"end":[248,26],"start":[248,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[249,28],"start":[249,13]}},"binds":[{"annotation":{"meta":null,"sourceSpan":{"end":[249,28],"start":[249,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[249,18],"start":[249,13]}},"kind":"Var","type":{"annotation":[{"end":[245,22],"name":"tests/purus/passing/Misc/Lib.purs","start":[245,10]},[]],"contents":[{"annotation":[{"end":[245,11],"name":"tests/purus/passing/Misc/Lib.purs","start":[245,10]},[]],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[{"end":[245,21],"name":"tests/purus/passing/Misc/Lib.purs","start":[245,11]},[]],"contents":["foo",{"annotation":[{"end":[245,21],"name":"tests/purus/passing/Misc/Lib.purs","start":[245,18]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},{"annotation":[{"end":[245,22],"name":"tests/purus/passing/Misc/Lib.purs","start":[245,21]},[]],"contents":[{"annotation":[{"end":[245,22],"name":"tests/purus/passing/Misc/Lib.purs","start":[245,21]},[]],"tag":"REmpty"},{"annotation":[{"end":[245,21],"name":"tests/purus/passing/Misc/Lib.purs","start":[245,18]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"KindApp"}],"tag":"RCons"}],"tag":"TypeApp"},"value":{"identifier":"anObj","moduleName":["Lib"]}},"identifier":"v"}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[249,28],"start":[249,13]}},"copy":[],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["foo",{"annotation":[{"end":[245,21],"name":"tests/purus/passing/Misc/Lib.purs","start":[245,18]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},{"annotation":[{"end":[248,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[248,25]},[]],"contents":[{"annotation":[{"end":[248,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[248,25]},[]],"tag":"REmpty"},{"annotation":[{"end":[248,25],"name":"tests/purus/passing/Misc/Lib.purs","start":[248,22]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"KindApp"}],"tag":"RCons"}],"tag":"TypeApp"},"value":{"identifier":"v","sourcePos":[249,1]}},"kind":"ObjectUpdate","type":{"annotation":[{"end":[248,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[248,14]},[]],"contents":[{"annotation":[{"end":[248,15],"name":"tests/purus/passing/Misc/Lib.purs","start":[248,14]},[]],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[{"end":[248,25],"name":"tests/purus/passing/Misc/Lib.purs","start":[248,15]},[]],"contents":["foo",{"annotation":[{"end":[248,25],"name":"tests/purus/passing/Misc/Lib.purs","start":[248,22]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},{"annotation":[{"end":[248,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[248,25]},[]],"contents":[{"annotation":[{"end":[248,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[248,25]},[]],"tag":"REmpty"},{"annotation":[{"end":[248,25],"name":"tests/purus/passing/Misc/Lib.purs","start":[248,22]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"KindApp"}],"tag":"RCons"}],"tag":"TypeApp"},"updates":[["foo",{"annotation":{"meta":null,"sourceSpan":{"end":[249,27],"start":[249,26]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"literalType":"IntLiteral","value":4}}]]},"kind":"Let"},"identifier":"objUpdate"},{"annotation":{"meta":null,"sourceSpan":{"end":[147,16],"start":[147,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[148,13],"start":[148,12]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"literalType":"IntLiteral","value":1}},"identifier":"anIntLit"},{"annotation":{"meta":null,"sourceSpan":{"end":[153,12],"start":[153,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[154,9],"start":[154,8]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"literalType":"IntLiteral","value":1}},"identifier":"aVal"},{"annotation":{"meta":null,"sourceSpan":{"end":[150,21],"start":[150,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[151,20],"start":[151,14]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"String"],"tag":"TypeConstructor"},"value":{"literalType":"StringLiteral","value":"woop"}},"identifier":"aStringLit"},{"annotation":{"meta":null,"sourceSpan":{"end":[261,24],"start":[261,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[262,15],"start":[262,1]}},"argument":"v","body":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"},"value":{"identifier":"True","moduleName":["Prim"]}},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[261,13],"name":"tests/purus/passing/Misc/Lib.purs","start":[261,10]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[261,24],"name":"tests/purus/passing/Misc/Lib.purs","start":[261,17]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"identifier":"aPred"},{"annotation":{"meta":null,"sourceSpan":{"end":[225,33],"start":[225,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[231,12],"start":[226,1]}},"argument":"w","body":{"annotation":{"meta":null,"sourceSpan":{"end":[231,12],"start":[226,1]}},"argument":"x","body":{"annotation":{"meta":null,"sourceSpan":{"end":[231,12],"start":[226,19]}},"binds":[{"annotation":{"meta":null,"sourceSpan":{"end":[225,33],"start":[225,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[225,33],"start":[225,1]}},"argument":"v1","body":{"annotation":{"meta":null,"sourceSpan":{"end":[231,12],"start":[231,11]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"literalType":"IntLiteral","value":0}},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"$28","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[225,33],"name":"tests/purus/passing/Misc/Lib.purs","start":[225,1]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"$28"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[225,33],"name":"tests/purus/passing/Misc/Lib.purs","start":[225,30]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"identifier":"v"}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[231,12],"start":[226,19]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[227,4],"start":[227,3]}},"binderType":"VarBinder","identifier":"y","type":{"annotation":[{"end":[225,19],"name":"tests/purus/passing/Misc/Lib.purs","start":[225,16]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}},{"annotation":{"meta":null,"sourceSpan":{"end":[227,7],"start":[227,6]}},"binderType":"VarBinder","identifier":"z","type":{"annotation":[{"end":[225,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[225,23]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[231,12],"start":[226,19]}},"binds":[{"annotation":{"meta":null,"sourceSpan":{"end":[225,33],"start":[225,1]}},"bindType":"NonRec","expression":{"abstraction":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[227,12],"start":[227,10]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[18,20],"name":"tests/purus/passing/Misc/Lib.purs","start":[18,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":50,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Lib"],"Eq$Dict"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[18,20],"name":"tests/purus/passing/Misc/Lib.purs","start":[18,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[19,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[19,9]},[]],"contents":[{"annotation":[{"end":[19,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[19,9]},[]],"contents":[{"annotation":[{"end":[19,13],"name":"tests/purus/passing/Misc/Lib.purs","start":[19,11]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[19,10],"name":"tests/purus/passing/Misc/Lib.purs","start":[19,9]},[]],"contents":{"kind":{"annotation":[{"end":[18,20],"name":"tests/purus/passing/Misc/Lib.purs","start":[18,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[19,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[19,14]},[]],"contents":[{"annotation":[{"end":[19,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[19,14]},[]],"contents":[{"annotation":[{"end":[19,18],"name":"tests/purus/passing/Misc/Lib.purs","start":[19,16]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[19,15],"name":"tests/purus/passing/Misc/Lib.purs","start":[19,14]},[]],"contents":{"kind":{"annotation":[{"end":[18,20],"name":"tests/purus/passing/Misc/Lib.purs","start":[18,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[19,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[19,19]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarVisible"},"tag":"ForAll"},"value":{"identifier":"eq","moduleName":["Lib"]}},"annotation":{"meta":null,"sourceSpan":{"end":[227,14],"start":[227,10]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Lib"],"Eq$Dict"],"tag":"TypeConstructor"},{"annotation":[{"end":[24,16],"name":"tests/purus/passing/Misc/Lib.purs","start":[24,13]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"eqInt","moduleName":["Lib"]}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[227,14],"start":[227,10]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[227,14],"start":[227,13]}},"kind":"Var","type":{"annotation":[{"end":[225,19],"name":"tests/purus/passing/Misc/Lib.purs","start":[225,16]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"identifier":"y","sourcePos":[227,3]}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[227,16],"start":[227,10]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[227,16],"start":[227,15]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"literalType":"IntLiteral","value":2}},"kind":"App"},"identifier":"v1"}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[231,12],"start":[226,19]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"binderType":"ConstructorBinder","binders":[],"constructorName":{"identifier":"True","moduleName":["Prim"]},"typeName":{"identifier":"Boolean","moduleName":["Prim"]}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[231,12],"start":[226,19]}},"binds":[{"annotation":{"meta":null,"sourceSpan":{"end":[225,33],"start":[225,1]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[228,15],"start":[228,10]}},"kind":"Var","type":{"annotation":[{"end":[261,24],"name":"tests/purus/passing/Misc/Lib.purs","start":[261,10]},[]],"contents":[{"annotation":[{"end":[261,24],"name":"tests/purus/passing/Misc/Lib.purs","start":[261,10]},[]],"contents":[{"annotation":[{"end":[261,16],"name":"tests/purus/passing/Misc/Lib.purs","start":[261,14]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[261,13],"name":"tests/purus/passing/Misc/Lib.purs","start":[261,10]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[261,24],"name":"tests/purus/passing/Misc/Lib.purs","start":[261,17]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"aPred","moduleName":["Lib"]}},"annotation":{"meta":null,"sourceSpan":{"end":[228,17],"start":[228,10]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[228,17],"start":[228,16]}},"kind":"Var","type":{"annotation":[{"end":[225,19],"name":"tests/purus/passing/Misc/Lib.purs","start":[225,16]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"identifier":"y","sourcePos":[227,3]}},"kind":"App"},"identifier":"v2"}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[231,12],"start":[226,19]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"binderType":"ConstructorBinder","binders":[],"constructorName":{"identifier":"True","moduleName":["Prim"]},"typeName":{"identifier":"Boolean","moduleName":["Prim"]}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[231,12],"start":[226,19]}},"binds":[{"annotation":{"meta":null,"sourceSpan":{"end":[225,33],"start":[225,1]}},"bindType":"NonRec","expression":{"abstraction":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[229,12],"start":[229,10]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[18,20],"name":"tests/purus/passing/Misc/Lib.purs","start":[18,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":50,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Lib"],"Eq$Dict"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[18,20],"name":"tests/purus/passing/Misc/Lib.purs","start":[18,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[19,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[19,9]},[]],"contents":[{"annotation":[{"end":[19,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[19,9]},[]],"contents":[{"annotation":[{"end":[19,13],"name":"tests/purus/passing/Misc/Lib.purs","start":[19,11]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[19,10],"name":"tests/purus/passing/Misc/Lib.purs","start":[19,9]},[]],"contents":{"kind":{"annotation":[{"end":[18,20],"name":"tests/purus/passing/Misc/Lib.purs","start":[18,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[19,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[19,14]},[]],"contents":[{"annotation":[{"end":[19,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[19,14]},[]],"contents":[{"annotation":[{"end":[19,18],"name":"tests/purus/passing/Misc/Lib.purs","start":[19,16]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[19,15],"name":"tests/purus/passing/Misc/Lib.purs","start":[19,14]},[]],"contents":{"kind":{"annotation":[{"end":[18,20],"name":"tests/purus/passing/Misc/Lib.purs","start":[18,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[19,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[19,19]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarVisible"},"tag":"ForAll"},"value":{"identifier":"eq","moduleName":["Lib"]}},"annotation":{"meta":null,"sourceSpan":{"end":[229,14],"start":[229,10]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Lib"],"Eq$Dict"],"tag":"TypeConstructor"},{"annotation":[{"end":[24,16],"name":"tests/purus/passing/Misc/Lib.purs","start":[24,13]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"eqInt","moduleName":["Lib"]}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[229,14],"start":[229,10]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[229,14],"start":[229,13]}},"kind":"Var","type":{"annotation":[{"end":[225,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[225,23]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"identifier":"z","sourcePos":[227,6]}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[229,16],"start":[229,10]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[229,16],"start":[229,15]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"literalType":"IntLiteral","value":0}},"kind":"App"},"identifier":"v3"}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[231,12],"start":[226,19]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"binderType":"ConstructorBinder","binders":[],"constructorName":{"identifier":"True","moduleName":["Prim"]},"typeName":{"identifier":"Boolean","moduleName":["Prim"]}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[231,12],"start":[226,19]}},"binds":[{"annotation":{"meta":null,"sourceSpan":{"end":[225,33],"start":[225,1]}},"bindType":"NonRec","expression":{"abstraction":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[230,12],"start":[230,10]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[18,20],"name":"tests/purus/passing/Misc/Lib.purs","start":[18,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":50,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Lib"],"Eq$Dict"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[18,20],"name":"tests/purus/passing/Misc/Lib.purs","start":[18,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[19,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[19,9]},[]],"contents":[{"annotation":[{"end":[19,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[19,9]},[]],"contents":[{"annotation":[{"end":[19,13],"name":"tests/purus/passing/Misc/Lib.purs","start":[19,11]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[19,10],"name":"tests/purus/passing/Misc/Lib.purs","start":[19,9]},[]],"contents":{"kind":{"annotation":[{"end":[18,20],"name":"tests/purus/passing/Misc/Lib.purs","start":[18,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[19,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[19,14]},[]],"contents":[{"annotation":[{"end":[19,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[19,14]},[]],"contents":[{"annotation":[{"end":[19,18],"name":"tests/purus/passing/Misc/Lib.purs","start":[19,16]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[19,15],"name":"tests/purus/passing/Misc/Lib.purs","start":[19,14]},[]],"contents":{"kind":{"annotation":[{"end":[18,20],"name":"tests/purus/passing/Misc/Lib.purs","start":[18,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[19,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[19,19]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarVisible"},"tag":"ForAll"},"value":{"identifier":"eq","moduleName":["Lib"]}},"annotation":{"meta":null,"sourceSpan":{"end":[230,14],"start":[230,10]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Lib"],"Eq$Dict"],"tag":"TypeConstructor"},{"annotation":[{"end":[24,16],"name":"tests/purus/passing/Misc/Lib.purs","start":[24,13]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"eqInt","moduleName":["Lib"]}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[230,14],"start":[230,10]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[230,14],"start":[230,13]}},"kind":"Var","type":{"annotation":[{"end":[225,19],"name":"tests/purus/passing/Misc/Lib.purs","start":[225,16]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"identifier":"y","sourcePos":[227,3]}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[230,26],"start":[230,10]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[230,26],"start":[230,15]}},"kind":"Var","type":{"annotation":[{"end":[126,19],"name":"tests/purus/passing/Misc/Lib.purs","start":[126,16]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"identifier":"nestedBinds","moduleName":["Lib"]}},"kind":"App"},"identifier":"v4"}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[231,12],"start":[226,19]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"binderType":"ConstructorBinder","binders":[],"constructorName":{"identifier":"True","moduleName":["Prim"]},"typeName":{"identifier":"Boolean","moduleName":["Prim"]}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[230,31],"start":[230,30]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"literalType":"IntLiteral","value":2}},"isGuarded":false},{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[231,12],"start":[226,19]}},"binderType":"NullBinder"}],"expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[225,33],"start":[225,1]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"$28","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[225,33],"name":"tests/purus/passing/Misc/Lib.purs","start":[225,1]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"$28"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[225,33],"name":"tests/purus/passing/Misc/Lib.purs","start":[225,30]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"v","sourcePos":[0,0]}},"annotation":{"meta":null,"sourceSpan":{"end":[231,12],"start":[226,19]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"},"value":{"identifier":"True","moduleName":["Prim"]}},"kind":"App"},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[225,33],"start":[225,1]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"},"value":{"identifier":"v4","sourcePos":[0,0]}}],"kind":"Case","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}},"kind":"Let"},"isGuarded":false},{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[231,12],"start":[226,19]}},"binderType":"NullBinder"}],"expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[225,33],"start":[225,1]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"$28","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[225,33],"name":"tests/purus/passing/Misc/Lib.purs","start":[225,1]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"$28"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[225,33],"name":"tests/purus/passing/Misc/Lib.purs","start":[225,30]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"v","sourcePos":[0,0]}},"annotation":{"meta":null,"sourceSpan":{"end":[231,12],"start":[226,19]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"},"value":{"identifier":"True","moduleName":["Prim"]}},"kind":"App"},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[225,33],"start":[225,1]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"},"value":{"identifier":"v3","sourcePos":[0,0]}}],"kind":"Case","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}},"kind":"Let"},"isGuarded":false},{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[231,12],"start":[226,19]}},"binderType":"NullBinder"}],"expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[225,33],"start":[225,1]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"$28","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[225,33],"name":"tests/purus/passing/Misc/Lib.purs","start":[225,1]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"$28"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[225,33],"name":"tests/purus/passing/Misc/Lib.purs","start":[225,30]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"v","sourcePos":[0,0]}},"annotation":{"meta":null,"sourceSpan":{"end":[231,12],"start":[226,19]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"},"value":{"identifier":"True","moduleName":["Prim"]}},"kind":"App"},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[225,33],"start":[225,1]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"},"value":{"identifier":"v2","sourcePos":[0,0]}}],"kind":"Case","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}},"kind":"Let"},"isGuarded":false},{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[231,12],"start":[226,19]}},"binderType":"NullBinder"}],"expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[225,33],"start":[225,1]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"$28","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[225,33],"name":"tests/purus/passing/Misc/Lib.purs","start":[225,1]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"$28"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[225,33],"name":"tests/purus/passing/Misc/Lib.purs","start":[225,30]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"v","sourcePos":[0,0]}},"annotation":{"meta":null,"sourceSpan":{"end":[231,12],"start":[226,19]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"},"value":{"identifier":"True","moduleName":["Prim"]}},"kind":"App"},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[225,33],"start":[225,1]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"},"value":{"identifier":"v1","sourcePos":[0,0]}}],"kind":"Case","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}},"kind":"Let"},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[226,25],"start":[226,24]}},"kind":"Var","type":{"annotation":[{"end":[225,19],"name":"tests/purus/passing/Misc/Lib.purs","start":[225,16]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"identifier":"w","sourcePos":[226,1]}},{"annotation":{"meta":null,"sourceSpan":{"end":[226,28],"start":[226,27]}},"kind":"Var","type":{"annotation":[{"end":[225,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[225,23]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"identifier":"x","sourcePos":[226,1]}}],"kind":"Case","type":{"annotation":[{"end":[225,33],"name":"tests/purus/passing/Misc/Lib.purs","start":[225,30]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}},"kind":"Let"},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[225,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[225,23]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[225,33],"name":"tests/purus/passing/Misc/Lib.purs","start":[225,30]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[225,19],"name":"tests/purus/passing/Misc/Lib.purs","start":[225,16]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[225,33],"name":"tests/purus/passing/Misc/Lib.purs","start":[225,23]},[]],"contents":[{"annotation":[{"end":[225,33],"name":"tests/purus/passing/Misc/Lib.purs","start":[225,23]},[]],"contents":[{"annotation":[{"end":[225,29],"name":"tests/purus/passing/Misc/Lib.purs","start":[225,27]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[225,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[225,23]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[225,33],"name":"tests/purus/passing/Misc/Lib.purs","start":[225,30]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"identifier":"guardedCase"},{"annotation":{"meta":null,"sourceSpan":{"end":[168,19],"start":[168,1]}},"bindType":"NonRec","expression":{"abstraction":{"abstraction":{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[169,14],"start":[169,10]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"x","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":60,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"x"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"x"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"x"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"Cons","moduleName":["Prim"]}},"annotation":{"meta":null,"sourceSpan":{"end":[169,16],"start":[169,10]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[169,16],"start":[169,15]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"literalType":"IntLiteral","value":1}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[169,29],"start":[169,10]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[169,22],"start":[169,18]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"x","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":61,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"x"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"x"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"x"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"Cons","moduleName":["Prim"]}},"annotation":{"meta":null,"sourceSpan":{"end":[169,24],"start":[169,18]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[169,24],"start":[169,23]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"literalType":"IntLiteral","value":2}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[169,28],"start":[169,18]}},"argument":{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[169,28],"start":[169,25]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"Nil","moduleName":["Prim"]}},"kind":"App"},"kind":"App"},"identifier":"aList2"},{"annotation":{"meta":null,"sourceSpan":{"end":[165,18],"start":[165,1]}},"bindType":"NonRec","expression":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"x","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"x"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"x"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"x"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"Cons","moduleName":["Prim"]}},"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[166,11],"start":[166,10]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"literalType":"IntLiteral","value":1}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"x","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"x"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"x"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"x"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"Cons","moduleName":["Prim"]}},"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[166,13],"start":[166,12]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"literalType":"IntLiteral","value":2}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"x","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"x"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"x"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"x"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"Cons","moduleName":["Prim"]}},"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[166,15],"start":[166,14]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"literalType":"IntLiteral","value":3}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"x","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"x"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"x"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"x"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"Cons","moduleName":["Prim"]}},"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[166,17],"start":[166,16]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"literalType":"IntLiteral","value":4}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"x","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"x"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"x"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"x"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"Cons","moduleName":["Prim"]}},"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[166,19],"start":[166,18]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"literalType":"IntLiteral","value":5}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[165,18],"name":"tests/purus/passing/Misc/Lib.purs","start":[165,15]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"Nil","moduleName":["Prim"]}},"kind":"App"},"kind":"App"},"kind":"App"},"kind":"App"},"kind":"App"},"identifier":"aList"},{"annotation":{"meta":null,"sourceSpan":{"end":[182,60],"start":[182,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[183,19],"start":[183,1]}},"argument":"r","body":{"annotation":{"meta":null,"sourceSpan":{"end":[183,19],"start":[183,16]}},"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[183,17],"start":[183,16]}},"kind":"Var","type":{"annotation":[{"end":[182,53],"name":"tests/purus/passing/Misc/Lib.purs","start":[182,39]},[]],"contents":[{"annotation":[{"end":[182,40],"name":"tests/purus/passing/Misc/Lib.purs","start":[182,39]},[]],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[{"end":[182,48],"name":"tests/purus/passing/Misc/Lib.purs","start":[182,40]},[]],"contents":["a",{"annotation":[{"end":[182,48],"name":"tests/purus/passing/Misc/Lib.purs","start":[182,45]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},{"annotation":[{"end":[182,52],"name":"tests/purus/passing/Misc/Lib.purs","start":[182,51]},[]],"contents":{"kind":{"annotation":[{"end":[182,36],"name":"tests/purus/passing/Misc/Lib.purs","start":[182,28]},[]],"contents":[{"annotation":[{"end":[182,31],"name":"tests/purus/passing/Misc/Lib.purs","start":[182,28]},[]],"contents":[["Prim"],"Row"],"tag":"TypeConstructor"},{"annotation":[{"end":[182,36],"name":"tests/purus/passing/Misc/Lib.purs","start":[182,32]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"var":"r"},"tag":"TypeVar"}],"tag":"RCons"}],"tag":"TypeApp"},"value":{"identifier":"r","sourcePos":[183,1]}},"fieldName":"a","kind":"Accessor","type":{"annotation":[{"end":[182,60],"name":"tests/purus/passing/Misc/Lib.purs","start":[182,57]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}},"kind":"Abs","type":{"annotation":[{"end":[182,60],"name":"tests/purus/passing/Misc/Lib.purs","start":[182,15]},[]],"contents":{"identifier":"r","kind":{"annotation":[{"end":[182,36],"name":"tests/purus/passing/Misc/Lib.purs","start":[182,28]},[]],"contents":[{"annotation":[{"end":[182,31],"name":"tests/purus/passing/Misc/Lib.purs","start":[182,28]},[]],"contents":[["Prim"],"Row"],"tag":"TypeConstructor"},{"annotation":[{"end":[182,36],"name":"tests/purus/passing/Misc/Lib.purs","start":[182,32]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"skolem":63,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[182,53],"name":"tests/purus/passing/Misc/Lib.purs","start":[182,39]},[]],"contents":[{"annotation":[{"end":[182,40],"name":"tests/purus/passing/Misc/Lib.purs","start":[182,39]},[]],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[{"end":[182,48],"name":"tests/purus/passing/Misc/Lib.purs","start":[182,40]},[]],"contents":["a",{"annotation":[{"end":[182,48],"name":"tests/purus/passing/Misc/Lib.purs","start":[182,45]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},{"annotation":[{"end":[182,52],"name":"tests/purus/passing/Misc/Lib.purs","start":[182,51]},[]],"contents":{"kind":{"annotation":[{"end":[182,36],"name":"tests/purus/passing/Misc/Lib.purs","start":[182,28]},[]],"contents":[{"annotation":[{"end":[182,31],"name":"tests/purus/passing/Misc/Lib.purs","start":[182,28]},[]],"contents":[["Prim"],"Row"],"tag":"TypeConstructor"},{"annotation":[{"end":[182,36],"name":"tests/purus/passing/Misc/Lib.purs","start":[182,32]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"var":"r"},"tag":"TypeVar"}],"tag":"RCons"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[182,60],"name":"tests/purus/passing/Misc/Lib.purs","start":[182,57]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"identifier":"aFunction4"},{"annotation":{"meta":null,"sourceSpan":{"end":[185,18],"start":[185,1]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[186,24],"start":[186,14]}},"kind":"Var","type":{"annotation":[{"end":[182,60],"name":"tests/purus/passing/Misc/Lib.purs","start":[182,15]},[]],"contents":{"identifier":"r","kind":{"annotation":[{"end":[182,36],"name":"tests/purus/passing/Misc/Lib.purs","start":[182,28]},[]],"contents":[{"annotation":[{"end":[182,31],"name":"tests/purus/passing/Misc/Lib.purs","start":[182,28]},[]],"contents":[["Prim"],"Row"],"tag":"TypeConstructor"},{"annotation":[{"end":[182,36],"name":"tests/purus/passing/Misc/Lib.purs","start":[182,32]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"skolem":63,"type":{"annotation":[{"end":[182,60],"name":"tests/purus/passing/Misc/Lib.purs","start":[182,39]},[]],"contents":[{"annotation":[{"end":[182,60],"name":"tests/purus/passing/Misc/Lib.purs","start":[182,39]},[]],"contents":[{"annotation":[{"end":[182,56],"name":"tests/purus/passing/Misc/Lib.purs","start":[182,54]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[182,53],"name":"tests/purus/passing/Misc/Lib.purs","start":[182,39]},[]],"contents":[{"annotation":[{"end":[182,40],"name":"tests/purus/passing/Misc/Lib.purs","start":[182,39]},[]],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[{"end":[182,48],"name":"tests/purus/passing/Misc/Lib.purs","start":[182,40]},[]],"contents":["a",{"annotation":[{"end":[182,48],"name":"tests/purus/passing/Misc/Lib.purs","start":[182,45]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},{"annotation":[{"end":[182,52],"name":"tests/purus/passing/Misc/Lib.purs","start":[182,51]},[]],"contents":{"kind":{"annotation":[{"end":[182,36],"name":"tests/purus/passing/Misc/Lib.purs","start":[182,28]},[]],"contents":[{"annotation":[{"end":[182,31],"name":"tests/purus/passing/Misc/Lib.purs","start":[182,28]},[]],"contents":[["Prim"],"Row"],"tag":"TypeConstructor"},{"annotation":[{"end":[182,36],"name":"tests/purus/passing/Misc/Lib.purs","start":[182,32]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"var":"r"},"tag":"TypeVar"}],"tag":"RCons"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[182,60],"name":"tests/purus/passing/Misc/Lib.purs","start":[182,57]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"aFunction4","moduleName":["Lib"]}},"annotation":{"meta":null,"sourceSpan":{"end":[186,31],"start":[186,14]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[186,31],"start":[186,25]}},"kind":"Literal","type":{"annotation":[{"end":[182,53],"name":"tests/purus/passing/Misc/Lib.purs","start":[182,39]},[]],"contents":[{"annotation":[{"end":[182,40],"name":"tests/purus/passing/Misc/Lib.purs","start":[182,39]},[]],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[{"end":[182,48],"name":"tests/purus/passing/Misc/Lib.purs","start":[182,40]},[]],"contents":["a",{"annotation":[{"end":[182,48],"name":"tests/purus/passing/Misc/Lib.purs","start":[182,45]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"tag":"REmpty"},{"annotation":[{"end":[182,36],"name":"tests/purus/passing/Misc/Lib.purs","start":[182,32]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"KindApp"}],"tag":"RCons"}],"tag":"TypeApp"},"value":{"literalType":"ObjectLiteral","value":[["a",{"annotation":{"meta":null,"sourceSpan":{"end":[186,30],"start":[186,29]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"literalType":"IntLiteral","value":2}}]]}},"kind":"App"},"identifier":"aFunction5"},{"annotation":{"meta":null,"sourceSpan":{"end":[205,39],"start":[205,1]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[205,18],"start":[205,8]}},"kind":"Var","type":{"annotation":[{"end":[182,60],"name":"tests/purus/passing/Misc/Lib.purs","start":[182,15]},[]],"contents":{"identifier":"r","kind":{"annotation":[{"end":[182,36],"name":"tests/purus/passing/Misc/Lib.purs","start":[182,28]},[]],"contents":[{"annotation":[{"end":[182,31],"name":"tests/purus/passing/Misc/Lib.purs","start":[182,28]},[]],"contents":[["Prim"],"Row"],"tag":"TypeConstructor"},{"annotation":[{"end":[182,36],"name":"tests/purus/passing/Misc/Lib.purs","start":[182,32]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"skolem":63,"type":{"annotation":[{"end":[182,60],"name":"tests/purus/passing/Misc/Lib.purs","start":[182,39]},[]],"contents":[{"annotation":[{"end":[182,60],"name":"tests/purus/passing/Misc/Lib.purs","start":[182,39]},[]],"contents":[{"annotation":[{"end":[182,56],"name":"tests/purus/passing/Misc/Lib.purs","start":[182,54]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[182,53],"name":"tests/purus/passing/Misc/Lib.purs","start":[182,39]},[]],"contents":[{"annotation":[{"end":[182,40],"name":"tests/purus/passing/Misc/Lib.purs","start":[182,39]},[]],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[{"end":[182,48],"name":"tests/purus/passing/Misc/Lib.purs","start":[182,40]},[]],"contents":["a",{"annotation":[{"end":[182,48],"name":"tests/purus/passing/Misc/Lib.purs","start":[182,45]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},{"annotation":[{"end":[182,52],"name":"tests/purus/passing/Misc/Lib.purs","start":[182,51]},[]],"contents":{"kind":{"annotation":[{"end":[182,36],"name":"tests/purus/passing/Misc/Lib.purs","start":[182,28]},[]],"contents":[{"annotation":[{"end":[182,31],"name":"tests/purus/passing/Misc/Lib.purs","start":[182,28]},[]],"contents":[["Prim"],"Row"],"tag":"TypeConstructor"},{"annotation":[{"end":[182,36],"name":"tests/purus/passing/Misc/Lib.purs","start":[182,32]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"var":"r"},"tag":"TypeVar"}],"tag":"RCons"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[182,60],"name":"tests/purus/passing/Misc/Lib.purs","start":[182,57]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"aFunction4","moduleName":["Lib"]}},"annotation":{"meta":null,"sourceSpan":{"end":[205,39],"start":[205,8]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[205,39],"start":[205,19]}},"kind":"Literal","type":{"annotation":[{"end":[182,53],"name":"tests/purus/passing/Misc/Lib.purs","start":[182,39]},[]],"contents":[{"annotation":[{"end":[182,40],"name":"tests/purus/passing/Misc/Lib.purs","start":[182,39]},[]],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[{"end":[182,48],"name":"tests/purus/passing/Misc/Lib.purs","start":[182,40]},[]],"contents":["a",{"annotation":[{"end":[182,48],"name":"tests/purus/passing/Misc/Lib.purs","start":[182,45]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["b",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"String"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"tag":"REmpty"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"KindApp"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"TypeApp"},"value":{"literalType":"ObjectLiteral","value":[["b",{"annotation":{"meta":null,"sourceSpan":{"end":[205,38],"start":[205,31]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"String"],"tag":"TypeConstructor"},"value":{"literalType":"StringLiteral","value":"hello"}}],["a",{"annotation":{"meta":null,"sourceSpan":{"end":[205,26],"start":[205,23]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"literalType":"IntLiteral","value":101}}]]}},"kind":"App"},"identifier":"main"},{"annotation":{"meta":null,"sourceSpan":{"end":[179,25],"start":[179,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[180,41],"start":[180,1]}},"argument":"x","body":{"annotation":{"meta":null,"sourceSpan":{"end":[180,41],"start":[180,16]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"binderType":"ConstructorBinder","binders":[],"constructorName":{"identifier":"True","moduleName":["Prim"]},"typeName":{"identifier":"Boolean","moduleName":["Prim"]}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[180,34],"start":[180,33]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"literalType":"IntLiteral","value":4}},"isGuarded":false},{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[180,41],"start":[180,16]}},"binderType":"NullBinder"}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[180,41],"start":[180,40]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"literalType":"IntLiteral","value":1}},"isGuarded":false}],"caseExpressions":[{"abstraction":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[180,22],"start":[180,20]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[18,20],"name":"tests/purus/passing/Misc/Lib.purs","start":[18,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":50,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Lib"],"Eq$Dict"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[18,20],"name":"tests/purus/passing/Misc/Lib.purs","start":[18,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[19,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[19,9]},[]],"contents":[{"annotation":[{"end":[19,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[19,9]},[]],"contents":[{"annotation":[{"end":[19,13],"name":"tests/purus/passing/Misc/Lib.purs","start":[19,11]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[19,10],"name":"tests/purus/passing/Misc/Lib.purs","start":[19,9]},[]],"contents":{"kind":{"annotation":[{"end":[18,20],"name":"tests/purus/passing/Misc/Lib.purs","start":[18,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[19,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[19,14]},[]],"contents":[{"annotation":[{"end":[19,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[19,14]},[]],"contents":[{"annotation":[{"end":[19,18],"name":"tests/purus/passing/Misc/Lib.purs","start":[19,16]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[19,15],"name":"tests/purus/passing/Misc/Lib.purs","start":[19,14]},[]],"contents":{"kind":{"annotation":[{"end":[18,20],"name":"tests/purus/passing/Misc/Lib.purs","start":[18,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[19,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[19,19]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarVisible"},"tag":"ForAll"},"value":{"identifier":"eq","moduleName":["Lib"]}},"annotation":{"meta":null,"sourceSpan":{"end":[180,24],"start":[180,20]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Lib"],"Eq$Dict"],"tag":"TypeConstructor"},{"annotation":[{"end":[24,16],"name":"tests/purus/passing/Misc/Lib.purs","start":[24,13]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"eqInt","moduleName":["Lib"]}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[180,24],"start":[180,20]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[180,24],"start":[180,23]}},"kind":"Var","type":{"annotation":[{"end":[179,18],"name":"tests/purus/passing/Misc/Lib.purs","start":[179,15]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"identifier":"x","sourcePos":[180,1]}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[180,26],"start":[180,20]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[180,26],"start":[180,25]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"literalType":"IntLiteral","value":2}},"kind":"App"}],"kind":"Case","type":{"annotation":[{"end":[179,25],"name":"tests/purus/passing/Misc/Lib.purs","start":[179,22]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[179,18],"name":"tests/purus/passing/Misc/Lib.purs","start":[179,15]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[179,25],"name":"tests/purus/passing/Misc/Lib.purs","start":[179,22]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"identifier":"aFunction3"},{"annotation":{"meta":null,"sourceSpan":{"end":[176,30],"start":[176,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[177,21],"start":[177,1]}},"argument":"x","body":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"x","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"x"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"x"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"x"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"Cons","moduleName":["Prim"]}},"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[177,18],"start":[177,17]}},"kind":"Var","type":{"annotation":[{"end":[176,18],"name":"tests/purus/passing/Misc/Lib.purs","start":[176,15]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"identifier":"x","sourcePos":[177,1]}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"x","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"x"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"x"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"x"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"Cons","moduleName":["Prim"]}},"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[177,20],"start":[177,19]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"literalType":"IntLiteral","value":1}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[176,30],"name":"tests/purus/passing/Misc/Lib.purs","start":[176,27]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"Nil","moduleName":["Prim"]}},"kind":"App"},"kind":"App"},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[176,18],"name":"tests/purus/passing/Misc/Lib.purs","start":[176,15]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[176,30],"name":"tests/purus/passing/Misc/Lib.purs","start":[176,22]},[]],"contents":[{"annotation":[{"end":[176,26],"name":"tests/purus/passing/Misc/Lib.purs","start":[176,22]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[176,30],"name":"tests/purus/passing/Misc/Lib.purs","start":[176,27]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"identifier":"aFunction2"},{"annotation":{"meta":null,"sourceSpan":{"end":[173,76],"start":[173,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[174,24],"start":[174,1]}},"argument":"any","body":{"annotation":{"meta":null,"sourceSpan":{"end":[174,24],"start":[174,1]}},"argument":"f","body":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[174,20],"start":[174,19]}},"kind":"Var","type":{"annotation":[{"end":[173,68],"name":"tests/purus/passing/Misc/Lib.purs","start":[173,40]},[]],"contents":{"identifier":"y","kind":{"annotation":[{"end":[173,57],"name":"tests/purus/passing/Misc/Lib.purs","start":[173,53]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":65,"type":{"annotation":[{"end":[173,68],"name":"tests/purus/passing/Misc/Lib.purs","start":[173,60]},[]],"contents":[{"annotation":[{"end":[173,68],"name":"tests/purus/passing/Misc/Lib.purs","start":[173,60]},[]],"contents":[{"annotation":[{"end":[173,64],"name":"tests/purus/passing/Misc/Lib.purs","start":[173,62]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[173,61],"name":"tests/purus/passing/Misc/Lib.purs","start":[173,60]},[]],"contents":{"kind":{"annotation":[{"end":[173,57],"name":"tests/purus/passing/Misc/Lib.purs","start":[173,53]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"y"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[173,68],"name":"tests/purus/passing/Misc/Lib.purs","start":[173,65]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"f","sourcePos":[174,1]}},"annotation":{"meta":null,"sourceSpan":{"end":[174,24],"start":[174,19]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[174,24],"start":[174,21]}},"kind":"Var","type":{"annotation":[{"end":[173,35],"name":"tests/purus/passing/Misc/Lib.purs","start":[173,34]},[]],"contents":{"kind":{"annotation":[{"end":[173,31],"name":"tests/purus/passing/Misc/Lib.purs","start":[173,27]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"x"},"tag":"TypeVar"},"value":{"identifier":"any","sourcePos":[174,1]}},"kind":"App"},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[173,68],"name":"tests/purus/passing/Misc/Lib.purs","start":[173,40]},[]],"contents":{"identifier":"y","kind":{"annotation":[{"end":[173,57],"name":"tests/purus/passing/Misc/Lib.purs","start":[173,53]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":65,"type":{"annotation":[{"end":[173,68],"name":"tests/purus/passing/Misc/Lib.purs","start":[173,60]},[]],"contents":[{"annotation":[{"end":[173,68],"name":"tests/purus/passing/Misc/Lib.purs","start":[173,60]},[]],"contents":[{"annotation":[{"end":[173,64],"name":"tests/purus/passing/Misc/Lib.purs","start":[173,62]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[173,61],"name":"tests/purus/passing/Misc/Lib.purs","start":[173,60]},[]],"contents":{"kind":{"annotation":[{"end":[173,57],"name":"tests/purus/passing/Misc/Lib.purs","start":[173,53]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"y"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[173,68],"name":"tests/purus/passing/Misc/Lib.purs","start":[173,65]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}],"tag":"TypeApp"},{"annotation":[{"end":[173,76],"name":"tests/purus/passing/Misc/Lib.purs","start":[173,73]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"kind":"Abs","type":{"annotation":[{"end":[173,76],"name":"tests/purus/passing/Misc/Lib.purs","start":[173,14]},[]],"contents":{"identifier":"x","kind":{"annotation":[{"end":[173,31],"name":"tests/purus/passing/Misc/Lib.purs","start":[173,27]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":66,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[173,35],"name":"tests/purus/passing/Misc/Lib.purs","start":[173,34]},[]],"contents":{"kind":{"annotation":[{"end":[173,31],"name":"tests/purus/passing/Misc/Lib.purs","start":[173,27]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"x"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[173,76],"name":"tests/purus/passing/Misc/Lib.purs","start":[173,39]},[]],"contents":[{"annotation":[{"end":[173,76],"name":"tests/purus/passing/Misc/Lib.purs","start":[173,39]},[]],"contents":[{"annotation":[{"end":[173,72],"name":"tests/purus/passing/Misc/Lib.purs","start":[173,70]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[173,68],"name":"tests/purus/passing/Misc/Lib.purs","start":[173,40]},[]],"contents":{"identifier":"y","kind":{"annotation":[{"end":[173,57],"name":"tests/purus/passing/Misc/Lib.purs","start":[173,53]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":65,"type":{"annotation":[{"end":[173,68],"name":"tests/purus/passing/Misc/Lib.purs","start":[173,60]},[]],"contents":[{"annotation":[{"end":[173,68],"name":"tests/purus/passing/Misc/Lib.purs","start":[173,60]},[]],"contents":[{"annotation":[{"end":[173,64],"name":"tests/purus/passing/Misc/Lib.purs","start":[173,62]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[173,61],"name":"tests/purus/passing/Misc/Lib.purs","start":[173,60]},[]],"contents":{"kind":{"annotation":[{"end":[173,57],"name":"tests/purus/passing/Misc/Lib.purs","start":[173,53]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"y"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[173,68],"name":"tests/purus/passing/Misc/Lib.purs","start":[173,65]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}],"tag":"TypeApp"},{"annotation":[{"end":[173,76],"name":"tests/purus/passing/Misc/Lib.purs","start":[173,73]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"identifier":"aFunction"},{"annotation":{"meta":null,"sourceSpan":{"end":[188,18],"start":[188,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":{"metaType":"IsWhere"},"sourceSpan":{"end":[189,29],"start":[189,14]}},"binds":[{"annotation":{"meta":null,"sourceSpan":{"end":[191,39],"start":[191,5]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[192,14],"start":[192,5]}},"argument":"v","body":{"annotation":{"meta":null,"sourceSpan":{"end":[192,14],"start":[192,12]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"literalType":"IntLiteral","value":10}},"kind":"Abs","type":{"annotation":[{"end":[191,39],"name":"tests/purus/passing/Misc/Lib.purs","start":[191,11]},[]],"contents":{"identifier":"z","kind":{"annotation":[{"end":[191,28],"name":"tests/purus/passing/Misc/Lib.purs","start":[191,24]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":69,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[191,32],"name":"tests/purus/passing/Misc/Lib.purs","start":[191,31]},[]],"contents":{"kind":{"annotation":[{"end":[191,28],"name":"tests/purus/passing/Misc/Lib.purs","start":[191,24]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"z"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[191,39],"name":"tests/purus/passing/Misc/Lib.purs","start":[191,36]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"identifier":"go"}],"expression":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[189,23],"start":[189,14]}},"kind":"Var","type":{"annotation":[{"end":[173,76],"name":"tests/purus/passing/Misc/Lib.purs","start":[173,14]},[]],"contents":{"identifier":"x","kind":{"annotation":[{"end":[173,31],"name":"tests/purus/passing/Misc/Lib.purs","start":[173,27]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":66,"type":{"annotation":[{"end":[173,76],"name":"tests/purus/passing/Misc/Lib.purs","start":[173,34]},[]],"contents":[{"annotation":[{"end":[173,76],"name":"tests/purus/passing/Misc/Lib.purs","start":[173,34]},[]],"contents":[{"annotation":[{"end":[173,38],"name":"tests/purus/passing/Misc/Lib.purs","start":[173,36]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[173,35],"name":"tests/purus/passing/Misc/Lib.purs","start":[173,34]},[]],"contents":{"kind":{"annotation":[{"end":[173,31],"name":"tests/purus/passing/Misc/Lib.purs","start":[173,27]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"x"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[173,76],"name":"tests/purus/passing/Misc/Lib.purs","start":[173,39]},[]],"contents":[{"annotation":[{"end":[173,76],"name":"tests/purus/passing/Misc/Lib.purs","start":[173,39]},[]],"contents":[{"annotation":[{"end":[173,72],"name":"tests/purus/passing/Misc/Lib.purs","start":[173,70]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[173,68],"name":"tests/purus/passing/Misc/Lib.purs","start":[173,40]},[]],"contents":{"identifier":"y","kind":{"annotation":[{"end":[173,57],"name":"tests/purus/passing/Misc/Lib.purs","start":[173,53]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":65,"type":{"annotation":[{"end":[173,68],"name":"tests/purus/passing/Misc/Lib.purs","start":[173,60]},[]],"contents":[{"annotation":[{"end":[173,68],"name":"tests/purus/passing/Misc/Lib.purs","start":[173,60]},[]],"contents":[{"annotation":[{"end":[173,64],"name":"tests/purus/passing/Misc/Lib.purs","start":[173,62]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[173,61],"name":"tests/purus/passing/Misc/Lib.purs","start":[173,60]},[]],"contents":{"kind":{"annotation":[{"end":[173,57],"name":"tests/purus/passing/Misc/Lib.purs","start":[173,53]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"y"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[173,68],"name":"tests/purus/passing/Misc/Lib.purs","start":[173,65]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}],"tag":"TypeApp"},{"annotation":[{"end":[173,76],"name":"tests/purus/passing/Misc/Lib.purs","start":[173,73]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"aFunction","moduleName":["Lib"]}},"annotation":{"meta":null,"sourceSpan":{"end":[189,26],"start":[189,14]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":192,"tag":"TUnknown"}],"tag":"TypeApp"},"value":{"identifier":"Nil","moduleName":["Prim"]}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[189,29],"start":[189,14]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[189,29],"start":[189,27]}},"kind":"Var","type":{"annotation":[{"end":[191,39],"name":"tests/purus/passing/Misc/Lib.purs","start":[191,11]},[]],"contents":{"identifier":"z","kind":{"annotation":[{"end":[191,28],"name":"tests/purus/passing/Misc/Lib.purs","start":[191,24]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":69,"type":{"annotation":[{"end":[191,39],"name":"tests/purus/passing/Misc/Lib.purs","start":[191,31]},[]],"contents":[{"annotation":[{"end":[191,39],"name":"tests/purus/passing/Misc/Lib.purs","start":[191,31]},[]],"contents":[{"annotation":[{"end":[191,35],"name":"tests/purus/passing/Misc/Lib.purs","start":[191,33]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[191,32],"name":"tests/purus/passing/Misc/Lib.purs","start":[191,31]},[]],"contents":{"kind":{"annotation":[{"end":[191,28],"name":"tests/purus/passing/Misc/Lib.purs","start":[191,24]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"z"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[191,39],"name":"tests/purus/passing/Misc/Lib.purs","start":[191,36]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"go","sourcePos":[191,5]}},"kind":"App"},"kind":"Let"},"identifier":"aFunction6"},{"annotation":{"meta":null,"sourceSpan":{"end":[162,17],"start":[162,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"},"value":{"identifier":"True","moduleName":["Prim"]}},"identifier":"aBool"}],"exports":["compare","eq","eq2","testMethod","testCons","testTestClass","minus","testEq","testTuple","workingEven","brokenEven","Some","Nada","opt2Int","testOpt2Int","Identitee","unIdentitee","testIdentitee","testEq2","ConInt","ConString","ConChar","ConNested","ConQuantified","ConConstrained","ConObject","ConObjectQuantified","testBinders","testBindersCase","mutuallyRecursiveBindingGroup","mutuallyRecursiveBindingGroupNoTypes","nestedBinds","ADataRec","ANewTypeRec","Constr1","Constr2","anIntLit","aStringLit","aVal","testasum","aBool","aList","aList2","aFunction","aFunction2","aFunction3","aFunction4","aFunction5","aFunction6","recF1","recG1","testBuiltin","main","plus","fakeLT","testPlus","guardedCase","nestedApplications","anObj","objUpdate","polyInObj","polyInObjMatch","aPred","cons","emptyList","consEmptyList1","consEmptyList2","id","testId","objForall","arrForall","testEqViaOrd","testValidator","testValidatorApplied","testForLift","testForLiftPoly","testForLiftPolyApplied","or","not","and","iff","ghcInlinerPaperEx","kozsTwoSCCEx","testLedgerTypes","litPattern","litPatternApplied","irrPattern","someData","someDataList","isNullSomeDataList","plutusIFTE","testClassInt","eqInt","eq2IntBoolean","ordInt"],"foreign":[],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[412,79],"start":[1,1]}},"moduleName":["Builtin"]},{"annotation":{"meta":null,"sourceSpan":{"end":[412,79],"start":[1,1]}},"moduleName":["Lib"]},{"annotation":{"meta":null,"sourceSpan":{"end":[412,79],"start":[1,1]}},"moduleName":["Prim"]}],"moduleName":["Lib"],"modulePath":"tests/purus/passing/Misc/Lib.purs","reExports":{},"sourceSpan":{"end":[412,79],"start":[1,1]}} \ No newline at end of file diff --git a/tests/purus/passing/Misc/output/Lib/Lib.cfn.pretty b/tests/purus/passing/Misc/output/Lib/Lib.cfn.pretty new file mode 100644 index 000000000..28db6889c --- /dev/null +++ b/tests/purus/passing/Misc/output/Lib/Lib.cfn.pretty @@ -0,0 +1,1025 @@ +Lib (tests/purus/passing/Misc/Lib.purs) + +Imported Modules: +------------------------------ + Builtin, + Lib, + Prim + +Exports: +------------------------------ + compare, + eq, + eq2, + testMethod, + testCons, + testTestClass, + minus, + testEq, + testTuple, + workingEven, + brokenEven, + Some, + Nada, + opt2Int, + testOpt2Int, + Identitee, + unIdentitee, + testIdentitee, + testEq2, + ConInt, + ConString, + ConChar, + ConNested, + ConQuantified, + ConConstrained, + ConObject, + ConObjectQuantified, + testBinders, + testBindersCase, + mutuallyRecursiveBindingGroup, + mutuallyRecursiveBindingGroupNoTypes, + nestedBinds, + ADataRec, + ANewTypeRec, + Constr1, + Constr2, + anIntLit, + aStringLit, + aVal, + testasum, + aBool, + aList, + aList2, + aFunction, + aFunction2, + aFunction3, + aFunction4, + aFunction5, + aFunction6, + recF1, + recG1, + testBuiltin, + main, + plus, + fakeLT, + testPlus, + guardedCase, + nestedApplications, + anObj, + objUpdate, + polyInObj, + polyInObjMatch, + aPred, + cons, + emptyList, + consEmptyList1, + consEmptyList2, + id, + testId, + objForall, + arrForall, + testEqViaOrd, + testValidator, + testValidatorApplied, + testForLift, + testForLiftPoly, + testForLiftPolyApplied, + or, + not, + and, + iff, + ghcInlinerPaperEx, + kozsTwoSCCEx, + testLedgerTypes, + litPattern, + litPatternApplied, + irrPattern, + someData, + someDataList, + isNullSomeDataList, + plutusIFTE, + testClassInt, + eqInt, + eq2IntBoolean, + ordInt + +Re-Exports: +------------------------------ + + +Foreign: +------------------------------ + + +Datatypes: +------------------------------ +data ADataRec = + ADataRec ({ hello :: Prim.Int, world :: Prim.Boolean }) + +newtype ANewtypeRec = + ANewTypeRec ({ foo :: Prim.Int }) + +data ASum = + Constr1 (Prim.Int) + | Constr2 (Prim.Boolean) + +newtype Eq$Dict (a :: Prim.Type) = + Eq$Dict ({ eq :: ((a :: Prim.Type) -> (((a :: Prim.Type) -> (Prim.Boolean)))) }) + +newtype Eq2$Dict (a :: Prim.Type) (b :: Prim.Type) = + Eq2$Dict ({ eq2 :: ((a :: Prim.Type) -> (((b :: Prim.Type) -> (Prim.Boolean)))) }) + +data Identitee (a :: Prim.Type) = + Identitee ((a :: Prim.Type)) + +data Option (a :: Prim.Type) = + Some ((a :: Prim.Type)) + | Nada + +newtype Ord$Dict (a :: Prim.Type) = + Ord$Dict ({ compare :: ((a :: Prim.Type) -> (((a :: Prim.Type) -> (Prim.Int)))), Eq0 :: ((Prim.Record ({})) -> ((Lib.Eq$Dict ((a :: Prim.Type))))) }) + +data TestBinderSum = + ConInt (Prim.Int) + | ConString (Prim.String) + | ConChar (Prim.Char) + | ConNested (Lib.TestBinderSum) + | ConQuantified (forall (x :: Prim.Type). ((x :: Prim.Type) -> (Prim.Int))) + | ConConstrained (forall (x :: Prim.Type). ((Lib.Eq$Dict ((x :: Prim.Type))) -> (((x :: Prim.Type) -> (Prim.Int))))) + | ConObject ({ objField :: Prim.Int }) + | ConObjectQuantified ({ objFieldQ :: forall (x :: Prim.Type). ((x :: Prim.Type) -> (Prim.Int)) }) + +newtype TestClass$Dict (a :: Prim.Type) = + TestClass$Dict ({ testMethod :: ((a :: Prim.Type) -> (Prim.Boolean)) }) + + +Declarations: +------------------------------ +testClassInt :: (Lib.TestClass$Dict (Prim.Int)) +testClassInt = + (TestClass$Dict: ({ testMethod :: (Prim.Int -> (Prim.Boolean)) } -> + ((Lib.TestClass$Dict (Prim.Int))))) + ({ + testMethod: \(x: Prim.Int) -> + (True: Prim.Boolean) + }: { testMethod :: (Prim.Int -> (Prim.Boolean)) }) + +eqInt :: (Lib.Eq$Dict (Prim.Int)) +eqInt = + (Eq$Dict: ({ eq :: (Prim.Int -> ((Prim.Int -> (Prim.Boolean)))) } -> + ((Lib.Eq$Dict (Prim.Int))))) + ({ + eq: \(v: Prim.Int) -> + \(v1: Prim.Int) -> + (True: Prim.Boolean) + }: { eq :: (Prim.Int -> ((Prim.Int -> (Prim.Boolean)))) }) + +ordInt :: (Lib.Ord$Dict (Prim.Int)) +ordInt = + (Ord$Dict: ({ + compare :: (Prim.Int -> ((Prim.Int -> (Prim.Int)))), + Eq0 :: ((Prim.Record ({}@Prim.Type)) -> + ((Lib.Eq$Dict (Prim.Int)))) + } -> + ((Lib.Ord$Dict (Prim.Int))))) + ({ + Eq0: \($__unused: (Prim.Record ({}@Prim.Type))) -> + (eqInt: (Lib.Eq$Dict (Prim.Int))), + compare: \(v: Prim.Int) -> + \(v1: Prim.Int) -> + (42: Prim.Int) + }: { + compare :: (Prim.Int -> ((Prim.Int -> (Prim.Int)))), + Eq0 :: ((Prim.Record ({}@Prim.Type)) -> ((Lib.Eq$Dict (Prim.Int)))) + }) + +eq2IntBoolean :: ((Lib.Eq2$Dict (Prim.Int)) (Prim.Boolean)) +eq2IntBoolean = + (Eq2$Dict: ({ eq2 :: (Prim.Int -> ((Prim.Boolean -> (Prim.Boolean)))) } -> + (((Lib.Eq2$Dict (Prim.Int)) (Prim.Boolean))))) + ({ + eq2: \(v: Prim.Int) -> + \(v1: Prim.Boolean) -> + (True: Prim.Boolean) + }: { eq2 :: (Prim.Int -> ((Prim.Boolean -> (Prim.Boolean)))) }) + +unIdentitee :: ((Lib.Identitee (Prim.Int)) -> (Prim.Int)) +unIdentitee = + \(v: (Lib.Identitee (Prim.Int))) -> + case (v: (Lib.Identitee (Prim.Int))) of + Identitee x -> (x: Prim.Int) + +testasum :: (Lib.ASum -> (Prim.Int)) +testasum = + \(x: Lib.ASum) -> + case (x: Lib.ASum) of + Constr1 y -> (1: Prim.Int) + Constr2 z -> (2: Prim.Int) + +testValidator :: forall (a :: Prim.Type) (b :: Prim.Type) (c :: Prim.Type). ((a :: Prim.Type) -> (((b :: Prim.Type) -> (((c :: Prim.Type) -> (Prim.Boolean)))))) +testValidator = + \(datum: (a :: Prim.Type)) -> + \(redeemer: (b :: Prim.Type)) -> + \(context: (c :: Prim.Type)) -> + (True: Prim.Boolean) + +testValidatorApplied :: Prim.Boolean +testValidatorApplied = + (testValidator: forall (a :: Prim.Type) + (b :: Prim.Type) + (c :: Prim.Type). ((a :: Prim.Type) -> + (((b :: Prim.Type) -> (((c :: Prim.Type) -> (Prim.Boolean))))))) + ("datum": Prim.String) + ("redeemer": Prim.String) + ("context": Prim.String) + +testTuple :: (((Prim.Tuple3 (Prim.Int)) (Prim.Int)) (Prim.Boolean)) +testTuple = + (Tuple3: forall (t1 :: Prim.Type) + (t2 :: Prim.Type) + (t3 :: Prim.Type). ((t1 :: Prim.Type) -> + (((t2 :: Prim.Type) -> + (((t3 :: Prim.Type) -> + ((((Prim.Tuple3 + ((t1 :: Prim.Type))) ((t2 :: Prim.Type))) ((t3 :: Prim.Type)))))))))) + (1: Prim.Int) + (2: Prim.Int) + (True: Prim.Boolean) + +testMethod :: forall (@a :: Prim.Type). ((Lib.TestClass$Dict ((a :: Prim.Type))) -> (((a :: Prim.Type) -> (Prim.Boolean)))) +testMethod = + \(dict: (Lib.TestClass$Dict ((a :: Prim.Type)))) -> + case (dict: (Lib.TestClass$Dict ((a :: Prim.Type)))) of + TestClass$Dict v -> + (v: { testMethod :: ((a :: Prim.Type) -> (Prim.Boolean)) }) + .testMethod + +testTestClass :: Prim.Boolean +testTestClass = + (testMethod: forall (@a :: Prim.Type). ((Lib.TestClass$Dict + ((a :: Prim.Type))) -> + (((a :: Prim.Type) -> (Prim.Boolean))))) + (testClassInt: (Lib.TestClass$Dict (Prim.Int))) + (3: Prim.Int) + +testLedgerTypes :: Prim.DCert +testLedgerTypes = (DCertMir: Prim.DCert) + +testIdentitee :: Prim.Int +testIdentitee = + (unIdentitee: ((Lib.Identitee (Prim.Int)) -> (Prim.Int))) + ((Identitee: forall (@a :: Prim.Type). ((a :: Prim.Type) -> + ((Lib.Identitee ((a :: Prim.Type)))))) + (101: Prim.Int)) + +testForLiftPoly :: forall (a :: Prim.Type). ((a :: Prim.Type) -> (Prim.Boolean)) +testForLiftPoly = + \(x: (a :: Prim.Type)) -> + let + q :: (a :: Prim.Type) + q = (x: (a :: Prim.Type)) + g :: (a*3 -> (Prim.Boolean)) + g = \(y: a*3) -> (True: Prim.Boolean) + j :: (a*3 -> ((Prim.Boolean -> (Prim.Boolean)))) + j = + \(c: a*3) -> + \(d: Prim.Boolean) -> + case (d: Prim.Boolean) of + True -> (d: Prim.Boolean) + _ -> (g: (a*3 -> (Prim.Boolean))) (c: a*3) + h :: (a*3 -> ((Prim.Boolean -> (Prim.Boolean)))) + h = + \(a: a*3) -> + \(b: Prim.Boolean) -> + let + i :: forall (b :: Prim.Type). ((b :: Prim.Type) -> (Prim.Boolean)) + i = \(z: (b :: Prim.Type)) -> (False: Prim.Boolean) + in case ((g: (a*3 -> (Prim.Boolean))) (a: a*3)) of + True -> + (i: forall (b :: Prim.Type). ((b :: Prim.Type) -> + (Prim.Boolean))) + (q: a*3) + _ -> + (j: (a*3 -> ((Prim.Boolean -> (Prim.Boolean))))) + (a: a*3) + (b: Prim.Boolean) + in (h: (a*3 -> ((Prim.Boolean -> (Prim.Boolean))))) + (x: (a :: Prim.Type)) + (True: Prim.Boolean) + +testForLiftPolyApplied :: Prim.Boolean +testForLiftPolyApplied = + (testForLiftPoly: forall (a :: Prim.Type). ((a :: Prim.Type) -> + (Prim.Boolean))) + ("hello": Prim.String) + +testCons :: List (Prim.Int) +testCons = + (Cons: forall (x :: Prim.Type). ((x :: Prim.Type) -> + ((List ((x :: Prim.Type)) -> (List ((x :: Prim.Type))))))) + (1: Prim.Int) + (Nil: List (Prim.Int)) + +testBuiltin :: Prim.Int +testBuiltin = + (addInteger: (Prim.Int -> ((Prim.Int -> (Prim.Int))))) + (1: Prim.Int) + (2: Prim.Int) + +testBinders :: (Lib.TestBinderSum -> (Prim.Int)) +testBinders = + \(x: Lib.TestBinderSum) -> + case (x: Lib.TestBinderSum) of + ConInt a -> (a: Prim.Int) + ConChar _ -> (5: Prim.Int) + ConNested conNest -> + case (conNest: Lib.TestBinderSum) of + ConInt n -> (n: Prim.Int) + _ -> (2: Prim.Int) + ConQuantified f -> + (f: forall (x :: Prim.Type). ((x :: Prim.Type) -> (Prim.Int))) + ("hello": Prim.String) + ConConstrained g -> + (g: forall (x :: Prim.Type). ((Lib.Eq$Dict ((x :: Prim.Type))) -> + (((x :: Prim.Type) -> (Prim.Int))))) + (eqInt: (Lib.Eq$Dict (Prim.Int))) + (2: Prim.Int) + ConNested other -> (7: Prim.Int) + ConObject obj -> (obj: { objField :: Prim.Int }).objField + ConObjectQuantified objQ -> + ((objQ: { + objFieldQ :: forall (x :: Prim.Type). ((x :: Prim.Type) -> + (Prim.Int)) + }) + .objFieldQ) + ("world": Prim.String) + ConObject objs -> + case (objs: { objField :: Prim.Int }) of + { objField: f } -> (f: Prim.Int) + other -> (0: Prim.Int) + +testBindersCase :: Prim.Int +testBindersCase = + (testBinders: (Lib.TestBinderSum -> (Prim.Int))) + ((ConInt: (Prim.Int -> (Lib.TestBinderSum))) (2: Prim.Int)) + +someData :: Builtin.BuiltinData +someData = (iData: (Prim.Int -> (Builtin.BuiltinData))) (1: Prim.Int) + +someDataList :: (Builtin.BuiltinList (Builtin.BuiltinData)) +someDataList = + (mkCons: forall (a :: Prim.Type). ((a :: Prim.Type) -> + (((Builtin.BuiltinList ((a :: Prim.Type))) -> + ((Builtin.BuiltinList ((a :: Prim.Type)))))))) + (someData: Builtin.BuiltinData) + ((mkNilData: (Prim.Unit -> ((Builtin.BuiltinList (Builtin.BuiltinData))))) + (unit: Prim.Unit)) + +recG1 :: forall (x :: Prim.Type). ((x :: Prim.Type) -> (Prim.Int)) +recG1 = + \(x: (x :: Prim.Type)) -> + (recF1: forall (x :: Prim.Type). ((x :: Prim.Type) -> (Prim.Int))) + (x: (x :: Prim.Type)) +recF1 :: forall (x :: Prim.Type). ((x :: Prim.Type) -> (Prim.Int)) +recF1 = + \(x: (x :: Prim.Type)) -> + (recG1: forall (x :: Prim.Type). ((x :: Prim.Type) -> (Prim.Int))) + (x: (x :: Prim.Type)) + +polyInObj :: { bar :: forall (x :: Prim.Type). ((x :: Prim.Type) -> (Prim.Int)), baz :: Prim.Int } +polyInObj = + let + go :: forall (y :: Prim.Type). ((y :: Prim.Type) -> (Prim.Int)) + go = \(v: (y :: Prim.Type)) -> (5: Prim.Int) + in ({ + baz: (100: Prim.Int), + bar: (go: forall (y :: Prim.Type). ((y :: Prim.Type) -> (Prim.Int))) + }: { + bar :: forall (x :: Prim.Type). ((x :: Prim.Type) -> (Prim.Int)), + baz :: Prim.Int + }) + +polyInObjMatch :: Prim.Int +polyInObjMatch = + case (polyInObj: { bar :: forall (x :: Prim.Type). ((x :: Prim.Type) -> (Prim.Int)), baz :: Prim.Int }) of + { bar: f, baz: _ } -> + (f: forall (x :: Prim.Type). ((x :: Prim.Type) -> (Prim.Int))) + ("hello": Prim.String) + +plutusIFTE :: Builtin.BuiltinData +plutusIFTE = + (ifThenElse: forall (x :: Prim.Type). (Prim.Boolean -> + (((x :: Prim.Type) -> (((x :: Prim.Type) -> ((x :: Prim.Type)))))))) + (True: Prim.Boolean) + (someData: Builtin.BuiltinData) + ((trace: forall (x :: Prim.Type). (Prim.String -> + (((x :: Prim.Type) -> ((x :: Prim.Type)))))) + ("BOOM!": Prim.String) + (someData: Builtin.BuiltinData)) + +plus :: (Prim.Int -> ((Prim.Int -> (Prim.Int)))) +plus = + \(a: Prim.Int) -> + \(b: Prim.Int) -> + (addInteger: (Prim.Int -> ((Prim.Int -> (Prim.Int))))) + (a: Prim.Int) + (b: Prim.Int) + +testPlus :: Prim.Int +testPlus = + (plus: (Prim.Int -> ((Prim.Int -> (Prim.Int))))) (1: Prim.Int) (1: Prim.Int) + +or :: (Prim.Boolean -> ((Prim.Boolean -> (Prim.Boolean)))) +or = + \(b1: Prim.Boolean) -> + \(b2: Prim.Boolean) -> + case (b1: Prim.Boolean) of + True -> (True: Prim.Boolean) + _ -> (b2: Prim.Boolean) + +opt2Int :: ((Lib.Option (Prim.Int)) -> (Prim.Int)) +opt2Int = + \(v: (Lib.Option (Prim.Int))) -> + case (v: (Lib.Option (Prim.Int))) of + Some i -> (i: Prim.Int) + Nada -> (0: Prim.Int) + +testOpt2Int :: Prim.Int +testOpt2Int = + (opt2Int: ((Lib.Option (Prim.Int)) -> (Prim.Int))) + ((Some: forall (@a :: Prim.Type). ((a :: Prim.Type) -> + ((Lib.Option ((a :: Prim.Type)))))) + (3: Prim.Int)) + +not :: (Prim.Boolean -> (Prim.Boolean)) +not = + \(b: Prim.Boolean) -> + case (b: Prim.Boolean) of + True -> (False: Prim.Boolean) + _ -> (True: Prim.Boolean) + +nestedBinds :: Prim.Int +nestedBinds = + let + g :: forall (a :: Prim.Type). ((a :: Prim.Type) -> (Prim.Int)) + g = \(v: (a :: Prim.Type)) -> (5: Prim.Int) + f :: (Prim.Int -> (Prim.Int)) + f = \(v: Prim.Int) -> (4: Prim.Int) + h :: Prim.Int + h = + let + i :: Prim.Int + i = + (g: forall (a :: Prim.Type). ((a :: Prim.Type) -> (Prim.Int))) + ("hello": Prim.String) + j :: Prim.Int + j = (f: (Prim.Int -> (Prim.Int))) (i: Prim.Int) + in (f: (Prim.Int -> (Prim.Int))) (j: Prim.Int) + in (h: Prim.Int) + +nestedApplications :: Prim.Int +nestedApplications = + let + i :: (Prim.Int -> ((Prim.Int -> (Prim.Int)))) + i = \(x: Prim.Int) -> \(v: Prim.Int) -> (x: Prim.Int) + h :: (Prim.Int -> (Prim.Int)) + h = + \(v: Prim.Int) -> + case (v: Prim.Int) of + 2 -> (3: Prim.Int) + _ -> (5: Prim.Int) + g :: (Prim.Int -> (Prim.Int)) + g = \(v: Prim.Int) -> (5: Prim.Int) + f :: (Prim.Int -> (Prim.Int)) + f = \(x: Prim.Int) -> (x: Prim.Int) + in (i: (Prim.Int -> ((Prim.Int -> (Prim.Int))))) + ((f: (Prim.Int -> (Prim.Int))) + ((g: (Prim.Int -> (Prim.Int))) + ((h: (Prim.Int -> (Prim.Int))) (2: Prim.Int)))) + (4: Prim.Int) + +mutuallyRecursiveBindingGroupNoTypes :: Prim.Int +mutuallyRecursiveBindingGroupNoTypes = + let + h' :: (Prim.Int -> ((Prim.Int -> (Prim.Int)))) + h' = \(x: Prim.Int) -> \(y: Prim.Int) -> (y: Prim.Int) + g' :: (Prim.Int -> (Prim.Int)) + g' = + \(y: Prim.Int) -> + (h': (Prim.Int -> ((Prim.Int -> (Prim.Int))))) + ((f': (Prim.Int -> (Prim.Int))) (y: Prim.Int)) + (3: Prim.Int) + f' :: (Prim.Int -> (Prim.Int)) + f' = \(x: Prim.Int) -> (g': (Prim.Int -> (Prim.Int))) (2: Prim.Int) + in (g': (Prim.Int -> (Prim.Int))) (3: Prim.Int) + +mutuallyRecursiveBindingGroup :: Prim.Int +mutuallyRecursiveBindingGroup = + let + h :: (Prim.Int -> ((Prim.Int -> (Prim.Int)))) + h = + \(x: Prim.Int) -> + \(y: Prim.Int) -> + (f: (Prim.Int -> (Prim.Int))) (y: Prim.Int) + g :: (Prim.Int -> (Prim.Int)) + g = + \(y: Prim.Int) -> + (h: (Prim.Int -> ((Prim.Int -> (Prim.Int))))) + ((f: (Prim.Int -> (Prim.Int))) (y: Prim.Int)) + (3: Prim.Int) + f :: (Prim.Int -> (Prim.Int)) + f = \(x: Prim.Int) -> (g: (Prim.Int -> (Prim.Int))) (2: Prim.Int) + in (g: (Prim.Int -> (Prim.Int))) (3: Prim.Int) + +minus :: (Prim.Int -> ((Prim.Int -> (Prim.Int)))) +minus = \(v: Prim.Int) -> \(v1: Prim.Int) -> (42: Prim.Int) + +litPattern :: (Prim.Int -> (Prim.Boolean)) +litPattern = + \(n: Prim.Int) -> + case (n: Prim.Int) of + 0 -> (False: Prim.Boolean) + 1 -> (True: Prim.Boolean) + 2 -> (True: Prim.Boolean) + 3 -> (True: Prim.Boolean) + 4 -> (True: Prim.Boolean) + _ -> (False: Prim.Boolean) + +litPatternApplied :: Prim.Boolean +litPatternApplied = (litPattern: (Prim.Int -> (Prim.Boolean))) (5: Prim.Int) + +isNullSomeDataList :: Prim.Boolean +isNullSomeDataList = + (nullList: forall (a :: Prim.Type). ((Builtin.BuiltinList + ((a :: Prim.Type))) -> + (Prim.Boolean))) + (someDataList: (Builtin.BuiltinList (Builtin.BuiltinData))) + +irrPattern :: (Prim.Int -> (Prim.Int)) +irrPattern = \(n: Prim.Int) -> (2: Prim.Int) + +id :: forall (t :: Prim.Type). ((t :: Prim.Type) -> ((t :: Prim.Type))) +id = \(x: (t :: Prim.Type)) -> (x: (t :: Prim.Type)) + +objForall :: forall (a :: Prim.Type) (b :: Prim.Type). { getIdA :: ((a :: Prim.Type) -> ((a :: Prim.Type))), getIdB :: ((b :: Prim.Type) -> ((b :: Prim.Type))) } +objForall = + ({ + getIdB: (id: forall (t :: Prim.Type). ((t :: Prim.Type) -> + ((t :: Prim.Type)))), + getIdA: (id: forall (t :: Prim.Type). ((t :: Prim.Type) -> + ((t :: Prim.Type)))) + }: forall (a :: Prim.Type) + (b :: Prim.Type). { + getIdA :: ((a :: Prim.Type) -> ((a :: Prim.Type))), + getIdB :: ((b :: Prim.Type) -> ((b :: Prim.Type))) + }) + +testId :: Prim.Int +testId = + (id: forall (t :: Prim.Type). ((t :: Prim.Type) -> ((t :: Prim.Type)))) + (2: Prim.Int) + +fakeLT :: (Prim.Int -> ((Prim.Int -> (Prim.Boolean)))) +fakeLT = \(v: Prim.Int) -> \(v1: Prim.Int) -> (True: Prim.Boolean) + +testForLift :: (Prim.Int -> (Prim.Boolean)) +testForLift = + \(x: Prim.Int) -> + let + j :: (Prim.Int -> ((Prim.Int -> (Prim.Int)))) + j = + \(c: Prim.Int) -> + \(d: Prim.Int) -> + (plus: (Prim.Int -> ((Prim.Int -> (Prim.Int))))) + (c: Prim.Int) + ((g: (Prim.Int -> (Prim.Int))) (d: Prim.Int)) + h :: (Prim.Int -> ((Prim.Int -> (Prim.Boolean)))) + h = + \(a: Prim.Int) -> + \(b: Prim.Int) -> + (fakeLT: (Prim.Int -> ((Prim.Int -> (Prim.Boolean))))) + ((g: (Prim.Int -> (Prim.Int))) (a: Prim.Int)) + ((j: (Prim.Int -> ((Prim.Int -> (Prim.Int))))) + (4: Prim.Int) + (b: Prim.Int)) + g :: (Prim.Int -> (Prim.Int)) + g = + \(a: Prim.Int) -> + case ((h: (Prim.Int -> ((Prim.Int -> (Prim.Boolean))))) (a: Prim.Int) (x: Prim.Int)) of + True -> + (j: (Prim.Int -> ((Prim.Int -> (Prim.Int))))) + (x: Prim.Int) + (1: Prim.Int) + _ -> + (multiplyInteger: (Prim.Int -> ((Prim.Int -> (Prim.Int))))) + (x: Prim.Int) + (x: Prim.Int) + in (h: (Prim.Int -> ((Prim.Int -> (Prim.Boolean))))) + (x: Prim.Int) + (3: Prim.Int) + +eq2 :: forall (@a :: Prim.Type) (@b :: Prim.Type). (((Lib.Eq2$Dict ((a :: Prim.Type))) ((b :: Prim.Type))) -> (((a :: Prim.Type) -> (((b :: Prim.Type) -> (Prim.Boolean)))))) +eq2 = + \(dict: ((Lib.Eq2$Dict ((a :: Prim.Type))) ((b :: Prim.Type)))) -> + case (dict: ((Lib.Eq2$Dict ((a :: Prim.Type))) ((b :: Prim.Type)))) of + Eq2$Dict v -> + (v: { + eq2 :: ((a :: Prim.Type) -> + (((b :: Prim.Type) -> (Prim.Boolean)))) + }) + .eq2 + +testEq2 :: Prim.Boolean +testEq2 = + (eq2: forall (@a :: Prim.Type) + (@b :: Prim.Type). (((Lib.Eq2$Dict ((a :: Prim.Type))) ((b :: Prim.Type))) -> + (((a :: Prim.Type) -> (((b :: Prim.Type) -> (Prim.Boolean))))))) + (eq2IntBoolean: ((Lib.Eq2$Dict (Prim.Int)) (Prim.Boolean))) + (101: Prim.Int) + (False: Prim.Boolean) + +eq :: forall (@a :: Prim.Type). ((Lib.Eq$Dict ((a :: Prim.Type))) -> (((a :: Prim.Type) -> (((a :: Prim.Type) -> (Prim.Boolean)))))) +eq = + \(dict: (Lib.Eq$Dict ((a :: Prim.Type)))) -> + case (dict: (Lib.Eq$Dict ((a :: Prim.Type)))) of + Eq$Dict v -> + (v: { + eq :: ((a :: Prim.Type) -> + (((a :: Prim.Type) -> (Prim.Boolean)))) + }) + .eq + +testEq :: Prim.Boolean +testEq = + (eq: forall (@a :: Prim.Type). ((Lib.Eq$Dict ((a :: Prim.Type))) -> + (((a :: Prim.Type) -> (((a :: Prim.Type) -> (Prim.Boolean))))))) + (eqInt: (Lib.Eq$Dict (Prim.Int))) + (1: Prim.Int) + (2: Prim.Int) + +testEqViaOrd :: forall (a :: Prim.Type). ((Lib.Ord$Dict ((a :: Prim.Type))) -> (((a :: Prim.Type) -> (((a :: Prim.Type) -> (Prim.Boolean)))))) +testEqViaOrd = + \(dictOrd: (Lib.Ord$Dict ((a :: Prim.Type)))) -> + \(a: (a :: Prim.Type)) -> + \(b: (a :: Prim.Type)) -> + (eq: forall (@a :: Prim.Type). ((Lib.Eq$Dict ((a :: Prim.Type))) -> + (((a :: Prim.Type) -> (((a :: Prim.Type) -> (Prim.Boolean))))))) + (((dictOrd: (Lib.Ord$Dict ((a :: Prim.Type)))) + .Eq0) + ({ }: (Prim.Record ({})))) + (a: (a :: Prim.Type)) + (b: (a :: Prim.Type)) + +workingEven :: (Prim.Int -> (Prim.Int)) +workingEven = + \(n: Prim.Int) -> + case ((eq: forall (@a :: Prim.Type). ((Lib.Eq$Dict ((a :: Prim.Type))) -> (((a :: Prim.Type) -> (((a :: Prim.Type) -> (Prim.Boolean))))))) (eqInt: (Lib.Eq$Dict (Prim.Int))) (n: Prim.Int) (0: Prim.Int)) of + True -> (1: Prim.Int) + _ -> (42: Prim.Int) + +emptyList :: List ((t135 :: Prim.Type)) +emptyList = (Nil: List ((t135 :: Prim.Type))) + +cons :: forall (a :: Prim.Type). ((a :: Prim.Type) -> ((List ((a :: Prim.Type)) -> (List ((a :: Prim.Type)))))) +cons = + \(x: (a :: Prim.Type)) -> + \(xs: List ((a :: Prim.Type))) -> + (Cons: forall (x :: Prim.Type). ((x :: Prim.Type) -> + ((List ((x :: Prim.Type)) -> (List ((x :: Prim.Type))))))) + (x: (a :: Prim.Type)) + (Nil: List ((a :: Prim.Type))) + +consEmptyList1 :: List (Prim.Int) +consEmptyList1 = + (cons: forall (a :: Prim.Type). ((a :: Prim.Type) -> + ((List ((a :: Prim.Type)) -> (List ((a :: Prim.Type))))))) + (1: Prim.Int) + (emptyList: forall (t135 :: Prim.Type). List ((t135 :: Prim.Type))) + +consEmptyList2 :: List (Prim.String) +consEmptyList2 = + (cons: forall (a :: Prim.Type). ((a :: Prim.Type) -> + ((List ((a :: Prim.Type)) -> (List ((a :: Prim.Type))))))) + ("hello": Prim.String) + (emptyList: forall (t135 :: Prim.Type). List ((t135 :: Prim.Type))) + +compare :: forall (@a :: Prim.Type). ((Lib.Ord$Dict ((a :: Prim.Type))) -> (((a :: Prim.Type) -> (((a :: Prim.Type) -> (Prim.Int)))))) +compare = + \(dict: (Lib.Ord$Dict ((a :: Prim.Type)))) -> + case (dict: (Lib.Ord$Dict ((a :: Prim.Type)))) of + Ord$Dict v -> + (v: { + compare :: ((a :: Prim.Type) -> + (((a :: Prim.Type) -> (Prim.Int)))), + Eq0 :: ((Prim.Record ({}@Prim.Type)) -> + ((Lib.Eq$Dict ((a :: Prim.Type))))) + }) + .compare + +brokenEven :: (Prim.Int -> (Prim.Int)) +brokenEven = + \(n: Prim.Int) -> + case ((eq: forall (@a :: Prim.Type). ((Lib.Eq$Dict ((a :: Prim.Type))) -> (((a :: Prim.Type) -> (((a :: Prim.Type) -> (Prim.Boolean))))))) (eqInt: (Lib.Eq$Dict (Prim.Int))) (n: Prim.Int) (0: Prim.Int)) of + True -> (1: Prim.Int) + _ -> + (brokenEven: (Prim.Int -> (Prim.Int))) + ((minus: (Prim.Int -> ((Prim.Int -> (Prim.Int))))) + (n: Prim.Int) + (2: Prim.Int)) + +arrForall :: List (forall (t :: Prim.Type). ((t :: Prim.Type) -> ((t :: Prim.Type)))) +arrForall = + (Cons: forall (x :: Prim.Type). ((x :: Prim.Type) -> + ((List ((x :: Prim.Type)) -> (List ((x :: Prim.Type))))))) + (id: forall (t :: Prim.Type). ((t :: Prim.Type) -> ((t :: Prim.Type)))) + (Nil: List (forall (a :: Prim.Type). ((a :: Prim.Type) -> + ((a :: Prim.Type))))) + +and :: (Prim.Boolean -> ((Prim.Boolean -> (Prim.Boolean)))) +and = + \(p: Prim.Boolean) -> + \(q: Prim.Boolean) -> + (not: (Prim.Boolean -> (Prim.Boolean))) + ((or: (Prim.Boolean -> ((Prim.Boolean -> (Prim.Boolean))))) + ((not: (Prim.Boolean -> (Prim.Boolean))) (p: Prim.Boolean)) + ((not: (Prim.Boolean -> (Prim.Boolean))) (q: Prim.Boolean))) + +iff :: (Prim.Boolean -> ((Prim.Boolean -> (Prim.Boolean)))) +iff = + \(p: Prim.Boolean) -> + \(q: Prim.Boolean) -> + (or: (Prim.Boolean -> ((Prim.Boolean -> (Prim.Boolean))))) + ((and: (Prim.Boolean -> ((Prim.Boolean -> (Prim.Boolean))))) + (p: Prim.Boolean) + (q: Prim.Boolean)) + ((and: (Prim.Boolean -> ((Prim.Boolean -> (Prim.Boolean))))) + ((not: (Prim.Boolean -> (Prim.Boolean))) (p: Prim.Boolean)) + ((not: (Prim.Boolean -> (Prim.Boolean))) (q: Prim.Boolean))) + +ghcInlinerPaperEx :: Prim.Boolean +ghcInlinerPaperEx = + let + h :: (Prim.Boolean -> (Prim.Boolean)) + h = + \(x: Prim.Boolean) -> + (and: (Prim.Boolean -> ((Prim.Boolean -> (Prim.Boolean))))) + ((f: (Prim.Boolean -> (Prim.Boolean))) (True: Prim.Boolean)) + (x: Prim.Boolean) + g :: (Prim.Boolean -> (Prim.Boolean)) + g = + \(x: Prim.Boolean) -> + (iff: (Prim.Boolean -> ((Prim.Boolean -> (Prim.Boolean))))) + ((h: (Prim.Boolean -> (Prim.Boolean))) (x: Prim.Boolean)) + (False: Prim.Boolean) + f :: (Prim.Boolean -> (Prim.Boolean)) + f = + \(x: Prim.Boolean) -> + (g: (Prim.Boolean -> (Prim.Boolean))) + ((not: (Prim.Boolean -> (Prim.Boolean))) (x: Prim.Boolean)) + q :: (Prim.Boolean -> (Prim.Boolean)) + q = + \(x: Prim.Boolean) -> + (g: (Prim.Boolean -> (Prim.Boolean))) + ((iff: (Prim.Boolean -> ((Prim.Boolean -> (Prim.Boolean))))) + (x: Prim.Boolean) + ((not: (Prim.Boolean -> (Prim.Boolean))) (x: Prim.Boolean))) + p :: Prim.Boolean + p = (q: (Prim.Boolean -> (Prim.Boolean))) (False: Prim.Boolean) + in (p: Prim.Boolean) + +kozsTwoSCCEx :: Prim.Boolean +kozsTwoSCCEx = + let + z :: Prim.Boolean + z = (True: Prim.Boolean) + h :: (Prim.Boolean -> (Prim.Boolean)) + h = + \(x: Prim.Boolean) -> + (not: (Prim.Boolean -> (Prim.Boolean))) + ((f: (Prim.Boolean -> (Prim.Boolean))) (x: Prim.Boolean)) + g :: (Prim.Boolean -> (Prim.Boolean)) + g = + \(x: Prim.Boolean) -> + (and: (Prim.Boolean -> ((Prim.Boolean -> (Prim.Boolean))))) + ((not: (Prim.Boolean -> (Prim.Boolean))) + ((h: (Prim.Boolean -> (Prim.Boolean))) (x: Prim.Boolean))) + ((not: (Prim.Boolean -> (Prim.Boolean))) (x: Prim.Boolean)) + f :: (Prim.Boolean -> (Prim.Boolean)) + f = + \(x: Prim.Boolean) -> + (not: (Prim.Boolean -> (Prim.Boolean))) + ((g: (Prim.Boolean -> (Prim.Boolean))) (x: Prim.Boolean)) + c :: (Prim.Boolean -> (Prim.Boolean)) + c = + \(x: Prim.Boolean) -> + (not: (Prim.Boolean -> (Prim.Boolean))) + ((and: (Prim.Boolean -> ((Prim.Boolean -> (Prim.Boolean))))) + ((f: (Prim.Boolean -> (Prim.Boolean))) (x: Prim.Boolean)) + ((b: (Prim.Boolean -> (Prim.Boolean))) (x: Prim.Boolean))) + b :: (Prim.Boolean -> (Prim.Boolean)) + b = + \(x: Prim.Boolean) -> + (and: (Prim.Boolean -> ((Prim.Boolean -> (Prim.Boolean))))) + (x: Prim.Boolean) + ((and: (Prim.Boolean -> ((Prim.Boolean -> (Prim.Boolean))))) + ((c: (Prim.Boolean -> (Prim.Boolean))) (x: Prim.Boolean)) + ((h: (Prim.Boolean -> (Prim.Boolean))) (x: Prim.Boolean))) + a :: (Prim.Boolean -> (Prim.Boolean)) + a = + \(x: Prim.Boolean) -> + (and: (Prim.Boolean -> ((Prim.Boolean -> (Prim.Boolean))))) + ((b: (Prim.Boolean -> (Prim.Boolean))) (x: Prim.Boolean)) + (x: Prim.Boolean) + in (and: (Prim.Boolean -> ((Prim.Boolean -> (Prim.Boolean))))) + ((a: (Prim.Boolean -> (Prim.Boolean))) (z: Prim.Boolean)) + ((and: (Prim.Boolean -> ((Prim.Boolean -> (Prim.Boolean))))) + ((b: (Prim.Boolean -> (Prim.Boolean))) (z: Prim.Boolean)) + ((and: (Prim.Boolean -> ((Prim.Boolean -> (Prim.Boolean))))) + ((c: (Prim.Boolean -> (Prim.Boolean))) (z: Prim.Boolean)) + ((and: (Prim.Boolean -> ((Prim.Boolean -> (Prim.Boolean))))) + ((f: (Prim.Boolean -> (Prim.Boolean))) (z: Prim.Boolean)) + ((and: (Prim.Boolean -> ((Prim.Boolean -> (Prim.Boolean))))) + ((g: (Prim.Boolean -> (Prim.Boolean))) (z: Prim.Boolean)) + ((h: (Prim.Boolean -> (Prim.Boolean))) (z: Prim.Boolean)))))) + +anObj :: { foo :: Prim.Int } +anObj = ({ foo: (3: Prim.Int) }: { foo :: Prim.Int }) + +objUpdate :: { foo :: Prim.Int } +objUpdate = + let + v :: { foo :: Prim.Int } + v = (anObj: { foo :: Prim.Int }) + in (v: { foo :: Prim.Int }) { foo = (4: Prim.Int) } + +anIntLit :: Prim.Int +anIntLit = (1: Prim.Int) + +aVal :: Prim.Int +aVal = (1: Prim.Int) + +aStringLit :: Prim.String +aStringLit = ("woop": Prim.String) + +aPred :: (Prim.Int -> (Prim.Boolean)) +aPred = \(v: Prim.Int) -> (True: Prim.Boolean) + +guardedCase :: (Prim.Int -> ((Prim.Int -> (Prim.Int)))) +guardedCase = + \(w: Prim.Int) -> + \(x: Prim.Int) -> + let + v :: forall ($28 :: Prim.Type). (($28 :: Prim.Type) -> (Prim.Int)) + v = \(v1: ($28 :: Prim.Type)) -> (0: Prim.Int) + in case (w: Prim.Int) (x: Prim.Int) of + y z -> + let + v1 :: Prim.Boolean + v1 = + (eq: forall (@a :: Prim.Type). ((Lib.Eq$Dict + ((a :: Prim.Type))) -> + (((a :: Prim.Type) -> + (((a :: Prim.Type) -> (Prim.Boolean))))))) + (eqInt: (Lib.Eq$Dict (Prim.Int))) + (y: Prim.Int) + (2: Prim.Int) + in case (v1: Prim.Boolean) of + True -> + let + v2 :: Prim.Boolean + v2 = (aPred: (Prim.Int -> (Prim.Boolean))) (y: Prim.Int) + in case (v2: Prim.Boolean) of + True -> + let + v3 :: Prim.Boolean + v3 = + (eq: forall (@a :: Prim.Type). ((Lib.Eq$Dict + ((a :: Prim.Type))) -> + (((a :: Prim.Type) -> + (((a :: Prim.Type) -> (Prim.Boolean))))))) + (eqInt: (Lib.Eq$Dict (Prim.Int))) + (z: Prim.Int) + (0: Prim.Int) + in case (v3: Prim.Boolean) of + True -> + let + v4 :: Prim.Boolean + v4 = + (eq: forall (@a :: Prim.Type). ((Lib.Eq$Dict + ((a :: Prim.Type))) -> + (((a :: Prim.Type) -> + (((a :: Prim.Type) -> + (Prim.Boolean))))))) + (eqInt: (Lib.Eq$Dict (Prim.Int))) + (y: Prim.Int) + (nestedBinds: Prim.Int) + in case (v4: Prim.Boolean) of + True -> (2: Prim.Int) + _ -> + (v: forall ($28 :: Prim.Type). (($28 :: Prim.Type) -> + (Prim.Int))) + (True: Prim.Boolean) + _ -> + (v: forall ($28 :: Prim.Type). (($28 :: Prim.Type) -> + (Prim.Int))) + (True: Prim.Boolean) + _ -> + (v: forall ($28 :: Prim.Type). (($28 :: Prim.Type) -> + (Prim.Int))) + (True: Prim.Boolean) + _ -> + (v: forall ($28 :: Prim.Type). (($28 :: Prim.Type) -> + (Prim.Int))) + (True: Prim.Boolean) + +aList2 :: List (Prim.Int) +aList2 = + (Cons: forall (x :: Prim.Type). ((x :: Prim.Type) -> + ((List ((x :: Prim.Type)) -> (List ((x :: Prim.Type))))))) + (1: Prim.Int) + ((Cons: forall (x :: Prim.Type). ((x :: Prim.Type) -> + ((List ((x :: Prim.Type)) -> (List ((x :: Prim.Type))))))) + (2: Prim.Int) + (Nil: List (Prim.Int))) + +aList :: List (Prim.Int) +aList = + (Cons: forall (x :: Prim.Type). ((x :: Prim.Type) -> + ((List ((x :: Prim.Type)) -> (List ((x :: Prim.Type))))))) + (1: Prim.Int) + ((Cons: forall (x :: Prim.Type). ((x :: Prim.Type) -> + ((List ((x :: Prim.Type)) -> (List ((x :: Prim.Type))))))) + (2: Prim.Int) + ((Cons: forall (x :: Prim.Type). ((x :: Prim.Type) -> + ((List ((x :: Prim.Type)) -> (List ((x :: Prim.Type))))))) + (3: Prim.Int) + ((Cons: forall (x :: Prim.Type). ((x :: Prim.Type) -> + ((List ((x :: Prim.Type)) -> (List ((x :: Prim.Type))))))) + (4: Prim.Int) + ((Cons: forall (x :: Prim.Type). ((x :: Prim.Type) -> + ((List ((x :: Prim.Type)) -> (List ((x :: Prim.Type))))))) + (5: Prim.Int) + (Nil: List (Prim.Int)))))) + +aFunction4 :: forall (r :: (Prim.Row (Prim.Type))). ({ a :: Prim.Int | (r :: (Prim.Row (Prim.Type))) } -> (Prim.Int)) +aFunction4 = + \(r: { a :: Prim.Int | (r :: (Prim.Row (Prim.Type))) }) -> + (r: { a :: Prim.Int | (r :: (Prim.Row (Prim.Type))) }) + .a + +aFunction5 :: Prim.Int +aFunction5 = + (aFunction4: forall (r :: (Prim.Row + (Prim.Type))). ({ a :: Prim.Int | (r :: (Prim.Row (Prim.Type))) } -> + (Prim.Int))) + ({ a: (2: Prim.Int) }: { a :: Prim.Int }) + +main :: Prim.Int +main = + (aFunction4: forall (r :: (Prim.Row + (Prim.Type))). ({ a :: Prim.Int | (r :: (Prim.Row (Prim.Type))) } -> + (Prim.Int))) + ({ b: ("hello": Prim.String), a: (101: Prim.Int) }: { + a :: Prim.Int, + b :: Prim.String + }) + +aFunction3 :: (Prim.Int -> (Prim.Int)) +aFunction3 = + \(x: Prim.Int) -> + case ((eq: forall (@a :: Prim.Type). ((Lib.Eq$Dict ((a :: Prim.Type))) -> (((a :: Prim.Type) -> (((a :: Prim.Type) -> (Prim.Boolean))))))) (eqInt: (Lib.Eq$Dict (Prim.Int))) (x: Prim.Int) (2: Prim.Int)) of + True -> (4: Prim.Int) + _ -> (1: Prim.Int) + +aFunction2 :: (Prim.Int -> (List (Prim.Int))) +aFunction2 = + \(x: Prim.Int) -> + (Cons: forall (x :: Prim.Type). ((x :: Prim.Type) -> + ((List ((x :: Prim.Type)) -> (List ((x :: Prim.Type))))))) + (x: Prim.Int) + ((Cons: forall (x :: Prim.Type). ((x :: Prim.Type) -> + ((List ((x :: Prim.Type)) -> (List ((x :: Prim.Type))))))) + (1: Prim.Int) + (Nil: List (Prim.Int))) + +aFunction :: forall (x :: Prim.Type). ((x :: Prim.Type) -> ((forall (y :: Prim.Type). ((y :: Prim.Type) -> (Prim.Int)) -> (Prim.Int)))) +aFunction = + \(any: (x :: Prim.Type)) -> + \(f: forall (y :: Prim.Type). ((y :: Prim.Type) -> (Prim.Int))) -> + (f: forall (y :: Prim.Type). ((y :: Prim.Type) -> (Prim.Int))) + (any: (x :: Prim.Type)) + +aFunction6 :: Prim.Int +aFunction6 = + let + go :: forall (z :: Prim.Type). ((z :: Prim.Type) -> (Prim.Int)) + go = \(v: (z :: Prim.Type)) -> (10: Prim.Int) + in (aFunction: forall (x :: Prim.Type). ((x :: Prim.Type) -> + ((forall (y :: Prim.Type). ((y :: Prim.Type) -> (Prim.Int)) -> + (Prim.Int))))) + (Nil: List (t192)) + (go: forall (z :: Prim.Type). ((z :: Prim.Type) -> (Prim.Int))) + +aBool :: Prim.Boolean +aBool = (True: Prim.Boolean) \ No newline at end of file diff --git a/tests/purus/passing/Misc/output/Lib/externs.cbor b/tests/purus/passing/Misc/output/Lib/externs.cbor new file mode 100644 index 000000000..9914907c8 Binary files /dev/null and b/tests/purus/passing/Misc/output/Lib/externs.cbor differ diff --git a/tests/purus/passing/Misc/output/Prelude/Prelude.cfn b/tests/purus/passing/Misc/output/Prelude/Prelude.cfn new file mode 100644 index 000000000..958f24f99 --- /dev/null +++ b/tests/purus/passing/Misc/output/Prelude/Prelude.cfn @@ -0,0 +1 @@ +{"builtWith":"0.0.1","comments":[],"dataTypes":{"_ctorDict":[[[["Prelude"],{"Ident":"Cons"}],[["Prelude"],"List"]],[[["Prelude"],{"Ident":"False"}],[["Prelude"],"Bool"]],[[["Prelude"],{"Ident":"Nil"}],[["Prelude"],"List"]],[[["Prelude"],{"Ident":"True"}],[["Prelude"],"Bool"]]],"_tyDict":[[[["Prelude"],"Bool"],{"_dDataArgs":[],"_dDataCtors":[{"_cdCtorFields":[],"_cdCtorName":[["Prelude"],{"Ident":"True"}]},{"_cdCtorFields":[],"_cdCtorName":[["Prelude"],{"Ident":"False"}]}],"_dDataTyName":[["Prelude"],"Bool"],"_dDeclType":"data"}],[[["Prelude"],"List"],{"_dDataArgs":[["a",{"annotation":[{"end":[21,21],"name":"tests/purus/passing/Misc/Prelude.purs","start":[21,17]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}]],"_dDataCtors":[{"_cdCtorFields":[],"_cdCtorName":[["Prelude"],{"Ident":"Nil"}]},{"_cdCtorFields":[[{"Ident":"value0"},{"annotation":[{"end":[21,37],"name":"tests/purus/passing/Misc/Prelude.purs","start":[21,36]},[]],"contents":{"kind":{"annotation":[{"end":[21,21],"name":"tests/purus/passing/Misc/Prelude.purs","start":[21,17]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],[{"Ident":"value1"},{"annotation":[{"end":[21,45],"name":"tests/purus/passing/Misc/Prelude.purs","start":[21,39]},[]],"contents":[{"annotation":[{"end":[21,43],"name":"tests/purus/passing/Misc/Prelude.purs","start":[21,39]},[]],"contents":[["Prelude"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[21,45],"name":"tests/purus/passing/Misc/Prelude.purs","start":[21,44]},[]],"contents":{"kind":{"annotation":[{"end":[21,21],"name":"tests/purus/passing/Misc/Prelude.purs","start":[21,17]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}]],"_cdCtorName":[["Prelude"],{"Ident":"Cons"}]}],"_dDataTyName":[["Prelude"],"List"],"_dDeclType":"data"}]]},"decls":[{"annotation":{"meta":null,"sourceSpan":{"end":[12,27],"start":[12,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"argument":"v","body":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"argument":"v1","body":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[13,8],"start":[13,4]}},"binderType":"ConstructorBinder","binders":[],"constructorName":{"identifier":"True","moduleName":["Prelude"]},"typeName":{"identifier":"Bool","moduleName":["Prelude"]}},{"annotation":{"meta":null,"sourceSpan":{"end":[13,10],"start":[13,9]}},"binderType":"NullBinder"}],"expression":{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[13,17],"start":[13,13]}},"kind":"Var","type":{"annotation":[{"end":[12,27],"name":"tests/purus/passing/Misc/Prelude.purs","start":[12,23]},[]],"contents":[["Prelude"],"Bool"],"tag":"TypeConstructor"},"value":{"identifier":"True","moduleName":["Prelude"]}},"isGuarded":false},{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[14,5],"start":[14,4]}},"binderType":"NullBinder"},{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[14,10],"start":[14,6]}},"binderType":"ConstructorBinder","binders":[],"constructorName":{"identifier":"True","moduleName":["Prelude"]},"typeName":{"identifier":"Bool","moduleName":["Prelude"]}}],"expression":{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[14,17],"start":[14,13]}},"kind":"Var","type":{"annotation":[{"end":[12,27],"name":"tests/purus/passing/Misc/Prelude.purs","start":[12,23]},[]],"contents":[["Prelude"],"Bool"],"tag":"TypeConstructor"},"value":{"identifier":"True","moduleName":["Prelude"]}},"isGuarded":false},{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[15,5],"start":[15,4]}},"binderType":"NullBinder"},{"annotation":{"meta":null,"sourceSpan":{"end":[15,7],"start":[15,6]}},"binderType":"NullBinder"}],"expression":{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[15,15],"start":[15,10]}},"kind":"Var","type":{"annotation":[{"end":[12,27],"name":"tests/purus/passing/Misc/Prelude.purs","start":[12,23]},[]],"contents":[["Prelude"],"Bool"],"tag":"TypeConstructor"},"value":{"identifier":"False","moduleName":["Prelude"]}},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[13,17],"start":[13,1]}},"kind":"Var","type":{"annotation":[{"end":[12,11],"name":"tests/purus/passing/Misc/Prelude.purs","start":[12,7]},[]],"contents":[["Prelude"],"Bool"],"tag":"TypeConstructor"},"value":{"identifier":"v","sourcePos":[0,0]}},{"annotation":{"meta":null,"sourceSpan":{"end":[13,17],"start":[13,1]}},"kind":"Var","type":{"annotation":[{"end":[12,19],"name":"tests/purus/passing/Misc/Prelude.purs","start":[12,15]},[]],"contents":[["Prelude"],"Bool"],"tag":"TypeConstructor"},"value":{"identifier":"v1","sourcePos":[0,0]}}],"kind":"Case","type":{"annotation":[{"end":[12,27],"name":"tests/purus/passing/Misc/Prelude.purs","start":[12,23]},[]],"contents":[["Prelude"],"Bool"],"tag":"TypeConstructor"}},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[12,19],"name":"tests/purus/passing/Misc/Prelude.purs","start":[12,15]},[]],"contents":[["Prelude"],"Bool"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[12,27],"name":"tests/purus/passing/Misc/Prelude.purs","start":[12,23]},[]],"contents":[["Prelude"],"Bool"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[12,11],"name":"tests/purus/passing/Misc/Prelude.purs","start":[12,7]},[]],"contents":[["Prelude"],"Bool"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[12,27],"name":"tests/purus/passing/Misc/Prelude.purs","start":[12,15]},[]],"contents":[{"annotation":[{"end":[12,27],"name":"tests/purus/passing/Misc/Prelude.purs","start":[12,15]},[]],"contents":[{"annotation":[{"end":[12,22],"name":"tests/purus/passing/Misc/Prelude.purs","start":[12,20]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[12,19],"name":"tests/purus/passing/Misc/Prelude.purs","start":[12,15]},[]],"contents":[["Prelude"],"Bool"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[12,27],"name":"tests/purus/passing/Misc/Prelude.purs","start":[12,23]},[]],"contents":[["Prelude"],"Bool"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"identifier":"or"},{"annotation":{"meta":null,"sourceSpan":{"end":[17,20],"start":[17,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"argument":"v","body":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[18,9],"start":[18,5]}},"binderType":"ConstructorBinder","binders":[],"constructorName":{"identifier":"True","moduleName":["Prelude"]},"typeName":{"identifier":"Bool","moduleName":["Prelude"]}}],"expression":{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[18,17],"start":[18,12]}},"kind":"Var","type":{"annotation":[{"end":[17,20],"name":"tests/purus/passing/Misc/Prelude.purs","start":[17,16]},[]],"contents":[["Prelude"],"Bool"],"tag":"TypeConstructor"},"value":{"identifier":"False","moduleName":["Prelude"]}},"isGuarded":false},{"binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[19,10],"start":[19,5]}},"binderType":"ConstructorBinder","binders":[],"constructorName":{"identifier":"False","moduleName":["Prelude"]},"typeName":{"identifier":"Bool","moduleName":["Prelude"]}}],"expression":{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[19,17],"start":[19,13]}},"kind":"Var","type":{"annotation":[{"end":[17,20],"name":"tests/purus/passing/Misc/Prelude.purs","start":[17,16]},[]],"contents":[["Prelude"],"Bool"],"tag":"TypeConstructor"},"value":{"identifier":"True","moduleName":["Prelude"]}},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[18,17],"start":[18,1]}},"kind":"Var","type":{"annotation":[{"end":[17,12],"name":"tests/purus/passing/Misc/Prelude.purs","start":[17,8]},[]],"contents":[["Prelude"],"Bool"],"tag":"TypeConstructor"},"value":{"identifier":"v","sourcePos":[0,0]}}],"kind":"Case","type":{"annotation":[{"end":[17,20],"name":"tests/purus/passing/Misc/Prelude.purs","start":[17,16]},[]],"contents":[["Prelude"],"Bool"],"tag":"TypeConstructor"}},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[17,12],"name":"tests/purus/passing/Misc/Prelude.purs","start":[17,8]},[]],"contents":[["Prelude"],"Bool"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[17,20],"name":"tests/purus/passing/Misc/Prelude.purs","start":[17,16]},[]],"contents":[["Prelude"],"Bool"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"identifier":"not"},{"bindType":"Rec","binds":[{"annotation":{"meta":null,"sourceSpan":{"end":[23,61],"start":[23,1]}},"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"argument":"v","body":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"argument":"v1","body":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[24,15],"start":[24,12]}},"binderType":"ConstructorBinder","binders":[],"constructorName":{"identifier":"Nil","moduleName":["Prelude"]},"typeName":{"identifier":"List","moduleName":["Prelude"]}},{"annotation":{"meta":null,"sourceSpan":{"end":[24,18],"start":[24,16]}},"binderType":"VarBinder","identifier":"ys","type":{"annotation":[{"end":[23,51],"name":"tests/purus/passing/Misc/Prelude.purs","start":[23,45]},[]],"contents":[{"annotation":[{"end":[23,49],"name":"tests/purus/passing/Misc/Prelude.purs","start":[23,45]},[]],"contents":[["Prelude"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[23,51],"name":"tests/purus/passing/Misc/Prelude.purs","start":[23,50]},[]],"contents":{"kind":{"annotation":[{"end":[23,32],"name":"tests/purus/passing/Misc/Prelude.purs","start":[23,28]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[24,23],"start":[24,21]}},"kind":"Var","type":{"annotation":[{"end":[23,51],"name":"tests/purus/passing/Misc/Prelude.purs","start":[23,45]},[]],"contents":[{"annotation":[{"end":[23,49],"name":"tests/purus/passing/Misc/Prelude.purs","start":[23,45]},[]],"contents":[["Prelude"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[23,51],"name":"tests/purus/passing/Misc/Prelude.purs","start":[23,50]},[]],"contents":{"kind":{"annotation":[{"end":[23,32],"name":"tests/purus/passing/Misc/Prelude.purs","start":[23,28]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},"value":{"identifier":"ys","sourcePos":[24,16]}},"isGuarded":false},{"binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":["value0","value1"],"metaType":"IsConstructor"},"sourceSpan":{"end":[25,22],"start":[25,13]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[25,19],"start":[25,18]}},"binderType":"VarBinder","identifier":"x","type":{"annotation":[{"end":[23,41],"name":"tests/purus/passing/Misc/Prelude.purs","start":[23,40]},[]],"contents":{"kind":{"annotation":[{"end":[23,32],"name":"tests/purus/passing/Misc/Prelude.purs","start":[23,28]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}},{"annotation":{"meta":null,"sourceSpan":{"end":[25,22],"start":[25,20]}},"binderType":"VarBinder","identifier":"xs","type":{"annotation":[{"end":[21,45],"name":"tests/purus/passing/Misc/Prelude.purs","start":[21,39]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prelude"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[23,41],"name":"tests/purus/passing/Misc/Prelude.purs","start":[23,40]},[]],"contents":{"kind":{"annotation":[{"end":[23,32],"name":"tests/purus/passing/Misc/Prelude.purs","start":[23,28]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}}],"constructorName":{"identifier":"Cons","moduleName":["Prelude"]},"typeName":{"identifier":"List","moduleName":["Prelude"]}},{"annotation":{"meta":null,"sourceSpan":{"end":[25,26],"start":[25,24]}},"binderType":"VarBinder","identifier":"ys","type":{"annotation":[{"end":[23,51],"name":"tests/purus/passing/Misc/Prelude.purs","start":[23,45]},[]],"contents":[{"annotation":[{"end":[23,49],"name":"tests/purus/passing/Misc/Prelude.purs","start":[23,45]},[]],"contents":[["Prelude"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[23,51],"name":"tests/purus/passing/Misc/Prelude.purs","start":[23,50]},[]],"contents":{"kind":{"annotation":[{"end":[23,32],"name":"tests/purus/passing/Misc/Prelude.purs","start":[23,28]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}}],"expression":{"abstraction":{"abstraction":{"annotation":{"meta":{"constructorType":"SumType","identifiers":["value0","value1"],"metaType":"IsConstructor"},"sourceSpan":{"end":[25,33],"start":[25,29]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[21,21],"name":"tests/purus/passing/Misc/Prelude.purs","start":[21,17]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":2,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[21,37],"name":"tests/purus/passing/Misc/Prelude.purs","start":[21,36]},[]],"contents":{"kind":{"annotation":[{"end":[21,21],"name":"tests/purus/passing/Misc/Prelude.purs","start":[21,17]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[21,45],"name":"tests/purus/passing/Misc/Prelude.purs","start":[21,39]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prelude"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[21,45],"name":"tests/purus/passing/Misc/Prelude.purs","start":[21,44]},[]],"contents":{"kind":{"annotation":[{"end":[21,21],"name":"tests/purus/passing/Misc/Prelude.purs","start":[21,17]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prelude"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[21,21],"name":"tests/purus/passing/Misc/Prelude.purs","start":[21,17]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarVisible"},"tag":"ForAll"},"value":{"identifier":"Cons","moduleName":["Prelude"]}},"annotation":{"meta":null,"sourceSpan":{"end":[25,35],"start":[25,29]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[25,35],"start":[25,34]}},"kind":"Var","type":{"annotation":[{"end":[23,41],"name":"tests/purus/passing/Misc/Prelude.purs","start":[23,40]},[]],"contents":{"kind":{"annotation":[{"end":[23,32],"name":"tests/purus/passing/Misc/Prelude.purs","start":[23,28]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"},"value":{"identifier":"x","sourcePos":[25,18]}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[25,54],"start":[25,29]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[25,47],"start":[25,37]}},"kind":"Var","type":{"annotation":[{"end":[23,61],"name":"tests/purus/passing/Misc/Prelude.purs","start":[23,15]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[23,32],"name":"tests/purus/passing/Misc/Prelude.purs","start":[23,28]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":0,"type":{"annotation":[{"end":[23,61],"name":"tests/purus/passing/Misc/Prelude.purs","start":[23,35]},[]],"contents":[{"annotation":[{"end":[23,61],"name":"tests/purus/passing/Misc/Prelude.purs","start":[23,35]},[]],"contents":[{"annotation":[{"end":[23,44],"name":"tests/purus/passing/Misc/Prelude.purs","start":[23,42]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[23,41],"name":"tests/purus/passing/Misc/Prelude.purs","start":[23,35]},[]],"contents":[{"annotation":[{"end":[23,39],"name":"tests/purus/passing/Misc/Prelude.purs","start":[23,35]},[]],"contents":[["Prelude"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[23,41],"name":"tests/purus/passing/Misc/Prelude.purs","start":[23,40]},[]],"contents":{"kind":{"annotation":[{"end":[23,32],"name":"tests/purus/passing/Misc/Prelude.purs","start":[23,28]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[23,61],"name":"tests/purus/passing/Misc/Prelude.purs","start":[23,45]},[]],"contents":[{"annotation":[{"end":[23,61],"name":"tests/purus/passing/Misc/Prelude.purs","start":[23,45]},[]],"contents":[{"annotation":[{"end":[23,54],"name":"tests/purus/passing/Misc/Prelude.purs","start":[23,52]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[23,51],"name":"tests/purus/passing/Misc/Prelude.purs","start":[23,45]},[]],"contents":[{"annotation":[{"end":[23,49],"name":"tests/purus/passing/Misc/Prelude.purs","start":[23,45]},[]],"contents":[["Prelude"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[23,51],"name":"tests/purus/passing/Misc/Prelude.purs","start":[23,50]},[]],"contents":{"kind":{"annotation":[{"end":[23,32],"name":"tests/purus/passing/Misc/Prelude.purs","start":[23,28]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[23,61],"name":"tests/purus/passing/Misc/Prelude.purs","start":[23,55]},[]],"contents":[{"annotation":[{"end":[23,59],"name":"tests/purus/passing/Misc/Prelude.purs","start":[23,55]},[]],"contents":[["Prelude"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[23,61],"name":"tests/purus/passing/Misc/Prelude.purs","start":[23,60]},[]],"contents":{"kind":{"annotation":[{"end":[23,32],"name":"tests/purus/passing/Misc/Prelude.purs","start":[23,28]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"appendList","moduleName":["Prelude"]}},"annotation":{"meta":null,"sourceSpan":{"end":[25,50],"start":[25,37]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[25,50],"start":[25,48]}},"kind":"Var","type":{"annotation":[{"end":[21,45],"name":"tests/purus/passing/Misc/Prelude.purs","start":[21,39]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prelude"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[23,41],"name":"tests/purus/passing/Misc/Prelude.purs","start":[23,40]},[]],"contents":{"kind":{"annotation":[{"end":[23,32],"name":"tests/purus/passing/Misc/Prelude.purs","start":[23,28]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},"value":{"identifier":"xs","sourcePos":[25,20]}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[25,53],"start":[25,37]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[25,53],"start":[25,51]}},"kind":"Var","type":{"annotation":[{"end":[23,51],"name":"tests/purus/passing/Misc/Prelude.purs","start":[23,45]},[]],"contents":[{"annotation":[{"end":[23,49],"name":"tests/purus/passing/Misc/Prelude.purs","start":[23,45]},[]],"contents":[["Prelude"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[23,51],"name":"tests/purus/passing/Misc/Prelude.purs","start":[23,50]},[]],"contents":{"kind":{"annotation":[{"end":[23,32],"name":"tests/purus/passing/Misc/Prelude.purs","start":[23,28]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},"value":{"identifier":"ys","sourcePos":[25,24]}},"kind":"App"},"kind":"App"},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[24,23],"start":[24,1]}},"kind":"Var","type":{"annotation":[{"end":[23,41],"name":"tests/purus/passing/Misc/Prelude.purs","start":[23,35]},[]],"contents":[{"annotation":[{"end":[23,39],"name":"tests/purus/passing/Misc/Prelude.purs","start":[23,35]},[]],"contents":[["Prelude"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[23,41],"name":"tests/purus/passing/Misc/Prelude.purs","start":[23,40]},[]],"contents":{"kind":{"annotation":[{"end":[23,32],"name":"tests/purus/passing/Misc/Prelude.purs","start":[23,28]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},"value":{"identifier":"v","sourcePos":[0,0]}},{"annotation":{"meta":null,"sourceSpan":{"end":[24,23],"start":[24,1]}},"kind":"Var","type":{"annotation":[{"end":[23,51],"name":"tests/purus/passing/Misc/Prelude.purs","start":[23,45]},[]],"contents":[{"annotation":[{"end":[23,49],"name":"tests/purus/passing/Misc/Prelude.purs","start":[23,45]},[]],"contents":[["Prelude"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[23,51],"name":"tests/purus/passing/Misc/Prelude.purs","start":[23,50]},[]],"contents":{"kind":{"annotation":[{"end":[23,32],"name":"tests/purus/passing/Misc/Prelude.purs","start":[23,28]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},"value":{"identifier":"v1","sourcePos":[0,0]}}],"kind":"Case","type":{"annotation":[{"end":[23,61],"name":"tests/purus/passing/Misc/Prelude.purs","start":[23,55]},[]],"contents":[{"annotation":[{"end":[23,59],"name":"tests/purus/passing/Misc/Prelude.purs","start":[23,55]},[]],"contents":[["Prelude"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[23,61],"name":"tests/purus/passing/Misc/Prelude.purs","start":[23,60]},[]],"contents":{"kind":{"annotation":[{"end":[23,32],"name":"tests/purus/passing/Misc/Prelude.purs","start":[23,28]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[23,51],"name":"tests/purus/passing/Misc/Prelude.purs","start":[23,45]},[]],"contents":[{"annotation":[{"end":[23,49],"name":"tests/purus/passing/Misc/Prelude.purs","start":[23,45]},[]],"contents":[["Prelude"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[23,51],"name":"tests/purus/passing/Misc/Prelude.purs","start":[23,50]},[]],"contents":{"kind":{"annotation":[{"end":[23,32],"name":"tests/purus/passing/Misc/Prelude.purs","start":[23,28]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[23,61],"name":"tests/purus/passing/Misc/Prelude.purs","start":[23,55]},[]],"contents":[{"annotation":[{"end":[23,59],"name":"tests/purus/passing/Misc/Prelude.purs","start":[23,55]},[]],"contents":[["Prelude"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[23,61],"name":"tests/purus/passing/Misc/Prelude.purs","start":[23,60]},[]],"contents":{"kind":{"annotation":[{"end":[23,32],"name":"tests/purus/passing/Misc/Prelude.purs","start":[23,28]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"kind":"Abs","type":{"annotation":[{"end":[23,61],"name":"tests/purus/passing/Misc/Prelude.purs","start":[23,15]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[23,32],"name":"tests/purus/passing/Misc/Prelude.purs","start":[23,28]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":1,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[23,41],"name":"tests/purus/passing/Misc/Prelude.purs","start":[23,35]},[]],"contents":[{"annotation":[{"end":[23,39],"name":"tests/purus/passing/Misc/Prelude.purs","start":[23,35]},[]],"contents":[["Prelude"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[23,41],"name":"tests/purus/passing/Misc/Prelude.purs","start":[23,40]},[]],"contents":{"kind":{"annotation":[{"end":[23,32],"name":"tests/purus/passing/Misc/Prelude.purs","start":[23,28]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[23,61],"name":"tests/purus/passing/Misc/Prelude.purs","start":[23,45]},[]],"contents":[{"annotation":[{"end":[23,61],"name":"tests/purus/passing/Misc/Prelude.purs","start":[23,45]},[]],"contents":[{"annotation":[{"end":[23,54],"name":"tests/purus/passing/Misc/Prelude.purs","start":[23,52]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[23,51],"name":"tests/purus/passing/Misc/Prelude.purs","start":[23,45]},[]],"contents":[{"annotation":[{"end":[23,49],"name":"tests/purus/passing/Misc/Prelude.purs","start":[23,45]},[]],"contents":[["Prelude"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[23,51],"name":"tests/purus/passing/Misc/Prelude.purs","start":[23,50]},[]],"contents":{"kind":{"annotation":[{"end":[23,32],"name":"tests/purus/passing/Misc/Prelude.purs","start":[23,28]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[23,61],"name":"tests/purus/passing/Misc/Prelude.purs","start":[23,55]},[]],"contents":[{"annotation":[{"end":[23,59],"name":"tests/purus/passing/Misc/Prelude.purs","start":[23,55]},[]],"contents":[["Prelude"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[23,61],"name":"tests/purus/passing/Misc/Prelude.purs","start":[23,60]},[]],"contents":{"kind":{"annotation":[{"end":[23,32],"name":"tests/purus/passing/Misc/Prelude.purs","start":[23,28]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"identifier":"appendList"}]},{"annotation":{"meta":null,"sourceSpan":{"end":[8,28],"start":[8,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"argument":"v","body":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"argument":"v1","body":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[9,9],"start":[9,5]}},"binderType":"ConstructorBinder","binders":[],"constructorName":{"identifier":"True","moduleName":["Prelude"]},"typeName":{"identifier":"Bool","moduleName":["Prelude"]}},{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[9,14],"start":[9,10]}},"binderType":"ConstructorBinder","binders":[],"constructorName":{"identifier":"True","moduleName":["Prelude"]},"typeName":{"identifier":"Bool","moduleName":["Prelude"]}}],"expression":{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[9,21],"start":[9,17]}},"kind":"Var","type":{"annotation":[{"end":[8,28],"name":"tests/purus/passing/Misc/Prelude.purs","start":[8,24]},[]],"contents":[["Prelude"],"Bool"],"tag":"TypeConstructor"},"value":{"identifier":"True","moduleName":["Prelude"]}},"isGuarded":false},{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[10,6],"start":[10,5]}},"binderType":"NullBinder"},{"annotation":{"meta":null,"sourceSpan":{"end":[10,8],"start":[10,7]}},"binderType":"NullBinder"}],"expression":{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[10,16],"start":[10,11]}},"kind":"Var","type":{"annotation":[{"end":[8,28],"name":"tests/purus/passing/Misc/Prelude.purs","start":[8,24]},[]],"contents":[["Prelude"],"Bool"],"tag":"TypeConstructor"},"value":{"identifier":"False","moduleName":["Prelude"]}},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[9,21],"start":[9,1]}},"kind":"Var","type":{"annotation":[{"end":[8,12],"name":"tests/purus/passing/Misc/Prelude.purs","start":[8,8]},[]],"contents":[["Prelude"],"Bool"],"tag":"TypeConstructor"},"value":{"identifier":"v","sourcePos":[0,0]}},{"annotation":{"meta":null,"sourceSpan":{"end":[9,21],"start":[9,1]}},"kind":"Var","type":{"annotation":[{"end":[8,20],"name":"tests/purus/passing/Misc/Prelude.purs","start":[8,16]},[]],"contents":[["Prelude"],"Bool"],"tag":"TypeConstructor"},"value":{"identifier":"v1","sourcePos":[0,0]}}],"kind":"Case","type":{"annotation":[{"end":[8,28],"name":"tests/purus/passing/Misc/Prelude.purs","start":[8,24]},[]],"contents":[["Prelude"],"Bool"],"tag":"TypeConstructor"}},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[8,20],"name":"tests/purus/passing/Misc/Prelude.purs","start":[8,16]},[]],"contents":[["Prelude"],"Bool"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[8,28],"name":"tests/purus/passing/Misc/Prelude.purs","start":[8,24]},[]],"contents":[["Prelude"],"Bool"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[8,12],"name":"tests/purus/passing/Misc/Prelude.purs","start":[8,8]},[]],"contents":[["Prelude"],"Bool"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[8,28],"name":"tests/purus/passing/Misc/Prelude.purs","start":[8,16]},[]],"contents":[{"annotation":[{"end":[8,28],"name":"tests/purus/passing/Misc/Prelude.purs","start":[8,16]},[]],"contents":[{"annotation":[{"end":[8,23],"name":"tests/purus/passing/Misc/Prelude.purs","start":[8,21]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[8,20],"name":"tests/purus/passing/Misc/Prelude.purs","start":[8,16]},[]],"contents":[["Prelude"],"Bool"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[8,28],"name":"tests/purus/passing/Misc/Prelude.purs","start":[8,24]},[]],"contents":[["Prelude"],"Bool"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"identifier":"and"}],"exports":["True","False","and","or","not","Nil","Cons","appendList"],"foreign":[],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[25,54],"start":[1,1]}},"moduleName":["Builtin"]},{"annotation":{"meta":null,"sourceSpan":{"end":[25,54],"start":[1,1]}},"moduleName":["Prelude"]},{"annotation":{"meta":null,"sourceSpan":{"end":[25,54],"start":[1,1]}},"moduleName":["Prim"]}],"moduleName":["Prelude"],"modulePath":"tests/purus/passing/Misc/Prelude.purs","reExports":{},"sourceSpan":{"end":[25,54],"start":[1,1]}} \ No newline at end of file diff --git a/tests/purus/passing/Misc/output/Prelude/Prelude.cfn.pretty b/tests/purus/passing/Misc/output/Prelude/Prelude.cfn.pretty new file mode 100644 index 000000000..e11753ed6 --- /dev/null +++ b/tests/purus/passing/Misc/output/Prelude/Prelude.cfn.pretty @@ -0,0 +1,81 @@ +Prelude (tests/purus/passing/Misc/Prelude.purs) + +Imported Modules: +------------------------------ + Builtin, + Prelude, + Prim + +Exports: +------------------------------ + True, + False, + and, + or, + not, + Nil, + Cons, + appendList + +Re-Exports: +------------------------------ + + +Foreign: +------------------------------ + + +Datatypes: +------------------------------ +data Bool = + True + | False + +data List (a :: Prim.Type) = + Nil + | Cons ((a :: Prim.Type)) ((Prelude.List ((a :: Prim.Type)))) + + +Declarations: +------------------------------ +or :: (Prelude.Bool -> ((Prelude.Bool -> (Prelude.Bool)))) +or = + \(v: Prelude.Bool) -> + \(v1: Prelude.Bool) -> + case (v: Prelude.Bool) (v1: Prelude.Bool) of + True _ -> (True: Prelude.Bool) + _ True -> (True: Prelude.Bool) + _ _ -> (False: Prelude.Bool) + +not :: (Prelude.Bool -> (Prelude.Bool)) +not = + \(v: Prelude.Bool) -> + case (v: Prelude.Bool) of + True -> (False: Prelude.Bool) + False -> (True: Prelude.Bool) + +appendList :: forall (a :: Prim.Type). ((Prelude.List ((a :: Prim.Type))) -> (((Prelude.List ((a :: Prim.Type))) -> ((Prelude.List ((a :: Prim.Type))))))) +appendList = + \(v: (Prelude.List ((a :: Prim.Type)))) -> + \(v1: (Prelude.List ((a :: Prim.Type)))) -> + case (v: (Prelude.List ((a :: Prim.Type)))) (v1: (Prelude.List ((a :: Prim.Type)))) of + Nil ys -> (ys: (Prelude.List ((a :: Prim.Type)))) + Cons x xs ys -> + (Cons: forall (@a :: Prim.Type). ((a :: Prim.Type) -> + (((Prelude.List ((a :: Prim.Type))) -> + ((Prelude.List ((a :: Prim.Type)))))))) + (x: (a :: Prim.Type)) + ((appendList: forall (a :: Prim.Type). ((Prelude.List + ((a :: Prim.Type))) -> + (((Prelude.List ((a :: Prim.Type))) -> + ((Prelude.List ((a :: Prim.Type)))))))) + (xs: (Prelude.List ((a :: Prim.Type)))) + (ys: (Prelude.List ((a :: Prim.Type))))) + +and :: (Prelude.Bool -> ((Prelude.Bool -> (Prelude.Bool)))) +and = + \(v: Prelude.Bool) -> + \(v1: Prelude.Bool) -> + case (v: Prelude.Bool) (v1: Prelude.Bool) of + True True -> (True: Prelude.Bool) + _ _ -> (False: Prelude.Bool) \ No newline at end of file diff --git a/tests/purus/passing/Misc/output/Prelude/externs.cbor b/tests/purus/passing/Misc/output/Prelude/externs.cbor new file mode 100644 index 000000000..7fcb67017 Binary files /dev/null and b/tests/purus/passing/Misc/output/Prelude/externs.cbor differ diff --git a/tests/purus/passing/Misc/output/package.json b/tests/purus/passing/Misc/output/package.json new file mode 100644 index 000000000..7c34deb58 --- /dev/null +++ b/tests/purus/passing/Misc/output/package.json @@ -0,0 +1 @@ +{"type":"module"} \ No newline at end of file diff --git a/tests/purus/passing/ModuleDeps/M1.purs b/tests/purus/passing/ModuleDeps/M1.purs new file mode 100644 index 000000000..535aa287c --- /dev/null +++ b/tests/purus/passing/ModuleDeps/M1.purs @@ -0,0 +1,5 @@ +module M1 where + +import M2 as M2 + +foo = M2.bar diff --git a/tests/purus/passing/ModuleDeps/M2.purs b/tests/purus/passing/ModuleDeps/M2.purs new file mode 100644 index 000000000..017e70e3f --- /dev/null +++ b/tests/purus/passing/ModuleDeps/M2.purs @@ -0,0 +1,5 @@ +module M2 where + +import M3 as M3 + +bar = M3.baz diff --git a/tests/purus/passing/ModuleDeps/M3.purs b/tests/purus/passing/ModuleDeps/M3.purs new file mode 100644 index 000000000..f07167b71 --- /dev/null +++ b/tests/purus/passing/ModuleDeps/M3.purs @@ -0,0 +1,3 @@ +module M3 where + +baz = 1 diff --git a/tests/purus/passing/ModuleDeps/output/M1/M1.cfn b/tests/purus/passing/ModuleDeps/output/M1/M1.cfn new file mode 100644 index 000000000..03fd9b517 --- /dev/null +++ b/tests/purus/passing/ModuleDeps/output/M1/M1.cfn @@ -0,0 +1 @@ +{"builtWith":"0.0.1","comments":[],"dataTypes":{"_ctorDict":[],"_tyDict":[]},"decls":[{"annotation":{"meta":null,"sourceSpan":{"end":[5,13],"start":[5,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[5,13],"start":[5,7]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"identifier":"bar","moduleName":["M2"]}},"identifier":"foo"}],"exports":["foo"],"foreign":[],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[5,13],"start":[1,1]}},"moduleName":["Builtin"]},{"annotation":{"meta":null,"sourceSpan":{"end":[5,13],"start":[1,1]}},"moduleName":["M2"]},{"annotation":{"meta":null,"sourceSpan":{"end":[5,13],"start":[1,1]}},"moduleName":["Prim"]}],"moduleName":["M1"],"modulePath":"tests/purus/passing/ModuleDeps/M1.purs","reExports":{},"sourceSpan":{"end":[5,13],"start":[1,1]}} \ No newline at end of file diff --git a/tests/purus/passing/ModuleDeps/output/M1/M1.cfn.pretty b/tests/purus/passing/ModuleDeps/output/M1/M1.cfn.pretty new file mode 100644 index 000000000..53147b10f --- /dev/null +++ b/tests/purus/passing/ModuleDeps/output/M1/M1.cfn.pretty @@ -0,0 +1,29 @@ +M1 (tests/purus/passing/ModuleDeps/M1.purs) + +Imported Modules: +------------------------------ + Builtin, + M2, + Prim + +Exports: +------------------------------ + foo + +Re-Exports: +------------------------------ + + +Foreign: +------------------------------ + + +Datatypes: +------------------------------ + + + +Declarations: +------------------------------ +foo :: Prim.Int +foo = (bar: Prim.Int) \ No newline at end of file diff --git a/tests/purus/passing/ModuleDeps/output/M1/externs.cbor b/tests/purus/passing/ModuleDeps/output/M1/externs.cbor new file mode 100644 index 000000000..923d4de15 Binary files /dev/null and b/tests/purus/passing/ModuleDeps/output/M1/externs.cbor differ diff --git a/tests/purus/passing/ModuleDeps/output/M2/M2.cfn b/tests/purus/passing/ModuleDeps/output/M2/M2.cfn new file mode 100644 index 000000000..0619f7dc9 --- /dev/null +++ b/tests/purus/passing/ModuleDeps/output/M2/M2.cfn @@ -0,0 +1 @@ +{"builtWith":"0.0.1","comments":[],"dataTypes":{"_ctorDict":[],"_tyDict":[]},"decls":[{"annotation":{"meta":null,"sourceSpan":{"end":[5,13],"start":[5,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[5,13],"start":[5,7]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"identifier":"baz","moduleName":["M3"]}},"identifier":"bar"}],"exports":["bar"],"foreign":[],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[5,13],"start":[1,1]}},"moduleName":["Builtin"]},{"annotation":{"meta":null,"sourceSpan":{"end":[5,13],"start":[1,1]}},"moduleName":["M3"]},{"annotation":{"meta":null,"sourceSpan":{"end":[5,13],"start":[1,1]}},"moduleName":["Prim"]}],"moduleName":["M2"],"modulePath":"tests/purus/passing/ModuleDeps/M2.purs","reExports":{},"sourceSpan":{"end":[5,13],"start":[1,1]}} \ No newline at end of file diff --git a/tests/purus/passing/ModuleDeps/output/M2/M2.cfn.pretty b/tests/purus/passing/ModuleDeps/output/M2/M2.cfn.pretty new file mode 100644 index 000000000..5913232ae --- /dev/null +++ b/tests/purus/passing/ModuleDeps/output/M2/M2.cfn.pretty @@ -0,0 +1,29 @@ +M2 (tests/purus/passing/ModuleDeps/M2.purs) + +Imported Modules: +------------------------------ + Builtin, + M3, + Prim + +Exports: +------------------------------ + bar + +Re-Exports: +------------------------------ + + +Foreign: +------------------------------ + + +Datatypes: +------------------------------ + + + +Declarations: +------------------------------ +bar :: Prim.Int +bar = (baz: Prim.Int) \ No newline at end of file diff --git a/tests/purus/passing/ModuleDeps/output/M2/externs.cbor b/tests/purus/passing/ModuleDeps/output/M2/externs.cbor new file mode 100644 index 000000000..2a7641000 Binary files /dev/null and b/tests/purus/passing/ModuleDeps/output/M2/externs.cbor differ diff --git a/tests/purus/passing/ModuleDeps/output/M3/M3.cfn b/tests/purus/passing/ModuleDeps/output/M3/M3.cfn new file mode 100644 index 000000000..b1a6cf075 --- /dev/null +++ b/tests/purus/passing/ModuleDeps/output/M3/M3.cfn @@ -0,0 +1 @@ +{"builtWith":"0.0.1","comments":[],"dataTypes":{"_ctorDict":[],"_tyDict":[]},"decls":[{"annotation":{"meta":null,"sourceSpan":{"end":[3,8],"start":[3,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[3,8],"start":[3,7]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"literalType":"IntLiteral","value":1}},"identifier":"baz"}],"exports":["baz"],"foreign":[],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[3,8],"start":[1,1]}},"moduleName":["Builtin"]},{"annotation":{"meta":null,"sourceSpan":{"end":[3,8],"start":[1,1]}},"moduleName":["Prim"]}],"moduleName":["M3"],"modulePath":"tests/purus/passing/ModuleDeps/M3.purs","reExports":{},"sourceSpan":{"end":[3,8],"start":[1,1]}} \ No newline at end of file diff --git a/tests/purus/passing/ModuleDeps/output/M3/M3.cfn.pretty b/tests/purus/passing/ModuleDeps/output/M3/M3.cfn.pretty new file mode 100644 index 000000000..7ed4542e3 --- /dev/null +++ b/tests/purus/passing/ModuleDeps/output/M3/M3.cfn.pretty @@ -0,0 +1,28 @@ +M3 (tests/purus/passing/ModuleDeps/M3.purs) + +Imported Modules: +------------------------------ + Builtin, + Prim + +Exports: +------------------------------ + baz + +Re-Exports: +------------------------------ + + +Foreign: +------------------------------ + + +Datatypes: +------------------------------ + + + +Declarations: +------------------------------ +baz :: Prim.Int +baz = (1: Prim.Int) \ No newline at end of file diff --git a/tests/purus/passing/ModuleDeps/output/M3/externs.cbor b/tests/purus/passing/ModuleDeps/output/M3/externs.cbor new file mode 100644 index 000000000..5053b861d Binary files /dev/null and b/tests/purus/passing/ModuleDeps/output/M3/externs.cbor differ diff --git a/tests/purus/passing/ModuleDeps/output/package.json b/tests/purus/passing/ModuleDeps/output/package.json new file mode 100644 index 000000000..7c34deb58 --- /dev/null +++ b/tests/purus/passing/ModuleDeps/output/package.json @@ -0,0 +1 @@ +{"type":"module"} \ No newline at end of file diff --git a/tests/purus/passing/NonOrphanInstanceFunDepExtra/Lib.purs b/tests/purus/passing/NonOrphanInstanceFunDepExtra/Lib.purs new file mode 100644 index 000000000..f068056b7 --- /dev/null +++ b/tests/purus/passing/NonOrphanInstanceFunDepExtra/Lib.purs @@ -0,0 +1,4 @@ +module Lib where +-- covering sets: {{f, l}} +class C (f :: Type) (l :: Type) (r :: Type) | l -> r +data L diff --git a/tests/purus/passing/NonOrphanInstanceFunDepExtra/output/Lib/Lib.cfn b/tests/purus/passing/NonOrphanInstanceFunDepExtra/output/Lib/Lib.cfn new file mode 100644 index 000000000..5e868a1e2 --- /dev/null +++ b/tests/purus/passing/NonOrphanInstanceFunDepExtra/output/Lib/Lib.cfn @@ -0,0 +1 @@ +{"builtWith":"0.0.1","comments":[],"dataTypes":{"_ctorDict":[[[["Lib"],{"Ident":"C$Dict"}],[["Lib"],"C$Dict"]]],"_tyDict":[[[["Lib"],"C$Dict"],{"_dDataArgs":[["f",{"annotation":[{"end":[3,19],"name":"tests/purus/passing/NonOrphanInstanceFunDepExtra/Lib.purs","start":[3,15]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],["l",{"annotation":[{"end":[3,31],"name":"tests/purus/passing/NonOrphanInstanceFunDepExtra/Lib.purs","start":[3,27]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],["r",{"annotation":[{"end":[3,43],"name":"tests/purus/passing/NonOrphanInstanceFunDepExtra/Lib.purs","start":[3,39]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}]],"_dDataCtors":[{"_cdCtorFields":[[{"Ident":"dict"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"tag":"REmpty"}],"tag":"TypeApp"}]],"_cdCtorName":[["Lib"],{"Ident":"C$Dict"}]}],"_dDataTyName":[["Lib"],"C$Dict"],"_dDeclType":"newtype"}],[[["Lib"],"L"],{"_dDataArgs":[],"_dDataCtors":[],"_dDataTyName":[["Lib"],"L"],"_dDeclType":"data"}]]},"decls":[],"exports":[],"foreign":[],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[4,7],"start":[1,1]}},"moduleName":["Builtin"]},{"annotation":{"meta":null,"sourceSpan":{"end":[4,7],"start":[1,1]}},"moduleName":["Prim"]}],"moduleName":["Lib"],"modulePath":"tests/purus/passing/NonOrphanInstanceFunDepExtra/Lib.purs","reExports":{},"sourceSpan":{"end":[4,7],"start":[1,1]}} \ No newline at end of file diff --git a/tests/purus/passing/NonOrphanInstanceFunDepExtra/output/Lib/Lib.cfn.pretty b/tests/purus/passing/NonOrphanInstanceFunDepExtra/output/Lib/Lib.cfn.pretty new file mode 100644 index 000000000..aa655f793 --- /dev/null +++ b/tests/purus/passing/NonOrphanInstanceFunDepExtra/output/Lib/Lib.cfn.pretty @@ -0,0 +1,30 @@ +Lib (tests/purus/passing/NonOrphanInstanceFunDepExtra/Lib.purs) + +Imported Modules: +------------------------------ + Builtin, + Prim + +Exports: +------------------------------ + + +Re-Exports: +------------------------------ + + +Foreign: +------------------------------ + + +Datatypes: +------------------------------ +newtype C$Dict (f :: Prim.Type) (l :: Prim.Type) (r :: Prim.Type) = + C$Dict ((Prim.Record ({}))) + +data L = + + + +Declarations: +------------------------------ diff --git a/tests/purus/passing/NonOrphanInstanceFunDepExtra/output/Lib/externs.cbor b/tests/purus/passing/NonOrphanInstanceFunDepExtra/output/Lib/externs.cbor new file mode 100644 index 000000000..33ef98673 Binary files /dev/null and b/tests/purus/passing/NonOrphanInstanceFunDepExtra/output/Lib/externs.cbor differ diff --git a/tests/purus/passing/NonOrphanInstanceFunDepExtra/output/package.json b/tests/purus/passing/NonOrphanInstanceFunDepExtra/output/package.json new file mode 100644 index 000000000..7c34deb58 --- /dev/null +++ b/tests/purus/passing/NonOrphanInstanceFunDepExtra/output/package.json @@ -0,0 +1 @@ +{"type":"module"} \ No newline at end of file diff --git a/tests/purus/passing/NonOrphanInstanceMulti/Lib.purs b/tests/purus/passing/NonOrphanInstanceMulti/Lib.purs new file mode 100644 index 000000000..2c48f2930 --- /dev/null +++ b/tests/purus/passing/NonOrphanInstanceMulti/Lib.purs @@ -0,0 +1,4 @@ +module Lib where +-- covering sets: {{l, r}} +class C (l :: Type) (r :: Type) +data R diff --git a/tests/purus/passing/NonOrphanInstanceMulti/output/Lib/Lib.cfn b/tests/purus/passing/NonOrphanInstanceMulti/output/Lib/Lib.cfn new file mode 100644 index 000000000..80cb57e33 --- /dev/null +++ b/tests/purus/passing/NonOrphanInstanceMulti/output/Lib/Lib.cfn @@ -0,0 +1 @@ +{"builtWith":"0.0.1","comments":[],"dataTypes":{"_ctorDict":[[[["Lib"],{"Ident":"C$Dict"}],[["Lib"],"C$Dict"]]],"_tyDict":[[[["Lib"],"C$Dict"],{"_dDataArgs":[["l",{"annotation":[{"end":[3,19],"name":"tests/purus/passing/NonOrphanInstanceMulti/Lib.purs","start":[3,15]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],["r",{"annotation":[{"end":[3,31],"name":"tests/purus/passing/NonOrphanInstanceMulti/Lib.purs","start":[3,27]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}]],"_dDataCtors":[{"_cdCtorFields":[[{"Ident":"dict"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"tag":"REmpty"}],"tag":"TypeApp"}]],"_cdCtorName":[["Lib"],{"Ident":"C$Dict"}]}],"_dDataTyName":[["Lib"],"C$Dict"],"_dDeclType":"newtype"}],[[["Lib"],"R"],{"_dDataArgs":[],"_dDataCtors":[],"_dDataTyName":[["Lib"],"R"],"_dDeclType":"data"}]]},"decls":[],"exports":[],"foreign":[],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[4,7],"start":[1,1]}},"moduleName":["Builtin"]},{"annotation":{"meta":null,"sourceSpan":{"end":[4,7],"start":[1,1]}},"moduleName":["Prim"]}],"moduleName":["Lib"],"modulePath":"tests/purus/passing/NonOrphanInstanceMulti/Lib.purs","reExports":{},"sourceSpan":{"end":[4,7],"start":[1,1]}} \ No newline at end of file diff --git a/tests/purus/passing/NonOrphanInstanceMulti/output/Lib/Lib.cfn.pretty b/tests/purus/passing/NonOrphanInstanceMulti/output/Lib/Lib.cfn.pretty new file mode 100644 index 000000000..3f5aa8698 --- /dev/null +++ b/tests/purus/passing/NonOrphanInstanceMulti/output/Lib/Lib.cfn.pretty @@ -0,0 +1,30 @@ +Lib (tests/purus/passing/NonOrphanInstanceMulti/Lib.purs) + +Imported Modules: +------------------------------ + Builtin, + Prim + +Exports: +------------------------------ + + +Re-Exports: +------------------------------ + + +Foreign: +------------------------------ + + +Datatypes: +------------------------------ +newtype C$Dict (l :: Prim.Type) (r :: Prim.Type) = + C$Dict ((Prim.Record ({}))) + +data R = + + + +Declarations: +------------------------------ diff --git a/tests/purus/passing/NonOrphanInstanceMulti/output/Lib/externs.cbor b/tests/purus/passing/NonOrphanInstanceMulti/output/Lib/externs.cbor new file mode 100644 index 000000000..7959320f4 Binary files /dev/null and b/tests/purus/passing/NonOrphanInstanceMulti/output/Lib/externs.cbor differ diff --git a/tests/purus/passing/NonOrphanInstanceMulti/output/package.json b/tests/purus/passing/NonOrphanInstanceMulti/output/package.json new file mode 100644 index 000000000..7c34deb58 --- /dev/null +++ b/tests/purus/passing/NonOrphanInstanceMulti/output/package.json @@ -0,0 +1 @@ +{"type":"module"} \ No newline at end of file diff --git a/tests/purus/passing/PendingConflictingImports/A.purs b/tests/purus/passing/PendingConflictingImports/A.purs new file mode 100644 index 000000000..302b0328d --- /dev/null +++ b/tests/purus/passing/PendingConflictingImports/A.purs @@ -0,0 +1,4 @@ +module A where + +thing :: Int +thing = 1 diff --git a/tests/purus/passing/PendingConflictingImports/B.purs b/tests/purus/passing/PendingConflictingImports/B.purs new file mode 100644 index 000000000..076bf7ea5 --- /dev/null +++ b/tests/purus/passing/PendingConflictingImports/B.purs @@ -0,0 +1,4 @@ +module B where + +thing :: Int +thing = 2 diff --git a/tests/purus/passing/PendingConflictingImports/PendingConflictingImports.purs b/tests/purus/passing/PendingConflictingImports/PendingConflictingImports.purs new file mode 100644 index 000000000..b42cd06fd --- /dev/null +++ b/tests/purus/passing/PendingConflictingImports/PendingConflictingImports.purs @@ -0,0 +1,8 @@ +module Main where + +-- No error as we never force `thing` to be resolved in `Main` +import A +import B + + +main = "Done" diff --git a/tests/purus/passing/PendingConflictingImports/output/A/A.cfn b/tests/purus/passing/PendingConflictingImports/output/A/A.cfn new file mode 100644 index 000000000..ca1124814 --- /dev/null +++ b/tests/purus/passing/PendingConflictingImports/output/A/A.cfn @@ -0,0 +1 @@ +{"builtWith":"0.0.1","comments":[],"dataTypes":{"_ctorDict":[],"_tyDict":[]},"decls":[{"annotation":{"meta":null,"sourceSpan":{"end":[3,13],"start":[3,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[4,10],"start":[4,9]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"literalType":"IntLiteral","value":1}},"identifier":"thing"}],"exports":["thing"],"foreign":[],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[4,10],"start":[1,1]}},"moduleName":["Builtin"]},{"annotation":{"meta":null,"sourceSpan":{"end":[4,10],"start":[1,1]}},"moduleName":["Prim"]}],"moduleName":["A"],"modulePath":"tests/purus/passing/PendingConflictingImports/A.purs","reExports":{},"sourceSpan":{"end":[4,10],"start":[1,1]}} \ No newline at end of file diff --git a/tests/purus/passing/PendingConflictingImports/output/A/A.cfn.pretty b/tests/purus/passing/PendingConflictingImports/output/A/A.cfn.pretty new file mode 100644 index 000000000..d05e5385f --- /dev/null +++ b/tests/purus/passing/PendingConflictingImports/output/A/A.cfn.pretty @@ -0,0 +1,28 @@ +A (tests/purus/passing/PendingConflictingImports/A.purs) + +Imported Modules: +------------------------------ + Builtin, + Prim + +Exports: +------------------------------ + thing + +Re-Exports: +------------------------------ + + +Foreign: +------------------------------ + + +Datatypes: +------------------------------ + + + +Declarations: +------------------------------ +thing :: Prim.Int +thing = (1: Prim.Int) \ No newline at end of file diff --git a/tests/purus/passing/PendingConflictingImports/output/A/externs.cbor b/tests/purus/passing/PendingConflictingImports/output/A/externs.cbor new file mode 100644 index 000000000..48749abf1 Binary files /dev/null and b/tests/purus/passing/PendingConflictingImports/output/A/externs.cbor differ diff --git a/tests/purus/passing/PendingConflictingImports/output/B/B.cfn b/tests/purus/passing/PendingConflictingImports/output/B/B.cfn new file mode 100644 index 000000000..edba5a645 --- /dev/null +++ b/tests/purus/passing/PendingConflictingImports/output/B/B.cfn @@ -0,0 +1 @@ +{"builtWith":"0.0.1","comments":[],"dataTypes":{"_ctorDict":[],"_tyDict":[]},"decls":[{"annotation":{"meta":null,"sourceSpan":{"end":[3,13],"start":[3,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[4,10],"start":[4,9]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"literalType":"IntLiteral","value":2}},"identifier":"thing"}],"exports":["thing"],"foreign":[],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[4,10],"start":[1,1]}},"moduleName":["Builtin"]},{"annotation":{"meta":null,"sourceSpan":{"end":[4,10],"start":[1,1]}},"moduleName":["Prim"]}],"moduleName":["B"],"modulePath":"tests/purus/passing/PendingConflictingImports/B.purs","reExports":{},"sourceSpan":{"end":[4,10],"start":[1,1]}} \ No newline at end of file diff --git a/tests/purus/passing/PendingConflictingImports/output/B/B.cfn.pretty b/tests/purus/passing/PendingConflictingImports/output/B/B.cfn.pretty new file mode 100644 index 000000000..86716eb93 --- /dev/null +++ b/tests/purus/passing/PendingConflictingImports/output/B/B.cfn.pretty @@ -0,0 +1,28 @@ +B (tests/purus/passing/PendingConflictingImports/B.purs) + +Imported Modules: +------------------------------ + Builtin, + Prim + +Exports: +------------------------------ + thing + +Re-Exports: +------------------------------ + + +Foreign: +------------------------------ + + +Datatypes: +------------------------------ + + + +Declarations: +------------------------------ +thing :: Prim.Int +thing = (2: Prim.Int) \ No newline at end of file diff --git a/tests/purus/passing/PendingConflictingImports/output/B/externs.cbor b/tests/purus/passing/PendingConflictingImports/output/B/externs.cbor new file mode 100644 index 000000000..64166ff20 Binary files /dev/null and b/tests/purus/passing/PendingConflictingImports/output/B/externs.cbor differ diff --git a/tests/purus/passing/PendingConflictingImports/output/Main/Main.cfn b/tests/purus/passing/PendingConflictingImports/output/Main/Main.cfn new file mode 100644 index 000000000..8a36d0eef --- /dev/null +++ b/tests/purus/passing/PendingConflictingImports/output/Main/Main.cfn @@ -0,0 +1 @@ +{"builtWith":"0.0.1","comments":[],"dataTypes":{"_ctorDict":[],"_tyDict":[]},"decls":[{"annotation":{"meta":null,"sourceSpan":{"end":[8,14],"start":[8,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[8,14],"start":[8,8]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"String"],"tag":"TypeConstructor"},"value":{"literalType":"StringLiteral","value":"Done"}},"identifier":"main"}],"exports":["main"],"foreign":[],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[4,9],"start":[4,1]}},"moduleName":["A"]},{"annotation":{"meta":null,"sourceSpan":{"end":[5,9],"start":[5,1]}},"moduleName":["B"]},{"annotation":{"meta":null,"sourceSpan":{"end":[8,14],"start":[1,1]}},"moduleName":["Builtin"]},{"annotation":{"meta":null,"sourceSpan":{"end":[8,14],"start":[1,1]}},"moduleName":["Prim"]}],"moduleName":["Main"],"modulePath":"tests/purus/passing/PendingConflictingImports/PendingConflictingImports.purs","reExports":{},"sourceSpan":{"end":[8,14],"start":[1,1]}} \ No newline at end of file diff --git a/tests/purus/passing/PendingConflictingImports/output/Main/Main.cfn.pretty b/tests/purus/passing/PendingConflictingImports/output/Main/Main.cfn.pretty new file mode 100644 index 000000000..7a9779eef --- /dev/null +++ b/tests/purus/passing/PendingConflictingImports/output/Main/Main.cfn.pretty @@ -0,0 +1,30 @@ +Main (tests/purus/passing/PendingConflictingImports/PendingConflictingImports.purs) + +Imported Modules: +------------------------------ + A, + B, + Builtin, + Prim + +Exports: +------------------------------ + main + +Re-Exports: +------------------------------ + + +Foreign: +------------------------------ + + +Datatypes: +------------------------------ + + + +Declarations: +------------------------------ +main :: Prim.String +main = ("Done": Prim.String) \ No newline at end of file diff --git a/tests/purus/passing/PendingConflictingImports/output/Main/externs.cbor b/tests/purus/passing/PendingConflictingImports/output/Main/externs.cbor new file mode 100644 index 000000000..d757b9c6d Binary files /dev/null and b/tests/purus/passing/PendingConflictingImports/output/Main/externs.cbor differ diff --git a/tests/purus/passing/PendingConflictingImports/output/package.json b/tests/purus/passing/PendingConflictingImports/output/package.json new file mode 100644 index 000000000..7c34deb58 --- /dev/null +++ b/tests/purus/passing/PendingConflictingImports/output/package.json @@ -0,0 +1 @@ +{"type":"module"} \ No newline at end of file diff --git a/tests/purus/passing/PendingConflictingImports2/A.purs b/tests/purus/passing/PendingConflictingImports2/A.purs new file mode 100644 index 000000000..302b0328d --- /dev/null +++ b/tests/purus/passing/PendingConflictingImports2/A.purs @@ -0,0 +1,4 @@ +module A where + +thing :: Int +thing = 1 diff --git a/tests/purus/passing/PendingConflictingImports2/PendingConflictingImports2.purs b/tests/purus/passing/PendingConflictingImports2/PendingConflictingImports2.purs new file mode 100644 index 000000000..81c3d821d --- /dev/null +++ b/tests/purus/passing/PendingConflictingImports2/PendingConflictingImports2.purs @@ -0,0 +1,9 @@ +module Main where + +import A + +-- No error as we never force `thing` to be resolved in `Main` +thing :: Int +thing = 2 + +main = "Done" diff --git a/tests/purus/passing/PendingConflictingImports2/output/A/A.cfn b/tests/purus/passing/PendingConflictingImports2/output/A/A.cfn new file mode 100644 index 000000000..21a9be784 --- /dev/null +++ b/tests/purus/passing/PendingConflictingImports2/output/A/A.cfn @@ -0,0 +1 @@ +{"builtWith":"0.0.1","comments":[],"dataTypes":{"_ctorDict":[],"_tyDict":[]},"decls":[{"annotation":{"meta":null,"sourceSpan":{"end":[3,13],"start":[3,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[4,10],"start":[4,9]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"literalType":"IntLiteral","value":1}},"identifier":"thing"}],"exports":["thing"],"foreign":[],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[4,10],"start":[1,1]}},"moduleName":["Builtin"]},{"annotation":{"meta":null,"sourceSpan":{"end":[4,10],"start":[1,1]}},"moduleName":["Prim"]}],"moduleName":["A"],"modulePath":"tests/purus/passing/PendingConflictingImports2/A.purs","reExports":{},"sourceSpan":{"end":[4,10],"start":[1,1]}} \ No newline at end of file diff --git a/tests/purus/passing/PendingConflictingImports2/output/A/A.cfn.pretty b/tests/purus/passing/PendingConflictingImports2/output/A/A.cfn.pretty new file mode 100644 index 000000000..b2cb0b31b --- /dev/null +++ b/tests/purus/passing/PendingConflictingImports2/output/A/A.cfn.pretty @@ -0,0 +1,28 @@ +A (tests/purus/passing/PendingConflictingImports2/A.purs) + +Imported Modules: +------------------------------ + Builtin, + Prim + +Exports: +------------------------------ + thing + +Re-Exports: +------------------------------ + + +Foreign: +------------------------------ + + +Datatypes: +------------------------------ + + + +Declarations: +------------------------------ +thing :: Prim.Int +thing = (1: Prim.Int) \ No newline at end of file diff --git a/tests/purus/passing/PendingConflictingImports2/output/A/externs.cbor b/tests/purus/passing/PendingConflictingImports2/output/A/externs.cbor new file mode 100644 index 000000000..0a92ab5fc Binary files /dev/null and b/tests/purus/passing/PendingConflictingImports2/output/A/externs.cbor differ diff --git a/tests/purus/passing/PendingConflictingImports2/output/Main/Main.cfn b/tests/purus/passing/PendingConflictingImports2/output/Main/Main.cfn new file mode 100644 index 000000000..f24757d64 --- /dev/null +++ b/tests/purus/passing/PendingConflictingImports2/output/Main/Main.cfn @@ -0,0 +1 @@ +{"builtWith":"0.0.1","comments":[],"dataTypes":{"_ctorDict":[],"_tyDict":[]},"decls":[{"annotation":{"meta":null,"sourceSpan":{"end":[6,13],"start":[6,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[7,10],"start":[7,9]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"literalType":"IntLiteral","value":2}},"identifier":"thing"},{"annotation":{"meta":null,"sourceSpan":{"end":[9,15],"start":[9,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[9,15],"start":[9,9]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"String"],"tag":"TypeConstructor"},"value":{"literalType":"StringLiteral","value":"Done"}},"identifier":"main"}],"exports":["thing","main"],"foreign":[],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[3,9],"start":[3,1]}},"moduleName":["A"]},{"annotation":{"meta":null,"sourceSpan":{"end":[9,15],"start":[1,1]}},"moduleName":["Builtin"]},{"annotation":{"meta":null,"sourceSpan":{"end":[9,15],"start":[1,1]}},"moduleName":["Prim"]}],"moduleName":["Main"],"modulePath":"tests/purus/passing/PendingConflictingImports2/PendingConflictingImports2.purs","reExports":{},"sourceSpan":{"end":[9,15],"start":[1,1]}} \ No newline at end of file diff --git a/tests/purus/passing/PendingConflictingImports2/output/Main/Main.cfn.pretty b/tests/purus/passing/PendingConflictingImports2/output/Main/Main.cfn.pretty new file mode 100644 index 000000000..b11a76cc3 --- /dev/null +++ b/tests/purus/passing/PendingConflictingImports2/output/Main/Main.cfn.pretty @@ -0,0 +1,33 @@ +Main (tests/purus/passing/PendingConflictingImports2/PendingConflictingImports2.purs) + +Imported Modules: +------------------------------ + A, + Builtin, + Prim + +Exports: +------------------------------ + thing, + main + +Re-Exports: +------------------------------ + + +Foreign: +------------------------------ + + +Datatypes: +------------------------------ + + + +Declarations: +------------------------------ +thing :: Prim.Int +thing = (2: Prim.Int) + +main :: Prim.String +main = ("Done": Prim.String) \ No newline at end of file diff --git a/tests/purus/passing/PendingConflictingImports2/output/Main/externs.cbor b/tests/purus/passing/PendingConflictingImports2/output/Main/externs.cbor new file mode 100644 index 000000000..44bf928fa Binary files /dev/null and b/tests/purus/passing/PendingConflictingImports2/output/Main/externs.cbor differ diff --git a/tests/purus/passing/PendingConflictingImports2/output/package.json b/tests/purus/passing/PendingConflictingImports2/output/package.json new file mode 100644 index 000000000..7c34deb58 --- /dev/null +++ b/tests/purus/passing/PendingConflictingImports2/output/package.json @@ -0,0 +1 @@ +{"type":"module"} \ No newline at end of file diff --git a/tests/purus/passing/ReExportQualified/A.purs b/tests/purus/passing/ReExportQualified/A.purs new file mode 100644 index 000000000..ae231283a --- /dev/null +++ b/tests/purus/passing/ReExportQualified/A.purs @@ -0,0 +1,3 @@ +module A where + +x = "Do" diff --git a/tests/purus/passing/ReExportQualified/B.purs b/tests/purus/passing/ReExportQualified/B.purs new file mode 100644 index 000000000..2e149222f --- /dev/null +++ b/tests/purus/passing/ReExportQualified/B.purs @@ -0,0 +1,3 @@ +module B where + +y = "ne" diff --git a/tests/purus/passing/ReExportQualified/C.purs b/tests/purus/passing/ReExportQualified/C.purs new file mode 100644 index 000000000..589f37bc4 --- /dev/null +++ b/tests/purus/passing/ReExportQualified/C.purs @@ -0,0 +1,4 @@ +module C (module A, module M2) where + +import A +import B as M2 diff --git a/tests/purus/passing/ReExportQualified/ReExportQualified.purs b/tests/purus/passing/ReExportQualified/ReExportQualified.purs new file mode 100644 index 000000000..af2f8d272 --- /dev/null +++ b/tests/purus/passing/ReExportQualified/ReExportQualified.purs @@ -0,0 +1,9 @@ +module Main where + +import C + + +concat :: String -> String -> String +concat _ _ = "concat" + +main = x `concat` y diff --git a/tests/purus/passing/ReExportQualified/output/A/A.cfn b/tests/purus/passing/ReExportQualified/output/A/A.cfn new file mode 100644 index 000000000..690ecf981 --- /dev/null +++ b/tests/purus/passing/ReExportQualified/output/A/A.cfn @@ -0,0 +1 @@ +{"builtWith":"0.0.1","comments":[],"dataTypes":{"_ctorDict":[],"_tyDict":[]},"decls":[{"annotation":{"meta":null,"sourceSpan":{"end":[3,9],"start":[3,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[3,9],"start":[3,5]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"String"],"tag":"TypeConstructor"},"value":{"literalType":"StringLiteral","value":"Do"}},"identifier":"x"}],"exports":["x"],"foreign":[],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[3,9],"start":[1,1]}},"moduleName":["Builtin"]},{"annotation":{"meta":null,"sourceSpan":{"end":[3,9],"start":[1,1]}},"moduleName":["Prim"]}],"moduleName":["A"],"modulePath":"tests/purus/passing/ReExportQualified/A.purs","reExports":{},"sourceSpan":{"end":[3,9],"start":[1,1]}} \ No newline at end of file diff --git a/tests/purus/passing/ReExportQualified/output/A/A.cfn.pretty b/tests/purus/passing/ReExportQualified/output/A/A.cfn.pretty new file mode 100644 index 000000000..734428180 --- /dev/null +++ b/tests/purus/passing/ReExportQualified/output/A/A.cfn.pretty @@ -0,0 +1,28 @@ +A (tests/purus/passing/ReExportQualified/A.purs) + +Imported Modules: +------------------------------ + Builtin, + Prim + +Exports: +------------------------------ + x + +Re-Exports: +------------------------------ + + +Foreign: +------------------------------ + + +Datatypes: +------------------------------ + + + +Declarations: +------------------------------ +x :: Prim.String +x = ("Do": Prim.String) \ No newline at end of file diff --git a/tests/purus/passing/ReExportQualified/output/A/externs.cbor b/tests/purus/passing/ReExportQualified/output/A/externs.cbor new file mode 100644 index 000000000..fd329f999 Binary files /dev/null and b/tests/purus/passing/ReExportQualified/output/A/externs.cbor differ diff --git a/tests/purus/passing/ReExportQualified/output/B/B.cfn b/tests/purus/passing/ReExportQualified/output/B/B.cfn new file mode 100644 index 000000000..970ae470c --- /dev/null +++ b/tests/purus/passing/ReExportQualified/output/B/B.cfn @@ -0,0 +1 @@ +{"builtWith":"0.0.1","comments":[],"dataTypes":{"_ctorDict":[],"_tyDict":[]},"decls":[{"annotation":{"meta":null,"sourceSpan":{"end":[3,9],"start":[3,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[3,9],"start":[3,5]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"String"],"tag":"TypeConstructor"},"value":{"literalType":"StringLiteral","value":"ne"}},"identifier":"y"}],"exports":["y"],"foreign":[],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[3,9],"start":[1,1]}},"moduleName":["Builtin"]},{"annotation":{"meta":null,"sourceSpan":{"end":[3,9],"start":[1,1]}},"moduleName":["Prim"]}],"moduleName":["B"],"modulePath":"tests/purus/passing/ReExportQualified/B.purs","reExports":{},"sourceSpan":{"end":[3,9],"start":[1,1]}} \ No newline at end of file diff --git a/tests/purus/passing/ReExportQualified/output/B/B.cfn.pretty b/tests/purus/passing/ReExportQualified/output/B/B.cfn.pretty new file mode 100644 index 000000000..5a2c785f0 --- /dev/null +++ b/tests/purus/passing/ReExportQualified/output/B/B.cfn.pretty @@ -0,0 +1,28 @@ +B (tests/purus/passing/ReExportQualified/B.purs) + +Imported Modules: +------------------------------ + Builtin, + Prim + +Exports: +------------------------------ + y + +Re-Exports: +------------------------------ + + +Foreign: +------------------------------ + + +Datatypes: +------------------------------ + + + +Declarations: +------------------------------ +y :: Prim.String +y = ("ne": Prim.String) \ No newline at end of file diff --git a/tests/purus/passing/ReExportQualified/output/B/externs.cbor b/tests/purus/passing/ReExportQualified/output/B/externs.cbor new file mode 100644 index 000000000..4f34888c9 Binary files /dev/null and b/tests/purus/passing/ReExportQualified/output/B/externs.cbor differ diff --git a/tests/purus/passing/ReExportQualified/output/C/C.cfn b/tests/purus/passing/ReExportQualified/output/C/C.cfn new file mode 100644 index 000000000..32078fb1c --- /dev/null +++ b/tests/purus/passing/ReExportQualified/output/C/C.cfn @@ -0,0 +1 @@ +{"builtWith":"0.0.1","comments":[],"dataTypes":{"_ctorDict":[],"_tyDict":[]},"decls":[],"exports":[],"foreign":[],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[3,9],"start":[3,1]}},"moduleName":["A"]},{"annotation":{"meta":null,"sourceSpan":{"end":[4,15],"start":[4,1]}},"moduleName":["B"]},{"annotation":{"meta":null,"sourceSpan":{"end":[4,15],"start":[1,1]}},"moduleName":["Builtin"]},{"annotation":{"meta":null,"sourceSpan":{"end":[4,15],"start":[1,1]}},"moduleName":["Prim"]}],"moduleName":["C"],"modulePath":"tests/purus/passing/ReExportQualified/C.purs","reExports":{"A":["x"],"B":["y"]},"sourceSpan":{"end":[4,15],"start":[1,1]}} \ No newline at end of file diff --git a/tests/purus/passing/ReExportQualified/output/C/C.cfn.pretty b/tests/purus/passing/ReExportQualified/output/C/C.cfn.pretty new file mode 100644 index 000000000..ff06affe4 --- /dev/null +++ b/tests/purus/passing/ReExportQualified/output/C/C.cfn.pretty @@ -0,0 +1,29 @@ +C (tests/purus/passing/ReExportQualified/C.purs) + +Imported Modules: +------------------------------ + A, + B, + Builtin, + Prim + +Exports: +------------------------------ + + +Re-Exports: +------------------------------ + A.x, + B.y + +Foreign: +------------------------------ + + +Datatypes: +------------------------------ + + + +Declarations: +------------------------------ diff --git a/tests/purus/passing/ReExportQualified/output/C/externs.cbor b/tests/purus/passing/ReExportQualified/output/C/externs.cbor new file mode 100644 index 000000000..d55a990fc Binary files /dev/null and b/tests/purus/passing/ReExportQualified/output/C/externs.cbor differ diff --git a/tests/purus/passing/ReExportQualified/output/Main/Main.cfn b/tests/purus/passing/ReExportQualified/output/Main/Main.cfn new file mode 100644 index 000000000..70113f3f7 --- /dev/null +++ b/tests/purus/passing/ReExportQualified/output/Main/Main.cfn @@ -0,0 +1 @@ +{"builtWith":"0.0.1","comments":[],"dataTypes":{"_ctorDict":[],"_tyDict":[]},"decls":[{"annotation":{"meta":null,"sourceSpan":{"end":[6,37],"start":[6,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[7,22],"start":[7,1]}},"argument":"v","body":{"annotation":{"meta":null,"sourceSpan":{"end":[7,22],"start":[7,1]}},"argument":"v1","body":{"annotation":{"meta":null,"sourceSpan":{"end":[7,22],"start":[7,14]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"String"],"tag":"TypeConstructor"},"value":{"literalType":"StringLiteral","value":"concat"}},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[6,27],"name":"tests/purus/passing/ReExportQualified/ReExportQualified.purs","start":[6,21]},[]],"contents":[["Prim"],"String"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[6,37],"name":"tests/purus/passing/ReExportQualified/ReExportQualified.purs","start":[6,31]},[]],"contents":[["Prim"],"String"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[6,17],"name":"tests/purus/passing/ReExportQualified/ReExportQualified.purs","start":[6,11]},[]],"contents":[["Prim"],"String"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[6,37],"name":"tests/purus/passing/ReExportQualified/ReExportQualified.purs","start":[6,21]},[]],"contents":[{"annotation":[{"end":[6,37],"name":"tests/purus/passing/ReExportQualified/ReExportQualified.purs","start":[6,21]},[]],"contents":[{"annotation":[{"end":[6,30],"name":"tests/purus/passing/ReExportQualified/ReExportQualified.purs","start":[6,28]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[6,27],"name":"tests/purus/passing/ReExportQualified/ReExportQualified.purs","start":[6,21]},[]],"contents":[["Prim"],"String"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[6,37],"name":"tests/purus/passing/ReExportQualified/ReExportQualified.purs","start":[6,31]},[]],"contents":[["Prim"],"String"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"identifier":"concat"},{"annotation":{"meta":null,"sourceSpan":{"end":[9,20],"start":[9,1]}},"bindType":"NonRec","expression":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[9,17],"start":[9,11]}},"kind":"Var","type":{"annotation":[{"end":[6,37],"name":"tests/purus/passing/ReExportQualified/ReExportQualified.purs","start":[6,11]},[]],"contents":[{"annotation":[{"end":[6,37],"name":"tests/purus/passing/ReExportQualified/ReExportQualified.purs","start":[6,11]},[]],"contents":[{"annotation":[{"end":[6,20],"name":"tests/purus/passing/ReExportQualified/ReExportQualified.purs","start":[6,18]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[6,17],"name":"tests/purus/passing/ReExportQualified/ReExportQualified.purs","start":[6,11]},[]],"contents":[["Prim"],"String"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[6,37],"name":"tests/purus/passing/ReExportQualified/ReExportQualified.purs","start":[6,21]},[]],"contents":[{"annotation":[{"end":[6,37],"name":"tests/purus/passing/ReExportQualified/ReExportQualified.purs","start":[6,21]},[]],"contents":[{"annotation":[{"end":[6,30],"name":"tests/purus/passing/ReExportQualified/ReExportQualified.purs","start":[6,28]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[6,27],"name":"tests/purus/passing/ReExportQualified/ReExportQualified.purs","start":[6,21]},[]],"contents":[["Prim"],"String"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[6,37],"name":"tests/purus/passing/ReExportQualified/ReExportQualified.purs","start":[6,31]},[]],"contents":[["Prim"],"String"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"concat","moduleName":["Main"]}},"annotation":{"meta":null,"sourceSpan":{"end":[9,20],"start":[9,8]}},"argument":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[9,9],"start":[9,8]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"String"],"tag":"TypeConstructor"},"value":{"identifier":"x","moduleName":["A"]}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[9,20],"start":[9,8]}},"argument":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[9,20],"start":[9,19]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"String"],"tag":"TypeConstructor"},"value":{"identifier":"y","moduleName":["B"]}},"kind":"App"},"identifier":"main"}],"exports":["concat","main"],"foreign":[],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[9,20],"start":[1,1]}},"moduleName":["A"]},{"annotation":{"meta":null,"sourceSpan":{"end":[9,20],"start":[1,1]}},"moduleName":["B"]},{"annotation":{"meta":null,"sourceSpan":{"end":[9,20],"start":[1,1]}},"moduleName":["Builtin"]},{"annotation":{"meta":null,"sourceSpan":{"end":[3,9],"start":[3,1]}},"moduleName":["C"]},{"annotation":{"meta":null,"sourceSpan":{"end":[9,20],"start":[1,1]}},"moduleName":["Main"]},{"annotation":{"meta":null,"sourceSpan":{"end":[9,20],"start":[1,1]}},"moduleName":["Prim"]}],"moduleName":["Main"],"modulePath":"tests/purus/passing/ReExportQualified/ReExportQualified.purs","reExports":{},"sourceSpan":{"end":[9,20],"start":[1,1]}} \ No newline at end of file diff --git a/tests/purus/passing/ReExportQualified/output/Main/Main.cfn.pretty b/tests/purus/passing/ReExportQualified/output/Main/Main.cfn.pretty new file mode 100644 index 000000000..8c679e78d --- /dev/null +++ b/tests/purus/passing/ReExportQualified/output/Main/Main.cfn.pretty @@ -0,0 +1,39 @@ +Main (tests/purus/passing/ReExportQualified/ReExportQualified.purs) + +Imported Modules: +------------------------------ + A, + B, + Builtin, + C, + Main, + Prim + +Exports: +------------------------------ + concat, + main + +Re-Exports: +------------------------------ + + +Foreign: +------------------------------ + + +Datatypes: +------------------------------ + + + +Declarations: +------------------------------ +concat :: (Prim.String -> ((Prim.String -> (Prim.String)))) +concat = \(v: Prim.String) -> \(v1: Prim.String) -> ("concat": Prim.String) + +main :: Prim.String +main = + (concat: (Prim.String -> ((Prim.String -> (Prim.String))))) + (x: Prim.String) + (y: Prim.String) \ No newline at end of file diff --git a/tests/purus/passing/ReExportQualified/output/Main/externs.cbor b/tests/purus/passing/ReExportQualified/output/Main/externs.cbor new file mode 100644 index 000000000..533f82ceb Binary files /dev/null and b/tests/purus/passing/ReExportQualified/output/Main/externs.cbor differ diff --git a/tests/purus/passing/ReExportQualified/output/package.json b/tests/purus/passing/ReExportQualified/output/package.json new file mode 100644 index 000000000..7c34deb58 --- /dev/null +++ b/tests/purus/passing/ReExportQualified/output/package.json @@ -0,0 +1 @@ +{"type":"module"} \ No newline at end of file diff --git a/tests/purus/passing/RedefinedFixity/M1.purs b/tests/purus/passing/RedefinedFixity/M1.purs new file mode 100644 index 000000000..5dbfe280b --- /dev/null +++ b/tests/purus/passing/RedefinedFixity/M1.purs @@ -0,0 +1,6 @@ +module M1 where + +applyFn :: forall (a :: Type) (b :: Type). (forall (c :: Type) (d :: Type). c -> d) -> a -> b +applyFn f a = f a + +infixr 1000 applyFn as $ diff --git a/tests/purus/passing/RedefinedFixity/M2.purs b/tests/purus/passing/RedefinedFixity/M2.purs new file mode 100644 index 000000000..f7ddf1946 --- /dev/null +++ b/tests/purus/passing/RedefinedFixity/M2.purs @@ -0,0 +1,3 @@ +module M2 where + +import M1 diff --git a/tests/purus/passing/RedefinedFixity/M3.purs b/tests/purus/passing/RedefinedFixity/M3.purs new file mode 100644 index 000000000..cd62cc115 --- /dev/null +++ b/tests/purus/passing/RedefinedFixity/M3.purs @@ -0,0 +1,4 @@ +module M3 where + +import M1 +import M2 diff --git a/tests/purus/passing/RedefinedFixity/RedefinedFixity.purs b/tests/purus/passing/RedefinedFixity/RedefinedFixity.purs new file mode 100644 index 000000000..a796c5790 --- /dev/null +++ b/tests/purus/passing/RedefinedFixity/RedefinedFixity.purs @@ -0,0 +1,5 @@ +module Main where + +import M3 + +main = "Done" diff --git a/tests/purus/passing/RedefinedFixity/output/M1/M1.cfn b/tests/purus/passing/RedefinedFixity/output/M1/M1.cfn new file mode 100644 index 000000000..e9a22e793 --- /dev/null +++ b/tests/purus/passing/RedefinedFixity/output/M1/M1.cfn @@ -0,0 +1 @@ +{"builtWith":"0.0.1","comments":[],"dataTypes":{"_ctorDict":[],"_tyDict":[]},"decls":[{"annotation":{"meta":null,"sourceSpan":{"end":[3,94],"start":[3,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[4,18],"start":[4,1]}},"argument":"f","body":{"annotation":{"meta":null,"sourceSpan":{"end":[4,18],"start":[4,1]}},"argument":"a","body":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[4,16],"start":[4,15]}},"kind":"Var","type":{"annotation":[{"end":[3,83],"name":"tests/purus/passing/RedefinedFixity/M1.purs","start":[3,45]},[]],"contents":{"identifier":"c","kind":{"annotation":[{"end":[3,62],"name":"tests/purus/passing/RedefinedFixity/M1.purs","start":[3,58]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":1,"type":{"annotation":[{"end":[3,83],"name":"tests/purus/passing/RedefinedFixity/M1.purs","start":[3,65]},[]],"contents":{"identifier":"d","kind":{"annotation":[{"end":[3,74],"name":"tests/purus/passing/RedefinedFixity/M1.purs","start":[3,70]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":0,"type":{"annotation":[{"end":[3,83],"name":"tests/purus/passing/RedefinedFixity/M1.purs","start":[3,77]},[]],"contents":[{"annotation":[{"end":[3,83],"name":"tests/purus/passing/RedefinedFixity/M1.purs","start":[3,77]},[]],"contents":[{"annotation":[{"end":[3,81],"name":"tests/purus/passing/RedefinedFixity/M1.purs","start":[3,79]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[3,78],"name":"tests/purus/passing/RedefinedFixity/M1.purs","start":[3,77]},[]],"contents":{"kind":{"annotation":[{"end":[3,62],"name":"tests/purus/passing/RedefinedFixity/M1.purs","start":[3,58]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"c"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[3,83],"name":"tests/purus/passing/RedefinedFixity/M1.purs","start":[3,82]},[]],"contents":{"kind":{"annotation":[{"end":[3,74],"name":"tests/purus/passing/RedefinedFixity/M1.purs","start":[3,70]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"d"},"tag":"TypeVar"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"f","sourcePos":[4,1]}},"annotation":{"meta":null,"sourceSpan":{"end":[4,18],"start":[4,15]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[4,18],"start":[4,17]}},"kind":"Var","type":{"annotation":[{"end":[3,89],"name":"tests/purus/passing/RedefinedFixity/M1.purs","start":[3,88]},[]],"contents":{"kind":{"annotation":[{"end":[3,29],"name":"tests/purus/passing/RedefinedFixity/M1.purs","start":[3,25]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"},"value":{"identifier":"a","sourcePos":[4,1]}},"kind":"App"},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[3,89],"name":"tests/purus/passing/RedefinedFixity/M1.purs","start":[3,88]},[]],"contents":{"kind":{"annotation":[{"end":[3,29],"name":"tests/purus/passing/RedefinedFixity/M1.purs","start":[3,25]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[3,94],"name":"tests/purus/passing/RedefinedFixity/M1.purs","start":[3,93]},[]],"contents":{"kind":{"annotation":[{"end":[3,41],"name":"tests/purus/passing/RedefinedFixity/M1.purs","start":[3,37]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"b"},"tag":"TypeVar"}],"tag":"TypeApp"}},"kind":"Abs","type":{"annotation":[{"end":[3,94],"name":"tests/purus/passing/RedefinedFixity/M1.purs","start":[3,12]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[3,29],"name":"tests/purus/passing/RedefinedFixity/M1.purs","start":[3,25]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":3,"type":{"annotation":[{"end":[3,94],"name":"tests/purus/passing/RedefinedFixity/M1.purs","start":[3,32]},[]],"contents":{"identifier":"b","kind":{"annotation":[{"end":[3,41],"name":"tests/purus/passing/RedefinedFixity/M1.purs","start":[3,37]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":2,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[3,83],"name":"tests/purus/passing/RedefinedFixity/M1.purs","start":[3,45]},[]],"contents":{"identifier":"c","kind":{"annotation":[{"end":[3,62],"name":"tests/purus/passing/RedefinedFixity/M1.purs","start":[3,58]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":1,"type":{"annotation":[{"end":[3,83],"name":"tests/purus/passing/RedefinedFixity/M1.purs","start":[3,65]},[]],"contents":{"identifier":"d","kind":{"annotation":[{"end":[3,74],"name":"tests/purus/passing/RedefinedFixity/M1.purs","start":[3,70]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":0,"type":{"annotation":[{"end":[3,83],"name":"tests/purus/passing/RedefinedFixity/M1.purs","start":[3,77]},[]],"contents":[{"annotation":[{"end":[3,83],"name":"tests/purus/passing/RedefinedFixity/M1.purs","start":[3,77]},[]],"contents":[{"annotation":[{"end":[3,81],"name":"tests/purus/passing/RedefinedFixity/M1.purs","start":[3,79]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[3,78],"name":"tests/purus/passing/RedefinedFixity/M1.purs","start":[3,77]},[]],"contents":{"kind":{"annotation":[{"end":[3,62],"name":"tests/purus/passing/RedefinedFixity/M1.purs","start":[3,58]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"c"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[3,83],"name":"tests/purus/passing/RedefinedFixity/M1.purs","start":[3,82]},[]],"contents":{"kind":{"annotation":[{"end":[3,74],"name":"tests/purus/passing/RedefinedFixity/M1.purs","start":[3,70]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"d"},"tag":"TypeVar"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}],"tag":"TypeApp"},{"annotation":[{"end":[3,94],"name":"tests/purus/passing/RedefinedFixity/M1.purs","start":[3,88]},[]],"contents":[{"annotation":[{"end":[3,94],"name":"tests/purus/passing/RedefinedFixity/M1.purs","start":[3,88]},[]],"contents":[{"annotation":[{"end":[3,92],"name":"tests/purus/passing/RedefinedFixity/M1.purs","start":[3,90]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[3,89],"name":"tests/purus/passing/RedefinedFixity/M1.purs","start":[3,88]},[]],"contents":{"kind":{"annotation":[{"end":[3,29],"name":"tests/purus/passing/RedefinedFixity/M1.purs","start":[3,25]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[3,94],"name":"tests/purus/passing/RedefinedFixity/M1.purs","start":[3,93]},[]],"contents":{"kind":{"annotation":[{"end":[3,41],"name":"tests/purus/passing/RedefinedFixity/M1.purs","start":[3,37]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"b"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"identifier":"applyFn"}],"exports":["applyFn"],"foreign":[],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[6,25],"start":[1,1]}},"moduleName":["Builtin"]},{"annotation":{"meta":null,"sourceSpan":{"end":[6,25],"start":[1,1]}},"moduleName":["M1"]},{"annotation":{"meta":null,"sourceSpan":{"end":[6,25],"start":[1,1]}},"moduleName":["Prim"]}],"moduleName":["M1"],"modulePath":"tests/purus/passing/RedefinedFixity/M1.purs","reExports":{},"sourceSpan":{"end":[6,25],"start":[1,1]}} \ No newline at end of file diff --git a/tests/purus/passing/RedefinedFixity/output/M1/M1.cfn.pretty b/tests/purus/passing/RedefinedFixity/output/M1/M1.cfn.pretty new file mode 100644 index 000000000..0bf63dfae --- /dev/null +++ b/tests/purus/passing/RedefinedFixity/output/M1/M1.cfn.pretty @@ -0,0 +1,35 @@ +M1 (tests/purus/passing/RedefinedFixity/M1.purs) + +Imported Modules: +------------------------------ + Builtin, + M1, + Prim + +Exports: +------------------------------ + applyFn + +Re-Exports: +------------------------------ + + +Foreign: +------------------------------ + + +Datatypes: +------------------------------ + + + +Declarations: +------------------------------ +applyFn :: forall (a :: Prim.Type) (b :: Prim.Type). (forall (c :: Prim.Type) (d :: Prim.Type). ((c :: Prim.Type) -> ((d :: Prim.Type))) -> (((a :: Prim.Type) -> ((b :: Prim.Type))))) +applyFn = + \(f: forall (c :: Prim.Type) + (d :: Prim.Type). ((c :: Prim.Type) -> ((d :: Prim.Type)))) -> + \(a: (a :: Prim.Type)) -> + (f: forall (c :: Prim.Type) + (d :: Prim.Type). ((c :: Prim.Type) -> ((d :: Prim.Type)))) + (a: (a :: Prim.Type)) \ No newline at end of file diff --git a/tests/purus/passing/RedefinedFixity/output/M1/externs.cbor b/tests/purus/passing/RedefinedFixity/output/M1/externs.cbor new file mode 100644 index 000000000..f7e182bc3 Binary files /dev/null and b/tests/purus/passing/RedefinedFixity/output/M1/externs.cbor differ diff --git a/tests/purus/passing/RedefinedFixity/output/M2/M2.cfn b/tests/purus/passing/RedefinedFixity/output/M2/M2.cfn new file mode 100644 index 000000000..37c98ce67 --- /dev/null +++ b/tests/purus/passing/RedefinedFixity/output/M2/M2.cfn @@ -0,0 +1 @@ +{"builtWith":"0.0.1","comments":[],"dataTypes":{"_ctorDict":[],"_tyDict":[]},"decls":[],"exports":[],"foreign":[],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[3,10],"start":[1,1]}},"moduleName":["Builtin"]},{"annotation":{"meta":null,"sourceSpan":{"end":[3,10],"start":[3,1]}},"moduleName":["M1"]},{"annotation":{"meta":null,"sourceSpan":{"end":[3,10],"start":[1,1]}},"moduleName":["Prim"]}],"moduleName":["M2"],"modulePath":"tests/purus/passing/RedefinedFixity/M2.purs","reExports":{},"sourceSpan":{"end":[3,10],"start":[1,1]}} \ No newline at end of file diff --git a/tests/purus/passing/RedefinedFixity/output/M2/M2.cfn.pretty b/tests/purus/passing/RedefinedFixity/output/M2/M2.cfn.pretty new file mode 100644 index 000000000..e10f0dcfe --- /dev/null +++ b/tests/purus/passing/RedefinedFixity/output/M2/M2.cfn.pretty @@ -0,0 +1,27 @@ +M2 (tests/purus/passing/RedefinedFixity/M2.purs) + +Imported Modules: +------------------------------ + Builtin, + M1, + Prim + +Exports: +------------------------------ + + +Re-Exports: +------------------------------ + + +Foreign: +------------------------------ + + +Datatypes: +------------------------------ + + + +Declarations: +------------------------------ diff --git a/tests/purus/passing/RedefinedFixity/output/M2/externs.cbor b/tests/purus/passing/RedefinedFixity/output/M2/externs.cbor new file mode 100644 index 000000000..224a65020 Binary files /dev/null and b/tests/purus/passing/RedefinedFixity/output/M2/externs.cbor differ diff --git a/tests/purus/passing/RedefinedFixity/output/M3/M3.cfn b/tests/purus/passing/RedefinedFixity/output/M3/M3.cfn new file mode 100644 index 000000000..21d217f36 --- /dev/null +++ b/tests/purus/passing/RedefinedFixity/output/M3/M3.cfn @@ -0,0 +1 @@ +{"builtWith":"0.0.1","comments":[],"dataTypes":{"_ctorDict":[],"_tyDict":[]},"decls":[],"exports":[],"foreign":[],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[4,10],"start":[1,1]}},"moduleName":["Builtin"]},{"annotation":{"meta":null,"sourceSpan":{"end":[3,10],"start":[3,1]}},"moduleName":["M1"]},{"annotation":{"meta":null,"sourceSpan":{"end":[4,10],"start":[4,1]}},"moduleName":["M2"]},{"annotation":{"meta":null,"sourceSpan":{"end":[4,10],"start":[1,1]}},"moduleName":["Prim"]}],"moduleName":["M3"],"modulePath":"tests/purus/passing/RedefinedFixity/M3.purs","reExports":{},"sourceSpan":{"end":[4,10],"start":[1,1]}} \ No newline at end of file diff --git a/tests/purus/passing/RedefinedFixity/output/M3/M3.cfn.pretty b/tests/purus/passing/RedefinedFixity/output/M3/M3.cfn.pretty new file mode 100644 index 000000000..89751fb4e --- /dev/null +++ b/tests/purus/passing/RedefinedFixity/output/M3/M3.cfn.pretty @@ -0,0 +1,28 @@ +M3 (tests/purus/passing/RedefinedFixity/M3.purs) + +Imported Modules: +------------------------------ + Builtin, + M1, + M2, + Prim + +Exports: +------------------------------ + + +Re-Exports: +------------------------------ + + +Foreign: +------------------------------ + + +Datatypes: +------------------------------ + + + +Declarations: +------------------------------ diff --git a/tests/purus/passing/RedefinedFixity/output/M3/externs.cbor b/tests/purus/passing/RedefinedFixity/output/M3/externs.cbor new file mode 100644 index 000000000..ad234ae5c Binary files /dev/null and b/tests/purus/passing/RedefinedFixity/output/M3/externs.cbor differ diff --git a/tests/purus/passing/RedefinedFixity/output/Main/Main.cfn b/tests/purus/passing/RedefinedFixity/output/Main/Main.cfn new file mode 100644 index 000000000..088e714f5 --- /dev/null +++ b/tests/purus/passing/RedefinedFixity/output/Main/Main.cfn @@ -0,0 +1 @@ +{"builtWith":"0.0.1","comments":[],"dataTypes":{"_ctorDict":[],"_tyDict":[]},"decls":[{"annotation":{"meta":null,"sourceSpan":{"end":[5,14],"start":[5,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[5,14],"start":[5,8]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"String"],"tag":"TypeConstructor"},"value":{"literalType":"StringLiteral","value":"Done"}},"identifier":"main"}],"exports":["main"],"foreign":[],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[5,14],"start":[1,1]}},"moduleName":["Builtin"]},{"annotation":{"meta":null,"sourceSpan":{"end":[3,10],"start":[3,1]}},"moduleName":["M3"]},{"annotation":{"meta":null,"sourceSpan":{"end":[5,14],"start":[1,1]}},"moduleName":["Prim"]}],"moduleName":["Main"],"modulePath":"tests/purus/passing/RedefinedFixity/RedefinedFixity.purs","reExports":{},"sourceSpan":{"end":[5,14],"start":[1,1]}} \ No newline at end of file diff --git a/tests/purus/passing/RedefinedFixity/output/Main/Main.cfn.pretty b/tests/purus/passing/RedefinedFixity/output/Main/Main.cfn.pretty new file mode 100644 index 000000000..5103ace8b --- /dev/null +++ b/tests/purus/passing/RedefinedFixity/output/Main/Main.cfn.pretty @@ -0,0 +1,29 @@ +Main (tests/purus/passing/RedefinedFixity/RedefinedFixity.purs) + +Imported Modules: +------------------------------ + Builtin, + M3, + Prim + +Exports: +------------------------------ + main + +Re-Exports: +------------------------------ + + +Foreign: +------------------------------ + + +Datatypes: +------------------------------ + + + +Declarations: +------------------------------ +main :: Prim.String +main = ("Done": Prim.String) \ No newline at end of file diff --git a/tests/purus/passing/RedefinedFixity/output/Main/externs.cbor b/tests/purus/passing/RedefinedFixity/output/Main/externs.cbor new file mode 100644 index 000000000..1a1c0ed65 Binary files /dev/null and b/tests/purus/passing/RedefinedFixity/output/Main/externs.cbor differ diff --git a/tests/purus/passing/RedefinedFixity/output/package.json b/tests/purus/passing/RedefinedFixity/output/package.json new file mode 100644 index 000000000..7c34deb58 --- /dev/null +++ b/tests/purus/passing/RedefinedFixity/output/package.json @@ -0,0 +1 @@ +{"type":"module"} \ No newline at end of file diff --git a/tests/purus/passing/ResolvableScopeConflict/A.purs b/tests/purus/passing/ResolvableScopeConflict/A.purs new file mode 100644 index 000000000..302b0328d --- /dev/null +++ b/tests/purus/passing/ResolvableScopeConflict/A.purs @@ -0,0 +1,4 @@ +module A where + +thing :: Int +thing = 1 diff --git a/tests/purus/passing/ResolvableScopeConflict/B.purs b/tests/purus/passing/ResolvableScopeConflict/B.purs new file mode 100644 index 000000000..4ad4bb6f4 --- /dev/null +++ b/tests/purus/passing/ResolvableScopeConflict/B.purs @@ -0,0 +1,7 @@ +module B where + +thing :: Int +thing = 2 + +zing :: Int +zing = 3 diff --git a/tests/purus/passing/ResolvableScopeConflict/ResolvableScopeConflict.purs b/tests/purus/passing/ResolvableScopeConflict/ResolvableScopeConflict.purs new file mode 100644 index 000000000..aa2bed42e --- /dev/null +++ b/tests/purus/passing/ResolvableScopeConflict/ResolvableScopeConflict.purs @@ -0,0 +1,12 @@ +module Main where + +import A (thing) +import B + +-- Not an error as although we have `thing` in scope from both A and B, it is +-- imported explicitly from A, giving it a resolvable solution. +what :: Boolean -> Int +what true = thing +what false = zing + +main = "Done" diff --git a/tests/purus/passing/ResolvableScopeConflict/output/A/A.cfn b/tests/purus/passing/ResolvableScopeConflict/output/A/A.cfn new file mode 100644 index 000000000..daddbdc4b --- /dev/null +++ b/tests/purus/passing/ResolvableScopeConflict/output/A/A.cfn @@ -0,0 +1 @@ +{"builtWith":"0.0.1","comments":[],"dataTypes":{"_ctorDict":[],"_tyDict":[]},"decls":[{"annotation":{"meta":null,"sourceSpan":{"end":[3,13],"start":[3,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[4,10],"start":[4,9]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"literalType":"IntLiteral","value":1}},"identifier":"thing"}],"exports":["thing"],"foreign":[],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[4,10],"start":[1,1]}},"moduleName":["Builtin"]},{"annotation":{"meta":null,"sourceSpan":{"end":[4,10],"start":[1,1]}},"moduleName":["Prim"]}],"moduleName":["A"],"modulePath":"tests/purus/passing/ResolvableScopeConflict/A.purs","reExports":{},"sourceSpan":{"end":[4,10],"start":[1,1]}} \ No newline at end of file diff --git a/tests/purus/passing/ResolvableScopeConflict/output/A/A.cfn.pretty b/tests/purus/passing/ResolvableScopeConflict/output/A/A.cfn.pretty new file mode 100644 index 000000000..0aaadaeb1 --- /dev/null +++ b/tests/purus/passing/ResolvableScopeConflict/output/A/A.cfn.pretty @@ -0,0 +1,28 @@ +A (tests/purus/passing/ResolvableScopeConflict/A.purs) + +Imported Modules: +------------------------------ + Builtin, + Prim + +Exports: +------------------------------ + thing + +Re-Exports: +------------------------------ + + +Foreign: +------------------------------ + + +Datatypes: +------------------------------ + + + +Declarations: +------------------------------ +thing :: Prim.Int +thing = (1: Prim.Int) \ No newline at end of file diff --git a/tests/purus/passing/ResolvableScopeConflict/output/A/externs.cbor b/tests/purus/passing/ResolvableScopeConflict/output/A/externs.cbor new file mode 100644 index 000000000..d4c464582 Binary files /dev/null and b/tests/purus/passing/ResolvableScopeConflict/output/A/externs.cbor differ diff --git a/tests/purus/passing/ResolvableScopeConflict/output/B/B.cfn b/tests/purus/passing/ResolvableScopeConflict/output/B/B.cfn new file mode 100644 index 000000000..fbc23aaf3 --- /dev/null +++ b/tests/purus/passing/ResolvableScopeConflict/output/B/B.cfn @@ -0,0 +1 @@ +{"builtWith":"0.0.1","comments":[],"dataTypes":{"_ctorDict":[],"_tyDict":[]},"decls":[{"annotation":{"meta":null,"sourceSpan":{"end":[6,12],"start":[6,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[7,9],"start":[7,8]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"literalType":"IntLiteral","value":3}},"identifier":"zing"},{"annotation":{"meta":null,"sourceSpan":{"end":[3,13],"start":[3,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[4,10],"start":[4,9]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"literalType":"IntLiteral","value":2}},"identifier":"thing"}],"exports":["thing","zing"],"foreign":[],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[7,9],"start":[1,1]}},"moduleName":["Builtin"]},{"annotation":{"meta":null,"sourceSpan":{"end":[7,9],"start":[1,1]}},"moduleName":["Prim"]}],"moduleName":["B"],"modulePath":"tests/purus/passing/ResolvableScopeConflict/B.purs","reExports":{},"sourceSpan":{"end":[7,9],"start":[1,1]}} \ No newline at end of file diff --git a/tests/purus/passing/ResolvableScopeConflict/output/B/B.cfn.pretty b/tests/purus/passing/ResolvableScopeConflict/output/B/B.cfn.pretty new file mode 100644 index 000000000..e87a3192c --- /dev/null +++ b/tests/purus/passing/ResolvableScopeConflict/output/B/B.cfn.pretty @@ -0,0 +1,32 @@ +B (tests/purus/passing/ResolvableScopeConflict/B.purs) + +Imported Modules: +------------------------------ + Builtin, + Prim + +Exports: +------------------------------ + thing, + zing + +Re-Exports: +------------------------------ + + +Foreign: +------------------------------ + + +Datatypes: +------------------------------ + + + +Declarations: +------------------------------ +zing :: Prim.Int +zing = (3: Prim.Int) + +thing :: Prim.Int +thing = (2: Prim.Int) \ No newline at end of file diff --git a/tests/purus/passing/ResolvableScopeConflict/output/B/externs.cbor b/tests/purus/passing/ResolvableScopeConflict/output/B/externs.cbor new file mode 100644 index 000000000..9d7aa5caa Binary files /dev/null and b/tests/purus/passing/ResolvableScopeConflict/output/B/externs.cbor differ diff --git a/tests/purus/passing/ResolvableScopeConflict/output/Main/Main.cfn b/tests/purus/passing/ResolvableScopeConflict/output/Main/Main.cfn new file mode 100644 index 000000000..078e2c2da --- /dev/null +++ b/tests/purus/passing/ResolvableScopeConflict/output/Main/Main.cfn @@ -0,0 +1 @@ +{"builtWith":"0.0.1","comments":[],"dataTypes":{"_ctorDict":[],"_tyDict":[]},"decls":[{"annotation":{"meta":null,"sourceSpan":{"end":[8,23],"start":[8,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"argument":"v","body":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"binderType":"ConstructorBinder","binders":[],"constructorName":{"identifier":"True","moduleName":["Prim"]},"typeName":{"identifier":"Boolean","moduleName":["Prim"]}}],"expression":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[9,18],"start":[9,13]}},"kind":"Var","type":{"annotation":[{"end":[3,13],"name":"tests/purus/passing/ResolvableScopeConflict/A.purs","start":[3,10]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"identifier":"thing","moduleName":["A"]}},"isGuarded":false},{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"binderType":"ConstructorBinder","binders":[],"constructorName":{"identifier":"False","moduleName":["Prim"]},"typeName":{"identifier":"Boolean","moduleName":["Prim"]}}],"expression":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[10,18],"start":[10,14]}},"kind":"Var","type":{"annotation":[{"end":[6,12],"name":"tests/purus/passing/ResolvableScopeConflict/B.purs","start":[6,9]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"identifier":"zing","moduleName":["B"]}},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[9,18],"start":[9,1]}},"kind":"Var","type":{"annotation":[{"end":[8,16],"name":"tests/purus/passing/ResolvableScopeConflict/ResolvableScopeConflict.purs","start":[8,9]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"},"value":{"identifier":"v","sourcePos":[0,0]}}],"kind":"Case","type":{"annotation":[{"end":[8,23],"name":"tests/purus/passing/ResolvableScopeConflict/ResolvableScopeConflict.purs","start":[8,20]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[8,16],"name":"tests/purus/passing/ResolvableScopeConflict/ResolvableScopeConflict.purs","start":[8,9]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[8,23],"name":"tests/purus/passing/ResolvableScopeConflict/ResolvableScopeConflict.purs","start":[8,20]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"identifier":"what"},{"annotation":{"meta":null,"sourceSpan":{"end":[12,14],"start":[12,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[12,14],"start":[12,8]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"String"],"tag":"TypeConstructor"},"value":{"literalType":"StringLiteral","value":"Done"}},"identifier":"main"}],"exports":["what","main"],"foreign":[],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[12,14],"start":[1,1]}},"moduleName":["A"]},{"annotation":{"meta":null,"sourceSpan":{"end":[12,14],"start":[1,1]}},"moduleName":["B"]},{"annotation":{"meta":null,"sourceSpan":{"end":[12,14],"start":[1,1]}},"moduleName":["Builtin"]},{"annotation":{"meta":null,"sourceSpan":{"end":[12,14],"start":[1,1]}},"moduleName":["Prim"]}],"moduleName":["Main"],"modulePath":"tests/purus/passing/ResolvableScopeConflict/ResolvableScopeConflict.purs","reExports":{},"sourceSpan":{"end":[12,14],"start":[1,1]}} \ No newline at end of file diff --git a/tests/purus/passing/ResolvableScopeConflict/output/Main/Main.cfn.pretty b/tests/purus/passing/ResolvableScopeConflict/output/Main/Main.cfn.pretty new file mode 100644 index 000000000..13e12271a --- /dev/null +++ b/tests/purus/passing/ResolvableScopeConflict/output/Main/Main.cfn.pretty @@ -0,0 +1,38 @@ +Main (tests/purus/passing/ResolvableScopeConflict/ResolvableScopeConflict.purs) + +Imported Modules: +------------------------------ + A, + B, + Builtin, + Prim + +Exports: +------------------------------ + what, + main + +Re-Exports: +------------------------------ + + +Foreign: +------------------------------ + + +Datatypes: +------------------------------ + + + +Declarations: +------------------------------ +what :: (Prim.Boolean -> (Prim.Int)) +what = + \(v: Prim.Boolean) -> + case (v: Prim.Boolean) of + True -> (thing: Prim.Int) + False -> (zing: Prim.Int) + +main :: Prim.String +main = ("Done": Prim.String) \ No newline at end of file diff --git a/tests/purus/passing/ResolvableScopeConflict/output/Main/externs.cbor b/tests/purus/passing/ResolvableScopeConflict/output/Main/externs.cbor new file mode 100644 index 000000000..3da785733 Binary files /dev/null and b/tests/purus/passing/ResolvableScopeConflict/output/Main/externs.cbor differ diff --git a/tests/purus/passing/ResolvableScopeConflict/output/package.json b/tests/purus/passing/ResolvableScopeConflict/output/package.json new file mode 100644 index 000000000..7c34deb58 --- /dev/null +++ b/tests/purus/passing/ResolvableScopeConflict/output/package.json @@ -0,0 +1 @@ +{"type":"module"} \ No newline at end of file diff --git a/tests/purus/passing/ResolvableScopeConflict2/A.purs b/tests/purus/passing/ResolvableScopeConflict2/A.purs new file mode 100644 index 000000000..943011cd7 --- /dev/null +++ b/tests/purus/passing/ResolvableScopeConflict2/A.purs @@ -0,0 +1,7 @@ +module A where + +thing :: Int +thing = 2 + +zing :: Int +zing = 3 diff --git a/tests/purus/passing/ResolvableScopeConflict2/ResolvableScopeConflict2.purs b/tests/purus/passing/ResolvableScopeConflict2/ResolvableScopeConflict2.purs new file mode 100644 index 000000000..899fadecb --- /dev/null +++ b/tests/purus/passing/ResolvableScopeConflict2/ResolvableScopeConflict2.purs @@ -0,0 +1,14 @@ +module Main where + +import A + +thing :: Int +thing = 1 + +-- Not an error as although we have `thing` in scope from both Main and A, +-- as the local declaration takes precedence over the implicit import +what :: Boolean -> Int +what true = thing +what false = zing + +main = "Done" diff --git a/tests/purus/passing/ResolvableScopeConflict2/output/A/A.cfn b/tests/purus/passing/ResolvableScopeConflict2/output/A/A.cfn new file mode 100644 index 000000000..e64863566 --- /dev/null +++ b/tests/purus/passing/ResolvableScopeConflict2/output/A/A.cfn @@ -0,0 +1 @@ +{"builtWith":"0.0.1","comments":[],"dataTypes":{"_ctorDict":[],"_tyDict":[]},"decls":[{"annotation":{"meta":null,"sourceSpan":{"end":[6,12],"start":[6,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[7,9],"start":[7,8]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"literalType":"IntLiteral","value":3}},"identifier":"zing"},{"annotation":{"meta":null,"sourceSpan":{"end":[3,13],"start":[3,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[4,10],"start":[4,9]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"literalType":"IntLiteral","value":2}},"identifier":"thing"}],"exports":["thing","zing"],"foreign":[],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[7,9],"start":[1,1]}},"moduleName":["Builtin"]},{"annotation":{"meta":null,"sourceSpan":{"end":[7,9],"start":[1,1]}},"moduleName":["Prim"]}],"moduleName":["A"],"modulePath":"tests/purus/passing/ResolvableScopeConflict2/A.purs","reExports":{},"sourceSpan":{"end":[7,9],"start":[1,1]}} \ No newline at end of file diff --git a/tests/purus/passing/ResolvableScopeConflict2/output/A/A.cfn.pretty b/tests/purus/passing/ResolvableScopeConflict2/output/A/A.cfn.pretty new file mode 100644 index 000000000..0395c8307 --- /dev/null +++ b/tests/purus/passing/ResolvableScopeConflict2/output/A/A.cfn.pretty @@ -0,0 +1,32 @@ +A (tests/purus/passing/ResolvableScopeConflict2/A.purs) + +Imported Modules: +------------------------------ + Builtin, + Prim + +Exports: +------------------------------ + thing, + zing + +Re-Exports: +------------------------------ + + +Foreign: +------------------------------ + + +Datatypes: +------------------------------ + + + +Declarations: +------------------------------ +zing :: Prim.Int +zing = (3: Prim.Int) + +thing :: Prim.Int +thing = (2: Prim.Int) \ No newline at end of file diff --git a/tests/purus/passing/ResolvableScopeConflict2/output/A/externs.cbor b/tests/purus/passing/ResolvableScopeConflict2/output/A/externs.cbor new file mode 100644 index 000000000..70fb0c764 Binary files /dev/null and b/tests/purus/passing/ResolvableScopeConflict2/output/A/externs.cbor differ diff --git a/tests/purus/passing/ResolvableScopeConflict2/output/Main/Main.cfn b/tests/purus/passing/ResolvableScopeConflict2/output/Main/Main.cfn new file mode 100644 index 000000000..6fb09a377 --- /dev/null +++ b/tests/purus/passing/ResolvableScopeConflict2/output/Main/Main.cfn @@ -0,0 +1 @@ +{"builtWith":"0.0.1","comments":[],"dataTypes":{"_ctorDict":[],"_tyDict":[]},"decls":[{"annotation":{"meta":null,"sourceSpan":{"end":[5,13],"start":[5,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[6,10],"start":[6,9]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"literalType":"IntLiteral","value":1}},"identifier":"thing"},{"annotation":{"meta":null,"sourceSpan":{"end":[10,23],"start":[10,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"argument":"v","body":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"binderType":"ConstructorBinder","binders":[],"constructorName":{"identifier":"True","moduleName":["Prim"]},"typeName":{"identifier":"Boolean","moduleName":["Prim"]}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[11,18],"start":[11,13]}},"kind":"Var","type":{"annotation":[{"end":[5,13],"name":"tests/purus/passing/ResolvableScopeConflict2/ResolvableScopeConflict2.purs","start":[5,10]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"identifier":"thing","moduleName":["Main"]}},"isGuarded":false},{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"binderType":"ConstructorBinder","binders":[],"constructorName":{"identifier":"False","moduleName":["Prim"]},"typeName":{"identifier":"Boolean","moduleName":["Prim"]}}],"expression":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[12,18],"start":[12,14]}},"kind":"Var","type":{"annotation":[{"end":[6,12],"name":"tests/purus/passing/ResolvableScopeConflict2/A.purs","start":[6,9]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"identifier":"zing","moduleName":["A"]}},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[11,18],"start":[11,1]}},"kind":"Var","type":{"annotation":[{"end":[10,16],"name":"tests/purus/passing/ResolvableScopeConflict2/ResolvableScopeConflict2.purs","start":[10,9]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"},"value":{"identifier":"v","sourcePos":[0,0]}}],"kind":"Case","type":{"annotation":[{"end":[10,23],"name":"tests/purus/passing/ResolvableScopeConflict2/ResolvableScopeConflict2.purs","start":[10,20]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[10,16],"name":"tests/purus/passing/ResolvableScopeConflict2/ResolvableScopeConflict2.purs","start":[10,9]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[10,23],"name":"tests/purus/passing/ResolvableScopeConflict2/ResolvableScopeConflict2.purs","start":[10,20]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"identifier":"what"},{"annotation":{"meta":null,"sourceSpan":{"end":[14,14],"start":[14,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[14,14],"start":[14,8]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"String"],"tag":"TypeConstructor"},"value":{"literalType":"StringLiteral","value":"Done"}},"identifier":"main"}],"exports":["thing","what","main"],"foreign":[],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[14,14],"start":[1,1]}},"moduleName":["A"]},{"annotation":{"meta":null,"sourceSpan":{"end":[14,14],"start":[1,1]}},"moduleName":["Builtin"]},{"annotation":{"meta":null,"sourceSpan":{"end":[14,14],"start":[1,1]}},"moduleName":["Main"]},{"annotation":{"meta":null,"sourceSpan":{"end":[14,14],"start":[1,1]}},"moduleName":["Prim"]}],"moduleName":["Main"],"modulePath":"tests/purus/passing/ResolvableScopeConflict2/ResolvableScopeConflict2.purs","reExports":{},"sourceSpan":{"end":[14,14],"start":[1,1]}} \ No newline at end of file diff --git a/tests/purus/passing/ResolvableScopeConflict2/output/Main/Main.cfn.pretty b/tests/purus/passing/ResolvableScopeConflict2/output/Main/Main.cfn.pretty new file mode 100644 index 000000000..3cdbddb87 --- /dev/null +++ b/tests/purus/passing/ResolvableScopeConflict2/output/Main/Main.cfn.pretty @@ -0,0 +1,42 @@ +Main (tests/purus/passing/ResolvableScopeConflict2/ResolvableScopeConflict2.purs) + +Imported Modules: +------------------------------ + A, + Builtin, + Main, + Prim + +Exports: +------------------------------ + thing, + what, + main + +Re-Exports: +------------------------------ + + +Foreign: +------------------------------ + + +Datatypes: +------------------------------ + + + +Declarations: +------------------------------ +thing :: Prim.Int +thing = (1: Prim.Int) + +what :: (Prim.Boolean -> (Prim.Int)) +what = + \(v: Prim.Boolean) -> + case (v: Prim.Boolean) of + True -> (thing: Prim.Int) + False -> (zing: Prim.Int) + +main :: Prim.String +main = ("Done": Prim.String) \ No newline at end of file diff --git a/tests/purus/passing/ResolvableScopeConflict2/output/Main/externs.cbor b/tests/purus/passing/ResolvableScopeConflict2/output/Main/externs.cbor new file mode 100644 index 000000000..91647003e Binary files /dev/null and b/tests/purus/passing/ResolvableScopeConflict2/output/Main/externs.cbor differ diff --git a/tests/purus/passing/ResolvableScopeConflict2/output/package.json b/tests/purus/passing/ResolvableScopeConflict2/output/package.json new file mode 100644 index 000000000..7c34deb58 --- /dev/null +++ b/tests/purus/passing/ResolvableScopeConflict2/output/package.json @@ -0,0 +1 @@ +{"type":"module"} \ No newline at end of file diff --git a/tests/purus/passing/ResolvableScopeConflict3/A.purs b/tests/purus/passing/ResolvableScopeConflict3/A.purs new file mode 100644 index 000000000..302b0328d --- /dev/null +++ b/tests/purus/passing/ResolvableScopeConflict3/A.purs @@ -0,0 +1,4 @@ +module A where + +thing :: Int +thing = 1 diff --git a/tests/purus/passing/ResolvableScopeConflict3/ResolvableScopeConflict3.purs b/tests/purus/passing/ResolvableScopeConflict3/ResolvableScopeConflict3.purs new file mode 100644 index 000000000..204008202 --- /dev/null +++ b/tests/purus/passing/ResolvableScopeConflict3/ResolvableScopeConflict3.purs @@ -0,0 +1,9 @@ +module Main (thing, main, module A) where + +import A + + +thing :: Int +thing = 2 + +main = "Done" diff --git a/tests/purus/passing/ResolvableScopeConflict3/output/A/A.cfn b/tests/purus/passing/ResolvableScopeConflict3/output/A/A.cfn new file mode 100644 index 000000000..782fea10a --- /dev/null +++ b/tests/purus/passing/ResolvableScopeConflict3/output/A/A.cfn @@ -0,0 +1 @@ +{"builtWith":"0.0.1","comments":[],"dataTypes":{"_ctorDict":[],"_tyDict":[]},"decls":[{"annotation":{"meta":null,"sourceSpan":{"end":[3,13],"start":[3,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[4,10],"start":[4,9]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"literalType":"IntLiteral","value":1}},"identifier":"thing"}],"exports":["thing"],"foreign":[],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[4,10],"start":[1,1]}},"moduleName":["Builtin"]},{"annotation":{"meta":null,"sourceSpan":{"end":[4,10],"start":[1,1]}},"moduleName":["Prim"]}],"moduleName":["A"],"modulePath":"tests/purus/passing/ResolvableScopeConflict3/A.purs","reExports":{},"sourceSpan":{"end":[4,10],"start":[1,1]}} \ No newline at end of file diff --git a/tests/purus/passing/ResolvableScopeConflict3/output/A/A.cfn.pretty b/tests/purus/passing/ResolvableScopeConflict3/output/A/A.cfn.pretty new file mode 100644 index 000000000..fc0b54733 --- /dev/null +++ b/tests/purus/passing/ResolvableScopeConflict3/output/A/A.cfn.pretty @@ -0,0 +1,28 @@ +A (tests/purus/passing/ResolvableScopeConflict3/A.purs) + +Imported Modules: +------------------------------ + Builtin, + Prim + +Exports: +------------------------------ + thing + +Re-Exports: +------------------------------ + + +Foreign: +------------------------------ + + +Datatypes: +------------------------------ + + + +Declarations: +------------------------------ +thing :: Prim.Int +thing = (1: Prim.Int) \ No newline at end of file diff --git a/tests/purus/passing/ResolvableScopeConflict3/output/A/externs.cbor b/tests/purus/passing/ResolvableScopeConflict3/output/A/externs.cbor new file mode 100644 index 000000000..759d25761 Binary files /dev/null and b/tests/purus/passing/ResolvableScopeConflict3/output/A/externs.cbor differ diff --git a/tests/purus/passing/ResolvableScopeConflict3/output/Main/Main.cfn b/tests/purus/passing/ResolvableScopeConflict3/output/Main/Main.cfn new file mode 100644 index 000000000..b1abf111e --- /dev/null +++ b/tests/purus/passing/ResolvableScopeConflict3/output/Main/Main.cfn @@ -0,0 +1 @@ +{"builtWith":"0.0.1","comments":[],"dataTypes":{"_ctorDict":[],"_tyDict":[]},"decls":[{"annotation":{"meta":null,"sourceSpan":{"end":[6,13],"start":[6,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[7,10],"start":[7,9]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"literalType":"IntLiteral","value":2}},"identifier":"thing"},{"annotation":{"meta":null,"sourceSpan":{"end":[9,14],"start":[9,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[9,14],"start":[9,8]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"String"],"tag":"TypeConstructor"},"value":{"literalType":"StringLiteral","value":"Done"}},"identifier":"main"}],"exports":["thing","main"],"foreign":[],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[3,9],"start":[3,1]}},"moduleName":["A"]},{"annotation":{"meta":null,"sourceSpan":{"end":[9,14],"start":[1,1]}},"moduleName":["Builtin"]},{"annotation":{"meta":null,"sourceSpan":{"end":[9,14],"start":[1,1]}},"moduleName":["Prim"]}],"moduleName":["Main"],"modulePath":"tests/purus/passing/ResolvableScopeConflict3/ResolvableScopeConflict3.purs","reExports":{},"sourceSpan":{"end":[9,14],"start":[1,1]}} \ No newline at end of file diff --git a/tests/purus/passing/ResolvableScopeConflict3/output/Main/Main.cfn.pretty b/tests/purus/passing/ResolvableScopeConflict3/output/Main/Main.cfn.pretty new file mode 100644 index 000000000..83878e43b --- /dev/null +++ b/tests/purus/passing/ResolvableScopeConflict3/output/Main/Main.cfn.pretty @@ -0,0 +1,33 @@ +Main (tests/purus/passing/ResolvableScopeConflict3/ResolvableScopeConflict3.purs) + +Imported Modules: +------------------------------ + A, + Builtin, + Prim + +Exports: +------------------------------ + thing, + main + +Re-Exports: +------------------------------ + + +Foreign: +------------------------------ + + +Datatypes: +------------------------------ + + + +Declarations: +------------------------------ +thing :: Prim.Int +thing = (2: Prim.Int) + +main :: Prim.String +main = ("Done": Prim.String) \ No newline at end of file diff --git a/tests/purus/passing/ResolvableScopeConflict3/output/Main/externs.cbor b/tests/purus/passing/ResolvableScopeConflict3/output/Main/externs.cbor new file mode 100644 index 000000000..8c85d5848 Binary files /dev/null and b/tests/purus/passing/ResolvableScopeConflict3/output/Main/externs.cbor differ diff --git a/tests/purus/passing/ResolvableScopeConflict3/output/package.json b/tests/purus/passing/ResolvableScopeConflict3/output/package.json new file mode 100644 index 000000000..7c34deb58 --- /dev/null +++ b/tests/purus/passing/ResolvableScopeConflict3/output/package.json @@ -0,0 +1 @@ +{"type":"module"} \ No newline at end of file diff --git a/tests/purus/passing/RowSyntax/RowSyntax.purs b/tests/purus/passing/RowSyntax/RowSyntax.purs new file mode 100644 index 000000000..77ebe2730 --- /dev/null +++ b/tests/purus/passing/RowSyntax/RowSyntax.purs @@ -0,0 +1,22 @@ +module RowSyntax where + +type OneRow :: Row Type +type OneRow = [one :: Int] + +type SomeRow :: Row Type +type SomeRow = [inn'it :: Int, stirring :: String] + +class IsARow' (r :: Row Type) +instance forall (r :: Row Type). IsARow' r + +data RowProxy (r :: Row Type) = RowProxy + +aRowProxy :: RowProxy [field :: Int] +aRowProxy = RowProxy + +moreFields :: RowProxy [field1 :: Int, field2 :: String, field3 :: Boolean] +moreFields = RowProxy + +type TestRecord1 = {foob :: String, ar :: Int} + +type TestRecord2 = Record [foob :: String, ar :: Int] diff --git a/tests/purus/passing/RowSyntax/output/RowSyntax/RowSyntax.cfn b/tests/purus/passing/RowSyntax/output/RowSyntax/RowSyntax.cfn new file mode 100644 index 000000000..a97446a29 --- /dev/null +++ b/tests/purus/passing/RowSyntax/output/RowSyntax/RowSyntax.cfn @@ -0,0 +1 @@ +{"builtWith":"0.0.1","comments":[],"dataTypes":{"_ctorDict":[[[["RowSyntax"],{"Ident":"IsARow'$Dict"}],[["RowSyntax"],"IsARow'$Dict"]],[[["RowSyntax"],{"Ident":"RowProxy"}],[["RowSyntax"],"RowProxy"]]],"_tyDict":[[[["RowSyntax"],"IsARow'$Dict"],{"_dDataArgs":[["r",{"annotation":[{"end":[9,29],"name":"tests/purus/passing/RowSyntax/RowSyntax.purs","start":[9,21]},[]],"contents":[{"annotation":[{"end":[9,24],"name":"tests/purus/passing/RowSyntax/RowSyntax.purs","start":[9,21]},[]],"contents":[["Prim"],"Row"],"tag":"TypeConstructor"},{"annotation":[{"end":[9,29],"name":"tests/purus/passing/RowSyntax/RowSyntax.purs","start":[9,25]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"}]],"_dDataCtors":[{"_cdCtorFields":[[{"Ident":"dict"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"tag":"REmpty"}],"tag":"TypeApp"}]],"_cdCtorName":[["RowSyntax"],{"Ident":"IsARow'$Dict"}]}],"_dDataTyName":[["RowSyntax"],"IsARow'$Dict"],"_dDeclType":"newtype"}],[[["RowSyntax"],"RowProxy"],{"_dDataArgs":[["r",{"annotation":[{"end":[12,29],"name":"tests/purus/passing/RowSyntax/RowSyntax.purs","start":[12,21]},[]],"contents":[{"annotation":[{"end":[12,24],"name":"tests/purus/passing/RowSyntax/RowSyntax.purs","start":[12,21]},[]],"contents":[["Prim"],"Row"],"tag":"TypeConstructor"},{"annotation":[{"end":[12,29],"name":"tests/purus/passing/RowSyntax/RowSyntax.purs","start":[12,25]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"}]],"_dDataCtors":[{"_cdCtorFields":[],"_cdCtorName":[["RowSyntax"],{"Ident":"RowProxy"}]}],"_dDataTyName":[["RowSyntax"],"RowProxy"],"_dDeclType":"data"}]]},"decls":[{"annotation":{"meta":null,"sourceSpan":{"end":[10,43],"start":[10,1]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":{"metaType":"IsNewtype"},"sourceSpan":{"end":[10,43],"start":[10,1]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"tag":"REmpty"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"KindApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["RowSyntax"],"IsARow'$Dict"],"tag":"TypeConstructor"},{"annotation":[{"end":[10,43],"name":"tests/purus/passing/RowSyntax/RowSyntax.purs","start":[10,42]},[]],"contents":{"kind":{"annotation":[{"end":[10,31],"name":"tests/purus/passing/RowSyntax/RowSyntax.purs","start":[10,23]},[]],"contents":[{"annotation":[{"end":[10,26],"name":"tests/purus/passing/RowSyntax/RowSyntax.purs","start":[10,23]},[]],"contents":[["Prim"],"Row"],"tag":"TypeConstructor"},{"annotation":[{"end":[10,31],"name":"tests/purus/passing/RowSyntax/RowSyntax.purs","start":[10,27]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"var":"r"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"IsARow'$Dict","moduleName":["RowSyntax"]}},"annotation":{"meta":null,"sourceSpan":{"end":[10,43],"start":[10,1]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[10,43],"start":[10,1]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"tag":"REmpty"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"KindApp"}],"tag":"TypeApp"},"value":{"literalType":"ObjectLiteral","value":[]}},"kind":"App"},"identifier":"isARow'"},{"annotation":{"meta":null,"sourceSpan":{"end":[17,38],"start":[17,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":{"constructorType":"ProductType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[18,22],"start":[18,14]}},"kind":"Var","type":{"annotation":[{"end":[17,38],"name":"tests/purus/passing/RowSyntax/RowSyntax.purs","start":[17,15]},[]],"contents":[{"annotation":[{"end":[17,23],"name":"tests/purus/passing/RowSyntax/RowSyntax.purs","start":[17,15]},[]],"contents":[["RowSyntax"],"RowProxy"],"tag":"TypeConstructor"},{"annotation":[{"end":[17,38],"name":"tests/purus/passing/RowSyntax/RowSyntax.purs","start":[17,25]},[]],"contents":["field1",{"annotation":[{"end":[17,38],"name":"tests/purus/passing/RowSyntax/RowSyntax.purs","start":[17,35]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},{"annotation":[{"end":[17,56],"name":"tests/purus/passing/RowSyntax/RowSyntax.purs","start":[17,40]},[]],"contents":["field2",{"annotation":[{"end":[17,56],"name":"tests/purus/passing/RowSyntax/RowSyntax.purs","start":[17,50]},[]],"contents":[["Prim"],"String"],"tag":"TypeConstructor"},{"annotation":[{"end":[17,75],"name":"tests/purus/passing/RowSyntax/RowSyntax.purs","start":[17,58]},[]],"contents":["field3",{"annotation":[{"end":[17,75],"name":"tests/purus/passing/RowSyntax/RowSyntax.purs","start":[17,68]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"},{"annotation":[{"end":[17,76],"name":"tests/purus/passing/RowSyntax/RowSyntax.purs","start":[17,75]},[]],"contents":[{"annotation":[{"end":[17,76],"name":"tests/purus/passing/RowSyntax/RowSyntax.purs","start":[17,75]},[]],"tag":"REmpty"},{"annotation":[{"end":[17,38],"name":"tests/purus/passing/RowSyntax/RowSyntax.purs","start":[17,35]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"KindApp"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"TypeApp"},"value":{"identifier":"RowProxy","moduleName":["RowSyntax"]}},"identifier":"moreFields"},{"annotation":{"meta":null,"sourceSpan":{"end":[14,36],"start":[14,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":{"constructorType":"ProductType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[15,21],"start":[15,13]}},"kind":"Var","type":{"annotation":[{"end":[14,36],"name":"tests/purus/passing/RowSyntax/RowSyntax.purs","start":[14,14]},[]],"contents":[{"annotation":[{"end":[14,22],"name":"tests/purus/passing/RowSyntax/RowSyntax.purs","start":[14,14]},[]],"contents":[["RowSyntax"],"RowProxy"],"tag":"TypeConstructor"},{"annotation":[{"end":[14,36],"name":"tests/purus/passing/RowSyntax/RowSyntax.purs","start":[14,24]},[]],"contents":["field",{"annotation":[{"end":[14,36],"name":"tests/purus/passing/RowSyntax/RowSyntax.purs","start":[14,33]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},{"annotation":[{"end":[14,37],"name":"tests/purus/passing/RowSyntax/RowSyntax.purs","start":[14,36]},[]],"contents":[{"annotation":[{"end":[14,37],"name":"tests/purus/passing/RowSyntax/RowSyntax.purs","start":[14,36]},[]],"tag":"REmpty"},{"annotation":[{"end":[14,36],"name":"tests/purus/passing/RowSyntax/RowSyntax.purs","start":[14,33]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"KindApp"}],"tag":"RCons"}],"tag":"TypeApp"},"value":{"identifier":"RowProxy","moduleName":["RowSyntax"]}},"identifier":"aRowProxy"}],"exports":["RowProxy","aRowProxy","moreFields","isARow'"],"foreign":[],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[22,54],"start":[1,1]}},"moduleName":["Builtin"]},{"annotation":{"meta":null,"sourceSpan":{"end":[22,54],"start":[1,1]}},"moduleName":["Prim"]},{"annotation":{"meta":null,"sourceSpan":{"end":[22,54],"start":[1,1]}},"moduleName":["RowSyntax"]}],"moduleName":["RowSyntax"],"modulePath":"tests/purus/passing/RowSyntax/RowSyntax.purs","reExports":{},"sourceSpan":{"end":[22,54],"start":[1,1]}} \ No newline at end of file diff --git a/tests/purus/passing/RowSyntax/output/RowSyntax/RowSyntax.cfn.pretty b/tests/purus/passing/RowSyntax/output/RowSyntax/RowSyntax.cfn.pretty new file mode 100644 index 000000000..ac1aea54c --- /dev/null +++ b/tests/purus/passing/RowSyntax/output/RowSyntax/RowSyntax.cfn.pretty @@ -0,0 +1,49 @@ +RowSyntax (tests/purus/passing/RowSyntax/RowSyntax.purs) + +Imported Modules: +------------------------------ + Builtin, + Prim, + RowSyntax + +Exports: +------------------------------ + RowProxy, + aRowProxy, + moreFields, + isARow' + +Re-Exports: +------------------------------ + + +Foreign: +------------------------------ + + +Datatypes: +------------------------------ +newtype IsARow'$Dict (r :: (Prim.Row (Prim.Type))) = + IsARow'$Dict ((Prim.Record ({}))) + +data RowProxy (r :: (Prim.Row (Prim.Type))) = + RowProxy + + +Declarations: +------------------------------ +isARow' :: (RowSyntax.IsARow'$Dict ((r :: (Prim.Row (Prim.Type))))) +isARow' = + (IsARow'$Dict: ((Prim.Record ({}@Prim.Type)) -> + ((RowSyntax.IsARow'$Dict ((r :: (Prim.Row (Prim.Type)))))))) + ({ }: (Prim.Record ({}@Prim.Type))) + +moreFields :: (RowSyntax.RowProxy (( field1 :: Prim.Int +, field2 :: Prim.String +, field3 :: Prim.Boolean ))) +moreFields = + (RowProxy: (RowSyntax.RowProxy + ((field1 :: Prim.Int, field2 :: Prim.String, field3 :: Prim.Boolean)))) + +aRowProxy :: (RowSyntax.RowProxy ((field :: Prim.Int))) +aRowProxy = (RowProxy: (RowSyntax.RowProxy ((field :: Prim.Int)))) \ No newline at end of file diff --git a/tests/purus/passing/RowSyntax/output/RowSyntax/externs.cbor b/tests/purus/passing/RowSyntax/output/RowSyntax/externs.cbor new file mode 100644 index 000000000..6424c59c6 Binary files /dev/null and b/tests/purus/passing/RowSyntax/output/RowSyntax/externs.cbor differ diff --git a/tests/purus/passing/RowSyntax/output/package.json b/tests/purus/passing/RowSyntax/output/package.json new file mode 100644 index 000000000..7c34deb58 --- /dev/null +++ b/tests/purus/passing/RowSyntax/output/package.json @@ -0,0 +1 @@ +{"type":"module"} \ No newline at end of file diff --git a/tests/purus/passing/ShadowedModuleName/ShadowedModuleName.purs b/tests/purus/passing/ShadowedModuleName/ShadowedModuleName.purs new file mode 100644 index 000000000..80061b5fb --- /dev/null +++ b/tests/purus/passing/ShadowedModuleName/ShadowedModuleName.purs @@ -0,0 +1,7 @@ +module Main where + +import Test + +data Test = Test + +main = runZ (Z "Done") diff --git a/tests/purus/passing/ShadowedModuleName/Test.purs b/tests/purus/passing/ShadowedModuleName/Test.purs new file mode 100644 index 000000000..b30eb2dfd --- /dev/null +++ b/tests/purus/passing/ShadowedModuleName/Test.purs @@ -0,0 +1,6 @@ +module Test where + +data Z = Z String + +runZ :: Z -> String +runZ (Z s) = s diff --git a/tests/purus/passing/ShadowedModuleName/output/Main/Main.cfn b/tests/purus/passing/ShadowedModuleName/output/Main/Main.cfn new file mode 100644 index 000000000..debf9e24b --- /dev/null +++ b/tests/purus/passing/ShadowedModuleName/output/Main/Main.cfn @@ -0,0 +1 @@ +{"builtWith":"0.0.1","comments":[],"dataTypes":{"_ctorDict":[[[["Main"],{"Ident":"Test"}],[["Main"],"Test"]]],"_tyDict":[[[["Main"],"Test"],{"_dDataArgs":[],"_dDataCtors":[{"_cdCtorFields":[],"_cdCtorName":[["Main"],{"Ident":"Test"}]}],"_dDataTyName":[["Main"],"Test"],"_dDeclType":"data"}]]},"decls":[{"annotation":{"meta":null,"sourceSpan":{"end":[7,23],"start":[7,1]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[7,12],"start":[7,8]}},"kind":"Var","type":{"annotation":[{"end":[5,20],"name":"tests/purus/passing/ShadowedModuleName/Test.purs","start":[5,9]},[]],"contents":[{"annotation":[{"end":[5,20],"name":"tests/purus/passing/ShadowedModuleName/Test.purs","start":[5,9]},[]],"contents":[{"annotation":[{"end":[5,13],"name":"tests/purus/passing/ShadowedModuleName/Test.purs","start":[5,11]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[5,10],"name":"tests/purus/passing/ShadowedModuleName/Test.purs","start":[5,9]},[]],"contents":[["Test"],"Z"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[5,20],"name":"tests/purus/passing/ShadowedModuleName/Test.purs","start":[5,14]},[]],"contents":[["Prim"],"String"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"runZ","moduleName":["Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[7,23],"start":[7,8]}},"argument":{"abstraction":{"annotation":{"meta":{"constructorType":"ProductType","identifiers":["value0"],"metaType":"IsConstructor"},"sourceSpan":{"end":[7,15],"start":[7,14]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[3,18],"name":"tests/purus/passing/ShadowedModuleName/Test.purs","start":[3,12]},[]],"contents":[["Prim"],"String"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Test"],"Z"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"Z","moduleName":["Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[7,22],"start":[7,14]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[7,22],"start":[7,16]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"String"],"tag":"TypeConstructor"},"value":{"literalType":"StringLiteral","value":"Done"}},"kind":"App"},"kind":"App"},"identifier":"main"}],"exports":["Test","main"],"foreign":[],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[7,23],"start":[1,1]}},"moduleName":["Builtin"]},{"annotation":{"meta":null,"sourceSpan":{"end":[7,23],"start":[1,1]}},"moduleName":["Prim"]},{"annotation":{"meta":null,"sourceSpan":{"end":[7,23],"start":[1,1]}},"moduleName":["Test"]}],"moduleName":["Main"],"modulePath":"tests/purus/passing/ShadowedModuleName/ShadowedModuleName.purs","reExports":{},"sourceSpan":{"end":[7,23],"start":[1,1]}} \ No newline at end of file diff --git a/tests/purus/passing/ShadowedModuleName/output/Main/Main.cfn.pretty b/tests/purus/passing/ShadowedModuleName/output/Main/Main.cfn.pretty new file mode 100644 index 000000000..87cec7210 --- /dev/null +++ b/tests/purus/passing/ShadowedModuleName/output/Main/Main.cfn.pretty @@ -0,0 +1,33 @@ +Main (tests/purus/passing/ShadowedModuleName/ShadowedModuleName.purs) + +Imported Modules: +------------------------------ + Builtin, + Prim, + Test + +Exports: +------------------------------ + Test, + main + +Re-Exports: +------------------------------ + + +Foreign: +------------------------------ + + +Datatypes: +------------------------------ +data Test = + Test + + +Declarations: +------------------------------ +main :: Prim.String +main = + (runZ: (Test.Z -> (Prim.String))) + ((Z: (Prim.String -> (Test.Z))) ("Done": Prim.String)) \ No newline at end of file diff --git a/tests/purus/passing/ShadowedModuleName/output/Main/externs.cbor b/tests/purus/passing/ShadowedModuleName/output/Main/externs.cbor new file mode 100644 index 000000000..da41f81da Binary files /dev/null and b/tests/purus/passing/ShadowedModuleName/output/Main/externs.cbor differ diff --git a/tests/purus/passing/ShadowedModuleName/output/Test/Test.cfn b/tests/purus/passing/ShadowedModuleName/output/Test/Test.cfn new file mode 100644 index 000000000..3b242e260 --- /dev/null +++ b/tests/purus/passing/ShadowedModuleName/output/Test/Test.cfn @@ -0,0 +1 @@ +{"builtWith":"0.0.1","comments":[],"dataTypes":{"_ctorDict":[[[["Test"],{"Ident":"Z"}],[["Test"],"Z"]]],"_tyDict":[[[["Test"],"Z"],{"_dDataArgs":[],"_dDataCtors":[{"_cdCtorFields":[[{"Ident":"value0"},{"annotation":[{"end":[3,18],"name":"tests/purus/passing/ShadowedModuleName/Test.purs","start":[3,12]},[]],"contents":[["Prim"],"String"],"tag":"TypeConstructor"}]],"_cdCtorName":[["Test"],{"Ident":"Z"}]}],"_dDataTyName":[["Test"],"Z"],"_dDeclType":"data"}]]},"decls":[{"annotation":{"meta":null,"sourceSpan":{"end":[5,20],"start":[5,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"argument":"v","body":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":{"constructorType":"ProductType","identifiers":["value0"],"metaType":"IsConstructor"},"sourceSpan":{"end":[6,10],"start":[6,7]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[6,10],"start":[6,9]}},"binderType":"VarBinder","identifier":"s","type":{"annotation":[{"end":[3,18],"name":"tests/purus/passing/ShadowedModuleName/Test.purs","start":[3,12]},[]],"contents":[["Prim"],"String"],"tag":"TypeConstructor"}}],"constructorName":{"identifier":"Z","moduleName":["Test"]},"typeName":{"identifier":"Z","moduleName":["Test"]}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[6,15],"start":[6,14]}},"kind":"Var","type":{"annotation":[{"end":[3,18],"name":"tests/purus/passing/ShadowedModuleName/Test.purs","start":[3,12]},[]],"contents":[["Prim"],"String"],"tag":"TypeConstructor"},"value":{"identifier":"s","sourcePos":[6,9]}},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[6,15],"start":[6,1]}},"kind":"Var","type":{"annotation":[{"end":[5,10],"name":"tests/purus/passing/ShadowedModuleName/Test.purs","start":[5,9]},[]],"contents":[["Test"],"Z"],"tag":"TypeConstructor"},"value":{"identifier":"v","sourcePos":[0,0]}}],"kind":"Case","type":{"annotation":[{"end":[5,20],"name":"tests/purus/passing/ShadowedModuleName/Test.purs","start":[5,14]},[]],"contents":[["Prim"],"String"],"tag":"TypeConstructor"}},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[5,10],"name":"tests/purus/passing/ShadowedModuleName/Test.purs","start":[5,9]},[]],"contents":[["Test"],"Z"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[5,20],"name":"tests/purus/passing/ShadowedModuleName/Test.purs","start":[5,14]},[]],"contents":[["Prim"],"String"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"identifier":"runZ"}],"exports":["Z","runZ"],"foreign":[],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[6,15],"start":[1,1]}},"moduleName":["Builtin"]},{"annotation":{"meta":null,"sourceSpan":{"end":[6,15],"start":[1,1]}},"moduleName":["Prim"]},{"annotation":{"meta":null,"sourceSpan":{"end":[6,15],"start":[1,1]}},"moduleName":["Test"]}],"moduleName":["Test"],"modulePath":"tests/purus/passing/ShadowedModuleName/Test.purs","reExports":{},"sourceSpan":{"end":[6,15],"start":[1,1]}} \ No newline at end of file diff --git a/tests/purus/passing/ShadowedModuleName/output/Test/Test.cfn.pretty b/tests/purus/passing/ShadowedModuleName/output/Test/Test.cfn.pretty new file mode 100644 index 000000000..5339f7a51 --- /dev/null +++ b/tests/purus/passing/ShadowedModuleName/output/Test/Test.cfn.pretty @@ -0,0 +1,34 @@ +Test (tests/purus/passing/ShadowedModuleName/Test.purs) + +Imported Modules: +------------------------------ + Builtin, + Prim, + Test + +Exports: +------------------------------ + Z, + runZ + +Re-Exports: +------------------------------ + + +Foreign: +------------------------------ + + +Datatypes: +------------------------------ +data Z = + Z (Prim.String) + + +Declarations: +------------------------------ +runZ :: (Test.Z -> (Prim.String)) +runZ = + \(v: Test.Z) -> + case (v: Test.Z) of + Z s -> (s: Prim.String) \ No newline at end of file diff --git a/tests/purus/passing/ShadowedModuleName/output/Test/externs.cbor b/tests/purus/passing/ShadowedModuleName/output/Test/externs.cbor new file mode 100644 index 000000000..c7ed3b4b0 Binary files /dev/null and b/tests/purus/passing/ShadowedModuleName/output/Test/externs.cbor differ diff --git a/tests/purus/passing/ShadowedModuleName/output/package.json b/tests/purus/passing/ShadowedModuleName/output/package.json new file mode 100644 index 000000000..7c34deb58 --- /dev/null +++ b/tests/purus/passing/ShadowedModuleName/output/package.json @@ -0,0 +1 @@ +{"type":"module"} \ No newline at end of file diff --git a/tests/purus/passing/TransitiveImport/Middle.purs b/tests/purus/passing/TransitiveImport/Middle.purs new file mode 100644 index 000000000..5d5783807 --- /dev/null +++ b/tests/purus/passing/TransitiveImport/Middle.purs @@ -0,0 +1,9 @@ +module Middle (module Test, uneet, middle) where + +import Test + +uneet :: Uneet +uneet = Uneet + +middle :: forall (a :: Type). TestCls a => a -> a +middle = test diff --git a/tests/purus/passing/TransitiveImport/Test.purs b/tests/purus/passing/TransitiveImport/Test.purs new file mode 100644 index 000000000..9b7bf816c --- /dev/null +++ b/tests/purus/passing/TransitiveImport/Test.purs @@ -0,0 +1,9 @@ +module Test where + +data Uneet = Uneet + +class TestCls (a :: Type) where + test :: a -> a + +instance TestCls Uneet where + test _ = Uneet diff --git a/tests/purus/passing/TransitiveImport/TransitiveImport.purs b/tests/purus/passing/TransitiveImport/TransitiveImport.purs new file mode 100644 index 000000000..4c43bd0b0 --- /dev/null +++ b/tests/purus/passing/TransitiveImport/TransitiveImport.purs @@ -0,0 +1,6 @@ +module Main where + + import Middle + + main :: Uneet + main = (middle uneet) diff --git a/tests/purus/passing/TransitiveImport/output/Main/Main.cfn b/tests/purus/passing/TransitiveImport/output/Main/Main.cfn new file mode 100644 index 000000000..4067293ca --- /dev/null +++ b/tests/purus/passing/TransitiveImport/output/Main/Main.cfn @@ -0,0 +1 @@ +{"builtWith":"0.0.1","comments":[],"dataTypes":{"_ctorDict":[],"_tyDict":[]},"decls":[{"annotation":{"meta":null,"sourceSpan":{"end":[5,16],"start":[5,3]}},"bindType":"NonRec","expression":{"abstraction":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[6,18],"start":[6,12]}},"kind":"Var","type":{"annotation":[{"end":[8,50],"name":"tests/purus/passing/TransitiveImport/Middle.purs","start":[8,11]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[8,28],"name":"tests/purus/passing/TransitiveImport/Middle.purs","start":[8,24]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":0,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Test"],"TestCls$Dict"],"tag":"TypeConstructor"},{"annotation":[{"end":[8,40],"name":"tests/purus/passing/TransitiveImport/Middle.purs","start":[8,39]},[]],"contents":{"kind":{"annotation":[{"end":[8,28],"name":"tests/purus/passing/TransitiveImport/Middle.purs","start":[8,24]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[8,50],"name":"tests/purus/passing/TransitiveImport/Middle.purs","start":[8,44]},[]],"contents":[{"annotation":[{"end":[8,50],"name":"tests/purus/passing/TransitiveImport/Middle.purs","start":[8,44]},[]],"contents":[{"annotation":[{"end":[8,48],"name":"tests/purus/passing/TransitiveImport/Middle.purs","start":[8,46]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[8,45],"name":"tests/purus/passing/TransitiveImport/Middle.purs","start":[8,44]},[]],"contents":{"kind":{"annotation":[{"end":[8,28],"name":"tests/purus/passing/TransitiveImport/Middle.purs","start":[8,24]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[8,50],"name":"tests/purus/passing/TransitiveImport/Middle.purs","start":[8,49]},[]],"contents":{"kind":{"annotation":[{"end":[8,28],"name":"tests/purus/passing/TransitiveImport/Middle.purs","start":[8,24]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"middle","moduleName":["Middle"]}},"annotation":{"meta":null,"sourceSpan":{"end":[6,24],"start":[6,12]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Test"],"TestCls$Dict"],"tag":"TypeConstructor"},{"annotation":[{"end":[8,23],"name":"tests/purus/passing/TransitiveImport/Test.purs","start":[8,18]},[]],"contents":[["Test"],"Uneet"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"testClsUneet","moduleName":["Test"]}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[6,24],"start":[6,12]}},"argument":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[6,24],"start":[6,19]}},"kind":"Var","type":{"annotation":[{"end":[5,15],"name":"tests/purus/passing/TransitiveImport/Middle.purs","start":[5,10]},[]],"contents":[["Test"],"Uneet"],"tag":"TypeConstructor"},"value":{"identifier":"uneet","moduleName":["Middle"]}},"kind":"App"},"identifier":"main"}],"exports":["main"],"foreign":[],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[6,25],"start":[1,1]}},"moduleName":["Builtin"]},{"annotation":{"meta":null,"sourceSpan":{"end":[6,25],"start":[1,1]}},"moduleName":["Middle"]},{"annotation":{"meta":null,"sourceSpan":{"end":[6,25],"start":[1,1]}},"moduleName":["Prim"]},{"annotation":{"meta":null,"sourceSpan":{"end":[6,25],"start":[1,1]}},"moduleName":["Test"]}],"moduleName":["Main"],"modulePath":"tests/purus/passing/TransitiveImport/TransitiveImport.purs","reExports":{},"sourceSpan":{"end":[6,25],"start":[1,1]}} \ No newline at end of file diff --git a/tests/purus/passing/TransitiveImport/output/Main/Main.cfn.pretty b/tests/purus/passing/TransitiveImport/output/Main/Main.cfn.pretty new file mode 100644 index 000000000..e1b06c62d --- /dev/null +++ b/tests/purus/passing/TransitiveImport/output/Main/Main.cfn.pretty @@ -0,0 +1,34 @@ +Main (tests/purus/passing/TransitiveImport/TransitiveImport.purs) + +Imported Modules: +------------------------------ + Builtin, + Middle, + Prim, + Test + +Exports: +------------------------------ + main + +Re-Exports: +------------------------------ + + +Foreign: +------------------------------ + + +Datatypes: +------------------------------ + + + +Declarations: +------------------------------ +main :: Test.Uneet +main = + (middle: forall (a :: Prim.Type). ((Test.TestCls$Dict ((a :: Prim.Type))) -> + (((a :: Prim.Type) -> ((a :: Prim.Type)))))) + (testClsUneet: (Test.TestCls$Dict (Test.Uneet))) + (uneet: Test.Uneet) \ No newline at end of file diff --git a/tests/purus/passing/TransitiveImport/output/Main/externs.cbor b/tests/purus/passing/TransitiveImport/output/Main/externs.cbor new file mode 100644 index 000000000..05b26a334 Binary files /dev/null and b/tests/purus/passing/TransitiveImport/output/Main/externs.cbor differ diff --git a/tests/purus/passing/TransitiveImport/output/Middle/Middle.cfn b/tests/purus/passing/TransitiveImport/output/Middle/Middle.cfn new file mode 100644 index 000000000..68be64d58 --- /dev/null +++ b/tests/purus/passing/TransitiveImport/output/Middle/Middle.cfn @@ -0,0 +1 @@ +{"builtWith":"0.0.1","comments":[],"dataTypes":{"_ctorDict":[],"_tyDict":[]},"decls":[{"annotation":{"meta":null,"sourceSpan":{"end":[5,15],"start":[5,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":{"constructorType":"ProductType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[6,14],"start":[6,9]}},"kind":"Var","type":{"annotation":[{"end":[5,15],"name":"tests/purus/passing/TransitiveImport/Middle.purs","start":[5,10]},[]],"contents":[["Test"],"Uneet"],"tag":"TypeConstructor"},"value":{"identifier":"Uneet","moduleName":["Test"]}},"identifier":"uneet"},{"annotation":{"meta":null,"sourceSpan":{"end":[8,50],"start":[8,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"argument":"dictTestCls","body":{"abstraction":{"annotation":{"meta":{"metaType":"IsForeign"},"sourceSpan":{"end":[9,14],"start":[9,10]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[5,25],"name":"tests/purus/passing/TransitiveImport/Test.purs","start":[5,21]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":1,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Test"],"TestCls$Dict"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[5,25],"name":"tests/purus/passing/TransitiveImport/Test.purs","start":[5,21]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[6,17],"name":"tests/purus/passing/TransitiveImport/Test.purs","start":[6,11]},[]],"contents":[{"annotation":[{"end":[6,17],"name":"tests/purus/passing/TransitiveImport/Test.purs","start":[6,11]},[]],"contents":[{"annotation":[{"end":[6,15],"name":"tests/purus/passing/TransitiveImport/Test.purs","start":[6,13]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[6,12],"name":"tests/purus/passing/TransitiveImport/Test.purs","start":[6,11]},[]],"contents":{"kind":{"annotation":[{"end":[5,25],"name":"tests/purus/passing/TransitiveImport/Test.purs","start":[5,21]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[6,17],"name":"tests/purus/passing/TransitiveImport/Test.purs","start":[6,16]},[]],"contents":{"kind":{"annotation":[{"end":[5,25],"name":"tests/purus/passing/TransitiveImport/Test.purs","start":[5,21]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarVisible"},"tag":"ForAll"},"value":{"identifier":"test","moduleName":["Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[9,14],"start":[9,10]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Test"],"TestCls$Dict"],"tag":"TypeConstructor"},{"annotation":[{"end":[8,40],"name":"tests/purus/passing/TransitiveImport/Middle.purs","start":[8,39]},[]],"contents":{"kind":{"annotation":[{"end":[8,28],"name":"tests/purus/passing/TransitiveImport/Middle.purs","start":[8,24]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},"value":{"identifier":"dictTestCls","sourcePos":[0,0]}},"kind":"App"},"kind":"Abs","type":{"annotation":[{"end":[8,50],"name":"tests/purus/passing/TransitiveImport/Middle.purs","start":[8,11]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[8,28],"name":"tests/purus/passing/TransitiveImport/Middle.purs","start":[8,24]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":0,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Test"],"TestCls$Dict"],"tag":"TypeConstructor"},{"annotation":[{"end":[8,40],"name":"tests/purus/passing/TransitiveImport/Middle.purs","start":[8,39]},[]],"contents":{"kind":{"annotation":[{"end":[8,28],"name":"tests/purus/passing/TransitiveImport/Middle.purs","start":[8,24]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[8,50],"name":"tests/purus/passing/TransitiveImport/Middle.purs","start":[8,44]},[]],"contents":[{"annotation":[{"end":[8,50],"name":"tests/purus/passing/TransitiveImport/Middle.purs","start":[8,44]},[]],"contents":[{"annotation":[{"end":[8,48],"name":"tests/purus/passing/TransitiveImport/Middle.purs","start":[8,46]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[8,45],"name":"tests/purus/passing/TransitiveImport/Middle.purs","start":[8,44]},[]],"contents":{"kind":{"annotation":[{"end":[8,28],"name":"tests/purus/passing/TransitiveImport/Middle.purs","start":[8,24]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[8,50],"name":"tests/purus/passing/TransitiveImport/Middle.purs","start":[8,49]},[]],"contents":{"kind":{"annotation":[{"end":[8,28],"name":"tests/purus/passing/TransitiveImport/Middle.purs","start":[8,24]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"identifier":"middle"}],"exports":["uneet","middle"],"foreign":[],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[9,14],"start":[1,1]}},"moduleName":["Builtin"]},{"annotation":{"meta":null,"sourceSpan":{"end":[9,14],"start":[1,1]}},"moduleName":["Prim"]},{"annotation":{"meta":null,"sourceSpan":{"end":[9,14],"start":[1,1]}},"moduleName":["Test"]}],"moduleName":["Middle"],"modulePath":"tests/purus/passing/TransitiveImport/Middle.purs","reExports":{"Test":["Uneet","test"]},"sourceSpan":{"end":[9,14],"start":[1,1]}} \ No newline at end of file diff --git a/tests/purus/passing/TransitiveImport/output/Middle/Middle.cfn.pretty b/tests/purus/passing/TransitiveImport/output/Middle/Middle.cfn.pretty new file mode 100644 index 000000000..c44042df6 --- /dev/null +++ b/tests/purus/passing/TransitiveImport/output/Middle/Middle.cfn.pretty @@ -0,0 +1,38 @@ +Middle (tests/purus/passing/TransitiveImport/Middle.purs) + +Imported Modules: +------------------------------ + Builtin, + Prim, + Test + +Exports: +------------------------------ + uneet, + middle + +Re-Exports: +------------------------------ + Test.Uneet + Test.test + +Foreign: +------------------------------ + + +Datatypes: +------------------------------ + + + +Declarations: +------------------------------ +uneet :: Test.Uneet +uneet = (Uneet: Test.Uneet) + +middle :: forall (a :: Prim.Type). ((Test.TestCls$Dict ((a :: Prim.Type))) -> (((a :: Prim.Type) -> ((a :: Prim.Type))))) +middle = + \(dictTestCls: (Test.TestCls$Dict ((a :: Prim.Type)))) -> + (test: forall (@a :: Prim.Type). ((Test.TestCls$Dict ((a :: Prim.Type))) -> + (((a :: Prim.Type) -> ((a :: Prim.Type)))))) + (dictTestCls: (Test.TestCls$Dict ((a :: Prim.Type)))) \ No newline at end of file diff --git a/tests/purus/passing/TransitiveImport/output/Middle/externs.cbor b/tests/purus/passing/TransitiveImport/output/Middle/externs.cbor new file mode 100644 index 000000000..3d92087a4 Binary files /dev/null and b/tests/purus/passing/TransitiveImport/output/Middle/externs.cbor differ diff --git a/tests/purus/passing/TransitiveImport/output/Test/Test.cfn b/tests/purus/passing/TransitiveImport/output/Test/Test.cfn new file mode 100644 index 000000000..49cdf76e7 --- /dev/null +++ b/tests/purus/passing/TransitiveImport/output/Test/Test.cfn @@ -0,0 +1 @@ +{"builtWith":"0.0.1","comments":[],"dataTypes":{"_ctorDict":[[[["Test"],{"Ident":"TestCls$Dict"}],[["Test"],"TestCls$Dict"]],[[["Test"],{"Ident":"Uneet"}],[["Test"],"Uneet"]]],"_tyDict":[[[["Test"],"TestCls$Dict"],{"_dDataArgs":[["a",{"annotation":[{"end":[5,25],"name":"tests/purus/passing/TransitiveImport/Test.purs","start":[5,21]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}]],"_dDataCtors":[{"_cdCtorFields":[[{"Ident":"dict"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["test",{"annotation":[{"end":[6,17],"name":"tests/purus/passing/TransitiveImport/Test.purs","start":[6,11]},[]],"contents":[{"annotation":[{"end":[6,17],"name":"tests/purus/passing/TransitiveImport/Test.purs","start":[6,11]},[]],"contents":[{"annotation":[{"end":[6,15],"name":"tests/purus/passing/TransitiveImport/Test.purs","start":[6,13]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[6,12],"name":"tests/purus/passing/TransitiveImport/Test.purs","start":[6,11]},[]],"contents":{"kind":{"annotation":[{"end":[5,25],"name":"tests/purus/passing/TransitiveImport/Test.purs","start":[5,21]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[6,17],"name":"tests/purus/passing/TransitiveImport/Test.purs","start":[6,16]},[]],"contents":{"kind":{"annotation":[{"end":[5,25],"name":"tests/purus/passing/TransitiveImport/Test.purs","start":[5,21]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"tag":"REmpty"}],"tag":"RCons"}],"tag":"TypeApp"}]],"_cdCtorName":[["Test"],{"Ident":"TestCls$Dict"}]}],"_dDataTyName":[["Test"],"TestCls$Dict"],"_dDeclType":"newtype"}],[[["Test"],"Uneet"],{"_dDataArgs":[],"_dDataCtors":[{"_cdCtorFields":[],"_cdCtorName":[["Test"],{"Ident":"Uneet"}]}],"_dDataTyName":[["Test"],"Uneet"],"_dDeclType":"data"}]]},"decls":[{"annotation":{"meta":null,"sourceSpan":{"end":[9,17],"start":[8,1]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":{"metaType":"IsNewtype"},"sourceSpan":{"end":[9,17],"start":[8,1]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["test",{"annotation":[{"end":[6,17],"name":"tests/purus/passing/TransitiveImport/Test.purs","start":[6,11]},[]],"contents":[{"annotation":[{"end":[6,17],"name":"tests/purus/passing/TransitiveImport/Test.purs","start":[6,11]},[]],"contents":[{"annotation":[{"end":[6,15],"name":"tests/purus/passing/TransitiveImport/Test.purs","start":[6,13]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[8,23],"name":"tests/purus/passing/TransitiveImport/Test.purs","start":[8,18]},[]],"contents":[["Test"],"Uneet"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[8,23],"name":"tests/purus/passing/TransitiveImport/Test.purs","start":[8,18]},[]],"contents":[["Test"],"Uneet"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"tag":"REmpty"},{"annotation":[{"end":[6,15],"name":"tests/purus/passing/TransitiveImport/Test.purs","start":[6,13]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"KindApp"}],"tag":"RCons"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Test"],"TestCls$Dict"],"tag":"TypeConstructor"},{"annotation":[{"end":[8,23],"name":"tests/purus/passing/TransitiveImport/Test.purs","start":[8,18]},[]],"contents":[["Test"],"Uneet"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"TestCls$Dict","moduleName":["Test"]}},"annotation":{"meta":null,"sourceSpan":{"end":[9,17],"start":[8,1]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[9,17],"start":[8,1]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["test",{"annotation":[{"end":[6,17],"name":"tests/purus/passing/TransitiveImport/Test.purs","start":[6,11]},[]],"contents":[{"annotation":[{"end":[6,17],"name":"tests/purus/passing/TransitiveImport/Test.purs","start":[6,11]},[]],"contents":[{"annotation":[{"end":[6,15],"name":"tests/purus/passing/TransitiveImport/Test.purs","start":[6,13]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[8,23],"name":"tests/purus/passing/TransitiveImport/Test.purs","start":[8,18]},[]],"contents":[["Test"],"Uneet"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[8,23],"name":"tests/purus/passing/TransitiveImport/Test.purs","start":[8,18]},[]],"contents":[["Test"],"Uneet"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"tag":"REmpty"},{"annotation":[{"end":[6,15],"name":"tests/purus/passing/TransitiveImport/Test.purs","start":[6,13]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"KindApp"}],"tag":"RCons"}],"tag":"TypeApp"},"value":{"literalType":"ObjectLiteral","value":[["test",{"annotation":{"meta":null,"sourceSpan":{"end":[9,17],"start":[9,3]}},"argument":"v","body":{"annotation":{"meta":{"constructorType":"ProductType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[9,17],"start":[9,12]}},"kind":"Var","type":{"annotation":[{"end":[8,23],"name":"tests/purus/passing/TransitiveImport/Test.purs","start":[8,18]},[]],"contents":[["Test"],"Uneet"],"tag":"TypeConstructor"},"value":{"identifier":"Uneet","moduleName":["Test"]}},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[8,23],"name":"tests/purus/passing/TransitiveImport/Test.purs","start":[8,18]},[]],"contents":[["Test"],"Uneet"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[8,23],"name":"tests/purus/passing/TransitiveImport/Test.purs","start":[8,18]},[]],"contents":[["Test"],"Uneet"],"tag":"TypeConstructor"}],"tag":"TypeApp"}}]]}},"kind":"App"},"identifier":"testClsUneet"},{"annotation":{"meta":null,"sourceSpan":{"end":[6,17],"start":[6,3]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[6,17],"start":[6,3]}},"argument":"dict","body":{"annotation":{"meta":null,"sourceSpan":{"end":[6,17],"start":[6,3]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":{"metaType":"IsNewtype"},"sourceSpan":{"end":[6,17],"start":[6,3]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[6,17],"start":[6,3]}},"binderType":"VarBinder","identifier":"v","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["test",{"annotation":[{"end":[6,17],"name":"tests/purus/passing/TransitiveImport/Test.purs","start":[6,11]},[]],"contents":[{"annotation":[{"end":[6,17],"name":"tests/purus/passing/TransitiveImport/Test.purs","start":[6,11]},[]],"contents":[{"annotation":[{"end":[6,15],"name":"tests/purus/passing/TransitiveImport/Test.purs","start":[6,13]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[5,25],"name":"tests/purus/passing/TransitiveImport/Test.purs","start":[5,21]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[5,25],"name":"tests/purus/passing/TransitiveImport/Test.purs","start":[5,21]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"tag":"REmpty"},{"annotation":[{"end":[6,15],"name":"tests/purus/passing/TransitiveImport/Test.purs","start":[6,13]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"KindApp"}],"tag":"RCons"}],"tag":"TypeApp"}}],"constructorName":{"identifier":"TestCls$Dict","moduleName":["Test"]},"typeName":{"identifier":"TestCls$Dict","moduleName":["Test"]}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[6,17],"start":[6,3]}},"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[6,17],"start":[6,3]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["test",{"annotation":[{"end":[6,17],"name":"tests/purus/passing/TransitiveImport/Test.purs","start":[6,11]},[]],"contents":[{"annotation":[{"end":[6,17],"name":"tests/purus/passing/TransitiveImport/Test.purs","start":[6,11]},[]],"contents":[{"annotation":[{"end":[6,15],"name":"tests/purus/passing/TransitiveImport/Test.purs","start":[6,13]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[5,25],"name":"tests/purus/passing/TransitiveImport/Test.purs","start":[5,21]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[5,25],"name":"tests/purus/passing/TransitiveImport/Test.purs","start":[5,21]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"tag":"REmpty"},{"annotation":[{"end":[6,15],"name":"tests/purus/passing/TransitiveImport/Test.purs","start":[6,13]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"KindApp"}],"tag":"RCons"}],"tag":"TypeApp"},"value":{"identifier":"v","sourcePos":[6,3]}},"fieldName":"test","kind":"Accessor","type":{"annotation":[{"end":[6,17],"name":"tests/purus/passing/TransitiveImport/Test.purs","start":[6,11]},[]],"contents":[{"annotation":[{"end":[6,17],"name":"tests/purus/passing/TransitiveImport/Test.purs","start":[6,11]},[]],"contents":[{"annotation":[{"end":[6,15],"name":"tests/purus/passing/TransitiveImport/Test.purs","start":[6,13]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[6,12],"name":"tests/purus/passing/TransitiveImport/Test.purs","start":[6,11]},[]],"contents":{"kind":{"annotation":[{"end":[5,25],"name":"tests/purus/passing/TransitiveImport/Test.purs","start":[5,21]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[6,17],"name":"tests/purus/passing/TransitiveImport/Test.purs","start":[6,16]},[]],"contents":{"kind":{"annotation":[{"end":[5,25],"name":"tests/purus/passing/TransitiveImport/Test.purs","start":[5,21]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[6,17],"start":[6,3]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Test"],"TestCls$Dict"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[5,25],"name":"tests/purus/passing/TransitiveImport/Test.purs","start":[5,21]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},"value":{"identifier":"dict","sourcePos":[0,0]}}],"kind":"Case","type":{"annotation":[{"end":[6,17],"name":"tests/purus/passing/TransitiveImport/Test.purs","start":[6,11]},[]],"contents":[{"annotation":[{"end":[6,17],"name":"tests/purus/passing/TransitiveImport/Test.purs","start":[6,11]},[]],"contents":[{"annotation":[{"end":[6,15],"name":"tests/purus/passing/TransitiveImport/Test.purs","start":[6,13]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[6,12],"name":"tests/purus/passing/TransitiveImport/Test.purs","start":[6,11]},[]],"contents":{"kind":{"annotation":[{"end":[5,25],"name":"tests/purus/passing/TransitiveImport/Test.purs","start":[5,21]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[6,17],"name":"tests/purus/passing/TransitiveImport/Test.purs","start":[6,16]},[]],"contents":{"kind":{"annotation":[{"end":[5,25],"name":"tests/purus/passing/TransitiveImport/Test.purs","start":[5,21]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[5,25],"name":"tests/purus/passing/TransitiveImport/Test.purs","start":[5,21]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":1,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Test"],"TestCls$Dict"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[5,25],"name":"tests/purus/passing/TransitiveImport/Test.purs","start":[5,21]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[6,17],"name":"tests/purus/passing/TransitiveImport/Test.purs","start":[6,11]},[]],"contents":[{"annotation":[{"end":[6,17],"name":"tests/purus/passing/TransitiveImport/Test.purs","start":[6,11]},[]],"contents":[{"annotation":[{"end":[6,15],"name":"tests/purus/passing/TransitiveImport/Test.purs","start":[6,13]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[6,12],"name":"tests/purus/passing/TransitiveImport/Test.purs","start":[6,11]},[]],"contents":{"kind":{"annotation":[{"end":[5,25],"name":"tests/purus/passing/TransitiveImport/Test.purs","start":[5,21]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[6,17],"name":"tests/purus/passing/TransitiveImport/Test.purs","start":[6,16]},[]],"contents":{"kind":{"annotation":[{"end":[5,25],"name":"tests/purus/passing/TransitiveImport/Test.purs","start":[5,21]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarVisible"},"tag":"ForAll"}},"identifier":"test"}],"exports":["test","Uneet","testClsUneet"],"foreign":[],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[9,17],"start":[1,1]}},"moduleName":["Builtin"]},{"annotation":{"meta":null,"sourceSpan":{"end":[9,17],"start":[1,1]}},"moduleName":["Prim"]},{"annotation":{"meta":null,"sourceSpan":{"end":[9,17],"start":[1,1]}},"moduleName":["Test"]}],"moduleName":["Test"],"modulePath":"tests/purus/passing/TransitiveImport/Test.purs","reExports":{},"sourceSpan":{"end":[9,17],"start":[1,1]}} \ No newline at end of file diff --git a/tests/purus/passing/TransitiveImport/output/Test/Test.cfn.pretty b/tests/purus/passing/TransitiveImport/output/Test/Test.cfn.pretty new file mode 100644 index 000000000..848ebf070 --- /dev/null +++ b/tests/purus/passing/TransitiveImport/output/Test/Test.cfn.pretty @@ -0,0 +1,49 @@ +Test (tests/purus/passing/TransitiveImport/Test.purs) + +Imported Modules: +------------------------------ + Builtin, + Prim, + Test + +Exports: +------------------------------ + test, + Uneet, + testClsUneet + +Re-Exports: +------------------------------ + + +Foreign: +------------------------------ + + +Datatypes: +------------------------------ +newtype TestCls$Dict (a :: Prim.Type) = + TestCls$Dict ({ test :: ((a :: Prim.Type) -> ((a :: Prim.Type))) }) + +data Uneet = + Uneet + + +Declarations: +------------------------------ +testClsUneet :: (Test.TestCls$Dict (Test.Uneet)) +testClsUneet = + (TestCls$Dict: ({ test :: (Test.Uneet -> (Test.Uneet)) } -> + ((Test.TestCls$Dict (Test.Uneet))))) + ({ test: \(v: Test.Uneet) -> (Uneet: Test.Uneet) }: { + test :: (Test.Uneet -> + (Test.Uneet)) + }) + +test :: forall (@a :: Prim.Type). ((Test.TestCls$Dict ((a :: Prim.Type))) -> (((a :: Prim.Type) -> ((a :: Prim.Type))))) +test = + \(dict: (Test.TestCls$Dict ((a :: Prim.Type)))) -> + case (dict: (Test.TestCls$Dict ((a :: Prim.Type)))) of + TestCls$Dict v -> + (v: { test :: ((a :: Prim.Type) -> ((a :: Prim.Type))) }) + .test \ No newline at end of file diff --git a/tests/purus/passing/TransitiveImport/output/Test/externs.cbor b/tests/purus/passing/TransitiveImport/output/Test/externs.cbor new file mode 100644 index 000000000..805df5cf6 Binary files /dev/null and b/tests/purus/passing/TransitiveImport/output/Test/externs.cbor differ diff --git a/tests/purus/passing/TransitiveImport/output/package.json b/tests/purus/passing/TransitiveImport/output/package.json new file mode 100644 index 000000000..7c34deb58 --- /dev/null +++ b/tests/purus/passing/TransitiveImport/output/package.json @@ -0,0 +1 @@ +{"type":"module"} \ No newline at end of file diff --git a/tests/purus/passing/prelude/Prelude.purs b/tests/purus/passing/prelude/Prelude.purs new file mode 100644 index 000000000..621e0e09c --- /dev/null +++ b/tests/purus/passing/prelude/Prelude.purs @@ -0,0 +1,694 @@ +module Prelude where + +serializeScriptContext :: ScriptContext -> Builtin.BuiltinData +serializeScriptContext (ScriptContext rec) = + Builtin.constrData 0 (Builtin.mkCons (serializeTxInfo rec.txInfo) + (Builtin.mkCons (serializeScriptPurpose rec.purpose) + (Builtin.mkNilData unit))) + +deserializeScriptContext :: Builtin.BuiltinData -> ScriptContext +deserializeScriptContext dat = + let dat' = Builtin.sndPair (Builtin.unConstrData dat) + unlisted = Builtin.unListData dat' + txInfo = deserializeTxInfo (Builtin.headList unlisted) + unlisted' = Builtin.tailList unlisted + purpose = deserializeScriptPurpose (Builtin.headList unlisted') + in ScriptContext { txInfo: txInfo, purpose: purpose } + +serializeScriptPurpose :: ScriptPurpose -> Builtin.BuiltinData +serializeScriptPurpose sp = case sp of + Minting cs -> + Builtin.constrData 0 (Builtin.mkCons (serializeCurrencySymbol cs) (Builtin.mkNilData unit)) + Spending tor -> + Builtin.constrData 1 (Builtin.mkCons (serializeTxOutRef tor) (Builtin.mkNilData unit)) + Rewarding sc -> + Builtin.constrData 2 (Builtin.mkCons (serializeStakingCredential sc) (Builtin.mkNilData unit)) + Certifying d -> + Builtin.constrData 3 (Builtin.mkCons (serializeDCert d) (Builtin.mkNilData unit)) + +deserializeScriptPurpose :: Builtin.BuiltinData -> ScriptPurpose +deserializeScriptPurpose dat = + let p = Builtin.unConstrData dat + tag = Builtin.fstPair p + x = Builtin.headList (Builtin.unListData (Builtin.sndPair p)) + in if Builtin.equalsInteger 0 tag + then Minting (deserializeCurrencySymbol x) + else if Builtin.equalsInteger 1 tag + then Spending (deserializeTxOutRef x) + else if Builtin.equalsInteger 2 tag + then Rewarding (deserializeStakingCredential x) + else Certifying (deserializeDCert x) + +serializeDCert :: DCert -> Builtin.BuiltinData +serializeDCert d = case d of + DCertDelegRegKey sc -> + Builtin.constrData 0 + (Builtin.mkCons (serializeStakingCredential sc) + (Builtin.mkNilData unit)) + DCertDelegDeRegKey sc -> + Builtin.constrData 1 + (Builtin.mkCons (serializeStakingCredential sc) + (Builtin.mkNilData unit)) + DCertDelegDelegate sc pkh -> + Builtin.constrData 2 + (Builtin.mkCons (serializeStakingCredential sc) + (Builtin.mkCons (serializePubKeyHash pkh) + (Builtin.mkNilData unit))) + DCertPoolRegister pkh1 pkh2 -> + Builtin.constrData 3 + (Builtin.mkCons (serializePubKeyHash pkh1) + (Builtin.mkCons (serializePubKeyHash pkh2) + (Builtin.mkNilData unit))) + DCertPoolRetire pkh i -> + Builtin.constrData 4 + (Builtin.mkCons (serializePubKeyHash pkh) + (Builtin.mkCons (serializeInt i) + (Builtin.mkNilData unit))) + DCertGenesis -> + Builtin.constrData 5 (Builtin.mkNilData unit) + DCertMir -> + Builtin.constrData 6 (Builtin.mkNilData unit) + +deserializeDCert :: Builtin.BuiltinData -> DCert +deserializeDCert dat = + let p = Builtin.unConstrData dat + tag = Builtin.fstPair p + unlisted = Builtin.unListData (Builtin.sndPair p) + in if Builtin.equalsInteger tag 0 + then DCertDelegRegKey (deserializeStakingCredential (Builtin.headList unlisted)) + else if Builtin.equalsInteger tag 1 + then DCertDelegDeRegKey (deserializeStakingCredential (Builtin.headList unlisted)) + else if Builtin.equalsInteger tag 2 + then let sc = deserializeStakingCredential (Builtin.headList unlisted) + unlisted' = Builtin.tailList unlisted + pkh = deserializePubKeyHash (Builtin.headList unlisted') + in DCertDelegDelegate sc pkh + else if Builtin.equalsInteger tag 3 + then let pkh1 = deserializePubKeyHash (Builtin.headList unlisted) + unlisted' = Builtin.tailList unlisted + pkh2 = deserializePubKeyHash (Builtin.headList unlisted') + in DCertPoolRegister pkh1 pkh2 + else if Builtin.equalsInteger tag 4 + then let pkh = deserializePubKeyHash (Builtin.headList unlisted) + unlisted' = Builtin.tailList unlisted + i = deserializeInt (Builtin.headList unlisted') + in DCertPoolRetire pkh i + else if Builtin.equalsInteger tag 5 + then DCertGenesis + else DCertMir + +serializeStakingCredential :: StakingCredential -> Builtin.BuiltinData +serializeStakingCredential sc = case sc of + StakingHash c -> + Builtin.constrData 0 (Builtin.mkCons (serializeCredential c) (Builtin.mkNilData unit)) + StakingPtr i1 i2 i3 -> + Builtin.constrData 1 (Builtin.mkCons (serializeInt i1) + (Builtin.mkCons (serializeInt i2) + (Builtin.mkCons (serializeInt i3) + (Builtin.mkNilData unit)))) + +deserializeStakingCredential :: Builtin.BuiltinData -> StakingCredential +deserializeStakingCredential dat = + let p = Builtin.unConstrData dat + tag = Builtin.fstPair p + unlisted = Builtin.unListData (Builtin.sndPair p) + in if Builtin.equalsInteger tag 0 + then StakingHash (deserializeCredential (Builtin.headList unlisted)) + else let i1 = deserializeInt (Builtin.headList unlisted) + unlisted' = Builtin.tailList unlisted + i2 = deserializeInt (Builtin.headList unlisted') + unlisted'' = Builtin.tailList (unlisted') + i3 = deserializeInt (Builtin.headList unlisted'') + in StakingPtr i1 i2 i3 + +serializeCredential :: Credential -> Builtin.BuiltinData +serializeCredential c = case c of + PubKeyCredential pkh -> Builtin.constrData 0 (Builtin.mkCons (serializePubKeyHash pkh) (Builtin.mkNilData unit)) + ScriptCredential sh -> Builtin.constrData 1 (Builtin.mkCons (serializeScriptHash sh) (Builtin.mkNilData unit)) + +deserializeCredential :: Builtin.BuiltinData -> Credential +deserializeCredential dat = + let p = Builtin.unConstrData dat + tag = Builtin.fstPair p + unlisted = Builtin.unListData (Builtin.sndPair p) + in if Builtin.equalsInteger tag 0 + then PubKeyCredential (deserializePubKeyHash (Builtin.headList unlisted)) + else ScriptCredential (deserializeScriptHash (Builtin.headList unlisted)) + +serializeValue :: Value -> Builtin.BuiltinData +serializeValue (Value v) = + serializeAssocMap serializeCurrencySymbol (serializeAssocMap serializeTokenName serializeInt) v + +deserializeValue :: Builtin.BuiltinData -> Value +deserializeValue dat = + Value (deserializeAssocMap deserializeCurrencySymbol (deserializeAssocMap + deserializeTokenName deserializeInt) dat) + +serializeCurrencySymbol :: CurrencySymbol -> Builtin.BuiltinData +serializeCurrencySymbol (CurrencySymbol bs) = serializeByteString bs + +deserializeCurrencySymbol :: Builtin.BuiltinData -> CurrencySymbol +deserializeCurrencySymbol dat = CurrencySymbol (deserializeByteString dat) + +serializeTokenName :: TokenName -> Builtin.BuiltinData +serializeTokenName (TokenName bs) = serializeByteString bs + +deserializeTokenName :: Builtin.BuiltinData -> TokenName +deserializeTokenName dat = TokenName (deserializeByteString dat) + +serializeLovelace :: Lovelace -> Builtin.BuiltinData +serializeLovelace (Lovelace i) = serializeInt i + +deserializeLovelace :: Builtin.BuiltinData -> Lovelace +deserializeLovelace dat = Lovelace (deserializeInt dat) + +serializePOSIXTime :: POSIXTime -> Builtin.BuiltinData +serializePOSIXTime (POSIXTime t) = serializeInt t + +deserializePOSIXTime :: Builtin.BuiltinData -> POSIXTime +deserializePOSIXTime dat = POSIXTime (deserializeInt dat) + +serializeAddress :: Address -> Builtin.BuiltinData +serializeAddress (Address rec) = + Builtin.constrData 0 (Builtin.mkCons (serializeCredential rec.credential) + (Builtin.mkCons (serializeMaybe serializeStakingCredential rec.stakingCredential) + (Builtin.mkNilData unit))) + +deserializeAddress :: Builtin.BuiltinData -> Address +deserializeAddress dat = + let dat' = Builtin.sndPair (Builtin.unConstrData dat) + unlisted = Builtin.unListData dat' + credential = deserializeCredential (Builtin.headList unlisted) + unlisted' = Builtin.tailList unlisted + stakingCredential = deserializeMaybe deserializeStakingCredential (Builtin.headList unlisted') + in Address { credential: credential, stakingCredential: stakingCredential } + +serializePubKeyHash :: PubKeyHash -> Builtin.BuiltinData +serializePubKeyHash (PubKeyHash bs) = + serializeByteString bs + +deserializePubKeyHash :: Builtin.BuiltinData -> PubKeyHash +deserializePubKeyHash dat = + PubKeyHash (deserializeByteString dat) + +serializeTxId :: TxId -> Builtin.BuiltinData +serializeTxId (TxId bs) = + Builtin.constrData 0 (Builtin.mkCons (serializeByteString bs) (Builtin.mkNilData unit)) + +deserializeTxId :: Builtin.BuiltinData -> TxId +deserializeTxId dat = + let dat' = Builtin.sndPair (Builtin.unConstrData dat) + unlisted = Builtin.unListData dat' + in TxId (deserializeByteString (Builtin.headList unlisted)) + +serializeTxInfo :: TxInfo -> Builtin.BuiltinData +serializeTxInfo (TxInfo rec) = + Builtin.constrData 0 (Builtin.mkCons (serializeList serializeTxInInfo rec.inputs) + (Builtin.mkCons (serializeList serializeTxInInfo rec.referenceInputs) + (Builtin.mkCons (serializeList serializeTxOut rec.outputs) + (Builtin.mkCons (serializeValue rec.fee) + (Builtin.mkCons (serializeValue rec.mint) + (Builtin.mkCons (serializeList serializeDCert rec.dCert) + (Builtin.mkCons (serializeAssocMap serializeStakingCredential serializeInt rec.wdrl) + (Builtin.mkCons (serializeInterval serializePOSIXTime rec.validRange) + (Builtin.mkCons (serializeList serializePubKeyHash rec.signatories) + (Builtin.mkCons (serializeAssocMap serializeScriptPurpose serializeRedeemer rec.redeemers) + (Builtin.mkCons (serializeAssocMap serializeDatumHash serializeDatum rec.data) + (Builtin.mkCons (serializeTxId rec.id) + (Builtin.mkNilData unit))))))))))))) + +deserializeTxInfo :: Builtin.BuiltinData -> TxInfo +deserializeTxInfo dat = + let unlisted = Builtin.unListData (Builtin.sndPair (Builtin.unConstrData dat)) + inputs = deserializeList deserializeTxInInfo (Builtin.headList unlisted) + unlisted1 = Builtin.tailList unlisted + referenceInputs = deserializeList deserializeTxInInfo (Builtin.headList unlisted1) + unlisted2 = Builtin.tailList unlisted1 + outputs = deserializeList deserializeTxOut (Builtin.headList unlisted2) + unlisted3 = Builtin.tailList unlisted2 + fee = deserializeValue (Builtin.headList unlisted3) + unlisted4 = Builtin.tailList unlisted3 + mint = deserializeValue (Builtin.headList unlisted4) + unlisted5 = Builtin.tailList unlisted4 + dCert = deserializeList deserializeDCert (Builtin.headList unlisted5) + unlisted6 = Builtin.tailList unlisted5 + wdrl = deserializeAssocMap deserializeStakingCredential deserializeInt (Builtin.headList unlisted6) + unlisted7 = Builtin.tailList unlisted6 + validTimeRange = deserializeInterval deserializePOSIXTime (Builtin.headList unlisted7) + unlisted8 = Builtin.tailList unlisted7 + signatories = deserializeList deserializePubKeyHash (Builtin.headList unlisted8) + unlisted9 = Builtin.tailList unlisted8 + redeemers = deserializeAssocMap deserializeScriptPurpose deserializeRedeemer (Builtin.headList unlisted9) + unlisted10 = Builtin.tailList unlisted9 + data1 = deserializeAssocMap deserializeDatumHash deserializeDatum (Builtin.headList unlisted10) + unlisted11 = Builtin.tailList unlisted10 + id1 = deserializeTxId (Builtin.headList unlisted11) + in TxInfo { inputs: inputs, + referenceInputs: referenceInputs, + outputs: outputs, + fee: fee, + mint: mint, + dCert: dCert, + wdrl: wdrl, + validRange: validTimeRange, + signatories: signatories, + redeemers: redeemers, + data: data1, + id: id1 + } + +serializeTxOut :: TxOut -> Builtin.BuiltinData +serializeTxOut (TxOut rec) = + Builtin.constrData 0 (Builtin.mkCons (serializeAddress rec.address) + (Builtin.mkCons (serializeValue rec.value) + (Builtin.mkCons (serializeOutputDatum rec.datum) + (Builtin.mkCons (serializeMaybe serializeScriptHash rec.referenceScript) + (Builtin.mkNilData unit))))) + +deserializeTxOut :: Builtin.BuiltinData -> TxOut +deserializeTxOut dat = + let unlisted = Builtin.unListData (Builtin.sndPair (Builtin.unConstrData dat)) + address = deserializeAddress (Builtin.headList unlisted) + unlisted1 = Builtin.tailList unlisted + value = deserializeValue (Builtin.headList unlisted1) + unlisted2 = Builtin.tailList unlisted1 + outputDatum = deserializeOutputDatum (Builtin.headList unlisted2) + unlisted3 = Builtin.tailList unlisted2 + referenceScript = deserializeMaybe deserializeScriptHash (Builtin.headList unlisted3) + in TxOut { address: address, + value: value, + datum: outputDatum, + referenceScript: referenceScript + } + +serializeTxOutRef :: TxOutRef -> Builtin.BuiltinData +serializeTxOutRef (TxOutRef rec) = + Builtin.constrData 0 (Builtin.mkCons (serializeTxId rec.id) + (Builtin.mkCons (serializeInt rec.idx) + (Builtin.mkNilData unit))) + +deserializeTxOutRef :: Builtin.BuiltinData -> TxOutRef +deserializeTxOutRef dat = + let unlisted = Builtin.unListData (Builtin.sndPair (Builtin.unConstrData dat)) + id1 = deserializeTxId (Builtin.headList unlisted) + unlisted' = Builtin.tailList unlisted + idx = deserializeInt (Builtin.headList unlisted') + in TxOutRef { id: id1, idx: idx } + +serializeTxInInfo :: TxInInfo -> Builtin.BuiltinData +serializeTxInInfo (TxInInfo rec) = + Builtin.constrData 0 (Builtin.mkCons (serializeTxOutRef rec.txOutRef) + (Builtin.mkCons (serializeTxOut rec.resolved) + (Builtin.mkNilData unit))) + +deserializeTxInInfo :: Builtin.BuiltinData -> TxInInfo +deserializeTxInInfo dat = + let unlisted = Builtin.unListData (Builtin.sndPair (Builtin.unConstrData dat)) + outRef = deserializeTxOutRef (Builtin.headList unlisted) + unlisted' = Builtin.tailList unlisted + resolved = deserializeTxOut (Builtin.headList unlisted') + in TxInInfo { txOutRef: outRef, resolved: resolved } + +serializeOutputDatum :: OutputDatum -> Builtin.BuiltinData +serializeOutputDatum od = case od of + NoOutputDatum -> Builtin.constrData 0 (Builtin.mkNilData unit) + OutputDatumHash h -> Builtin.constrData 1 (Builtin.mkCons (serializeDatumHash h) (Builtin.mkNilData unit)) + OutputDatum d -> Builtin.constrData 2 (Builtin.mkCons (serializeDatum d) (Builtin.mkNilData unit)) + +deserializeOutputDatum :: Builtin.BuiltinData -> OutputDatum +deserializeOutputDatum dat = + let p = Builtin.unConstrData dat + tag = Builtin.fstPair p + in if Builtin.equalsInteger tag 0 + then NoOutputDatum + else let unlisted = Builtin.unListData (Builtin.sndPair p) + x = Builtin.headList unlisted + in if Builtin.equalsInteger tag 1 + then OutputDatumHash (deserializeDatumHash x) + else OutputDatum (deserializeDatum x) + +serializeInterval :: + forall (a :: Type) . (a -> Builtin.BuiltinData) -> Interval a -> Builtin.BuiltinData +serializeInterval f (Interval rec) = + Builtin.constrData 0 (Builtin.mkCons (serializeLowerBound f rec.from) + (Builtin.mkCons (serializeUpperBound f rec.to) + (Builtin.mkNilData unit))) + +deserializeInterval :: + forall (a :: Type) . (Builtin.BuiltinData -> a) -> Builtin.BuiltinData -> Interval a +deserializeInterval f dat = + let dat' = Builtin.sndPair (Builtin.unConstrData dat) + unlisted = Builtin.unListData dat' + from = deserializeLowerBound f (Builtin.headList unlisted) + unlisted' = Builtin.tailList unlisted + to = deserializeUpperBound f (Builtin.headList unlisted') + in Interval {from: from, to: to} + +serializeExtended :: + forall (a :: Type) . (a -> Builtin.BuiltinData) -> Extended a -> Builtin.BuiltinData +serializeExtended f e = case e of + NegInf -> Builtin.constrData 0 (Builtin.mkNilData unit) + Finite x -> Builtin.constrData 1 (Builtin.mkCons (f x) (Builtin.mkNilData unit)) + PosInf -> Builtin.constrData 2 (Builtin.mkNilData unit) + +deserializeExtended :: + forall (a :: Type) . (Builtin.BuiltinData -> a) -> Builtin.BuiltinData -> Extended a +deserializeExtended f dat = + let p = Builtin.unConstrData dat + tag = Builtin.fstPair p + in if Builtin.equalsInteger tag 0 + then NegInf + else if Builtin.equalsInteger tag 1 + then let unlisted = Builtin.unListData (Builtin.sndPair p) + in Finite (f (Builtin.headList unlisted)) + else PosInf + +serializeLowerBound :: + forall (a :: Type) . (a -> Builtin.BuiltinData) -> LowerBound a -> Builtin.BuiltinData +serializeLowerBound f (LowerBound e) = + Builtin.constrData 0 (Builtin.mkCons (serializeExtended f e) (Builtin.mkNilData unit)) + +deserializeLowerBound :: + forall (a :: Type) . (Builtin.BuiltinData -> a) -> Builtin.BuiltinData -> LowerBound a +deserializeLowerBound f dat = + let dat' = Builtin.sndPair (Builtin.unConstrData dat) + unlisted = Builtin.unListData dat' + e = deserializeExtended f (Builtin.headList unlisted) + in LowerBound e + +serializeUpperBound :: + forall (a :: Type) . (a -> Builtin.BuiltinData) -> UpperBound a -> Builtin.BuiltinData +serializeUpperBound f (UpperBound e) = + Builtin.constrData 0 (Builtin.mkCons (serializeExtended f e) (Builtin.mkNilData unit)) + +deserializeUpperBound :: + forall (a :: Type) . (Builtin.BuiltinData -> a) -> Builtin.BuiltinData -> UpperBound a +deserializeUpperBound f dat = + let dat' = Builtin.sndPair (Builtin.unConstrData dat) + unlisted = Builtin.unListData dat' + e = deserializeExtended f (Builtin.headList unlisted) + in UpperBound e + +serializeAssocMap :: + forall (k :: Type) (v :: Type) . + (k -> Builtin.BuiltinData) -> + (v -> Builtin.BuiltinData) -> + AssocMap k v -> + Builtin.BuiltinData +serializeAssocMap fK fV (AssocMap ell) = Builtin.mapData (go ell) + where + go :: + List (Tuple2 k v) -> + Builtin.BuiltinList (Builtin.BuiltinPair Builtin.BuiltinData Builtin.BuiltinData) + go = case _ of + Cons p xs -> + let Tuple2 x y = p + in Builtin.mkCons (Builtin.mkPairData (fK x) (fV y)) (go xs) + Nil -> Builtin.mkNilPairData unit + +deserializeAssocMap :: + forall (k :: Type) (v :: Type) . + (Builtin.BuiltinData -> k) -> + (Builtin.BuiltinData -> v) -> + Builtin.BuiltinData -> + AssocMap k v +deserializeAssocMap fK fV dat = AssocMap (go (Builtin.unMapData dat)) + where + go :: + Builtin.BuiltinList (Builtin.BuiltinPair Builtin.BuiltinData Builtin.BuiltinData) -> + List (Tuple2 k v) + go ell = if Builtin.nullList ell + then Nil + else let p = Builtin.headList ell + t = Builtin.tailList ell + x = Builtin.fstPair p + y = Builtin.sndPair p + in Cons (Tuple2 (fK x) (fV y)) (go t) + +serializeScriptHash :: ScriptHash -> Builtin.BuiltinData +serializeScriptHash (ScriptHash dat) = serializeByteString dat + +deserializeScriptHash :: Builtin.BuiltinData -> ScriptHash +deserializeScriptHash dat = ScriptHash (deserializeByteString dat) + +serializeRedeemer :: Redeemer -> Builtin.BuiltinData +serializeRedeemer (Redeemer dat) = dat + +deserializeRedeemer :: Builtin.BuiltinData -> Redeemer +deserializeRedeemer = Redeemer + +serializeRedeemerHash :: RedeemerHash -> Builtin.BuiltinData +serializeRedeemerHash (RedeemerHash bs) = serializeByteString bs + +deserializeRedeemerHash :: Builtin.BuiltinData -> RedeemerHash +deserializeRedeemerHash dat = RedeemerHash (deserializeByteString dat) + +serializeDatum :: Datum -> Builtin.BuiltinData +serializeDatum (Datum dat) = dat + +deserializeDatum :: Builtin.BuiltinData -> Datum +deserializeDatum = Datum + +serializeDatumHash :: DatumHash -> Builtin.BuiltinData +serializeDatumHash (DatumHash bs) = serializeByteString bs + +deserializeDatumHash :: Builtin.BuiltinData -> DatumHash +deserializeDatumHash dat = DatumHash (deserializeByteString dat) + +serializeInt :: Int -> Builtin.BuiltinData +serializeInt = Builtin.iData + +deserializeInt :: Builtin.BuiltinData -> Int +deserializeInt = Builtin.unIData + +serializeByteString :: Builtin.BuiltinByteString -> Builtin.BuiltinData +serializeByteString = Builtin.bData + +deserializeByteString :: Builtin.BuiltinData -> Builtin.BuiltinByteString +deserializeByteString = Builtin.unBData + +serializeList :: + forall (a :: Type) . (a -> Builtin.BuiltinData) -> List a -> Builtin.BuiltinData +serializeList f arr = Builtin.listData (go arr) + where + go :: List a -> Builtin.BuiltinList Builtin.BuiltinData + go = case _ of + Nil -> Builtin.mkNilData unit + Cons x xs -> Builtin.mkCons (f x) (go xs) + +deserializeList :: + forall (a :: Type) . (Builtin.BuiltinData -> a) -> Builtin.BuiltinData -> List a +deserializeList f dat = + let unlisted = Builtin.unListData dat + in go unlisted + where + go :: Builtin.BuiltinList Builtin.BuiltinData -> List a + go ell = if Builtin.nullList ell + then Nil + else let h = Builtin.headList ell + t = Builtin.tailList ell + in Cons (f h) (go t) + +serializeTuple2 :: + forall (a :: Type) (b :: Type) . + (a -> Builtin.BuiltinData) -> + (b -> Builtin.BuiltinData) -> + Tuple2 a b -> + Builtin.BuiltinData +serializeTuple2 fA fB (Tuple2 x y) = + Builtin.constrData 0 (Builtin.mkCons (fA x) (Builtin.mkCons (fB y) (Builtin.mkNilData unit))) + +deserializeTuple2 :: + forall (a :: Type) (b :: Type) . + (Builtin.BuiltinData -> a) -> + (Builtin.BuiltinData -> b) -> + Builtin.BuiltinData -> + Tuple2 a b +deserializeTuple2 fA fB dat = + let dat' = Builtin.sndPair (Builtin.unConstrData dat) + unlisted = Builtin.unListData dat' + x = fA (Builtin.headList unlisted) + unlisted' = Builtin.tailList unlisted + y = fB (Builtin.headList unlisted') + in Tuple2 x y + +serializeMaybe :: + forall (a :: Type) . + (a -> Builtin.BuiltinData) -> + Maybe a -> + Builtin.BuiltinData +serializeMaybe f m = case m of + Nothing -> Builtin.constrData 0 (Builtin.mkNilData unit) + Just x -> Builtin.constrData 1 (Builtin.mkCons (f x) (Builtin.mkNilData unit)) + +deserializeMaybe :: + forall (a :: Type) . + (Builtin.BuiltinData -> a) -> + Builtin.BuiltinData -> + Maybe a +deserializeMaybe f dat = + let p = Builtin.unConstrData dat + tag = Builtin.fstPair p + in if Builtin.equalsInteger tag 0 + then Nothing + else let unlisted = Builtin.unListData (Builtin.sndPair p) + in Just (f (Builtin.headList unlisted)) + +maybe :: + forall (a :: Type) (b :: Type) . + b -> + (a -> b) -> + Maybe a -> + b +maybe whenNothing whenJust m = case m of + Nothing -> whenNothing + Just x -> whenJust x + +fromMaybe :: + forall (a :: Type) . + a -> + Maybe a -> + a +fromMaybe whenNothing m = case m of + Nothing -> whenNothing + Just x -> x + +identity :: forall (a :: Type) . a -> a +identity x = x + +const :: forall (a :: Type) (b :: Type) . a -> b -> b +const _ x = x + +and :: Boolean -> Boolean -> Boolean +and x y = Builtin.ifThenElse x y False + +or :: Boolean -> Boolean -> Boolean +or x y = Builtin.ifThenElse x True y + +not :: Boolean -> Boolean +not x = Builtin.ifThenElse x False True + +xor :: Boolean -> Boolean -> Boolean +xor x y = Builtin.ifThenElse x (not y) y + +mapList :: + forall (a :: Type) (b :: Type) . + (a -> b) -> + List a -> + List b +mapList f ell = case ell of + Nil -> Nil + Cons x xs -> Cons (f x) (mapList f xs) + +filterList :: + forall (a :: Type) . + (a -> Boolean) -> + List a -> + List a +filterList f ell = case ell of + Nil -> Nil + Cons x xs -> if f x + then Cons x (filterList f xs) + else filterList f xs + +takeList :: + forall (a :: Type) . + Int -> + List a -> + List a +takeList count ell = + if Builtin.lessThanEqualsInteger count 0 + then Nil + else case ell of + Nil -> Nil + Cons x xs -> Cons x (takeList (Builtin.subtractInteger count 1) xs) + +dropList :: + forall (a :: Type) . + Int -> + List a -> + List a +dropList count ell = + if Builtin.lessThanEqualsInteger count 0 + then ell + else case ell of + Nil -> Nil + Cons _ xs -> dropList (Builtin.subtractInteger count 1) xs + +zipWithList :: + forall (a :: Type) (b :: Type) (c :: Type) . + (a -> b -> c) -> + List a -> + List b -> + List c +zipWithList f ell1 ell2 = case ell1 of + Nil -> Nil + Cons x xs -> case ell2 of + Nil -> Nil + Cons y ys -> Cons (f x y) (zipWithList f xs ys) + +appendList :: + forall (a :: Type) . + List a -> + List a -> + List a +appendList ell1 ell2 = case ell1 of + Nil -> ell2 + Cons x xs -> Cons x (appendList xs ell2) + +lengthList :: + forall (a :: Type) . + List a -> + Int +lengthList ell = case ell of + Nil -> 0 + Cons _ xs -> Builtin.addInteger 1 (lengthList xs) + +anyList :: + forall (a :: Type) . + (a -> Boolean) -> + List a -> + Boolean +anyList p ell = case ell of + Nil -> False + Cons x xs -> if p x + then True + else anyList p xs + +allList :: + forall (a :: Type) . + (a -> Boolean) -> + List a -> + Boolean +allList p ell = case ell of + Nil -> True + Cons x xs -> if p x + then allList p xs + else False + +sumList :: List Int -> Int +sumList ell = case ell of + Nil -> 0 + Cons x xs -> Builtin.addInteger x (sumList xs) + +productList :: List Int -> Int +productList ell = case ell of + Nil -> 1 + Cons x xs -> Builtin.multiplyInteger x (productList xs) + +apply :: + forall (a :: Type) (b :: Type) . + (a -> b) -> + a -> + b +apply f x = f x + +infixr 0 apply as $ + +flip :: + forall (a :: Type) (b :: Type) (c :: Type) . + (a -> b -> c) -> + b -> + a -> + c +flip f x y = f y x diff --git a/tests/purus/passing/prelude/output/Prelude/Prelude.cfn b/tests/purus/passing/prelude/output/Prelude/Prelude.cfn new file mode 100644 index 000000000..dfcff1452 --- /dev/null +++ b/tests/purus/passing/prelude/output/Prelude/Prelude.cfn @@ -0,0 +1 @@ +{"builtWith":"0.0.1","comments":[],"dataTypes":{"_ctorDict":[],"_tyDict":[]},"decls":[{"bindType":"Rec","binds":[{"annotation":{"meta":null,"sourceSpan":{"end":[623,9],"start":[618,1]}},"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[628,67],"start":[624,1]}},"argument":"f","body":{"annotation":{"meta":null,"sourceSpan":{"end":[628,67],"start":[624,1]}},"argument":"ell1","body":{"annotation":{"meta":null,"sourceSpan":{"end":[628,67],"start":[624,1]}},"argument":"ell2","body":{"annotation":{"meta":null,"sourceSpan":{"end":[628,67],"start":[624,27]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[625,6],"start":[625,3]}},"binderType":"ConstructorBinder","binders":[],"constructorName":{"identifier":"Nil","moduleName":["Prim"]},"typeName":{"identifier":"List","moduleName":["Prim"]}}],"expression":{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[625,13],"start":[625,10]}},"kind":"Var","type":{"annotation":[{"end":[623,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[623,3]},[]],"contents":[{"annotation":[{"end":[623,7],"name":"tests/purus/passing/prelude/Prelude.purs","start":[623,3]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[623,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[623,8]},[]],"contents":{"kind":{"annotation":[{"end":[619,44],"name":"tests/purus/passing/prelude/Prelude.purs","start":[619,40]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"c"},"tag":"TypeVar"}],"tag":"TypeApp"},"value":{"identifier":"Nil","moduleName":["Prim"]}},"isGuarded":false},{"binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[626,12],"start":[626,3]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[626,9],"start":[626,8]}},"binderType":"VarBinder","identifier":"x","type":{"annotation":[{"end":[621,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[621,8]},[]],"contents":{"kind":{"annotation":[{"end":[619,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[619,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}},{"annotation":{"meta":null,"sourceSpan":{"end":[626,12],"start":[626,10]}},"binderType":"VarBinder","identifier":"xs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[621,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[621,8]},[]],"contents":{"kind":{"annotation":[{"end":[619,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[619,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}}],"constructorName":{"identifier":"Cons","moduleName":["Prim"]},"typeName":{"identifier":"List","moduleName":["Prim"]}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[628,67],"start":[626,16]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[627,23],"start":[627,20]}},"binderType":"ConstructorBinder","binders":[],"constructorName":{"identifier":"Nil","moduleName":["Prim"]},"typeName":{"identifier":"List","moduleName":["Prim"]}}],"expression":{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[627,30],"start":[627,27]}},"kind":"Var","type":{"annotation":[{"end":[623,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[623,3]},[]],"contents":[{"annotation":[{"end":[623,7],"name":"tests/purus/passing/prelude/Prelude.purs","start":[623,3]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[623,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[623,8]},[]],"contents":{"kind":{"annotation":[{"end":[619,44],"name":"tests/purus/passing/prelude/Prelude.purs","start":[619,40]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"c"},"tag":"TypeVar"}],"tag":"TypeApp"},"value":{"identifier":"Nil","moduleName":["Prim"]}},"isGuarded":false},{"binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[628,29],"start":[628,20]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[628,26],"start":[628,25]}},"binderType":"VarBinder","identifier":"y","type":{"annotation":[{"end":[622,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[622,8]},[]],"contents":{"kind":{"annotation":[{"end":[619,32],"name":"tests/purus/passing/prelude/Prelude.purs","start":[619,28]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"b"},"tag":"TypeVar"}},{"annotation":{"meta":null,"sourceSpan":{"end":[628,29],"start":[628,27]}},"binderType":"VarBinder","identifier":"ys","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[622,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[622,8]},[]],"contents":{"kind":{"annotation":[{"end":[619,32],"name":"tests/purus/passing/prelude/Prelude.purs","start":[619,28]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"b"},"tag":"TypeVar"}],"tag":"TypeApp"}}],"constructorName":{"identifier":"Cons","moduleName":["Prim"]},"typeName":{"identifier":"List","moduleName":["Prim"]}}],"expression":{"abstraction":{"abstraction":{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[628,37],"start":[628,33]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"x","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":8,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"x"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"x"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"x"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"Cons","moduleName":["Prim"]}},"annotation":{"meta":null,"sourceSpan":{"end":[628,45],"start":[628,33]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[628,40],"start":[628,39]}},"kind":"Var","type":{"annotation":[{"end":[620,15],"name":"tests/purus/passing/prelude/Prelude.purs","start":[620,4]},[]],"contents":[{"annotation":[{"end":[620,15],"name":"tests/purus/passing/prelude/Prelude.purs","start":[620,4]},[]],"contents":[{"annotation":[{"end":[620,8],"name":"tests/purus/passing/prelude/Prelude.purs","start":[620,6]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[620,5],"name":"tests/purus/passing/prelude/Prelude.purs","start":[620,4]},[]],"contents":{"kind":{"annotation":[{"end":[619,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[619,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[620,15],"name":"tests/purus/passing/prelude/Prelude.purs","start":[620,9]},[]],"contents":[{"annotation":[{"end":[620,15],"name":"tests/purus/passing/prelude/Prelude.purs","start":[620,9]},[]],"contents":[{"annotation":[{"end":[620,13],"name":"tests/purus/passing/prelude/Prelude.purs","start":[620,11]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[620,10],"name":"tests/purus/passing/prelude/Prelude.purs","start":[620,9]},[]],"contents":{"kind":{"annotation":[{"end":[619,32],"name":"tests/purus/passing/prelude/Prelude.purs","start":[619,28]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"b"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[620,15],"name":"tests/purus/passing/prelude/Prelude.purs","start":[620,14]},[]],"contents":{"kind":{"annotation":[{"end":[619,44],"name":"tests/purus/passing/prelude/Prelude.purs","start":[619,40]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"c"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"f","sourcePos":[624,1]}},"annotation":{"meta":null,"sourceSpan":{"end":[628,42],"start":[628,39]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[628,42],"start":[628,41]}},"kind":"Var","type":{"annotation":[{"end":[621,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[621,8]},[]],"contents":{"kind":{"annotation":[{"end":[619,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[619,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"},"value":{"identifier":"x","sourcePos":[626,8]}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[628,44],"start":[628,39]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[628,44],"start":[628,43]}},"kind":"Var","type":{"annotation":[{"end":[622,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[622,8]},[]],"contents":{"kind":{"annotation":[{"end":[619,32],"name":"tests/purus/passing/prelude/Prelude.purs","start":[619,28]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"b"},"tag":"TypeVar"},"value":{"identifier":"y","sourcePos":[628,25]}},"kind":"App"},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[628,67],"start":[628,33]}},"argument":{"abstraction":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[628,58],"start":[628,47]}},"kind":"Var","type":{"annotation":[{"end":[623,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[619,3]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[619,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[619,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":2,"type":{"annotation":[{"end":[623,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[619,23]},[]],"contents":{"identifier":"b","kind":{"annotation":[{"end":[619,32],"name":"tests/purus/passing/prelude/Prelude.purs","start":[619,28]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":1,"type":{"annotation":[{"end":[623,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[619,35]},[]],"contents":{"identifier":"c","kind":{"annotation":[{"end":[619,44],"name":"tests/purus/passing/prelude/Prelude.purs","start":[619,40]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":0,"type":{"annotation":[{"end":[623,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[620,3]},[]],"contents":[{"annotation":[{"end":[623,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[620,3]},[]],"contents":[{"annotation":[{"end":[620,19],"name":"tests/purus/passing/prelude/Prelude.purs","start":[620,17]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[620,15],"name":"tests/purus/passing/prelude/Prelude.purs","start":[620,4]},[]],"contents":[{"annotation":[{"end":[620,15],"name":"tests/purus/passing/prelude/Prelude.purs","start":[620,4]},[]],"contents":[{"annotation":[{"end":[620,8],"name":"tests/purus/passing/prelude/Prelude.purs","start":[620,6]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[620,5],"name":"tests/purus/passing/prelude/Prelude.purs","start":[620,4]},[]],"contents":{"kind":{"annotation":[{"end":[619,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[619,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[620,15],"name":"tests/purus/passing/prelude/Prelude.purs","start":[620,9]},[]],"contents":[{"annotation":[{"end":[620,15],"name":"tests/purus/passing/prelude/Prelude.purs","start":[620,9]},[]],"contents":[{"annotation":[{"end":[620,13],"name":"tests/purus/passing/prelude/Prelude.purs","start":[620,11]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[620,10],"name":"tests/purus/passing/prelude/Prelude.purs","start":[620,9]},[]],"contents":{"kind":{"annotation":[{"end":[619,32],"name":"tests/purus/passing/prelude/Prelude.purs","start":[619,28]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"b"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[620,15],"name":"tests/purus/passing/prelude/Prelude.purs","start":[620,14]},[]],"contents":{"kind":{"annotation":[{"end":[619,44],"name":"tests/purus/passing/prelude/Prelude.purs","start":[619,40]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"c"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[623,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[621,3]},[]],"contents":[{"annotation":[{"end":[623,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[621,3]},[]],"contents":[{"annotation":[{"end":[621,12],"name":"tests/purus/passing/prelude/Prelude.purs","start":[621,10]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[621,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[621,3]},[]],"contents":[{"annotation":[{"end":[621,7],"name":"tests/purus/passing/prelude/Prelude.purs","start":[621,3]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[621,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[621,8]},[]],"contents":{"kind":{"annotation":[{"end":[619,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[619,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[623,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[622,3]},[]],"contents":[{"annotation":[{"end":[623,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[622,3]},[]],"contents":[{"annotation":[{"end":[622,12],"name":"tests/purus/passing/prelude/Prelude.purs","start":[622,10]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[622,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[622,3]},[]],"contents":[{"annotation":[{"end":[622,7],"name":"tests/purus/passing/prelude/Prelude.purs","start":[622,3]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[622,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[622,8]},[]],"contents":{"kind":{"annotation":[{"end":[619,32],"name":"tests/purus/passing/prelude/Prelude.purs","start":[619,28]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"b"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[623,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[623,3]},[]],"contents":[{"annotation":[{"end":[623,7],"name":"tests/purus/passing/prelude/Prelude.purs","start":[623,3]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[623,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[623,8]},[]],"contents":{"kind":{"annotation":[{"end":[619,44],"name":"tests/purus/passing/prelude/Prelude.purs","start":[619,40]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"c"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"zipWithList","moduleName":["Prelude"]}},"annotation":{"meta":null,"sourceSpan":{"end":[628,60],"start":[628,47]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[628,60],"start":[628,59]}},"kind":"Var","type":{"annotation":[{"end":[620,15],"name":"tests/purus/passing/prelude/Prelude.purs","start":[620,4]},[]],"contents":[{"annotation":[{"end":[620,15],"name":"tests/purus/passing/prelude/Prelude.purs","start":[620,4]},[]],"contents":[{"annotation":[{"end":[620,8],"name":"tests/purus/passing/prelude/Prelude.purs","start":[620,6]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[620,5],"name":"tests/purus/passing/prelude/Prelude.purs","start":[620,4]},[]],"contents":{"kind":{"annotation":[{"end":[619,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[619,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[620,15],"name":"tests/purus/passing/prelude/Prelude.purs","start":[620,9]},[]],"contents":[{"annotation":[{"end":[620,15],"name":"tests/purus/passing/prelude/Prelude.purs","start":[620,9]},[]],"contents":[{"annotation":[{"end":[620,13],"name":"tests/purus/passing/prelude/Prelude.purs","start":[620,11]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[620,10],"name":"tests/purus/passing/prelude/Prelude.purs","start":[620,9]},[]],"contents":{"kind":{"annotation":[{"end":[619,32],"name":"tests/purus/passing/prelude/Prelude.purs","start":[619,28]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"b"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[620,15],"name":"tests/purus/passing/prelude/Prelude.purs","start":[620,14]},[]],"contents":{"kind":{"annotation":[{"end":[619,44],"name":"tests/purus/passing/prelude/Prelude.purs","start":[619,40]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"c"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"f","sourcePos":[624,1]}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[628,63],"start":[628,47]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[628,63],"start":[628,61]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[621,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[621,8]},[]],"contents":{"kind":{"annotation":[{"end":[619,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[619,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},"value":{"identifier":"xs","sourcePos":[626,10]}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[628,66],"start":[628,47]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[628,66],"start":[628,64]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[622,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[622,8]},[]],"contents":{"kind":{"annotation":[{"end":[619,32],"name":"tests/purus/passing/prelude/Prelude.purs","start":[619,28]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"b"},"tag":"TypeVar"}],"tag":"TypeApp"},"value":{"identifier":"ys","sourcePos":[628,27]}},"kind":"App"},"kind":"App"},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[626,25],"start":[626,21]}},"kind":"Var","type":{"annotation":[{"end":[622,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[622,3]},[]],"contents":[{"annotation":[{"end":[622,7],"name":"tests/purus/passing/prelude/Prelude.purs","start":[622,3]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[622,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[622,8]},[]],"contents":{"kind":{"annotation":[{"end":[619,32],"name":"tests/purus/passing/prelude/Prelude.purs","start":[619,28]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"b"},"tag":"TypeVar"}],"tag":"TypeApp"},"value":{"identifier":"ell2","sourcePos":[624,1]}}],"kind":"Case","type":{"annotation":[{"end":[623,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[623,3]},[]],"contents":[{"annotation":[{"end":[623,7],"name":"tests/purus/passing/prelude/Prelude.purs","start":[623,3]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[623,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[623,8]},[]],"contents":{"kind":{"annotation":[{"end":[619,44],"name":"tests/purus/passing/prelude/Prelude.purs","start":[619,40]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"c"},"tag":"TypeVar"}],"tag":"TypeApp"}},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[624,36],"start":[624,32]}},"kind":"Var","type":{"annotation":[{"end":[621,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[621,3]},[]],"contents":[{"annotation":[{"end":[621,7],"name":"tests/purus/passing/prelude/Prelude.purs","start":[621,3]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[621,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[621,8]},[]],"contents":{"kind":{"annotation":[{"end":[619,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[619,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},"value":{"identifier":"ell1","sourcePos":[624,1]}}],"kind":"Case","type":{"annotation":[{"end":[623,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[623,3]},[]],"contents":[{"annotation":[{"end":[623,7],"name":"tests/purus/passing/prelude/Prelude.purs","start":[623,3]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[623,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[623,8]},[]],"contents":{"kind":{"annotation":[{"end":[619,44],"name":"tests/purus/passing/prelude/Prelude.purs","start":[619,40]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"c"},"tag":"TypeVar"}],"tag":"TypeApp"}},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[622,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[622,3]},[]],"contents":[{"annotation":[{"end":[622,7],"name":"tests/purus/passing/prelude/Prelude.purs","start":[622,3]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[622,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[622,8]},[]],"contents":{"kind":{"annotation":[{"end":[619,32],"name":"tests/purus/passing/prelude/Prelude.purs","start":[619,28]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"b"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[623,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[623,3]},[]],"contents":[{"annotation":[{"end":[623,7],"name":"tests/purus/passing/prelude/Prelude.purs","start":[623,3]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[623,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[623,8]},[]],"contents":{"kind":{"annotation":[{"end":[619,44],"name":"tests/purus/passing/prelude/Prelude.purs","start":[619,40]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"c"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[621,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[621,3]},[]],"contents":[{"annotation":[{"end":[621,7],"name":"tests/purus/passing/prelude/Prelude.purs","start":[621,3]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[621,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[621,8]},[]],"contents":{"kind":{"annotation":[{"end":[619,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[619,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[623,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[622,3]},[]],"contents":[{"annotation":[{"end":[623,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[622,3]},[]],"contents":[{"annotation":[{"end":[622,12],"name":"tests/purus/passing/prelude/Prelude.purs","start":[622,10]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[622,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[622,3]},[]],"contents":[{"annotation":[{"end":[622,7],"name":"tests/purus/passing/prelude/Prelude.purs","start":[622,3]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[622,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[622,8]},[]],"contents":{"kind":{"annotation":[{"end":[619,32],"name":"tests/purus/passing/prelude/Prelude.purs","start":[619,28]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"b"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[623,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[623,3]},[]],"contents":[{"annotation":[{"end":[623,7],"name":"tests/purus/passing/prelude/Prelude.purs","start":[623,3]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[623,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[623,8]},[]],"contents":{"kind":{"annotation":[{"end":[619,44],"name":"tests/purus/passing/prelude/Prelude.purs","start":[619,40]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"c"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"kind":"Abs","type":{"annotation":[{"end":[623,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[619,3]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[619,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[619,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":3,"type":{"annotation":[{"end":[623,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[619,23]},[]],"contents":{"identifier":"b","kind":{"annotation":[{"end":[619,32],"name":"tests/purus/passing/prelude/Prelude.purs","start":[619,28]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":1,"type":{"annotation":[{"end":[623,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[619,35]},[]],"contents":{"identifier":"c","kind":{"annotation":[{"end":[619,44],"name":"tests/purus/passing/prelude/Prelude.purs","start":[619,40]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":0,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[620,15],"name":"tests/purus/passing/prelude/Prelude.purs","start":[620,4]},[]],"contents":[{"annotation":[{"end":[620,15],"name":"tests/purus/passing/prelude/Prelude.purs","start":[620,4]},[]],"contents":[{"annotation":[{"end":[620,8],"name":"tests/purus/passing/prelude/Prelude.purs","start":[620,6]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[620,5],"name":"tests/purus/passing/prelude/Prelude.purs","start":[620,4]},[]],"contents":{"kind":{"annotation":[{"end":[619,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[619,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[620,15],"name":"tests/purus/passing/prelude/Prelude.purs","start":[620,9]},[]],"contents":[{"annotation":[{"end":[620,15],"name":"tests/purus/passing/prelude/Prelude.purs","start":[620,9]},[]],"contents":[{"annotation":[{"end":[620,13],"name":"tests/purus/passing/prelude/Prelude.purs","start":[620,11]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[620,10],"name":"tests/purus/passing/prelude/Prelude.purs","start":[620,9]},[]],"contents":{"kind":{"annotation":[{"end":[619,32],"name":"tests/purus/passing/prelude/Prelude.purs","start":[619,28]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"b"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[620,15],"name":"tests/purus/passing/prelude/Prelude.purs","start":[620,14]},[]],"contents":{"kind":{"annotation":[{"end":[619,44],"name":"tests/purus/passing/prelude/Prelude.purs","start":[619,40]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"c"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[623,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[621,3]},[]],"contents":[{"annotation":[{"end":[623,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[621,3]},[]],"contents":[{"annotation":[{"end":[621,12],"name":"tests/purus/passing/prelude/Prelude.purs","start":[621,10]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[621,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[621,3]},[]],"contents":[{"annotation":[{"end":[621,7],"name":"tests/purus/passing/prelude/Prelude.purs","start":[621,3]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[621,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[621,8]},[]],"contents":{"kind":{"annotation":[{"end":[619,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[619,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[623,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[622,3]},[]],"contents":[{"annotation":[{"end":[623,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[622,3]},[]],"contents":[{"annotation":[{"end":[622,12],"name":"tests/purus/passing/prelude/Prelude.purs","start":[622,10]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[622,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[622,3]},[]],"contents":[{"annotation":[{"end":[622,7],"name":"tests/purus/passing/prelude/Prelude.purs","start":[622,3]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[622,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[622,8]},[]],"contents":{"kind":{"annotation":[{"end":[619,32],"name":"tests/purus/passing/prelude/Prelude.purs","start":[619,28]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"b"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[623,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[623,3]},[]],"contents":[{"annotation":[{"end":[623,7],"name":"tests/purus/passing/prelude/Prelude.purs","start":[623,3]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[623,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[623,8]},[]],"contents":{"kind":{"annotation":[{"end":[619,44],"name":"tests/purus/passing/prelude/Prelude.purs","start":[619,40]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"c"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"identifier":"zipWithList"}]},{"bindType":"Rec","binds":[{"annotation":{"meta":null,"sourceSpan":{"end":[598,9],"start":[594,1]}},"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[604,78],"start":[599,1]}},"argument":"count","body":{"annotation":{"meta":null,"sourceSpan":{"end":[604,78],"start":[599,1]}},"argument":"ell","body":{"annotation":{"meta":null,"sourceSpan":{"end":[604,78],"start":[600,3]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"binderType":"ConstructorBinder","binders":[],"constructorName":{"identifier":"True","moduleName":["Prim"]},"typeName":{"identifier":"Boolean","moduleName":["Prim"]}}],"expression":{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[601,11],"start":[601,8]}},"kind":"Var","type":{"annotation":[{"end":[598,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[598,3]},[]],"contents":[{"annotation":[{"end":[598,7],"name":"tests/purus/passing/prelude/Prelude.purs","start":[598,3]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[598,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[598,8]},[]],"contents":{"kind":{"annotation":[{"end":[595,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[595,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},"value":{"identifier":"Nil","moduleName":["Prim"]}},"isGuarded":false},{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[604,78],"start":[600,3]}},"binderType":"NullBinder"}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[604,78],"start":[602,8]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[603,14],"start":[603,11]}},"binderType":"ConstructorBinder","binders":[],"constructorName":{"identifier":"Nil","moduleName":["Prim"]},"typeName":{"identifier":"List","moduleName":["Prim"]}}],"expression":{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[603,21],"start":[603,18]}},"kind":"Var","type":{"annotation":[{"end":[598,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[598,3]},[]],"contents":[{"annotation":[{"end":[598,7],"name":"tests/purus/passing/prelude/Prelude.purs","start":[598,3]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[598,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[598,8]},[]],"contents":{"kind":{"annotation":[{"end":[595,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[595,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},"value":{"identifier":"Nil","moduleName":["Prim"]}},"isGuarded":false},{"binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[604,20],"start":[604,11]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[604,17],"start":[604,16]}},"binderType":"VarBinder","identifier":"x","type":{"annotation":[{"end":[597,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[597,8]},[]],"contents":{"kind":{"annotation":[{"end":[595,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[595,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}},{"annotation":{"meta":null,"sourceSpan":{"end":[604,20],"start":[604,18]}},"binderType":"VarBinder","identifier":"xs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[597,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[597,8]},[]],"contents":{"kind":{"annotation":[{"end":[595,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[595,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}}],"constructorName":{"identifier":"Cons","moduleName":["Prim"]},"typeName":{"identifier":"List","moduleName":["Prim"]}}],"expression":{"abstraction":{"abstraction":{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[604,28],"start":[604,24]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"x","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":16,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"x"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"x"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"x"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"Cons","moduleName":["Prim"]}},"annotation":{"meta":null,"sourceSpan":{"end":[604,30],"start":[604,24]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[604,30],"start":[604,29]}},"kind":"Var","type":{"annotation":[{"end":[597,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[597,8]},[]],"contents":{"kind":{"annotation":[{"end":[595,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[595,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"},"value":{"identifier":"x","sourcePos":[604,16]}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[604,78],"start":[604,24]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[604,40],"start":[604,32]}},"kind":"Var","type":{"annotation":[{"end":[598,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[595,3]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[595,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[595,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":12,"type":{"annotation":[{"end":[598,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[596,3]},[]],"contents":[{"annotation":[{"end":[598,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[596,3]},[]],"contents":[{"annotation":[{"end":[596,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[596,7]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[596,6],"name":"tests/purus/passing/prelude/Prelude.purs","start":[596,3]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[598,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[597,3]},[]],"contents":[{"annotation":[{"end":[598,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[597,3]},[]],"contents":[{"annotation":[{"end":[597,12],"name":"tests/purus/passing/prelude/Prelude.purs","start":[597,10]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[597,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[597,3]},[]],"contents":[{"annotation":[{"end":[597,7],"name":"tests/purus/passing/prelude/Prelude.purs","start":[597,3]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[597,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[597,8]},[]],"contents":{"kind":{"annotation":[{"end":[595,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[595,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[598,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[598,3]},[]],"contents":[{"annotation":[{"end":[598,7],"name":"tests/purus/passing/prelude/Prelude.purs","start":[598,3]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[598,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[598,8]},[]],"contents":{"kind":{"annotation":[{"end":[595,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[595,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"takeList","moduleName":["Prelude"]}},"annotation":{"meta":null,"sourceSpan":{"end":[604,74],"start":[604,32]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[604,65],"start":[604,42]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"subtractInteger","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[604,71],"start":[604,42]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[604,71],"start":[604,66]}},"kind":"Var","type":{"annotation":[{"end":[596,6],"name":"tests/purus/passing/prelude/Prelude.purs","start":[596,3]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"identifier":"count","sourcePos":[599,1]}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[604,73],"start":[604,42]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[604,73],"start":[604,72]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"literalType":"IntLiteral","value":1}},"kind":"App"},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[604,77],"start":[604,32]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[604,77],"start":[604,75]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[597,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[597,8]},[]],"contents":{"kind":{"annotation":[{"end":[595,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[595,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},"value":{"identifier":"xs","sourcePos":[604,18]}},"kind":"App"},"kind":"App"},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[602,16],"start":[602,13]}},"kind":"Var","type":{"annotation":[{"end":[597,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[597,3]},[]],"contents":[{"annotation":[{"end":[597,7],"name":"tests/purus/passing/prelude/Prelude.purs","start":[597,3]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[597,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[597,8]},[]],"contents":{"kind":{"annotation":[{"end":[595,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[595,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},"value":{"identifier":"ell","sourcePos":[599,1]}}],"kind":"Case","type":{"annotation":[{"end":[598,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[598,3]},[]],"contents":[{"annotation":[{"end":[598,7],"name":"tests/purus/passing/prelude/Prelude.purs","start":[598,3]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[598,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[598,8]},[]],"contents":{"kind":{"annotation":[{"end":[595,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[595,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}},"isGuarded":false}],"caseExpressions":[{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[600,35],"start":[600,6]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"lessThanEqualsInteger","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[600,41],"start":[600,6]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[600,41],"start":[600,36]}},"kind":"Var","type":{"annotation":[{"end":[596,6],"name":"tests/purus/passing/prelude/Prelude.purs","start":[596,3]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"identifier":"count","sourcePos":[599,1]}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[600,43],"start":[600,6]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[600,43],"start":[600,42]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"literalType":"IntLiteral","value":0}},"kind":"App"}],"kind":"Case","type":{"annotation":[{"end":[598,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[598,3]},[]],"contents":[{"annotation":[{"end":[598,7],"name":"tests/purus/passing/prelude/Prelude.purs","start":[598,3]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[598,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[598,8]},[]],"contents":{"kind":{"annotation":[{"end":[595,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[595,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[597,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[597,3]},[]],"contents":[{"annotation":[{"end":[597,7],"name":"tests/purus/passing/prelude/Prelude.purs","start":[597,3]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[597,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[597,8]},[]],"contents":{"kind":{"annotation":[{"end":[595,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[595,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[598,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[598,3]},[]],"contents":[{"annotation":[{"end":[598,7],"name":"tests/purus/passing/prelude/Prelude.purs","start":[598,3]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[598,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[598,8]},[]],"contents":{"kind":{"annotation":[{"end":[595,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[595,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"kind":"Abs","type":{"annotation":[{"end":[598,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[595,3]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[595,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[595,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":13,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[596,6],"name":"tests/purus/passing/prelude/Prelude.purs","start":[596,3]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[598,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[597,3]},[]],"contents":[{"annotation":[{"end":[598,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[597,3]},[]],"contents":[{"annotation":[{"end":[597,12],"name":"tests/purus/passing/prelude/Prelude.purs","start":[597,10]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[597,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[597,3]},[]],"contents":[{"annotation":[{"end":[597,7],"name":"tests/purus/passing/prelude/Prelude.purs","start":[597,3]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[597,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[597,8]},[]],"contents":{"kind":{"annotation":[{"end":[595,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[595,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[598,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[598,3]},[]],"contents":[{"annotation":[{"end":[598,7],"name":"tests/purus/passing/prelude/Prelude.purs","start":[598,3]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[598,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[598,8]},[]],"contents":{"kind":{"annotation":[{"end":[595,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[595,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"identifier":"takeList"}]},{"bindType":"Rec","binds":[{"annotation":{"meta":null,"sourceSpan":{"end":[669,27],"start":[669,1]}},"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[672,49],"start":[670,1]}},"argument":"ell","body":{"annotation":{"meta":null,"sourceSpan":{"end":[672,49],"start":[670,15]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[671,6],"start":[671,3]}},"binderType":"ConstructorBinder","binders":[],"constructorName":{"identifier":"Nil","moduleName":["Prim"]},"typeName":{"identifier":"List","moduleName":["Prim"]}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[671,11],"start":[671,10]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"literalType":"IntLiteral","value":0}},"isGuarded":false},{"binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[672,12],"start":[672,3]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[672,9],"start":[672,8]}},"binderType":"VarBinder","identifier":"x","type":{"annotation":[{"end":[669,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[669,17]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}},{"annotation":{"meta":null,"sourceSpan":{"end":[672,12],"start":[672,10]}},"binderType":"VarBinder","identifier":"xs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[669,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[669,17]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"}}],"constructorName":{"identifier":"Cons","moduleName":["Prim"]},"typeName":{"identifier":"List","moduleName":["Prim"]}}],"expression":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[672,34],"start":[672,16]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"addInteger","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[672,36],"start":[672,16]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[672,36],"start":[672,35]}},"kind":"Var","type":{"annotation":[{"end":[669,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[669,17]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"identifier":"x","sourcePos":[672,8]}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[672,49],"start":[672,16]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[672,45],"start":[672,38]}},"kind":"Var","type":{"annotation":[{"end":[669,27],"name":"tests/purus/passing/prelude/Prelude.purs","start":[669,12]},[]],"contents":[{"annotation":[{"end":[669,27],"name":"tests/purus/passing/prelude/Prelude.purs","start":[669,12]},[]],"contents":[{"annotation":[{"end":[669,23],"name":"tests/purus/passing/prelude/Prelude.purs","start":[669,21]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[669,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[669,12]},[]],"contents":[{"annotation":[{"end":[669,16],"name":"tests/purus/passing/prelude/Prelude.purs","start":[669,12]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[669,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[669,17]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[669,27],"name":"tests/purus/passing/prelude/Prelude.purs","start":[669,24]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"sumList","moduleName":["Prelude"]}},"annotation":{"meta":null,"sourceSpan":{"end":[672,48],"start":[672,38]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[672,48],"start":[672,46]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[669,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[669,17]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"xs","sourcePos":[672,10]}},"kind":"App"},"kind":"App"},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[670,23],"start":[670,20]}},"kind":"Var","type":{"annotation":[{"end":[669,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[669,12]},[]],"contents":[{"annotation":[{"end":[669,16],"name":"tests/purus/passing/prelude/Prelude.purs","start":[669,12]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[669,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[669,17]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"ell","sourcePos":[670,1]}}],"kind":"Case","type":{"annotation":[{"end":[669,27],"name":"tests/purus/passing/prelude/Prelude.purs","start":[669,24]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[669,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[669,12]},[]],"contents":[{"annotation":[{"end":[669,16],"name":"tests/purus/passing/prelude/Prelude.purs","start":[669,12]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[669,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[669,17]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[669,27],"name":"tests/purus/passing/prelude/Prelude.purs","start":[669,24]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"identifier":"sumList"}]},{"annotation":{"meta":null,"sourceSpan":{"end":[497,22],"start":[492,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[498,19],"start":[498,17]}},"argument":"fA","body":{"annotation":{"meta":null,"sourceSpan":{"end":[498,22],"start":[498,20]}},"argument":"fB","body":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"argument":"v","body":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[498,19],"start":[498,17]}},"binderType":"VarBinder","identifier":"fA1","type":{"annotation":[{"end":[494,28],"name":"tests/purus/passing/prelude/Prelude.purs","start":[494,4]},[]],"contents":[{"annotation":[{"end":[494,28],"name":"tests/purus/passing/prelude/Prelude.purs","start":[494,4]},[]],"contents":[{"annotation":[{"end":[494,8],"name":"tests/purus/passing/prelude/Prelude.purs","start":[494,6]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[494,5],"name":"tests/purus/passing/prelude/Prelude.purs","start":[494,4]},[]],"contents":{"kind":{"annotation":[{"end":[493,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[493,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[494,28],"name":"tests/purus/passing/prelude/Prelude.purs","start":[494,9]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},{"annotation":{"meta":null,"sourceSpan":{"end":[498,22],"start":[498,20]}},"binderType":"VarBinder","identifier":"fB1","type":{"annotation":[{"end":[495,28],"name":"tests/purus/passing/prelude/Prelude.purs","start":[495,4]},[]],"contents":[{"annotation":[{"end":[495,28],"name":"tests/purus/passing/prelude/Prelude.purs","start":[495,4]},[]],"contents":[{"annotation":[{"end":[495,8],"name":"tests/purus/passing/prelude/Prelude.purs","start":[495,6]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[495,5],"name":"tests/purus/passing/prelude/Prelude.purs","start":[495,4]},[]],"contents":{"kind":{"annotation":[{"end":[493,32],"name":"tests/purus/passing/prelude/Prelude.purs","start":[493,28]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"b"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[495,28],"name":"tests/purus/passing/prelude/Prelude.purs","start":[495,9]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},{"annotation":{"meta":{"constructorType":"ProductType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[498,34],"start":[498,24]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[498,32],"start":[498,31]}},"binderType":"VarBinder","identifier":"x","type":{"annotation":[{"end":[496,11],"name":"tests/purus/passing/prelude/Prelude.purs","start":[496,10]},[]],"contents":{"kind":{"annotation":[{"end":[493,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[493,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}},{"annotation":{"meta":null,"sourceSpan":{"end":[498,34],"start":[498,33]}},"binderType":"VarBinder","identifier":"y","type":{"annotation":[{"end":[496,13],"name":"tests/purus/passing/prelude/Prelude.purs","start":[496,12]},[]],"contents":{"kind":{"annotation":[{"end":[493,32],"name":"tests/purus/passing/prelude/Prelude.purs","start":[493,28]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"b"},"tag":"TypeVar"}}],"constructorName":{"identifier":"Tuple2","moduleName":["Prim"]},"typeName":{"identifier":"Tuple2","moduleName":["Prim"]}}],"expression":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[499,21],"start":[499,3]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"constrData","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[499,23],"start":[499,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[499,23],"start":[499,22]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"literalType":"IntLiteral","value":0}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[499,96],"start":[499,3]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[499,39],"start":[499,25]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"mkCons","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[499,46],"start":[499,25]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[499,43],"start":[499,41]}},"kind":"Var","type":{"annotation":[{"end":[494,28],"name":"tests/purus/passing/prelude/Prelude.purs","start":[494,4]},[]],"contents":[{"annotation":[{"end":[494,28],"name":"tests/purus/passing/prelude/Prelude.purs","start":[494,4]},[]],"contents":[{"annotation":[{"end":[494,8],"name":"tests/purus/passing/prelude/Prelude.purs","start":[494,6]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[494,5],"name":"tests/purus/passing/prelude/Prelude.purs","start":[494,4]},[]],"contents":{"kind":{"annotation":[{"end":[493,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[493,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[494,28],"name":"tests/purus/passing/prelude/Prelude.purs","start":[494,9]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"fA1","sourcePos":[498,17]}},"annotation":{"meta":null,"sourceSpan":{"end":[499,45],"start":[499,41]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[499,45],"start":[499,44]}},"kind":"Var","type":{"annotation":[{"end":[496,11],"name":"tests/purus/passing/prelude/Prelude.purs","start":[496,10]},[]],"contents":{"kind":{"annotation":[{"end":[493,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[493,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"},"value":{"identifier":"x","sourcePos":[498,31]}},"kind":"App"},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[499,95],"start":[499,25]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[499,62],"start":[499,48]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"mkCons","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[499,69],"start":[499,48]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[499,66],"start":[499,64]}},"kind":"Var","type":{"annotation":[{"end":[495,28],"name":"tests/purus/passing/prelude/Prelude.purs","start":[495,4]},[]],"contents":[{"annotation":[{"end":[495,28],"name":"tests/purus/passing/prelude/Prelude.purs","start":[495,4]},[]],"contents":[{"annotation":[{"end":[495,8],"name":"tests/purus/passing/prelude/Prelude.purs","start":[495,6]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[495,5],"name":"tests/purus/passing/prelude/Prelude.purs","start":[495,4]},[]],"contents":{"kind":{"annotation":[{"end":[493,32],"name":"tests/purus/passing/prelude/Prelude.purs","start":[493,28]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"b"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[495,28],"name":"tests/purus/passing/prelude/Prelude.purs","start":[495,9]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"fB1","sourcePos":[498,20]}},"annotation":{"meta":null,"sourceSpan":{"end":[499,68],"start":[499,64]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[499,68],"start":[499,67]}},"kind":"Var","type":{"annotation":[{"end":[496,13],"name":"tests/purus/passing/prelude/Prelude.purs","start":[496,12]},[]],"contents":{"kind":{"annotation":[{"end":[493,32],"name":"tests/purus/passing/prelude/Prelude.purs","start":[493,28]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"b"},"tag":"TypeVar"},"value":{"identifier":"y","sourcePos":[498,33]}},"kind":"App"},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[499,94],"start":[499,48]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[499,88],"start":[499,71]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Unit"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"mkNilData","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[499,93],"start":[499,71]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[499,93],"start":[499,89]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Unit"],"tag":"TypeConstructor"},"value":{"identifier":"unit","moduleName":["Prim"]}},"kind":"App"},"kind":"App"},"kind":"App"},"kind":"App"},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[499,96],"start":[498,1]}},"kind":"Var","type":{"annotation":[{"end":[494,28],"name":"tests/purus/passing/prelude/Prelude.purs","start":[494,4]},[]],"contents":[{"annotation":[{"end":[494,28],"name":"tests/purus/passing/prelude/Prelude.purs","start":[494,4]},[]],"contents":[{"annotation":[{"end":[494,8],"name":"tests/purus/passing/prelude/Prelude.purs","start":[494,6]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[494,5],"name":"tests/purus/passing/prelude/Prelude.purs","start":[494,4]},[]],"contents":{"kind":{"annotation":[{"end":[493,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[493,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[494,28],"name":"tests/purus/passing/prelude/Prelude.purs","start":[494,9]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"fA","sourcePos":[498,17]}},{"annotation":{"meta":null,"sourceSpan":{"end":[499,96],"start":[498,1]}},"kind":"Var","type":{"annotation":[{"end":[495,28],"name":"tests/purus/passing/prelude/Prelude.purs","start":[495,4]},[]],"contents":[{"annotation":[{"end":[495,28],"name":"tests/purus/passing/prelude/Prelude.purs","start":[495,4]},[]],"contents":[{"annotation":[{"end":[495,8],"name":"tests/purus/passing/prelude/Prelude.purs","start":[495,6]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[495,5],"name":"tests/purus/passing/prelude/Prelude.purs","start":[495,4]},[]],"contents":{"kind":{"annotation":[{"end":[493,32],"name":"tests/purus/passing/prelude/Prelude.purs","start":[493,28]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"b"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[495,28],"name":"tests/purus/passing/prelude/Prelude.purs","start":[495,9]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"fB","sourcePos":[498,20]}},{"annotation":{"meta":null,"sourceSpan":{"end":[499,96],"start":[498,1]}},"kind":"Var","type":{"annotation":[{"end":[496,13],"name":"tests/purus/passing/prelude/Prelude.purs","start":[496,3]},[]],"contents":[{"annotation":[{"end":[496,11],"name":"tests/purus/passing/prelude/Prelude.purs","start":[496,3]},[]],"contents":[{"annotation":[{"end":[496,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[496,3]},[]],"contents":[["Prim"],"Tuple2"],"tag":"TypeConstructor"},{"annotation":[{"end":[496,11],"name":"tests/purus/passing/prelude/Prelude.purs","start":[496,10]},[]],"contents":{"kind":{"annotation":[{"end":[493,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[493,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[496,13],"name":"tests/purus/passing/prelude/Prelude.purs","start":[496,12]},[]],"contents":{"kind":{"annotation":[{"end":[493,32],"name":"tests/purus/passing/prelude/Prelude.purs","start":[493,28]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"b"},"tag":"TypeVar"}],"tag":"TypeApp"},"value":{"identifier":"v","sourcePos":[0,0]}}],"kind":"Case","type":{"annotation":[{"end":[497,22],"name":"tests/purus/passing/prelude/Prelude.purs","start":[497,3]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[496,13],"name":"tests/purus/passing/prelude/Prelude.purs","start":[496,3]},[]],"contents":[{"annotation":[{"end":[496,11],"name":"tests/purus/passing/prelude/Prelude.purs","start":[496,3]},[]],"contents":[{"annotation":[{"end":[496,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[496,3]},[]],"contents":[["Prim"],"Tuple2"],"tag":"TypeConstructor"},{"annotation":[{"end":[496,11],"name":"tests/purus/passing/prelude/Prelude.purs","start":[496,10]},[]],"contents":{"kind":{"annotation":[{"end":[493,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[493,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[496,13],"name":"tests/purus/passing/prelude/Prelude.purs","start":[496,12]},[]],"contents":{"kind":{"annotation":[{"end":[493,32],"name":"tests/purus/passing/prelude/Prelude.purs","start":[493,28]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"b"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[497,22],"name":"tests/purus/passing/prelude/Prelude.purs","start":[497,3]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[495,28],"name":"tests/purus/passing/prelude/Prelude.purs","start":[495,4]},[]],"contents":[{"annotation":[{"end":[495,28],"name":"tests/purus/passing/prelude/Prelude.purs","start":[495,4]},[]],"contents":[{"annotation":[{"end":[495,8],"name":"tests/purus/passing/prelude/Prelude.purs","start":[495,6]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[495,5],"name":"tests/purus/passing/prelude/Prelude.purs","start":[495,4]},[]],"contents":{"kind":{"annotation":[{"end":[493,32],"name":"tests/purus/passing/prelude/Prelude.purs","start":[493,28]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"b"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[495,28],"name":"tests/purus/passing/prelude/Prelude.purs","start":[495,9]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[497,22],"name":"tests/purus/passing/prelude/Prelude.purs","start":[496,3]},[]],"contents":[{"annotation":[{"end":[497,22],"name":"tests/purus/passing/prelude/Prelude.purs","start":[496,3]},[]],"contents":[{"annotation":[{"end":[496,16],"name":"tests/purus/passing/prelude/Prelude.purs","start":[496,14]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[496,13],"name":"tests/purus/passing/prelude/Prelude.purs","start":[496,3]},[]],"contents":[{"annotation":[{"end":[496,11],"name":"tests/purus/passing/prelude/Prelude.purs","start":[496,3]},[]],"contents":[{"annotation":[{"end":[496,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[496,3]},[]],"contents":[["Prim"],"Tuple2"],"tag":"TypeConstructor"},{"annotation":[{"end":[496,11],"name":"tests/purus/passing/prelude/Prelude.purs","start":[496,10]},[]],"contents":{"kind":{"annotation":[{"end":[493,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[493,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[496,13],"name":"tests/purus/passing/prelude/Prelude.purs","start":[496,12]},[]],"contents":{"kind":{"annotation":[{"end":[493,32],"name":"tests/purus/passing/prelude/Prelude.purs","start":[493,28]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"b"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[497,22],"name":"tests/purus/passing/prelude/Prelude.purs","start":[497,3]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"kind":"Abs","type":{"annotation":[{"end":[497,22],"name":"tests/purus/passing/prelude/Prelude.purs","start":[493,3]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[493,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[493,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":19,"type":{"annotation":[{"end":[497,22],"name":"tests/purus/passing/prelude/Prelude.purs","start":[493,23]},[]],"contents":{"identifier":"b","kind":{"annotation":[{"end":[493,32],"name":"tests/purus/passing/prelude/Prelude.purs","start":[493,28]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":18,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[494,28],"name":"tests/purus/passing/prelude/Prelude.purs","start":[494,4]},[]],"contents":[{"annotation":[{"end":[494,28],"name":"tests/purus/passing/prelude/Prelude.purs","start":[494,4]},[]],"contents":[{"annotation":[{"end":[494,8],"name":"tests/purus/passing/prelude/Prelude.purs","start":[494,6]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[494,5],"name":"tests/purus/passing/prelude/Prelude.purs","start":[494,4]},[]],"contents":{"kind":{"annotation":[{"end":[493,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[493,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[494,28],"name":"tests/purus/passing/prelude/Prelude.purs","start":[494,9]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[497,22],"name":"tests/purus/passing/prelude/Prelude.purs","start":[495,3]},[]],"contents":[{"annotation":[{"end":[497,22],"name":"tests/purus/passing/prelude/Prelude.purs","start":[495,3]},[]],"contents":[{"annotation":[{"end":[495,32],"name":"tests/purus/passing/prelude/Prelude.purs","start":[495,30]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[495,28],"name":"tests/purus/passing/prelude/Prelude.purs","start":[495,4]},[]],"contents":[{"annotation":[{"end":[495,28],"name":"tests/purus/passing/prelude/Prelude.purs","start":[495,4]},[]],"contents":[{"annotation":[{"end":[495,8],"name":"tests/purus/passing/prelude/Prelude.purs","start":[495,6]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[495,5],"name":"tests/purus/passing/prelude/Prelude.purs","start":[495,4]},[]],"contents":{"kind":{"annotation":[{"end":[493,32],"name":"tests/purus/passing/prelude/Prelude.purs","start":[493,28]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"b"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[495,28],"name":"tests/purus/passing/prelude/Prelude.purs","start":[495,9]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[497,22],"name":"tests/purus/passing/prelude/Prelude.purs","start":[496,3]},[]],"contents":[{"annotation":[{"end":[497,22],"name":"tests/purus/passing/prelude/Prelude.purs","start":[496,3]},[]],"contents":[{"annotation":[{"end":[496,16],"name":"tests/purus/passing/prelude/Prelude.purs","start":[496,14]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[496,13],"name":"tests/purus/passing/prelude/Prelude.purs","start":[496,3]},[]],"contents":[{"annotation":[{"end":[496,11],"name":"tests/purus/passing/prelude/Prelude.purs","start":[496,3]},[]],"contents":[{"annotation":[{"end":[496,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[496,3]},[]],"contents":[["Prim"],"Tuple2"],"tag":"TypeConstructor"},{"annotation":[{"end":[496,11],"name":"tests/purus/passing/prelude/Prelude.purs","start":[496,10]},[]],"contents":{"kind":{"annotation":[{"end":[493,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[493,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[496,13],"name":"tests/purus/passing/prelude/Prelude.purs","start":[496,12]},[]],"contents":{"kind":{"annotation":[{"end":[493,32],"name":"tests/purus/passing/prelude/Prelude.purs","start":[493,28]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"b"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[497,22],"name":"tests/purus/passing/prelude/Prelude.purs","start":[497,3]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"identifier":"serializeTuple2"},{"annotation":{"meta":null,"sourceSpan":{"end":[434,53],"start":[434,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"argument":"v","body":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":{"metaType":"IsNewtype"},"sourceSpan":{"end":[435,32],"start":[435,20]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[435,32],"start":[435,29]}},"binderType":"VarBinder","identifier":"dat","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}}],"constructorName":{"identifier":"Redeemer","moduleName":["Prim"]},"typeName":{"identifier":"Redeemer","moduleName":["Prim"]}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[435,39],"start":[435,36]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"},"value":{"identifier":"dat","sourcePos":[435,29]}},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[435,39],"start":[435,1]}},"kind":"Var","type":{"annotation":[{"end":[434,30],"name":"tests/purus/passing/prelude/Prelude.purs","start":[434,22]},[]],"contents":[["Prim"],"Redeemer"],"tag":"TypeConstructor"},"value":{"identifier":"v","sourcePos":[0,0]}}],"kind":"Case","type":{"annotation":[{"end":[434,53],"name":"tests/purus/passing/prelude/Prelude.purs","start":[434,34]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[434,30],"name":"tests/purus/passing/prelude/Prelude.purs","start":[434,22]},[]],"contents":[["Prim"],"Redeemer"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[434,53],"name":"tests/purus/passing/prelude/Prelude.purs","start":[434,34]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"identifier":"serializeRedeemer"},{"annotation":{"meta":null,"sourceSpan":{"end":[519,22],"start":[515,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[522,81],"start":[520,1]}},"argument":"f","body":{"annotation":{"meta":null,"sourceSpan":{"end":[522,81],"start":[520,1]}},"argument":"m","body":{"annotation":{"meta":null,"sourceSpan":{"end":[522,81],"start":[520,22]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[521,10],"start":[521,3]}},"binderType":"ConstructorBinder","binders":[],"constructorName":{"identifier":"Nothing","moduleName":["Prim"]},"typeName":{"identifier":"Maybe","moduleName":["Prim"]}}],"expression":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[521,32],"start":[521,14]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"constrData","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[521,34],"start":[521,14]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[521,34],"start":[521,33]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"literalType":"IntLiteral","value":0}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[521,59],"start":[521,14]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[521,53],"start":[521,36]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Unit"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"mkNilData","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[521,58],"start":[521,36]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[521,58],"start":[521,54]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Unit"],"tag":"TypeConstructor"},"value":{"identifier":"unit","moduleName":["Prim"]}},"kind":"App"},"kind":"App"},"isGuarded":false},{"binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":["$__unused"],"metaType":"IsConstructor"},"sourceSpan":{"end":[522,9],"start":[522,3]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[522,9],"start":[522,8]}},"binderType":"VarBinder","identifier":"x","type":{"annotation":[{"end":[518,10],"name":"tests/purus/passing/prelude/Prelude.purs","start":[518,9]},[]],"contents":{"kind":{"annotation":[{"end":[516,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[516,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}}],"constructorName":{"identifier":"Just","moduleName":["Prim"]},"typeName":{"identifier":"Maybe","moduleName":["Prim"]}}],"expression":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[522,31],"start":[522,13]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"constrData","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[522,33],"start":[522,13]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[522,33],"start":[522,32]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"literalType":"IntLiteral","value":1}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[522,81],"start":[522,13]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[522,49],"start":[522,35]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"mkCons","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[522,55],"start":[522,35]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[522,52],"start":[522,51]}},"kind":"Var","type":{"annotation":[{"end":[517,28],"name":"tests/purus/passing/prelude/Prelude.purs","start":[517,4]},[]],"contents":[{"annotation":[{"end":[517,28],"name":"tests/purus/passing/prelude/Prelude.purs","start":[517,4]},[]],"contents":[{"annotation":[{"end":[517,8],"name":"tests/purus/passing/prelude/Prelude.purs","start":[517,6]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[517,5],"name":"tests/purus/passing/prelude/Prelude.purs","start":[517,4]},[]],"contents":{"kind":{"annotation":[{"end":[516,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[516,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[517,28],"name":"tests/purus/passing/prelude/Prelude.purs","start":[517,9]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"f","sourcePos":[520,1]}},"annotation":{"meta":null,"sourceSpan":{"end":[522,54],"start":[522,51]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[522,54],"start":[522,53]}},"kind":"Var","type":{"annotation":[{"end":[518,10],"name":"tests/purus/passing/prelude/Prelude.purs","start":[518,9]},[]],"contents":{"kind":{"annotation":[{"end":[516,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[516,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"},"value":{"identifier":"x","sourcePos":[522,8]}},"kind":"App"},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[522,80],"start":[522,35]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[522,74],"start":[522,57]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Unit"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"mkNilData","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[522,79],"start":[522,57]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[522,79],"start":[522,75]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Unit"],"tag":"TypeConstructor"},"value":{"identifier":"unit","moduleName":["Prim"]}},"kind":"App"},"kind":"App"},"kind":"App"},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[520,28],"start":[520,27]}},"kind":"Var","type":{"annotation":[{"end":[518,10],"name":"tests/purus/passing/prelude/Prelude.purs","start":[518,3]},[]],"contents":[{"annotation":[{"end":[518,8],"name":"tests/purus/passing/prelude/Prelude.purs","start":[518,3]},[]],"contents":[["Prim"],"Maybe"],"tag":"TypeConstructor"},{"annotation":[{"end":[518,10],"name":"tests/purus/passing/prelude/Prelude.purs","start":[518,9]},[]],"contents":{"kind":{"annotation":[{"end":[516,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[516,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},"value":{"identifier":"m","sourcePos":[520,1]}}],"kind":"Case","type":{"annotation":[{"end":[519,22],"name":"tests/purus/passing/prelude/Prelude.purs","start":[519,3]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[518,10],"name":"tests/purus/passing/prelude/Prelude.purs","start":[518,3]},[]],"contents":[{"annotation":[{"end":[518,8],"name":"tests/purus/passing/prelude/Prelude.purs","start":[518,3]},[]],"contents":[["Prim"],"Maybe"],"tag":"TypeConstructor"},{"annotation":[{"end":[518,10],"name":"tests/purus/passing/prelude/Prelude.purs","start":[518,9]},[]],"contents":{"kind":{"annotation":[{"end":[516,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[516,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[519,22],"name":"tests/purus/passing/prelude/Prelude.purs","start":[519,3]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"kind":"Abs","type":{"annotation":[{"end":[519,22],"name":"tests/purus/passing/prelude/Prelude.purs","start":[516,3]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[516,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[516,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":24,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[517,28],"name":"tests/purus/passing/prelude/Prelude.purs","start":[517,4]},[]],"contents":[{"annotation":[{"end":[517,28],"name":"tests/purus/passing/prelude/Prelude.purs","start":[517,4]},[]],"contents":[{"annotation":[{"end":[517,8],"name":"tests/purus/passing/prelude/Prelude.purs","start":[517,6]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[517,5],"name":"tests/purus/passing/prelude/Prelude.purs","start":[517,4]},[]],"contents":{"kind":{"annotation":[{"end":[516,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[516,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[517,28],"name":"tests/purus/passing/prelude/Prelude.purs","start":[517,9]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[519,22],"name":"tests/purus/passing/prelude/Prelude.purs","start":[518,3]},[]],"contents":[{"annotation":[{"end":[519,22],"name":"tests/purus/passing/prelude/Prelude.purs","start":[518,3]},[]],"contents":[{"annotation":[{"end":[518,13],"name":"tests/purus/passing/prelude/Prelude.purs","start":[518,11]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[518,10],"name":"tests/purus/passing/prelude/Prelude.purs","start":[518,3]},[]],"contents":[{"annotation":[{"end":[518,8],"name":"tests/purus/passing/prelude/Prelude.purs","start":[518,3]},[]],"contents":[["Prim"],"Maybe"],"tag":"TypeConstructor"},{"annotation":[{"end":[518,10],"name":"tests/purus/passing/prelude/Prelude.purs","start":[518,9]},[]],"contents":{"kind":{"annotation":[{"end":[516,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[516,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[519,22],"name":"tests/purus/passing/prelude/Prelude.purs","start":[519,3]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"identifier":"serializeMaybe"},{"annotation":{"meta":null,"sourceSpan":{"end":[471,83],"start":[470,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[477,55],"start":[472,1]}},"argument":"f","body":{"annotation":{"meta":null,"sourceSpan":{"end":[477,55],"start":[472,1]}},"argument":"arr","body":{"annotation":{"meta":{"metaType":"IsWhere"},"sourceSpan":{"end":[472,48],"start":[472,23]}},"binds":[{"annotation":{"meta":null,"sourceSpan":{"end":[474,60],"start":[474,5]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"argument":"v","body":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[476,17],"start":[476,14]}},"binderType":"ConstructorBinder","binders":[],"constructorName":{"identifier":"Nil","moduleName":["Prim"]},"typeName":{"identifier":"List","moduleName":["Prim"]}}],"expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[476,38],"start":[476,21]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Unit"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"mkNilData","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[476,43],"start":[476,21]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[476,43],"start":[476,39]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Unit"],"tag":"TypeConstructor"},"value":{"identifier":"unit","moduleName":["Prim"]}},"kind":"App"},"isGuarded":false},{"binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[477,23],"start":[477,14]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[477,20],"start":[477,19]}},"binderType":"VarBinder","identifier":"x","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["a",{"annotation":[{"end":[471,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[471,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},7,28],"tag":"Skolem"}},{"annotation":{"meta":null,"sourceSpan":{"end":[477,23],"start":[477,21]}},"binderType":"VarBinder","identifier":"xs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["a",{"annotation":[{"end":[471,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[471,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},7,28],"tag":"Skolem"}],"tag":"TypeApp"}}],"constructorName":{"identifier":"Cons","moduleName":["Prim"]},"typeName":{"identifier":"List","moduleName":["Prim"]}}],"expression":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[477,41],"start":[477,27]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"mkCons","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[477,47],"start":[477,27]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[477,44],"start":[477,43]}},"kind":"Var","type":{"annotation":[{"end":[471,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[471,25]},[]],"contents":[{"annotation":[{"end":[471,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[471,25]},[]],"contents":[{"annotation":[{"end":[471,29],"name":"tests/purus/passing/prelude/Prelude.purs","start":[471,27]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[471,26],"name":"tests/purus/passing/prelude/Prelude.purs","start":[471,25]},[]],"contents":{"kind":{"annotation":[{"end":[471,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[471,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[471,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[471,30]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"f","sourcePos":[472,1]}},"annotation":{"meta":null,"sourceSpan":{"end":[477,46],"start":[477,43]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[477,46],"start":[477,45]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["a",{"annotation":[{"end":[471,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[471,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},7,28],"tag":"Skolem"},"value":{"identifier":"x","sourcePos":[477,19]}},"kind":"App"},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[477,55],"start":[477,27]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[477,51],"start":[477,49]}},"kind":"Var","type":{"annotation":[{"end":[474,60],"name":"tests/purus/passing/prelude/Prelude.purs","start":[474,11]},[]],"contents":[{"annotation":[{"end":[474,60],"name":"tests/purus/passing/prelude/Prelude.purs","start":[474,11]},[]],"contents":[{"annotation":[{"end":[474,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[474,18]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[474,17],"name":"tests/purus/passing/prelude/Prelude.purs","start":[474,11]},[]],"contents":[{"annotation":[{"end":[474,15],"name":"tests/purus/passing/prelude/Prelude.purs","start":[474,11]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["a",{"annotation":[{"end":[471,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[471,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},7,28],"tag":"Skolem"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[474,60],"name":"tests/purus/passing/prelude/Prelude.purs","start":[474,21]},[]],"contents":[{"annotation":[{"end":[474,40],"name":"tests/purus/passing/prelude/Prelude.purs","start":[474,21]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[474,60],"name":"tests/purus/passing/prelude/Prelude.purs","start":[474,41]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"go","sourcePos":[474,5]}},"annotation":{"meta":null,"sourceSpan":{"end":[477,54],"start":[477,49]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[477,54],"start":[477,52]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["a",{"annotation":[{"end":[471,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[471,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},7,28],"tag":"Skolem"}],"tag":"TypeApp"},"value":{"identifier":"xs","sourcePos":[477,21]}},"kind":"App"},"kind":"App"},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"kind":"Var","type":{"annotation":[{"end":[474,17],"name":"tests/purus/passing/prelude/Prelude.purs","start":[474,11]},[]],"contents":[{"annotation":[{"end":[474,15],"name":"tests/purus/passing/prelude/Prelude.purs","start":[474,11]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["a",{"annotation":[{"end":[471,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[471,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},7,28],"tag":"Skolem"}],"tag":"TypeApp"},"value":{"identifier":"v","sourcePos":[0,0]}}],"kind":"Case","type":{"annotation":[{"end":[474,60],"name":"tests/purus/passing/prelude/Prelude.purs","start":[474,21]},[]],"contents":[{"annotation":[{"end":[474,40],"name":"tests/purus/passing/prelude/Prelude.purs","start":[474,21]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[474,60],"name":"tests/purus/passing/prelude/Prelude.purs","start":[474,41]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[474,17],"name":"tests/purus/passing/prelude/Prelude.purs","start":[474,11]},[]],"contents":[{"annotation":[{"end":[474,15],"name":"tests/purus/passing/prelude/Prelude.purs","start":[474,11]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["a",{"annotation":[{"end":[471,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[471,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},7,28],"tag":"Skolem"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[474,60],"name":"tests/purus/passing/prelude/Prelude.purs","start":[474,21]},[]],"contents":[{"annotation":[{"end":[474,40],"name":"tests/purus/passing/prelude/Prelude.purs","start":[474,21]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[474,60],"name":"tests/purus/passing/prelude/Prelude.purs","start":[474,41]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"identifier":"go"}],"expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[472,39],"start":[472,23]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"listData","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[472,48],"start":[472,23]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[472,43],"start":[472,41]}},"kind":"Var","type":{"annotation":[{"end":[474,60],"name":"tests/purus/passing/prelude/Prelude.purs","start":[474,11]},[]],"contents":[{"annotation":[{"end":[474,60],"name":"tests/purus/passing/prelude/Prelude.purs","start":[474,11]},[]],"contents":[{"annotation":[{"end":[474,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[474,18]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[474,17],"name":"tests/purus/passing/prelude/Prelude.purs","start":[474,11]},[]],"contents":[{"annotation":[{"end":[474,15],"name":"tests/purus/passing/prelude/Prelude.purs","start":[474,11]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["a",{"annotation":[{"end":[471,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[471,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},7,28],"tag":"Skolem"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[474,60],"name":"tests/purus/passing/prelude/Prelude.purs","start":[474,21]},[]],"contents":[{"annotation":[{"end":[474,40],"name":"tests/purus/passing/prelude/Prelude.purs","start":[474,21]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[474,60],"name":"tests/purus/passing/prelude/Prelude.purs","start":[474,41]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"go","sourcePos":[474,5]}},"annotation":{"meta":null,"sourceSpan":{"end":[472,47],"start":[472,41]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[472,47],"start":[472,44]}},"kind":"Var","type":{"annotation":[{"end":[471,60],"name":"tests/purus/passing/prelude/Prelude.purs","start":[471,54]},[]],"contents":[{"annotation":[{"end":[471,58],"name":"tests/purus/passing/prelude/Prelude.purs","start":[471,54]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[471,60],"name":"tests/purus/passing/prelude/Prelude.purs","start":[471,59]},[]],"contents":{"kind":{"annotation":[{"end":[471,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[471,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},"value":{"identifier":"arr","sourcePos":[472,1]}},"kind":"App"},"kind":"App"},"kind":"Let"},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[471,60],"name":"tests/purus/passing/prelude/Prelude.purs","start":[471,54]},[]],"contents":[{"annotation":[{"end":[471,58],"name":"tests/purus/passing/prelude/Prelude.purs","start":[471,54]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[471,60],"name":"tests/purus/passing/prelude/Prelude.purs","start":[471,59]},[]],"contents":{"kind":{"annotation":[{"end":[471,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[471,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[471,83],"name":"tests/purus/passing/prelude/Prelude.purs","start":[471,64]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"kind":"Abs","type":{"annotation":[{"end":[471,83],"name":"tests/purus/passing/prelude/Prelude.purs","start":[471,3]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[471,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[471,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":27,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[471,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[471,25]},[]],"contents":[{"annotation":[{"end":[471,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[471,25]},[]],"contents":[{"annotation":[{"end":[471,29],"name":"tests/purus/passing/prelude/Prelude.purs","start":[471,27]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[471,26],"name":"tests/purus/passing/prelude/Prelude.purs","start":[471,25]},[]],"contents":{"kind":{"annotation":[{"end":[471,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[471,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[471,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[471,30]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[471,83],"name":"tests/purus/passing/prelude/Prelude.purs","start":[471,54]},[]],"contents":[{"annotation":[{"end":[471,83],"name":"tests/purus/passing/prelude/Prelude.purs","start":[471,54]},[]],"contents":[{"annotation":[{"end":[471,63],"name":"tests/purus/passing/prelude/Prelude.purs","start":[471,61]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[471,60],"name":"tests/purus/passing/prelude/Prelude.purs","start":[471,54]},[]],"contents":[{"annotation":[{"end":[471,58],"name":"tests/purus/passing/prelude/Prelude.purs","start":[471,54]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[471,60],"name":"tests/purus/passing/prelude/Prelude.purs","start":[471,59]},[]],"contents":{"kind":{"annotation":[{"end":[471,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[471,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[471,83],"name":"tests/purus/passing/prelude/Prelude.purs","start":[471,64]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"identifier":"serializeList"},{"annotation":{"meta":null,"sourceSpan":{"end":[458,43],"start":[458,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[459,29],"start":[459,16]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"iData","moduleName":["Builtin"]}},"identifier":"serializeInt"},{"annotation":{"meta":null,"sourceSpan":{"end":[159,53],"start":[159,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"argument":"v","body":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":{"metaType":"IsNewtype"},"sourceSpan":{"end":[160,30],"start":[160,20]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[160,30],"start":[160,29]}},"binderType":"VarBinder","identifier":"i","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}}],"constructorName":{"identifier":"Lovelace","moduleName":["Prim"]},"typeName":{"identifier":"Lovelace","moduleName":["Prim"]}}],"expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[160,46],"start":[160,34]}},"kind":"Var","type":{"annotation":[{"end":[458,43],"name":"tests/purus/passing/prelude/Prelude.purs","start":[458,17]},[]],"contents":[{"annotation":[{"end":[458,43],"name":"tests/purus/passing/prelude/Prelude.purs","start":[458,17]},[]],"contents":[{"annotation":[{"end":[458,23],"name":"tests/purus/passing/prelude/Prelude.purs","start":[458,21]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[458,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[458,17]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[458,43],"name":"tests/purus/passing/prelude/Prelude.purs","start":[458,24]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"serializeInt","moduleName":["Prelude"]}},"annotation":{"meta":null,"sourceSpan":{"end":[160,48],"start":[160,34]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[160,48],"start":[160,47]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"identifier":"i","sourcePos":[160,29]}},"kind":"App"},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[160,48],"start":[160,1]}},"kind":"Var","type":{"annotation":[{"end":[159,30],"name":"tests/purus/passing/prelude/Prelude.purs","start":[159,22]},[]],"contents":[["Prim"],"Lovelace"],"tag":"TypeConstructor"},"value":{"identifier":"v","sourcePos":[0,0]}}],"kind":"Case","type":{"annotation":[{"end":[159,53],"name":"tests/purus/passing/prelude/Prelude.purs","start":[159,34]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[159,30],"name":"tests/purus/passing/prelude/Prelude.purs","start":[159,22]},[]],"contents":[["Prim"],"Lovelace"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[159,53],"name":"tests/purus/passing/prelude/Prelude.purs","start":[159,34]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"identifier":"serializeLovelace"},{"annotation":{"meta":null,"sourceSpan":{"end":[165,55],"start":[165,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"argument":"v","body":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":{"metaType":"IsNewtype"},"sourceSpan":{"end":[166,32],"start":[166,21]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[166,32],"start":[166,31]}},"binderType":"VarBinder","identifier":"t","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}}],"constructorName":{"identifier":"POSIXTime","moduleName":["Prim"]},"typeName":{"identifier":"POSIXTime","moduleName":["Prim"]}}],"expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[166,48],"start":[166,36]}},"kind":"Var","type":{"annotation":[{"end":[458,43],"name":"tests/purus/passing/prelude/Prelude.purs","start":[458,17]},[]],"contents":[{"annotation":[{"end":[458,43],"name":"tests/purus/passing/prelude/Prelude.purs","start":[458,17]},[]],"contents":[{"annotation":[{"end":[458,23],"name":"tests/purus/passing/prelude/Prelude.purs","start":[458,21]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[458,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[458,17]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[458,43],"name":"tests/purus/passing/prelude/Prelude.purs","start":[458,24]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"serializeInt","moduleName":["Prelude"]}},"annotation":{"meta":null,"sourceSpan":{"end":[166,50],"start":[166,36]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[166,50],"start":[166,49]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"identifier":"t","sourcePos":[166,31]}},"kind":"App"},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[166,50],"start":[166,1]}},"kind":"Var","type":{"annotation":[{"end":[165,32],"name":"tests/purus/passing/prelude/Prelude.purs","start":[165,23]},[]],"contents":[["Prim"],"POSIXTime"],"tag":"TypeConstructor"},"value":{"identifier":"v","sourcePos":[0,0]}}],"kind":"Case","type":{"annotation":[{"end":[165,55],"name":"tests/purus/passing/prelude/Prelude.purs","start":[165,36]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[165,32],"name":"tests/purus/passing/prelude/Prelude.purs","start":[165,23]},[]],"contents":[["Prim"],"POSIXTime"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[165,55],"name":"tests/purus/passing/prelude/Prelude.purs","start":[165,36]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"identifier":"serializePOSIXTime"},{"annotation":{"meta":null,"sourceSpan":{"end":[348,87],"start":[347,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[352,58],"start":[349,1]}},"argument":"f","body":{"annotation":{"meta":null,"sourceSpan":{"end":[352,58],"start":[349,1]}},"argument":"e","body":{"annotation":{"meta":null,"sourceSpan":{"end":[352,58],"start":[349,25]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[350,9],"start":[350,3]}},"binderType":"ConstructorBinder","binders":[],"constructorName":{"identifier":"NegInf","moduleName":["Prim"]},"typeName":{"identifier":"Extended","moduleName":["Prim"]}}],"expression":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[350,31],"start":[350,13]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"constrData","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[350,33],"start":[350,13]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[350,33],"start":[350,32]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"literalType":"IntLiteral","value":0}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[350,58],"start":[350,13]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[350,52],"start":[350,35]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Unit"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"mkNilData","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[350,57],"start":[350,35]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[350,57],"start":[350,53]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Unit"],"tag":"TypeConstructor"},"value":{"identifier":"unit","moduleName":["Prim"]}},"kind":"App"},"kind":"App"},"isGuarded":false},{"binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":["$__unused"],"metaType":"IsConstructor"},"sourceSpan":{"end":[351,11],"start":[351,3]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[351,11],"start":[351,10]}},"binderType":"VarBinder","identifier":"x","type":{"annotation":[{"end":[348,64],"name":"tests/purus/passing/prelude/Prelude.purs","start":[348,63]},[]],"contents":{"kind":{"annotation":[{"end":[348,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[348,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}}],"constructorName":{"identifier":"Finite","moduleName":["Prim"]},"typeName":{"identifier":"Extended","moduleName":["Prim"]}}],"expression":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[351,33],"start":[351,15]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"constrData","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[351,35],"start":[351,15]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[351,35],"start":[351,34]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"literalType":"IntLiteral","value":1}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[351,83],"start":[351,15]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[351,51],"start":[351,37]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"mkCons","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[351,57],"start":[351,37]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[351,54],"start":[351,53]}},"kind":"Var","type":{"annotation":[{"end":[348,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[348,25]},[]],"contents":[{"annotation":[{"end":[348,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[348,25]},[]],"contents":[{"annotation":[{"end":[348,29],"name":"tests/purus/passing/prelude/Prelude.purs","start":[348,27]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[348,26],"name":"tests/purus/passing/prelude/Prelude.purs","start":[348,25]},[]],"contents":{"kind":{"annotation":[{"end":[348,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[348,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[348,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[348,30]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"f","sourcePos":[349,1]}},"annotation":{"meta":null,"sourceSpan":{"end":[351,56],"start":[351,53]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[351,56],"start":[351,55]}},"kind":"Var","type":{"annotation":[{"end":[348,64],"name":"tests/purus/passing/prelude/Prelude.purs","start":[348,63]},[]],"contents":{"kind":{"annotation":[{"end":[348,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[348,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"},"value":{"identifier":"x","sourcePos":[351,10]}},"kind":"App"},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[351,82],"start":[351,37]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[351,76],"start":[351,59]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Unit"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"mkNilData","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[351,81],"start":[351,59]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[351,81],"start":[351,77]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Unit"],"tag":"TypeConstructor"},"value":{"identifier":"unit","moduleName":["Prim"]}},"kind":"App"},"kind":"App"},"kind":"App"},"isGuarded":false},{"binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[352,9],"start":[352,3]}},"binderType":"ConstructorBinder","binders":[],"constructorName":{"identifier":"PosInf","moduleName":["Prim"]},"typeName":{"identifier":"Extended","moduleName":["Prim"]}}],"expression":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[352,31],"start":[352,13]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"constrData","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[352,33],"start":[352,13]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[352,33],"start":[352,32]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"literalType":"IntLiteral","value":2}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[352,58],"start":[352,13]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[352,52],"start":[352,35]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Unit"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"mkNilData","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[352,57],"start":[352,35]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[352,57],"start":[352,53]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Unit"],"tag":"TypeConstructor"},"value":{"identifier":"unit","moduleName":["Prim"]}},"kind":"App"},"kind":"App"},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[349,31],"start":[349,30]}},"kind":"Var","type":{"annotation":[{"end":[348,64],"name":"tests/purus/passing/prelude/Prelude.purs","start":[348,54]},[]],"contents":[{"annotation":[{"end":[348,62],"name":"tests/purus/passing/prelude/Prelude.purs","start":[348,54]},[]],"contents":[["Prim"],"Extended"],"tag":"TypeConstructor"},{"annotation":[{"end":[348,64],"name":"tests/purus/passing/prelude/Prelude.purs","start":[348,63]},[]],"contents":{"kind":{"annotation":[{"end":[348,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[348,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},"value":{"identifier":"e","sourcePos":[349,1]}}],"kind":"Case","type":{"annotation":[{"end":[348,87],"name":"tests/purus/passing/prelude/Prelude.purs","start":[348,68]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[348,64],"name":"tests/purus/passing/prelude/Prelude.purs","start":[348,54]},[]],"contents":[{"annotation":[{"end":[348,62],"name":"tests/purus/passing/prelude/Prelude.purs","start":[348,54]},[]],"contents":[["Prim"],"Extended"],"tag":"TypeConstructor"},{"annotation":[{"end":[348,64],"name":"tests/purus/passing/prelude/Prelude.purs","start":[348,63]},[]],"contents":{"kind":{"annotation":[{"end":[348,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[348,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[348,87],"name":"tests/purus/passing/prelude/Prelude.purs","start":[348,68]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"kind":"Abs","type":{"annotation":[{"end":[348,87],"name":"tests/purus/passing/prelude/Prelude.purs","start":[348,3]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[348,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[348,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":30,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[348,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[348,25]},[]],"contents":[{"annotation":[{"end":[348,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[348,25]},[]],"contents":[{"annotation":[{"end":[348,29],"name":"tests/purus/passing/prelude/Prelude.purs","start":[348,27]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[348,26],"name":"tests/purus/passing/prelude/Prelude.purs","start":[348,25]},[]],"contents":{"kind":{"annotation":[{"end":[348,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[348,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[348,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[348,30]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[348,87],"name":"tests/purus/passing/prelude/Prelude.purs","start":[348,54]},[]],"contents":[{"annotation":[{"end":[348,87],"name":"tests/purus/passing/prelude/Prelude.purs","start":[348,54]},[]],"contents":[{"annotation":[{"end":[348,67],"name":"tests/purus/passing/prelude/Prelude.purs","start":[348,65]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[348,64],"name":"tests/purus/passing/prelude/Prelude.purs","start":[348,54]},[]],"contents":[{"annotation":[{"end":[348,62],"name":"tests/purus/passing/prelude/Prelude.purs","start":[348,54]},[]],"contents":[["Prim"],"Extended"],"tag":"TypeConstructor"},{"annotation":[{"end":[348,64],"name":"tests/purus/passing/prelude/Prelude.purs","start":[348,63]},[]],"contents":{"kind":{"annotation":[{"end":[348,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[348,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[348,87],"name":"tests/purus/passing/prelude/Prelude.purs","start":[348,68]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"identifier":"serializeExtended"},{"annotation":{"meta":null,"sourceSpan":{"end":[367,89],"start":[366,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[368,22],"start":[368,21]}},"argument":"f","body":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"argument":"v","body":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[368,22],"start":[368,21]}},"binderType":"VarBinder","identifier":"f1","type":{"annotation":[{"end":[367,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[367,25]},[]],"contents":[{"annotation":[{"end":[367,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[367,25]},[]],"contents":[{"annotation":[{"end":[367,29],"name":"tests/purus/passing/prelude/Prelude.purs","start":[367,27]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[367,26],"name":"tests/purus/passing/prelude/Prelude.purs","start":[367,25]},[]],"contents":{"kind":{"annotation":[{"end":[367,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[367,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[367,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[367,30]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},{"annotation":{"meta":{"metaType":"IsNewtype"},"sourceSpan":{"end":[368,36],"start":[368,24]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[368,36],"start":[368,35]}},"binderType":"VarBinder","identifier":"e","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Extended"],"tag":"TypeConstructor"},{"annotation":[{"end":[367,66],"name":"tests/purus/passing/prelude/Prelude.purs","start":[367,65]},[]],"contents":{"kind":{"annotation":[{"end":[367,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[367,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}}],"constructorName":{"identifier":"LowerBound","moduleName":["Prim"]},"typeName":{"identifier":"LowerBound","moduleName":["Prim"]}}],"expression":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[369,21],"start":[369,3]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"constrData","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[369,23],"start":[369,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[369,23],"start":[369,22]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"literalType":"IntLiteral","value":0}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[369,89],"start":[369,3]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[369,39],"start":[369,25]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"mkCons","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[369,63],"start":[369,25]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[369,58],"start":[369,41]}},"kind":"Var","type":{"annotation":[{"end":[348,87],"name":"tests/purus/passing/prelude/Prelude.purs","start":[348,3]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[348,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[348,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":30,"type":{"annotation":[{"end":[348,87],"name":"tests/purus/passing/prelude/Prelude.purs","start":[348,24]},[]],"contents":[{"annotation":[{"end":[348,87],"name":"tests/purus/passing/prelude/Prelude.purs","start":[348,24]},[]],"contents":[{"annotation":[{"end":[348,53],"name":"tests/purus/passing/prelude/Prelude.purs","start":[348,51]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[348,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[348,25]},[]],"contents":[{"annotation":[{"end":[348,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[348,25]},[]],"contents":[{"annotation":[{"end":[348,29],"name":"tests/purus/passing/prelude/Prelude.purs","start":[348,27]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[348,26],"name":"tests/purus/passing/prelude/Prelude.purs","start":[348,25]},[]],"contents":{"kind":{"annotation":[{"end":[348,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[348,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[348,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[348,30]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[348,87],"name":"tests/purus/passing/prelude/Prelude.purs","start":[348,54]},[]],"contents":[{"annotation":[{"end":[348,87],"name":"tests/purus/passing/prelude/Prelude.purs","start":[348,54]},[]],"contents":[{"annotation":[{"end":[348,67],"name":"tests/purus/passing/prelude/Prelude.purs","start":[348,65]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[348,64],"name":"tests/purus/passing/prelude/Prelude.purs","start":[348,54]},[]],"contents":[{"annotation":[{"end":[348,62],"name":"tests/purus/passing/prelude/Prelude.purs","start":[348,54]},[]],"contents":[["Prim"],"Extended"],"tag":"TypeConstructor"},{"annotation":[{"end":[348,64],"name":"tests/purus/passing/prelude/Prelude.purs","start":[348,63]},[]],"contents":{"kind":{"annotation":[{"end":[348,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[348,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[348,87],"name":"tests/purus/passing/prelude/Prelude.purs","start":[348,68]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"serializeExtended","moduleName":["Prelude"]}},"annotation":{"meta":null,"sourceSpan":{"end":[369,60],"start":[369,41]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[369,60],"start":[369,59]}},"kind":"Var","type":{"annotation":[{"end":[367,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[367,25]},[]],"contents":[{"annotation":[{"end":[367,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[367,25]},[]],"contents":[{"annotation":[{"end":[367,29],"name":"tests/purus/passing/prelude/Prelude.purs","start":[367,27]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[367,26],"name":"tests/purus/passing/prelude/Prelude.purs","start":[367,25]},[]],"contents":{"kind":{"annotation":[{"end":[367,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[367,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[367,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[367,30]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"f1","sourcePos":[368,21]}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[369,62],"start":[369,41]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[369,62],"start":[369,61]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Extended"],"tag":"TypeConstructor"},{"annotation":[{"end":[367,66],"name":"tests/purus/passing/prelude/Prelude.purs","start":[367,65]},[]],"contents":{"kind":{"annotation":[{"end":[367,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[367,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},"value":{"identifier":"e","sourcePos":[368,35]}},"kind":"App"},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[369,88],"start":[369,25]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[369,82],"start":[369,65]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Unit"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"mkNilData","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[369,87],"start":[369,65]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[369,87],"start":[369,83]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Unit"],"tag":"TypeConstructor"},"value":{"identifier":"unit","moduleName":["Prim"]}},"kind":"App"},"kind":"App"},"kind":"App"},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[369,89],"start":[368,1]}},"kind":"Var","type":{"annotation":[{"end":[367,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[367,25]},[]],"contents":[{"annotation":[{"end":[367,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[367,25]},[]],"contents":[{"annotation":[{"end":[367,29],"name":"tests/purus/passing/prelude/Prelude.purs","start":[367,27]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[367,26],"name":"tests/purus/passing/prelude/Prelude.purs","start":[367,25]},[]],"contents":{"kind":{"annotation":[{"end":[367,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[367,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[367,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[367,30]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"f","sourcePos":[368,21]}},{"annotation":{"meta":null,"sourceSpan":{"end":[369,89],"start":[368,1]}},"kind":"Var","type":{"annotation":[{"end":[367,66],"name":"tests/purus/passing/prelude/Prelude.purs","start":[367,54]},[]],"contents":[{"annotation":[{"end":[367,64],"name":"tests/purus/passing/prelude/Prelude.purs","start":[367,54]},[]],"contents":[["Prim"],"LowerBound"],"tag":"TypeConstructor"},{"annotation":[{"end":[367,66],"name":"tests/purus/passing/prelude/Prelude.purs","start":[367,65]},[]],"contents":{"kind":{"annotation":[{"end":[367,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[367,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},"value":{"identifier":"v","sourcePos":[0,0]}}],"kind":"Case","type":{"annotation":[{"end":[367,89],"name":"tests/purus/passing/prelude/Prelude.purs","start":[367,70]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[367,66],"name":"tests/purus/passing/prelude/Prelude.purs","start":[367,54]},[]],"contents":[{"annotation":[{"end":[367,64],"name":"tests/purus/passing/prelude/Prelude.purs","start":[367,54]},[]],"contents":[["Prim"],"LowerBound"],"tag":"TypeConstructor"},{"annotation":[{"end":[367,66],"name":"tests/purus/passing/prelude/Prelude.purs","start":[367,65]},[]],"contents":{"kind":{"annotation":[{"end":[367,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[367,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[367,89],"name":"tests/purus/passing/prelude/Prelude.purs","start":[367,70]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"kind":"Abs","type":{"annotation":[{"end":[367,89],"name":"tests/purus/passing/prelude/Prelude.purs","start":[367,3]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[367,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[367,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":33,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[367,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[367,25]},[]],"contents":[{"annotation":[{"end":[367,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[367,25]},[]],"contents":[{"annotation":[{"end":[367,29],"name":"tests/purus/passing/prelude/Prelude.purs","start":[367,27]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[367,26],"name":"tests/purus/passing/prelude/Prelude.purs","start":[367,25]},[]],"contents":{"kind":{"annotation":[{"end":[367,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[367,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[367,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[367,30]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[367,89],"name":"tests/purus/passing/prelude/Prelude.purs","start":[367,54]},[]],"contents":[{"annotation":[{"end":[367,89],"name":"tests/purus/passing/prelude/Prelude.purs","start":[367,54]},[]],"contents":[{"annotation":[{"end":[367,69],"name":"tests/purus/passing/prelude/Prelude.purs","start":[367,67]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[367,66],"name":"tests/purus/passing/prelude/Prelude.purs","start":[367,54]},[]],"contents":[{"annotation":[{"end":[367,64],"name":"tests/purus/passing/prelude/Prelude.purs","start":[367,54]},[]],"contents":[["Prim"],"LowerBound"],"tag":"TypeConstructor"},{"annotation":[{"end":[367,66],"name":"tests/purus/passing/prelude/Prelude.purs","start":[367,65]},[]],"contents":{"kind":{"annotation":[{"end":[367,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[367,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[367,89],"name":"tests/purus/passing/prelude/Prelude.purs","start":[367,70]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"identifier":"serializeLowerBound"},{"annotation":{"meta":null,"sourceSpan":{"end":[380,89],"start":[379,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[381,22],"start":[381,21]}},"argument":"f","body":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"argument":"v","body":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[381,22],"start":[381,21]}},"binderType":"VarBinder","identifier":"f1","type":{"annotation":[{"end":[380,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[380,25]},[]],"contents":[{"annotation":[{"end":[380,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[380,25]},[]],"contents":[{"annotation":[{"end":[380,29],"name":"tests/purus/passing/prelude/Prelude.purs","start":[380,27]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[380,26],"name":"tests/purus/passing/prelude/Prelude.purs","start":[380,25]},[]],"contents":{"kind":{"annotation":[{"end":[380,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[380,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[380,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[380,30]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},{"annotation":{"meta":{"metaType":"IsNewtype"},"sourceSpan":{"end":[381,36],"start":[381,24]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[381,36],"start":[381,35]}},"binderType":"VarBinder","identifier":"e","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Extended"],"tag":"TypeConstructor"},{"annotation":[{"end":[380,66],"name":"tests/purus/passing/prelude/Prelude.purs","start":[380,65]},[]],"contents":{"kind":{"annotation":[{"end":[380,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[380,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}}],"constructorName":{"identifier":"UpperBound","moduleName":["Prim"]},"typeName":{"identifier":"UpperBound","moduleName":["Prim"]}}],"expression":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[382,21],"start":[382,3]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"constrData","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[382,23],"start":[382,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[382,23],"start":[382,22]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"literalType":"IntLiteral","value":0}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[382,89],"start":[382,3]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[382,39],"start":[382,25]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"mkCons","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[382,63],"start":[382,25]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[382,58],"start":[382,41]}},"kind":"Var","type":{"annotation":[{"end":[348,87],"name":"tests/purus/passing/prelude/Prelude.purs","start":[348,3]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[348,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[348,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":30,"type":{"annotation":[{"end":[348,87],"name":"tests/purus/passing/prelude/Prelude.purs","start":[348,24]},[]],"contents":[{"annotation":[{"end":[348,87],"name":"tests/purus/passing/prelude/Prelude.purs","start":[348,24]},[]],"contents":[{"annotation":[{"end":[348,53],"name":"tests/purus/passing/prelude/Prelude.purs","start":[348,51]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[348,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[348,25]},[]],"contents":[{"annotation":[{"end":[348,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[348,25]},[]],"contents":[{"annotation":[{"end":[348,29],"name":"tests/purus/passing/prelude/Prelude.purs","start":[348,27]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[348,26],"name":"tests/purus/passing/prelude/Prelude.purs","start":[348,25]},[]],"contents":{"kind":{"annotation":[{"end":[348,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[348,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[348,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[348,30]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[348,87],"name":"tests/purus/passing/prelude/Prelude.purs","start":[348,54]},[]],"contents":[{"annotation":[{"end":[348,87],"name":"tests/purus/passing/prelude/Prelude.purs","start":[348,54]},[]],"contents":[{"annotation":[{"end":[348,67],"name":"tests/purus/passing/prelude/Prelude.purs","start":[348,65]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[348,64],"name":"tests/purus/passing/prelude/Prelude.purs","start":[348,54]},[]],"contents":[{"annotation":[{"end":[348,62],"name":"tests/purus/passing/prelude/Prelude.purs","start":[348,54]},[]],"contents":[["Prim"],"Extended"],"tag":"TypeConstructor"},{"annotation":[{"end":[348,64],"name":"tests/purus/passing/prelude/Prelude.purs","start":[348,63]},[]],"contents":{"kind":{"annotation":[{"end":[348,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[348,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[348,87],"name":"tests/purus/passing/prelude/Prelude.purs","start":[348,68]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"serializeExtended","moduleName":["Prelude"]}},"annotation":{"meta":null,"sourceSpan":{"end":[382,60],"start":[382,41]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[382,60],"start":[382,59]}},"kind":"Var","type":{"annotation":[{"end":[380,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[380,25]},[]],"contents":[{"annotation":[{"end":[380,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[380,25]},[]],"contents":[{"annotation":[{"end":[380,29],"name":"tests/purus/passing/prelude/Prelude.purs","start":[380,27]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[380,26],"name":"tests/purus/passing/prelude/Prelude.purs","start":[380,25]},[]],"contents":{"kind":{"annotation":[{"end":[380,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[380,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[380,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[380,30]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"f1","sourcePos":[381,21]}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[382,62],"start":[382,41]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[382,62],"start":[382,61]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Extended"],"tag":"TypeConstructor"},{"annotation":[{"end":[380,66],"name":"tests/purus/passing/prelude/Prelude.purs","start":[380,65]},[]],"contents":{"kind":{"annotation":[{"end":[380,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[380,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},"value":{"identifier":"e","sourcePos":[381,35]}},"kind":"App"},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[382,88],"start":[382,25]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[382,82],"start":[382,65]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Unit"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"mkNilData","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[382,87],"start":[382,65]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[382,87],"start":[382,83]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Unit"],"tag":"TypeConstructor"},"value":{"identifier":"unit","moduleName":["Prim"]}},"kind":"App"},"kind":"App"},"kind":"App"},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[382,89],"start":[381,1]}},"kind":"Var","type":{"annotation":[{"end":[380,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[380,25]},[]],"contents":[{"annotation":[{"end":[380,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[380,25]},[]],"contents":[{"annotation":[{"end":[380,29],"name":"tests/purus/passing/prelude/Prelude.purs","start":[380,27]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[380,26],"name":"tests/purus/passing/prelude/Prelude.purs","start":[380,25]},[]],"contents":{"kind":{"annotation":[{"end":[380,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[380,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[380,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[380,30]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"f","sourcePos":[381,21]}},{"annotation":{"meta":null,"sourceSpan":{"end":[382,89],"start":[381,1]}},"kind":"Var","type":{"annotation":[{"end":[380,66],"name":"tests/purus/passing/prelude/Prelude.purs","start":[380,54]},[]],"contents":[{"annotation":[{"end":[380,64],"name":"tests/purus/passing/prelude/Prelude.purs","start":[380,54]},[]],"contents":[["Prim"],"UpperBound"],"tag":"TypeConstructor"},{"annotation":[{"end":[380,66],"name":"tests/purus/passing/prelude/Prelude.purs","start":[380,65]},[]],"contents":{"kind":{"annotation":[{"end":[380,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[380,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},"value":{"identifier":"v","sourcePos":[0,0]}}],"kind":"Case","type":{"annotation":[{"end":[380,89],"name":"tests/purus/passing/prelude/Prelude.purs","start":[380,70]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[380,66],"name":"tests/purus/passing/prelude/Prelude.purs","start":[380,54]},[]],"contents":[{"annotation":[{"end":[380,64],"name":"tests/purus/passing/prelude/Prelude.purs","start":[380,54]},[]],"contents":[["Prim"],"UpperBound"],"tag":"TypeConstructor"},{"annotation":[{"end":[380,66],"name":"tests/purus/passing/prelude/Prelude.purs","start":[380,65]},[]],"contents":{"kind":{"annotation":[{"end":[380,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[380,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[380,89],"name":"tests/purus/passing/prelude/Prelude.purs","start":[380,70]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"kind":"Abs","type":{"annotation":[{"end":[380,89],"name":"tests/purus/passing/prelude/Prelude.purs","start":[380,3]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[380,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[380,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":36,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[380,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[380,25]},[]],"contents":[{"annotation":[{"end":[380,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[380,25]},[]],"contents":[{"annotation":[{"end":[380,29],"name":"tests/purus/passing/prelude/Prelude.purs","start":[380,27]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[380,26],"name":"tests/purus/passing/prelude/Prelude.purs","start":[380,25]},[]],"contents":{"kind":{"annotation":[{"end":[380,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[380,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[380,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[380,30]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[380,89],"name":"tests/purus/passing/prelude/Prelude.purs","start":[380,54]},[]],"contents":[{"annotation":[{"end":[380,89],"name":"tests/purus/passing/prelude/Prelude.purs","start":[380,54]},[]],"contents":[{"annotation":[{"end":[380,69],"name":"tests/purus/passing/prelude/Prelude.purs","start":[380,67]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[380,66],"name":"tests/purus/passing/prelude/Prelude.purs","start":[380,54]},[]],"contents":[{"annotation":[{"end":[380,64],"name":"tests/purus/passing/prelude/Prelude.purs","start":[380,54]},[]],"contents":[["Prim"],"UpperBound"],"tag":"TypeConstructor"},{"annotation":[{"end":[380,66],"name":"tests/purus/passing/prelude/Prelude.purs","start":[380,65]},[]],"contents":{"kind":{"annotation":[{"end":[380,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[380,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[380,89],"name":"tests/purus/passing/prelude/Prelude.purs","start":[380,70]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"identifier":"serializeUpperBound"},{"annotation":{"meta":null,"sourceSpan":{"end":[331,87],"start":[330,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[332,20],"start":[332,19]}},"argument":"f","body":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"argument":"v","body":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[332,20],"start":[332,19]}},"binderType":"VarBinder","identifier":"f1","type":{"annotation":[{"end":[331,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[331,25]},[]],"contents":[{"annotation":[{"end":[331,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[331,25]},[]],"contents":[{"annotation":[{"end":[331,29],"name":"tests/purus/passing/prelude/Prelude.purs","start":[331,27]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[331,26],"name":"tests/purus/passing/prelude/Prelude.purs","start":[331,25]},[]],"contents":{"kind":{"annotation":[{"end":[331,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[331,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[331,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[331,30]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},{"annotation":{"meta":{"metaType":"IsNewtype"},"sourceSpan":{"end":[332,34],"start":[332,22]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[332,34],"start":[332,31]}},"binderType":"VarBinder","identifier":"rec","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["from",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"LowerBound"],"tag":"TypeConstructor"},{"annotation":[{"end":[331,64],"name":"tests/purus/passing/prelude/Prelude.purs","start":[331,63]},[]],"contents":{"kind":{"annotation":[{"end":[331,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[331,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["to",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"UpperBound"],"tag":"TypeConstructor"},{"annotation":[{"end":[331,64],"name":"tests/purus/passing/prelude/Prelude.purs","start":[331,63]},[]],"contents":{"kind":{"annotation":[{"end":[331,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[331,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"tag":"REmpty"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"TypeApp"}}],"constructorName":{"identifier":"Interval","moduleName":["Prim"]},"typeName":{"identifier":"Interval","moduleName":["Prim"]}}],"expression":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[333,21],"start":[333,3]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"constrData","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[333,23],"start":[333,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[333,23],"start":[333,22]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"literalType":"IntLiteral","value":0}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[335,48],"start":[333,3]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[333,39],"start":[333,25]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"mkCons","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[333,72],"start":[333,25]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[333,60],"start":[333,41]}},"kind":"Var","type":{"annotation":[{"end":[367,89],"name":"tests/purus/passing/prelude/Prelude.purs","start":[367,3]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[367,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[367,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":33,"type":{"annotation":[{"end":[367,89],"name":"tests/purus/passing/prelude/Prelude.purs","start":[367,24]},[]],"contents":[{"annotation":[{"end":[367,89],"name":"tests/purus/passing/prelude/Prelude.purs","start":[367,24]},[]],"contents":[{"annotation":[{"end":[367,53],"name":"tests/purus/passing/prelude/Prelude.purs","start":[367,51]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[367,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[367,25]},[]],"contents":[{"annotation":[{"end":[367,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[367,25]},[]],"contents":[{"annotation":[{"end":[367,29],"name":"tests/purus/passing/prelude/Prelude.purs","start":[367,27]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[367,26],"name":"tests/purus/passing/prelude/Prelude.purs","start":[367,25]},[]],"contents":{"kind":{"annotation":[{"end":[367,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[367,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[367,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[367,30]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[367,89],"name":"tests/purus/passing/prelude/Prelude.purs","start":[367,54]},[]],"contents":[{"annotation":[{"end":[367,89],"name":"tests/purus/passing/prelude/Prelude.purs","start":[367,54]},[]],"contents":[{"annotation":[{"end":[367,69],"name":"tests/purus/passing/prelude/Prelude.purs","start":[367,67]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[367,66],"name":"tests/purus/passing/prelude/Prelude.purs","start":[367,54]},[]],"contents":[{"annotation":[{"end":[367,64],"name":"tests/purus/passing/prelude/Prelude.purs","start":[367,54]},[]],"contents":[["Prim"],"LowerBound"],"tag":"TypeConstructor"},{"annotation":[{"end":[367,66],"name":"tests/purus/passing/prelude/Prelude.purs","start":[367,65]},[]],"contents":{"kind":{"annotation":[{"end":[367,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[367,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[367,89],"name":"tests/purus/passing/prelude/Prelude.purs","start":[367,70]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"serializeLowerBound","moduleName":["Prelude"]}},"annotation":{"meta":null,"sourceSpan":{"end":[333,62],"start":[333,41]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[333,62],"start":[333,61]}},"kind":"Var","type":{"annotation":[{"end":[331,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[331,25]},[]],"contents":[{"annotation":[{"end":[331,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[331,25]},[]],"contents":[{"annotation":[{"end":[331,29],"name":"tests/purus/passing/prelude/Prelude.purs","start":[331,27]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[331,26],"name":"tests/purus/passing/prelude/Prelude.purs","start":[331,25]},[]],"contents":{"kind":{"annotation":[{"end":[331,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[331,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[331,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[331,30]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"f1","sourcePos":[332,19]}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[333,71],"start":[333,41]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[333,71],"start":[333,63]}},"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[333,66],"start":[333,63]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["from",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"LowerBound"],"tag":"TypeConstructor"},{"annotation":[{"end":[331,64],"name":"tests/purus/passing/prelude/Prelude.purs","start":[331,63]},[]],"contents":{"kind":{"annotation":[{"end":[331,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[331,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["to",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"UpperBound"],"tag":"TypeConstructor"},{"annotation":[{"end":[331,64],"name":"tests/purus/passing/prelude/Prelude.purs","start":[331,63]},[]],"contents":{"kind":{"annotation":[{"end":[331,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[331,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"tag":"REmpty"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"TypeApp"},"value":{"identifier":"rec","sourcePos":[332,31]}},"fieldName":"from","kind":"Accessor","type":{"annotation":[{"end":[367,66],"name":"tests/purus/passing/prelude/Prelude.purs","start":[367,54]},[]],"contents":[{"annotation":[{"end":[367,64],"name":"tests/purus/passing/prelude/Prelude.purs","start":[367,54]},[]],"contents":[["Prim"],"LowerBound"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["a",{"annotation":[{"end":[331,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[331,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},11,40],"tag":"Skolem"}],"tag":"TypeApp"}},"kind":"App"},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[335,47],"start":[333,25]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[334,34],"start":[334,20]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"mkCons","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[334,65],"start":[334,20]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[334,55],"start":[334,36]}},"kind":"Var","type":{"annotation":[{"end":[380,89],"name":"tests/purus/passing/prelude/Prelude.purs","start":[380,3]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[380,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[380,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":36,"type":{"annotation":[{"end":[380,89],"name":"tests/purus/passing/prelude/Prelude.purs","start":[380,24]},[]],"contents":[{"annotation":[{"end":[380,89],"name":"tests/purus/passing/prelude/Prelude.purs","start":[380,24]},[]],"contents":[{"annotation":[{"end":[380,53],"name":"tests/purus/passing/prelude/Prelude.purs","start":[380,51]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[380,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[380,25]},[]],"contents":[{"annotation":[{"end":[380,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[380,25]},[]],"contents":[{"annotation":[{"end":[380,29],"name":"tests/purus/passing/prelude/Prelude.purs","start":[380,27]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[380,26],"name":"tests/purus/passing/prelude/Prelude.purs","start":[380,25]},[]],"contents":{"kind":{"annotation":[{"end":[380,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[380,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[380,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[380,30]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[380,89],"name":"tests/purus/passing/prelude/Prelude.purs","start":[380,54]},[]],"contents":[{"annotation":[{"end":[380,89],"name":"tests/purus/passing/prelude/Prelude.purs","start":[380,54]},[]],"contents":[{"annotation":[{"end":[380,69],"name":"tests/purus/passing/prelude/Prelude.purs","start":[380,67]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[380,66],"name":"tests/purus/passing/prelude/Prelude.purs","start":[380,54]},[]],"contents":[{"annotation":[{"end":[380,64],"name":"tests/purus/passing/prelude/Prelude.purs","start":[380,54]},[]],"contents":[["Prim"],"UpperBound"],"tag":"TypeConstructor"},{"annotation":[{"end":[380,66],"name":"tests/purus/passing/prelude/Prelude.purs","start":[380,65]},[]],"contents":{"kind":{"annotation":[{"end":[380,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[380,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[380,89],"name":"tests/purus/passing/prelude/Prelude.purs","start":[380,70]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"serializeUpperBound","moduleName":["Prelude"]}},"annotation":{"meta":null,"sourceSpan":{"end":[334,57],"start":[334,36]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[334,57],"start":[334,56]}},"kind":"Var","type":{"annotation":[{"end":[331,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[331,25]},[]],"contents":[{"annotation":[{"end":[331,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[331,25]},[]],"contents":[{"annotation":[{"end":[331,29],"name":"tests/purus/passing/prelude/Prelude.purs","start":[331,27]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[331,26],"name":"tests/purus/passing/prelude/Prelude.purs","start":[331,25]},[]],"contents":{"kind":{"annotation":[{"end":[331,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[331,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[331,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[331,30]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"f1","sourcePos":[332,19]}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[334,64],"start":[334,36]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[334,64],"start":[334,58]}},"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[334,61],"start":[334,58]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["from",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"LowerBound"],"tag":"TypeConstructor"},{"annotation":[{"end":[331,64],"name":"tests/purus/passing/prelude/Prelude.purs","start":[331,63]},[]],"contents":{"kind":{"annotation":[{"end":[331,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[331,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["to",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"UpperBound"],"tag":"TypeConstructor"},{"annotation":[{"end":[331,64],"name":"tests/purus/passing/prelude/Prelude.purs","start":[331,63]},[]],"contents":{"kind":{"annotation":[{"end":[331,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[331,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"tag":"REmpty"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"TypeApp"},"value":{"identifier":"rec","sourcePos":[332,31]}},"fieldName":"to","kind":"Accessor","type":{"annotation":[{"end":[380,66],"name":"tests/purus/passing/prelude/Prelude.purs","start":[380,54]},[]],"contents":[{"annotation":[{"end":[380,64],"name":"tests/purus/passing/prelude/Prelude.purs","start":[380,54]},[]],"contents":[["Prim"],"UpperBound"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["a",{"annotation":[{"end":[331,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[331,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},11,40],"tag":"Skolem"}],"tag":"TypeApp"}},"kind":"App"},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[335,46],"start":[334,20]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[335,40],"start":[335,23]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Unit"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"mkNilData","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[335,45],"start":[335,23]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[335,45],"start":[335,41]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Unit"],"tag":"TypeConstructor"},"value":{"identifier":"unit","moduleName":["Prim"]}},"kind":"App"},"kind":"App"},"kind":"App"},"kind":"App"},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[335,48],"start":[332,1]}},"kind":"Var","type":{"annotation":[{"end":[331,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[331,25]},[]],"contents":[{"annotation":[{"end":[331,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[331,25]},[]],"contents":[{"annotation":[{"end":[331,29],"name":"tests/purus/passing/prelude/Prelude.purs","start":[331,27]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[331,26],"name":"tests/purus/passing/prelude/Prelude.purs","start":[331,25]},[]],"contents":{"kind":{"annotation":[{"end":[331,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[331,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[331,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[331,30]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"f","sourcePos":[332,19]}},{"annotation":{"meta":null,"sourceSpan":{"end":[335,48],"start":[332,1]}},"kind":"Var","type":{"annotation":[{"end":[331,64],"name":"tests/purus/passing/prelude/Prelude.purs","start":[331,54]},[]],"contents":[{"annotation":[{"end":[331,62],"name":"tests/purus/passing/prelude/Prelude.purs","start":[331,54]},[]],"contents":[["Prim"],"Interval"],"tag":"TypeConstructor"},{"annotation":[{"end":[331,64],"name":"tests/purus/passing/prelude/Prelude.purs","start":[331,63]},[]],"contents":{"kind":{"annotation":[{"end":[331,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[331,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},"value":{"identifier":"v","sourcePos":[0,0]}}],"kind":"Case","type":{"annotation":[{"end":[331,87],"name":"tests/purus/passing/prelude/Prelude.purs","start":[331,68]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[331,64],"name":"tests/purus/passing/prelude/Prelude.purs","start":[331,54]},[]],"contents":[{"annotation":[{"end":[331,62],"name":"tests/purus/passing/prelude/Prelude.purs","start":[331,54]},[]],"contents":[["Prim"],"Interval"],"tag":"TypeConstructor"},{"annotation":[{"end":[331,64],"name":"tests/purus/passing/prelude/Prelude.purs","start":[331,63]},[]],"contents":{"kind":{"annotation":[{"end":[331,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[331,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[331,87],"name":"tests/purus/passing/prelude/Prelude.purs","start":[331,68]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"kind":"Abs","type":{"annotation":[{"end":[331,87],"name":"tests/purus/passing/prelude/Prelude.purs","start":[331,3]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[331,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[331,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":39,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[331,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[331,25]},[]],"contents":[{"annotation":[{"end":[331,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[331,25]},[]],"contents":[{"annotation":[{"end":[331,29],"name":"tests/purus/passing/prelude/Prelude.purs","start":[331,27]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[331,26],"name":"tests/purus/passing/prelude/Prelude.purs","start":[331,25]},[]],"contents":{"kind":{"annotation":[{"end":[331,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[331,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[331,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[331,30]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[331,87],"name":"tests/purus/passing/prelude/Prelude.purs","start":[331,54]},[]],"contents":[{"annotation":[{"end":[331,87],"name":"tests/purus/passing/prelude/Prelude.purs","start":[331,54]},[]],"contents":[{"annotation":[{"end":[331,67],"name":"tests/purus/passing/prelude/Prelude.purs","start":[331,65]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[331,64],"name":"tests/purus/passing/prelude/Prelude.purs","start":[331,54]},[]],"contents":[{"annotation":[{"end":[331,62],"name":"tests/purus/passing/prelude/Prelude.purs","start":[331,54]},[]],"contents":[["Prim"],"Interval"],"tag":"TypeConstructor"},{"annotation":[{"end":[331,64],"name":"tests/purus/passing/prelude/Prelude.purs","start":[331,63]},[]],"contents":{"kind":{"annotation":[{"end":[331,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[331,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[331,87],"name":"tests/purus/passing/prelude/Prelude.purs","start":[331,68]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"identifier":"serializeInterval"},{"annotation":{"meta":null,"sourceSpan":{"end":[446,47],"start":[446,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"argument":"v","body":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":{"metaType":"IsNewtype"},"sourceSpan":{"end":[447,26],"start":[447,17]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[447,26],"start":[447,23]}},"binderType":"VarBinder","identifier":"dat","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}}],"constructorName":{"identifier":"Datum","moduleName":["Prim"]},"typeName":{"identifier":"Datum","moduleName":["Prim"]}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[447,33],"start":[447,30]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"},"value":{"identifier":"dat","sourcePos":[447,23]}},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[447,33],"start":[447,1]}},"kind":"Var","type":{"annotation":[{"end":[446,24],"name":"tests/purus/passing/prelude/Prelude.purs","start":[446,19]},[]],"contents":[["Prim"],"Datum"],"tag":"TypeConstructor"},"value":{"identifier":"v","sourcePos":[0,0]}}],"kind":"Case","type":{"annotation":[{"end":[446,47],"name":"tests/purus/passing/prelude/Prelude.purs","start":[446,28]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[446,24],"name":"tests/purus/passing/prelude/Prelude.purs","start":[446,19]},[]],"contents":[["Prim"],"Datum"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[446,47],"name":"tests/purus/passing/prelude/Prelude.purs","start":[446,28]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"identifier":"serializeDatum"},{"annotation":{"meta":null,"sourceSpan":{"end":[464,72],"start":[464,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[465,36],"start":[465,23]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinByteString"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"bData","moduleName":["Builtin"]}},"identifier":"serializeByteString"},{"annotation":{"meta":null,"sourceSpan":{"end":[147,65],"start":[147,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"argument":"v","body":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":{"metaType":"IsNewtype"},"sourceSpan":{"end":[148,43],"start":[148,26]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[148,43],"start":[148,41]}},"binderType":"VarBinder","identifier":"bs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinByteString"],"tag":"TypeConstructor"}}],"constructorName":{"identifier":"CurrencySymbol","moduleName":["Prim"]},"typeName":{"identifier":"CurrencySymbol","moduleName":["Prim"]}}],"expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[148,66],"start":[148,47]}},"kind":"Var","type":{"annotation":[{"end":[464,72],"name":"tests/purus/passing/prelude/Prelude.purs","start":[464,24]},[]],"contents":[{"annotation":[{"end":[464,72],"name":"tests/purus/passing/prelude/Prelude.purs","start":[464,24]},[]],"contents":[{"annotation":[{"end":[464,52],"name":"tests/purus/passing/prelude/Prelude.purs","start":[464,50]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[464,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[464,24]},[]],"contents":[["Builtin"],"BuiltinByteString"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[464,72],"name":"tests/purus/passing/prelude/Prelude.purs","start":[464,53]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"serializeByteString","moduleName":["Prelude"]}},"annotation":{"meta":null,"sourceSpan":{"end":[148,69],"start":[148,47]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[148,69],"start":[148,67]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinByteString"],"tag":"TypeConstructor"},"value":{"identifier":"bs","sourcePos":[148,41]}},"kind":"App"},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[148,69],"start":[148,1]}},"kind":"Var","type":{"annotation":[{"end":[147,42],"name":"tests/purus/passing/prelude/Prelude.purs","start":[147,28]},[]],"contents":[["Prim"],"CurrencySymbol"],"tag":"TypeConstructor"},"value":{"identifier":"v","sourcePos":[0,0]}}],"kind":"Case","type":{"annotation":[{"end":[147,65],"name":"tests/purus/passing/prelude/Prelude.purs","start":[147,46]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[147,42],"name":"tests/purus/passing/prelude/Prelude.purs","start":[147,28]},[]],"contents":[["Prim"],"CurrencySymbol"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[147,65],"name":"tests/purus/passing/prelude/Prelude.purs","start":[147,46]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"identifier":"serializeCurrencySymbol"},{"annotation":{"meta":null,"sourceSpan":{"end":[452,55],"start":[452,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"argument":"v","body":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":{"metaType":"IsNewtype"},"sourceSpan":{"end":[453,33],"start":[453,21]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[453,33],"start":[453,31]}},"binderType":"VarBinder","identifier":"bs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinByteString"],"tag":"TypeConstructor"}}],"constructorName":{"identifier":"DatumHash","moduleName":["Prim"]},"typeName":{"identifier":"DatumHash","moduleName":["Prim"]}}],"expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[453,56],"start":[453,37]}},"kind":"Var","type":{"annotation":[{"end":[464,72],"name":"tests/purus/passing/prelude/Prelude.purs","start":[464,24]},[]],"contents":[{"annotation":[{"end":[464,72],"name":"tests/purus/passing/prelude/Prelude.purs","start":[464,24]},[]],"contents":[{"annotation":[{"end":[464,52],"name":"tests/purus/passing/prelude/Prelude.purs","start":[464,50]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[464,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[464,24]},[]],"contents":[["Builtin"],"BuiltinByteString"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[464,72],"name":"tests/purus/passing/prelude/Prelude.purs","start":[464,53]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"serializeByteString","moduleName":["Prelude"]}},"annotation":{"meta":null,"sourceSpan":{"end":[453,59],"start":[453,37]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[453,59],"start":[453,57]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinByteString"],"tag":"TypeConstructor"},"value":{"identifier":"bs","sourcePos":[453,31]}},"kind":"App"},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[453,59],"start":[453,1]}},"kind":"Var","type":{"annotation":[{"end":[452,32],"name":"tests/purus/passing/prelude/Prelude.purs","start":[452,23]},[]],"contents":[["Prim"],"DatumHash"],"tag":"TypeConstructor"},"value":{"identifier":"v","sourcePos":[0,0]}}],"kind":"Case","type":{"annotation":[{"end":[452,55],"name":"tests/purus/passing/prelude/Prelude.purs","start":[452,36]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[452,32],"name":"tests/purus/passing/prelude/Prelude.purs","start":[452,23]},[]],"contents":[["Prim"],"DatumHash"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[452,55],"name":"tests/purus/passing/prelude/Prelude.purs","start":[452,36]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"identifier":"serializeDatumHash"},{"annotation":{"meta":null,"sourceSpan":{"end":[312,59],"start":[312,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[316,101],"start":[313,1]}},"argument":"od","body":{"annotation":{"meta":null,"sourceSpan":{"end":[316,101],"start":[313,27]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[314,16],"start":[314,3]}},"binderType":"ConstructorBinder","binders":[],"constructorName":{"identifier":"NoOutputDatum","moduleName":["Prim"]},"typeName":{"identifier":"OutputDatum","moduleName":["Prim"]}}],"expression":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[314,38],"start":[314,20]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"constrData","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[314,40],"start":[314,20]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[314,40],"start":[314,39]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"literalType":"IntLiteral","value":0}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[314,65],"start":[314,20]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[314,59],"start":[314,42]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Unit"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"mkNilData","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[314,64],"start":[314,42]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[314,64],"start":[314,60]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Unit"],"tag":"TypeConstructor"},"value":{"identifier":"unit","moduleName":["Prim"]}},"kind":"App"},"kind":"App"},"isGuarded":false},{"binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":["$__unused"],"metaType":"IsConstructor"},"sourceSpan":{"end":[315,20],"start":[315,3]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[315,20],"start":[315,19]}},"binderType":"VarBinder","identifier":"h","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"DatumHash"],"tag":"TypeConstructor"}}],"constructorName":{"identifier":"OutputDatumHash","moduleName":["Prim"]},"typeName":{"identifier":"OutputDatum","moduleName":["Prim"]}}],"expression":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[315,42],"start":[315,24]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"constrData","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[315,44],"start":[315,24]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[315,44],"start":[315,43]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"literalType":"IntLiteral","value":1}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[315,109],"start":[315,24]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[315,60],"start":[315,46]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"mkCons","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[315,83],"start":[315,46]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[315,80],"start":[315,62]}},"kind":"Var","type":{"annotation":[{"end":[452,55],"name":"tests/purus/passing/prelude/Prelude.purs","start":[452,23]},[]],"contents":[{"annotation":[{"end":[452,55],"name":"tests/purus/passing/prelude/Prelude.purs","start":[452,23]},[]],"contents":[{"annotation":[{"end":[452,35],"name":"tests/purus/passing/prelude/Prelude.purs","start":[452,33]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[452,32],"name":"tests/purus/passing/prelude/Prelude.purs","start":[452,23]},[]],"contents":[["Prim"],"DatumHash"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[452,55],"name":"tests/purus/passing/prelude/Prelude.purs","start":[452,36]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"serializeDatumHash","moduleName":["Prelude"]}},"annotation":{"meta":null,"sourceSpan":{"end":[315,82],"start":[315,62]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[315,82],"start":[315,81]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"DatumHash"],"tag":"TypeConstructor"},"value":{"identifier":"h","sourcePos":[315,19]}},"kind":"App"},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[315,108],"start":[315,46]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[315,102],"start":[315,85]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Unit"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"mkNilData","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[315,107],"start":[315,85]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[315,107],"start":[315,103]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Unit"],"tag":"TypeConstructor"},"value":{"identifier":"unit","moduleName":["Prim"]}},"kind":"App"},"kind":"App"},"kind":"App"},"isGuarded":false},{"binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":["$__unused"],"metaType":"IsConstructor"},"sourceSpan":{"end":[316,16],"start":[316,3]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[316,16],"start":[316,15]}},"binderType":"VarBinder","identifier":"d","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Datum"],"tag":"TypeConstructor"}}],"constructorName":{"identifier":"OutputDatum","moduleName":["Prim"]},"typeName":{"identifier":"OutputDatum","moduleName":["Prim"]}}],"expression":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[316,38],"start":[316,20]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"constrData","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[316,40],"start":[316,20]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[316,40],"start":[316,39]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"literalType":"IntLiteral","value":2}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[316,101],"start":[316,20]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[316,56],"start":[316,42]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"mkCons","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[316,75],"start":[316,42]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[316,72],"start":[316,58]}},"kind":"Var","type":{"annotation":[{"end":[446,47],"name":"tests/purus/passing/prelude/Prelude.purs","start":[446,19]},[]],"contents":[{"annotation":[{"end":[446,47],"name":"tests/purus/passing/prelude/Prelude.purs","start":[446,19]},[]],"contents":[{"annotation":[{"end":[446,27],"name":"tests/purus/passing/prelude/Prelude.purs","start":[446,25]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[446,24],"name":"tests/purus/passing/prelude/Prelude.purs","start":[446,19]},[]],"contents":[["Prim"],"Datum"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[446,47],"name":"tests/purus/passing/prelude/Prelude.purs","start":[446,28]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"serializeDatum","moduleName":["Prelude"]}},"annotation":{"meta":null,"sourceSpan":{"end":[316,74],"start":[316,58]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[316,74],"start":[316,73]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Datum"],"tag":"TypeConstructor"},"value":{"identifier":"d","sourcePos":[316,15]}},"kind":"App"},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[316,100],"start":[316,42]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[316,94],"start":[316,77]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Unit"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"mkNilData","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[316,99],"start":[316,77]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[316,99],"start":[316,95]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Unit"],"tag":"TypeConstructor"},"value":{"identifier":"unit","moduleName":["Prim"]}},"kind":"App"},"kind":"App"},"kind":"App"},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[313,34],"start":[313,32]}},"kind":"Var","type":{"annotation":[{"end":[312,36],"name":"tests/purus/passing/prelude/Prelude.purs","start":[312,25]},[]],"contents":[["Prim"],"OutputDatum"],"tag":"TypeConstructor"},"value":{"identifier":"od","sourcePos":[313,1]}}],"kind":"Case","type":{"annotation":[{"end":[312,59],"name":"tests/purus/passing/prelude/Prelude.purs","start":[312,40]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[312,36],"name":"tests/purus/passing/prelude/Prelude.purs","start":[312,25]},[]],"contents":[["Prim"],"OutputDatum"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[312,59],"name":"tests/purus/passing/prelude/Prelude.purs","start":[312,40]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"identifier":"serializeOutputDatum"},{"annotation":{"meta":null,"sourceSpan":{"end":[186,57],"start":[186,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"argument":"v","body":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":{"metaType":"IsNewtype"},"sourceSpan":{"end":[187,35],"start":[187,22]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[187,35],"start":[187,33]}},"binderType":"VarBinder","identifier":"bs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinByteString"],"tag":"TypeConstructor"}}],"constructorName":{"identifier":"PubKeyHash","moduleName":["Prim"]},"typeName":{"identifier":"PubKeyHash","moduleName":["Prim"]}}],"expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[188,22],"start":[188,3]}},"kind":"Var","type":{"annotation":[{"end":[464,72],"name":"tests/purus/passing/prelude/Prelude.purs","start":[464,24]},[]],"contents":[{"annotation":[{"end":[464,72],"name":"tests/purus/passing/prelude/Prelude.purs","start":[464,24]},[]],"contents":[{"annotation":[{"end":[464,52],"name":"tests/purus/passing/prelude/Prelude.purs","start":[464,50]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[464,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[464,24]},[]],"contents":[["Builtin"],"BuiltinByteString"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[464,72],"name":"tests/purus/passing/prelude/Prelude.purs","start":[464,53]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"serializeByteString","moduleName":["Prelude"]}},"annotation":{"meta":null,"sourceSpan":{"end":[188,25],"start":[188,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[188,25],"start":[188,23]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinByteString"],"tag":"TypeConstructor"},"value":{"identifier":"bs","sourcePos":[187,33]}},"kind":"App"},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[188,25],"start":[187,1]}},"kind":"Var","type":{"annotation":[{"end":[186,34],"name":"tests/purus/passing/prelude/Prelude.purs","start":[186,24]},[]],"contents":[["Prim"],"PubKeyHash"],"tag":"TypeConstructor"},"value":{"identifier":"v","sourcePos":[0,0]}}],"kind":"Case","type":{"annotation":[{"end":[186,57],"name":"tests/purus/passing/prelude/Prelude.purs","start":[186,38]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[186,34],"name":"tests/purus/passing/prelude/Prelude.purs","start":[186,24]},[]],"contents":[["Prim"],"PubKeyHash"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[186,57],"name":"tests/purus/passing/prelude/Prelude.purs","start":[186,38]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"identifier":"serializePubKeyHash"},{"annotation":{"meta":null,"sourceSpan":{"end":[440,61],"start":[440,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"argument":"v","body":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":{"metaType":"IsNewtype"},"sourceSpan":{"end":[441,39],"start":[441,24]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[441,39],"start":[441,37]}},"binderType":"VarBinder","identifier":"bs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinByteString"],"tag":"TypeConstructor"}}],"constructorName":{"identifier":"RedeemerHash","moduleName":["Prim"]},"typeName":{"identifier":"RedeemerHash","moduleName":["Prim"]}}],"expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[441,62],"start":[441,43]}},"kind":"Var","type":{"annotation":[{"end":[464,72],"name":"tests/purus/passing/prelude/Prelude.purs","start":[464,24]},[]],"contents":[{"annotation":[{"end":[464,72],"name":"tests/purus/passing/prelude/Prelude.purs","start":[464,24]},[]],"contents":[{"annotation":[{"end":[464,52],"name":"tests/purus/passing/prelude/Prelude.purs","start":[464,50]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[464,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[464,24]},[]],"contents":[["Builtin"],"BuiltinByteString"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[464,72],"name":"tests/purus/passing/prelude/Prelude.purs","start":[464,53]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"serializeByteString","moduleName":["Prelude"]}},"annotation":{"meta":null,"sourceSpan":{"end":[441,65],"start":[441,43]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[441,65],"start":[441,63]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinByteString"],"tag":"TypeConstructor"},"value":{"identifier":"bs","sourcePos":[441,37]}},"kind":"App"},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[441,65],"start":[441,1]}},"kind":"Var","type":{"annotation":[{"end":[440,38],"name":"tests/purus/passing/prelude/Prelude.purs","start":[440,26]},[]],"contents":[["Prim"],"RedeemerHash"],"tag":"TypeConstructor"},"value":{"identifier":"v","sourcePos":[0,0]}}],"kind":"Case","type":{"annotation":[{"end":[440,61],"name":"tests/purus/passing/prelude/Prelude.purs","start":[440,42]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[440,38],"name":"tests/purus/passing/prelude/Prelude.purs","start":[440,26]},[]],"contents":[["Prim"],"RedeemerHash"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[440,61],"name":"tests/purus/passing/prelude/Prelude.purs","start":[440,42]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"identifier":"serializeRedeemerHash"},{"annotation":{"meta":null,"sourceSpan":{"end":[428,57],"start":[428,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"argument":"v","body":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":{"metaType":"IsNewtype"},"sourceSpan":{"end":[429,36],"start":[429,22]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[429,36],"start":[429,33]}},"binderType":"VarBinder","identifier":"dat","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinByteString"],"tag":"TypeConstructor"}}],"constructorName":{"identifier":"ScriptHash","moduleName":["Prim"]},"typeName":{"identifier":"ScriptHash","moduleName":["Prim"]}}],"expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[429,59],"start":[429,40]}},"kind":"Var","type":{"annotation":[{"end":[464,72],"name":"tests/purus/passing/prelude/Prelude.purs","start":[464,24]},[]],"contents":[{"annotation":[{"end":[464,72],"name":"tests/purus/passing/prelude/Prelude.purs","start":[464,24]},[]],"contents":[{"annotation":[{"end":[464,52],"name":"tests/purus/passing/prelude/Prelude.purs","start":[464,50]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[464,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[464,24]},[]],"contents":[["Builtin"],"BuiltinByteString"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[464,72],"name":"tests/purus/passing/prelude/Prelude.purs","start":[464,53]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"serializeByteString","moduleName":["Prelude"]}},"annotation":{"meta":null,"sourceSpan":{"end":[429,63],"start":[429,40]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[429,63],"start":[429,60]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinByteString"],"tag":"TypeConstructor"},"value":{"identifier":"dat","sourcePos":[429,33]}},"kind":"App"},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[429,63],"start":[429,1]}},"kind":"Var","type":{"annotation":[{"end":[428,34],"name":"tests/purus/passing/prelude/Prelude.purs","start":[428,24]},[]],"contents":[["Prim"],"ScriptHash"],"tag":"TypeConstructor"},"value":{"identifier":"v","sourcePos":[0,0]}}],"kind":"Case","type":{"annotation":[{"end":[428,57],"name":"tests/purus/passing/prelude/Prelude.purs","start":[428,38]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[428,34],"name":"tests/purus/passing/prelude/Prelude.purs","start":[428,24]},[]],"contents":[["Prim"],"ScriptHash"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[428,57],"name":"tests/purus/passing/prelude/Prelude.purs","start":[428,38]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"identifier":"serializeScriptHash"},{"annotation":{"meta":null,"sourceSpan":{"end":[124,57],"start":[124,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[127,113],"start":[125,1]}},"argument":"c","body":{"annotation":{"meta":null,"sourceSpan":{"end":[127,113],"start":[125,25]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":["$__unused"],"metaType":"IsConstructor"},"sourceSpan":{"end":[126,23],"start":[126,3]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[126,23],"start":[126,20]}},"binderType":"VarBinder","identifier":"pkh","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"PubKeyHash"],"tag":"TypeConstructor"}}],"constructorName":{"identifier":"PubKeyCredential","moduleName":["Prim"]},"typeName":{"identifier":"Credential","moduleName":["Prim"]}}],"expression":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[126,45],"start":[126,27]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"constrData","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[126,47],"start":[126,27]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[126,47],"start":[126,46]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"literalType":"IntLiteral","value":0}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[126,115],"start":[126,27]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[126,63],"start":[126,49]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"mkCons","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[126,89],"start":[126,49]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[126,84],"start":[126,65]}},"kind":"Var","type":{"annotation":[{"end":[186,57],"name":"tests/purus/passing/prelude/Prelude.purs","start":[186,24]},[]],"contents":[{"annotation":[{"end":[186,57],"name":"tests/purus/passing/prelude/Prelude.purs","start":[186,24]},[]],"contents":[{"annotation":[{"end":[186,37],"name":"tests/purus/passing/prelude/Prelude.purs","start":[186,35]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[186,34],"name":"tests/purus/passing/prelude/Prelude.purs","start":[186,24]},[]],"contents":[["Prim"],"PubKeyHash"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[186,57],"name":"tests/purus/passing/prelude/Prelude.purs","start":[186,38]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"serializePubKeyHash","moduleName":["Prelude"]}},"annotation":{"meta":null,"sourceSpan":{"end":[126,88],"start":[126,65]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[126,88],"start":[126,85]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"PubKeyHash"],"tag":"TypeConstructor"},"value":{"identifier":"pkh","sourcePos":[126,20]}},"kind":"App"},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[126,114],"start":[126,49]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[126,108],"start":[126,91]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Unit"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"mkNilData","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[126,113],"start":[126,91]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[126,113],"start":[126,109]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Unit"],"tag":"TypeConstructor"},"value":{"identifier":"unit","moduleName":["Prim"]}},"kind":"App"},"kind":"App"},"kind":"App"},"isGuarded":false},{"binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":["$__unused"],"metaType":"IsConstructor"},"sourceSpan":{"end":[127,22],"start":[127,3]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[127,22],"start":[127,20]}},"binderType":"VarBinder","identifier":"sh","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"ScriptHash"],"tag":"TypeConstructor"}}],"constructorName":{"identifier":"ScriptCredential","moduleName":["Prim"]},"typeName":{"identifier":"Credential","moduleName":["Prim"]}}],"expression":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[127,44],"start":[127,26]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"constrData","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[127,46],"start":[127,26]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[127,46],"start":[127,45]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"literalType":"IntLiteral","value":1}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[127,113],"start":[127,26]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[127,62],"start":[127,48]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"mkCons","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[127,87],"start":[127,48]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[127,83],"start":[127,64]}},"kind":"Var","type":{"annotation":[{"end":[428,57],"name":"tests/purus/passing/prelude/Prelude.purs","start":[428,24]},[]],"contents":[{"annotation":[{"end":[428,57],"name":"tests/purus/passing/prelude/Prelude.purs","start":[428,24]},[]],"contents":[{"annotation":[{"end":[428,37],"name":"tests/purus/passing/prelude/Prelude.purs","start":[428,35]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[428,34],"name":"tests/purus/passing/prelude/Prelude.purs","start":[428,24]},[]],"contents":[["Prim"],"ScriptHash"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[428,57],"name":"tests/purus/passing/prelude/Prelude.purs","start":[428,38]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"serializeScriptHash","moduleName":["Prelude"]}},"annotation":{"meta":null,"sourceSpan":{"end":[127,86],"start":[127,64]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[127,86],"start":[127,84]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"ScriptHash"],"tag":"TypeConstructor"},"value":{"identifier":"sh","sourcePos":[127,20]}},"kind":"App"},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[127,112],"start":[127,48]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[127,106],"start":[127,89]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Unit"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"mkNilData","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[127,111],"start":[127,89]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[127,111],"start":[127,107]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Unit"],"tag":"TypeConstructor"},"value":{"identifier":"unit","moduleName":["Prim"]}},"kind":"App"},"kind":"App"},"kind":"App"},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[125,31],"start":[125,30]}},"kind":"Var","type":{"annotation":[{"end":[124,34],"name":"tests/purus/passing/prelude/Prelude.purs","start":[124,24]},[]],"contents":[["Prim"],"Credential"],"tag":"TypeConstructor"},"value":{"identifier":"c","sourcePos":[125,1]}}],"kind":"Case","type":{"annotation":[{"end":[124,57],"name":"tests/purus/passing/prelude/Prelude.purs","start":[124,38]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[124,34],"name":"tests/purus/passing/prelude/Prelude.purs","start":[124,24]},[]],"contents":[["Prim"],"Credential"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[124,57],"name":"tests/purus/passing/prelude/Prelude.purs","start":[124,38]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"identifier":"serializeCredential"},{"annotation":{"meta":null,"sourceSpan":{"end":[100,71],"start":[100,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[108,54],"start":[101,1]}},"argument":"sc","body":{"annotation":{"meta":null,"sourceSpan":{"end":[108,54],"start":[101,33]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":["$__unused"],"metaType":"IsConstructor"},"sourceSpan":{"end":[102,16],"start":[102,3]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[102,16],"start":[102,15]}},"binderType":"VarBinder","identifier":"c","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Credential"],"tag":"TypeConstructor"}}],"constructorName":{"identifier":"StakingHash","moduleName":["Prim"]},"typeName":{"identifier":"StakingCredential","moduleName":["Prim"]}}],"expression":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[103,23],"start":[103,5]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"constrData","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[103,25],"start":[103,5]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[103,25],"start":[103,24]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"literalType":"IntLiteral","value":0}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[103,91],"start":[103,5]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[103,41],"start":[103,27]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"mkCons","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[103,65],"start":[103,27]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[103,62],"start":[103,43]}},"kind":"Var","type":{"annotation":[{"end":[124,57],"name":"tests/purus/passing/prelude/Prelude.purs","start":[124,24]},[]],"contents":[{"annotation":[{"end":[124,57],"name":"tests/purus/passing/prelude/Prelude.purs","start":[124,24]},[]],"contents":[{"annotation":[{"end":[124,37],"name":"tests/purus/passing/prelude/Prelude.purs","start":[124,35]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[124,34],"name":"tests/purus/passing/prelude/Prelude.purs","start":[124,24]},[]],"contents":[["Prim"],"Credential"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[124,57],"name":"tests/purus/passing/prelude/Prelude.purs","start":[124,38]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"serializeCredential","moduleName":["Prelude"]}},"annotation":{"meta":null,"sourceSpan":{"end":[103,64],"start":[103,43]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[103,64],"start":[103,63]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Credential"],"tag":"TypeConstructor"},"value":{"identifier":"c","sourcePos":[102,15]}},"kind":"App"},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[103,90],"start":[103,27]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[103,84],"start":[103,67]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Unit"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"mkNilData","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[103,89],"start":[103,67]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[103,89],"start":[103,85]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Unit"],"tag":"TypeConstructor"},"value":{"identifier":"unit","moduleName":["Prim"]}},"kind":"App"},"kind":"App"},"kind":"App"},"isGuarded":false},{"binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":["$__unused","$__unused","$__unused"],"metaType":"IsConstructor"},"sourceSpan":{"end":[104,22],"start":[104,3]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[104,16],"start":[104,14]}},"binderType":"VarBinder","identifier":"i1","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}},{"annotation":{"meta":null,"sourceSpan":{"end":[104,19],"start":[104,17]}},"binderType":"VarBinder","identifier":"i2","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}},{"annotation":{"meta":null,"sourceSpan":{"end":[104,22],"start":[104,20]}},"binderType":"VarBinder","identifier":"i3","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}}],"constructorName":{"identifier":"StakingPtr","moduleName":["Prim"]},"typeName":{"identifier":"StakingCredential","moduleName":["Prim"]}}],"expression":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[105,23],"start":[105,5]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"constrData","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[105,25],"start":[105,5]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[105,25],"start":[105,24]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"literalType":"IntLiteral","value":1}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[108,54],"start":[105,5]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[105,41],"start":[105,27]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"mkCons","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[105,59],"start":[105,27]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[105,55],"start":[105,43]}},"kind":"Var","type":{"annotation":[{"end":[458,43],"name":"tests/purus/passing/prelude/Prelude.purs","start":[458,17]},[]],"contents":[{"annotation":[{"end":[458,43],"name":"tests/purus/passing/prelude/Prelude.purs","start":[458,17]},[]],"contents":[{"annotation":[{"end":[458,23],"name":"tests/purus/passing/prelude/Prelude.purs","start":[458,21]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[458,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[458,17]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[458,43],"name":"tests/purus/passing/prelude/Prelude.purs","start":[458,24]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"serializeInt","moduleName":["Prelude"]}},"annotation":{"meta":null,"sourceSpan":{"end":[105,58],"start":[105,43]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[105,58],"start":[105,56]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"identifier":"i1","sourcePos":[104,14]}},"kind":"App"},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[108,53],"start":[105,27]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[106,36],"start":[106,22]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"mkCons","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[106,54],"start":[106,22]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[106,50],"start":[106,38]}},"kind":"Var","type":{"annotation":[{"end":[458,43],"name":"tests/purus/passing/prelude/Prelude.purs","start":[458,17]},[]],"contents":[{"annotation":[{"end":[458,43],"name":"tests/purus/passing/prelude/Prelude.purs","start":[458,17]},[]],"contents":[{"annotation":[{"end":[458,23],"name":"tests/purus/passing/prelude/Prelude.purs","start":[458,21]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[458,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[458,17]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[458,43],"name":"tests/purus/passing/prelude/Prelude.purs","start":[458,24]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"serializeInt","moduleName":["Prelude"]}},"annotation":{"meta":null,"sourceSpan":{"end":[106,53],"start":[106,38]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[106,53],"start":[106,51]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"identifier":"i2","sourcePos":[104,17]}},"kind":"App"},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[108,52],"start":[106,22]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[107,39],"start":[107,25]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"mkCons","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[107,57],"start":[107,25]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[107,53],"start":[107,41]}},"kind":"Var","type":{"annotation":[{"end":[458,43],"name":"tests/purus/passing/prelude/Prelude.purs","start":[458,17]},[]],"contents":[{"annotation":[{"end":[458,43],"name":"tests/purus/passing/prelude/Prelude.purs","start":[458,17]},[]],"contents":[{"annotation":[{"end":[458,23],"name":"tests/purus/passing/prelude/Prelude.purs","start":[458,21]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[458,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[458,17]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[458,43],"name":"tests/purus/passing/prelude/Prelude.purs","start":[458,24]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"serializeInt","moduleName":["Prelude"]}},"annotation":{"meta":null,"sourceSpan":{"end":[107,56],"start":[107,41]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[107,56],"start":[107,54]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"identifier":"i3","sourcePos":[104,20]}},"kind":"App"},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[108,51],"start":[107,25]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[108,45],"start":[108,28]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Unit"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"mkNilData","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[108,50],"start":[108,28]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[108,50],"start":[108,46]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Unit"],"tag":"TypeConstructor"},"value":{"identifier":"unit","moduleName":["Prim"]}},"kind":"App"},"kind":"App"},"kind":"App"},"kind":"App"},"kind":"App"},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[101,40],"start":[101,38]}},"kind":"Var","type":{"annotation":[{"end":[100,48],"name":"tests/purus/passing/prelude/Prelude.purs","start":[100,31]},[]],"contents":[["Prim"],"StakingCredential"],"tag":"TypeConstructor"},"value":{"identifier":"sc","sourcePos":[101,1]}}],"kind":"Case","type":{"annotation":[{"end":[100,71],"name":"tests/purus/passing/prelude/Prelude.purs","start":[100,52]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[100,48],"name":"tests/purus/passing/prelude/Prelude.purs","start":[100,31]},[]],"contents":[["Prim"],"StakingCredential"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[100,71],"name":"tests/purus/passing/prelude/Prelude.purs","start":[100,52]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"identifier":"serializeStakingCredential"},{"annotation":{"meta":null,"sourceSpan":{"end":[42,47],"start":[42,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[70,50],"start":[43,1]}},"argument":"d","body":{"annotation":{"meta":null,"sourceSpan":{"end":[70,50],"start":[43,20]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":["$__unused"],"metaType":"IsConstructor"},"sourceSpan":{"end":[44,22],"start":[44,3]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[44,22],"start":[44,20]}},"binderType":"VarBinder","identifier":"sc","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"StakingCredential"],"tag":"TypeConstructor"}}],"constructorName":{"identifier":"DCertDelegRegKey","moduleName":["Prim"]},"typeName":{"identifier":"DCert","moduleName":["Prim"]}}],"expression":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[45,23],"start":[45,5]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"constrData","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[45,25],"start":[45,5]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[45,25],"start":[45,24]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"literalType":"IntLiteral","value":0}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[47,35],"start":[45,5]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[46,22],"start":[46,8]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"mkCons","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[46,54],"start":[46,8]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[46,50],"start":[46,24]}},"kind":"Var","type":{"annotation":[{"end":[100,71],"name":"tests/purus/passing/prelude/Prelude.purs","start":[100,31]},[]],"contents":[{"annotation":[{"end":[100,71],"name":"tests/purus/passing/prelude/Prelude.purs","start":[100,31]},[]],"contents":[{"annotation":[{"end":[100,51],"name":"tests/purus/passing/prelude/Prelude.purs","start":[100,49]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[100,48],"name":"tests/purus/passing/prelude/Prelude.purs","start":[100,31]},[]],"contents":[["Prim"],"StakingCredential"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[100,71],"name":"tests/purus/passing/prelude/Prelude.purs","start":[100,52]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"serializeStakingCredential","moduleName":["Prelude"]}},"annotation":{"meta":null,"sourceSpan":{"end":[46,53],"start":[46,24]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[46,53],"start":[46,51]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"StakingCredential"],"tag":"TypeConstructor"},"value":{"identifier":"sc","sourcePos":[44,20]}},"kind":"App"},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[47,34],"start":[46,8]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[47,28],"start":[47,11]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Unit"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"mkNilData","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[47,33],"start":[47,11]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[47,33],"start":[47,29]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Unit"],"tag":"TypeConstructor"},"value":{"identifier":"unit","moduleName":["Prim"]}},"kind":"App"},"kind":"App"},"kind":"App"},"isGuarded":false},{"binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":["$__unused"],"metaType":"IsConstructor"},"sourceSpan":{"end":[48,24],"start":[48,3]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[48,24],"start":[48,22]}},"binderType":"VarBinder","identifier":"sc","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"StakingCredential"],"tag":"TypeConstructor"}}],"constructorName":{"identifier":"DCertDelegDeRegKey","moduleName":["Prim"]},"typeName":{"identifier":"DCert","moduleName":["Prim"]}}],"expression":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[49,23],"start":[49,5]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"constrData","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[49,25],"start":[49,5]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[49,25],"start":[49,24]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"literalType":"IntLiteral","value":1}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[51,35],"start":[49,5]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[50,22],"start":[50,8]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"mkCons","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[50,54],"start":[50,8]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[50,50],"start":[50,24]}},"kind":"Var","type":{"annotation":[{"end":[100,71],"name":"tests/purus/passing/prelude/Prelude.purs","start":[100,31]},[]],"contents":[{"annotation":[{"end":[100,71],"name":"tests/purus/passing/prelude/Prelude.purs","start":[100,31]},[]],"contents":[{"annotation":[{"end":[100,51],"name":"tests/purus/passing/prelude/Prelude.purs","start":[100,49]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[100,48],"name":"tests/purus/passing/prelude/Prelude.purs","start":[100,31]},[]],"contents":[["Prim"],"StakingCredential"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[100,71],"name":"tests/purus/passing/prelude/Prelude.purs","start":[100,52]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"serializeStakingCredential","moduleName":["Prelude"]}},"annotation":{"meta":null,"sourceSpan":{"end":[50,53],"start":[50,24]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[50,53],"start":[50,51]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"StakingCredential"],"tag":"TypeConstructor"},"value":{"identifier":"sc","sourcePos":[48,22]}},"kind":"App"},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[51,34],"start":[50,8]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[51,28],"start":[51,11]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Unit"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"mkNilData","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[51,33],"start":[51,11]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[51,33],"start":[51,29]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Unit"],"tag":"TypeConstructor"},"value":{"identifier":"unit","moduleName":["Prim"]}},"kind":"App"},"kind":"App"},"kind":"App"},"isGuarded":false},{"binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":["$__unused","$__unused"],"metaType":"IsConstructor"},"sourceSpan":{"end":[52,28],"start":[52,3]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[52,24],"start":[52,22]}},"binderType":"VarBinder","identifier":"sc","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"StakingCredential"],"tag":"TypeConstructor"}},{"annotation":{"meta":null,"sourceSpan":{"end":[52,28],"start":[52,25]}},"binderType":"VarBinder","identifier":"pkh","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"PubKeyHash"],"tag":"TypeConstructor"}}],"constructorName":{"identifier":"DCertDelegDelegate","moduleName":["Prim"]},"typeName":{"identifier":"DCert","moduleName":["Prim"]}}],"expression":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[53,23],"start":[53,5]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"constrData","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[53,25],"start":[53,5]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[53,25],"start":[53,24]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"literalType":"IntLiteral","value":2}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[56,39],"start":[53,5]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[54,22],"start":[54,8]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"mkCons","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[54,54],"start":[54,8]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[54,50],"start":[54,24]}},"kind":"Var","type":{"annotation":[{"end":[100,71],"name":"tests/purus/passing/prelude/Prelude.purs","start":[100,31]},[]],"contents":[{"annotation":[{"end":[100,71],"name":"tests/purus/passing/prelude/Prelude.purs","start":[100,31]},[]],"contents":[{"annotation":[{"end":[100,51],"name":"tests/purus/passing/prelude/Prelude.purs","start":[100,49]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[100,48],"name":"tests/purus/passing/prelude/Prelude.purs","start":[100,31]},[]],"contents":[["Prim"],"StakingCredential"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[100,71],"name":"tests/purus/passing/prelude/Prelude.purs","start":[100,52]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"serializeStakingCredential","moduleName":["Prelude"]}},"annotation":{"meta":null,"sourceSpan":{"end":[54,53],"start":[54,24]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[54,53],"start":[54,51]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"StakingCredential"],"tag":"TypeConstructor"},"value":{"identifier":"sc","sourcePos":[52,22]}},"kind":"App"},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[56,38],"start":[54,8]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[55,25],"start":[55,11]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"mkCons","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[55,51],"start":[55,11]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[55,46],"start":[55,27]}},"kind":"Var","type":{"annotation":[{"end":[186,57],"name":"tests/purus/passing/prelude/Prelude.purs","start":[186,24]},[]],"contents":[{"annotation":[{"end":[186,57],"name":"tests/purus/passing/prelude/Prelude.purs","start":[186,24]},[]],"contents":[{"annotation":[{"end":[186,37],"name":"tests/purus/passing/prelude/Prelude.purs","start":[186,35]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[186,34],"name":"tests/purus/passing/prelude/Prelude.purs","start":[186,24]},[]],"contents":[["Prim"],"PubKeyHash"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[186,57],"name":"tests/purus/passing/prelude/Prelude.purs","start":[186,38]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"serializePubKeyHash","moduleName":["Prelude"]}},"annotation":{"meta":null,"sourceSpan":{"end":[55,50],"start":[55,27]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[55,50],"start":[55,47]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"PubKeyHash"],"tag":"TypeConstructor"},"value":{"identifier":"pkh","sourcePos":[52,25]}},"kind":"App"},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[56,37],"start":[55,11]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[56,31],"start":[56,14]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Unit"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"mkNilData","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[56,36],"start":[56,14]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[56,36],"start":[56,32]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Unit"],"tag":"TypeConstructor"},"value":{"identifier":"unit","moduleName":["Prim"]}},"kind":"App"},"kind":"App"},"kind":"App"},"kind":"App"},"isGuarded":false},{"binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":["$__unused","$__unused"],"metaType":"IsConstructor"},"sourceSpan":{"end":[57,30],"start":[57,3]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[57,25],"start":[57,21]}},"binderType":"VarBinder","identifier":"pkh1","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"PubKeyHash"],"tag":"TypeConstructor"}},{"annotation":{"meta":null,"sourceSpan":{"end":[57,30],"start":[57,26]}},"binderType":"VarBinder","identifier":"pkh2","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"PubKeyHash"],"tag":"TypeConstructor"}}],"constructorName":{"identifier":"DCertPoolRegister","moduleName":["Prim"]},"typeName":{"identifier":"DCert","moduleName":["Prim"]}}],"expression":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[58,23],"start":[58,5]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"constrData","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[58,25],"start":[58,5]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[58,25],"start":[58,24]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"literalType":"IntLiteral","value":3}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[61,39],"start":[58,5]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[59,22],"start":[59,8]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"mkCons","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[59,49],"start":[59,8]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[59,43],"start":[59,24]}},"kind":"Var","type":{"annotation":[{"end":[186,57],"name":"tests/purus/passing/prelude/Prelude.purs","start":[186,24]},[]],"contents":[{"annotation":[{"end":[186,57],"name":"tests/purus/passing/prelude/Prelude.purs","start":[186,24]},[]],"contents":[{"annotation":[{"end":[186,37],"name":"tests/purus/passing/prelude/Prelude.purs","start":[186,35]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[186,34],"name":"tests/purus/passing/prelude/Prelude.purs","start":[186,24]},[]],"contents":[["Prim"],"PubKeyHash"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[186,57],"name":"tests/purus/passing/prelude/Prelude.purs","start":[186,38]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"serializePubKeyHash","moduleName":["Prelude"]}},"annotation":{"meta":null,"sourceSpan":{"end":[59,48],"start":[59,24]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[59,48],"start":[59,44]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"PubKeyHash"],"tag":"TypeConstructor"},"value":{"identifier":"pkh1","sourcePos":[57,21]}},"kind":"App"},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[61,38],"start":[59,8]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[60,25],"start":[60,11]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"mkCons","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[60,52],"start":[60,11]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[60,46],"start":[60,27]}},"kind":"Var","type":{"annotation":[{"end":[186,57],"name":"tests/purus/passing/prelude/Prelude.purs","start":[186,24]},[]],"contents":[{"annotation":[{"end":[186,57],"name":"tests/purus/passing/prelude/Prelude.purs","start":[186,24]},[]],"contents":[{"annotation":[{"end":[186,37],"name":"tests/purus/passing/prelude/Prelude.purs","start":[186,35]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[186,34],"name":"tests/purus/passing/prelude/Prelude.purs","start":[186,24]},[]],"contents":[["Prim"],"PubKeyHash"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[186,57],"name":"tests/purus/passing/prelude/Prelude.purs","start":[186,38]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"serializePubKeyHash","moduleName":["Prelude"]}},"annotation":{"meta":null,"sourceSpan":{"end":[60,51],"start":[60,27]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[60,51],"start":[60,47]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"PubKeyHash"],"tag":"TypeConstructor"},"value":{"identifier":"pkh2","sourcePos":[57,26]}},"kind":"App"},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[61,37],"start":[60,11]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[61,31],"start":[61,14]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Unit"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"mkNilData","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[61,36],"start":[61,14]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[61,36],"start":[61,32]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Unit"],"tag":"TypeConstructor"},"value":{"identifier":"unit","moduleName":["Prim"]}},"kind":"App"},"kind":"App"},"kind":"App"},"kind":"App"},"isGuarded":false},{"binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":["$__unused","$__unused"],"metaType":"IsConstructor"},"sourceSpan":{"end":[62,24],"start":[62,3]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[62,22],"start":[62,19]}},"binderType":"VarBinder","identifier":"pkh","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"PubKeyHash"],"tag":"TypeConstructor"}},{"annotation":{"meta":null,"sourceSpan":{"end":[62,24],"start":[62,23]}},"binderType":"VarBinder","identifier":"i","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}}],"constructorName":{"identifier":"DCertPoolRetire","moduleName":["Prim"]},"typeName":{"identifier":"DCert","moduleName":["Prim"]}}],"expression":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[63,23],"start":[63,5]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"constrData","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[63,25],"start":[63,5]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[63,25],"start":[63,24]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"literalType":"IntLiteral","value":4}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[66,39],"start":[63,5]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[64,22],"start":[64,8]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"mkCons","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[64,48],"start":[64,8]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[64,43],"start":[64,24]}},"kind":"Var","type":{"annotation":[{"end":[186,57],"name":"tests/purus/passing/prelude/Prelude.purs","start":[186,24]},[]],"contents":[{"annotation":[{"end":[186,57],"name":"tests/purus/passing/prelude/Prelude.purs","start":[186,24]},[]],"contents":[{"annotation":[{"end":[186,37],"name":"tests/purus/passing/prelude/Prelude.purs","start":[186,35]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[186,34],"name":"tests/purus/passing/prelude/Prelude.purs","start":[186,24]},[]],"contents":[["Prim"],"PubKeyHash"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[186,57],"name":"tests/purus/passing/prelude/Prelude.purs","start":[186,38]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"serializePubKeyHash","moduleName":["Prelude"]}},"annotation":{"meta":null,"sourceSpan":{"end":[64,47],"start":[64,24]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[64,47],"start":[64,44]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"PubKeyHash"],"tag":"TypeConstructor"},"value":{"identifier":"pkh","sourcePos":[62,19]}},"kind":"App"},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[66,38],"start":[64,8]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[65,25],"start":[65,11]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"mkCons","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[65,42],"start":[65,11]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[65,39],"start":[65,27]}},"kind":"Var","type":{"annotation":[{"end":[458,43],"name":"tests/purus/passing/prelude/Prelude.purs","start":[458,17]},[]],"contents":[{"annotation":[{"end":[458,43],"name":"tests/purus/passing/prelude/Prelude.purs","start":[458,17]},[]],"contents":[{"annotation":[{"end":[458,23],"name":"tests/purus/passing/prelude/Prelude.purs","start":[458,21]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[458,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[458,17]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[458,43],"name":"tests/purus/passing/prelude/Prelude.purs","start":[458,24]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"serializeInt","moduleName":["Prelude"]}},"annotation":{"meta":null,"sourceSpan":{"end":[65,41],"start":[65,27]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[65,41],"start":[65,40]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"identifier":"i","sourcePos":[62,23]}},"kind":"App"},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[66,37],"start":[65,11]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[66,31],"start":[66,14]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Unit"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"mkNilData","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[66,36],"start":[66,14]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[66,36],"start":[66,32]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Unit"],"tag":"TypeConstructor"},"value":{"identifier":"unit","moduleName":["Prim"]}},"kind":"App"},"kind":"App"},"kind":"App"},"kind":"App"},"isGuarded":false},{"binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[67,15],"start":[67,3]}},"binderType":"ConstructorBinder","binders":[],"constructorName":{"identifier":"DCertGenesis","moduleName":["Prim"]},"typeName":{"identifier":"DCert","moduleName":["Prim"]}}],"expression":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[68,23],"start":[68,5]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"constrData","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[68,25],"start":[68,5]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[68,25],"start":[68,24]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"literalType":"IntLiteral","value":5}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[68,50],"start":[68,5]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[68,44],"start":[68,27]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Unit"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"mkNilData","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[68,49],"start":[68,27]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[68,49],"start":[68,45]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Unit"],"tag":"TypeConstructor"},"value":{"identifier":"unit","moduleName":["Prim"]}},"kind":"App"},"kind":"App"},"isGuarded":false},{"binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[69,11],"start":[69,3]}},"binderType":"ConstructorBinder","binders":[],"constructorName":{"identifier":"DCertMir","moduleName":["Prim"]},"typeName":{"identifier":"DCert","moduleName":["Prim"]}}],"expression":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[70,23],"start":[70,5]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"constrData","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[70,25],"start":[70,5]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[70,25],"start":[70,24]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"literalType":"IntLiteral","value":6}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[70,50],"start":[70,5]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[70,44],"start":[70,27]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Unit"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"mkNilData","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[70,49],"start":[70,27]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[70,49],"start":[70,45]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Unit"],"tag":"TypeConstructor"},"value":{"identifier":"unit","moduleName":["Prim"]}},"kind":"App"},"kind":"App"},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[43,26],"start":[43,25]}},"kind":"Var","type":{"annotation":[{"end":[42,24],"name":"tests/purus/passing/prelude/Prelude.purs","start":[42,19]},[]],"contents":[["Prim"],"DCert"],"tag":"TypeConstructor"},"value":{"identifier":"d","sourcePos":[43,1]}}],"kind":"Case","type":{"annotation":[{"end":[42,47],"name":"tests/purus/passing/prelude/Prelude.purs","start":[42,28]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[42,24],"name":"tests/purus/passing/prelude/Prelude.purs","start":[42,19]},[]],"contents":[["Prim"],"DCert"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[42,47],"name":"tests/purus/passing/prelude/Prelude.purs","start":[42,28]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"identifier":"serializeDCert"},{"annotation":{"meta":null,"sourceSpan":{"end":[153,55],"start":[153,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"argument":"v","body":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":{"metaType":"IsNewtype"},"sourceSpan":{"end":[154,33],"start":[154,21]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[154,33],"start":[154,31]}},"binderType":"VarBinder","identifier":"bs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinByteString"],"tag":"TypeConstructor"}}],"constructorName":{"identifier":"TokenName","moduleName":["Prim"]},"typeName":{"identifier":"TokenName","moduleName":["Prim"]}}],"expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[154,56],"start":[154,37]}},"kind":"Var","type":{"annotation":[{"end":[464,72],"name":"tests/purus/passing/prelude/Prelude.purs","start":[464,24]},[]],"contents":[{"annotation":[{"end":[464,72],"name":"tests/purus/passing/prelude/Prelude.purs","start":[464,24]},[]],"contents":[{"annotation":[{"end":[464,52],"name":"tests/purus/passing/prelude/Prelude.purs","start":[464,50]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[464,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[464,24]},[]],"contents":[["Builtin"],"BuiltinByteString"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[464,72],"name":"tests/purus/passing/prelude/Prelude.purs","start":[464,53]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"serializeByteString","moduleName":["Prelude"]}},"annotation":{"meta":null,"sourceSpan":{"end":[154,59],"start":[154,37]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[154,59],"start":[154,57]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinByteString"],"tag":"TypeConstructor"},"value":{"identifier":"bs","sourcePos":[154,31]}},"kind":"App"},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[154,59],"start":[154,1]}},"kind":"Var","type":{"annotation":[{"end":[153,32],"name":"tests/purus/passing/prelude/Prelude.purs","start":[153,23]},[]],"contents":[["Prim"],"TokenName"],"tag":"TypeConstructor"},"value":{"identifier":"v","sourcePos":[0,0]}}],"kind":"Case","type":{"annotation":[{"end":[153,55],"name":"tests/purus/passing/prelude/Prelude.purs","start":[153,36]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[153,32],"name":"tests/purus/passing/prelude/Prelude.purs","start":[153,23]},[]],"contents":[["Prim"],"TokenName"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[153,55],"name":"tests/purus/passing/prelude/Prelude.purs","start":[153,36]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"identifier":"serializeTokenName"},{"annotation":{"meta":null,"sourceSpan":{"end":[194,45],"start":[194,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"argument":"v","body":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":{"metaType":"IsNewtype"},"sourceSpan":{"end":[195,23],"start":[195,16]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[195,23],"start":[195,21]}},"binderType":"VarBinder","identifier":"bs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinByteString"],"tag":"TypeConstructor"}}],"constructorName":{"identifier":"TxId","moduleName":["Prim"]},"typeName":{"identifier":"TxId","moduleName":["Prim"]}}],"expression":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[196,21],"start":[196,3]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"constrData","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[196,23],"start":[196,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[196,23],"start":[196,22]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"literalType":"IntLiteral","value":0}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[196,90],"start":[196,3]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[196,39],"start":[196,25]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"mkCons","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[196,64],"start":[196,25]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[196,60],"start":[196,41]}},"kind":"Var","type":{"annotation":[{"end":[464,72],"name":"tests/purus/passing/prelude/Prelude.purs","start":[464,24]},[]],"contents":[{"annotation":[{"end":[464,72],"name":"tests/purus/passing/prelude/Prelude.purs","start":[464,24]},[]],"contents":[{"annotation":[{"end":[464,52],"name":"tests/purus/passing/prelude/Prelude.purs","start":[464,50]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[464,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[464,24]},[]],"contents":[["Builtin"],"BuiltinByteString"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[464,72],"name":"tests/purus/passing/prelude/Prelude.purs","start":[464,53]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"serializeByteString","moduleName":["Prelude"]}},"annotation":{"meta":null,"sourceSpan":{"end":[196,63],"start":[196,41]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[196,63],"start":[196,61]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinByteString"],"tag":"TypeConstructor"},"value":{"identifier":"bs","sourcePos":[195,21]}},"kind":"App"},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[196,89],"start":[196,25]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[196,83],"start":[196,66]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Unit"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"mkNilData","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[196,88],"start":[196,66]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[196,88],"start":[196,84]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Unit"],"tag":"TypeConstructor"},"value":{"identifier":"unit","moduleName":["Prim"]}},"kind":"App"},"kind":"App"},"kind":"App"},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[196,90],"start":[195,1]}},"kind":"Var","type":{"annotation":[{"end":[194,22],"name":"tests/purus/passing/prelude/Prelude.purs","start":[194,18]},[]],"contents":[["Prim"],"TxId"],"tag":"TypeConstructor"},"value":{"identifier":"v","sourcePos":[0,0]}}],"kind":"Case","type":{"annotation":[{"end":[194,45],"name":"tests/purus/passing/prelude/Prelude.purs","start":[194,26]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[194,22],"name":"tests/purus/passing/prelude/Prelude.purs","start":[194,18]},[]],"contents":[["Prim"],"TxId"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[194,45],"name":"tests/purus/passing/prelude/Prelude.purs","start":[194,26]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"identifier":"serializeTxId"},{"annotation":{"meta":null,"sourceSpan":{"end":[284,53],"start":[284,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"argument":"v","body":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":{"metaType":"IsNewtype"},"sourceSpan":{"end":[285,32],"start":[285,20]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[285,32],"start":[285,29]}},"binderType":"VarBinder","identifier":"rec","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["id",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"TxId"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["idx",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"tag":"REmpty"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"TypeApp"}}],"constructorName":{"identifier":"TxOutRef","moduleName":["Prim"]},"typeName":{"identifier":"TxOutRef","moduleName":["Prim"]}}],"expression":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[286,21],"start":[286,3]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"constrData","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[286,23],"start":[286,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[286,23],"start":[286,22]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"literalType":"IntLiteral","value":0}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[288,48],"start":[286,3]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[286,39],"start":[286,25]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"mkCons","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[286,62],"start":[286,25]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[286,54],"start":[286,41]}},"kind":"Var","type":{"annotation":[{"end":[194,45],"name":"tests/purus/passing/prelude/Prelude.purs","start":[194,18]},[]],"contents":[{"annotation":[{"end":[194,45],"name":"tests/purus/passing/prelude/Prelude.purs","start":[194,18]},[]],"contents":[{"annotation":[{"end":[194,25],"name":"tests/purus/passing/prelude/Prelude.purs","start":[194,23]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[194,22],"name":"tests/purus/passing/prelude/Prelude.purs","start":[194,18]},[]],"contents":[["Prim"],"TxId"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[194,45],"name":"tests/purus/passing/prelude/Prelude.purs","start":[194,26]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"serializeTxId","moduleName":["Prelude"]}},"annotation":{"meta":null,"sourceSpan":{"end":[286,61],"start":[286,41]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[286,61],"start":[286,55]}},"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[286,58],"start":[286,55]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["id",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"TxId"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["idx",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"tag":"REmpty"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"TypeApp"},"value":{"identifier":"rec","sourcePos":[285,29]}},"fieldName":"id","kind":"Accessor","type":{"annotation":[{"end":[194,22],"name":"tests/purus/passing/prelude/Prelude.purs","start":[194,18]},[]],"contents":[["Prim"],"TxId"],"tag":"TypeConstructor"}},"kind":"App"},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[288,47],"start":[286,25]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[287,34],"start":[287,20]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"mkCons","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[287,57],"start":[287,20]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[287,48],"start":[287,36]}},"kind":"Var","type":{"annotation":[{"end":[458,43],"name":"tests/purus/passing/prelude/Prelude.purs","start":[458,17]},[]],"contents":[{"annotation":[{"end":[458,43],"name":"tests/purus/passing/prelude/Prelude.purs","start":[458,17]},[]],"contents":[{"annotation":[{"end":[458,23],"name":"tests/purus/passing/prelude/Prelude.purs","start":[458,21]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[458,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[458,17]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[458,43],"name":"tests/purus/passing/prelude/Prelude.purs","start":[458,24]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"serializeInt","moduleName":["Prelude"]}},"annotation":{"meta":null,"sourceSpan":{"end":[287,56],"start":[287,36]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[287,56],"start":[287,49]}},"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[287,52],"start":[287,49]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["id",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"TxId"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["idx",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"tag":"REmpty"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"TypeApp"},"value":{"identifier":"rec","sourcePos":[285,29]}},"fieldName":"idx","kind":"Accessor","type":{"annotation":[{"end":[458,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[458,17]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}},"kind":"App"},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[288,46],"start":[287,20]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[288,40],"start":[288,23]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Unit"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"mkNilData","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[288,45],"start":[288,23]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[288,45],"start":[288,41]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Unit"],"tag":"TypeConstructor"},"value":{"identifier":"unit","moduleName":["Prim"]}},"kind":"App"},"kind":"App"},"kind":"App"},"kind":"App"},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[288,48],"start":[285,1]}},"kind":"Var","type":{"annotation":[{"end":[284,30],"name":"tests/purus/passing/prelude/Prelude.purs","start":[284,22]},[]],"contents":[["Prim"],"TxOutRef"],"tag":"TypeConstructor"},"value":{"identifier":"v","sourcePos":[0,0]}}],"kind":"Case","type":{"annotation":[{"end":[284,53],"name":"tests/purus/passing/prelude/Prelude.purs","start":[284,34]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[284,30],"name":"tests/purus/passing/prelude/Prelude.purs","start":[284,22]},[]],"contents":[["Prim"],"TxOutRef"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[284,53],"name":"tests/purus/passing/prelude/Prelude.purs","start":[284,34]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"identifier":"serializeTxOutRef"},{"annotation":{"meta":null,"sourceSpan":{"end":[18,63],"start":[18,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[27,86],"start":[19,1]}},"argument":"sp","body":{"annotation":{"meta":null,"sourceSpan":{"end":[27,86],"start":[19,29]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":["$__unused"],"metaType":"IsConstructor"},"sourceSpan":{"end":[20,13],"start":[20,3]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[20,13],"start":[20,11]}},"binderType":"VarBinder","identifier":"cs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"CurrencySymbol"],"tag":"TypeConstructor"}}],"constructorName":{"identifier":"Minting","moduleName":["Prim"]},"typeName":{"identifier":"ScriptPurpose","moduleName":["Prim"]}}],"expression":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[21,23],"start":[21,5]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"constrData","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[21,25],"start":[21,5]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[21,25],"start":[21,24]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"literalType":"IntLiteral","value":0}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[21,96],"start":[21,5]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[21,41],"start":[21,27]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"mkCons","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[21,70],"start":[21,27]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[21,66],"start":[21,43]}},"kind":"Var","type":{"annotation":[{"end":[147,65],"name":"tests/purus/passing/prelude/Prelude.purs","start":[147,28]},[]],"contents":[{"annotation":[{"end":[147,65],"name":"tests/purus/passing/prelude/Prelude.purs","start":[147,28]},[]],"contents":[{"annotation":[{"end":[147,45],"name":"tests/purus/passing/prelude/Prelude.purs","start":[147,43]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[147,42],"name":"tests/purus/passing/prelude/Prelude.purs","start":[147,28]},[]],"contents":[["Prim"],"CurrencySymbol"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[147,65],"name":"tests/purus/passing/prelude/Prelude.purs","start":[147,46]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"serializeCurrencySymbol","moduleName":["Prelude"]}},"annotation":{"meta":null,"sourceSpan":{"end":[21,69],"start":[21,43]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[21,69],"start":[21,67]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"CurrencySymbol"],"tag":"TypeConstructor"},"value":{"identifier":"cs","sourcePos":[20,11]}},"kind":"App"},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[21,95],"start":[21,27]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[21,89],"start":[21,72]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Unit"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"mkNilData","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[21,94],"start":[21,72]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[21,94],"start":[21,90]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Unit"],"tag":"TypeConstructor"},"value":{"identifier":"unit","moduleName":["Prim"]}},"kind":"App"},"kind":"App"},"kind":"App"},"isGuarded":false},{"binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":["$__unused"],"metaType":"IsConstructor"},"sourceSpan":{"end":[22,15],"start":[22,3]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[22,15],"start":[22,12]}},"binderType":"VarBinder","identifier":"tor","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"TxOutRef"],"tag":"TypeConstructor"}}],"constructorName":{"identifier":"Spending","moduleName":["Prim"]},"typeName":{"identifier":"ScriptPurpose","moduleName":["Prim"]}}],"expression":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[23,23],"start":[23,5]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"constrData","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[23,25],"start":[23,5]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[23,25],"start":[23,24]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"literalType":"IntLiteral","value":1}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[23,91],"start":[23,5]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[23,41],"start":[23,27]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"mkCons","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[23,65],"start":[23,27]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[23,60],"start":[23,43]}},"kind":"Var","type":{"annotation":[{"end":[284,53],"name":"tests/purus/passing/prelude/Prelude.purs","start":[284,22]},[]],"contents":[{"annotation":[{"end":[284,53],"name":"tests/purus/passing/prelude/Prelude.purs","start":[284,22]},[]],"contents":[{"annotation":[{"end":[284,33],"name":"tests/purus/passing/prelude/Prelude.purs","start":[284,31]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[284,30],"name":"tests/purus/passing/prelude/Prelude.purs","start":[284,22]},[]],"contents":[["Prim"],"TxOutRef"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[284,53],"name":"tests/purus/passing/prelude/Prelude.purs","start":[284,34]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"serializeTxOutRef","moduleName":["Prelude"]}},"annotation":{"meta":null,"sourceSpan":{"end":[23,64],"start":[23,43]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[23,64],"start":[23,61]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"TxOutRef"],"tag":"TypeConstructor"},"value":{"identifier":"tor","sourcePos":[22,12]}},"kind":"App"},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[23,90],"start":[23,27]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[23,84],"start":[23,67]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Unit"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"mkNilData","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[23,89],"start":[23,67]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[23,89],"start":[23,85]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Unit"],"tag":"TypeConstructor"},"value":{"identifier":"unit","moduleName":["Prim"]}},"kind":"App"},"kind":"App"},"kind":"App"},"isGuarded":false},{"binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":["$__unused"],"metaType":"IsConstructor"},"sourceSpan":{"end":[24,15],"start":[24,3]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[24,15],"start":[24,13]}},"binderType":"VarBinder","identifier":"sc","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"StakingCredential"],"tag":"TypeConstructor"}}],"constructorName":{"identifier":"Rewarding","moduleName":["Prim"]},"typeName":{"identifier":"ScriptPurpose","moduleName":["Prim"]}}],"expression":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[25,23],"start":[25,5]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"constrData","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[25,25],"start":[25,5]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[25,25],"start":[25,24]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"literalType":"IntLiteral","value":2}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[25,99],"start":[25,5]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[25,41],"start":[25,27]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"mkCons","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[25,73],"start":[25,27]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[25,69],"start":[25,43]}},"kind":"Var","type":{"annotation":[{"end":[100,71],"name":"tests/purus/passing/prelude/Prelude.purs","start":[100,31]},[]],"contents":[{"annotation":[{"end":[100,71],"name":"tests/purus/passing/prelude/Prelude.purs","start":[100,31]},[]],"contents":[{"annotation":[{"end":[100,51],"name":"tests/purus/passing/prelude/Prelude.purs","start":[100,49]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[100,48],"name":"tests/purus/passing/prelude/Prelude.purs","start":[100,31]},[]],"contents":[["Prim"],"StakingCredential"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[100,71],"name":"tests/purus/passing/prelude/Prelude.purs","start":[100,52]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"serializeStakingCredential","moduleName":["Prelude"]}},"annotation":{"meta":null,"sourceSpan":{"end":[25,72],"start":[25,43]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[25,72],"start":[25,70]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"StakingCredential"],"tag":"TypeConstructor"},"value":{"identifier":"sc","sourcePos":[24,13]}},"kind":"App"},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[25,98],"start":[25,27]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[25,92],"start":[25,75]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Unit"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"mkNilData","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[25,97],"start":[25,75]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[25,97],"start":[25,93]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Unit"],"tag":"TypeConstructor"},"value":{"identifier":"unit","moduleName":["Prim"]}},"kind":"App"},"kind":"App"},"kind":"App"},"isGuarded":false},{"binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":["$__unused"],"metaType":"IsConstructor"},"sourceSpan":{"end":[26,15],"start":[26,3]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[26,15],"start":[26,14]}},"binderType":"VarBinder","identifier":"d","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"DCert"],"tag":"TypeConstructor"}}],"constructorName":{"identifier":"Certifying","moduleName":["Prim"]},"typeName":{"identifier":"ScriptPurpose","moduleName":["Prim"]}}],"expression":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[27,23],"start":[27,5]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"constrData","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[27,25],"start":[27,5]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[27,25],"start":[27,24]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"literalType":"IntLiteral","value":3}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[27,86],"start":[27,5]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[27,41],"start":[27,27]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"mkCons","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[27,60],"start":[27,27]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[27,57],"start":[27,43]}},"kind":"Var","type":{"annotation":[{"end":[42,47],"name":"tests/purus/passing/prelude/Prelude.purs","start":[42,19]},[]],"contents":[{"annotation":[{"end":[42,47],"name":"tests/purus/passing/prelude/Prelude.purs","start":[42,19]},[]],"contents":[{"annotation":[{"end":[42,27],"name":"tests/purus/passing/prelude/Prelude.purs","start":[42,25]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[42,24],"name":"tests/purus/passing/prelude/Prelude.purs","start":[42,19]},[]],"contents":[["Prim"],"DCert"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[42,47],"name":"tests/purus/passing/prelude/Prelude.purs","start":[42,28]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"serializeDCert","moduleName":["Prelude"]}},"annotation":{"meta":null,"sourceSpan":{"end":[27,59],"start":[27,43]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[27,59],"start":[27,58]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"DCert"],"tag":"TypeConstructor"},"value":{"identifier":"d","sourcePos":[26,14]}},"kind":"App"},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[27,85],"start":[27,27]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[27,79],"start":[27,62]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Unit"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"mkNilData","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[27,84],"start":[27,62]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[27,84],"start":[27,80]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Unit"],"tag":"TypeConstructor"},"value":{"identifier":"unit","moduleName":["Prim"]}},"kind":"App"},"kind":"App"},"kind":"App"},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[19,36],"start":[19,34]}},"kind":"Var","type":{"annotation":[{"end":[18,40],"name":"tests/purus/passing/prelude/Prelude.purs","start":[18,27]},[]],"contents":[["Prim"],"ScriptPurpose"],"tag":"TypeConstructor"},"value":{"identifier":"sp","sourcePos":[19,1]}}],"kind":"Case","type":{"annotation":[{"end":[18,63],"name":"tests/purus/passing/prelude/Prelude.purs","start":[18,44]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[18,40],"name":"tests/purus/passing/prelude/Prelude.purs","start":[18,27]},[]],"contents":[["Prim"],"ScriptPurpose"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[18,63],"name":"tests/purus/passing/prelude/Prelude.purs","start":[18,44]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"identifier":"serializeScriptPurpose"},{"annotation":{"meta":null,"sourceSpan":{"end":[397,22],"start":[392,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[398,21],"start":[398,19]}},"argument":"fK","body":{"annotation":{"meta":null,"sourceSpan":{"end":[398,24],"start":[398,22]}},"argument":"fV","body":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"argument":"v","body":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[398,21],"start":[398,19]}},"binderType":"VarBinder","identifier":"fK1","type":{"annotation":[{"end":[394,28],"name":"tests/purus/passing/prelude/Prelude.purs","start":[394,4]},[]],"contents":[{"annotation":[{"end":[394,28],"name":"tests/purus/passing/prelude/Prelude.purs","start":[394,4]},[]],"contents":[{"annotation":[{"end":[394,8],"name":"tests/purus/passing/prelude/Prelude.purs","start":[394,6]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[394,5],"name":"tests/purus/passing/prelude/Prelude.purs","start":[394,4]},[]],"contents":{"kind":{"annotation":[{"end":[393,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[393,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"k"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[394,28],"name":"tests/purus/passing/prelude/Prelude.purs","start":[394,9]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},{"annotation":{"meta":null,"sourceSpan":{"end":[398,24],"start":[398,22]}},"binderType":"VarBinder","identifier":"fV1","type":{"annotation":[{"end":[395,28],"name":"tests/purus/passing/prelude/Prelude.purs","start":[395,4]},[]],"contents":[{"annotation":[{"end":[395,28],"name":"tests/purus/passing/prelude/Prelude.purs","start":[395,4]},[]],"contents":[{"annotation":[{"end":[395,8],"name":"tests/purus/passing/prelude/Prelude.purs","start":[395,6]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[395,5],"name":"tests/purus/passing/prelude/Prelude.purs","start":[395,4]},[]],"contents":{"kind":{"annotation":[{"end":[393,32],"name":"tests/purus/passing/prelude/Prelude.purs","start":[393,28]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"v"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[395,28],"name":"tests/purus/passing/prelude/Prelude.purs","start":[395,9]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},{"annotation":{"meta":{"metaType":"IsNewtype"},"sourceSpan":{"end":[398,38],"start":[398,26]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[398,38],"start":[398,35]}},"binderType":"VarBinder","identifier":"ell","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Tuple2"],"tag":"TypeConstructor"},{"annotation":[{"end":[396,13],"name":"tests/purus/passing/prelude/Prelude.purs","start":[396,12]},[]],"contents":{"kind":{"annotation":[{"end":[393,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[393,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"k"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[396,15],"name":"tests/purus/passing/prelude/Prelude.purs","start":[396,14]},[]],"contents":{"kind":{"annotation":[{"end":[393,32],"name":"tests/purus/passing/prelude/Prelude.purs","start":[393,28]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"v"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}}],"constructorName":{"identifier":"AssocMap","moduleName":["Prim"]},"typeName":{"identifier":"AssocMap","moduleName":["Prim"]}}],"expression":{"annotation":{"meta":{"metaType":"IsWhere"},"sourceSpan":{"end":[398,66],"start":[398,42]}},"binds":[{"annotation":{"meta":null,"sourceSpan":{"end":[402,88],"start":[400,5]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"argument":"v1","body":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[404,23],"start":[404,14]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[404,20],"start":[404,19]}},"binderType":"VarBinder","identifier":"p","type":{"annotation":[{"end":[401,23],"name":"tests/purus/passing/prelude/Prelude.purs","start":[401,13]},[]],"contents":[{"annotation":[{"end":[401,21],"name":"tests/purus/passing/prelude/Prelude.purs","start":[401,13]},[]],"contents":[{"annotation":[{"end":[401,19],"name":"tests/purus/passing/prelude/Prelude.purs","start":[401,13]},[]],"contents":[["Prim"],"Tuple2"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["k",{"annotation":[{"end":[393,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[393,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},12,68],"tag":"Skolem"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["v",{"annotation":[{"end":[393,32],"name":"tests/purus/passing/prelude/Prelude.purs","start":[393,28]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},13,69],"tag":"Skolem"}],"tag":"TypeApp"}},{"annotation":{"meta":null,"sourceSpan":{"end":[404,23],"start":[404,21]}},"binderType":"VarBinder","identifier":"xs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[401,23],"name":"tests/purus/passing/prelude/Prelude.purs","start":[401,13]},[]],"contents":[{"annotation":[{"end":[401,21],"name":"tests/purus/passing/prelude/Prelude.purs","start":[401,13]},[]],"contents":[{"annotation":[{"end":[401,19],"name":"tests/purus/passing/prelude/Prelude.purs","start":[401,13]},[]],"contents":[["Prim"],"Tuple2"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["k",{"annotation":[{"end":[393,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[393,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},12,68],"tag":"Skolem"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["v",{"annotation":[{"end":[393,32],"name":"tests/purus/passing/prelude/Prelude.purs","start":[393,28]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},13,69],"tag":"Skolem"}],"tag":"TypeApp"}],"tag":"TypeApp"}}],"constructorName":{"identifier":"Cons","moduleName":["Prim"]},"typeName":{"identifier":"List","moduleName":["Prim"]}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[405,34],"start":[405,20]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":{"constructorType":"ProductType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[405,30],"start":[405,20]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[405,28],"start":[405,27]}},"binderType":"VarBinder","identifier":"x","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["k",{"annotation":[{"end":[393,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[393,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},12,68],"tag":"Skolem"}},{"annotation":{"meta":null,"sourceSpan":{"end":[405,30],"start":[405,29]}},"binderType":"VarBinder","identifier":"y","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["v",{"annotation":[{"end":[393,32],"name":"tests/purus/passing/prelude/Prelude.purs","start":[393,28]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},13,69],"tag":"Skolem"}}],"constructorName":{"identifier":"Tuple2","moduleName":["Prim"]},"typeName":{"identifier":"Tuple2","moduleName":["Prim"]}}],"expression":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[406,36],"start":[406,22]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"mkCons","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[406,71],"start":[406,22]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[406,56],"start":[406,38]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinPair"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"mkPairData","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[406,63],"start":[406,38]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[406,60],"start":[406,58]}},"kind":"Var","type":{"annotation":[{"end":[394,28],"name":"tests/purus/passing/prelude/Prelude.purs","start":[394,4]},[]],"contents":[{"annotation":[{"end":[394,28],"name":"tests/purus/passing/prelude/Prelude.purs","start":[394,4]},[]],"contents":[{"annotation":[{"end":[394,8],"name":"tests/purus/passing/prelude/Prelude.purs","start":[394,6]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[394,5],"name":"tests/purus/passing/prelude/Prelude.purs","start":[394,4]},[]],"contents":{"kind":{"annotation":[{"end":[393,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[393,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"k"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[394,28],"name":"tests/purus/passing/prelude/Prelude.purs","start":[394,9]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"fK1","sourcePos":[398,19]}},"annotation":{"meta":null,"sourceSpan":{"end":[406,62],"start":[406,58]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[406,62],"start":[406,61]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["k",{"annotation":[{"end":[393,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[393,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},12,68],"tag":"Skolem"},"value":{"identifier":"x","sourcePos":[405,27]}},"kind":"App"},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[406,70],"start":[406,38]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[406,67],"start":[406,65]}},"kind":"Var","type":{"annotation":[{"end":[395,28],"name":"tests/purus/passing/prelude/Prelude.purs","start":[395,4]},[]],"contents":[{"annotation":[{"end":[395,28],"name":"tests/purus/passing/prelude/Prelude.purs","start":[395,4]},[]],"contents":[{"annotation":[{"end":[395,8],"name":"tests/purus/passing/prelude/Prelude.purs","start":[395,6]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[395,5],"name":"tests/purus/passing/prelude/Prelude.purs","start":[395,4]},[]],"contents":{"kind":{"annotation":[{"end":[393,32],"name":"tests/purus/passing/prelude/Prelude.purs","start":[393,28]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"v"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[395,28],"name":"tests/purus/passing/prelude/Prelude.purs","start":[395,9]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"fV1","sourcePos":[398,22]}},"annotation":{"meta":null,"sourceSpan":{"end":[406,69],"start":[406,65]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[406,69],"start":[406,68]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["v",{"annotation":[{"end":[393,32],"name":"tests/purus/passing/prelude/Prelude.purs","start":[393,28]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},13,69],"tag":"Skolem"},"value":{"identifier":"y","sourcePos":[405,29]}},"kind":"App"},"kind":"App"},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[406,79],"start":[406,22]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[406,75],"start":[406,73]}},"kind":"Var","type":{"annotation":[{"end":[402,88],"name":"tests/purus/passing/prelude/Prelude.purs","start":[401,7]},[]],"contents":[{"annotation":[{"end":[402,88],"name":"tests/purus/passing/prelude/Prelude.purs","start":[401,7]},[]],"contents":[{"annotation":[{"end":[401,27],"name":"tests/purus/passing/prelude/Prelude.purs","start":[401,25]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[401,24],"name":"tests/purus/passing/prelude/Prelude.purs","start":[401,7]},[]],"contents":[{"annotation":[{"end":[401,11],"name":"tests/purus/passing/prelude/Prelude.purs","start":[401,7]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[401,23],"name":"tests/purus/passing/prelude/Prelude.purs","start":[401,13]},[]],"contents":[{"annotation":[{"end":[401,21],"name":"tests/purus/passing/prelude/Prelude.purs","start":[401,13]},[]],"contents":[{"annotation":[{"end":[401,19],"name":"tests/purus/passing/prelude/Prelude.purs","start":[401,13]},[]],"contents":[["Prim"],"Tuple2"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["k",{"annotation":[{"end":[393,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[393,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},12,68],"tag":"Skolem"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["v",{"annotation":[{"end":[393,32],"name":"tests/purus/passing/prelude/Prelude.purs","start":[393,28]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},13,69],"tag":"Skolem"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[402,88],"name":"tests/purus/passing/prelude/Prelude.purs","start":[402,7]},[]],"contents":[{"annotation":[{"end":[402,26],"name":"tests/purus/passing/prelude/Prelude.purs","start":[402,7]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[402,87],"name":"tests/purus/passing/prelude/Prelude.purs","start":[402,28]},[]],"contents":[{"annotation":[{"end":[402,67],"name":"tests/purus/passing/prelude/Prelude.purs","start":[402,28]},[]],"contents":[{"annotation":[{"end":[402,47],"name":"tests/purus/passing/prelude/Prelude.purs","start":[402,28]},[]],"contents":[["Builtin"],"BuiltinPair"],"tag":"TypeConstructor"},{"annotation":[{"end":[402,67],"name":"tests/purus/passing/prelude/Prelude.purs","start":[402,48]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[402,87],"name":"tests/purus/passing/prelude/Prelude.purs","start":[402,68]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"go","sourcePos":[400,5]}},"annotation":{"meta":null,"sourceSpan":{"end":[406,78],"start":[406,73]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[406,78],"start":[406,76]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[401,23],"name":"tests/purus/passing/prelude/Prelude.purs","start":[401,13]},[]],"contents":[{"annotation":[{"end":[401,21],"name":"tests/purus/passing/prelude/Prelude.purs","start":[401,13]},[]],"contents":[{"annotation":[{"end":[401,19],"name":"tests/purus/passing/prelude/Prelude.purs","start":[401,13]},[]],"contents":[["Prim"],"Tuple2"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["k",{"annotation":[{"end":[393,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[393,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},12,68],"tag":"Skolem"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["v",{"annotation":[{"end":[393,32],"name":"tests/purus/passing/prelude/Prelude.purs","start":[393,28]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},13,69],"tag":"Skolem"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"xs","sourcePos":[404,21]}},"kind":"App"},"kind":"App"},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[405,34],"start":[405,33]}},"kind":"Var","type":{"annotation":[{"end":[401,23],"name":"tests/purus/passing/prelude/Prelude.purs","start":[401,13]},[]],"contents":[{"annotation":[{"end":[401,21],"name":"tests/purus/passing/prelude/Prelude.purs","start":[401,13]},[]],"contents":[{"annotation":[{"end":[401,19],"name":"tests/purus/passing/prelude/Prelude.purs","start":[401,13]},[]],"contents":[["Prim"],"Tuple2"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["k",{"annotation":[{"end":[393,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[393,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},12,68],"tag":"Skolem"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["v",{"annotation":[{"end":[393,32],"name":"tests/purus/passing/prelude/Prelude.purs","start":[393,28]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},13,69],"tag":"Skolem"}],"tag":"TypeApp"},"value":{"identifier":"p","sourcePos":[404,19]}}],"kind":"Case","type":{"annotation":[{"end":[402,88],"name":"tests/purus/passing/prelude/Prelude.purs","start":[402,7]},[]],"contents":[{"annotation":[{"end":[402,26],"name":"tests/purus/passing/prelude/Prelude.purs","start":[402,7]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[402,87],"name":"tests/purus/passing/prelude/Prelude.purs","start":[402,28]},[]],"contents":[{"annotation":[{"end":[402,67],"name":"tests/purus/passing/prelude/Prelude.purs","start":[402,28]},[]],"contents":[{"annotation":[{"end":[402,47],"name":"tests/purus/passing/prelude/Prelude.purs","start":[402,28]},[]],"contents":[["Builtin"],"BuiltinPair"],"tag":"TypeConstructor"},{"annotation":[{"end":[402,67],"name":"tests/purus/passing/prelude/Prelude.purs","start":[402,48]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[402,87],"name":"tests/purus/passing/prelude/Prelude.purs","start":[402,68]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"isGuarded":false},{"binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[407,17],"start":[407,14]}},"binderType":"ConstructorBinder","binders":[],"constructorName":{"identifier":"Nil","moduleName":["Prim"]},"typeName":{"identifier":"List","moduleName":["Prim"]}}],"expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[407,42],"start":[407,21]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Unit"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinPair"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"mkNilPairData","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[407,47],"start":[407,21]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[407,47],"start":[407,43]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Unit"],"tag":"TypeConstructor"},"value":{"identifier":"unit","moduleName":["Prim"]}},"kind":"App"},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"kind":"Var","type":{"annotation":[{"end":[401,24],"name":"tests/purus/passing/prelude/Prelude.purs","start":[401,7]},[]],"contents":[{"annotation":[{"end":[401,11],"name":"tests/purus/passing/prelude/Prelude.purs","start":[401,7]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[401,23],"name":"tests/purus/passing/prelude/Prelude.purs","start":[401,13]},[]],"contents":[{"annotation":[{"end":[401,21],"name":"tests/purus/passing/prelude/Prelude.purs","start":[401,13]},[]],"contents":[{"annotation":[{"end":[401,19],"name":"tests/purus/passing/prelude/Prelude.purs","start":[401,13]},[]],"contents":[["Prim"],"Tuple2"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["k",{"annotation":[{"end":[393,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[393,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},12,68],"tag":"Skolem"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["v",{"annotation":[{"end":[393,32],"name":"tests/purus/passing/prelude/Prelude.purs","start":[393,28]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},13,69],"tag":"Skolem"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"v1","sourcePos":[0,0]}}],"kind":"Case","type":{"annotation":[{"end":[402,88],"name":"tests/purus/passing/prelude/Prelude.purs","start":[402,7]},[]],"contents":[{"annotation":[{"end":[402,26],"name":"tests/purus/passing/prelude/Prelude.purs","start":[402,7]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[402,87],"name":"tests/purus/passing/prelude/Prelude.purs","start":[402,28]},[]],"contents":[{"annotation":[{"end":[402,67],"name":"tests/purus/passing/prelude/Prelude.purs","start":[402,28]},[]],"contents":[{"annotation":[{"end":[402,47],"name":"tests/purus/passing/prelude/Prelude.purs","start":[402,28]},[]],"contents":[["Builtin"],"BuiltinPair"],"tag":"TypeConstructor"},{"annotation":[{"end":[402,67],"name":"tests/purus/passing/prelude/Prelude.purs","start":[402,48]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[402,87],"name":"tests/purus/passing/prelude/Prelude.purs","start":[402,68]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[401,24],"name":"tests/purus/passing/prelude/Prelude.purs","start":[401,7]},[]],"contents":[{"annotation":[{"end":[401,11],"name":"tests/purus/passing/prelude/Prelude.purs","start":[401,7]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[401,23],"name":"tests/purus/passing/prelude/Prelude.purs","start":[401,13]},[]],"contents":[{"annotation":[{"end":[401,21],"name":"tests/purus/passing/prelude/Prelude.purs","start":[401,13]},[]],"contents":[{"annotation":[{"end":[401,19],"name":"tests/purus/passing/prelude/Prelude.purs","start":[401,13]},[]],"contents":[["Prim"],"Tuple2"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["k",{"annotation":[{"end":[393,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[393,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},12,68],"tag":"Skolem"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["v",{"annotation":[{"end":[393,32],"name":"tests/purus/passing/prelude/Prelude.purs","start":[393,28]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},13,69],"tag":"Skolem"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[402,88],"name":"tests/purus/passing/prelude/Prelude.purs","start":[402,7]},[]],"contents":[{"annotation":[{"end":[402,26],"name":"tests/purus/passing/prelude/Prelude.purs","start":[402,7]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[402,87],"name":"tests/purus/passing/prelude/Prelude.purs","start":[402,28]},[]],"contents":[{"annotation":[{"end":[402,67],"name":"tests/purus/passing/prelude/Prelude.purs","start":[402,28]},[]],"contents":[{"annotation":[{"end":[402,47],"name":"tests/purus/passing/prelude/Prelude.purs","start":[402,28]},[]],"contents":[["Builtin"],"BuiltinPair"],"tag":"TypeConstructor"},{"annotation":[{"end":[402,67],"name":"tests/purus/passing/prelude/Prelude.purs","start":[402,48]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[402,87],"name":"tests/purus/passing/prelude/Prelude.purs","start":[402,68]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"identifier":"go"}],"expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[398,57],"start":[398,42]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinPair"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"mapData","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[398,66],"start":[398,42]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[398,61],"start":[398,59]}},"kind":"Var","type":{"annotation":[{"end":[402,88],"name":"tests/purus/passing/prelude/Prelude.purs","start":[401,7]},[]],"contents":[{"annotation":[{"end":[402,88],"name":"tests/purus/passing/prelude/Prelude.purs","start":[401,7]},[]],"contents":[{"annotation":[{"end":[401,27],"name":"tests/purus/passing/prelude/Prelude.purs","start":[401,25]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[401,24],"name":"tests/purus/passing/prelude/Prelude.purs","start":[401,7]},[]],"contents":[{"annotation":[{"end":[401,11],"name":"tests/purus/passing/prelude/Prelude.purs","start":[401,7]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[401,23],"name":"tests/purus/passing/prelude/Prelude.purs","start":[401,13]},[]],"contents":[{"annotation":[{"end":[401,21],"name":"tests/purus/passing/prelude/Prelude.purs","start":[401,13]},[]],"contents":[{"annotation":[{"end":[401,19],"name":"tests/purus/passing/prelude/Prelude.purs","start":[401,13]},[]],"contents":[["Prim"],"Tuple2"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["k",{"annotation":[{"end":[393,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[393,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},12,68],"tag":"Skolem"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["v",{"annotation":[{"end":[393,32],"name":"tests/purus/passing/prelude/Prelude.purs","start":[393,28]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},13,69],"tag":"Skolem"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[402,88],"name":"tests/purus/passing/prelude/Prelude.purs","start":[402,7]},[]],"contents":[{"annotation":[{"end":[402,26],"name":"tests/purus/passing/prelude/Prelude.purs","start":[402,7]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[402,87],"name":"tests/purus/passing/prelude/Prelude.purs","start":[402,28]},[]],"contents":[{"annotation":[{"end":[402,67],"name":"tests/purus/passing/prelude/Prelude.purs","start":[402,28]},[]],"contents":[{"annotation":[{"end":[402,47],"name":"tests/purus/passing/prelude/Prelude.purs","start":[402,28]},[]],"contents":[["Builtin"],"BuiltinPair"],"tag":"TypeConstructor"},{"annotation":[{"end":[402,67],"name":"tests/purus/passing/prelude/Prelude.purs","start":[402,48]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[402,87],"name":"tests/purus/passing/prelude/Prelude.purs","start":[402,68]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"go","sourcePos":[400,5]}},"annotation":{"meta":null,"sourceSpan":{"end":[398,65],"start":[398,59]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[398,65],"start":[398,62]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Tuple2"],"tag":"TypeConstructor"},{"annotation":[{"end":[396,13],"name":"tests/purus/passing/prelude/Prelude.purs","start":[396,12]},[]],"contents":{"kind":{"annotation":[{"end":[393,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[393,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"k"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[396,15],"name":"tests/purus/passing/prelude/Prelude.purs","start":[396,14]},[]],"contents":{"kind":{"annotation":[{"end":[393,32],"name":"tests/purus/passing/prelude/Prelude.purs","start":[393,28]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"v"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"ell","sourcePos":[398,35]}},"kind":"App"},"kind":"App"},"kind":"Let"},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[407,47],"start":[398,1]}},"kind":"Var","type":{"annotation":[{"end":[394,28],"name":"tests/purus/passing/prelude/Prelude.purs","start":[394,4]},[]],"contents":[{"annotation":[{"end":[394,28],"name":"tests/purus/passing/prelude/Prelude.purs","start":[394,4]},[]],"contents":[{"annotation":[{"end":[394,8],"name":"tests/purus/passing/prelude/Prelude.purs","start":[394,6]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[394,5],"name":"tests/purus/passing/prelude/Prelude.purs","start":[394,4]},[]],"contents":{"kind":{"annotation":[{"end":[393,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[393,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"k"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[394,28],"name":"tests/purus/passing/prelude/Prelude.purs","start":[394,9]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"fK","sourcePos":[398,19]}},{"annotation":{"meta":null,"sourceSpan":{"end":[407,47],"start":[398,1]}},"kind":"Var","type":{"annotation":[{"end":[395,28],"name":"tests/purus/passing/prelude/Prelude.purs","start":[395,4]},[]],"contents":[{"annotation":[{"end":[395,28],"name":"tests/purus/passing/prelude/Prelude.purs","start":[395,4]},[]],"contents":[{"annotation":[{"end":[395,8],"name":"tests/purus/passing/prelude/Prelude.purs","start":[395,6]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[395,5],"name":"tests/purus/passing/prelude/Prelude.purs","start":[395,4]},[]],"contents":{"kind":{"annotation":[{"end":[393,32],"name":"tests/purus/passing/prelude/Prelude.purs","start":[393,28]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"v"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[395,28],"name":"tests/purus/passing/prelude/Prelude.purs","start":[395,9]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"fV","sourcePos":[398,22]}},{"annotation":{"meta":null,"sourceSpan":{"end":[407,47],"start":[398,1]}},"kind":"Var","type":{"annotation":[{"end":[396,15],"name":"tests/purus/passing/prelude/Prelude.purs","start":[396,3]},[]],"contents":[{"annotation":[{"end":[396,13],"name":"tests/purus/passing/prelude/Prelude.purs","start":[396,3]},[]],"contents":[{"annotation":[{"end":[396,11],"name":"tests/purus/passing/prelude/Prelude.purs","start":[396,3]},[]],"contents":[["Prim"],"AssocMap"],"tag":"TypeConstructor"},{"annotation":[{"end":[396,13],"name":"tests/purus/passing/prelude/Prelude.purs","start":[396,12]},[]],"contents":{"kind":{"annotation":[{"end":[393,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[393,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"k"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[396,15],"name":"tests/purus/passing/prelude/Prelude.purs","start":[396,14]},[]],"contents":{"kind":{"annotation":[{"end":[393,32],"name":"tests/purus/passing/prelude/Prelude.purs","start":[393,28]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"v"},"tag":"TypeVar"}],"tag":"TypeApp"},"value":{"identifier":"v","sourcePos":[0,0]}}],"kind":"Case","type":{"annotation":[{"end":[397,22],"name":"tests/purus/passing/prelude/Prelude.purs","start":[397,3]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[396,15],"name":"tests/purus/passing/prelude/Prelude.purs","start":[396,3]},[]],"contents":[{"annotation":[{"end":[396,13],"name":"tests/purus/passing/prelude/Prelude.purs","start":[396,3]},[]],"contents":[{"annotation":[{"end":[396,11],"name":"tests/purus/passing/prelude/Prelude.purs","start":[396,3]},[]],"contents":[["Prim"],"AssocMap"],"tag":"TypeConstructor"},{"annotation":[{"end":[396,13],"name":"tests/purus/passing/prelude/Prelude.purs","start":[396,12]},[]],"contents":{"kind":{"annotation":[{"end":[393,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[393,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"k"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[396,15],"name":"tests/purus/passing/prelude/Prelude.purs","start":[396,14]},[]],"contents":{"kind":{"annotation":[{"end":[393,32],"name":"tests/purus/passing/prelude/Prelude.purs","start":[393,28]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"v"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[397,22],"name":"tests/purus/passing/prelude/Prelude.purs","start":[397,3]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[395,28],"name":"tests/purus/passing/prelude/Prelude.purs","start":[395,4]},[]],"contents":[{"annotation":[{"end":[395,28],"name":"tests/purus/passing/prelude/Prelude.purs","start":[395,4]},[]],"contents":[{"annotation":[{"end":[395,8],"name":"tests/purus/passing/prelude/Prelude.purs","start":[395,6]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[395,5],"name":"tests/purus/passing/prelude/Prelude.purs","start":[395,4]},[]],"contents":{"kind":{"annotation":[{"end":[393,32],"name":"tests/purus/passing/prelude/Prelude.purs","start":[393,28]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"v"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[395,28],"name":"tests/purus/passing/prelude/Prelude.purs","start":[395,9]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[397,22],"name":"tests/purus/passing/prelude/Prelude.purs","start":[396,3]},[]],"contents":[{"annotation":[{"end":[397,22],"name":"tests/purus/passing/prelude/Prelude.purs","start":[396,3]},[]],"contents":[{"annotation":[{"end":[396,18],"name":"tests/purus/passing/prelude/Prelude.purs","start":[396,16]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[396,15],"name":"tests/purus/passing/prelude/Prelude.purs","start":[396,3]},[]],"contents":[{"annotation":[{"end":[396,13],"name":"tests/purus/passing/prelude/Prelude.purs","start":[396,3]},[]],"contents":[{"annotation":[{"end":[396,11],"name":"tests/purus/passing/prelude/Prelude.purs","start":[396,3]},[]],"contents":[["Prim"],"AssocMap"],"tag":"TypeConstructor"},{"annotation":[{"end":[396,13],"name":"tests/purus/passing/prelude/Prelude.purs","start":[396,12]},[]],"contents":{"kind":{"annotation":[{"end":[393,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[393,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"k"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[396,15],"name":"tests/purus/passing/prelude/Prelude.purs","start":[396,14]},[]],"contents":{"kind":{"annotation":[{"end":[393,32],"name":"tests/purus/passing/prelude/Prelude.purs","start":[393,28]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"v"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[397,22],"name":"tests/purus/passing/prelude/Prelude.purs","start":[397,3]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"kind":"Abs","type":{"annotation":[{"end":[397,22],"name":"tests/purus/passing/prelude/Prelude.purs","start":[393,3]},[]],"contents":{"identifier":"k","kind":{"annotation":[{"end":[393,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[393,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":67,"type":{"annotation":[{"end":[397,22],"name":"tests/purus/passing/prelude/Prelude.purs","start":[393,23]},[]],"contents":{"identifier":"v","kind":{"annotation":[{"end":[393,32],"name":"tests/purus/passing/prelude/Prelude.purs","start":[393,28]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":66,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[394,28],"name":"tests/purus/passing/prelude/Prelude.purs","start":[394,4]},[]],"contents":[{"annotation":[{"end":[394,28],"name":"tests/purus/passing/prelude/Prelude.purs","start":[394,4]},[]],"contents":[{"annotation":[{"end":[394,8],"name":"tests/purus/passing/prelude/Prelude.purs","start":[394,6]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[394,5],"name":"tests/purus/passing/prelude/Prelude.purs","start":[394,4]},[]],"contents":{"kind":{"annotation":[{"end":[393,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[393,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"k"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[394,28],"name":"tests/purus/passing/prelude/Prelude.purs","start":[394,9]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[397,22],"name":"tests/purus/passing/prelude/Prelude.purs","start":[395,3]},[]],"contents":[{"annotation":[{"end":[397,22],"name":"tests/purus/passing/prelude/Prelude.purs","start":[395,3]},[]],"contents":[{"annotation":[{"end":[395,32],"name":"tests/purus/passing/prelude/Prelude.purs","start":[395,30]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[395,28],"name":"tests/purus/passing/prelude/Prelude.purs","start":[395,4]},[]],"contents":[{"annotation":[{"end":[395,28],"name":"tests/purus/passing/prelude/Prelude.purs","start":[395,4]},[]],"contents":[{"annotation":[{"end":[395,8],"name":"tests/purus/passing/prelude/Prelude.purs","start":[395,6]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[395,5],"name":"tests/purus/passing/prelude/Prelude.purs","start":[395,4]},[]],"contents":{"kind":{"annotation":[{"end":[393,32],"name":"tests/purus/passing/prelude/Prelude.purs","start":[393,28]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"v"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[395,28],"name":"tests/purus/passing/prelude/Prelude.purs","start":[395,9]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[397,22],"name":"tests/purus/passing/prelude/Prelude.purs","start":[396,3]},[]],"contents":[{"annotation":[{"end":[397,22],"name":"tests/purus/passing/prelude/Prelude.purs","start":[396,3]},[]],"contents":[{"annotation":[{"end":[396,18],"name":"tests/purus/passing/prelude/Prelude.purs","start":[396,16]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[396,15],"name":"tests/purus/passing/prelude/Prelude.purs","start":[396,3]},[]],"contents":[{"annotation":[{"end":[396,13],"name":"tests/purus/passing/prelude/Prelude.purs","start":[396,3]},[]],"contents":[{"annotation":[{"end":[396,11],"name":"tests/purus/passing/prelude/Prelude.purs","start":[396,3]},[]],"contents":[["Prim"],"AssocMap"],"tag":"TypeConstructor"},{"annotation":[{"end":[396,13],"name":"tests/purus/passing/prelude/Prelude.purs","start":[396,12]},[]],"contents":{"kind":{"annotation":[{"end":[393,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[393,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"k"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[396,15],"name":"tests/purus/passing/prelude/Prelude.purs","start":[396,14]},[]],"contents":{"kind":{"annotation":[{"end":[393,32],"name":"tests/purus/passing/prelude/Prelude.purs","start":[393,28]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"v"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[397,22],"name":"tests/purus/passing/prelude/Prelude.purs","start":[397,3]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"identifier":"serializeAssocMap"},{"annotation":{"meta":null,"sourceSpan":{"end":[138,47],"start":[138,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"argument":"v","body":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":{"metaType":"IsNewtype"},"sourceSpan":{"end":[139,24],"start":[139,17]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[139,24],"start":[139,23]}},"binderType":"VarBinder","identifier":"v1","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"AssocMap"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"CurrencySymbol"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"AssocMap"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"TokenName"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}}],"constructorName":{"identifier":"Value","moduleName":["Prim"]},"typeName":{"identifier":"Value","moduleName":["Prim"]}}],"expression":{"abstraction":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[140,20],"start":[140,3]}},"kind":"Var","type":{"annotation":[{"end":[397,22],"name":"tests/purus/passing/prelude/Prelude.purs","start":[393,3]},[]],"contents":{"identifier":"k","kind":{"annotation":[{"end":[393,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[393,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":67,"type":{"annotation":[{"end":[397,22],"name":"tests/purus/passing/prelude/Prelude.purs","start":[393,23]},[]],"contents":{"identifier":"v","kind":{"annotation":[{"end":[393,32],"name":"tests/purus/passing/prelude/Prelude.purs","start":[393,28]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":66,"type":{"annotation":[{"end":[397,22],"name":"tests/purus/passing/prelude/Prelude.purs","start":[394,3]},[]],"contents":[{"annotation":[{"end":[397,22],"name":"tests/purus/passing/prelude/Prelude.purs","start":[394,3]},[]],"contents":[{"annotation":[{"end":[394,32],"name":"tests/purus/passing/prelude/Prelude.purs","start":[394,30]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[394,28],"name":"tests/purus/passing/prelude/Prelude.purs","start":[394,4]},[]],"contents":[{"annotation":[{"end":[394,28],"name":"tests/purus/passing/prelude/Prelude.purs","start":[394,4]},[]],"contents":[{"annotation":[{"end":[394,8],"name":"tests/purus/passing/prelude/Prelude.purs","start":[394,6]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[394,5],"name":"tests/purus/passing/prelude/Prelude.purs","start":[394,4]},[]],"contents":{"kind":{"annotation":[{"end":[393,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[393,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"k"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[394,28],"name":"tests/purus/passing/prelude/Prelude.purs","start":[394,9]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[397,22],"name":"tests/purus/passing/prelude/Prelude.purs","start":[395,3]},[]],"contents":[{"annotation":[{"end":[397,22],"name":"tests/purus/passing/prelude/Prelude.purs","start":[395,3]},[]],"contents":[{"annotation":[{"end":[395,32],"name":"tests/purus/passing/prelude/Prelude.purs","start":[395,30]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[395,28],"name":"tests/purus/passing/prelude/Prelude.purs","start":[395,4]},[]],"contents":[{"annotation":[{"end":[395,28],"name":"tests/purus/passing/prelude/Prelude.purs","start":[395,4]},[]],"contents":[{"annotation":[{"end":[395,8],"name":"tests/purus/passing/prelude/Prelude.purs","start":[395,6]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[395,5],"name":"tests/purus/passing/prelude/Prelude.purs","start":[395,4]},[]],"contents":{"kind":{"annotation":[{"end":[393,32],"name":"tests/purus/passing/prelude/Prelude.purs","start":[393,28]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"v"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[395,28],"name":"tests/purus/passing/prelude/Prelude.purs","start":[395,9]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[397,22],"name":"tests/purus/passing/prelude/Prelude.purs","start":[396,3]},[]],"contents":[{"annotation":[{"end":[397,22],"name":"tests/purus/passing/prelude/Prelude.purs","start":[396,3]},[]],"contents":[{"annotation":[{"end":[396,18],"name":"tests/purus/passing/prelude/Prelude.purs","start":[396,16]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[396,15],"name":"tests/purus/passing/prelude/Prelude.purs","start":[396,3]},[]],"contents":[{"annotation":[{"end":[396,13],"name":"tests/purus/passing/prelude/Prelude.purs","start":[396,3]},[]],"contents":[{"annotation":[{"end":[396,11],"name":"tests/purus/passing/prelude/Prelude.purs","start":[396,3]},[]],"contents":[["Prim"],"AssocMap"],"tag":"TypeConstructor"},{"annotation":[{"end":[396,13],"name":"tests/purus/passing/prelude/Prelude.purs","start":[396,12]},[]],"contents":{"kind":{"annotation":[{"end":[393,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[393,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"k"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[396,15],"name":"tests/purus/passing/prelude/Prelude.purs","start":[396,14]},[]],"contents":{"kind":{"annotation":[{"end":[393,32],"name":"tests/purus/passing/prelude/Prelude.purs","start":[393,28]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"v"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[397,22],"name":"tests/purus/passing/prelude/Prelude.purs","start":[397,3]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"serializeAssocMap","moduleName":["Prelude"]}},"annotation":{"meta":null,"sourceSpan":{"end":[140,44],"start":[140,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[140,44],"start":[140,21]}},"kind":"Var","type":{"annotation":[{"end":[147,65],"name":"tests/purus/passing/prelude/Prelude.purs","start":[147,28]},[]],"contents":[{"annotation":[{"end":[147,65],"name":"tests/purus/passing/prelude/Prelude.purs","start":[147,28]},[]],"contents":[{"annotation":[{"end":[147,45],"name":"tests/purus/passing/prelude/Prelude.purs","start":[147,43]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[147,42],"name":"tests/purus/passing/prelude/Prelude.purs","start":[147,28]},[]],"contents":[["Prim"],"CurrencySymbol"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[147,65],"name":"tests/purus/passing/prelude/Prelude.purs","start":[147,46]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"serializeCurrencySymbol","moduleName":["Prelude"]}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[140,96],"start":[140,3]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[140,63],"start":[140,46]}},"kind":"Var","type":{"annotation":[{"end":[397,22],"name":"tests/purus/passing/prelude/Prelude.purs","start":[393,3]},[]],"contents":{"identifier":"k","kind":{"annotation":[{"end":[393,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[393,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":67,"type":{"annotation":[{"end":[397,22],"name":"tests/purus/passing/prelude/Prelude.purs","start":[393,23]},[]],"contents":{"identifier":"v","kind":{"annotation":[{"end":[393,32],"name":"tests/purus/passing/prelude/Prelude.purs","start":[393,28]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":66,"type":{"annotation":[{"end":[397,22],"name":"tests/purus/passing/prelude/Prelude.purs","start":[394,3]},[]],"contents":[{"annotation":[{"end":[397,22],"name":"tests/purus/passing/prelude/Prelude.purs","start":[394,3]},[]],"contents":[{"annotation":[{"end":[394,32],"name":"tests/purus/passing/prelude/Prelude.purs","start":[394,30]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[394,28],"name":"tests/purus/passing/prelude/Prelude.purs","start":[394,4]},[]],"contents":[{"annotation":[{"end":[394,28],"name":"tests/purus/passing/prelude/Prelude.purs","start":[394,4]},[]],"contents":[{"annotation":[{"end":[394,8],"name":"tests/purus/passing/prelude/Prelude.purs","start":[394,6]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[394,5],"name":"tests/purus/passing/prelude/Prelude.purs","start":[394,4]},[]],"contents":{"kind":{"annotation":[{"end":[393,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[393,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"k"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[394,28],"name":"tests/purus/passing/prelude/Prelude.purs","start":[394,9]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[397,22],"name":"tests/purus/passing/prelude/Prelude.purs","start":[395,3]},[]],"contents":[{"annotation":[{"end":[397,22],"name":"tests/purus/passing/prelude/Prelude.purs","start":[395,3]},[]],"contents":[{"annotation":[{"end":[395,32],"name":"tests/purus/passing/prelude/Prelude.purs","start":[395,30]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[395,28],"name":"tests/purus/passing/prelude/Prelude.purs","start":[395,4]},[]],"contents":[{"annotation":[{"end":[395,28],"name":"tests/purus/passing/prelude/Prelude.purs","start":[395,4]},[]],"contents":[{"annotation":[{"end":[395,8],"name":"tests/purus/passing/prelude/Prelude.purs","start":[395,6]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[395,5],"name":"tests/purus/passing/prelude/Prelude.purs","start":[395,4]},[]],"contents":{"kind":{"annotation":[{"end":[393,32],"name":"tests/purus/passing/prelude/Prelude.purs","start":[393,28]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"v"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[395,28],"name":"tests/purus/passing/prelude/Prelude.purs","start":[395,9]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[397,22],"name":"tests/purus/passing/prelude/Prelude.purs","start":[396,3]},[]],"contents":[{"annotation":[{"end":[397,22],"name":"tests/purus/passing/prelude/Prelude.purs","start":[396,3]},[]],"contents":[{"annotation":[{"end":[396,18],"name":"tests/purus/passing/prelude/Prelude.purs","start":[396,16]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[396,15],"name":"tests/purus/passing/prelude/Prelude.purs","start":[396,3]},[]],"contents":[{"annotation":[{"end":[396,13],"name":"tests/purus/passing/prelude/Prelude.purs","start":[396,3]},[]],"contents":[{"annotation":[{"end":[396,11],"name":"tests/purus/passing/prelude/Prelude.purs","start":[396,3]},[]],"contents":[["Prim"],"AssocMap"],"tag":"TypeConstructor"},{"annotation":[{"end":[396,13],"name":"tests/purus/passing/prelude/Prelude.purs","start":[396,12]},[]],"contents":{"kind":{"annotation":[{"end":[393,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[393,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"k"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[396,15],"name":"tests/purus/passing/prelude/Prelude.purs","start":[396,14]},[]],"contents":{"kind":{"annotation":[{"end":[393,32],"name":"tests/purus/passing/prelude/Prelude.purs","start":[393,28]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"v"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[397,22],"name":"tests/purus/passing/prelude/Prelude.purs","start":[397,3]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"serializeAssocMap","moduleName":["Prelude"]}},"annotation":{"meta":null,"sourceSpan":{"end":[140,82],"start":[140,46]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[140,82],"start":[140,64]}},"kind":"Var","type":{"annotation":[{"end":[153,55],"name":"tests/purus/passing/prelude/Prelude.purs","start":[153,23]},[]],"contents":[{"annotation":[{"end":[153,55],"name":"tests/purus/passing/prelude/Prelude.purs","start":[153,23]},[]],"contents":[{"annotation":[{"end":[153,35],"name":"tests/purus/passing/prelude/Prelude.purs","start":[153,33]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[153,32],"name":"tests/purus/passing/prelude/Prelude.purs","start":[153,23]},[]],"contents":[["Prim"],"TokenName"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[153,55],"name":"tests/purus/passing/prelude/Prelude.purs","start":[153,36]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"serializeTokenName","moduleName":["Prelude"]}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[140,95],"start":[140,46]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[140,95],"start":[140,83]}},"kind":"Var","type":{"annotation":[{"end":[458,43],"name":"tests/purus/passing/prelude/Prelude.purs","start":[458,17]},[]],"contents":[{"annotation":[{"end":[458,43],"name":"tests/purus/passing/prelude/Prelude.purs","start":[458,17]},[]],"contents":[{"annotation":[{"end":[458,23],"name":"tests/purus/passing/prelude/Prelude.purs","start":[458,21]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[458,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[458,17]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[458,43],"name":"tests/purus/passing/prelude/Prelude.purs","start":[458,24]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"serializeInt","moduleName":["Prelude"]}},"kind":"App"},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[140,98],"start":[140,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[140,98],"start":[140,97]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"AssocMap"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"CurrencySymbol"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"AssocMap"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"TokenName"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"v1","sourcePos":[139,23]}},"kind":"App"},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[140,98],"start":[139,1]}},"kind":"Var","type":{"annotation":[{"end":[138,24],"name":"tests/purus/passing/prelude/Prelude.purs","start":[138,19]},[]],"contents":[["Prim"],"Value"],"tag":"TypeConstructor"},"value":{"identifier":"v","sourcePos":[0,0]}}],"kind":"Case","type":{"annotation":[{"end":[138,47],"name":"tests/purus/passing/prelude/Prelude.purs","start":[138,28]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[138,24],"name":"tests/purus/passing/prelude/Prelude.purs","start":[138,19]},[]],"contents":[["Prim"],"Value"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[138,47],"name":"tests/purus/passing/prelude/Prelude.purs","start":[138,28]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"identifier":"serializeValue"},{"annotation":{"meta":null,"sourceSpan":{"end":[171,51],"start":[171,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"argument":"v","body":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":{"metaType":"IsNewtype"},"sourceSpan":{"end":[172,30],"start":[172,19]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[172,30],"start":[172,27]}},"binderType":"VarBinder","identifier":"rec","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["credential",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Credential"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["stakingCredential",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Maybe"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"StakingCredential"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"tag":"REmpty"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"TypeApp"}}],"constructorName":{"identifier":"Address","moduleName":["Prim"]},"typeName":{"identifier":"Address","moduleName":["Prim"]}}],"expression":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[173,21],"start":[173,3]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"constrData","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[173,23],"start":[173,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[173,23],"start":[173,22]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"literalType":"IntLiteral","value":0}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[175,48],"start":[173,3]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[173,39],"start":[173,25]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"mkCons","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[173,76],"start":[173,25]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[173,60],"start":[173,41]}},"kind":"Var","type":{"annotation":[{"end":[124,57],"name":"tests/purus/passing/prelude/Prelude.purs","start":[124,24]},[]],"contents":[{"annotation":[{"end":[124,57],"name":"tests/purus/passing/prelude/Prelude.purs","start":[124,24]},[]],"contents":[{"annotation":[{"end":[124,37],"name":"tests/purus/passing/prelude/Prelude.purs","start":[124,35]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[124,34],"name":"tests/purus/passing/prelude/Prelude.purs","start":[124,24]},[]],"contents":[["Prim"],"Credential"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[124,57],"name":"tests/purus/passing/prelude/Prelude.purs","start":[124,38]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"serializeCredential","moduleName":["Prelude"]}},"annotation":{"meta":null,"sourceSpan":{"end":[173,75],"start":[173,41]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[173,75],"start":[173,61]}},"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[173,64],"start":[173,61]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["credential",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Credential"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["stakingCredential",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Maybe"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"StakingCredential"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"tag":"REmpty"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"TypeApp"},"value":{"identifier":"rec","sourcePos":[172,27]}},"fieldName":"credential","kind":"Accessor","type":{"annotation":[{"end":[124,34],"name":"tests/purus/passing/prelude/Prelude.purs","start":[124,24]},[]],"contents":[["Prim"],"Credential"],"tag":"TypeConstructor"}},"kind":"App"},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[175,47],"start":[173,25]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[174,34],"start":[174,20]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"mkCons","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[174,100],"start":[174,20]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[174,50],"start":[174,36]}},"kind":"Var","type":{"annotation":[{"end":[519,22],"name":"tests/purus/passing/prelude/Prelude.purs","start":[516,3]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[516,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[516,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":24,"type":{"annotation":[{"end":[519,22],"name":"tests/purus/passing/prelude/Prelude.purs","start":[517,3]},[]],"contents":[{"annotation":[{"end":[519,22],"name":"tests/purus/passing/prelude/Prelude.purs","start":[517,3]},[]],"contents":[{"annotation":[{"end":[517,32],"name":"tests/purus/passing/prelude/Prelude.purs","start":[517,30]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[517,28],"name":"tests/purus/passing/prelude/Prelude.purs","start":[517,4]},[]],"contents":[{"annotation":[{"end":[517,28],"name":"tests/purus/passing/prelude/Prelude.purs","start":[517,4]},[]],"contents":[{"annotation":[{"end":[517,8],"name":"tests/purus/passing/prelude/Prelude.purs","start":[517,6]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[517,5],"name":"tests/purus/passing/prelude/Prelude.purs","start":[517,4]},[]],"contents":{"kind":{"annotation":[{"end":[516,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[516,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[517,28],"name":"tests/purus/passing/prelude/Prelude.purs","start":[517,9]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[519,22],"name":"tests/purus/passing/prelude/Prelude.purs","start":[518,3]},[]],"contents":[{"annotation":[{"end":[519,22],"name":"tests/purus/passing/prelude/Prelude.purs","start":[518,3]},[]],"contents":[{"annotation":[{"end":[518,13],"name":"tests/purus/passing/prelude/Prelude.purs","start":[518,11]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[518,10],"name":"tests/purus/passing/prelude/Prelude.purs","start":[518,3]},[]],"contents":[{"annotation":[{"end":[518,8],"name":"tests/purus/passing/prelude/Prelude.purs","start":[518,3]},[]],"contents":[["Prim"],"Maybe"],"tag":"TypeConstructor"},{"annotation":[{"end":[518,10],"name":"tests/purus/passing/prelude/Prelude.purs","start":[518,9]},[]],"contents":{"kind":{"annotation":[{"end":[516,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[516,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[519,22],"name":"tests/purus/passing/prelude/Prelude.purs","start":[519,3]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"serializeMaybe","moduleName":["Prelude"]}},"annotation":{"meta":null,"sourceSpan":{"end":[174,77],"start":[174,36]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[174,77],"start":[174,51]}},"kind":"Var","type":{"annotation":[{"end":[100,71],"name":"tests/purus/passing/prelude/Prelude.purs","start":[100,31]},[]],"contents":[{"annotation":[{"end":[100,71],"name":"tests/purus/passing/prelude/Prelude.purs","start":[100,31]},[]],"contents":[{"annotation":[{"end":[100,51],"name":"tests/purus/passing/prelude/Prelude.purs","start":[100,49]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[100,48],"name":"tests/purus/passing/prelude/Prelude.purs","start":[100,31]},[]],"contents":[["Prim"],"StakingCredential"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[100,71],"name":"tests/purus/passing/prelude/Prelude.purs","start":[100,52]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"serializeStakingCredential","moduleName":["Prelude"]}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[174,99],"start":[174,36]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[174,99],"start":[174,78]}},"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[174,81],"start":[174,78]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["credential",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Credential"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["stakingCredential",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Maybe"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"StakingCredential"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"tag":"REmpty"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"TypeApp"},"value":{"identifier":"rec","sourcePos":[172,27]}},"fieldName":"stakingCredential","kind":"Accessor","type":{"annotation":[{"end":[518,10],"name":"tests/purus/passing/prelude/Prelude.purs","start":[518,3]},[]],"contents":[{"annotation":[{"end":[518,8],"name":"tests/purus/passing/prelude/Prelude.purs","start":[518,3]},[]],"contents":[["Prim"],"Maybe"],"tag":"TypeConstructor"},{"annotation":[{"end":[100,48],"name":"tests/purus/passing/prelude/Prelude.purs","start":[100,31]},[]],"contents":[["Prim"],"StakingCredential"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"kind":"App"},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[175,46],"start":[174,20]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[175,40],"start":[175,23]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Unit"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"mkNilData","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[175,45],"start":[175,23]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[175,45],"start":[175,41]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Unit"],"tag":"TypeConstructor"},"value":{"identifier":"unit","moduleName":["Prim"]}},"kind":"App"},"kind":"App"},"kind":"App"},"kind":"App"},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[175,48],"start":[172,1]}},"kind":"Var","type":{"annotation":[{"end":[171,28],"name":"tests/purus/passing/prelude/Prelude.purs","start":[171,21]},[]],"contents":[["Prim"],"Address"],"tag":"TypeConstructor"},"value":{"identifier":"v","sourcePos":[0,0]}}],"kind":"Case","type":{"annotation":[{"end":[171,51],"name":"tests/purus/passing/prelude/Prelude.purs","start":[171,32]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[171,28],"name":"tests/purus/passing/prelude/Prelude.purs","start":[171,21]},[]],"contents":[["Prim"],"Address"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[171,51],"name":"tests/purus/passing/prelude/Prelude.purs","start":[171,32]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"identifier":"serializeAddress"},{"annotation":{"meta":null,"sourceSpan":{"end":[260,47],"start":[260,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"argument":"v","body":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":{"metaType":"IsNewtype"},"sourceSpan":{"end":[261,26],"start":[261,17]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[261,26],"start":[261,23]}},"binderType":"VarBinder","identifier":"rec","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["address",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Address"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["value",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Value"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["datum",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"OutputDatum"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["referenceScript",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Maybe"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"ScriptHash"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"tag":"REmpty"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"TypeApp"}}],"constructorName":{"identifier":"TxOut","moduleName":["Prim"]},"typeName":{"identifier":"TxOut","moduleName":["Prim"]}}],"expression":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[262,21],"start":[262,3]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"constrData","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[262,23],"start":[262,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[262,23],"start":[262,22]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"literalType":"IntLiteral","value":0}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[266,56],"start":[262,3]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[262,39],"start":[262,25]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"mkCons","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[262,70],"start":[262,25]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[262,57],"start":[262,41]}},"kind":"Var","type":{"annotation":[{"end":[171,51],"name":"tests/purus/passing/prelude/Prelude.purs","start":[171,21]},[]],"contents":[{"annotation":[{"end":[171,51],"name":"tests/purus/passing/prelude/Prelude.purs","start":[171,21]},[]],"contents":[{"annotation":[{"end":[171,31],"name":"tests/purus/passing/prelude/Prelude.purs","start":[171,29]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[171,28],"name":"tests/purus/passing/prelude/Prelude.purs","start":[171,21]},[]],"contents":[["Prim"],"Address"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[171,51],"name":"tests/purus/passing/prelude/Prelude.purs","start":[171,32]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"serializeAddress","moduleName":["Prelude"]}},"annotation":{"meta":null,"sourceSpan":{"end":[262,69],"start":[262,41]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[262,69],"start":[262,58]}},"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[262,61],"start":[262,58]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["address",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Address"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["value",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Value"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["datum",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"OutputDatum"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["referenceScript",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Maybe"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"ScriptHash"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"tag":"REmpty"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"TypeApp"},"value":{"identifier":"rec","sourcePos":[261,23]}},"fieldName":"address","kind":"Accessor","type":{"annotation":[{"end":[171,28],"name":"tests/purus/passing/prelude/Prelude.purs","start":[171,21]},[]],"contents":[["Prim"],"Address"],"tag":"TypeConstructor"}},"kind":"App"},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[266,55],"start":[262,25]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[263,34],"start":[263,20]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"mkCons","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[263,61],"start":[263,20]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[263,50],"start":[263,36]}},"kind":"Var","type":{"annotation":[{"end":[138,47],"name":"tests/purus/passing/prelude/Prelude.purs","start":[138,19]},[]],"contents":[{"annotation":[{"end":[138,47],"name":"tests/purus/passing/prelude/Prelude.purs","start":[138,19]},[]],"contents":[{"annotation":[{"end":[138,27],"name":"tests/purus/passing/prelude/Prelude.purs","start":[138,25]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[138,24],"name":"tests/purus/passing/prelude/Prelude.purs","start":[138,19]},[]],"contents":[["Prim"],"Value"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[138,47],"name":"tests/purus/passing/prelude/Prelude.purs","start":[138,28]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"serializeValue","moduleName":["Prelude"]}},"annotation":{"meta":null,"sourceSpan":{"end":[263,60],"start":[263,36]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[263,60],"start":[263,51]}},"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[263,54],"start":[263,51]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["address",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Address"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["value",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Value"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["datum",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"OutputDatum"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["referenceScript",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Maybe"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"ScriptHash"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"tag":"REmpty"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"TypeApp"},"value":{"identifier":"rec","sourcePos":[261,23]}},"fieldName":"value","kind":"Accessor","type":{"annotation":[{"end":[138,24],"name":"tests/purus/passing/prelude/Prelude.purs","start":[138,19]},[]],"contents":[["Prim"],"Value"],"tag":"TypeConstructor"}},"kind":"App"},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[266,54],"start":[263,20]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[264,37],"start":[264,23]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"mkCons","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[264,70],"start":[264,23]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[264,59],"start":[264,39]}},"kind":"Var","type":{"annotation":[{"end":[312,59],"name":"tests/purus/passing/prelude/Prelude.purs","start":[312,25]},[]],"contents":[{"annotation":[{"end":[312,59],"name":"tests/purus/passing/prelude/Prelude.purs","start":[312,25]},[]],"contents":[{"annotation":[{"end":[312,39],"name":"tests/purus/passing/prelude/Prelude.purs","start":[312,37]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[312,36],"name":"tests/purus/passing/prelude/Prelude.purs","start":[312,25]},[]],"contents":[["Prim"],"OutputDatum"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[312,59],"name":"tests/purus/passing/prelude/Prelude.purs","start":[312,40]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"serializeOutputDatum","moduleName":["Prelude"]}},"annotation":{"meta":null,"sourceSpan":{"end":[264,69],"start":[264,39]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[264,69],"start":[264,60]}},"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[264,63],"start":[264,60]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["address",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Address"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["value",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Value"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["datum",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"OutputDatum"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["referenceScript",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Maybe"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"ScriptHash"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"tag":"REmpty"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"TypeApp"},"value":{"identifier":"rec","sourcePos":[261,23]}},"fieldName":"datum","kind":"Accessor","type":{"annotation":[{"end":[312,36],"name":"tests/purus/passing/prelude/Prelude.purs","start":[312,25]},[]],"contents":[["Prim"],"OutputDatum"],"tag":"TypeConstructor"}},"kind":"App"},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[266,53],"start":[264,23]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[265,40],"start":[265,26]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"mkCons","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[265,97],"start":[265,26]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[265,56],"start":[265,42]}},"kind":"Var","type":{"annotation":[{"end":[519,22],"name":"tests/purus/passing/prelude/Prelude.purs","start":[516,3]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[516,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[516,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":24,"type":{"annotation":[{"end":[519,22],"name":"tests/purus/passing/prelude/Prelude.purs","start":[517,3]},[]],"contents":[{"annotation":[{"end":[519,22],"name":"tests/purus/passing/prelude/Prelude.purs","start":[517,3]},[]],"contents":[{"annotation":[{"end":[517,32],"name":"tests/purus/passing/prelude/Prelude.purs","start":[517,30]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[517,28],"name":"tests/purus/passing/prelude/Prelude.purs","start":[517,4]},[]],"contents":[{"annotation":[{"end":[517,28],"name":"tests/purus/passing/prelude/Prelude.purs","start":[517,4]},[]],"contents":[{"annotation":[{"end":[517,8],"name":"tests/purus/passing/prelude/Prelude.purs","start":[517,6]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[517,5],"name":"tests/purus/passing/prelude/Prelude.purs","start":[517,4]},[]],"contents":{"kind":{"annotation":[{"end":[516,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[516,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[517,28],"name":"tests/purus/passing/prelude/Prelude.purs","start":[517,9]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[519,22],"name":"tests/purus/passing/prelude/Prelude.purs","start":[518,3]},[]],"contents":[{"annotation":[{"end":[519,22],"name":"tests/purus/passing/prelude/Prelude.purs","start":[518,3]},[]],"contents":[{"annotation":[{"end":[518,13],"name":"tests/purus/passing/prelude/Prelude.purs","start":[518,11]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[518,10],"name":"tests/purus/passing/prelude/Prelude.purs","start":[518,3]},[]],"contents":[{"annotation":[{"end":[518,8],"name":"tests/purus/passing/prelude/Prelude.purs","start":[518,3]},[]],"contents":[["Prim"],"Maybe"],"tag":"TypeConstructor"},{"annotation":[{"end":[518,10],"name":"tests/purus/passing/prelude/Prelude.purs","start":[518,9]},[]],"contents":{"kind":{"annotation":[{"end":[516,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[516,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[519,22],"name":"tests/purus/passing/prelude/Prelude.purs","start":[519,3]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"serializeMaybe","moduleName":["Prelude"]}},"annotation":{"meta":null,"sourceSpan":{"end":[265,76],"start":[265,42]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[265,76],"start":[265,57]}},"kind":"Var","type":{"annotation":[{"end":[428,57],"name":"tests/purus/passing/prelude/Prelude.purs","start":[428,24]},[]],"contents":[{"annotation":[{"end":[428,57],"name":"tests/purus/passing/prelude/Prelude.purs","start":[428,24]},[]],"contents":[{"annotation":[{"end":[428,37],"name":"tests/purus/passing/prelude/Prelude.purs","start":[428,35]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[428,34],"name":"tests/purus/passing/prelude/Prelude.purs","start":[428,24]},[]],"contents":[["Prim"],"ScriptHash"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[428,57],"name":"tests/purus/passing/prelude/Prelude.purs","start":[428,38]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"serializeScriptHash","moduleName":["Prelude"]}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[265,96],"start":[265,42]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[265,96],"start":[265,77]}},"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[265,80],"start":[265,77]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["address",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Address"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["value",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Value"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["datum",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"OutputDatum"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["referenceScript",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Maybe"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"ScriptHash"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"tag":"REmpty"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"TypeApp"},"value":{"identifier":"rec","sourcePos":[261,23]}},"fieldName":"referenceScript","kind":"Accessor","type":{"annotation":[{"end":[518,10],"name":"tests/purus/passing/prelude/Prelude.purs","start":[518,3]},[]],"contents":[{"annotation":[{"end":[518,8],"name":"tests/purus/passing/prelude/Prelude.purs","start":[518,3]},[]],"contents":[["Prim"],"Maybe"],"tag":"TypeConstructor"},{"annotation":[{"end":[428,34],"name":"tests/purus/passing/prelude/Prelude.purs","start":[428,24]},[]],"contents":[["Prim"],"ScriptHash"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"kind":"App"},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[266,52],"start":[265,26]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[266,46],"start":[266,29]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Unit"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"mkNilData","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[266,51],"start":[266,29]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[266,51],"start":[266,47]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Unit"],"tag":"TypeConstructor"},"value":{"identifier":"unit","moduleName":["Prim"]}},"kind":"App"},"kind":"App"},"kind":"App"},"kind":"App"},"kind":"App"},"kind":"App"},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[266,56],"start":[261,1]}},"kind":"Var","type":{"annotation":[{"end":[260,24],"name":"tests/purus/passing/prelude/Prelude.purs","start":[260,19]},[]],"contents":[["Prim"],"TxOut"],"tag":"TypeConstructor"},"value":{"identifier":"v","sourcePos":[0,0]}}],"kind":"Case","type":{"annotation":[{"end":[260,47],"name":"tests/purus/passing/prelude/Prelude.purs","start":[260,28]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[260,24],"name":"tests/purus/passing/prelude/Prelude.purs","start":[260,19]},[]],"contents":[["Prim"],"TxOut"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[260,47],"name":"tests/purus/passing/prelude/Prelude.purs","start":[260,28]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"identifier":"serializeTxOut"},{"annotation":{"meta":null,"sourceSpan":{"end":[298,53],"start":[298,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"argument":"v","body":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":{"metaType":"IsNewtype"},"sourceSpan":{"end":[299,32],"start":[299,20]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[299,32],"start":[299,29]}},"binderType":"VarBinder","identifier":"rec","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["txOutRef",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"TxOutRef"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["resolved",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"TxOut"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"tag":"REmpty"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"TypeApp"}}],"constructorName":{"identifier":"TxInInfo","moduleName":["Prim"]},"typeName":{"identifier":"TxInInfo","moduleName":["Prim"]}}],"expression":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[300,21],"start":[300,3]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"constrData","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[300,23],"start":[300,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[300,23],"start":[300,22]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"literalType":"IntLiteral","value":0}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[302,48],"start":[300,3]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[300,39],"start":[300,25]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"mkCons","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[300,72],"start":[300,25]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[300,58],"start":[300,41]}},"kind":"Var","type":{"annotation":[{"end":[284,53],"name":"tests/purus/passing/prelude/Prelude.purs","start":[284,22]},[]],"contents":[{"annotation":[{"end":[284,53],"name":"tests/purus/passing/prelude/Prelude.purs","start":[284,22]},[]],"contents":[{"annotation":[{"end":[284,33],"name":"tests/purus/passing/prelude/Prelude.purs","start":[284,31]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[284,30],"name":"tests/purus/passing/prelude/Prelude.purs","start":[284,22]},[]],"contents":[["Prim"],"TxOutRef"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[284,53],"name":"tests/purus/passing/prelude/Prelude.purs","start":[284,34]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"serializeTxOutRef","moduleName":["Prelude"]}},"annotation":{"meta":null,"sourceSpan":{"end":[300,71],"start":[300,41]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[300,71],"start":[300,59]}},"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[300,62],"start":[300,59]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["txOutRef",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"TxOutRef"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["resolved",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"TxOut"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"tag":"REmpty"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"TypeApp"},"value":{"identifier":"rec","sourcePos":[299,29]}},"fieldName":"txOutRef","kind":"Accessor","type":{"annotation":[{"end":[284,30],"name":"tests/purus/passing/prelude/Prelude.purs","start":[284,22]},[]],"contents":[["Prim"],"TxOutRef"],"tag":"TypeConstructor"}},"kind":"App"},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[302,47],"start":[300,25]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[301,34],"start":[301,20]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"mkCons","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[301,64],"start":[301,20]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[301,50],"start":[301,36]}},"kind":"Var","type":{"annotation":[{"end":[260,47],"name":"tests/purus/passing/prelude/Prelude.purs","start":[260,19]},[]],"contents":[{"annotation":[{"end":[260,47],"name":"tests/purus/passing/prelude/Prelude.purs","start":[260,19]},[]],"contents":[{"annotation":[{"end":[260,27],"name":"tests/purus/passing/prelude/Prelude.purs","start":[260,25]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[260,24],"name":"tests/purus/passing/prelude/Prelude.purs","start":[260,19]},[]],"contents":[["Prim"],"TxOut"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[260,47],"name":"tests/purus/passing/prelude/Prelude.purs","start":[260,28]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"serializeTxOut","moduleName":["Prelude"]}},"annotation":{"meta":null,"sourceSpan":{"end":[301,63],"start":[301,36]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[301,63],"start":[301,51]}},"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[301,54],"start":[301,51]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["txOutRef",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"TxOutRef"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["resolved",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"TxOut"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"tag":"REmpty"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"TypeApp"},"value":{"identifier":"rec","sourcePos":[299,29]}},"fieldName":"resolved","kind":"Accessor","type":{"annotation":[{"end":[260,24],"name":"tests/purus/passing/prelude/Prelude.purs","start":[260,19]},[]],"contents":[["Prim"],"TxOut"],"tag":"TypeConstructor"}},"kind":"App"},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[302,46],"start":[301,20]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[302,40],"start":[302,23]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Unit"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"mkNilData","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[302,45],"start":[302,23]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[302,45],"start":[302,41]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Unit"],"tag":"TypeConstructor"},"value":{"identifier":"unit","moduleName":["Prim"]}},"kind":"App"},"kind":"App"},"kind":"App"},"kind":"App"},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[302,48],"start":[299,1]}},"kind":"Var","type":{"annotation":[{"end":[298,30],"name":"tests/purus/passing/prelude/Prelude.purs","start":[298,22]},[]],"contents":[["Prim"],"TxInInfo"],"tag":"TypeConstructor"},"value":{"identifier":"v","sourcePos":[0,0]}}],"kind":"Case","type":{"annotation":[{"end":[298,53],"name":"tests/purus/passing/prelude/Prelude.purs","start":[298,34]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[298,30],"name":"tests/purus/passing/prelude/Prelude.purs","start":[298,22]},[]],"contents":[["Prim"],"TxInInfo"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[298,53],"name":"tests/purus/passing/prelude/Prelude.purs","start":[298,34]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"identifier":"serializeTxInInfo"},{"annotation":{"meta":null,"sourceSpan":{"end":[204,49],"start":[204,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"argument":"v","body":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":{"metaType":"IsNewtype"},"sourceSpan":{"end":[205,28],"start":[205,18]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[205,28],"start":[205,25]}},"binderType":"VarBinder","identifier":"rec","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["inputs",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"TxInInfo"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["referenceInputs",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"TxInInfo"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["outputs",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"TxOut"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["fee",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Value"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["mint",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Value"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["dCert",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"DCert"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["wdrl",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"AssocMap"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"StakingCredential"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["validRange",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Interval"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"POSIXTime"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["signatories",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"PubKeyHash"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["redeemers",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"AssocMap"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"ScriptPurpose"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Redeemer"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["data",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"AssocMap"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"DatumHash"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Datum"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["id",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"TxId"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"tag":"REmpty"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"TypeApp"}}],"constructorName":{"identifier":"TxInfo","moduleName":["Prim"]},"typeName":{"identifier":"TxInfo","moduleName":["Prim"]}}],"expression":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[206,21],"start":[206,3]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"constrData","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[206,23],"start":[206,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[206,23],"start":[206,22]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"literalType":"IntLiteral","value":0}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[218,88],"start":[206,3]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[206,39],"start":[206,25]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"mkCons","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[206,84],"start":[206,25]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[206,54],"start":[206,41]}},"kind":"Var","type":{"annotation":[{"end":[471,83],"name":"tests/purus/passing/prelude/Prelude.purs","start":[471,3]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[471,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[471,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":27,"type":{"annotation":[{"end":[471,83],"name":"tests/purus/passing/prelude/Prelude.purs","start":[471,24]},[]],"contents":[{"annotation":[{"end":[471,83],"name":"tests/purus/passing/prelude/Prelude.purs","start":[471,24]},[]],"contents":[{"annotation":[{"end":[471,53],"name":"tests/purus/passing/prelude/Prelude.purs","start":[471,51]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[471,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[471,25]},[]],"contents":[{"annotation":[{"end":[471,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[471,25]},[]],"contents":[{"annotation":[{"end":[471,29],"name":"tests/purus/passing/prelude/Prelude.purs","start":[471,27]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[471,26],"name":"tests/purus/passing/prelude/Prelude.purs","start":[471,25]},[]],"contents":{"kind":{"annotation":[{"end":[471,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[471,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[471,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[471,30]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[471,83],"name":"tests/purus/passing/prelude/Prelude.purs","start":[471,54]},[]],"contents":[{"annotation":[{"end":[471,83],"name":"tests/purus/passing/prelude/Prelude.purs","start":[471,54]},[]],"contents":[{"annotation":[{"end":[471,63],"name":"tests/purus/passing/prelude/Prelude.purs","start":[471,61]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[471,60],"name":"tests/purus/passing/prelude/Prelude.purs","start":[471,54]},[]],"contents":[{"annotation":[{"end":[471,58],"name":"tests/purus/passing/prelude/Prelude.purs","start":[471,54]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[471,60],"name":"tests/purus/passing/prelude/Prelude.purs","start":[471,59]},[]],"contents":{"kind":{"annotation":[{"end":[471,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[471,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[471,83],"name":"tests/purus/passing/prelude/Prelude.purs","start":[471,64]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"serializeList","moduleName":["Prelude"]}},"annotation":{"meta":null,"sourceSpan":{"end":[206,72],"start":[206,41]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[206,72],"start":[206,55]}},"kind":"Var","type":{"annotation":[{"end":[298,53],"name":"tests/purus/passing/prelude/Prelude.purs","start":[298,22]},[]],"contents":[{"annotation":[{"end":[298,53],"name":"tests/purus/passing/prelude/Prelude.purs","start":[298,22]},[]],"contents":[{"annotation":[{"end":[298,33],"name":"tests/purus/passing/prelude/Prelude.purs","start":[298,31]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[298,30],"name":"tests/purus/passing/prelude/Prelude.purs","start":[298,22]},[]],"contents":[["Prim"],"TxInInfo"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[298,53],"name":"tests/purus/passing/prelude/Prelude.purs","start":[298,34]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"serializeTxInInfo","moduleName":["Prelude"]}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[206,83],"start":[206,41]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[206,83],"start":[206,73]}},"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[206,76],"start":[206,73]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["inputs",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"TxInInfo"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["referenceInputs",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"TxInInfo"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["outputs",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"TxOut"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["fee",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Value"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["mint",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Value"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["dCert",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"DCert"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["wdrl",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"AssocMap"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"StakingCredential"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["validRange",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Interval"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"POSIXTime"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["signatories",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"PubKeyHash"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["redeemers",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"AssocMap"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"ScriptPurpose"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Redeemer"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["data",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"AssocMap"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"DatumHash"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Datum"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["id",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"TxId"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"tag":"REmpty"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"TypeApp"},"value":{"identifier":"rec","sourcePos":[205,25]}},"fieldName":"inputs","kind":"Accessor","type":{"annotation":[{"end":[471,60],"name":"tests/purus/passing/prelude/Prelude.purs","start":[471,54]},[]],"contents":[{"annotation":[{"end":[471,58],"name":"tests/purus/passing/prelude/Prelude.purs","start":[471,54]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[298,30],"name":"tests/purus/passing/prelude/Prelude.purs","start":[298,22]},[]],"contents":[["Prim"],"TxInInfo"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"kind":"App"},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[218,87],"start":[206,25]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[207,34],"start":[207,20]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"mkCons","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[207,88],"start":[207,20]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[207,49],"start":[207,36]}},"kind":"Var","type":{"annotation":[{"end":[471,83],"name":"tests/purus/passing/prelude/Prelude.purs","start":[471,3]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[471,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[471,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":27,"type":{"annotation":[{"end":[471,83],"name":"tests/purus/passing/prelude/Prelude.purs","start":[471,24]},[]],"contents":[{"annotation":[{"end":[471,83],"name":"tests/purus/passing/prelude/Prelude.purs","start":[471,24]},[]],"contents":[{"annotation":[{"end":[471,53],"name":"tests/purus/passing/prelude/Prelude.purs","start":[471,51]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[471,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[471,25]},[]],"contents":[{"annotation":[{"end":[471,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[471,25]},[]],"contents":[{"annotation":[{"end":[471,29],"name":"tests/purus/passing/prelude/Prelude.purs","start":[471,27]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[471,26],"name":"tests/purus/passing/prelude/Prelude.purs","start":[471,25]},[]],"contents":{"kind":{"annotation":[{"end":[471,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[471,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[471,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[471,30]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[471,83],"name":"tests/purus/passing/prelude/Prelude.purs","start":[471,54]},[]],"contents":[{"annotation":[{"end":[471,83],"name":"tests/purus/passing/prelude/Prelude.purs","start":[471,54]},[]],"contents":[{"annotation":[{"end":[471,63],"name":"tests/purus/passing/prelude/Prelude.purs","start":[471,61]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[471,60],"name":"tests/purus/passing/prelude/Prelude.purs","start":[471,54]},[]],"contents":[{"annotation":[{"end":[471,58],"name":"tests/purus/passing/prelude/Prelude.purs","start":[471,54]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[471,60],"name":"tests/purus/passing/prelude/Prelude.purs","start":[471,59]},[]],"contents":{"kind":{"annotation":[{"end":[471,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[471,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[471,83],"name":"tests/purus/passing/prelude/Prelude.purs","start":[471,64]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"serializeList","moduleName":["Prelude"]}},"annotation":{"meta":null,"sourceSpan":{"end":[207,67],"start":[207,36]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[207,67],"start":[207,50]}},"kind":"Var","type":{"annotation":[{"end":[298,53],"name":"tests/purus/passing/prelude/Prelude.purs","start":[298,22]},[]],"contents":[{"annotation":[{"end":[298,53],"name":"tests/purus/passing/prelude/Prelude.purs","start":[298,22]},[]],"contents":[{"annotation":[{"end":[298,33],"name":"tests/purus/passing/prelude/Prelude.purs","start":[298,31]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[298,30],"name":"tests/purus/passing/prelude/Prelude.purs","start":[298,22]},[]],"contents":[["Prim"],"TxInInfo"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[298,53],"name":"tests/purus/passing/prelude/Prelude.purs","start":[298,34]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"serializeTxInInfo","moduleName":["Prelude"]}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[207,87],"start":[207,36]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[207,87],"start":[207,68]}},"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[207,71],"start":[207,68]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["inputs",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"TxInInfo"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["referenceInputs",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"TxInInfo"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["outputs",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"TxOut"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["fee",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Value"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["mint",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Value"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["dCert",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"DCert"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["wdrl",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"AssocMap"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"StakingCredential"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["validRange",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Interval"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"POSIXTime"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["signatories",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"PubKeyHash"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["redeemers",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"AssocMap"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"ScriptPurpose"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Redeemer"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["data",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"AssocMap"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"DatumHash"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Datum"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["id",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"TxId"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"tag":"REmpty"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"TypeApp"},"value":{"identifier":"rec","sourcePos":[205,25]}},"fieldName":"referenceInputs","kind":"Accessor","type":{"annotation":[{"end":[471,60],"name":"tests/purus/passing/prelude/Prelude.purs","start":[471,54]},[]],"contents":[{"annotation":[{"end":[471,58],"name":"tests/purus/passing/prelude/Prelude.purs","start":[471,54]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[298,30],"name":"tests/purus/passing/prelude/Prelude.purs","start":[298,22]},[]],"contents":[["Prim"],"TxInInfo"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"kind":"App"},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[218,86],"start":[207,20]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[208,37],"start":[208,23]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"mkCons","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[208,80],"start":[208,23]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[208,52],"start":[208,39]}},"kind":"Var","type":{"annotation":[{"end":[471,83],"name":"tests/purus/passing/prelude/Prelude.purs","start":[471,3]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[471,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[471,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":27,"type":{"annotation":[{"end":[471,83],"name":"tests/purus/passing/prelude/Prelude.purs","start":[471,24]},[]],"contents":[{"annotation":[{"end":[471,83],"name":"tests/purus/passing/prelude/Prelude.purs","start":[471,24]},[]],"contents":[{"annotation":[{"end":[471,53],"name":"tests/purus/passing/prelude/Prelude.purs","start":[471,51]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[471,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[471,25]},[]],"contents":[{"annotation":[{"end":[471,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[471,25]},[]],"contents":[{"annotation":[{"end":[471,29],"name":"tests/purus/passing/prelude/Prelude.purs","start":[471,27]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[471,26],"name":"tests/purus/passing/prelude/Prelude.purs","start":[471,25]},[]],"contents":{"kind":{"annotation":[{"end":[471,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[471,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[471,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[471,30]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[471,83],"name":"tests/purus/passing/prelude/Prelude.purs","start":[471,54]},[]],"contents":[{"annotation":[{"end":[471,83],"name":"tests/purus/passing/prelude/Prelude.purs","start":[471,54]},[]],"contents":[{"annotation":[{"end":[471,63],"name":"tests/purus/passing/prelude/Prelude.purs","start":[471,61]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[471,60],"name":"tests/purus/passing/prelude/Prelude.purs","start":[471,54]},[]],"contents":[{"annotation":[{"end":[471,58],"name":"tests/purus/passing/prelude/Prelude.purs","start":[471,54]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[471,60],"name":"tests/purus/passing/prelude/Prelude.purs","start":[471,59]},[]],"contents":{"kind":{"annotation":[{"end":[471,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[471,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[471,83],"name":"tests/purus/passing/prelude/Prelude.purs","start":[471,64]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"serializeList","moduleName":["Prelude"]}},"annotation":{"meta":null,"sourceSpan":{"end":[208,67],"start":[208,39]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[208,67],"start":[208,53]}},"kind":"Var","type":{"annotation":[{"end":[260,47],"name":"tests/purus/passing/prelude/Prelude.purs","start":[260,19]},[]],"contents":[{"annotation":[{"end":[260,47],"name":"tests/purus/passing/prelude/Prelude.purs","start":[260,19]},[]],"contents":[{"annotation":[{"end":[260,27],"name":"tests/purus/passing/prelude/Prelude.purs","start":[260,25]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[260,24],"name":"tests/purus/passing/prelude/Prelude.purs","start":[260,19]},[]],"contents":[["Prim"],"TxOut"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[260,47],"name":"tests/purus/passing/prelude/Prelude.purs","start":[260,28]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"serializeTxOut","moduleName":["Prelude"]}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[208,79],"start":[208,39]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[208,79],"start":[208,68]}},"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[208,71],"start":[208,68]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["inputs",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"TxInInfo"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["referenceInputs",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"TxInInfo"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["outputs",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"TxOut"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["fee",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Value"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["mint",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Value"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["dCert",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"DCert"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["wdrl",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"AssocMap"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"StakingCredential"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["validRange",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Interval"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"POSIXTime"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["signatories",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"PubKeyHash"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["redeemers",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"AssocMap"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"ScriptPurpose"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Redeemer"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["data",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"AssocMap"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"DatumHash"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Datum"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["id",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"TxId"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"tag":"REmpty"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"TypeApp"},"value":{"identifier":"rec","sourcePos":[205,25]}},"fieldName":"outputs","kind":"Accessor","type":{"annotation":[{"end":[471,60],"name":"tests/purus/passing/prelude/Prelude.purs","start":[471,54]},[]],"contents":[{"annotation":[{"end":[471,58],"name":"tests/purus/passing/prelude/Prelude.purs","start":[471,54]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[260,24],"name":"tests/purus/passing/prelude/Prelude.purs","start":[260,19]},[]],"contents":[["Prim"],"TxOut"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"kind":"App"},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[218,85],"start":[208,23]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[209,40],"start":[209,26]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"mkCons","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[209,65],"start":[209,26]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[209,56],"start":[209,42]}},"kind":"Var","type":{"annotation":[{"end":[138,47],"name":"tests/purus/passing/prelude/Prelude.purs","start":[138,19]},[]],"contents":[{"annotation":[{"end":[138,47],"name":"tests/purus/passing/prelude/Prelude.purs","start":[138,19]},[]],"contents":[{"annotation":[{"end":[138,27],"name":"tests/purus/passing/prelude/Prelude.purs","start":[138,25]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[138,24],"name":"tests/purus/passing/prelude/Prelude.purs","start":[138,19]},[]],"contents":[["Prim"],"Value"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[138,47],"name":"tests/purus/passing/prelude/Prelude.purs","start":[138,28]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"serializeValue","moduleName":["Prelude"]}},"annotation":{"meta":null,"sourceSpan":{"end":[209,64],"start":[209,42]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[209,64],"start":[209,57]}},"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[209,60],"start":[209,57]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["inputs",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"TxInInfo"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["referenceInputs",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"TxInInfo"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["outputs",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"TxOut"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["fee",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Value"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["mint",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Value"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["dCert",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"DCert"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["wdrl",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"AssocMap"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"StakingCredential"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["validRange",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Interval"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"POSIXTime"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["signatories",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"PubKeyHash"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["redeemers",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"AssocMap"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"ScriptPurpose"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Redeemer"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["data",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"AssocMap"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"DatumHash"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Datum"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["id",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"TxId"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"tag":"REmpty"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"TypeApp"},"value":{"identifier":"rec","sourcePos":[205,25]}},"fieldName":"fee","kind":"Accessor","type":{"annotation":[{"end":[138,24],"name":"tests/purus/passing/prelude/Prelude.purs","start":[138,19]},[]],"contents":[["Prim"],"Value"],"tag":"TypeConstructor"}},"kind":"App"},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[218,84],"start":[209,26]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[210,43],"start":[210,29]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"mkCons","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[210,69],"start":[210,29]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[210,59],"start":[210,45]}},"kind":"Var","type":{"annotation":[{"end":[138,47],"name":"tests/purus/passing/prelude/Prelude.purs","start":[138,19]},[]],"contents":[{"annotation":[{"end":[138,47],"name":"tests/purus/passing/prelude/Prelude.purs","start":[138,19]},[]],"contents":[{"annotation":[{"end":[138,27],"name":"tests/purus/passing/prelude/Prelude.purs","start":[138,25]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[138,24],"name":"tests/purus/passing/prelude/Prelude.purs","start":[138,19]},[]],"contents":[["Prim"],"Value"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[138,47],"name":"tests/purus/passing/prelude/Prelude.purs","start":[138,28]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"serializeValue","moduleName":["Prelude"]}},"annotation":{"meta":null,"sourceSpan":{"end":[210,68],"start":[210,45]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[210,68],"start":[210,60]}},"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[210,63],"start":[210,60]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["inputs",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"TxInInfo"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["referenceInputs",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"TxInInfo"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["outputs",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"TxOut"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["fee",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Value"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["mint",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Value"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["dCert",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"DCert"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["wdrl",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"AssocMap"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"StakingCredential"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["validRange",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Interval"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"POSIXTime"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["signatories",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"PubKeyHash"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["redeemers",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"AssocMap"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"ScriptPurpose"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Redeemer"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["data",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"AssocMap"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"DatumHash"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Datum"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["id",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"TxId"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"tag":"REmpty"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"TypeApp"},"value":{"identifier":"rec","sourcePos":[205,25]}},"fieldName":"mint","kind":"Accessor","type":{"annotation":[{"end":[138,24],"name":"tests/purus/passing/prelude/Prelude.purs","start":[138,19]},[]],"contents":[["Prim"],"Value"],"tag":"TypeConstructor"}},"kind":"App"},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[218,83],"start":[210,29]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[211,46],"start":[211,32]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"mkCons","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[211,87],"start":[211,32]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[211,61],"start":[211,48]}},"kind":"Var","type":{"annotation":[{"end":[471,83],"name":"tests/purus/passing/prelude/Prelude.purs","start":[471,3]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[471,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[471,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":27,"type":{"annotation":[{"end":[471,83],"name":"tests/purus/passing/prelude/Prelude.purs","start":[471,24]},[]],"contents":[{"annotation":[{"end":[471,83],"name":"tests/purus/passing/prelude/Prelude.purs","start":[471,24]},[]],"contents":[{"annotation":[{"end":[471,53],"name":"tests/purus/passing/prelude/Prelude.purs","start":[471,51]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[471,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[471,25]},[]],"contents":[{"annotation":[{"end":[471,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[471,25]},[]],"contents":[{"annotation":[{"end":[471,29],"name":"tests/purus/passing/prelude/Prelude.purs","start":[471,27]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[471,26],"name":"tests/purus/passing/prelude/Prelude.purs","start":[471,25]},[]],"contents":{"kind":{"annotation":[{"end":[471,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[471,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[471,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[471,30]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[471,83],"name":"tests/purus/passing/prelude/Prelude.purs","start":[471,54]},[]],"contents":[{"annotation":[{"end":[471,83],"name":"tests/purus/passing/prelude/Prelude.purs","start":[471,54]},[]],"contents":[{"annotation":[{"end":[471,63],"name":"tests/purus/passing/prelude/Prelude.purs","start":[471,61]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[471,60],"name":"tests/purus/passing/prelude/Prelude.purs","start":[471,54]},[]],"contents":[{"annotation":[{"end":[471,58],"name":"tests/purus/passing/prelude/Prelude.purs","start":[471,54]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[471,60],"name":"tests/purus/passing/prelude/Prelude.purs","start":[471,59]},[]],"contents":{"kind":{"annotation":[{"end":[471,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[471,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[471,83],"name":"tests/purus/passing/prelude/Prelude.purs","start":[471,64]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"serializeList","moduleName":["Prelude"]}},"annotation":{"meta":null,"sourceSpan":{"end":[211,76],"start":[211,48]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[211,76],"start":[211,62]}},"kind":"Var","type":{"annotation":[{"end":[42,47],"name":"tests/purus/passing/prelude/Prelude.purs","start":[42,19]},[]],"contents":[{"annotation":[{"end":[42,47],"name":"tests/purus/passing/prelude/Prelude.purs","start":[42,19]},[]],"contents":[{"annotation":[{"end":[42,27],"name":"tests/purus/passing/prelude/Prelude.purs","start":[42,25]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[42,24],"name":"tests/purus/passing/prelude/Prelude.purs","start":[42,19]},[]],"contents":[["Prim"],"DCert"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[42,47],"name":"tests/purus/passing/prelude/Prelude.purs","start":[42,28]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"serializeDCert","moduleName":["Prelude"]}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[211,86],"start":[211,48]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[211,86],"start":[211,77]}},"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[211,80],"start":[211,77]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["inputs",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"TxInInfo"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["referenceInputs",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"TxInInfo"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["outputs",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"TxOut"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["fee",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Value"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["mint",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Value"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["dCert",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"DCert"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["wdrl",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"AssocMap"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"StakingCredential"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["validRange",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Interval"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"POSIXTime"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["signatories",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"PubKeyHash"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["redeemers",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"AssocMap"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"ScriptPurpose"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Redeemer"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["data",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"AssocMap"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"DatumHash"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Datum"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["id",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"TxId"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"tag":"REmpty"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"TypeApp"},"value":{"identifier":"rec","sourcePos":[205,25]}},"fieldName":"dCert","kind":"Accessor","type":{"annotation":[{"end":[471,60],"name":"tests/purus/passing/prelude/Prelude.purs","start":[471,54]},[]],"contents":[{"annotation":[{"end":[471,58],"name":"tests/purus/passing/prelude/Prelude.purs","start":[471,54]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[42,24],"name":"tests/purus/passing/prelude/Prelude.purs","start":[42,19]},[]],"contents":[["Prim"],"DCert"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"kind":"App"},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[218,82],"start":[211,32]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[212,49],"start":[212,35]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"mkCons","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[212,118],"start":[212,35]}},"argument":{"abstraction":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[212,68],"start":[212,51]}},"kind":"Var","type":{"annotation":[{"end":[397,22],"name":"tests/purus/passing/prelude/Prelude.purs","start":[393,3]},[]],"contents":{"identifier":"k","kind":{"annotation":[{"end":[393,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[393,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":67,"type":{"annotation":[{"end":[397,22],"name":"tests/purus/passing/prelude/Prelude.purs","start":[393,23]},[]],"contents":{"identifier":"v","kind":{"annotation":[{"end":[393,32],"name":"tests/purus/passing/prelude/Prelude.purs","start":[393,28]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":66,"type":{"annotation":[{"end":[397,22],"name":"tests/purus/passing/prelude/Prelude.purs","start":[394,3]},[]],"contents":[{"annotation":[{"end":[397,22],"name":"tests/purus/passing/prelude/Prelude.purs","start":[394,3]},[]],"contents":[{"annotation":[{"end":[394,32],"name":"tests/purus/passing/prelude/Prelude.purs","start":[394,30]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[394,28],"name":"tests/purus/passing/prelude/Prelude.purs","start":[394,4]},[]],"contents":[{"annotation":[{"end":[394,28],"name":"tests/purus/passing/prelude/Prelude.purs","start":[394,4]},[]],"contents":[{"annotation":[{"end":[394,8],"name":"tests/purus/passing/prelude/Prelude.purs","start":[394,6]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[394,5],"name":"tests/purus/passing/prelude/Prelude.purs","start":[394,4]},[]],"contents":{"kind":{"annotation":[{"end":[393,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[393,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"k"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[394,28],"name":"tests/purus/passing/prelude/Prelude.purs","start":[394,9]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[397,22],"name":"tests/purus/passing/prelude/Prelude.purs","start":[395,3]},[]],"contents":[{"annotation":[{"end":[397,22],"name":"tests/purus/passing/prelude/Prelude.purs","start":[395,3]},[]],"contents":[{"annotation":[{"end":[395,32],"name":"tests/purus/passing/prelude/Prelude.purs","start":[395,30]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[395,28],"name":"tests/purus/passing/prelude/Prelude.purs","start":[395,4]},[]],"contents":[{"annotation":[{"end":[395,28],"name":"tests/purus/passing/prelude/Prelude.purs","start":[395,4]},[]],"contents":[{"annotation":[{"end":[395,8],"name":"tests/purus/passing/prelude/Prelude.purs","start":[395,6]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[395,5],"name":"tests/purus/passing/prelude/Prelude.purs","start":[395,4]},[]],"contents":{"kind":{"annotation":[{"end":[393,32],"name":"tests/purus/passing/prelude/Prelude.purs","start":[393,28]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"v"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[395,28],"name":"tests/purus/passing/prelude/Prelude.purs","start":[395,9]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[397,22],"name":"tests/purus/passing/prelude/Prelude.purs","start":[396,3]},[]],"contents":[{"annotation":[{"end":[397,22],"name":"tests/purus/passing/prelude/Prelude.purs","start":[396,3]},[]],"contents":[{"annotation":[{"end":[396,18],"name":"tests/purus/passing/prelude/Prelude.purs","start":[396,16]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[396,15],"name":"tests/purus/passing/prelude/Prelude.purs","start":[396,3]},[]],"contents":[{"annotation":[{"end":[396,13],"name":"tests/purus/passing/prelude/Prelude.purs","start":[396,3]},[]],"contents":[{"annotation":[{"end":[396,11],"name":"tests/purus/passing/prelude/Prelude.purs","start":[396,3]},[]],"contents":[["Prim"],"AssocMap"],"tag":"TypeConstructor"},{"annotation":[{"end":[396,13],"name":"tests/purus/passing/prelude/Prelude.purs","start":[396,12]},[]],"contents":{"kind":{"annotation":[{"end":[393,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[393,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"k"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[396,15],"name":"tests/purus/passing/prelude/Prelude.purs","start":[396,14]},[]],"contents":{"kind":{"annotation":[{"end":[393,32],"name":"tests/purus/passing/prelude/Prelude.purs","start":[393,28]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"v"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[397,22],"name":"tests/purus/passing/prelude/Prelude.purs","start":[397,3]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"serializeAssocMap","moduleName":["Prelude"]}},"annotation":{"meta":null,"sourceSpan":{"end":[212,95],"start":[212,51]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[212,95],"start":[212,69]}},"kind":"Var","type":{"annotation":[{"end":[100,71],"name":"tests/purus/passing/prelude/Prelude.purs","start":[100,31]},[]],"contents":[{"annotation":[{"end":[100,71],"name":"tests/purus/passing/prelude/Prelude.purs","start":[100,31]},[]],"contents":[{"annotation":[{"end":[100,51],"name":"tests/purus/passing/prelude/Prelude.purs","start":[100,49]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[100,48],"name":"tests/purus/passing/prelude/Prelude.purs","start":[100,31]},[]],"contents":[["Prim"],"StakingCredential"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[100,71],"name":"tests/purus/passing/prelude/Prelude.purs","start":[100,52]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"serializeStakingCredential","moduleName":["Prelude"]}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[212,108],"start":[212,51]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[212,108],"start":[212,96]}},"kind":"Var","type":{"annotation":[{"end":[458,43],"name":"tests/purus/passing/prelude/Prelude.purs","start":[458,17]},[]],"contents":[{"annotation":[{"end":[458,43],"name":"tests/purus/passing/prelude/Prelude.purs","start":[458,17]},[]],"contents":[{"annotation":[{"end":[458,23],"name":"tests/purus/passing/prelude/Prelude.purs","start":[458,21]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[458,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[458,17]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[458,43],"name":"tests/purus/passing/prelude/Prelude.purs","start":[458,24]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"serializeInt","moduleName":["Prelude"]}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[212,117],"start":[212,51]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[212,117],"start":[212,109]}},"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[212,112],"start":[212,109]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["inputs",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"TxInInfo"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["referenceInputs",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"TxInInfo"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["outputs",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"TxOut"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["fee",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Value"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["mint",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Value"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["dCert",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"DCert"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["wdrl",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"AssocMap"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"StakingCredential"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["validRange",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Interval"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"POSIXTime"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["signatories",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"PubKeyHash"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["redeemers",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"AssocMap"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"ScriptPurpose"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Redeemer"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["data",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"AssocMap"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"DatumHash"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Datum"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["id",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"TxId"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"tag":"REmpty"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"TypeApp"},"value":{"identifier":"rec","sourcePos":[205,25]}},"fieldName":"wdrl","kind":"Accessor","type":{"annotation":[{"end":[396,15],"name":"tests/purus/passing/prelude/Prelude.purs","start":[396,3]},[]],"contents":[{"annotation":[{"end":[396,13],"name":"tests/purus/passing/prelude/Prelude.purs","start":[396,3]},[]],"contents":[{"annotation":[{"end":[396,11],"name":"tests/purus/passing/prelude/Prelude.purs","start":[396,3]},[]],"contents":[["Prim"],"AssocMap"],"tag":"TypeConstructor"},{"annotation":[{"end":[100,48],"name":"tests/purus/passing/prelude/Prelude.purs","start":[100,31]},[]],"contents":[["Prim"],"StakingCredential"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[458,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[458,17]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"kind":"App"},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[218,81],"start":[212,35]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[213,52],"start":[213,38]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"mkCons","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[213,106],"start":[213,38]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[213,71],"start":[213,54]}},"kind":"Var","type":{"annotation":[{"end":[331,87],"name":"tests/purus/passing/prelude/Prelude.purs","start":[331,3]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[331,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[331,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":39,"type":{"annotation":[{"end":[331,87],"name":"tests/purus/passing/prelude/Prelude.purs","start":[331,24]},[]],"contents":[{"annotation":[{"end":[331,87],"name":"tests/purus/passing/prelude/Prelude.purs","start":[331,24]},[]],"contents":[{"annotation":[{"end":[331,53],"name":"tests/purus/passing/prelude/Prelude.purs","start":[331,51]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[331,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[331,25]},[]],"contents":[{"annotation":[{"end":[331,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[331,25]},[]],"contents":[{"annotation":[{"end":[331,29],"name":"tests/purus/passing/prelude/Prelude.purs","start":[331,27]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[331,26],"name":"tests/purus/passing/prelude/Prelude.purs","start":[331,25]},[]],"contents":{"kind":{"annotation":[{"end":[331,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[331,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[331,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[331,30]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[331,87],"name":"tests/purus/passing/prelude/Prelude.purs","start":[331,54]},[]],"contents":[{"annotation":[{"end":[331,87],"name":"tests/purus/passing/prelude/Prelude.purs","start":[331,54]},[]],"contents":[{"annotation":[{"end":[331,67],"name":"tests/purus/passing/prelude/Prelude.purs","start":[331,65]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[331,64],"name":"tests/purus/passing/prelude/Prelude.purs","start":[331,54]},[]],"contents":[{"annotation":[{"end":[331,62],"name":"tests/purus/passing/prelude/Prelude.purs","start":[331,54]},[]],"contents":[["Prim"],"Interval"],"tag":"TypeConstructor"},{"annotation":[{"end":[331,64],"name":"tests/purus/passing/prelude/Prelude.purs","start":[331,63]},[]],"contents":{"kind":{"annotation":[{"end":[331,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[331,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[331,87],"name":"tests/purus/passing/prelude/Prelude.purs","start":[331,68]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"serializeInterval","moduleName":["Prelude"]}},"annotation":{"meta":null,"sourceSpan":{"end":[213,90],"start":[213,54]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[213,90],"start":[213,72]}},"kind":"Var","type":{"annotation":[{"end":[165,55],"name":"tests/purus/passing/prelude/Prelude.purs","start":[165,23]},[]],"contents":[{"annotation":[{"end":[165,55],"name":"tests/purus/passing/prelude/Prelude.purs","start":[165,23]},[]],"contents":[{"annotation":[{"end":[165,35],"name":"tests/purus/passing/prelude/Prelude.purs","start":[165,33]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[165,32],"name":"tests/purus/passing/prelude/Prelude.purs","start":[165,23]},[]],"contents":[["Prim"],"POSIXTime"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[165,55],"name":"tests/purus/passing/prelude/Prelude.purs","start":[165,36]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"serializePOSIXTime","moduleName":["Prelude"]}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[213,105],"start":[213,54]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[213,105],"start":[213,91]}},"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[213,94],"start":[213,91]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["inputs",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"TxInInfo"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["referenceInputs",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"TxInInfo"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["outputs",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"TxOut"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["fee",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Value"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["mint",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Value"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["dCert",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"DCert"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["wdrl",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"AssocMap"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"StakingCredential"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["validRange",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Interval"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"POSIXTime"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["signatories",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"PubKeyHash"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["redeemers",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"AssocMap"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"ScriptPurpose"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Redeemer"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["data",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"AssocMap"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"DatumHash"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Datum"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["id",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"TxId"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"tag":"REmpty"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"TypeApp"},"value":{"identifier":"rec","sourcePos":[205,25]}},"fieldName":"validRange","kind":"Accessor","type":{"annotation":[{"end":[331,64],"name":"tests/purus/passing/prelude/Prelude.purs","start":[331,54]},[]],"contents":[{"annotation":[{"end":[331,62],"name":"tests/purus/passing/prelude/Prelude.purs","start":[331,54]},[]],"contents":[["Prim"],"Interval"],"tag":"TypeConstructor"},{"annotation":[{"end":[165,32],"name":"tests/purus/passing/prelude/Prelude.purs","start":[165,23]},[]],"contents":[["Prim"],"POSIXTime"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"kind":"App"},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[218,80],"start":[213,38]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[214,55],"start":[214,41]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"mkCons","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[214,107],"start":[214,41]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[214,70],"start":[214,57]}},"kind":"Var","type":{"annotation":[{"end":[471,83],"name":"tests/purus/passing/prelude/Prelude.purs","start":[471,3]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[471,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[471,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":27,"type":{"annotation":[{"end":[471,83],"name":"tests/purus/passing/prelude/Prelude.purs","start":[471,24]},[]],"contents":[{"annotation":[{"end":[471,83],"name":"tests/purus/passing/prelude/Prelude.purs","start":[471,24]},[]],"contents":[{"annotation":[{"end":[471,53],"name":"tests/purus/passing/prelude/Prelude.purs","start":[471,51]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[471,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[471,25]},[]],"contents":[{"annotation":[{"end":[471,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[471,25]},[]],"contents":[{"annotation":[{"end":[471,29],"name":"tests/purus/passing/prelude/Prelude.purs","start":[471,27]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[471,26],"name":"tests/purus/passing/prelude/Prelude.purs","start":[471,25]},[]],"contents":{"kind":{"annotation":[{"end":[471,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[471,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[471,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[471,30]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[471,83],"name":"tests/purus/passing/prelude/Prelude.purs","start":[471,54]},[]],"contents":[{"annotation":[{"end":[471,83],"name":"tests/purus/passing/prelude/Prelude.purs","start":[471,54]},[]],"contents":[{"annotation":[{"end":[471,63],"name":"tests/purus/passing/prelude/Prelude.purs","start":[471,61]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[471,60],"name":"tests/purus/passing/prelude/Prelude.purs","start":[471,54]},[]],"contents":[{"annotation":[{"end":[471,58],"name":"tests/purus/passing/prelude/Prelude.purs","start":[471,54]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[471,60],"name":"tests/purus/passing/prelude/Prelude.purs","start":[471,59]},[]],"contents":{"kind":{"annotation":[{"end":[471,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[471,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[471,83],"name":"tests/purus/passing/prelude/Prelude.purs","start":[471,64]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"serializeList","moduleName":["Prelude"]}},"annotation":{"meta":null,"sourceSpan":{"end":[214,90],"start":[214,57]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[214,90],"start":[214,71]}},"kind":"Var","type":{"annotation":[{"end":[186,57],"name":"tests/purus/passing/prelude/Prelude.purs","start":[186,24]},[]],"contents":[{"annotation":[{"end":[186,57],"name":"tests/purus/passing/prelude/Prelude.purs","start":[186,24]},[]],"contents":[{"annotation":[{"end":[186,37],"name":"tests/purus/passing/prelude/Prelude.purs","start":[186,35]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[186,34],"name":"tests/purus/passing/prelude/Prelude.purs","start":[186,24]},[]],"contents":[["Prim"],"PubKeyHash"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[186,57],"name":"tests/purus/passing/prelude/Prelude.purs","start":[186,38]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"serializePubKeyHash","moduleName":["Prelude"]}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[214,106],"start":[214,57]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[214,106],"start":[214,91]}},"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[214,94],"start":[214,91]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["inputs",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"TxInInfo"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["referenceInputs",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"TxInInfo"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["outputs",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"TxOut"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["fee",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Value"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["mint",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Value"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["dCert",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"DCert"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["wdrl",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"AssocMap"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"StakingCredential"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["validRange",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Interval"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"POSIXTime"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["signatories",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"PubKeyHash"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["redeemers",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"AssocMap"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"ScriptPurpose"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Redeemer"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["data",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"AssocMap"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"DatumHash"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Datum"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["id",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"TxId"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"tag":"REmpty"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"TypeApp"},"value":{"identifier":"rec","sourcePos":[205,25]}},"fieldName":"signatories","kind":"Accessor","type":{"annotation":[{"end":[471,60],"name":"tests/purus/passing/prelude/Prelude.purs","start":[471,54]},[]],"contents":[{"annotation":[{"end":[471,58],"name":"tests/purus/passing/prelude/Prelude.purs","start":[471,54]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[186,34],"name":"tests/purus/passing/prelude/Prelude.purs","start":[186,24]},[]],"contents":[["Prim"],"PubKeyHash"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"kind":"App"},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[218,79],"start":[214,41]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[215,58],"start":[215,44]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"mkCons","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[215,133],"start":[215,44]}},"argument":{"abstraction":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[215,77],"start":[215,60]}},"kind":"Var","type":{"annotation":[{"end":[397,22],"name":"tests/purus/passing/prelude/Prelude.purs","start":[393,3]},[]],"contents":{"identifier":"k","kind":{"annotation":[{"end":[393,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[393,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":67,"type":{"annotation":[{"end":[397,22],"name":"tests/purus/passing/prelude/Prelude.purs","start":[393,23]},[]],"contents":{"identifier":"v","kind":{"annotation":[{"end":[393,32],"name":"tests/purus/passing/prelude/Prelude.purs","start":[393,28]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":66,"type":{"annotation":[{"end":[397,22],"name":"tests/purus/passing/prelude/Prelude.purs","start":[394,3]},[]],"contents":[{"annotation":[{"end":[397,22],"name":"tests/purus/passing/prelude/Prelude.purs","start":[394,3]},[]],"contents":[{"annotation":[{"end":[394,32],"name":"tests/purus/passing/prelude/Prelude.purs","start":[394,30]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[394,28],"name":"tests/purus/passing/prelude/Prelude.purs","start":[394,4]},[]],"contents":[{"annotation":[{"end":[394,28],"name":"tests/purus/passing/prelude/Prelude.purs","start":[394,4]},[]],"contents":[{"annotation":[{"end":[394,8],"name":"tests/purus/passing/prelude/Prelude.purs","start":[394,6]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[394,5],"name":"tests/purus/passing/prelude/Prelude.purs","start":[394,4]},[]],"contents":{"kind":{"annotation":[{"end":[393,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[393,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"k"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[394,28],"name":"tests/purus/passing/prelude/Prelude.purs","start":[394,9]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[397,22],"name":"tests/purus/passing/prelude/Prelude.purs","start":[395,3]},[]],"contents":[{"annotation":[{"end":[397,22],"name":"tests/purus/passing/prelude/Prelude.purs","start":[395,3]},[]],"contents":[{"annotation":[{"end":[395,32],"name":"tests/purus/passing/prelude/Prelude.purs","start":[395,30]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[395,28],"name":"tests/purus/passing/prelude/Prelude.purs","start":[395,4]},[]],"contents":[{"annotation":[{"end":[395,28],"name":"tests/purus/passing/prelude/Prelude.purs","start":[395,4]},[]],"contents":[{"annotation":[{"end":[395,8],"name":"tests/purus/passing/prelude/Prelude.purs","start":[395,6]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[395,5],"name":"tests/purus/passing/prelude/Prelude.purs","start":[395,4]},[]],"contents":{"kind":{"annotation":[{"end":[393,32],"name":"tests/purus/passing/prelude/Prelude.purs","start":[393,28]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"v"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[395,28],"name":"tests/purus/passing/prelude/Prelude.purs","start":[395,9]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[397,22],"name":"tests/purus/passing/prelude/Prelude.purs","start":[396,3]},[]],"contents":[{"annotation":[{"end":[397,22],"name":"tests/purus/passing/prelude/Prelude.purs","start":[396,3]},[]],"contents":[{"annotation":[{"end":[396,18],"name":"tests/purus/passing/prelude/Prelude.purs","start":[396,16]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[396,15],"name":"tests/purus/passing/prelude/Prelude.purs","start":[396,3]},[]],"contents":[{"annotation":[{"end":[396,13],"name":"tests/purus/passing/prelude/Prelude.purs","start":[396,3]},[]],"contents":[{"annotation":[{"end":[396,11],"name":"tests/purus/passing/prelude/Prelude.purs","start":[396,3]},[]],"contents":[["Prim"],"AssocMap"],"tag":"TypeConstructor"},{"annotation":[{"end":[396,13],"name":"tests/purus/passing/prelude/Prelude.purs","start":[396,12]},[]],"contents":{"kind":{"annotation":[{"end":[393,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[393,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"k"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[396,15],"name":"tests/purus/passing/prelude/Prelude.purs","start":[396,14]},[]],"contents":{"kind":{"annotation":[{"end":[393,32],"name":"tests/purus/passing/prelude/Prelude.purs","start":[393,28]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"v"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[397,22],"name":"tests/purus/passing/prelude/Prelude.purs","start":[397,3]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"serializeAssocMap","moduleName":["Prelude"]}},"annotation":{"meta":null,"sourceSpan":{"end":[215,100],"start":[215,60]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[215,100],"start":[215,78]}},"kind":"Var","type":{"annotation":[{"end":[18,63],"name":"tests/purus/passing/prelude/Prelude.purs","start":[18,27]},[]],"contents":[{"annotation":[{"end":[18,63],"name":"tests/purus/passing/prelude/Prelude.purs","start":[18,27]},[]],"contents":[{"annotation":[{"end":[18,43],"name":"tests/purus/passing/prelude/Prelude.purs","start":[18,41]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[18,40],"name":"tests/purus/passing/prelude/Prelude.purs","start":[18,27]},[]],"contents":[["Prim"],"ScriptPurpose"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[18,63],"name":"tests/purus/passing/prelude/Prelude.purs","start":[18,44]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"serializeScriptPurpose","moduleName":["Prelude"]}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[215,118],"start":[215,60]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[215,118],"start":[215,101]}},"kind":"Var","type":{"annotation":[{"end":[434,53],"name":"tests/purus/passing/prelude/Prelude.purs","start":[434,22]},[]],"contents":[{"annotation":[{"end":[434,53],"name":"tests/purus/passing/prelude/Prelude.purs","start":[434,22]},[]],"contents":[{"annotation":[{"end":[434,33],"name":"tests/purus/passing/prelude/Prelude.purs","start":[434,31]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[434,30],"name":"tests/purus/passing/prelude/Prelude.purs","start":[434,22]},[]],"contents":[["Prim"],"Redeemer"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[434,53],"name":"tests/purus/passing/prelude/Prelude.purs","start":[434,34]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"serializeRedeemer","moduleName":["Prelude"]}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[215,132],"start":[215,60]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[215,132],"start":[215,119]}},"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[215,122],"start":[215,119]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["inputs",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"TxInInfo"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["referenceInputs",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"TxInInfo"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["outputs",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"TxOut"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["fee",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Value"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["mint",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Value"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["dCert",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"DCert"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["wdrl",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"AssocMap"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"StakingCredential"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["validRange",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Interval"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"POSIXTime"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["signatories",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"PubKeyHash"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["redeemers",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"AssocMap"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"ScriptPurpose"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Redeemer"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["data",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"AssocMap"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"DatumHash"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Datum"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["id",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"TxId"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"tag":"REmpty"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"TypeApp"},"value":{"identifier":"rec","sourcePos":[205,25]}},"fieldName":"redeemers","kind":"Accessor","type":{"annotation":[{"end":[396,15],"name":"tests/purus/passing/prelude/Prelude.purs","start":[396,3]},[]],"contents":[{"annotation":[{"end":[396,13],"name":"tests/purus/passing/prelude/Prelude.purs","start":[396,3]},[]],"contents":[{"annotation":[{"end":[396,11],"name":"tests/purus/passing/prelude/Prelude.purs","start":[396,3]},[]],"contents":[["Prim"],"AssocMap"],"tag":"TypeConstructor"},{"annotation":[{"end":[18,40],"name":"tests/purus/passing/prelude/Prelude.purs","start":[18,27]},[]],"contents":[["Prim"],"ScriptPurpose"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[434,30],"name":"tests/purus/passing/prelude/Prelude.purs","start":[434,22]},[]],"contents":[["Prim"],"Redeemer"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"kind":"App"},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[218,78],"start":[215,44]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[216,61],"start":[216,47]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"mkCons","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[216,124],"start":[216,47]}},"argument":{"abstraction":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[216,80],"start":[216,63]}},"kind":"Var","type":{"annotation":[{"end":[397,22],"name":"tests/purus/passing/prelude/Prelude.purs","start":[393,3]},[]],"contents":{"identifier":"k","kind":{"annotation":[{"end":[393,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[393,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":67,"type":{"annotation":[{"end":[397,22],"name":"tests/purus/passing/prelude/Prelude.purs","start":[393,23]},[]],"contents":{"identifier":"v","kind":{"annotation":[{"end":[393,32],"name":"tests/purus/passing/prelude/Prelude.purs","start":[393,28]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":66,"type":{"annotation":[{"end":[397,22],"name":"tests/purus/passing/prelude/Prelude.purs","start":[394,3]},[]],"contents":[{"annotation":[{"end":[397,22],"name":"tests/purus/passing/prelude/Prelude.purs","start":[394,3]},[]],"contents":[{"annotation":[{"end":[394,32],"name":"tests/purus/passing/prelude/Prelude.purs","start":[394,30]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[394,28],"name":"tests/purus/passing/prelude/Prelude.purs","start":[394,4]},[]],"contents":[{"annotation":[{"end":[394,28],"name":"tests/purus/passing/prelude/Prelude.purs","start":[394,4]},[]],"contents":[{"annotation":[{"end":[394,8],"name":"tests/purus/passing/prelude/Prelude.purs","start":[394,6]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[394,5],"name":"tests/purus/passing/prelude/Prelude.purs","start":[394,4]},[]],"contents":{"kind":{"annotation":[{"end":[393,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[393,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"k"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[394,28],"name":"tests/purus/passing/prelude/Prelude.purs","start":[394,9]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[397,22],"name":"tests/purus/passing/prelude/Prelude.purs","start":[395,3]},[]],"contents":[{"annotation":[{"end":[397,22],"name":"tests/purus/passing/prelude/Prelude.purs","start":[395,3]},[]],"contents":[{"annotation":[{"end":[395,32],"name":"tests/purus/passing/prelude/Prelude.purs","start":[395,30]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[395,28],"name":"tests/purus/passing/prelude/Prelude.purs","start":[395,4]},[]],"contents":[{"annotation":[{"end":[395,28],"name":"tests/purus/passing/prelude/Prelude.purs","start":[395,4]},[]],"contents":[{"annotation":[{"end":[395,8],"name":"tests/purus/passing/prelude/Prelude.purs","start":[395,6]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[395,5],"name":"tests/purus/passing/prelude/Prelude.purs","start":[395,4]},[]],"contents":{"kind":{"annotation":[{"end":[393,32],"name":"tests/purus/passing/prelude/Prelude.purs","start":[393,28]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"v"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[395,28],"name":"tests/purus/passing/prelude/Prelude.purs","start":[395,9]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[397,22],"name":"tests/purus/passing/prelude/Prelude.purs","start":[396,3]},[]],"contents":[{"annotation":[{"end":[397,22],"name":"tests/purus/passing/prelude/Prelude.purs","start":[396,3]},[]],"contents":[{"annotation":[{"end":[396,18],"name":"tests/purus/passing/prelude/Prelude.purs","start":[396,16]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[396,15],"name":"tests/purus/passing/prelude/Prelude.purs","start":[396,3]},[]],"contents":[{"annotation":[{"end":[396,13],"name":"tests/purus/passing/prelude/Prelude.purs","start":[396,3]},[]],"contents":[{"annotation":[{"end":[396,11],"name":"tests/purus/passing/prelude/Prelude.purs","start":[396,3]},[]],"contents":[["Prim"],"AssocMap"],"tag":"TypeConstructor"},{"annotation":[{"end":[396,13],"name":"tests/purus/passing/prelude/Prelude.purs","start":[396,12]},[]],"contents":{"kind":{"annotation":[{"end":[393,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[393,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"k"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[396,15],"name":"tests/purus/passing/prelude/Prelude.purs","start":[396,14]},[]],"contents":{"kind":{"annotation":[{"end":[393,32],"name":"tests/purus/passing/prelude/Prelude.purs","start":[393,28]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"v"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[397,22],"name":"tests/purus/passing/prelude/Prelude.purs","start":[397,3]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"serializeAssocMap","moduleName":["Prelude"]}},"annotation":{"meta":null,"sourceSpan":{"end":[216,99],"start":[216,63]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[216,99],"start":[216,81]}},"kind":"Var","type":{"annotation":[{"end":[452,55],"name":"tests/purus/passing/prelude/Prelude.purs","start":[452,23]},[]],"contents":[{"annotation":[{"end":[452,55],"name":"tests/purus/passing/prelude/Prelude.purs","start":[452,23]},[]],"contents":[{"annotation":[{"end":[452,35],"name":"tests/purus/passing/prelude/Prelude.purs","start":[452,33]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[452,32],"name":"tests/purus/passing/prelude/Prelude.purs","start":[452,23]},[]],"contents":[["Prim"],"DatumHash"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[452,55],"name":"tests/purus/passing/prelude/Prelude.purs","start":[452,36]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"serializeDatumHash","moduleName":["Prelude"]}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[216,114],"start":[216,63]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[216,114],"start":[216,100]}},"kind":"Var","type":{"annotation":[{"end":[446,47],"name":"tests/purus/passing/prelude/Prelude.purs","start":[446,19]},[]],"contents":[{"annotation":[{"end":[446,47],"name":"tests/purus/passing/prelude/Prelude.purs","start":[446,19]},[]],"contents":[{"annotation":[{"end":[446,27],"name":"tests/purus/passing/prelude/Prelude.purs","start":[446,25]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[446,24],"name":"tests/purus/passing/prelude/Prelude.purs","start":[446,19]},[]],"contents":[["Prim"],"Datum"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[446,47],"name":"tests/purus/passing/prelude/Prelude.purs","start":[446,28]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"serializeDatum","moduleName":["Prelude"]}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[216,123],"start":[216,63]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[216,123],"start":[216,115]}},"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[216,118],"start":[216,115]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["inputs",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"TxInInfo"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["referenceInputs",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"TxInInfo"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["outputs",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"TxOut"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["fee",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Value"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["mint",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Value"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["dCert",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"DCert"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["wdrl",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"AssocMap"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"StakingCredential"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["validRange",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Interval"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"POSIXTime"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["signatories",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"PubKeyHash"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["redeemers",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"AssocMap"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"ScriptPurpose"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Redeemer"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["data",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"AssocMap"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"DatumHash"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Datum"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["id",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"TxId"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"tag":"REmpty"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"TypeApp"},"value":{"identifier":"rec","sourcePos":[205,25]}},"fieldName":"data","kind":"Accessor","type":{"annotation":[{"end":[396,15],"name":"tests/purus/passing/prelude/Prelude.purs","start":[396,3]},[]],"contents":[{"annotation":[{"end":[396,13],"name":"tests/purus/passing/prelude/Prelude.purs","start":[396,3]},[]],"contents":[{"annotation":[{"end":[396,11],"name":"tests/purus/passing/prelude/Prelude.purs","start":[396,3]},[]],"contents":[["Prim"],"AssocMap"],"tag":"TypeConstructor"},{"annotation":[{"end":[452,32],"name":"tests/purus/passing/prelude/Prelude.purs","start":[452,23]},[]],"contents":[["Prim"],"DatumHash"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[446,24],"name":"tests/purus/passing/prelude/Prelude.purs","start":[446,19]},[]],"contents":[["Prim"],"Datum"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"kind":"App"},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[218,77],"start":[216,47]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[217,64],"start":[217,50]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"mkCons","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[217,87],"start":[217,50]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[217,79],"start":[217,66]}},"kind":"Var","type":{"annotation":[{"end":[194,45],"name":"tests/purus/passing/prelude/Prelude.purs","start":[194,18]},[]],"contents":[{"annotation":[{"end":[194,45],"name":"tests/purus/passing/prelude/Prelude.purs","start":[194,18]},[]],"contents":[{"annotation":[{"end":[194,25],"name":"tests/purus/passing/prelude/Prelude.purs","start":[194,23]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[194,22],"name":"tests/purus/passing/prelude/Prelude.purs","start":[194,18]},[]],"contents":[["Prim"],"TxId"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[194,45],"name":"tests/purus/passing/prelude/Prelude.purs","start":[194,26]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"serializeTxId","moduleName":["Prelude"]}},"annotation":{"meta":null,"sourceSpan":{"end":[217,86],"start":[217,66]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[217,86],"start":[217,80]}},"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[217,83],"start":[217,80]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["inputs",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"TxInInfo"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["referenceInputs",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"TxInInfo"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["outputs",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"TxOut"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["fee",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Value"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["mint",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Value"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["dCert",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"DCert"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["wdrl",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"AssocMap"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"StakingCredential"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["validRange",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Interval"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"POSIXTime"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["signatories",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"PubKeyHash"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["redeemers",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"AssocMap"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"ScriptPurpose"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Redeemer"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["data",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"AssocMap"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"DatumHash"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Datum"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["id",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"TxId"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"tag":"REmpty"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"TypeApp"},"value":{"identifier":"rec","sourcePos":[205,25]}},"fieldName":"id","kind":"Accessor","type":{"annotation":[{"end":[194,22],"name":"tests/purus/passing/prelude/Prelude.purs","start":[194,18]},[]],"contents":[["Prim"],"TxId"],"tag":"TypeConstructor"}},"kind":"App"},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[218,76],"start":[217,50]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[218,70],"start":[218,53]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Unit"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"mkNilData","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[218,75],"start":[218,53]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[218,75],"start":[218,71]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Unit"],"tag":"TypeConstructor"},"value":{"identifier":"unit","moduleName":["Prim"]}},"kind":"App"},"kind":"App"},"kind":"App"},"kind":"App"},"kind":"App"},"kind":"App"},"kind":"App"},"kind":"App"},"kind":"App"},"kind":"App"},"kind":"App"},"kind":"App"},"kind":"App"},"kind":"App"},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[218,88],"start":[205,1]}},"kind":"Var","type":{"annotation":[{"end":[204,26],"name":"tests/purus/passing/prelude/Prelude.purs","start":[204,20]},[]],"contents":[["Prim"],"TxInfo"],"tag":"TypeConstructor"},"value":{"identifier":"v","sourcePos":[0,0]}}],"kind":"Case","type":{"annotation":[{"end":[204,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[204,30]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[204,26],"name":"tests/purus/passing/prelude/Prelude.purs","start":[204,20]},[]],"contents":[["Prim"],"TxInfo"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[204,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[204,30]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"identifier":"serializeTxInfo"},{"annotation":{"meta":null,"sourceSpan":{"end":[3,63],"start":[3,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"argument":"v","body":{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":{"metaType":"IsNewtype"},"sourceSpan":{"end":[4,42],"start":[4,25]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[4,42],"start":[4,39]}},"binderType":"VarBinder","identifier":"rec","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["txInfo",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"TxInfo"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["purpose",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"ScriptPurpose"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"tag":"REmpty"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"TypeApp"}}],"constructorName":{"identifier":"ScriptContext","moduleName":["Prim"]},"typeName":{"identifier":"ScriptContext","moduleName":["Prim"]}}],"expression":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[5,21],"start":[5,3]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"constrData","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[5,23],"start":[5,3]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[5,23],"start":[5,22]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"literalType":"IntLiteral","value":0}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[7,48],"start":[5,3]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[5,39],"start":[5,25]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"mkCons","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[5,68],"start":[5,25]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[5,56],"start":[5,41]}},"kind":"Var","type":{"annotation":[{"end":[204,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[204,20]},[]],"contents":[{"annotation":[{"end":[204,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[204,20]},[]],"contents":[{"annotation":[{"end":[204,29],"name":"tests/purus/passing/prelude/Prelude.purs","start":[204,27]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[204,26],"name":"tests/purus/passing/prelude/Prelude.purs","start":[204,20]},[]],"contents":[["Prim"],"TxInfo"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[204,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[204,30]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"serializeTxInfo","moduleName":["Prelude"]}},"annotation":{"meta":null,"sourceSpan":{"end":[5,67],"start":[5,41]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[5,67],"start":[5,57]}},"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[5,60],"start":[5,57]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["txInfo",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"TxInfo"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["purpose",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"ScriptPurpose"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"tag":"REmpty"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"TypeApp"},"value":{"identifier":"rec","sourcePos":[4,39]}},"fieldName":"txInfo","kind":"Accessor","type":{"annotation":[{"end":[204,26],"name":"tests/purus/passing/prelude/Prelude.purs","start":[204,20]},[]],"contents":[["Prim"],"TxInfo"],"tag":"TypeConstructor"}},"kind":"App"},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[7,47],"start":[5,25]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[6,34],"start":[6,20]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"mkCons","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[6,71],"start":[6,20]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[6,58],"start":[6,36]}},"kind":"Var","type":{"annotation":[{"end":[18,63],"name":"tests/purus/passing/prelude/Prelude.purs","start":[18,27]},[]],"contents":[{"annotation":[{"end":[18,63],"name":"tests/purus/passing/prelude/Prelude.purs","start":[18,27]},[]],"contents":[{"annotation":[{"end":[18,43],"name":"tests/purus/passing/prelude/Prelude.purs","start":[18,41]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[18,40],"name":"tests/purus/passing/prelude/Prelude.purs","start":[18,27]},[]],"contents":[["Prim"],"ScriptPurpose"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[18,63],"name":"tests/purus/passing/prelude/Prelude.purs","start":[18,44]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"serializeScriptPurpose","moduleName":["Prelude"]}},"annotation":{"meta":null,"sourceSpan":{"end":[6,70],"start":[6,36]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[6,70],"start":[6,59]}},"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[6,62],"start":[6,59]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["txInfo",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"TxInfo"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["purpose",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"ScriptPurpose"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"tag":"REmpty"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"TypeApp"},"value":{"identifier":"rec","sourcePos":[4,39]}},"fieldName":"purpose","kind":"Accessor","type":{"annotation":[{"end":[18,40],"name":"tests/purus/passing/prelude/Prelude.purs","start":[18,27]},[]],"contents":[["Prim"],"ScriptPurpose"],"tag":"TypeConstructor"}},"kind":"App"},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[7,46],"start":[6,20]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[7,40],"start":[7,23]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Unit"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"mkNilData","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[7,45],"start":[7,23]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[7,45],"start":[7,41]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Unit"],"tag":"TypeConstructor"},"value":{"identifier":"unit","moduleName":["Prim"]}},"kind":"App"},"kind":"App"},"kind":"App"},"kind":"App"},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[7,48],"start":[4,1]}},"kind":"Var","type":{"annotation":[{"end":[3,40],"name":"tests/purus/passing/prelude/Prelude.purs","start":[3,27]},[]],"contents":[["Prim"],"ScriptContext"],"tag":"TypeConstructor"},"value":{"identifier":"v","sourcePos":[0,0]}}],"kind":"Case","type":{"annotation":[{"end":[3,63],"name":"tests/purus/passing/prelude/Prelude.purs","start":[3,44]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[3,40],"name":"tests/purus/passing/prelude/Prelude.purs","start":[3,27]},[]],"contents":[["Prim"],"ScriptContext"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[3,63],"name":"tests/purus/passing/prelude/Prelude.purs","start":[3,44]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"identifier":"serializeScriptContext"},{"bindType":"Rec","binds":[{"annotation":{"meta":null,"sourceSpan":{"end":[674,31],"start":[674,1]}},"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[677,58],"start":[675,1]}},"argument":"ell","body":{"annotation":{"meta":null,"sourceSpan":{"end":[677,58],"start":[675,19]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[676,6],"start":[676,3]}},"binderType":"ConstructorBinder","binders":[],"constructorName":{"identifier":"Nil","moduleName":["Prim"]},"typeName":{"identifier":"List","moduleName":["Prim"]}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[676,11],"start":[676,10]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"literalType":"IntLiteral","value":1}},"isGuarded":false},{"binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[677,12],"start":[677,3]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[677,9],"start":[677,8]}},"binderType":"VarBinder","identifier":"x","type":{"annotation":[{"end":[674,24],"name":"tests/purus/passing/prelude/Prelude.purs","start":[674,21]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}},{"annotation":{"meta":null,"sourceSpan":{"end":[677,12],"start":[677,10]}},"binderType":"VarBinder","identifier":"xs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[674,24],"name":"tests/purus/passing/prelude/Prelude.purs","start":[674,21]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"}}],"constructorName":{"identifier":"Cons","moduleName":["Prim"]},"typeName":{"identifier":"List","moduleName":["Prim"]}}],"expression":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[677,39],"start":[677,16]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"multiplyInteger","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[677,41],"start":[677,16]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[677,41],"start":[677,40]}},"kind":"Var","type":{"annotation":[{"end":[674,24],"name":"tests/purus/passing/prelude/Prelude.purs","start":[674,21]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"identifier":"x","sourcePos":[677,8]}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[677,58],"start":[677,16]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[677,54],"start":[677,43]}},"kind":"Var","type":{"annotation":[{"end":[674,31],"name":"tests/purus/passing/prelude/Prelude.purs","start":[674,16]},[]],"contents":[{"annotation":[{"end":[674,31],"name":"tests/purus/passing/prelude/Prelude.purs","start":[674,16]},[]],"contents":[{"annotation":[{"end":[674,27],"name":"tests/purus/passing/prelude/Prelude.purs","start":[674,25]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[674,24],"name":"tests/purus/passing/prelude/Prelude.purs","start":[674,16]},[]],"contents":[{"annotation":[{"end":[674,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[674,16]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[674,24],"name":"tests/purus/passing/prelude/Prelude.purs","start":[674,21]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[674,31],"name":"tests/purus/passing/prelude/Prelude.purs","start":[674,28]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"productList","moduleName":["Prelude"]}},"annotation":{"meta":null,"sourceSpan":{"end":[677,57],"start":[677,43]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[677,57],"start":[677,55]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[674,24],"name":"tests/purus/passing/prelude/Prelude.purs","start":[674,21]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"xs","sourcePos":[677,10]}},"kind":"App"},"kind":"App"},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[675,27],"start":[675,24]}},"kind":"Var","type":{"annotation":[{"end":[674,24],"name":"tests/purus/passing/prelude/Prelude.purs","start":[674,16]},[]],"contents":[{"annotation":[{"end":[674,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[674,16]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[674,24],"name":"tests/purus/passing/prelude/Prelude.purs","start":[674,21]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"ell","sourcePos":[675,1]}}],"kind":"Case","type":{"annotation":[{"end":[674,31],"name":"tests/purus/passing/prelude/Prelude.purs","start":[674,28]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[674,24],"name":"tests/purus/passing/prelude/Prelude.purs","start":[674,16]},[]],"contents":[{"annotation":[{"end":[674,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[674,16]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[674,24],"name":"tests/purus/passing/prelude/Prelude.purs","start":[674,21]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[674,31],"name":"tests/purus/passing/prelude/Prelude.purs","start":[674,28]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"identifier":"productList"}]},{"annotation":{"meta":null,"sourceSpan":{"end":[565,36],"start":[565,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[566,37],"start":[566,1]}},"argument":"x","body":{"annotation":{"meta":null,"sourceSpan":{"end":[566,37],"start":[566,1]}},"argument":"y","body":{"abstraction":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[566,28],"start":[566,10]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"x","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"x"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"x"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"x"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"ifThenElse","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[566,30],"start":[566,10]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[566,30],"start":[566,29]}},"kind":"Var","type":{"annotation":[{"end":[565,14],"name":"tests/purus/passing/prelude/Prelude.purs","start":[565,7]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"},"value":{"identifier":"x","sourcePos":[566,1]}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[566,35],"start":[566,10]}},"argument":{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[566,35],"start":[566,31]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"},"value":{"identifier":"True","moduleName":["Prim"]}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[566,37],"start":[566,10]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[566,37],"start":[566,36]}},"kind":"Var","type":{"annotation":[{"end":[565,25],"name":"tests/purus/passing/prelude/Prelude.purs","start":[565,18]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"},"value":{"identifier":"y","sourcePos":[566,1]}},"kind":"App"},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[565,25],"name":"tests/purus/passing/prelude/Prelude.purs","start":[565,18]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[565,36],"name":"tests/purus/passing/prelude/Prelude.purs","start":[565,29]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[565,14],"name":"tests/purus/passing/prelude/Prelude.purs","start":[565,7]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[565,36],"name":"tests/purus/passing/prelude/Prelude.purs","start":[565,18]},[]],"contents":[{"annotation":[{"end":[565,36],"name":"tests/purus/passing/prelude/Prelude.purs","start":[565,18]},[]],"contents":[{"annotation":[{"end":[565,28],"name":"tests/purus/passing/prelude/Prelude.purs","start":[565,26]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[565,25],"name":"tests/purus/passing/prelude/Prelude.purs","start":[565,18]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[565,36],"name":"tests/purus/passing/prelude/Prelude.purs","start":[565,29]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"identifier":"or"},{"annotation":{"meta":null,"sourceSpan":{"end":[568,26],"start":[568,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[569,40],"start":[569,1]}},"argument":"x","body":{"abstraction":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[569,27],"start":[569,9]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"x","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"x"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"x"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"x"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"ifThenElse","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[569,29],"start":[569,9]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[569,29],"start":[569,28]}},"kind":"Var","type":{"annotation":[{"end":[568,15],"name":"tests/purus/passing/prelude/Prelude.purs","start":[568,8]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"},"value":{"identifier":"x","sourcePos":[569,1]}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[569,35],"start":[569,9]}},"argument":{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[569,35],"start":[569,30]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"},"value":{"identifier":"False","moduleName":["Prim"]}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[569,40],"start":[569,9]}},"argument":{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[569,40],"start":[569,36]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"},"value":{"identifier":"True","moduleName":["Prim"]}},"kind":"App"},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[568,15],"name":"tests/purus/passing/prelude/Prelude.purs","start":[568,8]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[568,26],"name":"tests/purus/passing/prelude/Prelude.purs","start":[568,19]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"identifier":"not"},{"annotation":{"meta":null,"sourceSpan":{"end":[571,37],"start":[571,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[572,41],"start":[572,1]}},"argument":"x","body":{"annotation":{"meta":null,"sourceSpan":{"end":[572,41],"start":[572,1]}},"argument":"y","body":{"abstraction":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[572,29],"start":[572,11]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"x","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"x"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"x"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"x"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"ifThenElse","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[572,31],"start":[572,11]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[572,31],"start":[572,30]}},"kind":"Var","type":{"annotation":[{"end":[571,15],"name":"tests/purus/passing/prelude/Prelude.purs","start":[571,8]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"},"value":{"identifier":"x","sourcePos":[572,1]}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[572,39],"start":[572,11]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[572,36],"start":[572,33]}},"kind":"Var","type":{"annotation":[{"end":[568,26],"name":"tests/purus/passing/prelude/Prelude.purs","start":[568,8]},[]],"contents":[{"annotation":[{"end":[568,26],"name":"tests/purus/passing/prelude/Prelude.purs","start":[568,8]},[]],"contents":[{"annotation":[{"end":[568,18],"name":"tests/purus/passing/prelude/Prelude.purs","start":[568,16]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[568,15],"name":"tests/purus/passing/prelude/Prelude.purs","start":[568,8]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[568,26],"name":"tests/purus/passing/prelude/Prelude.purs","start":[568,19]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"not","moduleName":["Prelude"]}},"annotation":{"meta":null,"sourceSpan":{"end":[572,38],"start":[572,33]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[572,38],"start":[572,37]}},"kind":"Var","type":{"annotation":[{"end":[571,26],"name":"tests/purus/passing/prelude/Prelude.purs","start":[571,19]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"},"value":{"identifier":"y","sourcePos":[572,1]}},"kind":"App"},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[572,41],"start":[572,11]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[572,41],"start":[572,40]}},"kind":"Var","type":{"annotation":[{"end":[571,26],"name":"tests/purus/passing/prelude/Prelude.purs","start":[571,19]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"},"value":{"identifier":"y","sourcePos":[572,1]}},"kind":"App"},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[571,26],"name":"tests/purus/passing/prelude/Prelude.purs","start":[571,19]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[571,37],"name":"tests/purus/passing/prelude/Prelude.purs","start":[571,30]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[571,15],"name":"tests/purus/passing/prelude/Prelude.purs","start":[571,8]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[571,37],"name":"tests/purus/passing/prelude/Prelude.purs","start":[571,19]},[]],"contents":[{"annotation":[{"end":[571,37],"name":"tests/purus/passing/prelude/Prelude.purs","start":[571,19]},[]],"contents":[{"annotation":[{"end":[571,29],"name":"tests/purus/passing/prelude/Prelude.purs","start":[571,27]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[571,26],"name":"tests/purus/passing/prelude/Prelude.purs","start":[571,19]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[571,37],"name":"tests/purus/passing/prelude/Prelude.purs","start":[571,30]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"identifier":"xor"},{"annotation":{"meta":null,"sourceSpan":{"end":[542,4],"start":[537,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[545,23],"start":[543,1]}},"argument":"whenNothing","body":{"annotation":{"meta":null,"sourceSpan":{"end":[545,23],"start":[543,1]}},"argument":"whenJust","body":{"annotation":{"meta":null,"sourceSpan":{"end":[545,23],"start":[543,1]}},"argument":"m","body":{"annotation":{"meta":null,"sourceSpan":{"end":[545,23],"start":[543,32]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[544,10],"start":[544,3]}},"binderType":"ConstructorBinder","binders":[],"constructorName":{"identifier":"Nothing","moduleName":["Prim"]},"typeName":{"identifier":"Maybe","moduleName":["Prim"]}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[544,25],"start":[544,14]}},"kind":"Var","type":{"annotation":[{"end":[539,4],"name":"tests/purus/passing/prelude/Prelude.purs","start":[539,3]},[]],"contents":{"kind":{"annotation":[{"end":[538,32],"name":"tests/purus/passing/prelude/Prelude.purs","start":[538,28]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"b"},"tag":"TypeVar"},"value":{"identifier":"whenNothing","sourcePos":[543,1]}},"isGuarded":false},{"binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":["$__unused"],"metaType":"IsConstructor"},"sourceSpan":{"end":[545,9],"start":[545,3]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[545,9],"start":[545,8]}},"binderType":"VarBinder","identifier":"x","type":{"annotation":[{"end":[541,10],"name":"tests/purus/passing/prelude/Prelude.purs","start":[541,9]},[]],"contents":{"kind":{"annotation":[{"end":[538,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[538,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}}],"constructorName":{"identifier":"Just","moduleName":["Prim"]},"typeName":{"identifier":"Maybe","moduleName":["Prim"]}}],"expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[545,21],"start":[545,13]}},"kind":"Var","type":{"annotation":[{"end":[540,10],"name":"tests/purus/passing/prelude/Prelude.purs","start":[540,4]},[]],"contents":[{"annotation":[{"end":[540,10],"name":"tests/purus/passing/prelude/Prelude.purs","start":[540,4]},[]],"contents":[{"annotation":[{"end":[540,8],"name":"tests/purus/passing/prelude/Prelude.purs","start":[540,6]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[540,5],"name":"tests/purus/passing/prelude/Prelude.purs","start":[540,4]},[]],"contents":{"kind":{"annotation":[{"end":[538,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[538,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[540,10],"name":"tests/purus/passing/prelude/Prelude.purs","start":[540,9]},[]],"contents":{"kind":{"annotation":[{"end":[538,32],"name":"tests/purus/passing/prelude/Prelude.purs","start":[538,28]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"b"},"tag":"TypeVar"}],"tag":"TypeApp"},"value":{"identifier":"whenJust","sourcePos":[543,1]}},"annotation":{"meta":null,"sourceSpan":{"end":[545,23],"start":[545,13]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[545,23],"start":[545,22]}},"kind":"Var","type":{"annotation":[{"end":[541,10],"name":"tests/purus/passing/prelude/Prelude.purs","start":[541,9]},[]],"contents":{"kind":{"annotation":[{"end":[538,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[538,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"},"value":{"identifier":"x","sourcePos":[545,8]}},"kind":"App"},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[543,38],"start":[543,37]}},"kind":"Var","type":{"annotation":[{"end":[541,10],"name":"tests/purus/passing/prelude/Prelude.purs","start":[541,3]},[]],"contents":[{"annotation":[{"end":[541,8],"name":"tests/purus/passing/prelude/Prelude.purs","start":[541,3]},[]],"contents":[["Prim"],"Maybe"],"tag":"TypeConstructor"},{"annotation":[{"end":[541,10],"name":"tests/purus/passing/prelude/Prelude.purs","start":[541,9]},[]],"contents":{"kind":{"annotation":[{"end":[538,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[538,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},"value":{"identifier":"m","sourcePos":[543,1]}}],"kind":"Case","type":{"annotation":[{"end":[542,4],"name":"tests/purus/passing/prelude/Prelude.purs","start":[542,3]},[]],"contents":{"kind":{"annotation":[{"end":[538,32],"name":"tests/purus/passing/prelude/Prelude.purs","start":[538,28]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"b"},"tag":"TypeVar"}},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[541,10],"name":"tests/purus/passing/prelude/Prelude.purs","start":[541,3]},[]],"contents":[{"annotation":[{"end":[541,8],"name":"tests/purus/passing/prelude/Prelude.purs","start":[541,3]},[]],"contents":[["Prim"],"Maybe"],"tag":"TypeConstructor"},{"annotation":[{"end":[541,10],"name":"tests/purus/passing/prelude/Prelude.purs","start":[541,9]},[]],"contents":{"kind":{"annotation":[{"end":[538,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[538,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[542,4],"name":"tests/purus/passing/prelude/Prelude.purs","start":[542,3]},[]],"contents":{"kind":{"annotation":[{"end":[538,32],"name":"tests/purus/passing/prelude/Prelude.purs","start":[538,28]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"b"},"tag":"TypeVar"}],"tag":"TypeApp"}},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[540,10],"name":"tests/purus/passing/prelude/Prelude.purs","start":[540,4]},[]],"contents":[{"annotation":[{"end":[540,10],"name":"tests/purus/passing/prelude/Prelude.purs","start":[540,4]},[]],"contents":[{"annotation":[{"end":[540,8],"name":"tests/purus/passing/prelude/Prelude.purs","start":[540,6]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[540,5],"name":"tests/purus/passing/prelude/Prelude.purs","start":[540,4]},[]],"contents":{"kind":{"annotation":[{"end":[538,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[538,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[540,10],"name":"tests/purus/passing/prelude/Prelude.purs","start":[540,9]},[]],"contents":{"kind":{"annotation":[{"end":[538,32],"name":"tests/purus/passing/prelude/Prelude.purs","start":[538,28]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"b"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[542,4],"name":"tests/purus/passing/prelude/Prelude.purs","start":[541,3]},[]],"contents":[{"annotation":[{"end":[542,4],"name":"tests/purus/passing/prelude/Prelude.purs","start":[541,3]},[]],"contents":[{"annotation":[{"end":[541,13],"name":"tests/purus/passing/prelude/Prelude.purs","start":[541,11]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[541,10],"name":"tests/purus/passing/prelude/Prelude.purs","start":[541,3]},[]],"contents":[{"annotation":[{"end":[541,8],"name":"tests/purus/passing/prelude/Prelude.purs","start":[541,3]},[]],"contents":[["Prim"],"Maybe"],"tag":"TypeConstructor"},{"annotation":[{"end":[541,10],"name":"tests/purus/passing/prelude/Prelude.purs","start":[541,9]},[]],"contents":{"kind":{"annotation":[{"end":[538,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[538,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[542,4],"name":"tests/purus/passing/prelude/Prelude.purs","start":[542,3]},[]],"contents":{"kind":{"annotation":[{"end":[538,32],"name":"tests/purus/passing/prelude/Prelude.purs","start":[538,28]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"b"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"kind":"Abs","type":{"annotation":[{"end":[542,4],"name":"tests/purus/passing/prelude/Prelude.purs","start":[538,3]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[538,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[538,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":97,"type":{"annotation":[{"end":[542,4],"name":"tests/purus/passing/prelude/Prelude.purs","start":[538,23]},[]],"contents":{"identifier":"b","kind":{"annotation":[{"end":[538,32],"name":"tests/purus/passing/prelude/Prelude.purs","start":[538,28]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":96,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[539,4],"name":"tests/purus/passing/prelude/Prelude.purs","start":[539,3]},[]],"contents":{"kind":{"annotation":[{"end":[538,32],"name":"tests/purus/passing/prelude/Prelude.purs","start":[538,28]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"b"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[542,4],"name":"tests/purus/passing/prelude/Prelude.purs","start":[540,3]},[]],"contents":[{"annotation":[{"end":[542,4],"name":"tests/purus/passing/prelude/Prelude.purs","start":[540,3]},[]],"contents":[{"annotation":[{"end":[540,14],"name":"tests/purus/passing/prelude/Prelude.purs","start":[540,12]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[540,10],"name":"tests/purus/passing/prelude/Prelude.purs","start":[540,4]},[]],"contents":[{"annotation":[{"end":[540,10],"name":"tests/purus/passing/prelude/Prelude.purs","start":[540,4]},[]],"contents":[{"annotation":[{"end":[540,8],"name":"tests/purus/passing/prelude/Prelude.purs","start":[540,6]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[540,5],"name":"tests/purus/passing/prelude/Prelude.purs","start":[540,4]},[]],"contents":{"kind":{"annotation":[{"end":[538,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[538,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[540,10],"name":"tests/purus/passing/prelude/Prelude.purs","start":[540,9]},[]],"contents":{"kind":{"annotation":[{"end":[538,32],"name":"tests/purus/passing/prelude/Prelude.purs","start":[538,28]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"b"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[542,4],"name":"tests/purus/passing/prelude/Prelude.purs","start":[541,3]},[]],"contents":[{"annotation":[{"end":[542,4],"name":"tests/purus/passing/prelude/Prelude.purs","start":[541,3]},[]],"contents":[{"annotation":[{"end":[541,13],"name":"tests/purus/passing/prelude/Prelude.purs","start":[541,11]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[541,10],"name":"tests/purus/passing/prelude/Prelude.purs","start":[541,3]},[]],"contents":[{"annotation":[{"end":[541,8],"name":"tests/purus/passing/prelude/Prelude.purs","start":[541,3]},[]],"contents":[["Prim"],"Maybe"],"tag":"TypeConstructor"},{"annotation":[{"end":[541,10],"name":"tests/purus/passing/prelude/Prelude.purs","start":[541,9]},[]],"contents":{"kind":{"annotation":[{"end":[538,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[538,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[542,4],"name":"tests/purus/passing/prelude/Prelude.purs","start":[542,3]},[]],"contents":{"kind":{"annotation":[{"end":[538,32],"name":"tests/purus/passing/prelude/Prelude.purs","start":[538,28]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"b"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"identifier":"maybe"},{"bindType":"Rec","binds":[{"annotation":{"meta":null,"sourceSpan":{"end":[578,9],"start":[574,1]}},"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[581,41],"start":[579,1]}},"argument":"f","body":{"annotation":{"meta":null,"sourceSpan":{"end":[581,41],"start":[579,1]}},"argument":"ell","body":{"annotation":{"meta":null,"sourceSpan":{"end":[581,41],"start":[579,17]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[580,6],"start":[580,3]}},"binderType":"ConstructorBinder","binders":[],"constructorName":{"identifier":"Nil","moduleName":["Prim"]},"typeName":{"identifier":"List","moduleName":["Prim"]}}],"expression":{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[580,13],"start":[580,10]}},"kind":"Var","type":{"annotation":[{"end":[578,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[578,3]},[]],"contents":[{"annotation":[{"end":[578,7],"name":"tests/purus/passing/prelude/Prelude.purs","start":[578,3]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[578,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[578,8]},[]],"contents":{"kind":{"annotation":[{"end":[575,32],"name":"tests/purus/passing/prelude/Prelude.purs","start":[575,28]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"b"},"tag":"TypeVar"}],"tag":"TypeApp"},"value":{"identifier":"Nil","moduleName":["Prim"]}},"isGuarded":false},{"binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[581,12],"start":[581,3]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[581,9],"start":[581,8]}},"binderType":"VarBinder","identifier":"x","type":{"annotation":[{"end":[577,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[577,8]},[]],"contents":{"kind":{"annotation":[{"end":[575,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[575,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}},{"annotation":{"meta":null,"sourceSpan":{"end":[581,12],"start":[581,10]}},"binderType":"VarBinder","identifier":"xs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[577,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[577,8]},[]],"contents":{"kind":{"annotation":[{"end":[575,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[575,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}}],"constructorName":{"identifier":"Cons","moduleName":["Prim"]},"typeName":{"identifier":"List","moduleName":["Prim"]}}],"expression":{"abstraction":{"abstraction":{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[581,20],"start":[581,16]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"x","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":105,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"x"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"x"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"x"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"Cons","moduleName":["Prim"]}},"annotation":{"meta":null,"sourceSpan":{"end":[581,26],"start":[581,16]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[581,23],"start":[581,22]}},"kind":"Var","type":{"annotation":[{"end":[576,10],"name":"tests/purus/passing/prelude/Prelude.purs","start":[576,4]},[]],"contents":[{"annotation":[{"end":[576,10],"name":"tests/purus/passing/prelude/Prelude.purs","start":[576,4]},[]],"contents":[{"annotation":[{"end":[576,8],"name":"tests/purus/passing/prelude/Prelude.purs","start":[576,6]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[576,5],"name":"tests/purus/passing/prelude/Prelude.purs","start":[576,4]},[]],"contents":{"kind":{"annotation":[{"end":[575,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[575,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[576,10],"name":"tests/purus/passing/prelude/Prelude.purs","start":[576,9]},[]],"contents":{"kind":{"annotation":[{"end":[575,32],"name":"tests/purus/passing/prelude/Prelude.purs","start":[575,28]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"b"},"tag":"TypeVar"}],"tag":"TypeApp"},"value":{"identifier":"f","sourcePos":[579,1]}},"annotation":{"meta":null,"sourceSpan":{"end":[581,25],"start":[581,22]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[581,25],"start":[581,24]}},"kind":"Var","type":{"annotation":[{"end":[577,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[577,8]},[]],"contents":{"kind":{"annotation":[{"end":[575,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[575,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"},"value":{"identifier":"x","sourcePos":[581,8]}},"kind":"App"},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[581,41],"start":[581,16]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[581,35],"start":[581,28]}},"kind":"Var","type":{"annotation":[{"end":[578,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[575,3]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[575,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[575,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":101,"type":{"annotation":[{"end":[578,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[575,23]},[]],"contents":{"identifier":"b","kind":{"annotation":[{"end":[575,32],"name":"tests/purus/passing/prelude/Prelude.purs","start":[575,28]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":100,"type":{"annotation":[{"end":[578,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[576,3]},[]],"contents":[{"annotation":[{"end":[578,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[576,3]},[]],"contents":[{"annotation":[{"end":[576,14],"name":"tests/purus/passing/prelude/Prelude.purs","start":[576,12]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[576,10],"name":"tests/purus/passing/prelude/Prelude.purs","start":[576,4]},[]],"contents":[{"annotation":[{"end":[576,10],"name":"tests/purus/passing/prelude/Prelude.purs","start":[576,4]},[]],"contents":[{"annotation":[{"end":[576,8],"name":"tests/purus/passing/prelude/Prelude.purs","start":[576,6]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[576,5],"name":"tests/purus/passing/prelude/Prelude.purs","start":[576,4]},[]],"contents":{"kind":{"annotation":[{"end":[575,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[575,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[576,10],"name":"tests/purus/passing/prelude/Prelude.purs","start":[576,9]},[]],"contents":{"kind":{"annotation":[{"end":[575,32],"name":"tests/purus/passing/prelude/Prelude.purs","start":[575,28]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"b"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[578,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[577,3]},[]],"contents":[{"annotation":[{"end":[578,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[577,3]},[]],"contents":[{"annotation":[{"end":[577,12],"name":"tests/purus/passing/prelude/Prelude.purs","start":[577,10]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[577,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[577,3]},[]],"contents":[{"annotation":[{"end":[577,7],"name":"tests/purus/passing/prelude/Prelude.purs","start":[577,3]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[577,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[577,8]},[]],"contents":{"kind":{"annotation":[{"end":[575,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[575,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[578,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[578,3]},[]],"contents":[{"annotation":[{"end":[578,7],"name":"tests/purus/passing/prelude/Prelude.purs","start":[578,3]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[578,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[578,8]},[]],"contents":{"kind":{"annotation":[{"end":[575,32],"name":"tests/purus/passing/prelude/Prelude.purs","start":[575,28]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"b"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"mapList","moduleName":["Prelude"]}},"annotation":{"meta":null,"sourceSpan":{"end":[581,37],"start":[581,28]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[581,37],"start":[581,36]}},"kind":"Var","type":{"annotation":[{"end":[576,10],"name":"tests/purus/passing/prelude/Prelude.purs","start":[576,4]},[]],"contents":[{"annotation":[{"end":[576,10],"name":"tests/purus/passing/prelude/Prelude.purs","start":[576,4]},[]],"contents":[{"annotation":[{"end":[576,8],"name":"tests/purus/passing/prelude/Prelude.purs","start":[576,6]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[576,5],"name":"tests/purus/passing/prelude/Prelude.purs","start":[576,4]},[]],"contents":{"kind":{"annotation":[{"end":[575,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[575,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[576,10],"name":"tests/purus/passing/prelude/Prelude.purs","start":[576,9]},[]],"contents":{"kind":{"annotation":[{"end":[575,32],"name":"tests/purus/passing/prelude/Prelude.purs","start":[575,28]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"b"},"tag":"TypeVar"}],"tag":"TypeApp"},"value":{"identifier":"f","sourcePos":[579,1]}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[581,40],"start":[581,28]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[581,40],"start":[581,38]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[577,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[577,8]},[]],"contents":{"kind":{"annotation":[{"end":[575,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[575,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},"value":{"identifier":"xs","sourcePos":[581,10]}},"kind":"App"},"kind":"App"},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[579,25],"start":[579,22]}},"kind":"Var","type":{"annotation":[{"end":[577,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[577,3]},[]],"contents":[{"annotation":[{"end":[577,7],"name":"tests/purus/passing/prelude/Prelude.purs","start":[577,3]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[577,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[577,8]},[]],"contents":{"kind":{"annotation":[{"end":[575,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[575,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},"value":{"identifier":"ell","sourcePos":[579,1]}}],"kind":"Case","type":{"annotation":[{"end":[578,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[578,3]},[]],"contents":[{"annotation":[{"end":[578,7],"name":"tests/purus/passing/prelude/Prelude.purs","start":[578,3]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[578,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[578,8]},[]],"contents":{"kind":{"annotation":[{"end":[575,32],"name":"tests/purus/passing/prelude/Prelude.purs","start":[575,28]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"b"},"tag":"TypeVar"}],"tag":"TypeApp"}},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[577,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[577,3]},[]],"contents":[{"annotation":[{"end":[577,7],"name":"tests/purus/passing/prelude/Prelude.purs","start":[577,3]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[577,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[577,8]},[]],"contents":{"kind":{"annotation":[{"end":[575,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[575,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[578,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[578,3]},[]],"contents":[{"annotation":[{"end":[578,7],"name":"tests/purus/passing/prelude/Prelude.purs","start":[578,3]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[578,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[578,8]},[]],"contents":{"kind":{"annotation":[{"end":[575,32],"name":"tests/purus/passing/prelude/Prelude.purs","start":[575,28]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"b"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"kind":"Abs","type":{"annotation":[{"end":[578,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[575,3]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[575,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[575,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":102,"type":{"annotation":[{"end":[578,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[575,23]},[]],"contents":{"identifier":"b","kind":{"annotation":[{"end":[575,32],"name":"tests/purus/passing/prelude/Prelude.purs","start":[575,28]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":100,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[576,10],"name":"tests/purus/passing/prelude/Prelude.purs","start":[576,4]},[]],"contents":[{"annotation":[{"end":[576,10],"name":"tests/purus/passing/prelude/Prelude.purs","start":[576,4]},[]],"contents":[{"annotation":[{"end":[576,8],"name":"tests/purus/passing/prelude/Prelude.purs","start":[576,6]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[576,5],"name":"tests/purus/passing/prelude/Prelude.purs","start":[576,4]},[]],"contents":{"kind":{"annotation":[{"end":[575,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[575,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[576,10],"name":"tests/purus/passing/prelude/Prelude.purs","start":[576,9]},[]],"contents":{"kind":{"annotation":[{"end":[575,32],"name":"tests/purus/passing/prelude/Prelude.purs","start":[575,28]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"b"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[578,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[577,3]},[]],"contents":[{"annotation":[{"end":[578,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[577,3]},[]],"contents":[{"annotation":[{"end":[577,12],"name":"tests/purus/passing/prelude/Prelude.purs","start":[577,10]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[577,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[577,3]},[]],"contents":[{"annotation":[{"end":[577,7],"name":"tests/purus/passing/prelude/Prelude.purs","start":[577,3]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[577,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[577,8]},[]],"contents":{"kind":{"annotation":[{"end":[575,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[575,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[578,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[578,3]},[]],"contents":[{"annotation":[{"end":[578,7],"name":"tests/purus/passing/prelude/Prelude.purs","start":[578,3]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[578,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[578,8]},[]],"contents":{"kind":{"annotation":[{"end":[575,32],"name":"tests/purus/passing/prelude/Prelude.purs","start":[575,28]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"b"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"identifier":"mapList"}]},{"bindType":"Rec","binds":[{"annotation":{"meta":null,"sourceSpan":{"end":[642,6],"start":[639,1]}},"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[645,52],"start":[643,1]}},"argument":"ell","body":{"annotation":{"meta":null,"sourceSpan":{"end":[645,52],"start":[643,18]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[644,6],"start":[644,3]}},"binderType":"ConstructorBinder","binders":[],"constructorName":{"identifier":"Nil","moduleName":["Prim"]},"typeName":{"identifier":"List","moduleName":["Prim"]}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[644,11],"start":[644,10]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"literalType":"IntLiteral","value":0}},"isGuarded":false},{"binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[645,12],"start":[645,3]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[645,9],"start":[645,8]}},"binderType":"NullBinder"},{"annotation":{"meta":null,"sourceSpan":{"end":[645,12],"start":[645,10]}},"binderType":"VarBinder","identifier":"xs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[641,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[641,8]},[]],"contents":{"kind":{"annotation":[{"end":[640,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[640,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}}],"constructorName":{"identifier":"Cons","moduleName":["Prim"]},"typeName":{"identifier":"List","moduleName":["Prim"]}}],"expression":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[645,34],"start":[645,16]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"addInteger","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[645,36],"start":[645,16]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[645,36],"start":[645,35]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"literalType":"IntLiteral","value":1}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[645,52],"start":[645,16]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[645,48],"start":[645,38]}},"kind":"Var","type":{"annotation":[{"end":[642,6],"name":"tests/purus/passing/prelude/Prelude.purs","start":[640,3]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[640,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[640,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":108,"type":{"annotation":[{"end":[642,6],"name":"tests/purus/passing/prelude/Prelude.purs","start":[641,3]},[]],"contents":[{"annotation":[{"end":[642,6],"name":"tests/purus/passing/prelude/Prelude.purs","start":[641,3]},[]],"contents":[{"annotation":[{"end":[641,12],"name":"tests/purus/passing/prelude/Prelude.purs","start":[641,10]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[641,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[641,3]},[]],"contents":[{"annotation":[{"end":[641,7],"name":"tests/purus/passing/prelude/Prelude.purs","start":[641,3]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[641,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[641,8]},[]],"contents":{"kind":{"annotation":[{"end":[640,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[640,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[642,6],"name":"tests/purus/passing/prelude/Prelude.purs","start":[642,3]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"lengthList","moduleName":["Prelude"]}},"annotation":{"meta":null,"sourceSpan":{"end":[645,51],"start":[645,38]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[645,51],"start":[645,49]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[641,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[641,8]},[]],"contents":{"kind":{"annotation":[{"end":[640,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[640,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},"value":{"identifier":"xs","sourcePos":[645,10]}},"kind":"App"},"kind":"App"},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[643,26],"start":[643,23]}},"kind":"Var","type":{"annotation":[{"end":[641,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[641,3]},[]],"contents":[{"annotation":[{"end":[641,7],"name":"tests/purus/passing/prelude/Prelude.purs","start":[641,3]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[641,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[641,8]},[]],"contents":{"kind":{"annotation":[{"end":[640,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[640,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},"value":{"identifier":"ell","sourcePos":[643,1]}}],"kind":"Case","type":{"annotation":[{"end":[642,6],"name":"tests/purus/passing/prelude/Prelude.purs","start":[642,3]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}},"kind":"Abs","type":{"annotation":[{"end":[642,6],"name":"tests/purus/passing/prelude/Prelude.purs","start":[640,3]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[640,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[640,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":109,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[641,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[641,3]},[]],"contents":[{"annotation":[{"end":[641,7],"name":"tests/purus/passing/prelude/Prelude.purs","start":[641,3]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[641,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[641,8]},[]],"contents":{"kind":{"annotation":[{"end":[640,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[640,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[642,6],"name":"tests/purus/passing/prelude/Prelude.purs","start":[642,3]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"identifier":"lengthList"}]},{"annotation":{"meta":null,"sourceSpan":{"end":[556,40],"start":[556,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[557,15],"start":[557,1]}},"argument":"x","body":{"annotation":{"meta":null,"sourceSpan":{"end":[557,15],"start":[557,14]}},"kind":"Var","type":{"annotation":[{"end":[556,35],"name":"tests/purus/passing/prelude/Prelude.purs","start":[556,34]},[]],"contents":{"kind":{"annotation":[{"end":[556,30],"name":"tests/purus/passing/prelude/Prelude.purs","start":[556,26]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"},"value":{"identifier":"x","sourcePos":[557,1]}},"kind":"Abs","type":{"annotation":[{"end":[556,40],"name":"tests/purus/passing/prelude/Prelude.purs","start":[556,13]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[556,30],"name":"tests/purus/passing/prelude/Prelude.purs","start":[556,26]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":111,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[556,35],"name":"tests/purus/passing/prelude/Prelude.purs","start":[556,34]},[]],"contents":{"kind":{"annotation":[{"end":[556,30],"name":"tests/purus/passing/prelude/Prelude.purs","start":[556,26]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[556,40],"name":"tests/purus/passing/prelude/Prelude.purs","start":[556,39]},[]],"contents":{"kind":{"annotation":[{"end":[556,30],"name":"tests/purus/passing/prelude/Prelude.purs","start":[556,26]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"identifier":"identity"},{"annotation":{"meta":null,"sourceSpan":{"end":[551,4],"start":[547,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[554,14],"start":[552,1]}},"argument":"whenNothing","body":{"annotation":{"meta":null,"sourceSpan":{"end":[554,14],"start":[552,1]}},"argument":"m","body":{"annotation":{"meta":null,"sourceSpan":{"end":[554,14],"start":[552,27]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[553,10],"start":[553,3]}},"binderType":"ConstructorBinder","binders":[],"constructorName":{"identifier":"Nothing","moduleName":["Prim"]},"typeName":{"identifier":"Maybe","moduleName":["Prim"]}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[553,25],"start":[553,14]}},"kind":"Var","type":{"annotation":[{"end":[549,4],"name":"tests/purus/passing/prelude/Prelude.purs","start":[549,3]},[]],"contents":{"kind":{"annotation":[{"end":[548,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[548,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"},"value":{"identifier":"whenNothing","sourcePos":[552,1]}},"isGuarded":false},{"binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":["$__unused"],"metaType":"IsConstructor"},"sourceSpan":{"end":[554,9],"start":[554,3]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[554,9],"start":[554,8]}},"binderType":"VarBinder","identifier":"x","type":{"annotation":[{"end":[550,10],"name":"tests/purus/passing/prelude/Prelude.purs","start":[550,9]},[]],"contents":{"kind":{"annotation":[{"end":[548,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[548,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}}],"constructorName":{"identifier":"Just","moduleName":["Prim"]},"typeName":{"identifier":"Maybe","moduleName":["Prim"]}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[554,14],"start":[554,13]}},"kind":"Var","type":{"annotation":[{"end":[550,10],"name":"tests/purus/passing/prelude/Prelude.purs","start":[550,9]},[]],"contents":{"kind":{"annotation":[{"end":[548,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[548,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"},"value":{"identifier":"x","sourcePos":[554,8]}},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[552,33],"start":[552,32]}},"kind":"Var","type":{"annotation":[{"end":[550,10],"name":"tests/purus/passing/prelude/Prelude.purs","start":[550,3]},[]],"contents":[{"annotation":[{"end":[550,8],"name":"tests/purus/passing/prelude/Prelude.purs","start":[550,3]},[]],"contents":[["Prim"],"Maybe"],"tag":"TypeConstructor"},{"annotation":[{"end":[550,10],"name":"tests/purus/passing/prelude/Prelude.purs","start":[550,9]},[]],"contents":{"kind":{"annotation":[{"end":[548,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[548,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},"value":{"identifier":"m","sourcePos":[552,1]}}],"kind":"Case","type":{"annotation":[{"end":[551,4],"name":"tests/purus/passing/prelude/Prelude.purs","start":[551,3]},[]],"contents":{"kind":{"annotation":[{"end":[548,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[548,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[550,10],"name":"tests/purus/passing/prelude/Prelude.purs","start":[550,3]},[]],"contents":[{"annotation":[{"end":[550,8],"name":"tests/purus/passing/prelude/Prelude.purs","start":[550,3]},[]],"contents":[["Prim"],"Maybe"],"tag":"TypeConstructor"},{"annotation":[{"end":[550,10],"name":"tests/purus/passing/prelude/Prelude.purs","start":[550,9]},[]],"contents":{"kind":{"annotation":[{"end":[548,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[548,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[551,4],"name":"tests/purus/passing/prelude/Prelude.purs","start":[551,3]},[]],"contents":{"kind":{"annotation":[{"end":[548,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[548,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}},"kind":"Abs","type":{"annotation":[{"end":[551,4],"name":"tests/purus/passing/prelude/Prelude.purs","start":[548,3]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[548,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[548,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":113,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[549,4],"name":"tests/purus/passing/prelude/Prelude.purs","start":[549,3]},[]],"contents":{"kind":{"annotation":[{"end":[548,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[548,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[551,4],"name":"tests/purus/passing/prelude/Prelude.purs","start":[550,3]},[]],"contents":[{"annotation":[{"end":[551,4],"name":"tests/purus/passing/prelude/Prelude.purs","start":[550,3]},[]],"contents":[{"annotation":[{"end":[550,13],"name":"tests/purus/passing/prelude/Prelude.purs","start":[550,11]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[550,10],"name":"tests/purus/passing/prelude/Prelude.purs","start":[550,3]},[]],"contents":[{"annotation":[{"end":[550,8],"name":"tests/purus/passing/prelude/Prelude.purs","start":[550,3]},[]],"contents":[["Prim"],"Maybe"],"tag":"TypeConstructor"},{"annotation":[{"end":[550,10],"name":"tests/purus/passing/prelude/Prelude.purs","start":[550,9]},[]],"contents":{"kind":{"annotation":[{"end":[548,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[548,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[551,4],"name":"tests/purus/passing/prelude/Prelude.purs","start":[551,3]},[]],"contents":{"kind":{"annotation":[{"end":[548,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[548,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"identifier":"fromMaybe"},{"annotation":{"meta":null,"sourceSpan":{"end":[693,4],"start":[688,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[694,19],"start":[694,1]}},"argument":"f","body":{"annotation":{"meta":null,"sourceSpan":{"end":[694,19],"start":[694,1]}},"argument":"x","body":{"annotation":{"meta":null,"sourceSpan":{"end":[694,19],"start":[694,1]}},"argument":"y","body":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[694,15],"start":[694,14]}},"kind":"Var","type":{"annotation":[{"end":[690,15],"name":"tests/purus/passing/prelude/Prelude.purs","start":[690,4]},[]],"contents":[{"annotation":[{"end":[690,15],"name":"tests/purus/passing/prelude/Prelude.purs","start":[690,4]},[]],"contents":[{"annotation":[{"end":[690,8],"name":"tests/purus/passing/prelude/Prelude.purs","start":[690,6]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[690,5],"name":"tests/purus/passing/prelude/Prelude.purs","start":[690,4]},[]],"contents":{"kind":{"annotation":[{"end":[689,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[689,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[690,15],"name":"tests/purus/passing/prelude/Prelude.purs","start":[690,9]},[]],"contents":[{"annotation":[{"end":[690,15],"name":"tests/purus/passing/prelude/Prelude.purs","start":[690,9]},[]],"contents":[{"annotation":[{"end":[690,13],"name":"tests/purus/passing/prelude/Prelude.purs","start":[690,11]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[690,10],"name":"tests/purus/passing/prelude/Prelude.purs","start":[690,9]},[]],"contents":{"kind":{"annotation":[{"end":[689,32],"name":"tests/purus/passing/prelude/Prelude.purs","start":[689,28]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"b"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[690,15],"name":"tests/purus/passing/prelude/Prelude.purs","start":[690,14]},[]],"contents":{"kind":{"annotation":[{"end":[689,44],"name":"tests/purus/passing/prelude/Prelude.purs","start":[689,40]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"c"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"f","sourcePos":[694,1]}},"annotation":{"meta":null,"sourceSpan":{"end":[694,17],"start":[694,14]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[694,17],"start":[694,16]}},"kind":"Var","type":{"annotation":[{"end":[692,4],"name":"tests/purus/passing/prelude/Prelude.purs","start":[692,3]},[]],"contents":{"kind":{"annotation":[{"end":[689,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[689,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"},"value":{"identifier":"y","sourcePos":[694,1]}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[694,19],"start":[694,14]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[694,19],"start":[694,18]}},"kind":"Var","type":{"annotation":[{"end":[691,4],"name":"tests/purus/passing/prelude/Prelude.purs","start":[691,3]},[]],"contents":{"kind":{"annotation":[{"end":[689,32],"name":"tests/purus/passing/prelude/Prelude.purs","start":[689,28]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"b"},"tag":"TypeVar"},"value":{"identifier":"x","sourcePos":[694,1]}},"kind":"App"},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[692,4],"name":"tests/purus/passing/prelude/Prelude.purs","start":[692,3]},[]],"contents":{"kind":{"annotation":[{"end":[689,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[689,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[693,4],"name":"tests/purus/passing/prelude/Prelude.purs","start":[693,3]},[]],"contents":{"kind":{"annotation":[{"end":[689,44],"name":"tests/purus/passing/prelude/Prelude.purs","start":[689,40]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"c"},"tag":"TypeVar"}],"tag":"TypeApp"}},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[691,4],"name":"tests/purus/passing/prelude/Prelude.purs","start":[691,3]},[]],"contents":{"kind":{"annotation":[{"end":[689,32],"name":"tests/purus/passing/prelude/Prelude.purs","start":[689,28]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"b"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[693,4],"name":"tests/purus/passing/prelude/Prelude.purs","start":[692,3]},[]],"contents":[{"annotation":[{"end":[693,4],"name":"tests/purus/passing/prelude/Prelude.purs","start":[692,3]},[]],"contents":[{"annotation":[{"end":[692,7],"name":"tests/purus/passing/prelude/Prelude.purs","start":[692,5]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[692,4],"name":"tests/purus/passing/prelude/Prelude.purs","start":[692,3]},[]],"contents":{"kind":{"annotation":[{"end":[689,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[689,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[693,4],"name":"tests/purus/passing/prelude/Prelude.purs","start":[693,3]},[]],"contents":{"kind":{"annotation":[{"end":[689,44],"name":"tests/purus/passing/prelude/Prelude.purs","start":[689,40]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"c"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"kind":"Abs","type":{"annotation":[{"end":[693,4],"name":"tests/purus/passing/prelude/Prelude.purs","start":[689,3]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[689,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[689,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":117,"type":{"annotation":[{"end":[693,4],"name":"tests/purus/passing/prelude/Prelude.purs","start":[689,23]},[]],"contents":{"identifier":"b","kind":{"annotation":[{"end":[689,32],"name":"tests/purus/passing/prelude/Prelude.purs","start":[689,28]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":116,"type":{"annotation":[{"end":[693,4],"name":"tests/purus/passing/prelude/Prelude.purs","start":[689,35]},[]],"contents":{"identifier":"c","kind":{"annotation":[{"end":[689,44],"name":"tests/purus/passing/prelude/Prelude.purs","start":[689,40]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":115,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[690,15],"name":"tests/purus/passing/prelude/Prelude.purs","start":[690,4]},[]],"contents":[{"annotation":[{"end":[690,15],"name":"tests/purus/passing/prelude/Prelude.purs","start":[690,4]},[]],"contents":[{"annotation":[{"end":[690,8],"name":"tests/purus/passing/prelude/Prelude.purs","start":[690,6]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[690,5],"name":"tests/purus/passing/prelude/Prelude.purs","start":[690,4]},[]],"contents":{"kind":{"annotation":[{"end":[689,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[689,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[690,15],"name":"tests/purus/passing/prelude/Prelude.purs","start":[690,9]},[]],"contents":[{"annotation":[{"end":[690,15],"name":"tests/purus/passing/prelude/Prelude.purs","start":[690,9]},[]],"contents":[{"annotation":[{"end":[690,13],"name":"tests/purus/passing/prelude/Prelude.purs","start":[690,11]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[690,10],"name":"tests/purus/passing/prelude/Prelude.purs","start":[690,9]},[]],"contents":{"kind":{"annotation":[{"end":[689,32],"name":"tests/purus/passing/prelude/Prelude.purs","start":[689,28]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"b"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[690,15],"name":"tests/purus/passing/prelude/Prelude.purs","start":[690,14]},[]],"contents":{"kind":{"annotation":[{"end":[689,44],"name":"tests/purus/passing/prelude/Prelude.purs","start":[689,40]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"c"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[693,4],"name":"tests/purus/passing/prelude/Prelude.purs","start":[691,3]},[]],"contents":[{"annotation":[{"end":[693,4],"name":"tests/purus/passing/prelude/Prelude.purs","start":[691,3]},[]],"contents":[{"annotation":[{"end":[691,7],"name":"tests/purus/passing/prelude/Prelude.purs","start":[691,5]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[691,4],"name":"tests/purus/passing/prelude/Prelude.purs","start":[691,3]},[]],"contents":{"kind":{"annotation":[{"end":[689,32],"name":"tests/purus/passing/prelude/Prelude.purs","start":[689,28]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"b"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[693,4],"name":"tests/purus/passing/prelude/Prelude.purs","start":[692,3]},[]],"contents":[{"annotation":[{"end":[693,4],"name":"tests/purus/passing/prelude/Prelude.purs","start":[692,3]},[]],"contents":[{"annotation":[{"end":[692,7],"name":"tests/purus/passing/prelude/Prelude.purs","start":[692,5]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[692,4],"name":"tests/purus/passing/prelude/Prelude.purs","start":[692,3]},[]],"contents":{"kind":{"annotation":[{"end":[689,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[689,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[693,4],"name":"tests/purus/passing/prelude/Prelude.purs","start":[693,3]},[]],"contents":{"kind":{"annotation":[{"end":[689,44],"name":"tests/purus/passing/prelude/Prelude.purs","start":[689,40]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"c"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"identifier":"flip"},{"bindType":"Rec","binds":[{"annotation":{"meta":null,"sourceSpan":{"end":[587,9],"start":[583,1]}},"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[592,36],"start":[588,1]}},"argument":"f","body":{"annotation":{"meta":null,"sourceSpan":{"end":[592,36],"start":[588,1]}},"argument":"ell","body":{"annotation":{"meta":null,"sourceSpan":{"end":[592,36],"start":[588,20]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[589,6],"start":[589,3]}},"binderType":"ConstructorBinder","binders":[],"constructorName":{"identifier":"Nil","moduleName":["Prim"]},"typeName":{"identifier":"List","moduleName":["Prim"]}}],"expression":{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[589,13],"start":[589,10]}},"kind":"Var","type":{"annotation":[{"end":[587,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[587,3]},[]],"contents":[{"annotation":[{"end":[587,7],"name":"tests/purus/passing/prelude/Prelude.purs","start":[587,3]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[587,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[587,8]},[]],"contents":{"kind":{"annotation":[{"end":[584,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[584,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},"value":{"identifier":"Nil","moduleName":["Prim"]}},"isGuarded":false},{"binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[590,12],"start":[590,3]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[590,9],"start":[590,8]}},"binderType":"VarBinder","identifier":"x","type":{"annotation":[{"end":[586,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[586,8]},[]],"contents":{"kind":{"annotation":[{"end":[584,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[584,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}},{"annotation":{"meta":null,"sourceSpan":{"end":[590,12],"start":[590,10]}},"binderType":"VarBinder","identifier":"xs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[586,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[586,8]},[]],"contents":{"kind":{"annotation":[{"end":[584,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[584,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}}],"constructorName":{"identifier":"Cons","moduleName":["Prim"]},"typeName":{"identifier":"List","moduleName":["Prim"]}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[592,36],"start":[590,16]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"binderType":"ConstructorBinder","binders":[],"constructorName":{"identifier":"True","moduleName":["Prim"]},"typeName":{"identifier":"Boolean","moduleName":["Prim"]}}],"expression":{"abstraction":{"abstraction":{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[591,25],"start":[591,21]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"x","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":124,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"x"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"x"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"x"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"Cons","moduleName":["Prim"]}},"annotation":{"meta":null,"sourceSpan":{"end":[591,27],"start":[591,21]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[591,27],"start":[591,26]}},"kind":"Var","type":{"annotation":[{"end":[586,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[586,8]},[]],"contents":{"kind":{"annotation":[{"end":[584,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[584,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"},"value":{"identifier":"x","sourcePos":[590,8]}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[591,45],"start":[591,21]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[591,39],"start":[591,29]}},"kind":"Var","type":{"annotation":[{"end":[587,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[584,3]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[584,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[584,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":121,"type":{"annotation":[{"end":[587,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[585,3]},[]],"contents":[{"annotation":[{"end":[587,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[585,3]},[]],"contents":[{"annotation":[{"end":[585,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[585,18]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[585,16],"name":"tests/purus/passing/prelude/Prelude.purs","start":[585,4]},[]],"contents":[{"annotation":[{"end":[585,16],"name":"tests/purus/passing/prelude/Prelude.purs","start":[585,4]},[]],"contents":[{"annotation":[{"end":[585,8],"name":"tests/purus/passing/prelude/Prelude.purs","start":[585,6]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[585,5],"name":"tests/purus/passing/prelude/Prelude.purs","start":[585,4]},[]],"contents":{"kind":{"annotation":[{"end":[584,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[584,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[585,16],"name":"tests/purus/passing/prelude/Prelude.purs","start":[585,9]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[587,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[586,3]},[]],"contents":[{"annotation":[{"end":[587,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[586,3]},[]],"contents":[{"annotation":[{"end":[586,12],"name":"tests/purus/passing/prelude/Prelude.purs","start":[586,10]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[586,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[586,3]},[]],"contents":[{"annotation":[{"end":[586,7],"name":"tests/purus/passing/prelude/Prelude.purs","start":[586,3]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[586,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[586,8]},[]],"contents":{"kind":{"annotation":[{"end":[584,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[584,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[587,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[587,3]},[]],"contents":[{"annotation":[{"end":[587,7],"name":"tests/purus/passing/prelude/Prelude.purs","start":[587,3]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[587,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[587,8]},[]],"contents":{"kind":{"annotation":[{"end":[584,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[584,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"filterList","moduleName":["Prelude"]}},"annotation":{"meta":null,"sourceSpan":{"end":[591,41],"start":[591,29]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[591,41],"start":[591,40]}},"kind":"Var","type":{"annotation":[{"end":[585,16],"name":"tests/purus/passing/prelude/Prelude.purs","start":[585,4]},[]],"contents":[{"annotation":[{"end":[585,16],"name":"tests/purus/passing/prelude/Prelude.purs","start":[585,4]},[]],"contents":[{"annotation":[{"end":[585,8],"name":"tests/purus/passing/prelude/Prelude.purs","start":[585,6]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[585,5],"name":"tests/purus/passing/prelude/Prelude.purs","start":[585,4]},[]],"contents":{"kind":{"annotation":[{"end":[584,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[584,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[585,16],"name":"tests/purus/passing/prelude/Prelude.purs","start":[585,9]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"f","sourcePos":[588,1]}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[591,44],"start":[591,29]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[591,44],"start":[591,42]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[586,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[586,8]},[]],"contents":{"kind":{"annotation":[{"end":[584,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[584,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},"value":{"identifier":"xs","sourcePos":[590,10]}},"kind":"App"},"kind":"App"},"isGuarded":false},{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[592,36],"start":[590,16]}},"binderType":"NullBinder"}],"expression":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[592,31],"start":[592,21]}},"kind":"Var","type":{"annotation":[{"end":[587,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[584,3]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[584,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[584,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":121,"type":{"annotation":[{"end":[587,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[585,3]},[]],"contents":[{"annotation":[{"end":[587,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[585,3]},[]],"contents":[{"annotation":[{"end":[585,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[585,18]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[585,16],"name":"tests/purus/passing/prelude/Prelude.purs","start":[585,4]},[]],"contents":[{"annotation":[{"end":[585,16],"name":"tests/purus/passing/prelude/Prelude.purs","start":[585,4]},[]],"contents":[{"annotation":[{"end":[585,8],"name":"tests/purus/passing/prelude/Prelude.purs","start":[585,6]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[585,5],"name":"tests/purus/passing/prelude/Prelude.purs","start":[585,4]},[]],"contents":{"kind":{"annotation":[{"end":[584,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[584,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[585,16],"name":"tests/purus/passing/prelude/Prelude.purs","start":[585,9]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[587,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[586,3]},[]],"contents":[{"annotation":[{"end":[587,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[586,3]},[]],"contents":[{"annotation":[{"end":[586,12],"name":"tests/purus/passing/prelude/Prelude.purs","start":[586,10]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[586,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[586,3]},[]],"contents":[{"annotation":[{"end":[586,7],"name":"tests/purus/passing/prelude/Prelude.purs","start":[586,3]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[586,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[586,8]},[]],"contents":{"kind":{"annotation":[{"end":[584,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[584,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[587,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[587,3]},[]],"contents":[{"annotation":[{"end":[587,7],"name":"tests/purus/passing/prelude/Prelude.purs","start":[587,3]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[587,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[587,8]},[]],"contents":{"kind":{"annotation":[{"end":[584,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[584,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"filterList","moduleName":["Prelude"]}},"annotation":{"meta":null,"sourceSpan":{"end":[592,33],"start":[592,21]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[592,33],"start":[592,32]}},"kind":"Var","type":{"annotation":[{"end":[585,16],"name":"tests/purus/passing/prelude/Prelude.purs","start":[585,4]},[]],"contents":[{"annotation":[{"end":[585,16],"name":"tests/purus/passing/prelude/Prelude.purs","start":[585,4]},[]],"contents":[{"annotation":[{"end":[585,8],"name":"tests/purus/passing/prelude/Prelude.purs","start":[585,6]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[585,5],"name":"tests/purus/passing/prelude/Prelude.purs","start":[585,4]},[]],"contents":{"kind":{"annotation":[{"end":[584,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[584,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[585,16],"name":"tests/purus/passing/prelude/Prelude.purs","start":[585,9]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"f","sourcePos":[588,1]}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[592,36],"start":[592,21]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[592,36],"start":[592,34]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[586,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[586,8]},[]],"contents":{"kind":{"annotation":[{"end":[584,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[584,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},"value":{"identifier":"xs","sourcePos":[590,10]}},"kind":"App"},"isGuarded":false}],"caseExpressions":[{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[590,20],"start":[590,19]}},"kind":"Var","type":{"annotation":[{"end":[585,16],"name":"tests/purus/passing/prelude/Prelude.purs","start":[585,4]},[]],"contents":[{"annotation":[{"end":[585,16],"name":"tests/purus/passing/prelude/Prelude.purs","start":[585,4]},[]],"contents":[{"annotation":[{"end":[585,8],"name":"tests/purus/passing/prelude/Prelude.purs","start":[585,6]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[585,5],"name":"tests/purus/passing/prelude/Prelude.purs","start":[585,4]},[]],"contents":{"kind":{"annotation":[{"end":[584,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[584,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[585,16],"name":"tests/purus/passing/prelude/Prelude.purs","start":[585,9]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"f","sourcePos":[588,1]}},"annotation":{"meta":null,"sourceSpan":{"end":[590,22],"start":[590,19]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[590,22],"start":[590,21]}},"kind":"Var","type":{"annotation":[{"end":[586,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[586,8]},[]],"contents":{"kind":{"annotation":[{"end":[584,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[584,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"},"value":{"identifier":"x","sourcePos":[590,8]}},"kind":"App"}],"kind":"Case","type":{"annotation":[{"end":[587,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[587,3]},[]],"contents":[{"annotation":[{"end":[587,7],"name":"tests/purus/passing/prelude/Prelude.purs","start":[587,3]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[587,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[587,8]},[]],"contents":{"kind":{"annotation":[{"end":[584,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[584,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[588,28],"start":[588,25]}},"kind":"Var","type":{"annotation":[{"end":[586,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[586,3]},[]],"contents":[{"annotation":[{"end":[586,7],"name":"tests/purus/passing/prelude/Prelude.purs","start":[586,3]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[586,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[586,8]},[]],"contents":{"kind":{"annotation":[{"end":[584,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[584,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},"value":{"identifier":"ell","sourcePos":[588,1]}}],"kind":"Case","type":{"annotation":[{"end":[587,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[587,3]},[]],"contents":[{"annotation":[{"end":[587,7],"name":"tests/purus/passing/prelude/Prelude.purs","start":[587,3]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[587,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[587,8]},[]],"contents":{"kind":{"annotation":[{"end":[584,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[584,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[586,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[586,3]},[]],"contents":[{"annotation":[{"end":[586,7],"name":"tests/purus/passing/prelude/Prelude.purs","start":[586,3]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[586,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[586,8]},[]],"contents":{"kind":{"annotation":[{"end":[584,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[584,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[587,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[587,3]},[]],"contents":[{"annotation":[{"end":[587,7],"name":"tests/purus/passing/prelude/Prelude.purs","start":[587,3]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[587,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[587,8]},[]],"contents":{"kind":{"annotation":[{"end":[584,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[584,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"kind":"Abs","type":{"annotation":[{"end":[587,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[584,3]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[584,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[584,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":122,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[585,16],"name":"tests/purus/passing/prelude/Prelude.purs","start":[585,4]},[]],"contents":[{"annotation":[{"end":[585,16],"name":"tests/purus/passing/prelude/Prelude.purs","start":[585,4]},[]],"contents":[{"annotation":[{"end":[585,8],"name":"tests/purus/passing/prelude/Prelude.purs","start":[585,6]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[585,5],"name":"tests/purus/passing/prelude/Prelude.purs","start":[585,4]},[]],"contents":{"kind":{"annotation":[{"end":[584,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[584,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[585,16],"name":"tests/purus/passing/prelude/Prelude.purs","start":[585,9]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[587,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[586,3]},[]],"contents":[{"annotation":[{"end":[587,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[586,3]},[]],"contents":[{"annotation":[{"end":[586,12],"name":"tests/purus/passing/prelude/Prelude.purs","start":[586,10]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[586,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[586,3]},[]],"contents":[{"annotation":[{"end":[586,7],"name":"tests/purus/passing/prelude/Prelude.purs","start":[586,3]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[586,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[586,8]},[]],"contents":{"kind":{"annotation":[{"end":[584,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[584,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[587,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[587,3]},[]],"contents":[{"annotation":[{"end":[587,7],"name":"tests/purus/passing/prelude/Prelude.purs","start":[587,3]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[587,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[587,8]},[]],"contents":{"kind":{"annotation":[{"end":[584,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[584,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"identifier":"filterList"}]},{"bindType":"Rec","binds":[{"annotation":{"meta":null,"sourceSpan":{"end":[610,9],"start":[606,1]}},"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[616,70],"start":[611,1]}},"argument":"count","body":{"annotation":{"meta":null,"sourceSpan":{"end":[616,70],"start":[611,1]}},"argument":"ell","body":{"annotation":{"meta":null,"sourceSpan":{"end":[616,70],"start":[612,3]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"binderType":"ConstructorBinder","binders":[],"constructorName":{"identifier":"True","moduleName":["Prim"]},"typeName":{"identifier":"Boolean","moduleName":["Prim"]}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[613,11],"start":[613,8]}},"kind":"Var","type":{"annotation":[{"end":[609,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[609,3]},[]],"contents":[{"annotation":[{"end":[609,7],"name":"tests/purus/passing/prelude/Prelude.purs","start":[609,3]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[609,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[609,8]},[]],"contents":{"kind":{"annotation":[{"end":[607,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[607,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},"value":{"identifier":"ell","sourcePos":[611,1]}},"isGuarded":false},{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[616,70],"start":[612,3]}},"binderType":"NullBinder"}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[616,70],"start":[614,8]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[615,15],"start":[615,12]}},"binderType":"ConstructorBinder","binders":[],"constructorName":{"identifier":"Nil","moduleName":["Prim"]},"typeName":{"identifier":"List","moduleName":["Prim"]}}],"expression":{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[615,22],"start":[615,19]}},"kind":"Var","type":{"annotation":[{"end":[610,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[610,3]},[]],"contents":[{"annotation":[{"end":[610,7],"name":"tests/purus/passing/prelude/Prelude.purs","start":[610,3]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[610,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[610,8]},[]],"contents":{"kind":{"annotation":[{"end":[607,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[607,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},"value":{"identifier":"Nil","moduleName":["Prim"]}},"isGuarded":false},{"binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[616,21],"start":[616,12]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[616,18],"start":[616,17]}},"binderType":"NullBinder"},{"annotation":{"meta":null,"sourceSpan":{"end":[616,21],"start":[616,19]}},"binderType":"VarBinder","identifier":"xs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[609,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[609,8]},[]],"contents":{"kind":{"annotation":[{"end":[607,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[607,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}}],"constructorName":{"identifier":"Cons","moduleName":["Prim"]},"typeName":{"identifier":"List","moduleName":["Prim"]}}],"expression":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[616,33],"start":[616,25]}},"kind":"Var","type":{"annotation":[{"end":[610,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[607,3]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[607,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[607,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":127,"type":{"annotation":[{"end":[610,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[608,3]},[]],"contents":[{"annotation":[{"end":[610,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[608,3]},[]],"contents":[{"annotation":[{"end":[608,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[608,7]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[608,6],"name":"tests/purus/passing/prelude/Prelude.purs","start":[608,3]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[610,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[609,3]},[]],"contents":[{"annotation":[{"end":[610,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[609,3]},[]],"contents":[{"annotation":[{"end":[609,12],"name":"tests/purus/passing/prelude/Prelude.purs","start":[609,10]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[609,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[609,3]},[]],"contents":[{"annotation":[{"end":[609,7],"name":"tests/purus/passing/prelude/Prelude.purs","start":[609,3]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[609,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[609,8]},[]],"contents":{"kind":{"annotation":[{"end":[607,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[607,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[610,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[610,3]},[]],"contents":[{"annotation":[{"end":[610,7],"name":"tests/purus/passing/prelude/Prelude.purs","start":[610,3]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[610,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[610,8]},[]],"contents":{"kind":{"annotation":[{"end":[607,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[607,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"dropList","moduleName":["Prelude"]}},"annotation":{"meta":null,"sourceSpan":{"end":[616,67],"start":[616,25]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[616,58],"start":[616,35]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"subtractInteger","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[616,64],"start":[616,35]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[616,64],"start":[616,59]}},"kind":"Var","type":{"annotation":[{"end":[608,6],"name":"tests/purus/passing/prelude/Prelude.purs","start":[608,3]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"identifier":"count","sourcePos":[611,1]}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[616,66],"start":[616,35]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[616,66],"start":[616,65]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"literalType":"IntLiteral","value":1}},"kind":"App"},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[616,70],"start":[616,25]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[616,70],"start":[616,68]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[609,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[609,8]},[]],"contents":{"kind":{"annotation":[{"end":[607,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[607,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},"value":{"identifier":"xs","sourcePos":[616,19]}},"kind":"App"},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[614,16],"start":[614,13]}},"kind":"Var","type":{"annotation":[{"end":[609,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[609,3]},[]],"contents":[{"annotation":[{"end":[609,7],"name":"tests/purus/passing/prelude/Prelude.purs","start":[609,3]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[609,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[609,8]},[]],"contents":{"kind":{"annotation":[{"end":[607,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[607,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},"value":{"identifier":"ell","sourcePos":[611,1]}}],"kind":"Case","type":{"annotation":[{"end":[610,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[610,3]},[]],"contents":[{"annotation":[{"end":[610,7],"name":"tests/purus/passing/prelude/Prelude.purs","start":[610,3]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[610,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[610,8]},[]],"contents":{"kind":{"annotation":[{"end":[607,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[607,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}},"isGuarded":false}],"caseExpressions":[{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[612,35],"start":[612,6]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"lessThanEqualsInteger","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[612,41],"start":[612,6]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[612,41],"start":[612,36]}},"kind":"Var","type":{"annotation":[{"end":[608,6],"name":"tests/purus/passing/prelude/Prelude.purs","start":[608,3]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"identifier":"count","sourcePos":[611,1]}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[612,43],"start":[612,6]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[612,43],"start":[612,42]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"literalType":"IntLiteral","value":0}},"kind":"App"}],"kind":"Case","type":{"annotation":[{"end":[610,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[610,3]},[]],"contents":[{"annotation":[{"end":[610,7],"name":"tests/purus/passing/prelude/Prelude.purs","start":[610,3]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[610,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[610,8]},[]],"contents":{"kind":{"annotation":[{"end":[607,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[607,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[609,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[609,3]},[]],"contents":[{"annotation":[{"end":[609,7],"name":"tests/purus/passing/prelude/Prelude.purs","start":[609,3]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[609,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[609,8]},[]],"contents":{"kind":{"annotation":[{"end":[607,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[607,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[610,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[610,3]},[]],"contents":[{"annotation":[{"end":[610,7],"name":"tests/purus/passing/prelude/Prelude.purs","start":[610,3]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[610,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[610,8]},[]],"contents":{"kind":{"annotation":[{"end":[607,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[607,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"kind":"Abs","type":{"annotation":[{"end":[610,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[607,3]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[607,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[607,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":128,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[608,6],"name":"tests/purus/passing/prelude/Prelude.purs","start":[608,3]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[610,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[609,3]},[]],"contents":[{"annotation":[{"end":[610,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[609,3]},[]],"contents":[{"annotation":[{"end":[609,12],"name":"tests/purus/passing/prelude/Prelude.purs","start":[609,10]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[609,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[609,3]},[]],"contents":[{"annotation":[{"end":[609,7],"name":"tests/purus/passing/prelude/Prelude.purs","start":[609,3]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[609,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[609,8]},[]],"contents":{"kind":{"annotation":[{"end":[607,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[607,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[610,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[610,3]},[]],"contents":[{"annotation":[{"end":[610,7],"name":"tests/purus/passing/prelude/Prelude.purs","start":[610,3]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[610,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[610,8]},[]],"contents":{"kind":{"annotation":[{"end":[607,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[607,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"identifier":"dropList"}]},{"annotation":{"meta":null,"sourceSpan":{"end":[506,13],"start":[501,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[513,20],"start":[507,1]}},"argument":"fA","body":{"annotation":{"meta":null,"sourceSpan":{"end":[513,20],"start":[507,1]}},"argument":"fB","body":{"annotation":{"meta":null,"sourceSpan":{"end":[513,20],"start":[507,1]}},"argument":"dat","body":{"annotation":{"meta":null,"sourceSpan":{"end":[513,20],"start":[508,5]}},"binds":[{"annotation":{"meta":null,"sourceSpan":{"end":[508,58],"start":[508,9]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[508,31],"start":[508,16]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"b","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinPair"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"b"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"b"},"tag":"TypeVar"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"sndPair","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[508,58],"start":[508,16]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[508,53],"start":[508,33]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinPair"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"unConstrData","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[508,57],"start":[508,33]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[508,57],"start":[508,54]}},"kind":"Var","type":{"annotation":[{"end":[505,22],"name":"tests/purus/passing/prelude/Prelude.purs","start":[505,3]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"},"value":{"identifier":"dat","sourcePos":[507,1]}},"kind":"App"},"kind":"App"},"identifier":"dat'"},{"annotation":{"meta":null,"sourceSpan":{"end":[509,43],"start":[509,9]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[509,38],"start":[509,20]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"unListData","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[509,43],"start":[509,20]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[509,43],"start":[509,39]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"},"value":{"identifier":"dat'","sourcePos":[508,9]}},"kind":"App"},"identifier":"unlisted"},{"annotation":{"meta":null,"sourceSpan":{"end":[511,46],"start":[511,9]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[511,37],"start":[511,21]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"tailList","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[511,46],"start":[511,21]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[511,46],"start":[511,38]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"unlisted","sourcePos":[509,9]}},"kind":"App"},"identifier":"unlisted'"},{"annotation":{"meta":null,"sourceSpan":{"end":[512,44],"start":[512,9]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[512,15],"start":[512,13]}},"kind":"Var","type":{"annotation":[{"end":[504,28],"name":"tests/purus/passing/prelude/Prelude.purs","start":[504,4]},[]],"contents":[{"annotation":[{"end":[504,28],"name":"tests/purus/passing/prelude/Prelude.purs","start":[504,4]},[]],"contents":[{"annotation":[{"end":[504,26],"name":"tests/purus/passing/prelude/Prelude.purs","start":[504,24]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[504,23],"name":"tests/purus/passing/prelude/Prelude.purs","start":[504,4]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[504,28],"name":"tests/purus/passing/prelude/Prelude.purs","start":[504,27]},[]],"contents":{"kind":{"annotation":[{"end":[502,32],"name":"tests/purus/passing/prelude/Prelude.purs","start":[502,28]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"b"},"tag":"TypeVar"}],"tag":"TypeApp"},"value":{"identifier":"fB","sourcePos":[507,1]}},"annotation":{"meta":null,"sourceSpan":{"end":[512,44],"start":[512,13]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[512,33],"start":[512,17]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"headList","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[512,43],"start":[512,17]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[512,43],"start":[512,34]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"unlisted'","sourcePos":[511,9]}},"kind":"App"},"kind":"App"},"identifier":"y"},{"annotation":{"meta":null,"sourceSpan":{"end":[510,43],"start":[510,9]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[510,15],"start":[510,13]}},"kind":"Var","type":{"annotation":[{"end":[503,28],"name":"tests/purus/passing/prelude/Prelude.purs","start":[503,4]},[]],"contents":[{"annotation":[{"end":[503,28],"name":"tests/purus/passing/prelude/Prelude.purs","start":[503,4]},[]],"contents":[{"annotation":[{"end":[503,26],"name":"tests/purus/passing/prelude/Prelude.purs","start":[503,24]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[503,23],"name":"tests/purus/passing/prelude/Prelude.purs","start":[503,4]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[503,28],"name":"tests/purus/passing/prelude/Prelude.purs","start":[503,27]},[]],"contents":{"kind":{"annotation":[{"end":[502,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[502,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},"value":{"identifier":"fA","sourcePos":[507,1]}},"annotation":{"meta":null,"sourceSpan":{"end":[510,43],"start":[510,13]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[510,33],"start":[510,17]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"headList","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[510,42],"start":[510,17]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[510,42],"start":[510,34]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"unlisted","sourcePos":[509,9]}},"kind":"App"},"kind":"App"},"identifier":"x"}],"expression":{"abstraction":{"abstraction":{"annotation":{"meta":{"constructorType":"ProductType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[513,16],"start":[513,10]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"t1","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":141,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"t2","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":140,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"t1"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"t2"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Tuple2"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"t1"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"t2"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"Tuple2","moduleName":["Prim"]}},"annotation":{"meta":null,"sourceSpan":{"end":[513,18],"start":[513,10]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[513,18],"start":[513,17]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["a",{"annotation":[{"end":[502,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[502,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},26,133],"tag":"Skolem"},"value":{"identifier":"x","sourcePos":[510,9]}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[513,20],"start":[513,10]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[513,20],"start":[513,19]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["b",{"annotation":[{"end":[502,32],"name":"tests/purus/passing/prelude/Prelude.purs","start":[502,28]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},27,134],"tag":"Skolem"},"value":{"identifier":"y","sourcePos":[512,9]}},"kind":"App"},"kind":"Let"},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[505,22],"name":"tests/purus/passing/prelude/Prelude.purs","start":[505,3]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[506,13],"name":"tests/purus/passing/prelude/Prelude.purs","start":[506,3]},[]],"contents":[{"annotation":[{"end":[506,11],"name":"tests/purus/passing/prelude/Prelude.purs","start":[506,3]},[]],"contents":[{"annotation":[{"end":[506,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[506,3]},[]],"contents":[["Prim"],"Tuple2"],"tag":"TypeConstructor"},{"annotation":[{"end":[506,11],"name":"tests/purus/passing/prelude/Prelude.purs","start":[506,10]},[]],"contents":{"kind":{"annotation":[{"end":[502,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[502,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[506,13],"name":"tests/purus/passing/prelude/Prelude.purs","start":[506,12]},[]],"contents":{"kind":{"annotation":[{"end":[502,32],"name":"tests/purus/passing/prelude/Prelude.purs","start":[502,28]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"b"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[504,28],"name":"tests/purus/passing/prelude/Prelude.purs","start":[504,4]},[]],"contents":[{"annotation":[{"end":[504,28],"name":"tests/purus/passing/prelude/Prelude.purs","start":[504,4]},[]],"contents":[{"annotation":[{"end":[504,26],"name":"tests/purus/passing/prelude/Prelude.purs","start":[504,24]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[504,23],"name":"tests/purus/passing/prelude/Prelude.purs","start":[504,4]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[504,28],"name":"tests/purus/passing/prelude/Prelude.purs","start":[504,27]},[]],"contents":{"kind":{"annotation":[{"end":[502,32],"name":"tests/purus/passing/prelude/Prelude.purs","start":[502,28]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"b"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[506,13],"name":"tests/purus/passing/prelude/Prelude.purs","start":[505,3]},[]],"contents":[{"annotation":[{"end":[506,13],"name":"tests/purus/passing/prelude/Prelude.purs","start":[505,3]},[]],"contents":[{"annotation":[{"end":[505,25],"name":"tests/purus/passing/prelude/Prelude.purs","start":[505,23]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[505,22],"name":"tests/purus/passing/prelude/Prelude.purs","start":[505,3]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[506,13],"name":"tests/purus/passing/prelude/Prelude.purs","start":[506,3]},[]],"contents":[{"annotation":[{"end":[506,11],"name":"tests/purus/passing/prelude/Prelude.purs","start":[506,3]},[]],"contents":[{"annotation":[{"end":[506,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[506,3]},[]],"contents":[["Prim"],"Tuple2"],"tag":"TypeConstructor"},{"annotation":[{"end":[506,11],"name":"tests/purus/passing/prelude/Prelude.purs","start":[506,10]},[]],"contents":{"kind":{"annotation":[{"end":[502,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[502,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[506,13],"name":"tests/purus/passing/prelude/Prelude.purs","start":[506,12]},[]],"contents":{"kind":{"annotation":[{"end":[502,32],"name":"tests/purus/passing/prelude/Prelude.purs","start":[502,28]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"b"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"kind":"Abs","type":{"annotation":[{"end":[506,13],"name":"tests/purus/passing/prelude/Prelude.purs","start":[502,3]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[502,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[502,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":132,"type":{"annotation":[{"end":[506,13],"name":"tests/purus/passing/prelude/Prelude.purs","start":[502,23]},[]],"contents":{"identifier":"b","kind":{"annotation":[{"end":[502,32],"name":"tests/purus/passing/prelude/Prelude.purs","start":[502,28]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":131,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[503,28],"name":"tests/purus/passing/prelude/Prelude.purs","start":[503,4]},[]],"contents":[{"annotation":[{"end":[503,28],"name":"tests/purus/passing/prelude/Prelude.purs","start":[503,4]},[]],"contents":[{"annotation":[{"end":[503,26],"name":"tests/purus/passing/prelude/Prelude.purs","start":[503,24]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[503,23],"name":"tests/purus/passing/prelude/Prelude.purs","start":[503,4]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[503,28],"name":"tests/purus/passing/prelude/Prelude.purs","start":[503,27]},[]],"contents":{"kind":{"annotation":[{"end":[502,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[502,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[506,13],"name":"tests/purus/passing/prelude/Prelude.purs","start":[504,3]},[]],"contents":[{"annotation":[{"end":[506,13],"name":"tests/purus/passing/prelude/Prelude.purs","start":[504,3]},[]],"contents":[{"annotation":[{"end":[504,32],"name":"tests/purus/passing/prelude/Prelude.purs","start":[504,30]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[504,28],"name":"tests/purus/passing/prelude/Prelude.purs","start":[504,4]},[]],"contents":[{"annotation":[{"end":[504,28],"name":"tests/purus/passing/prelude/Prelude.purs","start":[504,4]},[]],"contents":[{"annotation":[{"end":[504,26],"name":"tests/purus/passing/prelude/Prelude.purs","start":[504,24]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[504,23],"name":"tests/purus/passing/prelude/Prelude.purs","start":[504,4]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[504,28],"name":"tests/purus/passing/prelude/Prelude.purs","start":[504,27]},[]],"contents":{"kind":{"annotation":[{"end":[502,32],"name":"tests/purus/passing/prelude/Prelude.purs","start":[502,28]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"b"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[506,13],"name":"tests/purus/passing/prelude/Prelude.purs","start":[505,3]},[]],"contents":[{"annotation":[{"end":[506,13],"name":"tests/purus/passing/prelude/Prelude.purs","start":[505,3]},[]],"contents":[{"annotation":[{"end":[505,25],"name":"tests/purus/passing/prelude/Prelude.purs","start":[505,23]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[505,22],"name":"tests/purus/passing/prelude/Prelude.purs","start":[505,3]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[506,13],"name":"tests/purus/passing/prelude/Prelude.purs","start":[506,3]},[]],"contents":[{"annotation":[{"end":[506,11],"name":"tests/purus/passing/prelude/Prelude.purs","start":[506,3]},[]],"contents":[{"annotation":[{"end":[506,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[506,3]},[]],"contents":[["Prim"],"Tuple2"],"tag":"TypeConstructor"},{"annotation":[{"end":[506,11],"name":"tests/purus/passing/prelude/Prelude.purs","start":[506,10]},[]],"contents":{"kind":{"annotation":[{"end":[502,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[502,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[506,13],"name":"tests/purus/passing/prelude/Prelude.purs","start":[506,12]},[]],"contents":{"kind":{"annotation":[{"end":[502,32],"name":"tests/purus/passing/prelude/Prelude.purs","start":[502,28]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"b"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"identifier":"deserializeTuple2"},{"annotation":{"meta":null,"sourceSpan":{"end":[437,55],"start":[437,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":{"metaType":"IsNewtype"},"sourceSpan":{"end":[438,31],"start":[438,23]}},"kind":"Var","type":{"annotation":[{"end":[437,55],"name":"tests/purus/passing/prelude/Prelude.purs","start":[437,24]},[]],"contents":[{"annotation":[{"end":[437,55],"name":"tests/purus/passing/prelude/Prelude.purs","start":[437,24]},[]],"contents":[{"annotation":[{"end":[437,46],"name":"tests/purus/passing/prelude/Prelude.purs","start":[437,44]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[437,43],"name":"tests/purus/passing/prelude/Prelude.purs","start":[437,24]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[437,55],"name":"tests/purus/passing/prelude/Prelude.purs","start":[437,47]},[]],"contents":[["Prim"],"Redeemer"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"Redeemer","moduleName":["Prim"]}},"identifier":"deserializeRedeemer"},{"annotation":{"meta":null,"sourceSpan":{"end":[528,10],"start":[524,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[535,54],"start":[529,1]}},"argument":"f","body":{"annotation":{"meta":null,"sourceSpan":{"end":[535,54],"start":[529,1]}},"argument":"dat","body":{"annotation":{"meta":null,"sourceSpan":{"end":[535,54],"start":[530,3]}},"binds":[{"annotation":{"meta":null,"sourceSpan":{"end":[530,35],"start":[530,7]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[530,31],"start":[530,11]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinPair"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"unConstrData","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[530,35],"start":[530,11]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[530,35],"start":[530,32]}},"kind":"Var","type":{"annotation":[{"end":[527,22],"name":"tests/purus/passing/prelude/Prelude.purs","start":[527,3]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"},"value":{"identifier":"dat","sourcePos":[529,1]}},"kind":"App"},"identifier":"p"},{"annotation":{"meta":null,"sourceSpan":{"end":[531,30],"start":[531,7]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[531,28],"start":[531,13]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"b","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinPair"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"b"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"fstPair","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[531,30],"start":[531,13]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[531,30],"start":[531,29]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinPair"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"p","sourcePos":[530,7]}},"kind":"App"},"identifier":"tag"}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[535,54],"start":[532,8]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"binderType":"ConstructorBinder","binders":[],"constructorName":{"identifier":"True","moduleName":["Prim"]},"typeName":{"identifier":"Boolean","moduleName":["Prim"]}}],"expression":{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[533,20],"start":[533,13]}},"kind":"Var","type":{"annotation":[{"end":[528,10],"name":"tests/purus/passing/prelude/Prelude.purs","start":[528,3]},[]],"contents":[{"annotation":[{"end":[528,8],"name":"tests/purus/passing/prelude/Prelude.purs","start":[528,3]},[]],"contents":[["Prim"],"Maybe"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["a",{"annotation":[{"end":[525,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[525,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},28,143],"tag":"Skolem"}],"tag":"TypeApp"},"value":{"identifier":"Nothing","moduleName":["Prim"]}},"isGuarded":false},{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[535,54],"start":[532,8]}},"binderType":"NullBinder"}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[535,54],"start":[534,13]}},"binds":[{"annotation":{"meta":null,"sourceSpan":{"end":[534,66],"start":[534,17]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[534,46],"start":[534,28]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"unListData","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[534,66],"start":[534,28]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[534,63],"start":[534,48]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"b","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinPair"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"b"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"b"},"tag":"TypeVar"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"sndPair","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[534,65],"start":[534,48]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[534,65],"start":[534,64]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinPair"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"p","sourcePos":[530,7]}},"kind":"App"},"kind":"App"},"identifier":"unlisted"}],"expression":{"abstraction":{"annotation":{"meta":{"constructorType":"SumType","identifiers":["$__unused"],"metaType":"IsConstructor"},"sourceSpan":{"end":[535,22],"start":[535,18]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":149,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Maybe"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"Just","moduleName":["Prim"]}},"annotation":{"meta":null,"sourceSpan":{"end":[535,54],"start":[535,18]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[535,25],"start":[535,24]}},"kind":"Var","type":{"annotation":[{"end":[526,28],"name":"tests/purus/passing/prelude/Prelude.purs","start":[526,4]},[]],"contents":[{"annotation":[{"end":[526,28],"name":"tests/purus/passing/prelude/Prelude.purs","start":[526,4]},[]],"contents":[{"annotation":[{"end":[526,26],"name":"tests/purus/passing/prelude/Prelude.purs","start":[526,24]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[526,23],"name":"tests/purus/passing/prelude/Prelude.purs","start":[526,4]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[526,28],"name":"tests/purus/passing/prelude/Prelude.purs","start":[526,27]},[]],"contents":{"kind":{"annotation":[{"end":[525,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[525,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},"value":{"identifier":"f","sourcePos":[529,1]}},"annotation":{"meta":null,"sourceSpan":{"end":[535,53],"start":[535,24]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[535,43],"start":[535,27]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"headList","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[535,52],"start":[535,27]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[535,52],"start":[535,44]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"unlisted","sourcePos":[534,17]}},"kind":"App"},"kind":"App"},"kind":"App"},"kind":"Let"},"isGuarded":false}],"caseExpressions":[{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[532,32],"start":[532,11]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"equalsInteger","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[532,36],"start":[532,11]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[532,36],"start":[532,33]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"identifier":"tag","sourcePos":[531,7]}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[532,38],"start":[532,11]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[532,38],"start":[532,37]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"literalType":"IntLiteral","value":0}},"kind":"App"}],"kind":"Case","type":{"annotation":[{"end":[528,10],"name":"tests/purus/passing/prelude/Prelude.purs","start":[528,3]},[]],"contents":[{"annotation":[{"end":[528,8],"name":"tests/purus/passing/prelude/Prelude.purs","start":[528,3]},[]],"contents":[["Prim"],"Maybe"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["a",{"annotation":[{"end":[525,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[525,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},28,143],"tag":"Skolem"}],"tag":"TypeApp"}},"kind":"Let"},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[527,22],"name":"tests/purus/passing/prelude/Prelude.purs","start":[527,3]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[528,10],"name":"tests/purus/passing/prelude/Prelude.purs","start":[528,3]},[]],"contents":[{"annotation":[{"end":[528,8],"name":"tests/purus/passing/prelude/Prelude.purs","start":[528,3]},[]],"contents":[["Prim"],"Maybe"],"tag":"TypeConstructor"},{"annotation":[{"end":[528,10],"name":"tests/purus/passing/prelude/Prelude.purs","start":[528,9]},[]],"contents":{"kind":{"annotation":[{"end":[525,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[525,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"kind":"Abs","type":{"annotation":[{"end":[528,10],"name":"tests/purus/passing/prelude/Prelude.purs","start":[525,3]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[525,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[525,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":142,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[526,28],"name":"tests/purus/passing/prelude/Prelude.purs","start":[526,4]},[]],"contents":[{"annotation":[{"end":[526,28],"name":"tests/purus/passing/prelude/Prelude.purs","start":[526,4]},[]],"contents":[{"annotation":[{"end":[526,26],"name":"tests/purus/passing/prelude/Prelude.purs","start":[526,24]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[526,23],"name":"tests/purus/passing/prelude/Prelude.purs","start":[526,4]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[526,28],"name":"tests/purus/passing/prelude/Prelude.purs","start":[526,27]},[]],"contents":{"kind":{"annotation":[{"end":[525,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[525,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[528,10],"name":"tests/purus/passing/prelude/Prelude.purs","start":[527,3]},[]],"contents":[{"annotation":[{"end":[528,10],"name":"tests/purus/passing/prelude/Prelude.purs","start":[527,3]},[]],"contents":[{"annotation":[{"end":[527,25],"name":"tests/purus/passing/prelude/Prelude.purs","start":[527,23]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[527,22],"name":"tests/purus/passing/prelude/Prelude.purs","start":[527,3]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[528,10],"name":"tests/purus/passing/prelude/Prelude.purs","start":[528,3]},[]],"contents":[{"annotation":[{"end":[528,8],"name":"tests/purus/passing/prelude/Prelude.purs","start":[528,3]},[]],"contents":[["Prim"],"Maybe"],"tag":"TypeConstructor"},{"annotation":[{"end":[528,10],"name":"tests/purus/passing/prelude/Prelude.purs","start":[528,9]},[]],"contents":{"kind":{"annotation":[{"end":[525,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[525,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"identifier":"deserializeMaybe"},{"annotation":{"meta":null,"sourceSpan":{"end":[480,83],"start":[479,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[490,42],"start":[481,1]}},"argument":"f","body":{"annotation":{"meta":null,"sourceSpan":{"end":[490,42],"start":[481,1]}},"argument":"dat","body":{"annotation":{"meta":{"metaType":"IsWhere"},"sourceSpan":{"end":[483,18],"start":[482,3]}},"binds":[{"annotation":{"meta":null,"sourceSpan":{"end":[485,61],"start":[485,6]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[490,42],"start":[486,6]}},"argument":"ell","body":{"annotation":{"meta":null,"sourceSpan":{"end":[490,42],"start":[486,15]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"binderType":"ConstructorBinder","binders":[],"constructorName":{"identifier":"True","moduleName":["Prim"]},"typeName":{"identifier":"Boolean","moduleName":["Prim"]}}],"expression":{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[487,23],"start":[487,20]}},"kind":"Var","type":{"annotation":[{"end":[485,61],"name":"tests/purus/passing/prelude/Prelude.purs","start":[485,55]},[]],"contents":[{"annotation":[{"end":[485,59],"name":"tests/purus/passing/prelude/Prelude.purs","start":[485,55]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["a",{"annotation":[{"end":[480,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[480,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},29,152],"tag":"Skolem"}],"tag":"TypeApp"},"value":{"identifier":"Nil","moduleName":["Prim"]}},"isGuarded":false},{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[490,42],"start":[486,15]}},"binderType":"NullBinder"}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[490,42],"start":[488,20]}},"binds":[{"annotation":{"meta":null,"sourceSpan":{"end":[489,48],"start":[489,24]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[489,44],"start":[489,28]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"tailList","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[489,48],"start":[489,28]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[489,48],"start":[489,45]}},"kind":"Var","type":{"annotation":[{"end":[485,51],"name":"tests/purus/passing/prelude/Prelude.purs","start":[485,12]},[]],"contents":[{"annotation":[{"end":[485,31],"name":"tests/purus/passing/prelude/Prelude.purs","start":[485,12]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[485,51],"name":"tests/purus/passing/prelude/Prelude.purs","start":[485,32]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"ell","sourcePos":[486,6]}},"kind":"App"},"identifier":"t"},{"annotation":{"meta":null,"sourceSpan":{"end":[488,48],"start":[488,24]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[488,44],"start":[488,28]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"headList","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[488,48],"start":[488,28]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[488,48],"start":[488,45]}},"kind":"Var","type":{"annotation":[{"end":[485,51],"name":"tests/purus/passing/prelude/Prelude.purs","start":[485,12]},[]],"contents":[{"annotation":[{"end":[485,31],"name":"tests/purus/passing/prelude/Prelude.purs","start":[485,12]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[485,51],"name":"tests/purus/passing/prelude/Prelude.purs","start":[485,32]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"ell","sourcePos":[486,6]}},"kind":"App"},"identifier":"h"}],"expression":{"abstraction":{"abstraction":{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[490,29],"start":[490,25]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"x","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":157,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"x"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"x"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"x"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"Cons","moduleName":["Prim"]}},"annotation":{"meta":null,"sourceSpan":{"end":[490,35],"start":[490,25]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[490,32],"start":[490,31]}},"kind":"Var","type":{"annotation":[{"end":[480,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[480,25]},[]],"contents":[{"annotation":[{"end":[480,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[480,25]},[]],"contents":[{"annotation":[{"end":[480,47],"name":"tests/purus/passing/prelude/Prelude.purs","start":[480,45]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[480,44],"name":"tests/purus/passing/prelude/Prelude.purs","start":[480,25]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[480,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[480,48]},[]],"contents":{"kind":{"annotation":[{"end":[480,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[480,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},"value":{"identifier":"f","sourcePos":[481,1]}},"annotation":{"meta":null,"sourceSpan":{"end":[490,34],"start":[490,31]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[490,34],"start":[490,33]}},"kind":"Var","type":{"annotation":[{"end":[485,51],"name":"tests/purus/passing/prelude/Prelude.purs","start":[485,32]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"},"value":{"identifier":"h","sourcePos":[488,24]}},"kind":"App"},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[490,42],"start":[490,25]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[490,39],"start":[490,37]}},"kind":"Var","type":{"annotation":[{"end":[485,61],"name":"tests/purus/passing/prelude/Prelude.purs","start":[485,12]},[]],"contents":[{"annotation":[{"end":[485,61],"name":"tests/purus/passing/prelude/Prelude.purs","start":[485,12]},[]],"contents":[{"annotation":[{"end":[485,54],"name":"tests/purus/passing/prelude/Prelude.purs","start":[485,52]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[485,51],"name":"tests/purus/passing/prelude/Prelude.purs","start":[485,12]},[]],"contents":[{"annotation":[{"end":[485,31],"name":"tests/purus/passing/prelude/Prelude.purs","start":[485,12]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[485,51],"name":"tests/purus/passing/prelude/Prelude.purs","start":[485,32]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[485,61],"name":"tests/purus/passing/prelude/Prelude.purs","start":[485,55]},[]],"contents":[{"annotation":[{"end":[485,59],"name":"tests/purus/passing/prelude/Prelude.purs","start":[485,55]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["a",{"annotation":[{"end":[480,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[480,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},29,152],"tag":"Skolem"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"go","sourcePos":[485,6]}},"annotation":{"meta":null,"sourceSpan":{"end":[490,41],"start":[490,37]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[490,41],"start":[490,40]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[485,51],"name":"tests/purus/passing/prelude/Prelude.purs","start":[485,32]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"t","sourcePos":[489,24]}},"kind":"App"},"kind":"App"},"kind":"Let"},"isGuarded":false}],"caseExpressions":[{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[486,34],"start":[486,18]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"nullList","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[486,38],"start":[486,18]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[486,38],"start":[486,35]}},"kind":"Var","type":{"annotation":[{"end":[485,51],"name":"tests/purus/passing/prelude/Prelude.purs","start":[485,12]},[]],"contents":[{"annotation":[{"end":[485,31],"name":"tests/purus/passing/prelude/Prelude.purs","start":[485,12]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[485,51],"name":"tests/purus/passing/prelude/Prelude.purs","start":[485,32]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"ell","sourcePos":[486,6]}},"kind":"App"}],"kind":"Case","type":{"annotation":[{"end":[485,61],"name":"tests/purus/passing/prelude/Prelude.purs","start":[485,55]},[]],"contents":[{"annotation":[{"end":[485,59],"name":"tests/purus/passing/prelude/Prelude.purs","start":[485,55]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["a",{"annotation":[{"end":[480,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[480,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},29,152],"tag":"Skolem"}],"tag":"TypeApp"}},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[485,51],"name":"tests/purus/passing/prelude/Prelude.purs","start":[485,12]},[]],"contents":[{"annotation":[{"end":[485,31],"name":"tests/purus/passing/prelude/Prelude.purs","start":[485,12]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[485,51],"name":"tests/purus/passing/prelude/Prelude.purs","start":[485,32]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[485,61],"name":"tests/purus/passing/prelude/Prelude.purs","start":[485,55]},[]],"contents":[{"annotation":[{"end":[485,59],"name":"tests/purus/passing/prelude/Prelude.purs","start":[485,55]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["a",{"annotation":[{"end":[480,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[480,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},29,152],"tag":"Skolem"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"identifier":"go"}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[483,18],"start":[482,3]}},"binds":[{"annotation":{"meta":null,"sourceSpan":{"end":[482,40],"start":[482,7]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[482,36],"start":[482,18]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"unListData","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[482,40],"start":[482,18]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[482,40],"start":[482,37]}},"kind":"Var","type":{"annotation":[{"end":[480,73],"name":"tests/purus/passing/prelude/Prelude.purs","start":[480,54]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"},"value":{"identifier":"dat","sourcePos":[481,1]}},"kind":"App"},"identifier":"unlisted"}],"expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[483,9],"start":[483,7]}},"kind":"Var","type":{"annotation":[{"end":[485,61],"name":"tests/purus/passing/prelude/Prelude.purs","start":[485,12]},[]],"contents":[{"annotation":[{"end":[485,61],"name":"tests/purus/passing/prelude/Prelude.purs","start":[485,12]},[]],"contents":[{"annotation":[{"end":[485,54],"name":"tests/purus/passing/prelude/Prelude.purs","start":[485,52]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[485,51],"name":"tests/purus/passing/prelude/Prelude.purs","start":[485,12]},[]],"contents":[{"annotation":[{"end":[485,31],"name":"tests/purus/passing/prelude/Prelude.purs","start":[485,12]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[485,51],"name":"tests/purus/passing/prelude/Prelude.purs","start":[485,32]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[485,61],"name":"tests/purus/passing/prelude/Prelude.purs","start":[485,55]},[]],"contents":[{"annotation":[{"end":[485,59],"name":"tests/purus/passing/prelude/Prelude.purs","start":[485,55]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["a",{"annotation":[{"end":[480,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[480,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},29,152],"tag":"Skolem"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"go","sourcePos":[485,6]}},"annotation":{"meta":null,"sourceSpan":{"end":[483,18],"start":[483,7]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[483,18],"start":[483,10]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"unlisted","sourcePos":[482,7]}},"kind":"App"},"kind":"Let"},"kind":"Let"},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[480,73],"name":"tests/purus/passing/prelude/Prelude.purs","start":[480,54]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[480,83],"name":"tests/purus/passing/prelude/Prelude.purs","start":[480,77]},[]],"contents":[{"annotation":[{"end":[480,81],"name":"tests/purus/passing/prelude/Prelude.purs","start":[480,77]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[480,83],"name":"tests/purus/passing/prelude/Prelude.purs","start":[480,82]},[]],"contents":{"kind":{"annotation":[{"end":[480,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[480,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"kind":"Abs","type":{"annotation":[{"end":[480,83],"name":"tests/purus/passing/prelude/Prelude.purs","start":[480,3]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[480,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[480,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":151,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[480,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[480,25]},[]],"contents":[{"annotation":[{"end":[480,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[480,25]},[]],"contents":[{"annotation":[{"end":[480,47],"name":"tests/purus/passing/prelude/Prelude.purs","start":[480,45]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[480,44],"name":"tests/purus/passing/prelude/Prelude.purs","start":[480,25]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[480,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[480,48]},[]],"contents":{"kind":{"annotation":[{"end":[480,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[480,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[480,83],"name":"tests/purus/passing/prelude/Prelude.purs","start":[480,54]},[]],"contents":[{"annotation":[{"end":[480,83],"name":"tests/purus/passing/prelude/Prelude.purs","start":[480,54]},[]],"contents":[{"annotation":[{"end":[480,76],"name":"tests/purus/passing/prelude/Prelude.purs","start":[480,74]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[480,73],"name":"tests/purus/passing/prelude/Prelude.purs","start":[480,54]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[480,83],"name":"tests/purus/passing/prelude/Prelude.purs","start":[480,77]},[]],"contents":[{"annotation":[{"end":[480,81],"name":"tests/purus/passing/prelude/Prelude.purs","start":[480,77]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[480,83],"name":"tests/purus/passing/prelude/Prelude.purs","start":[480,82]},[]],"contents":{"kind":{"annotation":[{"end":[480,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[480,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"identifier":"deserializeList"},{"annotation":{"meta":null,"sourceSpan":{"end":[461,45],"start":[461,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[462,33],"start":[462,18]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"unIData","moduleName":["Builtin"]}},"identifier":"deserializeInt"},{"annotation":{"meta":null,"sourceSpan":{"end":[162,55],"start":[162,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[163,56],"start":[163,1]}},"argument":"dat","body":{"abstraction":{"annotation":{"meta":{"metaType":"IsNewtype"},"sourceSpan":{"end":[163,35],"start":[163,27]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Lovelace"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"Lovelace","moduleName":["Prim"]}},"annotation":{"meta":null,"sourceSpan":{"end":[163,56],"start":[163,27]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[163,51],"start":[163,37]}},"kind":"Var","type":{"annotation":[{"end":[461,45],"name":"tests/purus/passing/prelude/Prelude.purs","start":[461,19]},[]],"contents":[{"annotation":[{"end":[461,45],"name":"tests/purus/passing/prelude/Prelude.purs","start":[461,19]},[]],"contents":[{"annotation":[{"end":[461,41],"name":"tests/purus/passing/prelude/Prelude.purs","start":[461,39]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[461,38],"name":"tests/purus/passing/prelude/Prelude.purs","start":[461,19]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[461,45],"name":"tests/purus/passing/prelude/Prelude.purs","start":[461,42]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"deserializeInt","moduleName":["Prelude"]}},"annotation":{"meta":null,"sourceSpan":{"end":[163,55],"start":[163,37]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[163,55],"start":[163,52]}},"kind":"Var","type":{"annotation":[{"end":[162,43],"name":"tests/purus/passing/prelude/Prelude.purs","start":[162,24]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"},"value":{"identifier":"dat","sourcePos":[163,1]}},"kind":"App"},"kind":"App"},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[162,43],"name":"tests/purus/passing/prelude/Prelude.purs","start":[162,24]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[162,55],"name":"tests/purus/passing/prelude/Prelude.purs","start":[162,47]},[]],"contents":[["Prim"],"Lovelace"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"identifier":"deserializeLovelace"},{"annotation":{"meta":null,"sourceSpan":{"end":[168,57],"start":[168,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[169,58],"start":[169,1]}},"argument":"dat","body":{"abstraction":{"annotation":{"meta":{"metaType":"IsNewtype"},"sourceSpan":{"end":[169,37],"start":[169,28]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"POSIXTime"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"POSIXTime","moduleName":["Prim"]}},"annotation":{"meta":null,"sourceSpan":{"end":[169,58],"start":[169,28]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[169,53],"start":[169,39]}},"kind":"Var","type":{"annotation":[{"end":[461,45],"name":"tests/purus/passing/prelude/Prelude.purs","start":[461,19]},[]],"contents":[{"annotation":[{"end":[461,45],"name":"tests/purus/passing/prelude/Prelude.purs","start":[461,19]},[]],"contents":[{"annotation":[{"end":[461,41],"name":"tests/purus/passing/prelude/Prelude.purs","start":[461,39]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[461,38],"name":"tests/purus/passing/prelude/Prelude.purs","start":[461,19]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[461,45],"name":"tests/purus/passing/prelude/Prelude.purs","start":[461,42]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"deserializeInt","moduleName":["Prelude"]}},"annotation":{"meta":null,"sourceSpan":{"end":[169,57],"start":[169,39]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[169,57],"start":[169,54]}},"kind":"Var","type":{"annotation":[{"end":[168,44],"name":"tests/purus/passing/prelude/Prelude.purs","start":[168,25]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"},"value":{"identifier":"dat","sourcePos":[169,1]}},"kind":"App"},"kind":"App"},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[168,44],"name":"tests/purus/passing/prelude/Prelude.purs","start":[168,25]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[168,57],"name":"tests/purus/passing/prelude/Prelude.purs","start":[168,48]},[]],"contents":[["Prim"],"POSIXTime"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"identifier":"deserializePOSIXTime"},{"annotation":{"meta":null,"sourceSpan":{"end":[355,87],"start":[354,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[364,24],"start":[356,1]}},"argument":"f","body":{"annotation":{"meta":null,"sourceSpan":{"end":[364,24],"start":[356,1]}},"argument":"dat","body":{"annotation":{"meta":null,"sourceSpan":{"end":[364,24],"start":[357,3]}},"binds":[{"annotation":{"meta":null,"sourceSpan":{"end":[357,35],"start":[357,7]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[357,31],"start":[357,11]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinPair"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"unConstrData","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[357,35],"start":[357,11]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[357,35],"start":[357,32]}},"kind":"Var","type":{"annotation":[{"end":[355,73],"name":"tests/purus/passing/prelude/Prelude.purs","start":[355,54]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"},"value":{"identifier":"dat","sourcePos":[356,1]}},"kind":"App"},"identifier":"p"},{"annotation":{"meta":null,"sourceSpan":{"end":[358,30],"start":[358,7]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[358,28],"start":[358,13]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"b","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinPair"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"b"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"fstPair","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[358,30],"start":[358,13]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[358,30],"start":[358,29]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinPair"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"p","sourcePos":[357,7]}},"kind":"App"},"identifier":"tag"}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[364,24],"start":[359,8]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"binderType":"ConstructorBinder","binders":[],"constructorName":{"identifier":"True","moduleName":["Prim"]},"typeName":{"identifier":"Boolean","moduleName":["Prim"]}}],"expression":{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[360,19],"start":[360,13]}},"kind":"Var","type":{"annotation":[{"end":[355,87],"name":"tests/purus/passing/prelude/Prelude.purs","start":[355,77]},[]],"contents":[{"annotation":[{"end":[355,85],"name":"tests/purus/passing/prelude/Prelude.purs","start":[355,77]},[]],"contents":[["Prim"],"Extended"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["a",{"annotation":[{"end":[355,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[355,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},30,159],"tag":"Skolem"}],"tag":"TypeApp"},"value":{"identifier":"NegInf","moduleName":["Prim"]}},"isGuarded":false},{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[364,24],"start":[359,8]}},"binderType":"NullBinder"}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[364,24],"start":[361,13]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"binderType":"ConstructorBinder","binders":[],"constructorName":{"identifier":"True","moduleName":["Prim"]},"typeName":{"identifier":"Boolean","moduleName":["Prim"]}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[363,60],"start":[362,18]}},"binds":[{"annotation":{"meta":null,"sourceSpan":{"end":[362,71],"start":[362,22]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[362,51],"start":[362,33]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"unListData","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[362,71],"start":[362,33]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[362,68],"start":[362,53]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"b","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinPair"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"b"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"b"},"tag":"TypeVar"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"sndPair","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[362,70],"start":[362,53]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[362,70],"start":[362,69]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinPair"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"p","sourcePos":[357,7]}},"kind":"App"},"kind":"App"},"identifier":"unlisted"}],"expression":{"abstraction":{"annotation":{"meta":{"constructorType":"SumType","identifiers":["$__unused"],"metaType":"IsConstructor"},"sourceSpan":{"end":[363,28],"start":[363,22]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":165,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Extended"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"Finite","moduleName":["Prim"]}},"annotation":{"meta":null,"sourceSpan":{"end":[363,60],"start":[363,22]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[363,31],"start":[363,30]}},"kind":"Var","type":{"annotation":[{"end":[355,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[355,25]},[]],"contents":[{"annotation":[{"end":[355,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[355,25]},[]],"contents":[{"annotation":[{"end":[355,47],"name":"tests/purus/passing/prelude/Prelude.purs","start":[355,45]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[355,44],"name":"tests/purus/passing/prelude/Prelude.purs","start":[355,25]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[355,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[355,48]},[]],"contents":{"kind":{"annotation":[{"end":[355,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[355,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},"value":{"identifier":"f","sourcePos":[356,1]}},"annotation":{"meta":null,"sourceSpan":{"end":[363,59],"start":[363,30]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[363,49],"start":[363,33]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"headList","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[363,58],"start":[363,33]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[363,58],"start":[363,50]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"unlisted","sourcePos":[362,22]}},"kind":"App"},"kind":"App"},"kind":"App"},"kind":"Let"},"isGuarded":false},{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[364,24],"start":[361,13]}},"binderType":"NullBinder"}],"expression":{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[364,24],"start":[364,18]}},"kind":"Var","type":{"annotation":[{"end":[355,87],"name":"tests/purus/passing/prelude/Prelude.purs","start":[355,77]},[]],"contents":[{"annotation":[{"end":[355,85],"name":"tests/purus/passing/prelude/Prelude.purs","start":[355,77]},[]],"contents":[["Prim"],"Extended"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["a",{"annotation":[{"end":[355,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[355,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},30,159],"tag":"Skolem"}],"tag":"TypeApp"},"value":{"identifier":"PosInf","moduleName":["Prim"]}},"isGuarded":false}],"caseExpressions":[{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[361,37],"start":[361,16]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"equalsInteger","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[361,41],"start":[361,16]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[361,41],"start":[361,38]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"identifier":"tag","sourcePos":[358,7]}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[361,43],"start":[361,16]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[361,43],"start":[361,42]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"literalType":"IntLiteral","value":1}},"kind":"App"}],"kind":"Case","type":{"annotation":[{"end":[355,87],"name":"tests/purus/passing/prelude/Prelude.purs","start":[355,77]},[]],"contents":[{"annotation":[{"end":[355,85],"name":"tests/purus/passing/prelude/Prelude.purs","start":[355,77]},[]],"contents":[["Prim"],"Extended"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["a",{"annotation":[{"end":[355,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[355,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},30,159],"tag":"Skolem"}],"tag":"TypeApp"}},"isGuarded":false}],"caseExpressions":[{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[359,32],"start":[359,11]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"equalsInteger","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[359,36],"start":[359,11]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[359,36],"start":[359,33]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"identifier":"tag","sourcePos":[358,7]}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[359,38],"start":[359,11]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[359,38],"start":[359,37]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"literalType":"IntLiteral","value":0}},"kind":"App"}],"kind":"Case","type":{"annotation":[{"end":[355,87],"name":"tests/purus/passing/prelude/Prelude.purs","start":[355,77]},[]],"contents":[{"annotation":[{"end":[355,85],"name":"tests/purus/passing/prelude/Prelude.purs","start":[355,77]},[]],"contents":[["Prim"],"Extended"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["a",{"annotation":[{"end":[355,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[355,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},30,159],"tag":"Skolem"}],"tag":"TypeApp"}},"kind":"Let"},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[355,73],"name":"tests/purus/passing/prelude/Prelude.purs","start":[355,54]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[355,87],"name":"tests/purus/passing/prelude/Prelude.purs","start":[355,77]},[]],"contents":[{"annotation":[{"end":[355,85],"name":"tests/purus/passing/prelude/Prelude.purs","start":[355,77]},[]],"contents":[["Prim"],"Extended"],"tag":"TypeConstructor"},{"annotation":[{"end":[355,87],"name":"tests/purus/passing/prelude/Prelude.purs","start":[355,86]},[]],"contents":{"kind":{"annotation":[{"end":[355,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[355,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"kind":"Abs","type":{"annotation":[{"end":[355,87],"name":"tests/purus/passing/prelude/Prelude.purs","start":[355,3]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[355,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[355,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":158,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[355,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[355,25]},[]],"contents":[{"annotation":[{"end":[355,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[355,25]},[]],"contents":[{"annotation":[{"end":[355,47],"name":"tests/purus/passing/prelude/Prelude.purs","start":[355,45]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[355,44],"name":"tests/purus/passing/prelude/Prelude.purs","start":[355,25]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[355,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[355,48]},[]],"contents":{"kind":{"annotation":[{"end":[355,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[355,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[355,87],"name":"tests/purus/passing/prelude/Prelude.purs","start":[355,54]},[]],"contents":[{"annotation":[{"end":[355,87],"name":"tests/purus/passing/prelude/Prelude.purs","start":[355,54]},[]],"contents":[{"annotation":[{"end":[355,76],"name":"tests/purus/passing/prelude/Prelude.purs","start":[355,74]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[355,73],"name":"tests/purus/passing/prelude/Prelude.purs","start":[355,54]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[355,87],"name":"tests/purus/passing/prelude/Prelude.purs","start":[355,77]},[]],"contents":[{"annotation":[{"end":[355,85],"name":"tests/purus/passing/prelude/Prelude.purs","start":[355,77]},[]],"contents":[["Prim"],"Extended"],"tag":"TypeConstructor"},{"annotation":[{"end":[355,87],"name":"tests/purus/passing/prelude/Prelude.purs","start":[355,86]},[]],"contents":{"kind":{"annotation":[{"end":[355,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[355,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"identifier":"deserializeExtended"},{"annotation":{"meta":null,"sourceSpan":{"end":[372,89],"start":[371,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[377,20],"start":[373,1]}},"argument":"f","body":{"annotation":{"meta":null,"sourceSpan":{"end":[377,20],"start":[373,1]}},"argument":"dat","body":{"annotation":{"meta":null,"sourceSpan":{"end":[377,20],"start":[374,3]}},"binds":[{"annotation":{"meta":null,"sourceSpan":{"end":[374,56],"start":[374,7]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[374,29],"start":[374,14]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"b","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinPair"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"b"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"b"},"tag":"TypeVar"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"sndPair","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[374,56],"start":[374,14]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[374,51],"start":[374,31]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinPair"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"unConstrData","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[374,55],"start":[374,31]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[374,55],"start":[374,52]}},"kind":"Var","type":{"annotation":[{"end":[372,73],"name":"tests/purus/passing/prelude/Prelude.purs","start":[372,54]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"},"value":{"identifier":"dat","sourcePos":[373,1]}},"kind":"App"},"kind":"App"},"identifier":"dat'"},{"annotation":{"meta":null,"sourceSpan":{"end":[375,41],"start":[375,7]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[375,36],"start":[375,18]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"unListData","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[375,41],"start":[375,18]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[375,41],"start":[375,37]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"},"value":{"identifier":"dat'","sourcePos":[374,7]}},"kind":"App"},"identifier":"unlisted"},{"annotation":{"meta":null,"sourceSpan":{"end":[376,60],"start":[376,7]}},"bindType":"NonRec","expression":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[376,30],"start":[376,11]}},"kind":"Var","type":{"annotation":[{"end":[355,87],"name":"tests/purus/passing/prelude/Prelude.purs","start":[355,3]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[355,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[355,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":158,"type":{"annotation":[{"end":[355,87],"name":"tests/purus/passing/prelude/Prelude.purs","start":[355,24]},[]],"contents":[{"annotation":[{"end":[355,87],"name":"tests/purus/passing/prelude/Prelude.purs","start":[355,24]},[]],"contents":[{"annotation":[{"end":[355,53],"name":"tests/purus/passing/prelude/Prelude.purs","start":[355,51]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[355,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[355,25]},[]],"contents":[{"annotation":[{"end":[355,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[355,25]},[]],"contents":[{"annotation":[{"end":[355,47],"name":"tests/purus/passing/prelude/Prelude.purs","start":[355,45]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[355,44],"name":"tests/purus/passing/prelude/Prelude.purs","start":[355,25]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[355,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[355,48]},[]],"contents":{"kind":{"annotation":[{"end":[355,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[355,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[355,87],"name":"tests/purus/passing/prelude/Prelude.purs","start":[355,54]},[]],"contents":[{"annotation":[{"end":[355,87],"name":"tests/purus/passing/prelude/Prelude.purs","start":[355,54]},[]],"contents":[{"annotation":[{"end":[355,76],"name":"tests/purus/passing/prelude/Prelude.purs","start":[355,74]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[355,73],"name":"tests/purus/passing/prelude/Prelude.purs","start":[355,54]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[355,87],"name":"tests/purus/passing/prelude/Prelude.purs","start":[355,77]},[]],"contents":[{"annotation":[{"end":[355,85],"name":"tests/purus/passing/prelude/Prelude.purs","start":[355,77]},[]],"contents":[["Prim"],"Extended"],"tag":"TypeConstructor"},{"annotation":[{"end":[355,87],"name":"tests/purus/passing/prelude/Prelude.purs","start":[355,86]},[]],"contents":{"kind":{"annotation":[{"end":[355,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[355,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"deserializeExtended","moduleName":["Prelude"]}},"annotation":{"meta":null,"sourceSpan":{"end":[376,32],"start":[376,11]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[376,32],"start":[376,31]}},"kind":"Var","type":{"annotation":[{"end":[372,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[372,25]},[]],"contents":[{"annotation":[{"end":[372,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[372,25]},[]],"contents":[{"annotation":[{"end":[372,47],"name":"tests/purus/passing/prelude/Prelude.purs","start":[372,45]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[372,44],"name":"tests/purus/passing/prelude/Prelude.purs","start":[372,25]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[372,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[372,48]},[]],"contents":{"kind":{"annotation":[{"end":[372,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[372,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},"value":{"identifier":"f","sourcePos":[373,1]}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[376,60],"start":[376,11]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[376,50],"start":[376,34]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"headList","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[376,59],"start":[376,34]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[376,59],"start":[376,51]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"unlisted","sourcePos":[375,7]}},"kind":"App"},"kind":"App"},"identifier":"e"}],"expression":{"abstraction":{"annotation":{"meta":{"metaType":"IsNewtype"},"sourceSpan":{"end":[377,18],"start":[377,8]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":173,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Extended"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"LowerBound"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"LowerBound","moduleName":["Prim"]}},"annotation":{"meta":null,"sourceSpan":{"end":[377,20],"start":[377,8]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[377,20],"start":[377,19]}},"kind":"Var","type":{"annotation":[{"end":[355,87],"name":"tests/purus/passing/prelude/Prelude.purs","start":[355,77]},[]],"contents":[{"annotation":[{"end":[355,85],"name":"tests/purus/passing/prelude/Prelude.purs","start":[355,77]},[]],"contents":[["Prim"],"Extended"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["a",{"annotation":[{"end":[372,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[372,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},31,169],"tag":"Skolem"}],"tag":"TypeApp"},"value":{"identifier":"e","sourcePos":[376,7]}},"kind":"App"},"kind":"Let"},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[372,73],"name":"tests/purus/passing/prelude/Prelude.purs","start":[372,54]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[372,89],"name":"tests/purus/passing/prelude/Prelude.purs","start":[372,77]},[]],"contents":[{"annotation":[{"end":[372,87],"name":"tests/purus/passing/prelude/Prelude.purs","start":[372,77]},[]],"contents":[["Prim"],"LowerBound"],"tag":"TypeConstructor"},{"annotation":[{"end":[372,89],"name":"tests/purus/passing/prelude/Prelude.purs","start":[372,88]},[]],"contents":{"kind":{"annotation":[{"end":[372,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[372,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"kind":"Abs","type":{"annotation":[{"end":[372,89],"name":"tests/purus/passing/prelude/Prelude.purs","start":[372,3]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[372,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[372,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":168,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[372,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[372,25]},[]],"contents":[{"annotation":[{"end":[372,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[372,25]},[]],"contents":[{"annotation":[{"end":[372,47],"name":"tests/purus/passing/prelude/Prelude.purs","start":[372,45]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[372,44],"name":"tests/purus/passing/prelude/Prelude.purs","start":[372,25]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[372,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[372,48]},[]],"contents":{"kind":{"annotation":[{"end":[372,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[372,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[372,89],"name":"tests/purus/passing/prelude/Prelude.purs","start":[372,54]},[]],"contents":[{"annotation":[{"end":[372,89],"name":"tests/purus/passing/prelude/Prelude.purs","start":[372,54]},[]],"contents":[{"annotation":[{"end":[372,76],"name":"tests/purus/passing/prelude/Prelude.purs","start":[372,74]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[372,73],"name":"tests/purus/passing/prelude/Prelude.purs","start":[372,54]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[372,89],"name":"tests/purus/passing/prelude/Prelude.purs","start":[372,77]},[]],"contents":[{"annotation":[{"end":[372,87],"name":"tests/purus/passing/prelude/Prelude.purs","start":[372,77]},[]],"contents":[["Prim"],"LowerBound"],"tag":"TypeConstructor"},{"annotation":[{"end":[372,89],"name":"tests/purus/passing/prelude/Prelude.purs","start":[372,88]},[]],"contents":{"kind":{"annotation":[{"end":[372,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[372,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"identifier":"deserializeLowerBound"},{"annotation":{"meta":null,"sourceSpan":{"end":[385,89],"start":[384,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[390,20],"start":[386,1]}},"argument":"f","body":{"annotation":{"meta":null,"sourceSpan":{"end":[390,20],"start":[386,1]}},"argument":"dat","body":{"annotation":{"meta":null,"sourceSpan":{"end":[390,20],"start":[387,3]}},"binds":[{"annotation":{"meta":null,"sourceSpan":{"end":[387,56],"start":[387,7]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[387,29],"start":[387,14]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"b","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinPair"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"b"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"b"},"tag":"TypeVar"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"sndPair","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[387,56],"start":[387,14]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[387,51],"start":[387,31]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinPair"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"unConstrData","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[387,55],"start":[387,31]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[387,55],"start":[387,52]}},"kind":"Var","type":{"annotation":[{"end":[385,73],"name":"tests/purus/passing/prelude/Prelude.purs","start":[385,54]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"},"value":{"identifier":"dat","sourcePos":[386,1]}},"kind":"App"},"kind":"App"},"identifier":"dat'"},{"annotation":{"meta":null,"sourceSpan":{"end":[388,41],"start":[388,7]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[388,36],"start":[388,18]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"unListData","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[388,41],"start":[388,18]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[388,41],"start":[388,37]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"},"value":{"identifier":"dat'","sourcePos":[387,7]}},"kind":"App"},"identifier":"unlisted"},{"annotation":{"meta":null,"sourceSpan":{"end":[389,60],"start":[389,7]}},"bindType":"NonRec","expression":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[389,30],"start":[389,11]}},"kind":"Var","type":{"annotation":[{"end":[355,87],"name":"tests/purus/passing/prelude/Prelude.purs","start":[355,3]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[355,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[355,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":158,"type":{"annotation":[{"end":[355,87],"name":"tests/purus/passing/prelude/Prelude.purs","start":[355,24]},[]],"contents":[{"annotation":[{"end":[355,87],"name":"tests/purus/passing/prelude/Prelude.purs","start":[355,24]},[]],"contents":[{"annotation":[{"end":[355,53],"name":"tests/purus/passing/prelude/Prelude.purs","start":[355,51]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[355,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[355,25]},[]],"contents":[{"annotation":[{"end":[355,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[355,25]},[]],"contents":[{"annotation":[{"end":[355,47],"name":"tests/purus/passing/prelude/Prelude.purs","start":[355,45]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[355,44],"name":"tests/purus/passing/prelude/Prelude.purs","start":[355,25]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[355,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[355,48]},[]],"contents":{"kind":{"annotation":[{"end":[355,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[355,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[355,87],"name":"tests/purus/passing/prelude/Prelude.purs","start":[355,54]},[]],"contents":[{"annotation":[{"end":[355,87],"name":"tests/purus/passing/prelude/Prelude.purs","start":[355,54]},[]],"contents":[{"annotation":[{"end":[355,76],"name":"tests/purus/passing/prelude/Prelude.purs","start":[355,74]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[355,73],"name":"tests/purus/passing/prelude/Prelude.purs","start":[355,54]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[355,87],"name":"tests/purus/passing/prelude/Prelude.purs","start":[355,77]},[]],"contents":[{"annotation":[{"end":[355,85],"name":"tests/purus/passing/prelude/Prelude.purs","start":[355,77]},[]],"contents":[["Prim"],"Extended"],"tag":"TypeConstructor"},{"annotation":[{"end":[355,87],"name":"tests/purus/passing/prelude/Prelude.purs","start":[355,86]},[]],"contents":{"kind":{"annotation":[{"end":[355,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[355,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"deserializeExtended","moduleName":["Prelude"]}},"annotation":{"meta":null,"sourceSpan":{"end":[389,32],"start":[389,11]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[389,32],"start":[389,31]}},"kind":"Var","type":{"annotation":[{"end":[385,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[385,25]},[]],"contents":[{"annotation":[{"end":[385,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[385,25]},[]],"contents":[{"annotation":[{"end":[385,47],"name":"tests/purus/passing/prelude/Prelude.purs","start":[385,45]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[385,44],"name":"tests/purus/passing/prelude/Prelude.purs","start":[385,25]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[385,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[385,48]},[]],"contents":{"kind":{"annotation":[{"end":[385,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[385,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},"value":{"identifier":"f","sourcePos":[386,1]}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[389,60],"start":[389,11]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[389,50],"start":[389,34]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"headList","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[389,59],"start":[389,34]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[389,59],"start":[389,51]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"unlisted","sourcePos":[388,7]}},"kind":"App"},"kind":"App"},"identifier":"e"}],"expression":{"abstraction":{"annotation":{"meta":{"metaType":"IsNewtype"},"sourceSpan":{"end":[390,18],"start":[390,8]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":179,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Extended"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"UpperBound"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"UpperBound","moduleName":["Prim"]}},"annotation":{"meta":null,"sourceSpan":{"end":[390,20],"start":[390,8]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[390,20],"start":[390,19]}},"kind":"Var","type":{"annotation":[{"end":[355,87],"name":"tests/purus/passing/prelude/Prelude.purs","start":[355,77]},[]],"contents":[{"annotation":[{"end":[355,85],"name":"tests/purus/passing/prelude/Prelude.purs","start":[355,77]},[]],"contents":[["Prim"],"Extended"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["a",{"annotation":[{"end":[385,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[385,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},32,175],"tag":"Skolem"}],"tag":"TypeApp"},"value":{"identifier":"e","sourcePos":[389,7]}},"kind":"App"},"kind":"Let"},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[385,73],"name":"tests/purus/passing/prelude/Prelude.purs","start":[385,54]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[385,89],"name":"tests/purus/passing/prelude/Prelude.purs","start":[385,77]},[]],"contents":[{"annotation":[{"end":[385,87],"name":"tests/purus/passing/prelude/Prelude.purs","start":[385,77]},[]],"contents":[["Prim"],"UpperBound"],"tag":"TypeConstructor"},{"annotation":[{"end":[385,89],"name":"tests/purus/passing/prelude/Prelude.purs","start":[385,88]},[]],"contents":{"kind":{"annotation":[{"end":[385,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[385,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"kind":"Abs","type":{"annotation":[{"end":[385,89],"name":"tests/purus/passing/prelude/Prelude.purs","start":[385,3]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[385,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[385,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":174,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[385,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[385,25]},[]],"contents":[{"annotation":[{"end":[385,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[385,25]},[]],"contents":[{"annotation":[{"end":[385,47],"name":"tests/purus/passing/prelude/Prelude.purs","start":[385,45]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[385,44],"name":"tests/purus/passing/prelude/Prelude.purs","start":[385,25]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[385,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[385,48]},[]],"contents":{"kind":{"annotation":[{"end":[385,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[385,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[385,89],"name":"tests/purus/passing/prelude/Prelude.purs","start":[385,54]},[]],"contents":[{"annotation":[{"end":[385,89],"name":"tests/purus/passing/prelude/Prelude.purs","start":[385,54]},[]],"contents":[{"annotation":[{"end":[385,76],"name":"tests/purus/passing/prelude/Prelude.purs","start":[385,74]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[385,73],"name":"tests/purus/passing/prelude/Prelude.purs","start":[385,54]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[385,89],"name":"tests/purus/passing/prelude/Prelude.purs","start":[385,77]},[]],"contents":[{"annotation":[{"end":[385,87],"name":"tests/purus/passing/prelude/Prelude.purs","start":[385,77]},[]],"contents":[["Prim"],"UpperBound"],"tag":"TypeConstructor"},{"annotation":[{"end":[385,89],"name":"tests/purus/passing/prelude/Prelude.purs","start":[385,88]},[]],"contents":{"kind":{"annotation":[{"end":[385,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[385,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"identifier":"deserializeUpperBound"},{"annotation":{"meta":null,"sourceSpan":{"end":[338,87],"start":[337,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[345,37],"start":[339,1]}},"argument":"f","body":{"annotation":{"meta":null,"sourceSpan":{"end":[345,37],"start":[339,1]}},"argument":"dat","body":{"annotation":{"meta":null,"sourceSpan":{"end":[345,37],"start":[340,3]}},"binds":[{"annotation":{"meta":null,"sourceSpan":{"end":[340,56],"start":[340,7]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[340,29],"start":[340,14]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"b","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinPair"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"b"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"b"},"tag":"TypeVar"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"sndPair","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[340,56],"start":[340,14]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[340,51],"start":[340,31]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinPair"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"unConstrData","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[340,55],"start":[340,31]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[340,55],"start":[340,52]}},"kind":"Var","type":{"annotation":[{"end":[338,73],"name":"tests/purus/passing/prelude/Prelude.purs","start":[338,54]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"},"value":{"identifier":"dat","sourcePos":[339,1]}},"kind":"App"},"kind":"App"},"identifier":"dat'"},{"annotation":{"meta":null,"sourceSpan":{"end":[341,41],"start":[341,7]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[341,36],"start":[341,18]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"unListData","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[341,41],"start":[341,18]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[341,41],"start":[341,37]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"},"value":{"identifier":"dat'","sourcePos":[340,7]}},"kind":"App"},"identifier":"unlisted"},{"annotation":{"meta":null,"sourceSpan":{"end":[342,65],"start":[342,7]}},"bindType":"NonRec","expression":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[342,35],"start":[342,14]}},"kind":"Var","type":{"annotation":[{"end":[372,89],"name":"tests/purus/passing/prelude/Prelude.purs","start":[372,3]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[372,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[372,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":168,"type":{"annotation":[{"end":[372,89],"name":"tests/purus/passing/prelude/Prelude.purs","start":[372,24]},[]],"contents":[{"annotation":[{"end":[372,89],"name":"tests/purus/passing/prelude/Prelude.purs","start":[372,24]},[]],"contents":[{"annotation":[{"end":[372,53],"name":"tests/purus/passing/prelude/Prelude.purs","start":[372,51]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[372,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[372,25]},[]],"contents":[{"annotation":[{"end":[372,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[372,25]},[]],"contents":[{"annotation":[{"end":[372,47],"name":"tests/purus/passing/prelude/Prelude.purs","start":[372,45]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[372,44],"name":"tests/purus/passing/prelude/Prelude.purs","start":[372,25]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[372,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[372,48]},[]],"contents":{"kind":{"annotation":[{"end":[372,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[372,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[372,89],"name":"tests/purus/passing/prelude/Prelude.purs","start":[372,54]},[]],"contents":[{"annotation":[{"end":[372,89],"name":"tests/purus/passing/prelude/Prelude.purs","start":[372,54]},[]],"contents":[{"annotation":[{"end":[372,76],"name":"tests/purus/passing/prelude/Prelude.purs","start":[372,74]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[372,73],"name":"tests/purus/passing/prelude/Prelude.purs","start":[372,54]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[372,89],"name":"tests/purus/passing/prelude/Prelude.purs","start":[372,77]},[]],"contents":[{"annotation":[{"end":[372,87],"name":"tests/purus/passing/prelude/Prelude.purs","start":[372,77]},[]],"contents":[["Prim"],"LowerBound"],"tag":"TypeConstructor"},{"annotation":[{"end":[372,89],"name":"tests/purus/passing/prelude/Prelude.purs","start":[372,88]},[]],"contents":{"kind":{"annotation":[{"end":[372,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[372,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"deserializeLowerBound","moduleName":["Prelude"]}},"annotation":{"meta":null,"sourceSpan":{"end":[342,37],"start":[342,14]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[342,37],"start":[342,36]}},"kind":"Var","type":{"annotation":[{"end":[338,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[338,25]},[]],"contents":[{"annotation":[{"end":[338,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[338,25]},[]],"contents":[{"annotation":[{"end":[338,47],"name":"tests/purus/passing/prelude/Prelude.purs","start":[338,45]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[338,44],"name":"tests/purus/passing/prelude/Prelude.purs","start":[338,25]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[338,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[338,48]},[]],"contents":{"kind":{"annotation":[{"end":[338,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[338,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},"value":{"identifier":"f","sourcePos":[339,1]}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[342,65],"start":[342,14]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[342,55],"start":[342,39]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"headList","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[342,64],"start":[342,39]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[342,64],"start":[342,56]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"unlisted","sourcePos":[341,7]}},"kind":"App"},"kind":"App"},"identifier":"from"},{"annotation":{"meta":null,"sourceSpan":{"end":[343,44],"start":[343,7]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[343,35],"start":[343,19]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"tailList","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[343,44],"start":[343,19]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[343,44],"start":[343,36]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"unlisted","sourcePos":[341,7]}},"kind":"App"},"identifier":"unlisted'"},{"annotation":{"meta":null,"sourceSpan":{"end":[344,64],"start":[344,7]}},"bindType":"NonRec","expression":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[344,33],"start":[344,12]}},"kind":"Var","type":{"annotation":[{"end":[385,89],"name":"tests/purus/passing/prelude/Prelude.purs","start":[385,3]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[385,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[385,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":174,"type":{"annotation":[{"end":[385,89],"name":"tests/purus/passing/prelude/Prelude.purs","start":[385,24]},[]],"contents":[{"annotation":[{"end":[385,89],"name":"tests/purus/passing/prelude/Prelude.purs","start":[385,24]},[]],"contents":[{"annotation":[{"end":[385,53],"name":"tests/purus/passing/prelude/Prelude.purs","start":[385,51]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[385,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[385,25]},[]],"contents":[{"annotation":[{"end":[385,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[385,25]},[]],"contents":[{"annotation":[{"end":[385,47],"name":"tests/purus/passing/prelude/Prelude.purs","start":[385,45]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[385,44],"name":"tests/purus/passing/prelude/Prelude.purs","start":[385,25]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[385,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[385,48]},[]],"contents":{"kind":{"annotation":[{"end":[385,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[385,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[385,89],"name":"tests/purus/passing/prelude/Prelude.purs","start":[385,54]},[]],"contents":[{"annotation":[{"end":[385,89],"name":"tests/purus/passing/prelude/Prelude.purs","start":[385,54]},[]],"contents":[{"annotation":[{"end":[385,76],"name":"tests/purus/passing/prelude/Prelude.purs","start":[385,74]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[385,73],"name":"tests/purus/passing/prelude/Prelude.purs","start":[385,54]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[385,89],"name":"tests/purus/passing/prelude/Prelude.purs","start":[385,77]},[]],"contents":[{"annotation":[{"end":[385,87],"name":"tests/purus/passing/prelude/Prelude.purs","start":[385,77]},[]],"contents":[["Prim"],"UpperBound"],"tag":"TypeConstructor"},{"annotation":[{"end":[385,89],"name":"tests/purus/passing/prelude/Prelude.purs","start":[385,88]},[]],"contents":{"kind":{"annotation":[{"end":[385,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[385,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"deserializeUpperBound","moduleName":["Prelude"]}},"annotation":{"meta":null,"sourceSpan":{"end":[344,35],"start":[344,12]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[344,35],"start":[344,34]}},"kind":"Var","type":{"annotation":[{"end":[338,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[338,25]},[]],"contents":[{"annotation":[{"end":[338,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[338,25]},[]],"contents":[{"annotation":[{"end":[338,47],"name":"tests/purus/passing/prelude/Prelude.purs","start":[338,45]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[338,44],"name":"tests/purus/passing/prelude/Prelude.purs","start":[338,25]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[338,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[338,48]},[]],"contents":{"kind":{"annotation":[{"end":[338,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[338,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},"value":{"identifier":"f","sourcePos":[339,1]}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[344,64],"start":[344,12]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[344,53],"start":[344,37]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"headList","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[344,63],"start":[344,37]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[344,63],"start":[344,54]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"unlisted'","sourcePos":[343,7]}},"kind":"App"},"kind":"App"},"identifier":"to"}],"expression":{"abstraction":{"annotation":{"meta":{"metaType":"IsNewtype"},"sourceSpan":{"end":[345,16],"start":[345,8]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":187,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["from",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"LowerBound"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["to",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"UpperBound"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"tag":"REmpty"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Interval"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"Interval","moduleName":["Prim"]}},"annotation":{"meta":null,"sourceSpan":{"end":[345,37],"start":[345,8]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[345,37],"start":[345,17]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["from",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"LowerBound"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["a",{"annotation":[{"end":[338,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[338,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},33,181],"tag":"Skolem"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["to",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"UpperBound"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["a",{"annotation":[{"end":[338,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[338,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},33,181],"tag":"Skolem"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"tag":"REmpty"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"TypeApp"},"value":{"literalType":"ObjectLiteral","value":[["to",{"annotation":{"meta":null,"sourceSpan":{"end":[345,36],"start":[345,34]}},"kind":"Var","type":{"annotation":[{"end":[385,89],"name":"tests/purus/passing/prelude/Prelude.purs","start":[385,77]},[]],"contents":[{"annotation":[{"end":[385,87],"name":"tests/purus/passing/prelude/Prelude.purs","start":[385,77]},[]],"contents":[["Prim"],"UpperBound"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["a",{"annotation":[{"end":[338,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[338,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},33,181],"tag":"Skolem"}],"tag":"TypeApp"},"value":{"identifier":"to","sourcePos":[344,7]}}],["from",{"annotation":{"meta":null,"sourceSpan":{"end":[345,28],"start":[345,24]}},"kind":"Var","type":{"annotation":[{"end":[372,89],"name":"tests/purus/passing/prelude/Prelude.purs","start":[372,77]},[]],"contents":[{"annotation":[{"end":[372,87],"name":"tests/purus/passing/prelude/Prelude.purs","start":[372,77]},[]],"contents":[["Prim"],"LowerBound"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["a",{"annotation":[{"end":[338,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[338,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},33,181],"tag":"Skolem"}],"tag":"TypeApp"},"value":{"identifier":"from","sourcePos":[342,7]}}]]}},"kind":"App"},"kind":"Let"},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[338,73],"name":"tests/purus/passing/prelude/Prelude.purs","start":[338,54]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[338,87],"name":"tests/purus/passing/prelude/Prelude.purs","start":[338,77]},[]],"contents":[{"annotation":[{"end":[338,85],"name":"tests/purus/passing/prelude/Prelude.purs","start":[338,77]},[]],"contents":[["Prim"],"Interval"],"tag":"TypeConstructor"},{"annotation":[{"end":[338,87],"name":"tests/purus/passing/prelude/Prelude.purs","start":[338,86]},[]],"contents":{"kind":{"annotation":[{"end":[338,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[338,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"kind":"Abs","type":{"annotation":[{"end":[338,87],"name":"tests/purus/passing/prelude/Prelude.purs","start":[338,3]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[338,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[338,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":180,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[338,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[338,25]},[]],"contents":[{"annotation":[{"end":[338,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[338,25]},[]],"contents":[{"annotation":[{"end":[338,47],"name":"tests/purus/passing/prelude/Prelude.purs","start":[338,45]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[338,44],"name":"tests/purus/passing/prelude/Prelude.purs","start":[338,25]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[338,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[338,48]},[]],"contents":{"kind":{"annotation":[{"end":[338,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[338,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[338,87],"name":"tests/purus/passing/prelude/Prelude.purs","start":[338,54]},[]],"contents":[{"annotation":[{"end":[338,87],"name":"tests/purus/passing/prelude/Prelude.purs","start":[338,54]},[]],"contents":[{"annotation":[{"end":[338,76],"name":"tests/purus/passing/prelude/Prelude.purs","start":[338,74]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[338,73],"name":"tests/purus/passing/prelude/Prelude.purs","start":[338,54]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[338,87],"name":"tests/purus/passing/prelude/Prelude.purs","start":[338,77]},[]],"contents":[{"annotation":[{"end":[338,85],"name":"tests/purus/passing/prelude/Prelude.purs","start":[338,77]},[]],"contents":[["Prim"],"Interval"],"tag":"TypeConstructor"},{"annotation":[{"end":[338,87],"name":"tests/purus/passing/prelude/Prelude.purs","start":[338,86]},[]],"contents":{"kind":{"annotation":[{"end":[338,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[338,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"identifier":"deserializeInterval"},{"annotation":{"meta":null,"sourceSpan":{"end":[449,49],"start":[449,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":{"metaType":"IsNewtype"},"sourceSpan":{"end":[450,25],"start":[450,20]}},"kind":"Var","type":{"annotation":[{"end":[449,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[449,21]},[]],"contents":[{"annotation":[{"end":[449,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[449,21]},[]],"contents":[{"annotation":[{"end":[449,43],"name":"tests/purus/passing/prelude/Prelude.purs","start":[449,41]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[449,40],"name":"tests/purus/passing/prelude/Prelude.purs","start":[449,21]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[449,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[449,44]},[]],"contents":[["Prim"],"Datum"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"Datum","moduleName":["Prim"]}},"identifier":"deserializeDatum"},{"annotation":{"meta":null,"sourceSpan":{"end":[467,74],"start":[467,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[468,40],"start":[468,25]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinByteString"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"unBData","moduleName":["Builtin"]}},"identifier":"deserializeByteString"},{"annotation":{"meta":null,"sourceSpan":{"end":[150,67],"start":[150,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[151,75],"start":[151,1]}},"argument":"dat","body":{"abstraction":{"annotation":{"meta":{"metaType":"IsNewtype"},"sourceSpan":{"end":[151,47],"start":[151,33]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinByteString"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"CurrencySymbol"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"CurrencySymbol","moduleName":["Prim"]}},"annotation":{"meta":null,"sourceSpan":{"end":[151,75],"start":[151,33]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[151,70],"start":[151,49]}},"kind":"Var","type":{"annotation":[{"end":[467,74],"name":"tests/purus/passing/prelude/Prelude.purs","start":[467,26]},[]],"contents":[{"annotation":[{"end":[467,74],"name":"tests/purus/passing/prelude/Prelude.purs","start":[467,26]},[]],"contents":[{"annotation":[{"end":[467,48],"name":"tests/purus/passing/prelude/Prelude.purs","start":[467,46]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[467,45],"name":"tests/purus/passing/prelude/Prelude.purs","start":[467,26]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[467,74],"name":"tests/purus/passing/prelude/Prelude.purs","start":[467,49]},[]],"contents":[["Builtin"],"BuiltinByteString"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"deserializeByteString","moduleName":["Prelude"]}},"annotation":{"meta":null,"sourceSpan":{"end":[151,74],"start":[151,49]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[151,74],"start":[151,71]}},"kind":"Var","type":{"annotation":[{"end":[150,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[150,30]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"},"value":{"identifier":"dat","sourcePos":[151,1]}},"kind":"App"},"kind":"App"},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[150,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[150,30]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[150,67],"name":"tests/purus/passing/prelude/Prelude.purs","start":[150,53]},[]],"contents":[["Prim"],"CurrencySymbol"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"identifier":"deserializeCurrencySymbol"},{"annotation":{"meta":null,"sourceSpan":{"end":[455,57],"start":[455,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[456,65],"start":[456,1]}},"argument":"dat","body":{"abstraction":{"annotation":{"meta":{"metaType":"IsNewtype"},"sourceSpan":{"end":[456,37],"start":[456,28]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinByteString"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"DatumHash"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"DatumHash","moduleName":["Prim"]}},"annotation":{"meta":null,"sourceSpan":{"end":[456,65],"start":[456,28]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[456,60],"start":[456,39]}},"kind":"Var","type":{"annotation":[{"end":[467,74],"name":"tests/purus/passing/prelude/Prelude.purs","start":[467,26]},[]],"contents":[{"annotation":[{"end":[467,74],"name":"tests/purus/passing/prelude/Prelude.purs","start":[467,26]},[]],"contents":[{"annotation":[{"end":[467,48],"name":"tests/purus/passing/prelude/Prelude.purs","start":[467,46]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[467,45],"name":"tests/purus/passing/prelude/Prelude.purs","start":[467,26]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[467,74],"name":"tests/purus/passing/prelude/Prelude.purs","start":[467,49]},[]],"contents":[["Builtin"],"BuiltinByteString"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"deserializeByteString","moduleName":["Prelude"]}},"annotation":{"meta":null,"sourceSpan":{"end":[456,64],"start":[456,39]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[456,64],"start":[456,61]}},"kind":"Var","type":{"annotation":[{"end":[455,44],"name":"tests/purus/passing/prelude/Prelude.purs","start":[455,25]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"},"value":{"identifier":"dat","sourcePos":[456,1]}},"kind":"App"},"kind":"App"},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[455,44],"name":"tests/purus/passing/prelude/Prelude.purs","start":[455,25]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[455,57],"name":"tests/purus/passing/prelude/Prelude.purs","start":[455,48]},[]],"contents":[["Prim"],"DatumHash"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"identifier":"deserializeDatumHash"},{"annotation":{"meta":null,"sourceSpan":{"end":[318,61],"start":[318,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[328,55],"start":[319,1]}},"argument":"dat","body":{"annotation":{"meta":null,"sourceSpan":{"end":[328,55],"start":[320,3]}},"binds":[{"annotation":{"meta":null,"sourceSpan":{"end":[320,35],"start":[320,7]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[320,31],"start":[320,11]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinPair"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"unConstrData","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[320,35],"start":[320,11]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[320,35],"start":[320,32]}},"kind":"Var","type":{"annotation":[{"end":[318,46],"name":"tests/purus/passing/prelude/Prelude.purs","start":[318,27]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"},"value":{"identifier":"dat","sourcePos":[319,1]}},"kind":"App"},"identifier":"p"},{"annotation":{"meta":null,"sourceSpan":{"end":[321,30],"start":[321,7]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[321,28],"start":[321,13]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"b","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinPair"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"b"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"fstPair","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[321,30],"start":[321,13]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[321,30],"start":[321,29]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinPair"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"p","sourcePos":[320,7]}},"kind":"App"},"identifier":"tag"}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[328,55],"start":[322,8]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"binderType":"ConstructorBinder","binders":[],"constructorName":{"identifier":"True","moduleName":["Prim"]},"typeName":{"identifier":"Boolean","moduleName":["Prim"]}}],"expression":{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[323,26],"start":[323,13]}},"kind":"Var","type":{"annotation":[{"end":[318,61],"name":"tests/purus/passing/prelude/Prelude.purs","start":[318,50]},[]],"contents":[["Prim"],"OutputDatum"],"tag":"TypeConstructor"},"value":{"identifier":"NoOutputDatum","moduleName":["Prim"]}},"isGuarded":false},{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[328,55],"start":[322,8]}},"binderType":"NullBinder"}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[328,55],"start":[324,13]}},"binds":[{"annotation":{"meta":null,"sourceSpan":{"end":[324,66],"start":[324,17]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[324,46],"start":[324,28]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"unListData","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[324,66],"start":[324,28]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[324,63],"start":[324,48]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"b","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinPair"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"b"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"b"},"tag":"TypeVar"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"sndPair","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[324,65],"start":[324,48]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[324,65],"start":[324,64]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinPair"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"p","sourcePos":[320,7]}},"kind":"App"},"kind":"App"},"identifier":"unlisted"},{"annotation":{"meta":null,"sourceSpan":{"end":[325,46],"start":[325,17]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[325,37],"start":[325,21]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"headList","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[325,46],"start":[325,21]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[325,46],"start":[325,38]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"unlisted","sourcePos":[324,17]}},"kind":"App"},"identifier":"x"}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[328,55],"start":[326,18]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"binderType":"ConstructorBinder","binders":[],"constructorName":{"identifier":"True","moduleName":["Prim"]},"typeName":{"identifier":"Boolean","moduleName":["Prim"]}}],"expression":{"abstraction":{"annotation":{"meta":{"constructorType":"SumType","identifiers":["$__unused"],"metaType":"IsConstructor"},"sourceSpan":{"end":[327,38],"start":[327,23]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"DatumHash"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"OutputDatum"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"OutputDatumHash","moduleName":["Prim"]}},"annotation":{"meta":null,"sourceSpan":{"end":[327,63],"start":[327,23]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[327,60],"start":[327,40]}},"kind":"Var","type":{"annotation":[{"end":[455,57],"name":"tests/purus/passing/prelude/Prelude.purs","start":[455,25]},[]],"contents":[{"annotation":[{"end":[455,57],"name":"tests/purus/passing/prelude/Prelude.purs","start":[455,25]},[]],"contents":[{"annotation":[{"end":[455,47],"name":"tests/purus/passing/prelude/Prelude.purs","start":[455,45]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[455,44],"name":"tests/purus/passing/prelude/Prelude.purs","start":[455,25]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[455,57],"name":"tests/purus/passing/prelude/Prelude.purs","start":[455,48]},[]],"contents":[["Prim"],"DatumHash"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"deserializeDatumHash","moduleName":["Prelude"]}},"annotation":{"meta":null,"sourceSpan":{"end":[327,62],"start":[327,40]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[327,62],"start":[327,61]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"},"value":{"identifier":"x","sourcePos":[325,17]}},"kind":"App"},"kind":"App"},"isGuarded":false},{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[328,55],"start":[326,18]}},"binderType":"NullBinder"}],"expression":{"abstraction":{"annotation":{"meta":{"constructorType":"SumType","identifiers":["$__unused"],"metaType":"IsConstructor"},"sourceSpan":{"end":[328,34],"start":[328,23]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Datum"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"OutputDatum"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"OutputDatum","moduleName":["Prim"]}},"annotation":{"meta":null,"sourceSpan":{"end":[328,55],"start":[328,23]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[328,52],"start":[328,36]}},"kind":"Var","type":{"annotation":[{"end":[449,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[449,21]},[]],"contents":[{"annotation":[{"end":[449,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[449,21]},[]],"contents":[{"annotation":[{"end":[449,43],"name":"tests/purus/passing/prelude/Prelude.purs","start":[449,41]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[449,40],"name":"tests/purus/passing/prelude/Prelude.purs","start":[449,21]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[449,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[449,44]},[]],"contents":[["Prim"],"Datum"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"deserializeDatum","moduleName":["Prelude"]}},"annotation":{"meta":null,"sourceSpan":{"end":[328,54],"start":[328,36]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[328,54],"start":[328,53]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"},"value":{"identifier":"x","sourcePos":[325,17]}},"kind":"App"},"kind":"App"},"isGuarded":false}],"caseExpressions":[{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[326,42],"start":[326,21]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"equalsInteger","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[326,46],"start":[326,21]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[326,46],"start":[326,43]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"identifier":"tag","sourcePos":[321,7]}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[326,48],"start":[326,21]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[326,48],"start":[326,47]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"literalType":"IntLiteral","value":1}},"kind":"App"}],"kind":"Case","type":{"annotation":[{"end":[318,61],"name":"tests/purus/passing/prelude/Prelude.purs","start":[318,50]},[]],"contents":[["Prim"],"OutputDatum"],"tag":"TypeConstructor"}},"kind":"Let"},"isGuarded":false}],"caseExpressions":[{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[322,32],"start":[322,11]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"equalsInteger","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[322,36],"start":[322,11]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[322,36],"start":[322,33]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"identifier":"tag","sourcePos":[321,7]}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[322,38],"start":[322,11]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[322,38],"start":[322,37]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"literalType":"IntLiteral","value":0}},"kind":"App"}],"kind":"Case","type":{"annotation":[{"end":[318,61],"name":"tests/purus/passing/prelude/Prelude.purs","start":[318,50]},[]],"contents":[["Prim"],"OutputDatum"],"tag":"TypeConstructor"}},"kind":"Let"},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[318,46],"name":"tests/purus/passing/prelude/Prelude.purs","start":[318,27]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[318,61],"name":"tests/purus/passing/prelude/Prelude.purs","start":[318,50]},[]],"contents":[["Prim"],"OutputDatum"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"identifier":"deserializeOutputDatum"},{"annotation":{"meta":null,"sourceSpan":{"end":[190,59],"start":[190,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[192,41],"start":[191,1]}},"argument":"dat","body":{"abstraction":{"annotation":{"meta":{"metaType":"IsNewtype"},"sourceSpan":{"end":[192,13],"start":[192,3]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinByteString"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"PubKeyHash"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"PubKeyHash","moduleName":["Prim"]}},"annotation":{"meta":null,"sourceSpan":{"end":[192,41],"start":[192,3]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[192,36],"start":[192,15]}},"kind":"Var","type":{"annotation":[{"end":[467,74],"name":"tests/purus/passing/prelude/Prelude.purs","start":[467,26]},[]],"contents":[{"annotation":[{"end":[467,74],"name":"tests/purus/passing/prelude/Prelude.purs","start":[467,26]},[]],"contents":[{"annotation":[{"end":[467,48],"name":"tests/purus/passing/prelude/Prelude.purs","start":[467,46]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[467,45],"name":"tests/purus/passing/prelude/Prelude.purs","start":[467,26]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[467,74],"name":"tests/purus/passing/prelude/Prelude.purs","start":[467,49]},[]],"contents":[["Builtin"],"BuiltinByteString"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"deserializeByteString","moduleName":["Prelude"]}},"annotation":{"meta":null,"sourceSpan":{"end":[192,40],"start":[192,15]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[192,40],"start":[192,37]}},"kind":"Var","type":{"annotation":[{"end":[190,45],"name":"tests/purus/passing/prelude/Prelude.purs","start":[190,26]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"},"value":{"identifier":"dat","sourcePos":[191,1]}},"kind":"App"},"kind":"App"},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[190,45],"name":"tests/purus/passing/prelude/Prelude.purs","start":[190,26]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[190,59],"name":"tests/purus/passing/prelude/Prelude.purs","start":[190,49]},[]],"contents":[["Prim"],"PubKeyHash"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"identifier":"deserializePubKeyHash"},{"annotation":{"meta":null,"sourceSpan":{"end":[443,63],"start":[443,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[444,71],"start":[444,1]}},"argument":"dat","body":{"abstraction":{"annotation":{"meta":{"metaType":"IsNewtype"},"sourceSpan":{"end":[444,43],"start":[444,31]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinByteString"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"RedeemerHash"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"RedeemerHash","moduleName":["Prim"]}},"annotation":{"meta":null,"sourceSpan":{"end":[444,71],"start":[444,31]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[444,66],"start":[444,45]}},"kind":"Var","type":{"annotation":[{"end":[467,74],"name":"tests/purus/passing/prelude/Prelude.purs","start":[467,26]},[]],"contents":[{"annotation":[{"end":[467,74],"name":"tests/purus/passing/prelude/Prelude.purs","start":[467,26]},[]],"contents":[{"annotation":[{"end":[467,48],"name":"tests/purus/passing/prelude/Prelude.purs","start":[467,46]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[467,45],"name":"tests/purus/passing/prelude/Prelude.purs","start":[467,26]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[467,74],"name":"tests/purus/passing/prelude/Prelude.purs","start":[467,49]},[]],"contents":[["Builtin"],"BuiltinByteString"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"deserializeByteString","moduleName":["Prelude"]}},"annotation":{"meta":null,"sourceSpan":{"end":[444,70],"start":[444,45]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[444,70],"start":[444,67]}},"kind":"Var","type":{"annotation":[{"end":[443,47],"name":"tests/purus/passing/prelude/Prelude.purs","start":[443,28]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"},"value":{"identifier":"dat","sourcePos":[444,1]}},"kind":"App"},"kind":"App"},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[443,47],"name":"tests/purus/passing/prelude/Prelude.purs","start":[443,28]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[443,63],"name":"tests/purus/passing/prelude/Prelude.purs","start":[443,51]},[]],"contents":[["Prim"],"RedeemerHash"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"identifier":"deserializeRedeemerHash"},{"annotation":{"meta":null,"sourceSpan":{"end":[431,59],"start":[431,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[432,67],"start":[432,1]}},"argument":"dat","body":{"abstraction":{"annotation":{"meta":{"metaType":"IsNewtype"},"sourceSpan":{"end":[432,39],"start":[432,29]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinByteString"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"ScriptHash"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"ScriptHash","moduleName":["Prim"]}},"annotation":{"meta":null,"sourceSpan":{"end":[432,67],"start":[432,29]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[432,62],"start":[432,41]}},"kind":"Var","type":{"annotation":[{"end":[467,74],"name":"tests/purus/passing/prelude/Prelude.purs","start":[467,26]},[]],"contents":[{"annotation":[{"end":[467,74],"name":"tests/purus/passing/prelude/Prelude.purs","start":[467,26]},[]],"contents":[{"annotation":[{"end":[467,48],"name":"tests/purus/passing/prelude/Prelude.purs","start":[467,46]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[467,45],"name":"tests/purus/passing/prelude/Prelude.purs","start":[467,26]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[467,74],"name":"tests/purus/passing/prelude/Prelude.purs","start":[467,49]},[]],"contents":[["Builtin"],"BuiltinByteString"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"deserializeByteString","moduleName":["Prelude"]}},"annotation":{"meta":null,"sourceSpan":{"end":[432,66],"start":[432,41]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[432,66],"start":[432,63]}},"kind":"Var","type":{"annotation":[{"end":[431,45],"name":"tests/purus/passing/prelude/Prelude.purs","start":[431,26]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"},"value":{"identifier":"dat","sourcePos":[432,1]}},"kind":"App"},"kind":"App"},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[431,45],"name":"tests/purus/passing/prelude/Prelude.purs","start":[431,26]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[431,59],"name":"tests/purus/passing/prelude/Prelude.purs","start":[431,49]},[]],"contents":[["Prim"],"ScriptHash"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"identifier":"deserializeScriptHash"},{"annotation":{"meta":null,"sourceSpan":{"end":[129,59],"start":[129,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[136,81],"start":[130,1]}},"argument":"dat","body":{"annotation":{"meta":null,"sourceSpan":{"end":[136,81],"start":[131,3]}},"binds":[{"annotation":{"meta":null,"sourceSpan":{"end":[131,35],"start":[131,7]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[131,31],"start":[131,11]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinPair"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"unConstrData","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[131,35],"start":[131,11]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[131,35],"start":[131,32]}},"kind":"Var","type":{"annotation":[{"end":[129,45],"name":"tests/purus/passing/prelude/Prelude.purs","start":[129,26]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"},"value":{"identifier":"dat","sourcePos":[130,1]}},"kind":"App"},"identifier":"p"},{"annotation":{"meta":null,"sourceSpan":{"end":[132,30],"start":[132,7]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[132,28],"start":[132,13]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"b","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinPair"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"b"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"fstPair","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[132,30],"start":[132,13]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[132,30],"start":[132,29]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinPair"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"p","sourcePos":[131,7]}},"kind":"App"},"identifier":"tag"},{"annotation":{"meta":null,"sourceSpan":{"end":[133,56],"start":[133,7]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[133,36],"start":[133,18]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"unListData","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[133,56],"start":[133,18]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[133,53],"start":[133,38]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"b","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinPair"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"b"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"b"},"tag":"TypeVar"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"sndPair","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[133,55],"start":[133,38]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[133,55],"start":[133,54]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinPair"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"p","sourcePos":[131,7]}},"kind":"App"},"kind":"App"},"identifier":"unlisted"}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[136,81],"start":[134,8]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"binderType":"ConstructorBinder","binders":[],"constructorName":{"identifier":"True","moduleName":["Prim"]},"typeName":{"identifier":"Boolean","moduleName":["Prim"]}}],"expression":{"abstraction":{"annotation":{"meta":{"constructorType":"SumType","identifiers":["$__unused"],"metaType":"IsConstructor"},"sourceSpan":{"end":[135,29],"start":[135,13]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"PubKeyHash"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Credential"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"PubKeyCredential","moduleName":["Prim"]}},"annotation":{"meta":null,"sourceSpan":{"end":[135,81],"start":[135,13]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[135,52],"start":[135,31]}},"kind":"Var","type":{"annotation":[{"end":[190,59],"name":"tests/purus/passing/prelude/Prelude.purs","start":[190,26]},[]],"contents":[{"annotation":[{"end":[190,59],"name":"tests/purus/passing/prelude/Prelude.purs","start":[190,26]},[]],"contents":[{"annotation":[{"end":[190,48],"name":"tests/purus/passing/prelude/Prelude.purs","start":[190,46]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[190,45],"name":"tests/purus/passing/prelude/Prelude.purs","start":[190,26]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[190,59],"name":"tests/purus/passing/prelude/Prelude.purs","start":[190,49]},[]],"contents":[["Prim"],"PubKeyHash"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"deserializePubKeyHash","moduleName":["Prelude"]}},"annotation":{"meta":null,"sourceSpan":{"end":[135,80],"start":[135,31]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[135,70],"start":[135,54]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"headList","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[135,79],"start":[135,54]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[135,79],"start":[135,71]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"unlisted","sourcePos":[133,7]}},"kind":"App"},"kind":"App"},"kind":"App"},"isGuarded":false},{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[136,81],"start":[134,8]}},"binderType":"NullBinder"}],"expression":{"abstraction":{"annotation":{"meta":{"constructorType":"SumType","identifiers":["$__unused"],"metaType":"IsConstructor"},"sourceSpan":{"end":[136,29],"start":[136,13]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"ScriptHash"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Credential"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"ScriptCredential","moduleName":["Prim"]}},"annotation":{"meta":null,"sourceSpan":{"end":[136,81],"start":[136,13]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[136,52],"start":[136,31]}},"kind":"Var","type":{"annotation":[{"end":[431,59],"name":"tests/purus/passing/prelude/Prelude.purs","start":[431,26]},[]],"contents":[{"annotation":[{"end":[431,59],"name":"tests/purus/passing/prelude/Prelude.purs","start":[431,26]},[]],"contents":[{"annotation":[{"end":[431,48],"name":"tests/purus/passing/prelude/Prelude.purs","start":[431,46]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[431,45],"name":"tests/purus/passing/prelude/Prelude.purs","start":[431,26]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[431,59],"name":"tests/purus/passing/prelude/Prelude.purs","start":[431,49]},[]],"contents":[["Prim"],"ScriptHash"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"deserializeScriptHash","moduleName":["Prelude"]}},"annotation":{"meta":null,"sourceSpan":{"end":[136,80],"start":[136,31]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[136,70],"start":[136,54]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"headList","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[136,79],"start":[136,54]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[136,79],"start":[136,71]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"unlisted","sourcePos":[133,7]}},"kind":"App"},"kind":"App"},"kind":"App"},"isGuarded":false}],"caseExpressions":[{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[134,32],"start":[134,11]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"equalsInteger","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[134,36],"start":[134,11]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[134,36],"start":[134,33]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"identifier":"tag","sourcePos":[132,7]}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[134,38],"start":[134,11]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[134,38],"start":[134,37]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"literalType":"IntLiteral","value":0}},"kind":"App"}],"kind":"Case","type":{"annotation":[{"end":[129,59],"name":"tests/purus/passing/prelude/Prelude.purs","start":[129,49]},[]],"contents":[["Prim"],"Credential"],"tag":"TypeConstructor"}},"kind":"Let"},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[129,45],"name":"tests/purus/passing/prelude/Prelude.purs","start":[129,26]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[129,59],"name":"tests/purus/passing/prelude/Prelude.purs","start":[129,49]},[]],"contents":[["Prim"],"Credential"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"identifier":"deserializeCredential"},{"annotation":{"meta":null,"sourceSpan":{"end":[110,73],"start":[110,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[122,37],"start":[111,1]}},"argument":"dat","body":{"annotation":{"meta":null,"sourceSpan":{"end":[122,37],"start":[112,3]}},"binds":[{"annotation":{"meta":null,"sourceSpan":{"end":[112,35],"start":[112,7]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[112,31],"start":[112,11]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinPair"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"unConstrData","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[112,35],"start":[112,11]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[112,35],"start":[112,32]}},"kind":"Var","type":{"annotation":[{"end":[110,52],"name":"tests/purus/passing/prelude/Prelude.purs","start":[110,33]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"},"value":{"identifier":"dat","sourcePos":[111,1]}},"kind":"App"},"identifier":"p"},{"annotation":{"meta":null,"sourceSpan":{"end":[113,30],"start":[113,7]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[113,28],"start":[113,13]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"b","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinPair"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"b"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"fstPair","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[113,30],"start":[113,13]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[113,30],"start":[113,29]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinPair"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"p","sourcePos":[112,7]}},"kind":"App"},"identifier":"tag"},{"annotation":{"meta":null,"sourceSpan":{"end":[114,56],"start":[114,7]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[114,36],"start":[114,18]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"unListData","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[114,56],"start":[114,18]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[114,53],"start":[114,38]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"b","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinPair"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"b"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"b"},"tag":"TypeVar"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"sndPair","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[114,55],"start":[114,38]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[114,55],"start":[114,54]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinPair"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"p","sourcePos":[112,7]}},"kind":"App"},"kind":"App"},"identifier":"unlisted"}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[122,37],"start":[115,8]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"binderType":"ConstructorBinder","binders":[],"constructorName":{"identifier":"True","moduleName":["Prim"]},"typeName":{"identifier":"Boolean","moduleName":["Prim"]}}],"expression":{"abstraction":{"annotation":{"meta":{"constructorType":"SumType","identifiers":["$__unused"],"metaType":"IsConstructor"},"sourceSpan":{"end":[116,24],"start":[116,13]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Credential"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"StakingCredential"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"StakingHash","moduleName":["Prim"]}},"annotation":{"meta":null,"sourceSpan":{"end":[116,76],"start":[116,13]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[116,47],"start":[116,26]}},"kind":"Var","type":{"annotation":[{"end":[129,59],"name":"tests/purus/passing/prelude/Prelude.purs","start":[129,26]},[]],"contents":[{"annotation":[{"end":[129,59],"name":"tests/purus/passing/prelude/Prelude.purs","start":[129,26]},[]],"contents":[{"annotation":[{"end":[129,48],"name":"tests/purus/passing/prelude/Prelude.purs","start":[129,46]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[129,45],"name":"tests/purus/passing/prelude/Prelude.purs","start":[129,26]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[129,59],"name":"tests/purus/passing/prelude/Prelude.purs","start":[129,49]},[]],"contents":[["Prim"],"Credential"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"deserializeCredential","moduleName":["Prelude"]}},"annotation":{"meta":null,"sourceSpan":{"end":[116,75],"start":[116,26]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[116,65],"start":[116,49]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"headList","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[116,74],"start":[116,49]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[116,74],"start":[116,66]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"unlisted","sourcePos":[114,7]}},"kind":"App"},"kind":"App"},"kind":"App"},"isGuarded":false},{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[122,37],"start":[115,8]}},"binderType":"NullBinder"}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[122,37],"start":[117,13]}},"binds":[{"annotation":{"meta":null,"sourceSpan":{"end":[118,54],"start":[118,17]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[118,45],"start":[118,29]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"tailList","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[118,54],"start":[118,29]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[118,54],"start":[118,46]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"unlisted","sourcePos":[114,7]}},"kind":"App"},"identifier":"unlisted'"},{"annotation":{"meta":null,"sourceSpan":{"end":[120,58],"start":[120,17]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[120,46],"start":[120,30]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"tailList","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[120,58],"start":[120,30]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[120,57],"start":[120,48]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"unlisted'","sourcePos":[118,17]}},"kind":"App"},"identifier":"unlisted''"},{"annotation":{"meta":null,"sourceSpan":{"end":[121,66],"start":[121,17]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[121,36],"start":[121,22]}},"kind":"Var","type":{"annotation":[{"end":[461,45],"name":"tests/purus/passing/prelude/Prelude.purs","start":[461,19]},[]],"contents":[{"annotation":[{"end":[461,45],"name":"tests/purus/passing/prelude/Prelude.purs","start":[461,19]},[]],"contents":[{"annotation":[{"end":[461,41],"name":"tests/purus/passing/prelude/Prelude.purs","start":[461,39]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[461,38],"name":"tests/purus/passing/prelude/Prelude.purs","start":[461,19]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[461,45],"name":"tests/purus/passing/prelude/Prelude.purs","start":[461,42]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"deserializeInt","moduleName":["Prelude"]}},"annotation":{"meta":null,"sourceSpan":{"end":[121,66],"start":[121,22]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[121,54],"start":[121,38]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"headList","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[121,65],"start":[121,38]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[121,65],"start":[121,55]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"unlisted''","sourcePos":[120,17]}},"kind":"App"},"kind":"App"},"identifier":"i3"},{"annotation":{"meta":null,"sourceSpan":{"end":[119,65],"start":[119,17]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[119,36],"start":[119,22]}},"kind":"Var","type":{"annotation":[{"end":[461,45],"name":"tests/purus/passing/prelude/Prelude.purs","start":[461,19]},[]],"contents":[{"annotation":[{"end":[461,45],"name":"tests/purus/passing/prelude/Prelude.purs","start":[461,19]},[]],"contents":[{"annotation":[{"end":[461,41],"name":"tests/purus/passing/prelude/Prelude.purs","start":[461,39]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[461,38],"name":"tests/purus/passing/prelude/Prelude.purs","start":[461,19]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[461,45],"name":"tests/purus/passing/prelude/Prelude.purs","start":[461,42]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"deserializeInt","moduleName":["Prelude"]}},"annotation":{"meta":null,"sourceSpan":{"end":[119,65],"start":[119,22]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[119,54],"start":[119,38]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"headList","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[119,64],"start":[119,38]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[119,64],"start":[119,55]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"unlisted'","sourcePos":[118,17]}},"kind":"App"},"kind":"App"},"identifier":"i2"},{"annotation":{"meta":null,"sourceSpan":{"end":[117,64],"start":[117,17]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[117,36],"start":[117,22]}},"kind":"Var","type":{"annotation":[{"end":[461,45],"name":"tests/purus/passing/prelude/Prelude.purs","start":[461,19]},[]],"contents":[{"annotation":[{"end":[461,45],"name":"tests/purus/passing/prelude/Prelude.purs","start":[461,19]},[]],"contents":[{"annotation":[{"end":[461,41],"name":"tests/purus/passing/prelude/Prelude.purs","start":[461,39]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[461,38],"name":"tests/purus/passing/prelude/Prelude.purs","start":[461,19]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[461,45],"name":"tests/purus/passing/prelude/Prelude.purs","start":[461,42]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"deserializeInt","moduleName":["Prelude"]}},"annotation":{"meta":null,"sourceSpan":{"end":[117,64],"start":[117,22]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[117,54],"start":[117,38]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"headList","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[117,63],"start":[117,38]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[117,63],"start":[117,55]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"unlisted","sourcePos":[114,7]}},"kind":"App"},"kind":"App"},"identifier":"i1"}],"expression":{"abstraction":{"abstraction":{"abstraction":{"annotation":{"meta":{"constructorType":"SumType","identifiers":["$__unused","$__unused","$__unused"],"metaType":"IsConstructor"},"sourceSpan":{"end":[122,28],"start":[122,18]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"StakingCredential"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"StakingPtr","moduleName":["Prim"]}},"annotation":{"meta":null,"sourceSpan":{"end":[122,31],"start":[122,18]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[122,31],"start":[122,29]}},"kind":"Var","type":{"annotation":[{"end":[461,45],"name":"tests/purus/passing/prelude/Prelude.purs","start":[461,42]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"identifier":"i1","sourcePos":[117,17]}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[122,34],"start":[122,18]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[122,34],"start":[122,32]}},"kind":"Var","type":{"annotation":[{"end":[461,45],"name":"tests/purus/passing/prelude/Prelude.purs","start":[461,42]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"identifier":"i2","sourcePos":[119,17]}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[122,37],"start":[122,18]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[122,37],"start":[122,35]}},"kind":"Var","type":{"annotation":[{"end":[461,45],"name":"tests/purus/passing/prelude/Prelude.purs","start":[461,42]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"identifier":"i3","sourcePos":[121,17]}},"kind":"App"},"kind":"Let"},"isGuarded":false}],"caseExpressions":[{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[115,32],"start":[115,11]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"equalsInteger","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[115,36],"start":[115,11]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[115,36],"start":[115,33]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"identifier":"tag","sourcePos":[113,7]}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[115,38],"start":[115,11]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[115,38],"start":[115,37]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"literalType":"IntLiteral","value":0}},"kind":"App"}],"kind":"Case","type":{"annotation":[{"end":[110,73],"name":"tests/purus/passing/prelude/Prelude.purs","start":[110,56]},[]],"contents":[["Prim"],"StakingCredential"],"tag":"TypeConstructor"}},"kind":"Let"},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[110,52],"name":"tests/purus/passing/prelude/Prelude.purs","start":[110,33]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[110,73],"name":"tests/purus/passing/prelude/Prelude.purs","start":[110,56]},[]],"contents":[["Prim"],"StakingCredential"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"identifier":"deserializeStakingCredential"},{"annotation":{"meta":null,"sourceSpan":{"end":[72,49],"start":[72,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[98,46],"start":[73,1]}},"argument":"dat","body":{"annotation":{"meta":null,"sourceSpan":{"end":[98,46],"start":[74,3]}},"binds":[{"annotation":{"meta":null,"sourceSpan":{"end":[74,35],"start":[74,7]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[74,31],"start":[74,11]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinPair"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"unConstrData","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[74,35],"start":[74,11]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[74,35],"start":[74,32]}},"kind":"Var","type":{"annotation":[{"end":[72,40],"name":"tests/purus/passing/prelude/Prelude.purs","start":[72,21]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"},"value":{"identifier":"dat","sourcePos":[73,1]}},"kind":"App"},"identifier":"p"},{"annotation":{"meta":null,"sourceSpan":{"end":[75,30],"start":[75,7]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[75,28],"start":[75,13]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"b","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinPair"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"b"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"fstPair","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[75,30],"start":[75,13]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[75,30],"start":[75,29]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinPair"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"p","sourcePos":[74,7]}},"kind":"App"},"identifier":"tag"},{"annotation":{"meta":null,"sourceSpan":{"end":[76,56],"start":[76,7]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[76,36],"start":[76,18]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"unListData","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[76,56],"start":[76,18]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[76,53],"start":[76,38]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"b","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinPair"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"b"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"b"},"tag":"TypeVar"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"sndPair","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[76,55],"start":[76,38]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[76,55],"start":[76,54]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinPair"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"p","sourcePos":[74,7]}},"kind":"App"},"kind":"App"},"identifier":"unlisted"}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[98,46],"start":[77,8]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"binderType":"ConstructorBinder","binders":[],"constructorName":{"identifier":"True","moduleName":["Prim"]},"typeName":{"identifier":"Boolean","moduleName":["Prim"]}}],"expression":{"abstraction":{"annotation":{"meta":{"constructorType":"SumType","identifiers":["$__unused"],"metaType":"IsConstructor"},"sourceSpan":{"end":[78,29],"start":[78,13]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"StakingCredential"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"DCert"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"DCertDelegRegKey","moduleName":["Prim"]}},"annotation":{"meta":null,"sourceSpan":{"end":[78,88],"start":[78,13]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[78,59],"start":[78,31]}},"kind":"Var","type":{"annotation":[{"end":[110,73],"name":"tests/purus/passing/prelude/Prelude.purs","start":[110,33]},[]],"contents":[{"annotation":[{"end":[110,73],"name":"tests/purus/passing/prelude/Prelude.purs","start":[110,33]},[]],"contents":[{"annotation":[{"end":[110,55],"name":"tests/purus/passing/prelude/Prelude.purs","start":[110,53]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[110,52],"name":"tests/purus/passing/prelude/Prelude.purs","start":[110,33]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[110,73],"name":"tests/purus/passing/prelude/Prelude.purs","start":[110,56]},[]],"contents":[["Prim"],"StakingCredential"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"deserializeStakingCredential","moduleName":["Prelude"]}},"annotation":{"meta":null,"sourceSpan":{"end":[78,87],"start":[78,31]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[78,77],"start":[78,61]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"headList","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[78,86],"start":[78,61]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[78,86],"start":[78,78]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"unlisted","sourcePos":[76,7]}},"kind":"App"},"kind":"App"},"kind":"App"},"isGuarded":false},{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[98,46],"start":[77,8]}},"binderType":"NullBinder"}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[98,46],"start":[79,13]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"binderType":"ConstructorBinder","binders":[],"constructorName":{"identifier":"True","moduleName":["Prim"]},"typeName":{"identifier":"Boolean","moduleName":["Prim"]}}],"expression":{"abstraction":{"annotation":{"meta":{"constructorType":"SumType","identifiers":["$__unused"],"metaType":"IsConstructor"},"sourceSpan":{"end":[80,36],"start":[80,18]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"StakingCredential"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"DCert"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"DCertDelegDeRegKey","moduleName":["Prim"]}},"annotation":{"meta":null,"sourceSpan":{"end":[80,95],"start":[80,18]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[80,66],"start":[80,38]}},"kind":"Var","type":{"annotation":[{"end":[110,73],"name":"tests/purus/passing/prelude/Prelude.purs","start":[110,33]},[]],"contents":[{"annotation":[{"end":[110,73],"name":"tests/purus/passing/prelude/Prelude.purs","start":[110,33]},[]],"contents":[{"annotation":[{"end":[110,55],"name":"tests/purus/passing/prelude/Prelude.purs","start":[110,53]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[110,52],"name":"tests/purus/passing/prelude/Prelude.purs","start":[110,33]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[110,73],"name":"tests/purus/passing/prelude/Prelude.purs","start":[110,56]},[]],"contents":[["Prim"],"StakingCredential"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"deserializeStakingCredential","moduleName":["Prelude"]}},"annotation":{"meta":null,"sourceSpan":{"end":[80,94],"start":[80,38]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[80,84],"start":[80,68]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"headList","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[80,93],"start":[80,68]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[80,93],"start":[80,85]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"unlisted","sourcePos":[76,7]}},"kind":"App"},"kind":"App"},"kind":"App"},"isGuarded":false},{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[98,46],"start":[79,13]}},"binderType":"NullBinder"}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[98,46],"start":[81,18]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"binderType":"ConstructorBinder","binders":[],"constructorName":{"identifier":"True","moduleName":["Prim"]},"typeName":{"identifier":"Boolean","moduleName":["Prim"]}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[85,53],"start":[82,23]}},"binds":[{"annotation":{"meta":null,"sourceSpan":{"end":[83,64],"start":[83,27]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[83,55],"start":[83,39]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"tailList","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[83,64],"start":[83,39]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[83,64],"start":[83,56]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"unlisted","sourcePos":[76,7]}},"kind":"App"},"identifier":"unlisted'"},{"annotation":{"meta":null,"sourceSpan":{"end":[82,88],"start":[82,27]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[82,60],"start":[82,32]}},"kind":"Var","type":{"annotation":[{"end":[110,73],"name":"tests/purus/passing/prelude/Prelude.purs","start":[110,33]},[]],"contents":[{"annotation":[{"end":[110,73],"name":"tests/purus/passing/prelude/Prelude.purs","start":[110,33]},[]],"contents":[{"annotation":[{"end":[110,55],"name":"tests/purus/passing/prelude/Prelude.purs","start":[110,53]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[110,52],"name":"tests/purus/passing/prelude/Prelude.purs","start":[110,33]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[110,73],"name":"tests/purus/passing/prelude/Prelude.purs","start":[110,56]},[]],"contents":[["Prim"],"StakingCredential"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"deserializeStakingCredential","moduleName":["Prelude"]}},"annotation":{"meta":null,"sourceSpan":{"end":[82,88],"start":[82,32]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[82,78],"start":[82,62]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"headList","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[82,87],"start":[82,62]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[82,87],"start":[82,79]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"unlisted","sourcePos":[76,7]}},"kind":"App"},"kind":"App"},"identifier":"sc"},{"annotation":{"meta":null,"sourceSpan":{"end":[84,83],"start":[84,27]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[84,54],"start":[84,33]}},"kind":"Var","type":{"annotation":[{"end":[190,59],"name":"tests/purus/passing/prelude/Prelude.purs","start":[190,26]},[]],"contents":[{"annotation":[{"end":[190,59],"name":"tests/purus/passing/prelude/Prelude.purs","start":[190,26]},[]],"contents":[{"annotation":[{"end":[190,48],"name":"tests/purus/passing/prelude/Prelude.purs","start":[190,46]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[190,45],"name":"tests/purus/passing/prelude/Prelude.purs","start":[190,26]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[190,59],"name":"tests/purus/passing/prelude/Prelude.purs","start":[190,49]},[]],"contents":[["Prim"],"PubKeyHash"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"deserializePubKeyHash","moduleName":["Prelude"]}},"annotation":{"meta":null,"sourceSpan":{"end":[84,83],"start":[84,33]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[84,72],"start":[84,56]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"headList","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[84,82],"start":[84,56]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[84,82],"start":[84,73]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"unlisted'","sourcePos":[83,27]}},"kind":"App"},"kind":"App"},"identifier":"pkh"}],"expression":{"abstraction":{"abstraction":{"annotation":{"meta":{"constructorType":"SumType","identifiers":["$__unused","$__unused"],"metaType":"IsConstructor"},"sourceSpan":{"end":[85,46],"start":[85,28]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"StakingCredential"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"PubKeyHash"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"DCert"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"DCertDelegDelegate","moduleName":["Prim"]}},"annotation":{"meta":null,"sourceSpan":{"end":[85,49],"start":[85,28]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[85,49],"start":[85,47]}},"kind":"Var","type":{"annotation":[{"end":[110,73],"name":"tests/purus/passing/prelude/Prelude.purs","start":[110,56]},[]],"contents":[["Prim"],"StakingCredential"],"tag":"TypeConstructor"},"value":{"identifier":"sc","sourcePos":[82,27]}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[85,53],"start":[85,28]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[85,53],"start":[85,50]}},"kind":"Var","type":{"annotation":[{"end":[190,59],"name":"tests/purus/passing/prelude/Prelude.purs","start":[190,49]},[]],"contents":[["Prim"],"PubKeyHash"],"tag":"TypeConstructor"},"value":{"identifier":"pkh","sourcePos":[84,27]}},"kind":"App"},"kind":"Let"},"isGuarded":false},{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[98,46],"start":[81,18]}},"binderType":"NullBinder"}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[98,46],"start":[86,23]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"binderType":"ConstructorBinder","binders":[],"constructorName":{"identifier":"True","moduleName":["Prim"]},"typeName":{"identifier":"Boolean","moduleName":["Prim"]}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[90,59],"start":[87,28]}},"binds":[{"annotation":{"meta":null,"sourceSpan":{"end":[88,69],"start":[88,32]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[88,60],"start":[88,44]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"tailList","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[88,69],"start":[88,44]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[88,69],"start":[88,61]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"unlisted","sourcePos":[76,7]}},"kind":"App"},"identifier":"unlisted'"},{"annotation":{"meta":null,"sourceSpan":{"end":[89,89],"start":[89,32]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[89,60],"start":[89,39]}},"kind":"Var","type":{"annotation":[{"end":[190,59],"name":"tests/purus/passing/prelude/Prelude.purs","start":[190,26]},[]],"contents":[{"annotation":[{"end":[190,59],"name":"tests/purus/passing/prelude/Prelude.purs","start":[190,26]},[]],"contents":[{"annotation":[{"end":[190,48],"name":"tests/purus/passing/prelude/Prelude.purs","start":[190,46]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[190,45],"name":"tests/purus/passing/prelude/Prelude.purs","start":[190,26]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[190,59],"name":"tests/purus/passing/prelude/Prelude.purs","start":[190,49]},[]],"contents":[["Prim"],"PubKeyHash"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"deserializePubKeyHash","moduleName":["Prelude"]}},"annotation":{"meta":null,"sourceSpan":{"end":[89,89],"start":[89,39]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[89,78],"start":[89,62]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"headList","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[89,88],"start":[89,62]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[89,88],"start":[89,79]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"unlisted'","sourcePos":[88,32]}},"kind":"App"},"kind":"App"},"identifier":"pkh2"},{"annotation":{"meta":null,"sourceSpan":{"end":[87,88],"start":[87,32]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[87,60],"start":[87,39]}},"kind":"Var","type":{"annotation":[{"end":[190,59],"name":"tests/purus/passing/prelude/Prelude.purs","start":[190,26]},[]],"contents":[{"annotation":[{"end":[190,59],"name":"tests/purus/passing/prelude/Prelude.purs","start":[190,26]},[]],"contents":[{"annotation":[{"end":[190,48],"name":"tests/purus/passing/prelude/Prelude.purs","start":[190,46]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[190,45],"name":"tests/purus/passing/prelude/Prelude.purs","start":[190,26]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[190,59],"name":"tests/purus/passing/prelude/Prelude.purs","start":[190,49]},[]],"contents":[["Prim"],"PubKeyHash"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"deserializePubKeyHash","moduleName":["Prelude"]}},"annotation":{"meta":null,"sourceSpan":{"end":[87,88],"start":[87,39]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[87,78],"start":[87,62]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"headList","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[87,87],"start":[87,62]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[87,87],"start":[87,79]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"unlisted","sourcePos":[76,7]}},"kind":"App"},"kind":"App"},"identifier":"pkh1"}],"expression":{"abstraction":{"abstraction":{"annotation":{"meta":{"constructorType":"SumType","identifiers":["$__unused","$__unused"],"metaType":"IsConstructor"},"sourceSpan":{"end":[90,49],"start":[90,32]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"PubKeyHash"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"PubKeyHash"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"DCert"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"DCertPoolRegister","moduleName":["Prim"]}},"annotation":{"meta":null,"sourceSpan":{"end":[90,54],"start":[90,32]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[90,54],"start":[90,50]}},"kind":"Var","type":{"annotation":[{"end":[190,59],"name":"tests/purus/passing/prelude/Prelude.purs","start":[190,49]},[]],"contents":[["Prim"],"PubKeyHash"],"tag":"TypeConstructor"},"value":{"identifier":"pkh1","sourcePos":[87,32]}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[90,59],"start":[90,32]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[90,59],"start":[90,55]}},"kind":"Var","type":{"annotation":[{"end":[190,59],"name":"tests/purus/passing/prelude/Prelude.purs","start":[190,49]},[]],"contents":[["Prim"],"PubKeyHash"],"tag":"TypeConstructor"},"value":{"identifier":"pkh2","sourcePos":[89,32]}},"kind":"App"},"kind":"Let"},"isGuarded":false},{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[98,46],"start":[86,23]}},"binderType":"NullBinder"}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[98,46],"start":[91,28]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"binderType":"ConstructorBinder","binders":[],"constructorName":{"identifier":"True","moduleName":["Prim"]},"typeName":{"identifier":"Boolean","moduleName":["Prim"]}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[95,59],"start":[92,33]}},"binds":[{"annotation":{"meta":null,"sourceSpan":{"end":[93,74],"start":[93,37]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[93,65],"start":[93,49]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"tailList","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[93,74],"start":[93,49]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[93,74],"start":[93,66]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"unlisted","sourcePos":[76,7]}},"kind":"App"},"identifier":"unlisted'"},{"annotation":{"meta":null,"sourceSpan":{"end":[92,92],"start":[92,37]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[92,64],"start":[92,43]}},"kind":"Var","type":{"annotation":[{"end":[190,59],"name":"tests/purus/passing/prelude/Prelude.purs","start":[190,26]},[]],"contents":[{"annotation":[{"end":[190,59],"name":"tests/purus/passing/prelude/Prelude.purs","start":[190,26]},[]],"contents":[{"annotation":[{"end":[190,48],"name":"tests/purus/passing/prelude/Prelude.purs","start":[190,46]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[190,45],"name":"tests/purus/passing/prelude/Prelude.purs","start":[190,26]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[190,59],"name":"tests/purus/passing/prelude/Prelude.purs","start":[190,49]},[]],"contents":[["Prim"],"PubKeyHash"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"deserializePubKeyHash","moduleName":["Prelude"]}},"annotation":{"meta":null,"sourceSpan":{"end":[92,92],"start":[92,43]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[92,82],"start":[92,66]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"headList","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[92,91],"start":[92,66]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[92,91],"start":[92,83]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"unlisted","sourcePos":[76,7]}},"kind":"App"},"kind":"App"},"identifier":"pkh"},{"annotation":{"meta":null,"sourceSpan":{"end":[94,84],"start":[94,37]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[94,55],"start":[94,41]}},"kind":"Var","type":{"annotation":[{"end":[461,45],"name":"tests/purus/passing/prelude/Prelude.purs","start":[461,19]},[]],"contents":[{"annotation":[{"end":[461,45],"name":"tests/purus/passing/prelude/Prelude.purs","start":[461,19]},[]],"contents":[{"annotation":[{"end":[461,41],"name":"tests/purus/passing/prelude/Prelude.purs","start":[461,39]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[461,38],"name":"tests/purus/passing/prelude/Prelude.purs","start":[461,19]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[461,45],"name":"tests/purus/passing/prelude/Prelude.purs","start":[461,42]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"deserializeInt","moduleName":["Prelude"]}},"annotation":{"meta":null,"sourceSpan":{"end":[94,84],"start":[94,41]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[94,73],"start":[94,57]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"headList","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[94,83],"start":[94,57]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[94,83],"start":[94,74]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"unlisted'","sourcePos":[93,37]}},"kind":"App"},"kind":"App"},"identifier":"i"}],"expression":{"abstraction":{"abstraction":{"annotation":{"meta":{"constructorType":"SumType","identifiers":["$__unused","$__unused"],"metaType":"IsConstructor"},"sourceSpan":{"end":[95,53],"start":[95,38]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"PubKeyHash"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"DCert"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"DCertPoolRetire","moduleName":["Prim"]}},"annotation":{"meta":null,"sourceSpan":{"end":[95,57],"start":[95,38]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[95,57],"start":[95,54]}},"kind":"Var","type":{"annotation":[{"end":[190,59],"name":"tests/purus/passing/prelude/Prelude.purs","start":[190,49]},[]],"contents":[["Prim"],"PubKeyHash"],"tag":"TypeConstructor"},"value":{"identifier":"pkh","sourcePos":[92,37]}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[95,59],"start":[95,38]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[95,59],"start":[95,58]}},"kind":"Var","type":{"annotation":[{"end":[461,45],"name":"tests/purus/passing/prelude/Prelude.purs","start":[461,42]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"identifier":"i","sourcePos":[94,37]}},"kind":"App"},"kind":"Let"},"isGuarded":false},{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[98,46],"start":[91,28]}},"binderType":"NullBinder"}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[98,46],"start":[96,33]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"binderType":"ConstructorBinder","binders":[],"constructorName":{"identifier":"True","moduleName":["Prim"]},"typeName":{"identifier":"Boolean","moduleName":["Prim"]}}],"expression":{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[97,50],"start":[97,38]}},"kind":"Var","type":{"annotation":[{"end":[72,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[72,44]},[]],"contents":[["Prim"],"DCert"],"tag":"TypeConstructor"},"value":{"identifier":"DCertGenesis","moduleName":["Prim"]}},"isGuarded":false},{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[98,46],"start":[96,33]}},"binderType":"NullBinder"}],"expression":{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[98,46],"start":[98,38]}},"kind":"Var","type":{"annotation":[{"end":[72,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[72,44]},[]],"contents":[["Prim"],"DCert"],"tag":"TypeConstructor"},"value":{"identifier":"DCertMir","moduleName":["Prim"]}},"isGuarded":false}],"caseExpressions":[{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[96,57],"start":[96,36]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"equalsInteger","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[96,61],"start":[96,36]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[96,61],"start":[96,58]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"identifier":"tag","sourcePos":[75,7]}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[96,63],"start":[96,36]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[96,63],"start":[96,62]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"literalType":"IntLiteral","value":5}},"kind":"App"}],"kind":"Case","type":{"annotation":[{"end":[72,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[72,44]},[]],"contents":[["Prim"],"DCert"],"tag":"TypeConstructor"}},"isGuarded":false}],"caseExpressions":[{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[91,52],"start":[91,31]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"equalsInteger","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[91,56],"start":[91,31]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[91,56],"start":[91,53]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"identifier":"tag","sourcePos":[75,7]}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[91,58],"start":[91,31]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[91,58],"start":[91,57]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"literalType":"IntLiteral","value":4}},"kind":"App"}],"kind":"Case","type":{"annotation":[{"end":[72,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[72,44]},[]],"contents":[["Prim"],"DCert"],"tag":"TypeConstructor"}},"isGuarded":false}],"caseExpressions":[{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[86,47],"start":[86,26]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"equalsInteger","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[86,51],"start":[86,26]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[86,51],"start":[86,48]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"identifier":"tag","sourcePos":[75,7]}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[86,53],"start":[86,26]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[86,53],"start":[86,52]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"literalType":"IntLiteral","value":3}},"kind":"App"}],"kind":"Case","type":{"annotation":[{"end":[72,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[72,44]},[]],"contents":[["Prim"],"DCert"],"tag":"TypeConstructor"}},"isGuarded":false}],"caseExpressions":[{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[81,42],"start":[81,21]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"equalsInteger","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[81,46],"start":[81,21]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[81,46],"start":[81,43]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"identifier":"tag","sourcePos":[75,7]}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[81,48],"start":[81,21]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[81,48],"start":[81,47]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"literalType":"IntLiteral","value":2}},"kind":"App"}],"kind":"Case","type":{"annotation":[{"end":[72,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[72,44]},[]],"contents":[["Prim"],"DCert"],"tag":"TypeConstructor"}},"isGuarded":false}],"caseExpressions":[{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[79,37],"start":[79,16]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"equalsInteger","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[79,41],"start":[79,16]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[79,41],"start":[79,38]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"identifier":"tag","sourcePos":[75,7]}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[79,43],"start":[79,16]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[79,43],"start":[79,42]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"literalType":"IntLiteral","value":1}},"kind":"App"}],"kind":"Case","type":{"annotation":[{"end":[72,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[72,44]},[]],"contents":[["Prim"],"DCert"],"tag":"TypeConstructor"}},"isGuarded":false}],"caseExpressions":[{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[77,32],"start":[77,11]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"equalsInteger","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[77,36],"start":[77,11]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[77,36],"start":[77,33]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"identifier":"tag","sourcePos":[75,7]}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[77,38],"start":[77,11]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[77,38],"start":[77,37]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"literalType":"IntLiteral","value":0}},"kind":"App"}],"kind":"Case","type":{"annotation":[{"end":[72,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[72,44]},[]],"contents":[["Prim"],"DCert"],"tag":"TypeConstructor"}},"kind":"Let"},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[72,40],"name":"tests/purus/passing/prelude/Prelude.purs","start":[72,21]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[72,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[72,44]},[]],"contents":[["Prim"],"DCert"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"identifier":"deserializeDCert"},{"annotation":{"meta":null,"sourceSpan":{"end":[156,57],"start":[156,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[157,65],"start":[157,1]}},"argument":"dat","body":{"abstraction":{"annotation":{"meta":{"metaType":"IsNewtype"},"sourceSpan":{"end":[157,37],"start":[157,28]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinByteString"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"TokenName"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"TokenName","moduleName":["Prim"]}},"annotation":{"meta":null,"sourceSpan":{"end":[157,65],"start":[157,28]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[157,60],"start":[157,39]}},"kind":"Var","type":{"annotation":[{"end":[467,74],"name":"tests/purus/passing/prelude/Prelude.purs","start":[467,26]},[]],"contents":[{"annotation":[{"end":[467,74],"name":"tests/purus/passing/prelude/Prelude.purs","start":[467,26]},[]],"contents":[{"annotation":[{"end":[467,48],"name":"tests/purus/passing/prelude/Prelude.purs","start":[467,46]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[467,45],"name":"tests/purus/passing/prelude/Prelude.purs","start":[467,26]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[467,74],"name":"tests/purus/passing/prelude/Prelude.purs","start":[467,49]},[]],"contents":[["Builtin"],"BuiltinByteString"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"deserializeByteString","moduleName":["Prelude"]}},"annotation":{"meta":null,"sourceSpan":{"end":[157,64],"start":[157,39]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[157,64],"start":[157,61]}},"kind":"Var","type":{"annotation":[{"end":[156,44],"name":"tests/purus/passing/prelude/Prelude.purs","start":[156,25]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"},"value":{"identifier":"dat","sourcePos":[157,1]}},"kind":"App"},"kind":"App"},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[156,44],"name":"tests/purus/passing/prelude/Prelude.purs","start":[156,25]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[156,57],"name":"tests/purus/passing/prelude/Prelude.purs","start":[156,48]},[]],"contents":[["Prim"],"TokenName"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"identifier":"deserializeTokenName"},{"annotation":{"meta":null,"sourceSpan":{"end":[198,47],"start":[198,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[202,64],"start":[199,1]}},"argument":"dat","body":{"annotation":{"meta":null,"sourceSpan":{"end":[202,64],"start":[200,3]}},"binds":[{"annotation":{"meta":null,"sourceSpan":{"end":[200,56],"start":[200,7]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[200,29],"start":[200,14]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"b","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinPair"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"b"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"b"},"tag":"TypeVar"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"sndPair","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[200,56],"start":[200,14]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[200,51],"start":[200,31]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinPair"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"unConstrData","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[200,55],"start":[200,31]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[200,55],"start":[200,52]}},"kind":"Var","type":{"annotation":[{"end":[198,39],"name":"tests/purus/passing/prelude/Prelude.purs","start":[198,20]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"},"value":{"identifier":"dat","sourcePos":[199,1]}},"kind":"App"},"kind":"App"},"identifier":"dat'"},{"annotation":{"meta":null,"sourceSpan":{"end":[201,41],"start":[201,7]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[201,36],"start":[201,18]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"unListData","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[201,41],"start":[201,18]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[201,41],"start":[201,37]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"},"value":{"identifier":"dat'","sourcePos":[200,7]}},"kind":"App"},"identifier":"unlisted"}],"expression":{"abstraction":{"annotation":{"meta":{"metaType":"IsNewtype"},"sourceSpan":{"end":[202,12],"start":[202,8]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinByteString"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"TxId"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"TxId","moduleName":["Prim"]}},"annotation":{"meta":null,"sourceSpan":{"end":[202,64],"start":[202,8]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[202,35],"start":[202,14]}},"kind":"Var","type":{"annotation":[{"end":[467,74],"name":"tests/purus/passing/prelude/Prelude.purs","start":[467,26]},[]],"contents":[{"annotation":[{"end":[467,74],"name":"tests/purus/passing/prelude/Prelude.purs","start":[467,26]},[]],"contents":[{"annotation":[{"end":[467,48],"name":"tests/purus/passing/prelude/Prelude.purs","start":[467,46]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[467,45],"name":"tests/purus/passing/prelude/Prelude.purs","start":[467,26]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[467,74],"name":"tests/purus/passing/prelude/Prelude.purs","start":[467,49]},[]],"contents":[["Builtin"],"BuiltinByteString"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"deserializeByteString","moduleName":["Prelude"]}},"annotation":{"meta":null,"sourceSpan":{"end":[202,63],"start":[202,14]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[202,53],"start":[202,37]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"headList","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[202,62],"start":[202,37]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[202,62],"start":[202,54]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"unlisted","sourcePos":[201,7]}},"kind":"App"},"kind":"App"},"kind":"App"},"kind":"Let"},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[198,39],"name":"tests/purus/passing/prelude/Prelude.purs","start":[198,20]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[198,47],"name":"tests/purus/passing/prelude/Prelude.purs","start":[198,43]},[]],"contents":[["Prim"],"TxId"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"identifier":"deserializeTxId"},{"annotation":{"meta":null,"sourceSpan":{"end":[290,55],"start":[290,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[296,38],"start":[291,1]}},"argument":"dat","body":{"annotation":{"meta":null,"sourceSpan":{"end":[296,38],"start":[292,3]}},"binds":[{"annotation":{"meta":null,"sourceSpan":{"end":[292,81],"start":[292,7]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[292,36],"start":[292,18]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"unListData","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[292,81],"start":[292,18]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[292,53],"start":[292,38]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"b","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinPair"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"b"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"b"},"tag":"TypeVar"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"sndPair","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[292,80],"start":[292,38]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[292,75],"start":[292,55]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinPair"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"unConstrData","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[292,79],"start":[292,55]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[292,79],"start":[292,76]}},"kind":"Var","type":{"annotation":[{"end":[290,43],"name":"tests/purus/passing/prelude/Prelude.purs","start":[290,24]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"},"value":{"identifier":"dat","sourcePos":[291,1]}},"kind":"App"},"kind":"App"},"kind":"App"},"identifier":"unlisted"},{"annotation":{"meta":null,"sourceSpan":{"end":[294,44],"start":[294,7]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[294,35],"start":[294,19]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"tailList","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[294,44],"start":[294,19]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[294,44],"start":[294,36]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"unlisted","sourcePos":[292,7]}},"kind":"App"},"identifier":"unlisted'"},{"annotation":{"meta":null,"sourceSpan":{"end":[295,56],"start":[295,7]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[295,27],"start":[295,13]}},"kind":"Var","type":{"annotation":[{"end":[461,45],"name":"tests/purus/passing/prelude/Prelude.purs","start":[461,19]},[]],"contents":[{"annotation":[{"end":[461,45],"name":"tests/purus/passing/prelude/Prelude.purs","start":[461,19]},[]],"contents":[{"annotation":[{"end":[461,41],"name":"tests/purus/passing/prelude/Prelude.purs","start":[461,39]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[461,38],"name":"tests/purus/passing/prelude/Prelude.purs","start":[461,19]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[461,45],"name":"tests/purus/passing/prelude/Prelude.purs","start":[461,42]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"deserializeInt","moduleName":["Prelude"]}},"annotation":{"meta":null,"sourceSpan":{"end":[295,56],"start":[295,13]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[295,45],"start":[295,29]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"headList","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[295,55],"start":[295,29]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[295,55],"start":[295,46]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"unlisted'","sourcePos":[294,7]}},"kind":"App"},"kind":"App"},"identifier":"idx"},{"annotation":{"meta":null,"sourceSpan":{"end":[293,56],"start":[293,7]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[293,28],"start":[293,13]}},"kind":"Var","type":{"annotation":[{"end":[198,47],"name":"tests/purus/passing/prelude/Prelude.purs","start":[198,20]},[]],"contents":[{"annotation":[{"end":[198,47],"name":"tests/purus/passing/prelude/Prelude.purs","start":[198,20]},[]],"contents":[{"annotation":[{"end":[198,42],"name":"tests/purus/passing/prelude/Prelude.purs","start":[198,40]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[198,39],"name":"tests/purus/passing/prelude/Prelude.purs","start":[198,20]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[198,47],"name":"tests/purus/passing/prelude/Prelude.purs","start":[198,43]},[]],"contents":[["Prim"],"TxId"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"deserializeTxId","moduleName":["Prelude"]}},"annotation":{"meta":null,"sourceSpan":{"end":[293,56],"start":[293,13]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[293,46],"start":[293,30]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"headList","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[293,55],"start":[293,30]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[293,55],"start":[293,47]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"unlisted","sourcePos":[292,7]}},"kind":"App"},"kind":"App"},"identifier":"id1"}],"expression":{"abstraction":{"annotation":{"meta":{"metaType":"IsNewtype"},"sourceSpan":{"end":[296,16],"start":[296,8]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["id",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"TxId"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["idx",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"tag":"REmpty"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"TxOutRef"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"TxOutRef","moduleName":["Prim"]}},"annotation":{"meta":null,"sourceSpan":{"end":[296,38],"start":[296,8]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[296,38],"start":[296,17]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["id",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"TxId"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["idx",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"tag":"REmpty"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"TypeApp"},"value":{"literalType":"ObjectLiteral","value":[["idx",{"annotation":{"meta":null,"sourceSpan":{"end":[296,36],"start":[296,33]}},"kind":"Var","type":{"annotation":[{"end":[461,45],"name":"tests/purus/passing/prelude/Prelude.purs","start":[461,42]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"identifier":"idx","sourcePos":[295,7]}}],["id",{"annotation":{"meta":null,"sourceSpan":{"end":[296,26],"start":[296,23]}},"kind":"Var","type":{"annotation":[{"end":[198,47],"name":"tests/purus/passing/prelude/Prelude.purs","start":[198,43]},[]],"contents":[["Prim"],"TxId"],"tag":"TypeConstructor"},"value":{"identifier":"id1","sourcePos":[293,7]}}]]}},"kind":"App"},"kind":"Let"},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[290,43],"name":"tests/purus/passing/prelude/Prelude.purs","start":[290,24]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[290,55],"name":"tests/purus/passing/prelude/Prelude.purs","start":[290,47]},[]],"contents":[["Prim"],"TxOutRef"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"identifier":"deserializeTxOutRef"},{"annotation":{"meta":null,"sourceSpan":{"end":[29,65],"start":[29,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[40,54],"start":[30,1]}},"argument":"dat","body":{"annotation":{"meta":null,"sourceSpan":{"end":[40,54],"start":[31,3]}},"binds":[{"annotation":{"meta":null,"sourceSpan":{"end":[31,35],"start":[31,7]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[31,31],"start":[31,11]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinPair"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"unConstrData","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[31,35],"start":[31,11]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[31,35],"start":[31,32]}},"kind":"Var","type":{"annotation":[{"end":[29,48],"name":"tests/purus/passing/prelude/Prelude.purs","start":[29,29]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"},"value":{"identifier":"dat","sourcePos":[30,1]}},"kind":"App"},"identifier":"p"},{"annotation":{"meta":null,"sourceSpan":{"end":[32,30],"start":[32,7]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[32,28],"start":[32,13]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"b","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinPair"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"b"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"fstPair","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[32,30],"start":[32,13]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[32,30],"start":[32,29]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinPair"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"p","sourcePos":[31,7]}},"kind":"App"},"identifier":"tag"},{"annotation":{"meta":null,"sourceSpan":{"end":[33,68],"start":[33,7]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[33,27],"start":[33,11]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"headList","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[33,68],"start":[33,11]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[33,47],"start":[33,29]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"unListData","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[33,67],"start":[33,29]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[33,64],"start":[33,49]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"b","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinPair"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"b"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"b"},"tag":"TypeVar"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"sndPair","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[33,66],"start":[33,49]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[33,66],"start":[33,65]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinPair"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"p","sourcePos":[31,7]}},"kind":"App"},"kind":"App"},"kind":"App"},"identifier":"x"}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[40,54],"start":[34,8]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"binderType":"ConstructorBinder","binders":[],"constructorName":{"identifier":"True","moduleName":["Prim"]},"typeName":{"identifier":"Boolean","moduleName":["Prim"]}}],"expression":{"abstraction":{"annotation":{"meta":{"constructorType":"SumType","identifiers":["$__unused"],"metaType":"IsConstructor"},"sourceSpan":{"end":[35,20],"start":[35,13]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"CurrencySymbol"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"ScriptPurpose"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"Minting","moduleName":["Prim"]}},"annotation":{"meta":null,"sourceSpan":{"end":[35,50],"start":[35,13]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[35,47],"start":[35,22]}},"kind":"Var","type":{"annotation":[{"end":[150,67],"name":"tests/purus/passing/prelude/Prelude.purs","start":[150,30]},[]],"contents":[{"annotation":[{"end":[150,67],"name":"tests/purus/passing/prelude/Prelude.purs","start":[150,30]},[]],"contents":[{"annotation":[{"end":[150,52],"name":"tests/purus/passing/prelude/Prelude.purs","start":[150,50]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[150,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[150,30]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[150,67],"name":"tests/purus/passing/prelude/Prelude.purs","start":[150,53]},[]],"contents":[["Prim"],"CurrencySymbol"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"deserializeCurrencySymbol","moduleName":["Prelude"]}},"annotation":{"meta":null,"sourceSpan":{"end":[35,49],"start":[35,22]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[35,49],"start":[35,48]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"},"value":{"identifier":"x","sourcePos":[33,7]}},"kind":"App"},"kind":"App"},"isGuarded":false},{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[40,54],"start":[34,8]}},"binderType":"NullBinder"}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[40,54],"start":[36,13]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"binderType":"ConstructorBinder","binders":[],"constructorName":{"identifier":"True","moduleName":["Prim"]},"typeName":{"identifier":"Boolean","moduleName":["Prim"]}}],"expression":{"abstraction":{"annotation":{"meta":{"constructorType":"SumType","identifiers":["$__unused"],"metaType":"IsConstructor"},"sourceSpan":{"end":[37,26],"start":[37,18]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"TxOutRef"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"ScriptPurpose"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"Spending","moduleName":["Prim"]}},"annotation":{"meta":null,"sourceSpan":{"end":[37,50],"start":[37,18]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[37,47],"start":[37,28]}},"kind":"Var","type":{"annotation":[{"end":[290,55],"name":"tests/purus/passing/prelude/Prelude.purs","start":[290,24]},[]],"contents":[{"annotation":[{"end":[290,55],"name":"tests/purus/passing/prelude/Prelude.purs","start":[290,24]},[]],"contents":[{"annotation":[{"end":[290,46],"name":"tests/purus/passing/prelude/Prelude.purs","start":[290,44]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[290,43],"name":"tests/purus/passing/prelude/Prelude.purs","start":[290,24]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[290,55],"name":"tests/purus/passing/prelude/Prelude.purs","start":[290,47]},[]],"contents":[["Prim"],"TxOutRef"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"deserializeTxOutRef","moduleName":["Prelude"]}},"annotation":{"meta":null,"sourceSpan":{"end":[37,49],"start":[37,28]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[37,49],"start":[37,48]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"},"value":{"identifier":"x","sourcePos":[33,7]}},"kind":"App"},"kind":"App"},"isGuarded":false},{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[40,54],"start":[36,13]}},"binderType":"NullBinder"}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[40,54],"start":[38,18]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"binderType":"ConstructorBinder","binders":[],"constructorName":{"identifier":"True","moduleName":["Prim"]},"typeName":{"identifier":"Boolean","moduleName":["Prim"]}}],"expression":{"abstraction":{"annotation":{"meta":{"constructorType":"SumType","identifiers":["$__unused"],"metaType":"IsConstructor"},"sourceSpan":{"end":[39,32],"start":[39,23]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"StakingCredential"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"ScriptPurpose"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"Rewarding","moduleName":["Prim"]}},"annotation":{"meta":null,"sourceSpan":{"end":[39,65],"start":[39,23]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[39,62],"start":[39,34]}},"kind":"Var","type":{"annotation":[{"end":[110,73],"name":"tests/purus/passing/prelude/Prelude.purs","start":[110,33]},[]],"contents":[{"annotation":[{"end":[110,73],"name":"tests/purus/passing/prelude/Prelude.purs","start":[110,33]},[]],"contents":[{"annotation":[{"end":[110,55],"name":"tests/purus/passing/prelude/Prelude.purs","start":[110,53]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[110,52],"name":"tests/purus/passing/prelude/Prelude.purs","start":[110,33]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[110,73],"name":"tests/purus/passing/prelude/Prelude.purs","start":[110,56]},[]],"contents":[["Prim"],"StakingCredential"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"deserializeStakingCredential","moduleName":["Prelude"]}},"annotation":{"meta":null,"sourceSpan":{"end":[39,64],"start":[39,34]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[39,64],"start":[39,63]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"},"value":{"identifier":"x","sourcePos":[33,7]}},"kind":"App"},"kind":"App"},"isGuarded":false},{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[40,54],"start":[38,18]}},"binderType":"NullBinder"}],"expression":{"abstraction":{"annotation":{"meta":{"constructorType":"SumType","identifiers":["$__unused"],"metaType":"IsConstructor"},"sourceSpan":{"end":[40,33],"start":[40,23]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"DCert"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"ScriptPurpose"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"Certifying","moduleName":["Prim"]}},"annotation":{"meta":null,"sourceSpan":{"end":[40,54],"start":[40,23]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[40,51],"start":[40,35]}},"kind":"Var","type":{"annotation":[{"end":[72,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[72,21]},[]],"contents":[{"annotation":[{"end":[72,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[72,21]},[]],"contents":[{"annotation":[{"end":[72,43],"name":"tests/purus/passing/prelude/Prelude.purs","start":[72,41]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[72,40],"name":"tests/purus/passing/prelude/Prelude.purs","start":[72,21]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[72,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[72,44]},[]],"contents":[["Prim"],"DCert"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"deserializeDCert","moduleName":["Prelude"]}},"annotation":{"meta":null,"sourceSpan":{"end":[40,53],"start":[40,35]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[40,53],"start":[40,52]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"},"value":{"identifier":"x","sourcePos":[33,7]}},"kind":"App"},"kind":"App"},"isGuarded":false}],"caseExpressions":[{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[38,42],"start":[38,21]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"equalsInteger","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[38,44],"start":[38,21]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[38,44],"start":[38,43]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"literalType":"IntLiteral","value":2}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[38,48],"start":[38,21]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[38,48],"start":[38,45]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"identifier":"tag","sourcePos":[32,7]}},"kind":"App"}],"kind":"Case","type":{"annotation":[{"end":[29,65],"name":"tests/purus/passing/prelude/Prelude.purs","start":[29,52]},[]],"contents":[["Prim"],"ScriptPurpose"],"tag":"TypeConstructor"}},"isGuarded":false}],"caseExpressions":[{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[36,37],"start":[36,16]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"equalsInteger","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[36,39],"start":[36,16]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[36,39],"start":[36,38]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"literalType":"IntLiteral","value":1}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[36,43],"start":[36,16]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[36,43],"start":[36,40]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"identifier":"tag","sourcePos":[32,7]}},"kind":"App"}],"kind":"Case","type":{"annotation":[{"end":[29,65],"name":"tests/purus/passing/prelude/Prelude.purs","start":[29,52]},[]],"contents":[["Prim"],"ScriptPurpose"],"tag":"TypeConstructor"}},"isGuarded":false}],"caseExpressions":[{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[34,32],"start":[34,11]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"equalsInteger","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[34,34],"start":[34,11]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[34,34],"start":[34,33]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"literalType":"IntLiteral","value":0}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[34,38],"start":[34,11]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[34,38],"start":[34,35]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"},"value":{"identifier":"tag","sourcePos":[32,7]}},"kind":"App"}],"kind":"Case","type":{"annotation":[{"end":[29,65],"name":"tests/purus/passing/prelude/Prelude.purs","start":[29,52]},[]],"contents":[["Prim"],"ScriptPurpose"],"tag":"TypeConstructor"}},"kind":"Let"},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[29,48],"name":"tests/purus/passing/prelude/Prelude.purs","start":[29,29]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[29,65],"name":"tests/purus/passing/prelude/Prelude.purs","start":[29,52]},[]],"contents":[["Prim"],"ScriptPurpose"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"identifier":"deserializeScriptPurpose"},{"annotation":{"meta":null,"sourceSpan":{"end":[414,15],"start":[409,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[426,58],"start":[415,1]}},"argument":"fK","body":{"annotation":{"meta":null,"sourceSpan":{"end":[426,58],"start":[415,1]}},"argument":"fV","body":{"annotation":{"meta":null,"sourceSpan":{"end":[426,58],"start":[415,1]}},"argument":"dat","body":{"annotation":{"meta":{"metaType":"IsWhere"},"sourceSpan":{"end":[415,70],"start":[415,33]}},"binds":[{"annotation":{"meta":null,"sourceSpan":{"end":[419,24],"start":[417,5]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[426,58],"start":[420,5]}},"argument":"ell","body":{"annotation":{"meta":null,"sourceSpan":{"end":[426,58],"start":[420,14]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"binderType":"ConstructorBinder","binders":[],"constructorName":{"identifier":"True","moduleName":["Prim"]},"typeName":{"identifier":"Boolean","moduleName":["Prim"]}}],"expression":{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[421,22],"start":[421,19]}},"kind":"Var","type":{"annotation":[{"end":[419,24],"name":"tests/purus/passing/prelude/Prelude.purs","start":[419,7]},[]],"contents":[{"annotation":[{"end":[419,11],"name":"tests/purus/passing/prelude/Prelude.purs","start":[419,7]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[419,23],"name":"tests/purus/passing/prelude/Prelude.purs","start":[419,13]},[]],"contents":[{"annotation":[{"end":[419,21],"name":"tests/purus/passing/prelude/Prelude.purs","start":[419,13]},[]],"contents":[{"annotation":[{"end":[419,19],"name":"tests/purus/passing/prelude/Prelude.purs","start":[419,13]},[]],"contents":[["Prim"],"Tuple2"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["k",{"annotation":[{"end":[410,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[410,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},34,239],"tag":"Skolem"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["v",{"annotation":[{"end":[410,32],"name":"tests/purus/passing/prelude/Prelude.purs","start":[410,28]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},35,240],"tag":"Skolem"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"Nil","moduleName":["Prim"]}},"isGuarded":false},{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[426,58],"start":[420,14]}},"binderType":"NullBinder"}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[426,58],"start":[422,19]}},"binds":[{"annotation":{"meta":null,"sourceSpan":{"end":[423,47],"start":[423,23]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[423,43],"start":[423,27]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"tailList","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[423,47],"start":[423,27]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[423,47],"start":[423,44]}},"kind":"Var","type":{"annotation":[{"end":[418,88],"name":"tests/purus/passing/prelude/Prelude.purs","start":[418,7]},[]],"contents":[{"annotation":[{"end":[418,26],"name":"tests/purus/passing/prelude/Prelude.purs","start":[418,7]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[418,87],"name":"tests/purus/passing/prelude/Prelude.purs","start":[418,28]},[]],"contents":[{"annotation":[{"end":[418,67],"name":"tests/purus/passing/prelude/Prelude.purs","start":[418,28]},[]],"contents":[{"annotation":[{"end":[418,47],"name":"tests/purus/passing/prelude/Prelude.purs","start":[418,28]},[]],"contents":[["Builtin"],"BuiltinPair"],"tag":"TypeConstructor"},{"annotation":[{"end":[418,67],"name":"tests/purus/passing/prelude/Prelude.purs","start":[418,48]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[418,87],"name":"tests/purus/passing/prelude/Prelude.purs","start":[418,68]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"ell","sourcePos":[420,5]}},"kind":"App"},"identifier":"t"},{"annotation":{"meta":null,"sourceSpan":{"end":[422,47],"start":[422,23]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[422,43],"start":[422,27]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"headList","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[422,47],"start":[422,27]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[422,47],"start":[422,44]}},"kind":"Var","type":{"annotation":[{"end":[418,88],"name":"tests/purus/passing/prelude/Prelude.purs","start":[418,7]},[]],"contents":[{"annotation":[{"end":[418,26],"name":"tests/purus/passing/prelude/Prelude.purs","start":[418,7]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[418,87],"name":"tests/purus/passing/prelude/Prelude.purs","start":[418,28]},[]],"contents":[{"annotation":[{"end":[418,67],"name":"tests/purus/passing/prelude/Prelude.purs","start":[418,28]},[]],"contents":[{"annotation":[{"end":[418,47],"name":"tests/purus/passing/prelude/Prelude.purs","start":[418,28]},[]],"contents":[["Builtin"],"BuiltinPair"],"tag":"TypeConstructor"},{"annotation":[{"end":[418,67],"name":"tests/purus/passing/prelude/Prelude.purs","start":[418,48]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[418,87],"name":"tests/purus/passing/prelude/Prelude.purs","start":[418,68]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"ell","sourcePos":[420,5]}},"kind":"App"},"identifier":"p"},{"annotation":{"meta":null,"sourceSpan":{"end":[424,44],"start":[424,23]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[424,42],"start":[424,27]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"b","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinPair"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"b"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"fstPair","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[424,44],"start":[424,27]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[424,44],"start":[424,43]}},"kind":"Var","type":{"annotation":[{"end":[418,87],"name":"tests/purus/passing/prelude/Prelude.purs","start":[418,28]},[]],"contents":[{"annotation":[{"end":[418,67],"name":"tests/purus/passing/prelude/Prelude.purs","start":[418,28]},[]],"contents":[{"annotation":[{"end":[418,47],"name":"tests/purus/passing/prelude/Prelude.purs","start":[418,28]},[]],"contents":[["Builtin"],"BuiltinPair"],"tag":"TypeConstructor"},{"annotation":[{"end":[418,67],"name":"tests/purus/passing/prelude/Prelude.purs","start":[418,48]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[418,87],"name":"tests/purus/passing/prelude/Prelude.purs","start":[418,68]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"p","sourcePos":[422,23]}},"kind":"App"},"identifier":"x"},{"annotation":{"meta":null,"sourceSpan":{"end":[425,44],"start":[425,23]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[425,42],"start":[425,27]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"b","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinPair"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"b"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"b"},"tag":"TypeVar"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"sndPair","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[425,44],"start":[425,27]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[425,44],"start":[425,43]}},"kind":"Var","type":{"annotation":[{"end":[418,87],"name":"tests/purus/passing/prelude/Prelude.purs","start":[418,28]},[]],"contents":[{"annotation":[{"end":[418,67],"name":"tests/purus/passing/prelude/Prelude.purs","start":[418,28]},[]],"contents":[{"annotation":[{"end":[418,47],"name":"tests/purus/passing/prelude/Prelude.purs","start":[418,28]},[]],"contents":[["Builtin"],"BuiltinPair"],"tag":"TypeConstructor"},{"annotation":[{"end":[418,67],"name":"tests/purus/passing/prelude/Prelude.purs","start":[418,48]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[418,87],"name":"tests/purus/passing/prelude/Prelude.purs","start":[418,68]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"p","sourcePos":[422,23]}},"kind":"App"},"identifier":"y"}],"expression":{"abstraction":{"abstraction":{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[426,28],"start":[426,24]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"x","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":249,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"x"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"x"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"x"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"Cons","moduleName":["Prim"]}},"annotation":{"meta":null,"sourceSpan":{"end":[426,51],"start":[426,24]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":{"constructorType":"ProductType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[426,36],"start":[426,30]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"t1","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":251,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"t2","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":250,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"t1"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"t2"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Tuple2"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"t1"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"t2"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"Tuple2","moduleName":["Prim"]}},"annotation":{"meta":null,"sourceSpan":{"end":[426,43],"start":[426,30]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[426,40],"start":[426,38]}},"kind":"Var","type":{"annotation":[{"end":[411,28],"name":"tests/purus/passing/prelude/Prelude.purs","start":[411,4]},[]],"contents":[{"annotation":[{"end":[411,28],"name":"tests/purus/passing/prelude/Prelude.purs","start":[411,4]},[]],"contents":[{"annotation":[{"end":[411,26],"name":"tests/purus/passing/prelude/Prelude.purs","start":[411,24]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[411,23],"name":"tests/purus/passing/prelude/Prelude.purs","start":[411,4]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[411,28],"name":"tests/purus/passing/prelude/Prelude.purs","start":[411,27]},[]],"contents":{"kind":{"annotation":[{"end":[410,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[410,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"k"},"tag":"TypeVar"}],"tag":"TypeApp"},"value":{"identifier":"fK","sourcePos":[415,1]}},"annotation":{"meta":null,"sourceSpan":{"end":[426,42],"start":[426,38]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[426,42],"start":[426,41]}},"kind":"Var","type":{"annotation":[{"end":[418,67],"name":"tests/purus/passing/prelude/Prelude.purs","start":[418,48]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"},"value":{"identifier":"x","sourcePos":[424,23]}},"kind":"App"},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[426,50],"start":[426,30]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[426,47],"start":[426,45]}},"kind":"Var","type":{"annotation":[{"end":[412,28],"name":"tests/purus/passing/prelude/Prelude.purs","start":[412,4]},[]],"contents":[{"annotation":[{"end":[412,28],"name":"tests/purus/passing/prelude/Prelude.purs","start":[412,4]},[]],"contents":[{"annotation":[{"end":[412,26],"name":"tests/purus/passing/prelude/Prelude.purs","start":[412,24]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[412,23],"name":"tests/purus/passing/prelude/Prelude.purs","start":[412,4]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[412,28],"name":"tests/purus/passing/prelude/Prelude.purs","start":[412,27]},[]],"contents":{"kind":{"annotation":[{"end":[410,32],"name":"tests/purus/passing/prelude/Prelude.purs","start":[410,28]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"v"},"tag":"TypeVar"}],"tag":"TypeApp"},"value":{"identifier":"fV","sourcePos":[415,1]}},"annotation":{"meta":null,"sourceSpan":{"end":[426,49],"start":[426,45]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[426,49],"start":[426,48]}},"kind":"Var","type":{"annotation":[{"end":[418,87],"name":"tests/purus/passing/prelude/Prelude.purs","start":[418,68]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"},"value":{"identifier":"y","sourcePos":[425,23]}},"kind":"App"},"kind":"App"},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[426,58],"start":[426,24]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[426,55],"start":[426,53]}},"kind":"Var","type":{"annotation":[{"end":[419,24],"name":"tests/purus/passing/prelude/Prelude.purs","start":[418,7]},[]],"contents":[{"annotation":[{"end":[419,24],"name":"tests/purus/passing/prelude/Prelude.purs","start":[418,7]},[]],"contents":[{"annotation":[{"end":[418,91],"name":"tests/purus/passing/prelude/Prelude.purs","start":[418,89]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[418,88],"name":"tests/purus/passing/prelude/Prelude.purs","start":[418,7]},[]],"contents":[{"annotation":[{"end":[418,26],"name":"tests/purus/passing/prelude/Prelude.purs","start":[418,7]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[418,87],"name":"tests/purus/passing/prelude/Prelude.purs","start":[418,28]},[]],"contents":[{"annotation":[{"end":[418,67],"name":"tests/purus/passing/prelude/Prelude.purs","start":[418,28]},[]],"contents":[{"annotation":[{"end":[418,47],"name":"tests/purus/passing/prelude/Prelude.purs","start":[418,28]},[]],"contents":[["Builtin"],"BuiltinPair"],"tag":"TypeConstructor"},{"annotation":[{"end":[418,67],"name":"tests/purus/passing/prelude/Prelude.purs","start":[418,48]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[418,87],"name":"tests/purus/passing/prelude/Prelude.purs","start":[418,68]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[419,24],"name":"tests/purus/passing/prelude/Prelude.purs","start":[419,7]},[]],"contents":[{"annotation":[{"end":[419,11],"name":"tests/purus/passing/prelude/Prelude.purs","start":[419,7]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[419,23],"name":"tests/purus/passing/prelude/Prelude.purs","start":[419,13]},[]],"contents":[{"annotation":[{"end":[419,21],"name":"tests/purus/passing/prelude/Prelude.purs","start":[419,13]},[]],"contents":[{"annotation":[{"end":[419,19],"name":"tests/purus/passing/prelude/Prelude.purs","start":[419,13]},[]],"contents":[["Prim"],"Tuple2"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["k",{"annotation":[{"end":[410,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[410,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},34,239],"tag":"Skolem"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["v",{"annotation":[{"end":[410,32],"name":"tests/purus/passing/prelude/Prelude.purs","start":[410,28]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},35,240],"tag":"Skolem"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"go","sourcePos":[417,5]}},"annotation":{"meta":null,"sourceSpan":{"end":[426,57],"start":[426,53]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[426,57],"start":[426,56]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[418,87],"name":"tests/purus/passing/prelude/Prelude.purs","start":[418,28]},[]],"contents":[{"annotation":[{"end":[418,67],"name":"tests/purus/passing/prelude/Prelude.purs","start":[418,28]},[]],"contents":[{"annotation":[{"end":[418,47],"name":"tests/purus/passing/prelude/Prelude.purs","start":[418,28]},[]],"contents":[["Builtin"],"BuiltinPair"],"tag":"TypeConstructor"},{"annotation":[{"end":[418,67],"name":"tests/purus/passing/prelude/Prelude.purs","start":[418,48]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[418,87],"name":"tests/purus/passing/prelude/Prelude.purs","start":[418,68]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"t","sourcePos":[423,23]}},"kind":"App"},"kind":"App"},"kind":"Let"},"isGuarded":false}],"caseExpressions":[{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[420,33],"start":[420,17]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"nullList","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[420,37],"start":[420,17]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[420,37],"start":[420,34]}},"kind":"Var","type":{"annotation":[{"end":[418,88],"name":"tests/purus/passing/prelude/Prelude.purs","start":[418,7]},[]],"contents":[{"annotation":[{"end":[418,26],"name":"tests/purus/passing/prelude/Prelude.purs","start":[418,7]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[418,87],"name":"tests/purus/passing/prelude/Prelude.purs","start":[418,28]},[]],"contents":[{"annotation":[{"end":[418,67],"name":"tests/purus/passing/prelude/Prelude.purs","start":[418,28]},[]],"contents":[{"annotation":[{"end":[418,47],"name":"tests/purus/passing/prelude/Prelude.purs","start":[418,28]},[]],"contents":[["Builtin"],"BuiltinPair"],"tag":"TypeConstructor"},{"annotation":[{"end":[418,67],"name":"tests/purus/passing/prelude/Prelude.purs","start":[418,48]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[418,87],"name":"tests/purus/passing/prelude/Prelude.purs","start":[418,68]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"ell","sourcePos":[420,5]}},"kind":"App"}],"kind":"Case","type":{"annotation":[{"end":[419,24],"name":"tests/purus/passing/prelude/Prelude.purs","start":[419,7]},[]],"contents":[{"annotation":[{"end":[419,11],"name":"tests/purus/passing/prelude/Prelude.purs","start":[419,7]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[419,23],"name":"tests/purus/passing/prelude/Prelude.purs","start":[419,13]},[]],"contents":[{"annotation":[{"end":[419,21],"name":"tests/purus/passing/prelude/Prelude.purs","start":[419,13]},[]],"contents":[{"annotation":[{"end":[419,19],"name":"tests/purus/passing/prelude/Prelude.purs","start":[419,13]},[]],"contents":[["Prim"],"Tuple2"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["k",{"annotation":[{"end":[410,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[410,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},34,239],"tag":"Skolem"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["v",{"annotation":[{"end":[410,32],"name":"tests/purus/passing/prelude/Prelude.purs","start":[410,28]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},35,240],"tag":"Skolem"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[418,88],"name":"tests/purus/passing/prelude/Prelude.purs","start":[418,7]},[]],"contents":[{"annotation":[{"end":[418,26],"name":"tests/purus/passing/prelude/Prelude.purs","start":[418,7]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[418,87],"name":"tests/purus/passing/prelude/Prelude.purs","start":[418,28]},[]],"contents":[{"annotation":[{"end":[418,67],"name":"tests/purus/passing/prelude/Prelude.purs","start":[418,28]},[]],"contents":[{"annotation":[{"end":[418,47],"name":"tests/purus/passing/prelude/Prelude.purs","start":[418,28]},[]],"contents":[["Builtin"],"BuiltinPair"],"tag":"TypeConstructor"},{"annotation":[{"end":[418,67],"name":"tests/purus/passing/prelude/Prelude.purs","start":[418,48]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[418,87],"name":"tests/purus/passing/prelude/Prelude.purs","start":[418,68]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[419,24],"name":"tests/purus/passing/prelude/Prelude.purs","start":[419,7]},[]],"contents":[{"annotation":[{"end":[419,11],"name":"tests/purus/passing/prelude/Prelude.purs","start":[419,7]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[419,23],"name":"tests/purus/passing/prelude/Prelude.purs","start":[419,13]},[]],"contents":[{"annotation":[{"end":[419,21],"name":"tests/purus/passing/prelude/Prelude.purs","start":[419,13]},[]],"contents":[{"annotation":[{"end":[419,19],"name":"tests/purus/passing/prelude/Prelude.purs","start":[419,13]},[]],"contents":[["Prim"],"Tuple2"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["k",{"annotation":[{"end":[410,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[410,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},34,239],"tag":"Skolem"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["v",{"annotation":[{"end":[410,32],"name":"tests/purus/passing/prelude/Prelude.purs","start":[410,28]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},35,240],"tag":"Skolem"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"identifier":"go"}],"expression":{"abstraction":{"annotation":{"meta":{"metaType":"IsNewtype"},"sourceSpan":{"end":[415,41],"start":[415,33]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"k","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":253,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"v","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":252,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Tuple2"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"k"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"v"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"AssocMap"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"k"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"v"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"AssocMap","moduleName":["Prim"]}},"annotation":{"meta":null,"sourceSpan":{"end":[415,70],"start":[415,33]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[415,45],"start":[415,43]}},"kind":"Var","type":{"annotation":[{"end":[419,24],"name":"tests/purus/passing/prelude/Prelude.purs","start":[418,7]},[]],"contents":[{"annotation":[{"end":[419,24],"name":"tests/purus/passing/prelude/Prelude.purs","start":[418,7]},[]],"contents":[{"annotation":[{"end":[418,91],"name":"tests/purus/passing/prelude/Prelude.purs","start":[418,89]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[418,88],"name":"tests/purus/passing/prelude/Prelude.purs","start":[418,7]},[]],"contents":[{"annotation":[{"end":[418,26],"name":"tests/purus/passing/prelude/Prelude.purs","start":[418,7]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[418,87],"name":"tests/purus/passing/prelude/Prelude.purs","start":[418,28]},[]],"contents":[{"annotation":[{"end":[418,67],"name":"tests/purus/passing/prelude/Prelude.purs","start":[418,28]},[]],"contents":[{"annotation":[{"end":[418,47],"name":"tests/purus/passing/prelude/Prelude.purs","start":[418,28]},[]],"contents":[["Builtin"],"BuiltinPair"],"tag":"TypeConstructor"},{"annotation":[{"end":[418,67],"name":"tests/purus/passing/prelude/Prelude.purs","start":[418,48]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[418,87],"name":"tests/purus/passing/prelude/Prelude.purs","start":[418,68]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[419,24],"name":"tests/purus/passing/prelude/Prelude.purs","start":[419,7]},[]],"contents":[{"annotation":[{"end":[419,11],"name":"tests/purus/passing/prelude/Prelude.purs","start":[419,7]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[419,23],"name":"tests/purus/passing/prelude/Prelude.purs","start":[419,13]},[]],"contents":[{"annotation":[{"end":[419,21],"name":"tests/purus/passing/prelude/Prelude.purs","start":[419,13]},[]],"contents":[{"annotation":[{"end":[419,19],"name":"tests/purus/passing/prelude/Prelude.purs","start":[419,13]},[]],"contents":[["Prim"],"Tuple2"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["k",{"annotation":[{"end":[410,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[410,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},34,239],"tag":"Skolem"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["v",{"annotation":[{"end":[410,32],"name":"tests/purus/passing/prelude/Prelude.purs","start":[410,28]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},35,240],"tag":"Skolem"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"go","sourcePos":[417,5]}},"annotation":{"meta":null,"sourceSpan":{"end":[415,69],"start":[415,43]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[415,64],"start":[415,47]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinPair"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"unMapData","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[415,68],"start":[415,47]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[415,68],"start":[415,65]}},"kind":"Var","type":{"annotation":[{"end":[413,22],"name":"tests/purus/passing/prelude/Prelude.purs","start":[413,3]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"},"value":{"identifier":"dat","sourcePos":[415,1]}},"kind":"App"},"kind":"App"},"kind":"App"},"kind":"Let"},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[413,22],"name":"tests/purus/passing/prelude/Prelude.purs","start":[413,3]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[414,15],"name":"tests/purus/passing/prelude/Prelude.purs","start":[414,3]},[]],"contents":[{"annotation":[{"end":[414,13],"name":"tests/purus/passing/prelude/Prelude.purs","start":[414,3]},[]],"contents":[{"annotation":[{"end":[414,11],"name":"tests/purus/passing/prelude/Prelude.purs","start":[414,3]},[]],"contents":[["Prim"],"AssocMap"],"tag":"TypeConstructor"},{"annotation":[{"end":[414,13],"name":"tests/purus/passing/prelude/Prelude.purs","start":[414,12]},[]],"contents":{"kind":{"annotation":[{"end":[410,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[410,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"k"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[414,15],"name":"tests/purus/passing/prelude/Prelude.purs","start":[414,14]},[]],"contents":{"kind":{"annotation":[{"end":[410,32],"name":"tests/purus/passing/prelude/Prelude.purs","start":[410,28]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"v"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[412,28],"name":"tests/purus/passing/prelude/Prelude.purs","start":[412,4]},[]],"contents":[{"annotation":[{"end":[412,28],"name":"tests/purus/passing/prelude/Prelude.purs","start":[412,4]},[]],"contents":[{"annotation":[{"end":[412,26],"name":"tests/purus/passing/prelude/Prelude.purs","start":[412,24]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[412,23],"name":"tests/purus/passing/prelude/Prelude.purs","start":[412,4]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[412,28],"name":"tests/purus/passing/prelude/Prelude.purs","start":[412,27]},[]],"contents":{"kind":{"annotation":[{"end":[410,32],"name":"tests/purus/passing/prelude/Prelude.purs","start":[410,28]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"v"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[414,15],"name":"tests/purus/passing/prelude/Prelude.purs","start":[413,3]},[]],"contents":[{"annotation":[{"end":[414,15],"name":"tests/purus/passing/prelude/Prelude.purs","start":[413,3]},[]],"contents":[{"annotation":[{"end":[413,25],"name":"tests/purus/passing/prelude/Prelude.purs","start":[413,23]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[413,22],"name":"tests/purus/passing/prelude/Prelude.purs","start":[413,3]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[414,15],"name":"tests/purus/passing/prelude/Prelude.purs","start":[414,3]},[]],"contents":[{"annotation":[{"end":[414,13],"name":"tests/purus/passing/prelude/Prelude.purs","start":[414,3]},[]],"contents":[{"annotation":[{"end":[414,11],"name":"tests/purus/passing/prelude/Prelude.purs","start":[414,3]},[]],"contents":[["Prim"],"AssocMap"],"tag":"TypeConstructor"},{"annotation":[{"end":[414,13],"name":"tests/purus/passing/prelude/Prelude.purs","start":[414,12]},[]],"contents":{"kind":{"annotation":[{"end":[410,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[410,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"k"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[414,15],"name":"tests/purus/passing/prelude/Prelude.purs","start":[414,14]},[]],"contents":{"kind":{"annotation":[{"end":[410,32],"name":"tests/purus/passing/prelude/Prelude.purs","start":[410,28]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"v"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"kind":"Abs","type":{"annotation":[{"end":[414,15],"name":"tests/purus/passing/prelude/Prelude.purs","start":[410,3]},[]],"contents":{"identifier":"k","kind":{"annotation":[{"end":[410,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[410,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":238,"type":{"annotation":[{"end":[414,15],"name":"tests/purus/passing/prelude/Prelude.purs","start":[410,23]},[]],"contents":{"identifier":"v","kind":{"annotation":[{"end":[410,32],"name":"tests/purus/passing/prelude/Prelude.purs","start":[410,28]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":237,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[411,28],"name":"tests/purus/passing/prelude/Prelude.purs","start":[411,4]},[]],"contents":[{"annotation":[{"end":[411,28],"name":"tests/purus/passing/prelude/Prelude.purs","start":[411,4]},[]],"contents":[{"annotation":[{"end":[411,26],"name":"tests/purus/passing/prelude/Prelude.purs","start":[411,24]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[411,23],"name":"tests/purus/passing/prelude/Prelude.purs","start":[411,4]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[411,28],"name":"tests/purus/passing/prelude/Prelude.purs","start":[411,27]},[]],"contents":{"kind":{"annotation":[{"end":[410,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[410,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"k"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[414,15],"name":"tests/purus/passing/prelude/Prelude.purs","start":[412,3]},[]],"contents":[{"annotation":[{"end":[414,15],"name":"tests/purus/passing/prelude/Prelude.purs","start":[412,3]},[]],"contents":[{"annotation":[{"end":[412,32],"name":"tests/purus/passing/prelude/Prelude.purs","start":[412,30]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[412,28],"name":"tests/purus/passing/prelude/Prelude.purs","start":[412,4]},[]],"contents":[{"annotation":[{"end":[412,28],"name":"tests/purus/passing/prelude/Prelude.purs","start":[412,4]},[]],"contents":[{"annotation":[{"end":[412,26],"name":"tests/purus/passing/prelude/Prelude.purs","start":[412,24]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[412,23],"name":"tests/purus/passing/prelude/Prelude.purs","start":[412,4]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[412,28],"name":"tests/purus/passing/prelude/Prelude.purs","start":[412,27]},[]],"contents":{"kind":{"annotation":[{"end":[410,32],"name":"tests/purus/passing/prelude/Prelude.purs","start":[410,28]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"v"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[414,15],"name":"tests/purus/passing/prelude/Prelude.purs","start":[413,3]},[]],"contents":[{"annotation":[{"end":[414,15],"name":"tests/purus/passing/prelude/Prelude.purs","start":[413,3]},[]],"contents":[{"annotation":[{"end":[413,25],"name":"tests/purus/passing/prelude/Prelude.purs","start":[413,23]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[413,22],"name":"tests/purus/passing/prelude/Prelude.purs","start":[413,3]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[414,15],"name":"tests/purus/passing/prelude/Prelude.purs","start":[414,3]},[]],"contents":[{"annotation":[{"end":[414,13],"name":"tests/purus/passing/prelude/Prelude.purs","start":[414,3]},[]],"contents":[{"annotation":[{"end":[414,11],"name":"tests/purus/passing/prelude/Prelude.purs","start":[414,3]},[]],"contents":[["Prim"],"AssocMap"],"tag":"TypeConstructor"},{"annotation":[{"end":[414,13],"name":"tests/purus/passing/prelude/Prelude.purs","start":[414,12]},[]],"contents":{"kind":{"annotation":[{"end":[410,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[410,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"k"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[414,15],"name":"tests/purus/passing/prelude/Prelude.purs","start":[414,14]},[]],"contents":{"kind":{"annotation":[{"end":[410,32],"name":"tests/purus/passing/prelude/Prelude.purs","start":[410,28]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"v"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"identifier":"deserializeAssocMap"},{"annotation":{"meta":null,"sourceSpan":{"end":[142,49],"start":[142,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[145,50],"start":[143,1]}},"argument":"dat","body":{"abstraction":{"annotation":{"meta":{"metaType":"IsNewtype"},"sourceSpan":{"end":[144,8],"start":[144,3]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"AssocMap"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"CurrencySymbol"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"AssocMap"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"TokenName"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Value"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"Value","moduleName":["Prim"]}},"annotation":{"meta":null,"sourceSpan":{"end":[145,50],"start":[144,3]}},"argument":{"abstraction":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[144,29],"start":[144,10]}},"kind":"Var","type":{"annotation":[{"end":[414,15],"name":"tests/purus/passing/prelude/Prelude.purs","start":[410,3]},[]],"contents":{"identifier":"k","kind":{"annotation":[{"end":[410,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[410,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":238,"type":{"annotation":[{"end":[414,15],"name":"tests/purus/passing/prelude/Prelude.purs","start":[410,23]},[]],"contents":{"identifier":"v","kind":{"annotation":[{"end":[410,32],"name":"tests/purus/passing/prelude/Prelude.purs","start":[410,28]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":237,"type":{"annotation":[{"end":[414,15],"name":"tests/purus/passing/prelude/Prelude.purs","start":[411,3]},[]],"contents":[{"annotation":[{"end":[414,15],"name":"tests/purus/passing/prelude/Prelude.purs","start":[411,3]},[]],"contents":[{"annotation":[{"end":[411,32],"name":"tests/purus/passing/prelude/Prelude.purs","start":[411,30]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[411,28],"name":"tests/purus/passing/prelude/Prelude.purs","start":[411,4]},[]],"contents":[{"annotation":[{"end":[411,28],"name":"tests/purus/passing/prelude/Prelude.purs","start":[411,4]},[]],"contents":[{"annotation":[{"end":[411,26],"name":"tests/purus/passing/prelude/Prelude.purs","start":[411,24]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[411,23],"name":"tests/purus/passing/prelude/Prelude.purs","start":[411,4]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[411,28],"name":"tests/purus/passing/prelude/Prelude.purs","start":[411,27]},[]],"contents":{"kind":{"annotation":[{"end":[410,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[410,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"k"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[414,15],"name":"tests/purus/passing/prelude/Prelude.purs","start":[412,3]},[]],"contents":[{"annotation":[{"end":[414,15],"name":"tests/purus/passing/prelude/Prelude.purs","start":[412,3]},[]],"contents":[{"annotation":[{"end":[412,32],"name":"tests/purus/passing/prelude/Prelude.purs","start":[412,30]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[412,28],"name":"tests/purus/passing/prelude/Prelude.purs","start":[412,4]},[]],"contents":[{"annotation":[{"end":[412,28],"name":"tests/purus/passing/prelude/Prelude.purs","start":[412,4]},[]],"contents":[{"annotation":[{"end":[412,26],"name":"tests/purus/passing/prelude/Prelude.purs","start":[412,24]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[412,23],"name":"tests/purus/passing/prelude/Prelude.purs","start":[412,4]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[412,28],"name":"tests/purus/passing/prelude/Prelude.purs","start":[412,27]},[]],"contents":{"kind":{"annotation":[{"end":[410,32],"name":"tests/purus/passing/prelude/Prelude.purs","start":[410,28]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"v"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[414,15],"name":"tests/purus/passing/prelude/Prelude.purs","start":[413,3]},[]],"contents":[{"annotation":[{"end":[414,15],"name":"tests/purus/passing/prelude/Prelude.purs","start":[413,3]},[]],"contents":[{"annotation":[{"end":[413,25],"name":"tests/purus/passing/prelude/Prelude.purs","start":[413,23]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[413,22],"name":"tests/purus/passing/prelude/Prelude.purs","start":[413,3]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[414,15],"name":"tests/purus/passing/prelude/Prelude.purs","start":[414,3]},[]],"contents":[{"annotation":[{"end":[414,13],"name":"tests/purus/passing/prelude/Prelude.purs","start":[414,3]},[]],"contents":[{"annotation":[{"end":[414,11],"name":"tests/purus/passing/prelude/Prelude.purs","start":[414,3]},[]],"contents":[["Prim"],"AssocMap"],"tag":"TypeConstructor"},{"annotation":[{"end":[414,13],"name":"tests/purus/passing/prelude/Prelude.purs","start":[414,12]},[]],"contents":{"kind":{"annotation":[{"end":[410,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[410,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"k"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[414,15],"name":"tests/purus/passing/prelude/Prelude.purs","start":[414,14]},[]],"contents":{"kind":{"annotation":[{"end":[410,32],"name":"tests/purus/passing/prelude/Prelude.purs","start":[410,28]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"v"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"deserializeAssocMap","moduleName":["Prelude"]}},"annotation":{"meta":null,"sourceSpan":{"end":[144,55],"start":[144,10]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[144,55],"start":[144,30]}},"kind":"Var","type":{"annotation":[{"end":[150,67],"name":"tests/purus/passing/prelude/Prelude.purs","start":[150,30]},[]],"contents":[{"annotation":[{"end":[150,67],"name":"tests/purus/passing/prelude/Prelude.purs","start":[150,30]},[]],"contents":[{"annotation":[{"end":[150,52],"name":"tests/purus/passing/prelude/Prelude.purs","start":[150,50]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[150,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[150,30]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[150,67],"name":"tests/purus/passing/prelude/Prelude.purs","start":[150,53]},[]],"contents":[["Prim"],"CurrencySymbol"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"deserializeCurrencySymbol","moduleName":["Prelude"]}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[145,45],"start":[144,10]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[144,76],"start":[144,57]}},"kind":"Var","type":{"annotation":[{"end":[414,15],"name":"tests/purus/passing/prelude/Prelude.purs","start":[410,3]},[]],"contents":{"identifier":"k","kind":{"annotation":[{"end":[410,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[410,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":238,"type":{"annotation":[{"end":[414,15],"name":"tests/purus/passing/prelude/Prelude.purs","start":[410,23]},[]],"contents":{"identifier":"v","kind":{"annotation":[{"end":[410,32],"name":"tests/purus/passing/prelude/Prelude.purs","start":[410,28]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":237,"type":{"annotation":[{"end":[414,15],"name":"tests/purus/passing/prelude/Prelude.purs","start":[411,3]},[]],"contents":[{"annotation":[{"end":[414,15],"name":"tests/purus/passing/prelude/Prelude.purs","start":[411,3]},[]],"contents":[{"annotation":[{"end":[411,32],"name":"tests/purus/passing/prelude/Prelude.purs","start":[411,30]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[411,28],"name":"tests/purus/passing/prelude/Prelude.purs","start":[411,4]},[]],"contents":[{"annotation":[{"end":[411,28],"name":"tests/purus/passing/prelude/Prelude.purs","start":[411,4]},[]],"contents":[{"annotation":[{"end":[411,26],"name":"tests/purus/passing/prelude/Prelude.purs","start":[411,24]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[411,23],"name":"tests/purus/passing/prelude/Prelude.purs","start":[411,4]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[411,28],"name":"tests/purus/passing/prelude/Prelude.purs","start":[411,27]},[]],"contents":{"kind":{"annotation":[{"end":[410,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[410,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"k"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[414,15],"name":"tests/purus/passing/prelude/Prelude.purs","start":[412,3]},[]],"contents":[{"annotation":[{"end":[414,15],"name":"tests/purus/passing/prelude/Prelude.purs","start":[412,3]},[]],"contents":[{"annotation":[{"end":[412,32],"name":"tests/purus/passing/prelude/Prelude.purs","start":[412,30]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[412,28],"name":"tests/purus/passing/prelude/Prelude.purs","start":[412,4]},[]],"contents":[{"annotation":[{"end":[412,28],"name":"tests/purus/passing/prelude/Prelude.purs","start":[412,4]},[]],"contents":[{"annotation":[{"end":[412,26],"name":"tests/purus/passing/prelude/Prelude.purs","start":[412,24]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[412,23],"name":"tests/purus/passing/prelude/Prelude.purs","start":[412,4]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[412,28],"name":"tests/purus/passing/prelude/Prelude.purs","start":[412,27]},[]],"contents":{"kind":{"annotation":[{"end":[410,32],"name":"tests/purus/passing/prelude/Prelude.purs","start":[410,28]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"v"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[414,15],"name":"tests/purus/passing/prelude/Prelude.purs","start":[413,3]},[]],"contents":[{"annotation":[{"end":[414,15],"name":"tests/purus/passing/prelude/Prelude.purs","start":[413,3]},[]],"contents":[{"annotation":[{"end":[413,25],"name":"tests/purus/passing/prelude/Prelude.purs","start":[413,23]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[413,22],"name":"tests/purus/passing/prelude/Prelude.purs","start":[413,3]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[414,15],"name":"tests/purus/passing/prelude/Prelude.purs","start":[414,3]},[]],"contents":[{"annotation":[{"end":[414,13],"name":"tests/purus/passing/prelude/Prelude.purs","start":[414,3]},[]],"contents":[{"annotation":[{"end":[414,11],"name":"tests/purus/passing/prelude/Prelude.purs","start":[414,3]},[]],"contents":[["Prim"],"AssocMap"],"tag":"TypeConstructor"},{"annotation":[{"end":[414,13],"name":"tests/purus/passing/prelude/Prelude.purs","start":[414,12]},[]],"contents":{"kind":{"annotation":[{"end":[410,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[410,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"k"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[414,15],"name":"tests/purus/passing/prelude/Prelude.purs","start":[414,14]},[]],"contents":{"kind":{"annotation":[{"end":[410,32],"name":"tests/purus/passing/prelude/Prelude.purs","start":[410,28]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"v"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"deserializeAssocMap","moduleName":["Prelude"]}},"annotation":{"meta":null,"sourceSpan":{"end":[145,29],"start":[144,57]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[145,29],"start":[145,9]}},"kind":"Var","type":{"annotation":[{"end":[156,57],"name":"tests/purus/passing/prelude/Prelude.purs","start":[156,25]},[]],"contents":[{"annotation":[{"end":[156,57],"name":"tests/purus/passing/prelude/Prelude.purs","start":[156,25]},[]],"contents":[{"annotation":[{"end":[156,47],"name":"tests/purus/passing/prelude/Prelude.purs","start":[156,45]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[156,44],"name":"tests/purus/passing/prelude/Prelude.purs","start":[156,25]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[156,57],"name":"tests/purus/passing/prelude/Prelude.purs","start":[156,48]},[]],"contents":[["Prim"],"TokenName"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"deserializeTokenName","moduleName":["Prelude"]}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[145,44],"start":[144,57]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[145,44],"start":[145,30]}},"kind":"Var","type":{"annotation":[{"end":[461,45],"name":"tests/purus/passing/prelude/Prelude.purs","start":[461,19]},[]],"contents":[{"annotation":[{"end":[461,45],"name":"tests/purus/passing/prelude/Prelude.purs","start":[461,19]},[]],"contents":[{"annotation":[{"end":[461,41],"name":"tests/purus/passing/prelude/Prelude.purs","start":[461,39]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[461,38],"name":"tests/purus/passing/prelude/Prelude.purs","start":[461,19]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[461,45],"name":"tests/purus/passing/prelude/Prelude.purs","start":[461,42]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"deserializeInt","moduleName":["Prelude"]}},"kind":"App"},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[145,49],"start":[144,10]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[145,49],"start":[145,46]}},"kind":"Var","type":{"annotation":[{"end":[142,40],"name":"tests/purus/passing/prelude/Prelude.purs","start":[142,21]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"},"value":{"identifier":"dat","sourcePos":[143,1]}},"kind":"App"},"kind":"App"},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[142,40],"name":"tests/purus/passing/prelude/Prelude.purs","start":[142,21]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[142,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[142,44]},[]],"contents":[["Prim"],"Value"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"identifier":"deserializeValue"},{"annotation":{"meta":null,"sourceSpan":{"end":[177,53],"start":[177,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[184,80],"start":[178,1]}},"argument":"dat","body":{"annotation":{"meta":null,"sourceSpan":{"end":[184,80],"start":[179,3]}},"binds":[{"annotation":{"meta":null,"sourceSpan":{"end":[179,56],"start":[179,7]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[179,29],"start":[179,14]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"b","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinPair"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"b"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"b"},"tag":"TypeVar"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"sndPair","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[179,56],"start":[179,14]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[179,51],"start":[179,31]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinPair"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"unConstrData","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[179,55],"start":[179,31]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[179,55],"start":[179,52]}},"kind":"Var","type":{"annotation":[{"end":[177,42],"name":"tests/purus/passing/prelude/Prelude.purs","start":[177,23]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"},"value":{"identifier":"dat","sourcePos":[178,1]}},"kind":"App"},"kind":"App"},"identifier":"dat'"},{"annotation":{"meta":null,"sourceSpan":{"end":[180,41],"start":[180,7]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[180,36],"start":[180,18]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"unListData","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[180,41],"start":[180,18]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[180,41],"start":[180,37]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"},"value":{"identifier":"dat'","sourcePos":[179,7]}},"kind":"App"},"identifier":"unlisted"},{"annotation":{"meta":null,"sourceSpan":{"end":[182,44],"start":[182,7]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[182,35],"start":[182,19]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"tailList","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[182,44],"start":[182,19]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[182,44],"start":[182,36]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"unlisted","sourcePos":[180,7]}},"kind":"App"},"identifier":"unlisted'"},{"annotation":{"meta":null,"sourceSpan":{"end":[183,101],"start":[183,7]}},"bindType":"NonRec","expression":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[183,43],"start":[183,27]}},"kind":"Var","type":{"annotation":[{"end":[528,10],"name":"tests/purus/passing/prelude/Prelude.purs","start":[525,3]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[525,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[525,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":142,"type":{"annotation":[{"end":[528,10],"name":"tests/purus/passing/prelude/Prelude.purs","start":[526,3]},[]],"contents":[{"annotation":[{"end":[528,10],"name":"tests/purus/passing/prelude/Prelude.purs","start":[526,3]},[]],"contents":[{"annotation":[{"end":[526,32],"name":"tests/purus/passing/prelude/Prelude.purs","start":[526,30]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[526,28],"name":"tests/purus/passing/prelude/Prelude.purs","start":[526,4]},[]],"contents":[{"annotation":[{"end":[526,28],"name":"tests/purus/passing/prelude/Prelude.purs","start":[526,4]},[]],"contents":[{"annotation":[{"end":[526,26],"name":"tests/purus/passing/prelude/Prelude.purs","start":[526,24]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[526,23],"name":"tests/purus/passing/prelude/Prelude.purs","start":[526,4]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[526,28],"name":"tests/purus/passing/prelude/Prelude.purs","start":[526,27]},[]],"contents":{"kind":{"annotation":[{"end":[525,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[525,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[528,10],"name":"tests/purus/passing/prelude/Prelude.purs","start":[527,3]},[]],"contents":[{"annotation":[{"end":[528,10],"name":"tests/purus/passing/prelude/Prelude.purs","start":[527,3]},[]],"contents":[{"annotation":[{"end":[527,25],"name":"tests/purus/passing/prelude/Prelude.purs","start":[527,23]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[527,22],"name":"tests/purus/passing/prelude/Prelude.purs","start":[527,3]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[528,10],"name":"tests/purus/passing/prelude/Prelude.purs","start":[528,3]},[]],"contents":[{"annotation":[{"end":[528,8],"name":"tests/purus/passing/prelude/Prelude.purs","start":[528,3]},[]],"contents":[["Prim"],"Maybe"],"tag":"TypeConstructor"},{"annotation":[{"end":[528,10],"name":"tests/purus/passing/prelude/Prelude.purs","start":[528,9]},[]],"contents":{"kind":{"annotation":[{"end":[525,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[525,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"deserializeMaybe","moduleName":["Prelude"]}},"annotation":{"meta":null,"sourceSpan":{"end":[183,72],"start":[183,27]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[183,72],"start":[183,44]}},"kind":"Var","type":{"annotation":[{"end":[110,73],"name":"tests/purus/passing/prelude/Prelude.purs","start":[110,33]},[]],"contents":[{"annotation":[{"end":[110,73],"name":"tests/purus/passing/prelude/Prelude.purs","start":[110,33]},[]],"contents":[{"annotation":[{"end":[110,55],"name":"tests/purus/passing/prelude/Prelude.purs","start":[110,53]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[110,52],"name":"tests/purus/passing/prelude/Prelude.purs","start":[110,33]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[110,73],"name":"tests/purus/passing/prelude/Prelude.purs","start":[110,56]},[]],"contents":[["Prim"],"StakingCredential"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"deserializeStakingCredential","moduleName":["Prelude"]}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[183,101],"start":[183,27]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[183,90],"start":[183,74]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"headList","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[183,100],"start":[183,74]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[183,100],"start":[183,91]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"unlisted'","sourcePos":[182,7]}},"kind":"App"},"kind":"App"},"identifier":"stakingCredential"},{"annotation":{"meta":null,"sourceSpan":{"end":[181,69],"start":[181,7]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[181,41],"start":[181,20]}},"kind":"Var","type":{"annotation":[{"end":[129,59],"name":"tests/purus/passing/prelude/Prelude.purs","start":[129,26]},[]],"contents":[{"annotation":[{"end":[129,59],"name":"tests/purus/passing/prelude/Prelude.purs","start":[129,26]},[]],"contents":[{"annotation":[{"end":[129,48],"name":"tests/purus/passing/prelude/Prelude.purs","start":[129,46]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[129,45],"name":"tests/purus/passing/prelude/Prelude.purs","start":[129,26]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[129,59],"name":"tests/purus/passing/prelude/Prelude.purs","start":[129,49]},[]],"contents":[["Prim"],"Credential"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"deserializeCredential","moduleName":["Prelude"]}},"annotation":{"meta":null,"sourceSpan":{"end":[181,69],"start":[181,20]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[181,59],"start":[181,43]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"headList","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[181,68],"start":[181,43]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[181,68],"start":[181,60]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"unlisted","sourcePos":[180,7]}},"kind":"App"},"kind":"App"},"identifier":"credential"}],"expression":{"abstraction":{"annotation":{"meta":{"metaType":"IsNewtype"},"sourceSpan":{"end":[184,15],"start":[184,8]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["credential",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Credential"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["stakingCredential",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Maybe"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"StakingCredential"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"tag":"REmpty"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Address"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"Address","moduleName":["Prim"]}},"annotation":{"meta":null,"sourceSpan":{"end":[184,80],"start":[184,8]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[184,80],"start":[184,16]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["credential",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Credential"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["stakingCredential",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Maybe"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"StakingCredential"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"tag":"REmpty"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"TypeApp"},"value":{"literalType":"ObjectLiteral","value":[["stakingCredential",{"annotation":{"meta":null,"sourceSpan":{"end":[184,78],"start":[184,61]}},"kind":"Var","type":{"annotation":[{"end":[528,10],"name":"tests/purus/passing/prelude/Prelude.purs","start":[528,3]},[]],"contents":[{"annotation":[{"end":[528,8],"name":"tests/purus/passing/prelude/Prelude.purs","start":[528,3]},[]],"contents":[["Prim"],"Maybe"],"tag":"TypeConstructor"},{"annotation":[{"end":[110,73],"name":"tests/purus/passing/prelude/Prelude.purs","start":[110,56]},[]],"contents":[["Prim"],"StakingCredential"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"stakingCredential","sourcePos":[183,7]}}],["credential",{"annotation":{"meta":null,"sourceSpan":{"end":[184,40],"start":[184,30]}},"kind":"Var","type":{"annotation":[{"end":[129,59],"name":"tests/purus/passing/prelude/Prelude.purs","start":[129,49]},[]],"contents":[["Prim"],"Credential"],"tag":"TypeConstructor"},"value":{"identifier":"credential","sourcePos":[181,7]}}]]}},"kind":"App"},"kind":"Let"},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[177,42],"name":"tests/purus/passing/prelude/Prelude.purs","start":[177,23]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[177,53],"name":"tests/purus/passing/prelude/Prelude.purs","start":[177,46]},[]],"contents":[["Prim"],"Address"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"identifier":"deserializeAddress"},{"annotation":{"meta":null,"sourceSpan":{"end":[268,49],"start":[268,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[282,15],"start":[269,1]}},"argument":"dat","body":{"annotation":{"meta":null,"sourceSpan":{"end":[282,15],"start":[270,3]}},"binds":[{"annotation":{"meta":null,"sourceSpan":{"end":[270,81],"start":[270,7]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[270,36],"start":[270,18]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"unListData","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[270,81],"start":[270,18]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[270,53],"start":[270,38]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"b","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinPair"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"b"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"b"},"tag":"TypeVar"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"sndPair","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[270,80],"start":[270,38]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[270,75],"start":[270,55]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinPair"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"unConstrData","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[270,79],"start":[270,55]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[270,79],"start":[270,76]}},"kind":"Var","type":{"annotation":[{"end":[268,40],"name":"tests/purus/passing/prelude/Prelude.purs","start":[268,21]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"},"value":{"identifier":"dat","sourcePos":[269,1]}},"kind":"App"},"kind":"App"},"kind":"App"},"identifier":"unlisted"},{"annotation":{"meta":null,"sourceSpan":{"end":[272,44],"start":[272,7]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[272,35],"start":[272,19]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"tailList","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[272,44],"start":[272,19]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[272,44],"start":[272,36]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"unlisted","sourcePos":[270,7]}},"kind":"App"},"identifier":"unlisted1"},{"annotation":{"meta":null,"sourceSpan":{"end":[274,45],"start":[274,7]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[274,35],"start":[274,19]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"tailList","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[274,45],"start":[274,19]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[274,45],"start":[274,36]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"unlisted1","sourcePos":[272,7]}},"kind":"App"},"identifier":"unlisted2"},{"annotation":{"meta":null,"sourceSpan":{"end":[276,45],"start":[276,7]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[276,35],"start":[276,19]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"tailList","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[276,45],"start":[276,19]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[276,45],"start":[276,36]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"unlisted2","sourcePos":[274,7]}},"kind":"App"},"identifier":"unlisted3"},{"annotation":{"meta":null,"sourceSpan":{"end":[273,60],"start":[273,7]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[273,31],"start":[273,15]}},"kind":"Var","type":{"annotation":[{"end":[142,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[142,21]},[]],"contents":[{"annotation":[{"end":[142,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[142,21]},[]],"contents":[{"annotation":[{"end":[142,43],"name":"tests/purus/passing/prelude/Prelude.purs","start":[142,41]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[142,40],"name":"tests/purus/passing/prelude/Prelude.purs","start":[142,21]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[142,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[142,44]},[]],"contents":[["Prim"],"Value"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"deserializeValue","moduleName":["Prelude"]}},"annotation":{"meta":null,"sourceSpan":{"end":[273,60],"start":[273,15]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[273,49],"start":[273,33]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"headList","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[273,59],"start":[273,33]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[273,59],"start":[273,50]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"unlisted1","sourcePos":[272,7]}},"kind":"App"},"kind":"App"},"identifier":"value"},{"annotation":{"meta":null,"sourceSpan":{"end":[277,92],"start":[277,7]}},"bindType":"NonRec","expression":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[277,41],"start":[277,25]}},"kind":"Var","type":{"annotation":[{"end":[528,10],"name":"tests/purus/passing/prelude/Prelude.purs","start":[525,3]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[525,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[525,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":142,"type":{"annotation":[{"end":[528,10],"name":"tests/purus/passing/prelude/Prelude.purs","start":[526,3]},[]],"contents":[{"annotation":[{"end":[528,10],"name":"tests/purus/passing/prelude/Prelude.purs","start":[526,3]},[]],"contents":[{"annotation":[{"end":[526,32],"name":"tests/purus/passing/prelude/Prelude.purs","start":[526,30]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[526,28],"name":"tests/purus/passing/prelude/Prelude.purs","start":[526,4]},[]],"contents":[{"annotation":[{"end":[526,28],"name":"tests/purus/passing/prelude/Prelude.purs","start":[526,4]},[]],"contents":[{"annotation":[{"end":[526,26],"name":"tests/purus/passing/prelude/Prelude.purs","start":[526,24]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[526,23],"name":"tests/purus/passing/prelude/Prelude.purs","start":[526,4]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[526,28],"name":"tests/purus/passing/prelude/Prelude.purs","start":[526,27]},[]],"contents":{"kind":{"annotation":[{"end":[525,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[525,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[528,10],"name":"tests/purus/passing/prelude/Prelude.purs","start":[527,3]},[]],"contents":[{"annotation":[{"end":[528,10],"name":"tests/purus/passing/prelude/Prelude.purs","start":[527,3]},[]],"contents":[{"annotation":[{"end":[527,25],"name":"tests/purus/passing/prelude/Prelude.purs","start":[527,23]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[527,22],"name":"tests/purus/passing/prelude/Prelude.purs","start":[527,3]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[528,10],"name":"tests/purus/passing/prelude/Prelude.purs","start":[528,3]},[]],"contents":[{"annotation":[{"end":[528,8],"name":"tests/purus/passing/prelude/Prelude.purs","start":[528,3]},[]],"contents":[["Prim"],"Maybe"],"tag":"TypeConstructor"},{"annotation":[{"end":[528,10],"name":"tests/purus/passing/prelude/Prelude.purs","start":[528,9]},[]],"contents":{"kind":{"annotation":[{"end":[525,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[525,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"deserializeMaybe","moduleName":["Prelude"]}},"annotation":{"meta":null,"sourceSpan":{"end":[277,63],"start":[277,25]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[277,63],"start":[277,42]}},"kind":"Var","type":{"annotation":[{"end":[431,59],"name":"tests/purus/passing/prelude/Prelude.purs","start":[431,26]},[]],"contents":[{"annotation":[{"end":[431,59],"name":"tests/purus/passing/prelude/Prelude.purs","start":[431,26]},[]],"contents":[{"annotation":[{"end":[431,48],"name":"tests/purus/passing/prelude/Prelude.purs","start":[431,46]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[431,45],"name":"tests/purus/passing/prelude/Prelude.purs","start":[431,26]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[431,59],"name":"tests/purus/passing/prelude/Prelude.purs","start":[431,49]},[]],"contents":[["Prim"],"ScriptHash"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"deserializeScriptHash","moduleName":["Prelude"]}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[277,92],"start":[277,25]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[277,81],"start":[277,65]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"headList","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[277,91],"start":[277,65]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[277,91],"start":[277,82]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"unlisted3","sourcePos":[276,7]}},"kind":"App"},"kind":"App"},"identifier":"referenceScript"},{"annotation":{"meta":null,"sourceSpan":{"end":[275,72],"start":[275,7]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[275,43],"start":[275,21]}},"kind":"Var","type":{"annotation":[{"end":[318,61],"name":"tests/purus/passing/prelude/Prelude.purs","start":[318,27]},[]],"contents":[{"annotation":[{"end":[318,61],"name":"tests/purus/passing/prelude/Prelude.purs","start":[318,27]},[]],"contents":[{"annotation":[{"end":[318,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[318,47]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[318,46],"name":"tests/purus/passing/prelude/Prelude.purs","start":[318,27]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[318,61],"name":"tests/purus/passing/prelude/Prelude.purs","start":[318,50]},[]],"contents":[["Prim"],"OutputDatum"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"deserializeOutputDatum","moduleName":["Prelude"]}},"annotation":{"meta":null,"sourceSpan":{"end":[275,72],"start":[275,21]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[275,61],"start":[275,45]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"headList","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[275,71],"start":[275,45]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[275,71],"start":[275,62]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"unlisted2","sourcePos":[274,7]}},"kind":"App"},"kind":"App"},"identifier":"outputDatum"},{"annotation":{"meta":null,"sourceSpan":{"end":[271,63],"start":[271,7]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[271,35],"start":[271,17]}},"kind":"Var","type":{"annotation":[{"end":[177,53],"name":"tests/purus/passing/prelude/Prelude.purs","start":[177,23]},[]],"contents":[{"annotation":[{"end":[177,53],"name":"tests/purus/passing/prelude/Prelude.purs","start":[177,23]},[]],"contents":[{"annotation":[{"end":[177,45],"name":"tests/purus/passing/prelude/Prelude.purs","start":[177,43]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[177,42],"name":"tests/purus/passing/prelude/Prelude.purs","start":[177,23]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[177,53],"name":"tests/purus/passing/prelude/Prelude.purs","start":[177,46]},[]],"contents":[["Prim"],"Address"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"deserializeAddress","moduleName":["Prelude"]}},"annotation":{"meta":null,"sourceSpan":{"end":[271,63],"start":[271,17]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[271,53],"start":[271,37]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"headList","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[271,62],"start":[271,37]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[271,62],"start":[271,54]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"unlisted","sourcePos":[270,7]}},"kind":"App"},"kind":"App"},"identifier":"address"}],"expression":{"abstraction":{"annotation":{"meta":{"metaType":"IsNewtype"},"sourceSpan":{"end":[278,13],"start":[278,8]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["address",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Address"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["value",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Value"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["datum",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"OutputDatum"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["referenceScript",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Maybe"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"ScriptHash"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"tag":"REmpty"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"TxOut"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"TxOut","moduleName":["Prim"]}},"annotation":{"meta":null,"sourceSpan":{"end":[282,15],"start":[278,8]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[282,15],"start":[278,14]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["address",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Address"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["value",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Value"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["datum",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"OutputDatum"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["referenceScript",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Maybe"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"ScriptHash"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"tag":"REmpty"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"TypeApp"},"value":{"literalType":"ObjectLiteral","value":[["referenceScript",{"annotation":{"meta":null,"sourceSpan":{"end":[281,48],"start":[281,33]}},"kind":"Var","type":{"annotation":[{"end":[528,10],"name":"tests/purus/passing/prelude/Prelude.purs","start":[528,3]},[]],"contents":[{"annotation":[{"end":[528,8],"name":"tests/purus/passing/prelude/Prelude.purs","start":[528,3]},[]],"contents":[["Prim"],"Maybe"],"tag":"TypeConstructor"},{"annotation":[{"end":[431,59],"name":"tests/purus/passing/prelude/Prelude.purs","start":[431,49]},[]],"contents":[["Prim"],"ScriptHash"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"referenceScript","sourcePos":[277,7]}}],["datum",{"annotation":{"meta":null,"sourceSpan":{"end":[280,34],"start":[280,23]}},"kind":"Var","type":{"annotation":[{"end":[318,61],"name":"tests/purus/passing/prelude/Prelude.purs","start":[318,50]},[]],"contents":[["Prim"],"OutputDatum"],"tag":"TypeConstructor"},"value":{"identifier":"outputDatum","sourcePos":[275,7]}}],["value",{"annotation":{"meta":null,"sourceSpan":{"end":[279,28],"start":[279,23]}},"kind":"Var","type":{"annotation":[{"end":[142,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[142,44]},[]],"contents":[["Prim"],"Value"],"tag":"TypeConstructor"},"value":{"identifier":"value","sourcePos":[273,7]}}],["address",{"annotation":{"meta":null,"sourceSpan":{"end":[278,32],"start":[278,25]}},"kind":"Var","type":{"annotation":[{"end":[177,53],"name":"tests/purus/passing/prelude/Prelude.purs","start":[177,46]},[]],"contents":[["Prim"],"Address"],"tag":"TypeConstructor"},"value":{"identifier":"address","sourcePos":[271,7]}}]]}},"kind":"App"},"kind":"Let"},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[268,40],"name":"tests/purus/passing/prelude/Prelude.purs","start":[268,21]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[268,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[268,44]},[]],"contents":[["Prim"],"TxOut"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"identifier":"deserializeTxOut"},{"annotation":{"meta":null,"sourceSpan":{"end":[304,55],"start":[304,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[310,57],"start":[305,1]}},"argument":"dat","body":{"annotation":{"meta":null,"sourceSpan":{"end":[310,57],"start":[306,3]}},"binds":[{"annotation":{"meta":null,"sourceSpan":{"end":[306,81],"start":[306,7]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[306,36],"start":[306,18]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"unListData","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[306,81],"start":[306,18]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[306,53],"start":[306,38]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"b","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinPair"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"b"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"b"},"tag":"TypeVar"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"sndPair","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[306,80],"start":[306,38]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[306,75],"start":[306,55]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinPair"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"unConstrData","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[306,79],"start":[306,55]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[306,79],"start":[306,76]}},"kind":"Var","type":{"annotation":[{"end":[304,43],"name":"tests/purus/passing/prelude/Prelude.purs","start":[304,24]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"},"value":{"identifier":"dat","sourcePos":[305,1]}},"kind":"App"},"kind":"App"},"kind":"App"},"identifier":"unlisted"},{"annotation":{"meta":null,"sourceSpan":{"end":[308,44],"start":[308,7]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[308,35],"start":[308,19]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"tailList","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[308,44],"start":[308,19]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[308,44],"start":[308,36]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"unlisted","sourcePos":[306,7]}},"kind":"App"},"identifier":"unlisted'"},{"annotation":{"meta":null,"sourceSpan":{"end":[309,63],"start":[309,7]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[309,34],"start":[309,18]}},"kind":"Var","type":{"annotation":[{"end":[268,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[268,21]},[]],"contents":[{"annotation":[{"end":[268,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[268,21]},[]],"contents":[{"annotation":[{"end":[268,43],"name":"tests/purus/passing/prelude/Prelude.purs","start":[268,41]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[268,40],"name":"tests/purus/passing/prelude/Prelude.purs","start":[268,21]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[268,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[268,44]},[]],"contents":[["Prim"],"TxOut"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"deserializeTxOut","moduleName":["Prelude"]}},"annotation":{"meta":null,"sourceSpan":{"end":[309,63],"start":[309,18]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[309,52],"start":[309,36]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"headList","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[309,62],"start":[309,36]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[309,62],"start":[309,53]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"unlisted'","sourcePos":[308,7]}},"kind":"App"},"kind":"App"},"identifier":"resolved"},{"annotation":{"meta":null,"sourceSpan":{"end":[307,63],"start":[307,7]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[307,35],"start":[307,16]}},"kind":"Var","type":{"annotation":[{"end":[290,55],"name":"tests/purus/passing/prelude/Prelude.purs","start":[290,24]},[]],"contents":[{"annotation":[{"end":[290,55],"name":"tests/purus/passing/prelude/Prelude.purs","start":[290,24]},[]],"contents":[{"annotation":[{"end":[290,46],"name":"tests/purus/passing/prelude/Prelude.purs","start":[290,44]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[290,43],"name":"tests/purus/passing/prelude/Prelude.purs","start":[290,24]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[290,55],"name":"tests/purus/passing/prelude/Prelude.purs","start":[290,47]},[]],"contents":[["Prim"],"TxOutRef"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"deserializeTxOutRef","moduleName":["Prelude"]}},"annotation":{"meta":null,"sourceSpan":{"end":[307,63],"start":[307,16]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[307,53],"start":[307,37]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"headList","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[307,62],"start":[307,37]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[307,62],"start":[307,54]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"unlisted","sourcePos":[306,7]}},"kind":"App"},"kind":"App"},"identifier":"outRef"}],"expression":{"abstraction":{"annotation":{"meta":{"metaType":"IsNewtype"},"sourceSpan":{"end":[310,16],"start":[310,8]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["txOutRef",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"TxOutRef"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["resolved",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"TxOut"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"tag":"REmpty"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"TxInInfo"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"TxInInfo","moduleName":["Prim"]}},"annotation":{"meta":null,"sourceSpan":{"end":[310,57],"start":[310,8]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[310,57],"start":[310,17]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["txOutRef",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"TxOutRef"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["resolved",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"TxOut"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"tag":"REmpty"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"TypeApp"},"value":{"literalType":"ObjectLiteral","value":[["resolved",{"annotation":{"meta":null,"sourceSpan":{"end":[310,55],"start":[310,47]}},"kind":"Var","type":{"annotation":[{"end":[268,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[268,44]},[]],"contents":[["Prim"],"TxOut"],"tag":"TypeConstructor"},"value":{"identifier":"resolved","sourcePos":[309,7]}}],["txOutRef",{"annotation":{"meta":null,"sourceSpan":{"end":[310,35],"start":[310,29]}},"kind":"Var","type":{"annotation":[{"end":[290,55],"name":"tests/purus/passing/prelude/Prelude.purs","start":[290,47]},[]],"contents":[["Prim"],"TxOutRef"],"tag":"TypeConstructor"},"value":{"identifier":"outRef","sourcePos":[307,7]}}]]}},"kind":"App"},"kind":"Let"},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[304,43],"name":"tests/purus/passing/prelude/Prelude.purs","start":[304,24]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[304,55],"name":"tests/purus/passing/prelude/Prelude.purs","start":[304,47]},[]],"contents":[["Prim"],"TxInInfo"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"identifier":"deserializeTxInInfo"},{"annotation":{"meta":null,"sourceSpan":{"end":[220,51],"start":[220,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[258,16],"start":[221,1]}},"argument":"dat","body":{"annotation":{"meta":null,"sourceSpan":{"end":[258,16],"start":[222,3]}},"binds":[{"annotation":{"meta":null,"sourceSpan":{"end":[222,81],"start":[222,7]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[222,36],"start":[222,18]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"unListData","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[222,81],"start":[222,18]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[222,53],"start":[222,38]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"b","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinPair"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"b"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"b"},"tag":"TypeVar"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"sndPair","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[222,80],"start":[222,38]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[222,75],"start":[222,55]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinPair"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"unConstrData","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[222,79],"start":[222,55]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[222,79],"start":[222,76]}},"kind":"Var","type":{"annotation":[{"end":[220,41],"name":"tests/purus/passing/prelude/Prelude.purs","start":[220,22]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"},"value":{"identifier":"dat","sourcePos":[221,1]}},"kind":"App"},"kind":"App"},"kind":"App"},"identifier":"unlisted"},{"annotation":{"meta":null,"sourceSpan":{"end":[224,44],"start":[224,7]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[224,35],"start":[224,19]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"tailList","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[224,44],"start":[224,19]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[224,44],"start":[224,36]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"unlisted","sourcePos":[222,7]}},"kind":"App"},"identifier":"unlisted1"},{"annotation":{"meta":null,"sourceSpan":{"end":[226,45],"start":[226,7]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[226,35],"start":[226,19]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"tailList","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[226,45],"start":[226,19]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[226,45],"start":[226,36]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"unlisted1","sourcePos":[224,7]}},"kind":"App"},"identifier":"unlisted2"},{"annotation":{"meta":null,"sourceSpan":{"end":[228,45],"start":[228,7]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[228,35],"start":[228,19]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"tailList","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[228,45],"start":[228,19]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[228,45],"start":[228,36]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"unlisted2","sourcePos":[226,7]}},"kind":"App"},"identifier":"unlisted3"},{"annotation":{"meta":null,"sourceSpan":{"end":[230,45],"start":[230,7]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[230,35],"start":[230,19]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"tailList","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[230,45],"start":[230,19]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[230,45],"start":[230,36]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"unlisted3","sourcePos":[228,7]}},"kind":"App"},"identifier":"unlisted4"},{"annotation":{"meta":null,"sourceSpan":{"end":[232,45],"start":[232,7]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[232,35],"start":[232,19]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"tailList","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[232,45],"start":[232,19]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[232,45],"start":[232,36]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"unlisted4","sourcePos":[230,7]}},"kind":"App"},"identifier":"unlisted5"},{"annotation":{"meta":null,"sourceSpan":{"end":[234,45],"start":[234,7]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[234,35],"start":[234,19]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"tailList","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[234,45],"start":[234,19]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[234,45],"start":[234,36]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"unlisted5","sourcePos":[232,7]}},"kind":"App"},"identifier":"unlisted6"},{"annotation":{"meta":null,"sourceSpan":{"end":[236,45],"start":[236,7]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[236,35],"start":[236,19]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"tailList","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[236,45],"start":[236,19]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[236,45],"start":[236,36]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"unlisted6","sourcePos":[234,7]}},"kind":"App"},"identifier":"unlisted7"},{"annotation":{"meta":null,"sourceSpan":{"end":[238,45],"start":[238,7]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[238,35],"start":[238,19]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"tailList","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[238,45],"start":[238,19]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[238,45],"start":[238,36]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"unlisted7","sourcePos":[236,7]}},"kind":"App"},"identifier":"unlisted8"},{"annotation":{"meta":null,"sourceSpan":{"end":[240,45],"start":[240,7]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[240,35],"start":[240,19]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"tailList","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[240,45],"start":[240,19]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[240,45],"start":[240,36]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"unlisted8","sourcePos":[238,7]}},"kind":"App"},"identifier":"unlisted9"},{"annotation":{"meta":null,"sourceSpan":{"end":[242,46],"start":[242,7]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[242,36],"start":[242,20]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"tailList","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[242,46],"start":[242,20]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[242,46],"start":[242,37]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"unlisted9","sourcePos":[240,7]}},"kind":"App"},"identifier":"unlisted10"},{"annotation":{"meta":null,"sourceSpan":{"end":[244,47],"start":[244,7]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[244,36],"start":[244,20]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"tailList","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[244,47],"start":[244,20]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[244,47],"start":[244,37]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"unlisted10","sourcePos":[242,7]}},"kind":"App"},"identifier":"unlisted11"},{"annotation":{"meta":null,"sourceSpan":{"end":[237,93],"start":[237,7]}},"bindType":"NonRec","expression":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[237,43],"start":[237,24]}},"kind":"Var","type":{"annotation":[{"end":[338,87],"name":"tests/purus/passing/prelude/Prelude.purs","start":[338,3]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[338,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[338,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":180,"type":{"annotation":[{"end":[338,87],"name":"tests/purus/passing/prelude/Prelude.purs","start":[338,24]},[]],"contents":[{"annotation":[{"end":[338,87],"name":"tests/purus/passing/prelude/Prelude.purs","start":[338,24]},[]],"contents":[{"annotation":[{"end":[338,53],"name":"tests/purus/passing/prelude/Prelude.purs","start":[338,51]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[338,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[338,25]},[]],"contents":[{"annotation":[{"end":[338,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[338,25]},[]],"contents":[{"annotation":[{"end":[338,47],"name":"tests/purus/passing/prelude/Prelude.purs","start":[338,45]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[338,44],"name":"tests/purus/passing/prelude/Prelude.purs","start":[338,25]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[338,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[338,48]},[]],"contents":{"kind":{"annotation":[{"end":[338,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[338,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[338,87],"name":"tests/purus/passing/prelude/Prelude.purs","start":[338,54]},[]],"contents":[{"annotation":[{"end":[338,87],"name":"tests/purus/passing/prelude/Prelude.purs","start":[338,54]},[]],"contents":[{"annotation":[{"end":[338,76],"name":"tests/purus/passing/prelude/Prelude.purs","start":[338,74]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[338,73],"name":"tests/purus/passing/prelude/Prelude.purs","start":[338,54]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[338,87],"name":"tests/purus/passing/prelude/Prelude.purs","start":[338,77]},[]],"contents":[{"annotation":[{"end":[338,85],"name":"tests/purus/passing/prelude/Prelude.purs","start":[338,77]},[]],"contents":[["Prim"],"Interval"],"tag":"TypeConstructor"},{"annotation":[{"end":[338,87],"name":"tests/purus/passing/prelude/Prelude.purs","start":[338,86]},[]],"contents":{"kind":{"annotation":[{"end":[338,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[338,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"deserializeInterval","moduleName":["Prelude"]}},"annotation":{"meta":null,"sourceSpan":{"end":[237,64],"start":[237,24]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[237,64],"start":[237,44]}},"kind":"Var","type":{"annotation":[{"end":[168,57],"name":"tests/purus/passing/prelude/Prelude.purs","start":[168,25]},[]],"contents":[{"annotation":[{"end":[168,57],"name":"tests/purus/passing/prelude/Prelude.purs","start":[168,25]},[]],"contents":[{"annotation":[{"end":[168,47],"name":"tests/purus/passing/prelude/Prelude.purs","start":[168,45]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[168,44],"name":"tests/purus/passing/prelude/Prelude.purs","start":[168,25]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[168,57],"name":"tests/purus/passing/prelude/Prelude.purs","start":[168,48]},[]],"contents":[["Prim"],"POSIXTime"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"deserializePOSIXTime","moduleName":["Prelude"]}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[237,93],"start":[237,24]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[237,82],"start":[237,66]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"headList","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[237,92],"start":[237,66]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[237,92],"start":[237,83]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"unlisted7","sourcePos":[236,7]}},"kind":"App"},"kind":"App"},"identifier":"validTimeRange"},{"annotation":{"meta":null,"sourceSpan":{"end":[235,106],"start":[235,7]}},"bindType":"NonRec","expression":{"abstraction":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[235,33],"start":[235,14]}},"kind":"Var","type":{"annotation":[{"end":[414,15],"name":"tests/purus/passing/prelude/Prelude.purs","start":[410,3]},[]],"contents":{"identifier":"k","kind":{"annotation":[{"end":[410,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[410,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":238,"type":{"annotation":[{"end":[414,15],"name":"tests/purus/passing/prelude/Prelude.purs","start":[410,23]},[]],"contents":{"identifier":"v","kind":{"annotation":[{"end":[410,32],"name":"tests/purus/passing/prelude/Prelude.purs","start":[410,28]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":237,"type":{"annotation":[{"end":[414,15],"name":"tests/purus/passing/prelude/Prelude.purs","start":[411,3]},[]],"contents":[{"annotation":[{"end":[414,15],"name":"tests/purus/passing/prelude/Prelude.purs","start":[411,3]},[]],"contents":[{"annotation":[{"end":[411,32],"name":"tests/purus/passing/prelude/Prelude.purs","start":[411,30]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[411,28],"name":"tests/purus/passing/prelude/Prelude.purs","start":[411,4]},[]],"contents":[{"annotation":[{"end":[411,28],"name":"tests/purus/passing/prelude/Prelude.purs","start":[411,4]},[]],"contents":[{"annotation":[{"end":[411,26],"name":"tests/purus/passing/prelude/Prelude.purs","start":[411,24]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[411,23],"name":"tests/purus/passing/prelude/Prelude.purs","start":[411,4]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[411,28],"name":"tests/purus/passing/prelude/Prelude.purs","start":[411,27]},[]],"contents":{"kind":{"annotation":[{"end":[410,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[410,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"k"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[414,15],"name":"tests/purus/passing/prelude/Prelude.purs","start":[412,3]},[]],"contents":[{"annotation":[{"end":[414,15],"name":"tests/purus/passing/prelude/Prelude.purs","start":[412,3]},[]],"contents":[{"annotation":[{"end":[412,32],"name":"tests/purus/passing/prelude/Prelude.purs","start":[412,30]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[412,28],"name":"tests/purus/passing/prelude/Prelude.purs","start":[412,4]},[]],"contents":[{"annotation":[{"end":[412,28],"name":"tests/purus/passing/prelude/Prelude.purs","start":[412,4]},[]],"contents":[{"annotation":[{"end":[412,26],"name":"tests/purus/passing/prelude/Prelude.purs","start":[412,24]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[412,23],"name":"tests/purus/passing/prelude/Prelude.purs","start":[412,4]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[412,28],"name":"tests/purus/passing/prelude/Prelude.purs","start":[412,27]},[]],"contents":{"kind":{"annotation":[{"end":[410,32],"name":"tests/purus/passing/prelude/Prelude.purs","start":[410,28]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"v"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[414,15],"name":"tests/purus/passing/prelude/Prelude.purs","start":[413,3]},[]],"contents":[{"annotation":[{"end":[414,15],"name":"tests/purus/passing/prelude/Prelude.purs","start":[413,3]},[]],"contents":[{"annotation":[{"end":[413,25],"name":"tests/purus/passing/prelude/Prelude.purs","start":[413,23]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[413,22],"name":"tests/purus/passing/prelude/Prelude.purs","start":[413,3]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[414,15],"name":"tests/purus/passing/prelude/Prelude.purs","start":[414,3]},[]],"contents":[{"annotation":[{"end":[414,13],"name":"tests/purus/passing/prelude/Prelude.purs","start":[414,3]},[]],"contents":[{"annotation":[{"end":[414,11],"name":"tests/purus/passing/prelude/Prelude.purs","start":[414,3]},[]],"contents":[["Prim"],"AssocMap"],"tag":"TypeConstructor"},{"annotation":[{"end":[414,13],"name":"tests/purus/passing/prelude/Prelude.purs","start":[414,12]},[]],"contents":{"kind":{"annotation":[{"end":[410,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[410,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"k"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[414,15],"name":"tests/purus/passing/prelude/Prelude.purs","start":[414,14]},[]],"contents":{"kind":{"annotation":[{"end":[410,32],"name":"tests/purus/passing/prelude/Prelude.purs","start":[410,28]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"v"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"deserializeAssocMap","moduleName":["Prelude"]}},"annotation":{"meta":null,"sourceSpan":{"end":[235,62],"start":[235,14]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[235,62],"start":[235,34]}},"kind":"Var","type":{"annotation":[{"end":[110,73],"name":"tests/purus/passing/prelude/Prelude.purs","start":[110,33]},[]],"contents":[{"annotation":[{"end":[110,73],"name":"tests/purus/passing/prelude/Prelude.purs","start":[110,33]},[]],"contents":[{"annotation":[{"end":[110,55],"name":"tests/purus/passing/prelude/Prelude.purs","start":[110,53]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[110,52],"name":"tests/purus/passing/prelude/Prelude.purs","start":[110,33]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[110,73],"name":"tests/purus/passing/prelude/Prelude.purs","start":[110,56]},[]],"contents":[["Prim"],"StakingCredential"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"deserializeStakingCredential","moduleName":["Prelude"]}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[235,77],"start":[235,14]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[235,77],"start":[235,63]}},"kind":"Var","type":{"annotation":[{"end":[461,45],"name":"tests/purus/passing/prelude/Prelude.purs","start":[461,19]},[]],"contents":[{"annotation":[{"end":[461,45],"name":"tests/purus/passing/prelude/Prelude.purs","start":[461,19]},[]],"contents":[{"annotation":[{"end":[461,41],"name":"tests/purus/passing/prelude/Prelude.purs","start":[461,39]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[461,38],"name":"tests/purus/passing/prelude/Prelude.purs","start":[461,19]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[461,45],"name":"tests/purus/passing/prelude/Prelude.purs","start":[461,42]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"deserializeInt","moduleName":["Prelude"]}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[235,106],"start":[235,14]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[235,95],"start":[235,79]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"headList","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[235,105],"start":[235,79]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[235,105],"start":[235,96]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"unlisted6","sourcePos":[234,7]}},"kind":"App"},"kind":"App"},"identifier":"wdrl"},{"annotation":{"meta":null,"sourceSpan":{"end":[239,87],"start":[239,7]}},"bindType":"NonRec","expression":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[239,36],"start":[239,21]}},"kind":"Var","type":{"annotation":[{"end":[480,83],"name":"tests/purus/passing/prelude/Prelude.purs","start":[480,3]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[480,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[480,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":151,"type":{"annotation":[{"end":[480,83],"name":"tests/purus/passing/prelude/Prelude.purs","start":[480,24]},[]],"contents":[{"annotation":[{"end":[480,83],"name":"tests/purus/passing/prelude/Prelude.purs","start":[480,24]},[]],"contents":[{"annotation":[{"end":[480,53],"name":"tests/purus/passing/prelude/Prelude.purs","start":[480,51]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[480,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[480,25]},[]],"contents":[{"annotation":[{"end":[480,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[480,25]},[]],"contents":[{"annotation":[{"end":[480,47],"name":"tests/purus/passing/prelude/Prelude.purs","start":[480,45]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[480,44],"name":"tests/purus/passing/prelude/Prelude.purs","start":[480,25]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[480,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[480,48]},[]],"contents":{"kind":{"annotation":[{"end":[480,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[480,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[480,83],"name":"tests/purus/passing/prelude/Prelude.purs","start":[480,54]},[]],"contents":[{"annotation":[{"end":[480,83],"name":"tests/purus/passing/prelude/Prelude.purs","start":[480,54]},[]],"contents":[{"annotation":[{"end":[480,76],"name":"tests/purus/passing/prelude/Prelude.purs","start":[480,74]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[480,73],"name":"tests/purus/passing/prelude/Prelude.purs","start":[480,54]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[480,83],"name":"tests/purus/passing/prelude/Prelude.purs","start":[480,77]},[]],"contents":[{"annotation":[{"end":[480,81],"name":"tests/purus/passing/prelude/Prelude.purs","start":[480,77]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[480,83],"name":"tests/purus/passing/prelude/Prelude.purs","start":[480,82]},[]],"contents":{"kind":{"annotation":[{"end":[480,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[480,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"deserializeList","moduleName":["Prelude"]}},"annotation":{"meta":null,"sourceSpan":{"end":[239,58],"start":[239,21]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[239,58],"start":[239,37]}},"kind":"Var","type":{"annotation":[{"end":[190,59],"name":"tests/purus/passing/prelude/Prelude.purs","start":[190,26]},[]],"contents":[{"annotation":[{"end":[190,59],"name":"tests/purus/passing/prelude/Prelude.purs","start":[190,26]},[]],"contents":[{"annotation":[{"end":[190,48],"name":"tests/purus/passing/prelude/Prelude.purs","start":[190,46]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[190,45],"name":"tests/purus/passing/prelude/Prelude.purs","start":[190,26]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[190,59],"name":"tests/purus/passing/prelude/Prelude.purs","start":[190,49]},[]],"contents":[["Prim"],"PubKeyHash"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"deserializePubKeyHash","moduleName":["Prelude"]}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[239,87],"start":[239,21]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[239,76],"start":[239,60]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"headList","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[239,86],"start":[239,60]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[239,86],"start":[239,77]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"unlisted8","sourcePos":[238,7]}},"kind":"App"},"kind":"App"},"identifier":"signatories"},{"annotation":{"meta":null,"sourceSpan":{"end":[225,89],"start":[225,7]}},"bindType":"NonRec","expression":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[225,40],"start":[225,25]}},"kind":"Var","type":{"annotation":[{"end":[480,83],"name":"tests/purus/passing/prelude/Prelude.purs","start":[480,3]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[480,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[480,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":151,"type":{"annotation":[{"end":[480,83],"name":"tests/purus/passing/prelude/Prelude.purs","start":[480,24]},[]],"contents":[{"annotation":[{"end":[480,83],"name":"tests/purus/passing/prelude/Prelude.purs","start":[480,24]},[]],"contents":[{"annotation":[{"end":[480,53],"name":"tests/purus/passing/prelude/Prelude.purs","start":[480,51]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[480,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[480,25]},[]],"contents":[{"annotation":[{"end":[480,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[480,25]},[]],"contents":[{"annotation":[{"end":[480,47],"name":"tests/purus/passing/prelude/Prelude.purs","start":[480,45]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[480,44],"name":"tests/purus/passing/prelude/Prelude.purs","start":[480,25]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[480,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[480,48]},[]],"contents":{"kind":{"annotation":[{"end":[480,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[480,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[480,83],"name":"tests/purus/passing/prelude/Prelude.purs","start":[480,54]},[]],"contents":[{"annotation":[{"end":[480,83],"name":"tests/purus/passing/prelude/Prelude.purs","start":[480,54]},[]],"contents":[{"annotation":[{"end":[480,76],"name":"tests/purus/passing/prelude/Prelude.purs","start":[480,74]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[480,73],"name":"tests/purus/passing/prelude/Prelude.purs","start":[480,54]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[480,83],"name":"tests/purus/passing/prelude/Prelude.purs","start":[480,77]},[]],"contents":[{"annotation":[{"end":[480,81],"name":"tests/purus/passing/prelude/Prelude.purs","start":[480,77]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[480,83],"name":"tests/purus/passing/prelude/Prelude.purs","start":[480,82]},[]],"contents":{"kind":{"annotation":[{"end":[480,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[480,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"deserializeList","moduleName":["Prelude"]}},"annotation":{"meta":null,"sourceSpan":{"end":[225,60],"start":[225,25]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[225,60],"start":[225,41]}},"kind":"Var","type":{"annotation":[{"end":[304,55],"name":"tests/purus/passing/prelude/Prelude.purs","start":[304,24]},[]],"contents":[{"annotation":[{"end":[304,55],"name":"tests/purus/passing/prelude/Prelude.purs","start":[304,24]},[]],"contents":[{"annotation":[{"end":[304,46],"name":"tests/purus/passing/prelude/Prelude.purs","start":[304,44]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[304,43],"name":"tests/purus/passing/prelude/Prelude.purs","start":[304,24]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[304,55],"name":"tests/purus/passing/prelude/Prelude.purs","start":[304,47]},[]],"contents":[["Prim"],"TxInInfo"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"deserializeTxInInfo","moduleName":["Prelude"]}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[225,89],"start":[225,25]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[225,78],"start":[225,62]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"headList","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[225,88],"start":[225,62]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[225,88],"start":[225,79]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"unlisted1","sourcePos":[224,7]}},"kind":"App"},"kind":"App"},"identifier":"referenceInputs"},{"annotation":{"meta":null,"sourceSpan":{"end":[241,112],"start":[241,7]}},"bindType":"NonRec","expression":{"abstraction":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[241,38],"start":[241,19]}},"kind":"Var","type":{"annotation":[{"end":[414,15],"name":"tests/purus/passing/prelude/Prelude.purs","start":[410,3]},[]],"contents":{"identifier":"k","kind":{"annotation":[{"end":[410,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[410,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":238,"type":{"annotation":[{"end":[414,15],"name":"tests/purus/passing/prelude/Prelude.purs","start":[410,23]},[]],"contents":{"identifier":"v","kind":{"annotation":[{"end":[410,32],"name":"tests/purus/passing/prelude/Prelude.purs","start":[410,28]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":237,"type":{"annotation":[{"end":[414,15],"name":"tests/purus/passing/prelude/Prelude.purs","start":[411,3]},[]],"contents":[{"annotation":[{"end":[414,15],"name":"tests/purus/passing/prelude/Prelude.purs","start":[411,3]},[]],"contents":[{"annotation":[{"end":[411,32],"name":"tests/purus/passing/prelude/Prelude.purs","start":[411,30]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[411,28],"name":"tests/purus/passing/prelude/Prelude.purs","start":[411,4]},[]],"contents":[{"annotation":[{"end":[411,28],"name":"tests/purus/passing/prelude/Prelude.purs","start":[411,4]},[]],"contents":[{"annotation":[{"end":[411,26],"name":"tests/purus/passing/prelude/Prelude.purs","start":[411,24]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[411,23],"name":"tests/purus/passing/prelude/Prelude.purs","start":[411,4]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[411,28],"name":"tests/purus/passing/prelude/Prelude.purs","start":[411,27]},[]],"contents":{"kind":{"annotation":[{"end":[410,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[410,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"k"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[414,15],"name":"tests/purus/passing/prelude/Prelude.purs","start":[412,3]},[]],"contents":[{"annotation":[{"end":[414,15],"name":"tests/purus/passing/prelude/Prelude.purs","start":[412,3]},[]],"contents":[{"annotation":[{"end":[412,32],"name":"tests/purus/passing/prelude/Prelude.purs","start":[412,30]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[412,28],"name":"tests/purus/passing/prelude/Prelude.purs","start":[412,4]},[]],"contents":[{"annotation":[{"end":[412,28],"name":"tests/purus/passing/prelude/Prelude.purs","start":[412,4]},[]],"contents":[{"annotation":[{"end":[412,26],"name":"tests/purus/passing/prelude/Prelude.purs","start":[412,24]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[412,23],"name":"tests/purus/passing/prelude/Prelude.purs","start":[412,4]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[412,28],"name":"tests/purus/passing/prelude/Prelude.purs","start":[412,27]},[]],"contents":{"kind":{"annotation":[{"end":[410,32],"name":"tests/purus/passing/prelude/Prelude.purs","start":[410,28]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"v"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[414,15],"name":"tests/purus/passing/prelude/Prelude.purs","start":[413,3]},[]],"contents":[{"annotation":[{"end":[414,15],"name":"tests/purus/passing/prelude/Prelude.purs","start":[413,3]},[]],"contents":[{"annotation":[{"end":[413,25],"name":"tests/purus/passing/prelude/Prelude.purs","start":[413,23]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[413,22],"name":"tests/purus/passing/prelude/Prelude.purs","start":[413,3]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[414,15],"name":"tests/purus/passing/prelude/Prelude.purs","start":[414,3]},[]],"contents":[{"annotation":[{"end":[414,13],"name":"tests/purus/passing/prelude/Prelude.purs","start":[414,3]},[]],"contents":[{"annotation":[{"end":[414,11],"name":"tests/purus/passing/prelude/Prelude.purs","start":[414,3]},[]],"contents":[["Prim"],"AssocMap"],"tag":"TypeConstructor"},{"annotation":[{"end":[414,13],"name":"tests/purus/passing/prelude/Prelude.purs","start":[414,12]},[]],"contents":{"kind":{"annotation":[{"end":[410,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[410,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"k"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[414,15],"name":"tests/purus/passing/prelude/Prelude.purs","start":[414,14]},[]],"contents":{"kind":{"annotation":[{"end":[410,32],"name":"tests/purus/passing/prelude/Prelude.purs","start":[410,28]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"v"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"deserializeAssocMap","moduleName":["Prelude"]}},"annotation":{"meta":null,"sourceSpan":{"end":[241,63],"start":[241,19]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[241,63],"start":[241,39]}},"kind":"Var","type":{"annotation":[{"end":[29,65],"name":"tests/purus/passing/prelude/Prelude.purs","start":[29,29]},[]],"contents":[{"annotation":[{"end":[29,65],"name":"tests/purus/passing/prelude/Prelude.purs","start":[29,29]},[]],"contents":[{"annotation":[{"end":[29,51],"name":"tests/purus/passing/prelude/Prelude.purs","start":[29,49]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[29,48],"name":"tests/purus/passing/prelude/Prelude.purs","start":[29,29]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[29,65],"name":"tests/purus/passing/prelude/Prelude.purs","start":[29,52]},[]],"contents":[["Prim"],"ScriptPurpose"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"deserializeScriptPurpose","moduleName":["Prelude"]}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[241,83],"start":[241,19]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[241,83],"start":[241,64]}},"kind":"Var","type":{"annotation":[{"end":[437,55],"name":"tests/purus/passing/prelude/Prelude.purs","start":[437,24]},[]],"contents":[{"annotation":[{"end":[437,55],"name":"tests/purus/passing/prelude/Prelude.purs","start":[437,24]},[]],"contents":[{"annotation":[{"end":[437,46],"name":"tests/purus/passing/prelude/Prelude.purs","start":[437,44]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[437,43],"name":"tests/purus/passing/prelude/Prelude.purs","start":[437,24]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[437,55],"name":"tests/purus/passing/prelude/Prelude.purs","start":[437,47]},[]],"contents":[["Prim"],"Redeemer"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"deserializeRedeemer","moduleName":["Prelude"]}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[241,112],"start":[241,19]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[241,101],"start":[241,85]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"headList","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[241,111],"start":[241,85]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[241,111],"start":[241,102]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"unlisted9","sourcePos":[240,7]}},"kind":"App"},"kind":"App"},"identifier":"redeemers"},{"annotation":{"meta":null,"sourceSpan":{"end":[227,79],"start":[227,7]}},"bindType":"NonRec","expression":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[227,33],"start":[227,18]}},"kind":"Var","type":{"annotation":[{"end":[480,83],"name":"tests/purus/passing/prelude/Prelude.purs","start":[480,3]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[480,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[480,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":151,"type":{"annotation":[{"end":[480,83],"name":"tests/purus/passing/prelude/Prelude.purs","start":[480,24]},[]],"contents":[{"annotation":[{"end":[480,83],"name":"tests/purus/passing/prelude/Prelude.purs","start":[480,24]},[]],"contents":[{"annotation":[{"end":[480,53],"name":"tests/purus/passing/prelude/Prelude.purs","start":[480,51]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[480,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[480,25]},[]],"contents":[{"annotation":[{"end":[480,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[480,25]},[]],"contents":[{"annotation":[{"end":[480,47],"name":"tests/purus/passing/prelude/Prelude.purs","start":[480,45]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[480,44],"name":"tests/purus/passing/prelude/Prelude.purs","start":[480,25]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[480,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[480,48]},[]],"contents":{"kind":{"annotation":[{"end":[480,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[480,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[480,83],"name":"tests/purus/passing/prelude/Prelude.purs","start":[480,54]},[]],"contents":[{"annotation":[{"end":[480,83],"name":"tests/purus/passing/prelude/Prelude.purs","start":[480,54]},[]],"contents":[{"annotation":[{"end":[480,76],"name":"tests/purus/passing/prelude/Prelude.purs","start":[480,74]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[480,73],"name":"tests/purus/passing/prelude/Prelude.purs","start":[480,54]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[480,83],"name":"tests/purus/passing/prelude/Prelude.purs","start":[480,77]},[]],"contents":[{"annotation":[{"end":[480,81],"name":"tests/purus/passing/prelude/Prelude.purs","start":[480,77]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[480,83],"name":"tests/purus/passing/prelude/Prelude.purs","start":[480,82]},[]],"contents":{"kind":{"annotation":[{"end":[480,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[480,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"deserializeList","moduleName":["Prelude"]}},"annotation":{"meta":null,"sourceSpan":{"end":[227,50],"start":[227,18]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[227,50],"start":[227,34]}},"kind":"Var","type":{"annotation":[{"end":[268,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[268,21]},[]],"contents":[{"annotation":[{"end":[268,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[268,21]},[]],"contents":[{"annotation":[{"end":[268,43],"name":"tests/purus/passing/prelude/Prelude.purs","start":[268,41]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[268,40],"name":"tests/purus/passing/prelude/Prelude.purs","start":[268,21]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[268,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[268,44]},[]],"contents":[["Prim"],"TxOut"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"deserializeTxOut","moduleName":["Prelude"]}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[227,79],"start":[227,18]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[227,68],"start":[227,52]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"headList","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[227,78],"start":[227,52]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[227,78],"start":[227,69]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"unlisted2","sourcePos":[226,7]}},"kind":"App"},"kind":"App"},"identifier":"outputs"},{"annotation":{"meta":null,"sourceSpan":{"end":[231,59],"start":[231,7]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[231,30],"start":[231,14]}},"kind":"Var","type":{"annotation":[{"end":[142,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[142,21]},[]],"contents":[{"annotation":[{"end":[142,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[142,21]},[]],"contents":[{"annotation":[{"end":[142,43],"name":"tests/purus/passing/prelude/Prelude.purs","start":[142,41]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[142,40],"name":"tests/purus/passing/prelude/Prelude.purs","start":[142,21]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[142,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[142,44]},[]],"contents":[["Prim"],"Value"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"deserializeValue","moduleName":["Prelude"]}},"annotation":{"meta":null,"sourceSpan":{"end":[231,59],"start":[231,14]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[231,48],"start":[231,32]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"headList","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[231,58],"start":[231,32]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[231,58],"start":[231,49]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"unlisted4","sourcePos":[230,7]}},"kind":"App"},"kind":"App"},"identifier":"mint"},{"annotation":{"meta":null,"sourceSpan":{"end":[223,80],"start":[223,7]}},"bindType":"NonRec","expression":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[223,32],"start":[223,17]}},"kind":"Var","type":{"annotation":[{"end":[480,83],"name":"tests/purus/passing/prelude/Prelude.purs","start":[480,3]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[480,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[480,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":151,"type":{"annotation":[{"end":[480,83],"name":"tests/purus/passing/prelude/Prelude.purs","start":[480,24]},[]],"contents":[{"annotation":[{"end":[480,83],"name":"tests/purus/passing/prelude/Prelude.purs","start":[480,24]},[]],"contents":[{"annotation":[{"end":[480,53],"name":"tests/purus/passing/prelude/Prelude.purs","start":[480,51]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[480,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[480,25]},[]],"contents":[{"annotation":[{"end":[480,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[480,25]},[]],"contents":[{"annotation":[{"end":[480,47],"name":"tests/purus/passing/prelude/Prelude.purs","start":[480,45]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[480,44],"name":"tests/purus/passing/prelude/Prelude.purs","start":[480,25]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[480,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[480,48]},[]],"contents":{"kind":{"annotation":[{"end":[480,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[480,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[480,83],"name":"tests/purus/passing/prelude/Prelude.purs","start":[480,54]},[]],"contents":[{"annotation":[{"end":[480,83],"name":"tests/purus/passing/prelude/Prelude.purs","start":[480,54]},[]],"contents":[{"annotation":[{"end":[480,76],"name":"tests/purus/passing/prelude/Prelude.purs","start":[480,74]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[480,73],"name":"tests/purus/passing/prelude/Prelude.purs","start":[480,54]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[480,83],"name":"tests/purus/passing/prelude/Prelude.purs","start":[480,77]},[]],"contents":[{"annotation":[{"end":[480,81],"name":"tests/purus/passing/prelude/Prelude.purs","start":[480,77]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[480,83],"name":"tests/purus/passing/prelude/Prelude.purs","start":[480,82]},[]],"contents":{"kind":{"annotation":[{"end":[480,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[480,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"deserializeList","moduleName":["Prelude"]}},"annotation":{"meta":null,"sourceSpan":{"end":[223,52],"start":[223,17]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[223,52],"start":[223,33]}},"kind":"Var","type":{"annotation":[{"end":[304,55],"name":"tests/purus/passing/prelude/Prelude.purs","start":[304,24]},[]],"contents":[{"annotation":[{"end":[304,55],"name":"tests/purus/passing/prelude/Prelude.purs","start":[304,24]},[]],"contents":[{"annotation":[{"end":[304,46],"name":"tests/purus/passing/prelude/Prelude.purs","start":[304,44]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[304,43],"name":"tests/purus/passing/prelude/Prelude.purs","start":[304,24]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[304,55],"name":"tests/purus/passing/prelude/Prelude.purs","start":[304,47]},[]],"contents":[["Prim"],"TxInInfo"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"deserializeTxInInfo","moduleName":["Prelude"]}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[223,80],"start":[223,17]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[223,70],"start":[223,54]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"headList","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[223,79],"start":[223,54]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[223,79],"start":[223,71]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"unlisted","sourcePos":[222,7]}},"kind":"App"},"kind":"App"},"identifier":"inputs"},{"annotation":{"meta":null,"sourceSpan":{"end":[245,58],"start":[245,7]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[245,28],"start":[245,13]}},"kind":"Var","type":{"annotation":[{"end":[198,47],"name":"tests/purus/passing/prelude/Prelude.purs","start":[198,20]},[]],"contents":[{"annotation":[{"end":[198,47],"name":"tests/purus/passing/prelude/Prelude.purs","start":[198,20]},[]],"contents":[{"annotation":[{"end":[198,42],"name":"tests/purus/passing/prelude/Prelude.purs","start":[198,40]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[198,39],"name":"tests/purus/passing/prelude/Prelude.purs","start":[198,20]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[198,47],"name":"tests/purus/passing/prelude/Prelude.purs","start":[198,43]},[]],"contents":[["Prim"],"TxId"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"deserializeTxId","moduleName":["Prelude"]}},"annotation":{"meta":null,"sourceSpan":{"end":[245,58],"start":[245,13]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[245,46],"start":[245,30]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"headList","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[245,57],"start":[245,30]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[245,57],"start":[245,47]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"unlisted11","sourcePos":[244,7]}},"kind":"App"},"kind":"App"},"identifier":"id1"},{"annotation":{"meta":null,"sourceSpan":{"end":[229,58],"start":[229,7]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[229,29],"start":[229,13]}},"kind":"Var","type":{"annotation":[{"end":[142,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[142,21]},[]],"contents":[{"annotation":[{"end":[142,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[142,21]},[]],"contents":[{"annotation":[{"end":[142,43],"name":"tests/purus/passing/prelude/Prelude.purs","start":[142,41]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[142,40],"name":"tests/purus/passing/prelude/Prelude.purs","start":[142,21]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[142,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[142,44]},[]],"contents":[["Prim"],"Value"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"deserializeValue","moduleName":["Prelude"]}},"annotation":{"meta":null,"sourceSpan":{"end":[229,58],"start":[229,13]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[229,47],"start":[229,31]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"headList","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[229,57],"start":[229,31]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[229,57],"start":[229,48]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"unlisted3","sourcePos":[228,7]}},"kind":"App"},"kind":"App"},"identifier":"fee"},{"annotation":{"meta":null,"sourceSpan":{"end":[243,102],"start":[243,7]}},"bindType":"NonRec","expression":{"abstraction":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[243,34],"start":[243,15]}},"kind":"Var","type":{"annotation":[{"end":[414,15],"name":"tests/purus/passing/prelude/Prelude.purs","start":[410,3]},[]],"contents":{"identifier":"k","kind":{"annotation":[{"end":[410,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[410,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":238,"type":{"annotation":[{"end":[414,15],"name":"tests/purus/passing/prelude/Prelude.purs","start":[410,23]},[]],"contents":{"identifier":"v","kind":{"annotation":[{"end":[410,32],"name":"tests/purus/passing/prelude/Prelude.purs","start":[410,28]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":237,"type":{"annotation":[{"end":[414,15],"name":"tests/purus/passing/prelude/Prelude.purs","start":[411,3]},[]],"contents":[{"annotation":[{"end":[414,15],"name":"tests/purus/passing/prelude/Prelude.purs","start":[411,3]},[]],"contents":[{"annotation":[{"end":[411,32],"name":"tests/purus/passing/prelude/Prelude.purs","start":[411,30]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[411,28],"name":"tests/purus/passing/prelude/Prelude.purs","start":[411,4]},[]],"contents":[{"annotation":[{"end":[411,28],"name":"tests/purus/passing/prelude/Prelude.purs","start":[411,4]},[]],"contents":[{"annotation":[{"end":[411,26],"name":"tests/purus/passing/prelude/Prelude.purs","start":[411,24]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[411,23],"name":"tests/purus/passing/prelude/Prelude.purs","start":[411,4]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[411,28],"name":"tests/purus/passing/prelude/Prelude.purs","start":[411,27]},[]],"contents":{"kind":{"annotation":[{"end":[410,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[410,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"k"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[414,15],"name":"tests/purus/passing/prelude/Prelude.purs","start":[412,3]},[]],"contents":[{"annotation":[{"end":[414,15],"name":"tests/purus/passing/prelude/Prelude.purs","start":[412,3]},[]],"contents":[{"annotation":[{"end":[412,32],"name":"tests/purus/passing/prelude/Prelude.purs","start":[412,30]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[412,28],"name":"tests/purus/passing/prelude/Prelude.purs","start":[412,4]},[]],"contents":[{"annotation":[{"end":[412,28],"name":"tests/purus/passing/prelude/Prelude.purs","start":[412,4]},[]],"contents":[{"annotation":[{"end":[412,26],"name":"tests/purus/passing/prelude/Prelude.purs","start":[412,24]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[412,23],"name":"tests/purus/passing/prelude/Prelude.purs","start":[412,4]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[412,28],"name":"tests/purus/passing/prelude/Prelude.purs","start":[412,27]},[]],"contents":{"kind":{"annotation":[{"end":[410,32],"name":"tests/purus/passing/prelude/Prelude.purs","start":[410,28]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"v"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[414,15],"name":"tests/purus/passing/prelude/Prelude.purs","start":[413,3]},[]],"contents":[{"annotation":[{"end":[414,15],"name":"tests/purus/passing/prelude/Prelude.purs","start":[413,3]},[]],"contents":[{"annotation":[{"end":[413,25],"name":"tests/purus/passing/prelude/Prelude.purs","start":[413,23]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[413,22],"name":"tests/purus/passing/prelude/Prelude.purs","start":[413,3]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[414,15],"name":"tests/purus/passing/prelude/Prelude.purs","start":[414,3]},[]],"contents":[{"annotation":[{"end":[414,13],"name":"tests/purus/passing/prelude/Prelude.purs","start":[414,3]},[]],"contents":[{"annotation":[{"end":[414,11],"name":"tests/purus/passing/prelude/Prelude.purs","start":[414,3]},[]],"contents":[["Prim"],"AssocMap"],"tag":"TypeConstructor"},{"annotation":[{"end":[414,13],"name":"tests/purus/passing/prelude/Prelude.purs","start":[414,12]},[]],"contents":{"kind":{"annotation":[{"end":[410,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[410,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"k"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[414,15],"name":"tests/purus/passing/prelude/Prelude.purs","start":[414,14]},[]],"contents":{"kind":{"annotation":[{"end":[410,32],"name":"tests/purus/passing/prelude/Prelude.purs","start":[410,28]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"v"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"deserializeAssocMap","moduleName":["Prelude"]}},"annotation":{"meta":null,"sourceSpan":{"end":[243,55],"start":[243,15]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[243,55],"start":[243,35]}},"kind":"Var","type":{"annotation":[{"end":[455,57],"name":"tests/purus/passing/prelude/Prelude.purs","start":[455,25]},[]],"contents":[{"annotation":[{"end":[455,57],"name":"tests/purus/passing/prelude/Prelude.purs","start":[455,25]},[]],"contents":[{"annotation":[{"end":[455,47],"name":"tests/purus/passing/prelude/Prelude.purs","start":[455,45]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[455,44],"name":"tests/purus/passing/prelude/Prelude.purs","start":[455,25]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[455,57],"name":"tests/purus/passing/prelude/Prelude.purs","start":[455,48]},[]],"contents":[["Prim"],"DatumHash"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"deserializeDatumHash","moduleName":["Prelude"]}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[243,72],"start":[243,15]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[243,72],"start":[243,56]}},"kind":"Var","type":{"annotation":[{"end":[449,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[449,21]},[]],"contents":[{"annotation":[{"end":[449,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[449,21]},[]],"contents":[{"annotation":[{"end":[449,43],"name":"tests/purus/passing/prelude/Prelude.purs","start":[449,41]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[449,40],"name":"tests/purus/passing/prelude/Prelude.purs","start":[449,21]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[449,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[449,44]},[]],"contents":[["Prim"],"Datum"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"deserializeDatum","moduleName":["Prelude"]}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[243,102],"start":[243,15]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[243,90],"start":[243,74]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"headList","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[243,101],"start":[243,74]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[243,101],"start":[243,91]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"unlisted10","sourcePos":[242,7]}},"kind":"App"},"kind":"App"},"identifier":"data1"},{"annotation":{"meta":null,"sourceSpan":{"end":[233,76],"start":[233,7]}},"bindType":"NonRec","expression":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[233,30],"start":[233,15]}},"kind":"Var","type":{"annotation":[{"end":[480,83],"name":"tests/purus/passing/prelude/Prelude.purs","start":[480,3]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[480,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[480,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":151,"type":{"annotation":[{"end":[480,83],"name":"tests/purus/passing/prelude/Prelude.purs","start":[480,24]},[]],"contents":[{"annotation":[{"end":[480,83],"name":"tests/purus/passing/prelude/Prelude.purs","start":[480,24]},[]],"contents":[{"annotation":[{"end":[480,53],"name":"tests/purus/passing/prelude/Prelude.purs","start":[480,51]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[480,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[480,25]},[]],"contents":[{"annotation":[{"end":[480,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[480,25]},[]],"contents":[{"annotation":[{"end":[480,47],"name":"tests/purus/passing/prelude/Prelude.purs","start":[480,45]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[480,44],"name":"tests/purus/passing/prelude/Prelude.purs","start":[480,25]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[480,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[480,48]},[]],"contents":{"kind":{"annotation":[{"end":[480,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[480,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[480,83],"name":"tests/purus/passing/prelude/Prelude.purs","start":[480,54]},[]],"contents":[{"annotation":[{"end":[480,83],"name":"tests/purus/passing/prelude/Prelude.purs","start":[480,54]},[]],"contents":[{"annotation":[{"end":[480,76],"name":"tests/purus/passing/prelude/Prelude.purs","start":[480,74]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[480,73],"name":"tests/purus/passing/prelude/Prelude.purs","start":[480,54]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[480,83],"name":"tests/purus/passing/prelude/Prelude.purs","start":[480,77]},[]],"contents":[{"annotation":[{"end":[480,81],"name":"tests/purus/passing/prelude/Prelude.purs","start":[480,77]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[480,83],"name":"tests/purus/passing/prelude/Prelude.purs","start":[480,82]},[]],"contents":{"kind":{"annotation":[{"end":[480,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[480,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"deserializeList","moduleName":["Prelude"]}},"annotation":{"meta":null,"sourceSpan":{"end":[233,47],"start":[233,15]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[233,47],"start":[233,31]}},"kind":"Var","type":{"annotation":[{"end":[72,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[72,21]},[]],"contents":[{"annotation":[{"end":[72,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[72,21]},[]],"contents":[{"annotation":[{"end":[72,43],"name":"tests/purus/passing/prelude/Prelude.purs","start":[72,41]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[72,40],"name":"tests/purus/passing/prelude/Prelude.purs","start":[72,21]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[72,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[72,44]},[]],"contents":[["Prim"],"DCert"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"deserializeDCert","moduleName":["Prelude"]}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[233,76],"start":[233,15]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[233,65],"start":[233,49]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"headList","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[233,75],"start":[233,49]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[233,75],"start":[233,66]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"unlisted5","sourcePos":[232,7]}},"kind":"App"},"kind":"App"},"identifier":"dCert"}],"expression":{"abstraction":{"annotation":{"meta":{"metaType":"IsNewtype"},"sourceSpan":{"end":[246,14],"start":[246,8]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["inputs",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"TxInInfo"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["referenceInputs",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"TxInInfo"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["outputs",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"TxOut"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["fee",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Value"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["mint",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Value"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["dCert",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"DCert"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["wdrl",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"AssocMap"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"StakingCredential"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["validRange",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Interval"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"POSIXTime"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["signatories",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"PubKeyHash"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["redeemers",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"AssocMap"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"ScriptPurpose"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Redeemer"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["data",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"AssocMap"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"DatumHash"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Datum"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["id",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"TxId"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"tag":"REmpty"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"TxInfo"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"TxInfo","moduleName":["Prim"]}},"annotation":{"meta":null,"sourceSpan":{"end":[258,16],"start":[246,8]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[258,16],"start":[246,15]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["inputs",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"TxInInfo"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["referenceInputs",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"TxInInfo"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["outputs",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"TxOut"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["fee",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Value"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["mint",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Value"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["dCert",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"DCert"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["wdrl",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"AssocMap"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"StakingCredential"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["validRange",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Interval"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"POSIXTime"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["signatories",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"PubKeyHash"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["redeemers",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"AssocMap"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"ScriptPurpose"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Redeemer"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["data",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"AssocMap"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"DatumHash"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Datum"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["id",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"TxId"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"tag":"REmpty"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"TypeApp"},"value":{"literalType":"ObjectLiteral","value":[["id",{"annotation":{"meta":null,"sourceSpan":{"end":[257,24],"start":[257,21]}},"kind":"Var","type":{"annotation":[{"end":[198,47],"name":"tests/purus/passing/prelude/Prelude.purs","start":[198,43]},[]],"contents":[["Prim"],"TxId"],"tag":"TypeConstructor"},"value":{"identifier":"id1","sourcePos":[245,7]}}],["data",{"annotation":{"meta":null,"sourceSpan":{"end":[256,28],"start":[256,23]}},"kind":"Var","type":{"annotation":[{"end":[414,15],"name":"tests/purus/passing/prelude/Prelude.purs","start":[414,3]},[]],"contents":[{"annotation":[{"end":[414,13],"name":"tests/purus/passing/prelude/Prelude.purs","start":[414,3]},[]],"contents":[{"annotation":[{"end":[414,11],"name":"tests/purus/passing/prelude/Prelude.purs","start":[414,3]},[]],"contents":[["Prim"],"AssocMap"],"tag":"TypeConstructor"},{"annotation":[{"end":[455,57],"name":"tests/purus/passing/prelude/Prelude.purs","start":[455,48]},[]],"contents":[["Prim"],"DatumHash"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[449,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[449,44]},[]],"contents":[["Prim"],"Datum"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"data1","sourcePos":[243,7]}}],["redeemers",{"annotation":{"meta":null,"sourceSpan":{"end":[255,37],"start":[255,28]}},"kind":"Var","type":{"annotation":[{"end":[414,15],"name":"tests/purus/passing/prelude/Prelude.purs","start":[414,3]},[]],"contents":[{"annotation":[{"end":[414,13],"name":"tests/purus/passing/prelude/Prelude.purs","start":[414,3]},[]],"contents":[{"annotation":[{"end":[414,11],"name":"tests/purus/passing/prelude/Prelude.purs","start":[414,3]},[]],"contents":[["Prim"],"AssocMap"],"tag":"TypeConstructor"},{"annotation":[{"end":[29,65],"name":"tests/purus/passing/prelude/Prelude.purs","start":[29,52]},[]],"contents":[["Prim"],"ScriptPurpose"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[437,55],"name":"tests/purus/passing/prelude/Prelude.purs","start":[437,47]},[]],"contents":[["Prim"],"Redeemer"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"redeemers","sourcePos":[241,7]}}],["signatories",{"annotation":{"meta":null,"sourceSpan":{"end":[254,41],"start":[254,30]}},"kind":"Var","type":{"annotation":[{"end":[480,83],"name":"tests/purus/passing/prelude/Prelude.purs","start":[480,77]},[]],"contents":[{"annotation":[{"end":[480,81],"name":"tests/purus/passing/prelude/Prelude.purs","start":[480,77]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[190,59],"name":"tests/purus/passing/prelude/Prelude.purs","start":[190,49]},[]],"contents":[["Prim"],"PubKeyHash"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"signatories","sourcePos":[239,7]}}],["validRange",{"annotation":{"meta":null,"sourceSpan":{"end":[253,43],"start":[253,29]}},"kind":"Var","type":{"annotation":[{"end":[338,87],"name":"tests/purus/passing/prelude/Prelude.purs","start":[338,77]},[]],"contents":[{"annotation":[{"end":[338,85],"name":"tests/purus/passing/prelude/Prelude.purs","start":[338,77]},[]],"contents":[["Prim"],"Interval"],"tag":"TypeConstructor"},{"annotation":[{"end":[168,57],"name":"tests/purus/passing/prelude/Prelude.purs","start":[168,48]},[]],"contents":[["Prim"],"POSIXTime"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"validTimeRange","sourcePos":[237,7]}}],["wdrl",{"annotation":{"meta":null,"sourceSpan":{"end":[252,27],"start":[252,23]}},"kind":"Var","type":{"annotation":[{"end":[414,15],"name":"tests/purus/passing/prelude/Prelude.purs","start":[414,3]},[]],"contents":[{"annotation":[{"end":[414,13],"name":"tests/purus/passing/prelude/Prelude.purs","start":[414,3]},[]],"contents":[{"annotation":[{"end":[414,11],"name":"tests/purus/passing/prelude/Prelude.purs","start":[414,3]},[]],"contents":[["Prim"],"AssocMap"],"tag":"TypeConstructor"},{"annotation":[{"end":[110,73],"name":"tests/purus/passing/prelude/Prelude.purs","start":[110,56]},[]],"contents":[["Prim"],"StakingCredential"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[461,45],"name":"tests/purus/passing/prelude/Prelude.purs","start":[461,42]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"wdrl","sourcePos":[235,7]}}],["dCert",{"annotation":{"meta":null,"sourceSpan":{"end":[251,29],"start":[251,24]}},"kind":"Var","type":{"annotation":[{"end":[480,83],"name":"tests/purus/passing/prelude/Prelude.purs","start":[480,77]},[]],"contents":[{"annotation":[{"end":[480,81],"name":"tests/purus/passing/prelude/Prelude.purs","start":[480,77]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[72,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[72,44]},[]],"contents":[["Prim"],"DCert"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"dCert","sourcePos":[233,7]}}],["mint",{"annotation":{"meta":null,"sourceSpan":{"end":[250,27],"start":[250,23]}},"kind":"Var","type":{"annotation":[{"end":[142,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[142,44]},[]],"contents":[["Prim"],"Value"],"tag":"TypeConstructor"},"value":{"identifier":"mint","sourcePos":[231,7]}}],["fee",{"annotation":{"meta":null,"sourceSpan":{"end":[249,25],"start":[249,22]}},"kind":"Var","type":{"annotation":[{"end":[142,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[142,44]},[]],"contents":[["Prim"],"Value"],"tag":"TypeConstructor"},"value":{"identifier":"fee","sourcePos":[229,7]}}],["outputs",{"annotation":{"meta":null,"sourceSpan":{"end":[248,33],"start":[248,26]}},"kind":"Var","type":{"annotation":[{"end":[480,83],"name":"tests/purus/passing/prelude/Prelude.purs","start":[480,77]},[]],"contents":[{"annotation":[{"end":[480,81],"name":"tests/purus/passing/prelude/Prelude.purs","start":[480,77]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[268,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[268,44]},[]],"contents":[["Prim"],"TxOut"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"outputs","sourcePos":[227,7]}}],["referenceInputs",{"annotation":{"meta":null,"sourceSpan":{"end":[247,49],"start":[247,34]}},"kind":"Var","type":{"annotation":[{"end":[480,83],"name":"tests/purus/passing/prelude/Prelude.purs","start":[480,77]},[]],"contents":[{"annotation":[{"end":[480,81],"name":"tests/purus/passing/prelude/Prelude.purs","start":[480,77]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[304,55],"name":"tests/purus/passing/prelude/Prelude.purs","start":[304,47]},[]],"contents":[["Prim"],"TxInInfo"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"referenceInputs","sourcePos":[225,7]}}],["inputs",{"annotation":{"meta":null,"sourceSpan":{"end":[246,31],"start":[246,25]}},"kind":"Var","type":{"annotation":[{"end":[480,83],"name":"tests/purus/passing/prelude/Prelude.purs","start":[480,77]},[]],"contents":[{"annotation":[{"end":[480,81],"name":"tests/purus/passing/prelude/Prelude.purs","start":[480,77]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[304,55],"name":"tests/purus/passing/prelude/Prelude.purs","start":[304,47]},[]],"contents":[["Prim"],"TxInInfo"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"inputs","sourcePos":[223,7]}}]]}},"kind":"App"},"kind":"Let"},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[220,41],"name":"tests/purus/passing/prelude/Prelude.purs","start":[220,22]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[220,51],"name":"tests/purus/passing/prelude/Prelude.purs","start":[220,45]},[]],"contents":[["Prim"],"TxInfo"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"identifier":"deserializeTxInfo"},{"annotation":{"meta":null,"sourceSpan":{"end":[9,65],"start":[9,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[16,58],"start":[10,1]}},"argument":"dat","body":{"annotation":{"meta":null,"sourceSpan":{"end":[16,58],"start":[11,3]}},"binds":[{"annotation":{"meta":null,"sourceSpan":{"end":[11,56],"start":[11,7]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[11,29],"start":[11,14]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"b","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinPair"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"b"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"b"},"tag":"TypeVar"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"sndPair","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[11,56],"start":[11,14]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[11,51],"start":[11,31]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinPair"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"unConstrData","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[11,55],"start":[11,31]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[11,55],"start":[11,52]}},"kind":"Var","type":{"annotation":[{"end":[9,48],"name":"tests/purus/passing/prelude/Prelude.purs","start":[9,29]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"},"value":{"identifier":"dat","sourcePos":[10,1]}},"kind":"App"},"kind":"App"},"identifier":"dat'"},{"annotation":{"meta":null,"sourceSpan":{"end":[12,41],"start":[12,7]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[12,36],"start":[12,18]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"value":{"identifier":"unListData","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[12,41],"start":[12,18]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[12,41],"start":[12,37]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"},"value":{"identifier":"dat'","sourcePos":[11,7]}},"kind":"App"},"identifier":"unlisted"},{"annotation":{"meta":null,"sourceSpan":{"end":[13,61],"start":[13,7]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[13,33],"start":[13,16]}},"kind":"Var","type":{"annotation":[{"end":[220,51],"name":"tests/purus/passing/prelude/Prelude.purs","start":[220,22]},[]],"contents":[{"annotation":[{"end":[220,51],"name":"tests/purus/passing/prelude/Prelude.purs","start":[220,22]},[]],"contents":[{"annotation":[{"end":[220,44],"name":"tests/purus/passing/prelude/Prelude.purs","start":[220,42]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[220,41],"name":"tests/purus/passing/prelude/Prelude.purs","start":[220,22]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[220,51],"name":"tests/purus/passing/prelude/Prelude.purs","start":[220,45]},[]],"contents":[["Prim"],"TxInfo"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"deserializeTxInfo","moduleName":["Prelude"]}},"annotation":{"meta":null,"sourceSpan":{"end":[13,61],"start":[13,16]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[13,51],"start":[13,35]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"headList","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[13,60],"start":[13,35]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[13,60],"start":[13,52]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"unlisted","sourcePos":[12,7]}},"kind":"App"},"kind":"App"},"identifier":"txInfo"},{"annotation":{"meta":null,"sourceSpan":{"end":[14,44],"start":[14,7]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[14,35],"start":[14,19]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"tailList","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[14,44],"start":[14,19]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[14,44],"start":[14,36]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"unlisted","sourcePos":[12,7]}},"kind":"App"},"identifier":"unlisted'"},{"annotation":{"meta":null,"sourceSpan":{"end":[15,70],"start":[15,7]}},"bindType":"NonRec","expression":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[15,41],"start":[15,17]}},"kind":"Var","type":{"annotation":[{"end":[29,65],"name":"tests/purus/passing/prelude/Prelude.purs","start":[29,29]},[]],"contents":[{"annotation":[{"end":[29,65],"name":"tests/purus/passing/prelude/Prelude.purs","start":[29,29]},[]],"contents":[{"annotation":[{"end":[29,51],"name":"tests/purus/passing/prelude/Prelude.purs","start":[29,49]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[29,48],"name":"tests/purus/passing/prelude/Prelude.purs","start":[29,29]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[29,65],"name":"tests/purus/passing/prelude/Prelude.purs","start":[29,52]},[]],"contents":[["Prim"],"ScriptPurpose"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"deserializeScriptPurpose","moduleName":["Prelude"]}},"annotation":{"meta":null,"sourceSpan":{"end":[15,70],"start":[15,17]}},"argument":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[15,59],"start":[15,43]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"headList","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[15,69],"start":[15,43]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[15,69],"start":[15,60]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinList"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"unlisted'","sourcePos":[14,7]}},"kind":"App"},"kind":"App"},"identifier":"purpose"}],"expression":{"abstraction":{"annotation":{"meta":{"metaType":"IsNewtype"},"sourceSpan":{"end":[16,21],"start":[16,8]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["txInfo",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"TxInfo"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["purpose",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"ScriptPurpose"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"tag":"REmpty"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"ScriptContext"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"ScriptContext","moduleName":["Prim"]}},"annotation":{"meta":null,"sourceSpan":{"end":[16,58],"start":[16,8]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[16,58],"start":[16,22]}},"kind":"Literal","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["txInfo",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"TxInfo"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":["purpose",{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"ScriptPurpose"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"tag":"REmpty"}],"tag":"RCons"}],"tag":"RCons"}],"tag":"TypeApp"},"value":{"literalType":"ObjectLiteral","value":[["purpose",{"annotation":{"meta":null,"sourceSpan":{"end":[16,56],"start":[16,49]}},"kind":"Var","type":{"annotation":[{"end":[29,65],"name":"tests/purus/passing/prelude/Prelude.purs","start":[29,52]},[]],"contents":[["Prim"],"ScriptPurpose"],"tag":"TypeConstructor"},"value":{"identifier":"purpose","sourcePos":[15,7]}}],["txInfo",{"annotation":{"meta":null,"sourceSpan":{"end":[16,38],"start":[16,32]}},"kind":"Var","type":{"annotation":[{"end":[220,51],"name":"tests/purus/passing/prelude/Prelude.purs","start":[220,45]},[]],"contents":[["Prim"],"TxInfo"],"tag":"TypeConstructor"},"value":{"identifier":"txInfo","sourcePos":[13,7]}}]]}},"kind":"App"},"kind":"Let"},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[9,48],"name":"tests/purus/passing/prelude/Prelude.purs","start":[9,29]},[]],"contents":[["Builtin"],"BuiltinData"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[9,65],"name":"tests/purus/passing/prelude/Prelude.purs","start":[9,52]},[]],"contents":[["Prim"],"ScriptContext"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"identifier":"deserializeScriptContext"},{"annotation":{"meta":null,"sourceSpan":{"end":[559,54],"start":[559,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[560,14],"start":[560,1]}},"argument":"v","body":{"annotation":{"meta":null,"sourceSpan":{"end":[560,14],"start":[560,1]}},"argument":"x","body":{"annotation":{"meta":null,"sourceSpan":{"end":[560,14],"start":[560,13]}},"kind":"Var","type":{"annotation":[{"end":[559,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[559,48]},[]],"contents":{"kind":{"annotation":[{"end":[559,39],"name":"tests/purus/passing/prelude/Prelude.purs","start":[559,35]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"b"},"tag":"TypeVar"},"value":{"identifier":"x","sourcePos":[560,1]}},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[559,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[559,48]},[]],"contents":{"kind":{"annotation":[{"end":[559,39],"name":"tests/purus/passing/prelude/Prelude.purs","start":[559,35]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"b"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[559,54],"name":"tests/purus/passing/prelude/Prelude.purs","start":[559,53]},[]],"contents":{"kind":{"annotation":[{"end":[559,39],"name":"tests/purus/passing/prelude/Prelude.purs","start":[559,35]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"b"},"tag":"TypeVar"}],"tag":"TypeApp"}},"kind":"Abs","type":{"annotation":[{"end":[559,54],"name":"tests/purus/passing/prelude/Prelude.purs","start":[559,10]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[559,27],"name":"tests/purus/passing/prelude/Prelude.purs","start":[559,23]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":304,"type":{"annotation":[{"end":[559,54],"name":"tests/purus/passing/prelude/Prelude.purs","start":[559,30]},[]],"contents":{"identifier":"b","kind":{"annotation":[{"end":[559,39],"name":"tests/purus/passing/prelude/Prelude.purs","start":[559,35]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":303,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[559,44],"name":"tests/purus/passing/prelude/Prelude.purs","start":[559,43]},[]],"contents":{"kind":{"annotation":[{"end":[559,27],"name":"tests/purus/passing/prelude/Prelude.purs","start":[559,23]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[559,54],"name":"tests/purus/passing/prelude/Prelude.purs","start":[559,48]},[]],"contents":[{"annotation":[{"end":[559,54],"name":"tests/purus/passing/prelude/Prelude.purs","start":[559,48]},[]],"contents":[{"annotation":[{"end":[559,52],"name":"tests/purus/passing/prelude/Prelude.purs","start":[559,50]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[559,49],"name":"tests/purus/passing/prelude/Prelude.purs","start":[559,48]},[]],"contents":{"kind":{"annotation":[{"end":[559,39],"name":"tests/purus/passing/prelude/Prelude.purs","start":[559,35]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"b"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[559,54],"name":"tests/purus/passing/prelude/Prelude.purs","start":[559,53]},[]],"contents":{"kind":{"annotation":[{"end":[559,39],"name":"tests/purus/passing/prelude/Prelude.purs","start":[559,35]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"b"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"identifier":"const"},{"annotation":{"meta":null,"sourceSpan":{"end":[683,4],"start":[679,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[684,16],"start":[684,1]}},"argument":"f","body":{"annotation":{"meta":null,"sourceSpan":{"end":[684,16],"start":[684,1]}},"argument":"x","body":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[684,14],"start":[684,13]}},"kind":"Var","type":{"annotation":[{"end":[681,10],"name":"tests/purus/passing/prelude/Prelude.purs","start":[681,4]},[]],"contents":[{"annotation":[{"end":[681,10],"name":"tests/purus/passing/prelude/Prelude.purs","start":[681,4]},[]],"contents":[{"annotation":[{"end":[681,8],"name":"tests/purus/passing/prelude/Prelude.purs","start":[681,6]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[681,5],"name":"tests/purus/passing/prelude/Prelude.purs","start":[681,4]},[]],"contents":{"kind":{"annotation":[{"end":[680,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[680,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[681,10],"name":"tests/purus/passing/prelude/Prelude.purs","start":[681,9]},[]],"contents":{"kind":{"annotation":[{"end":[680,32],"name":"tests/purus/passing/prelude/Prelude.purs","start":[680,28]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"b"},"tag":"TypeVar"}],"tag":"TypeApp"},"value":{"identifier":"f","sourcePos":[684,1]}},"annotation":{"meta":null,"sourceSpan":{"end":[684,16],"start":[684,13]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[684,16],"start":[684,15]}},"kind":"Var","type":{"annotation":[{"end":[682,4],"name":"tests/purus/passing/prelude/Prelude.purs","start":[682,3]},[]],"contents":{"kind":{"annotation":[{"end":[680,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[680,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"},"value":{"identifier":"x","sourcePos":[684,1]}},"kind":"App"},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[682,4],"name":"tests/purus/passing/prelude/Prelude.purs","start":[682,3]},[]],"contents":{"kind":{"annotation":[{"end":[680,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[680,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[683,4],"name":"tests/purus/passing/prelude/Prelude.purs","start":[683,3]},[]],"contents":{"kind":{"annotation":[{"end":[680,32],"name":"tests/purus/passing/prelude/Prelude.purs","start":[680,28]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"b"},"tag":"TypeVar"}],"tag":"TypeApp"}},"kind":"Abs","type":{"annotation":[{"end":[683,4],"name":"tests/purus/passing/prelude/Prelude.purs","start":[680,3]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[680,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[680,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":308,"type":{"annotation":[{"end":[683,4],"name":"tests/purus/passing/prelude/Prelude.purs","start":[680,23]},[]],"contents":{"identifier":"b","kind":{"annotation":[{"end":[680,32],"name":"tests/purus/passing/prelude/Prelude.purs","start":[680,28]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":307,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[681,10],"name":"tests/purus/passing/prelude/Prelude.purs","start":[681,4]},[]],"contents":[{"annotation":[{"end":[681,10],"name":"tests/purus/passing/prelude/Prelude.purs","start":[681,4]},[]],"contents":[{"annotation":[{"end":[681,8],"name":"tests/purus/passing/prelude/Prelude.purs","start":[681,6]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[681,5],"name":"tests/purus/passing/prelude/Prelude.purs","start":[681,4]},[]],"contents":{"kind":{"annotation":[{"end":[680,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[680,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[681,10],"name":"tests/purus/passing/prelude/Prelude.purs","start":[681,9]},[]],"contents":{"kind":{"annotation":[{"end":[680,32],"name":"tests/purus/passing/prelude/Prelude.purs","start":[680,28]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"b"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[683,4],"name":"tests/purus/passing/prelude/Prelude.purs","start":[682,3]},[]],"contents":[{"annotation":[{"end":[683,4],"name":"tests/purus/passing/prelude/Prelude.purs","start":[682,3]},[]],"contents":[{"annotation":[{"end":[682,7],"name":"tests/purus/passing/prelude/Prelude.purs","start":[682,5]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[682,4],"name":"tests/purus/passing/prelude/Prelude.purs","start":[682,3]},[]],"contents":{"kind":{"annotation":[{"end":[680,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[680,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[683,4],"name":"tests/purus/passing/prelude/Prelude.purs","start":[683,3]},[]],"contents":{"kind":{"annotation":[{"end":[680,32],"name":"tests/purus/passing/prelude/Prelude.purs","start":[680,28]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"b"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"identifier":"apply"},{"bindType":"Rec","binds":[{"annotation":{"meta":null,"sourceSpan":{"end":[634,9],"start":[630,1]}},"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[637,43],"start":[635,1]}},"argument":"ell1","body":{"annotation":{"meta":null,"sourceSpan":{"end":[637,43],"start":[635,1]}},"argument":"ell2","body":{"annotation":{"meta":null,"sourceSpan":{"end":[637,43],"start":[635,24]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[636,6],"start":[636,3]}},"binderType":"ConstructorBinder","binders":[],"constructorName":{"identifier":"Nil","moduleName":["Prim"]},"typeName":{"identifier":"List","moduleName":["Prim"]}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[636,14],"start":[636,10]}},"kind":"Var","type":{"annotation":[{"end":[633,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[633,3]},[]],"contents":[{"annotation":[{"end":[633,7],"name":"tests/purus/passing/prelude/Prelude.purs","start":[633,3]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[633,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[633,8]},[]],"contents":{"kind":{"annotation":[{"end":[631,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[631,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},"value":{"identifier":"ell2","sourcePos":[635,1]}},"isGuarded":false},{"binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[637,12],"start":[637,3]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[637,9],"start":[637,8]}},"binderType":"VarBinder","identifier":"x","type":{"annotation":[{"end":[632,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[632,8]},[]],"contents":{"kind":{"annotation":[{"end":[631,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[631,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}},{"annotation":{"meta":null,"sourceSpan":{"end":[637,12],"start":[637,10]}},"binderType":"VarBinder","identifier":"xs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[632,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[632,8]},[]],"contents":{"kind":{"annotation":[{"end":[631,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[631,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}}],"constructorName":{"identifier":"Cons","moduleName":["Prim"]},"typeName":{"identifier":"List","moduleName":["Prim"]}}],"expression":{"abstraction":{"abstraction":{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[637,20],"start":[637,16]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"x","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":313,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"x"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"x"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"x"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"Cons","moduleName":["Prim"]}},"annotation":{"meta":null,"sourceSpan":{"end":[637,22],"start":[637,16]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[637,22],"start":[637,21]}},"kind":"Var","type":{"annotation":[{"end":[632,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[632,8]},[]],"contents":{"kind":{"annotation":[{"end":[631,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[631,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"},"value":{"identifier":"x","sourcePos":[637,8]}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[637,43],"start":[637,16]}},"argument":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[637,34],"start":[637,24]}},"kind":"Var","type":{"annotation":[{"end":[634,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[631,3]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[631,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[631,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":311,"type":{"annotation":[{"end":[634,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[632,3]},[]],"contents":[{"annotation":[{"end":[634,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[632,3]},[]],"contents":[{"annotation":[{"end":[632,12],"name":"tests/purus/passing/prelude/Prelude.purs","start":[632,10]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[632,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[632,3]},[]],"contents":[{"annotation":[{"end":[632,7],"name":"tests/purus/passing/prelude/Prelude.purs","start":[632,3]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[632,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[632,8]},[]],"contents":{"kind":{"annotation":[{"end":[631,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[631,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[634,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[633,3]},[]],"contents":[{"annotation":[{"end":[634,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[633,3]},[]],"contents":[{"annotation":[{"end":[633,12],"name":"tests/purus/passing/prelude/Prelude.purs","start":[633,10]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[633,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[633,3]},[]],"contents":[{"annotation":[{"end":[633,7],"name":"tests/purus/passing/prelude/Prelude.purs","start":[633,3]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[633,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[633,8]},[]],"contents":{"kind":{"annotation":[{"end":[631,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[631,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[634,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[634,3]},[]],"contents":[{"annotation":[{"end":[634,7],"name":"tests/purus/passing/prelude/Prelude.purs","start":[634,3]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[634,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[634,8]},[]],"contents":{"kind":{"annotation":[{"end":[631,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[631,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"appendList","moduleName":["Prelude"]}},"annotation":{"meta":null,"sourceSpan":{"end":[637,37],"start":[637,24]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[637,37],"start":[637,35]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[632,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[632,8]},[]],"contents":{"kind":{"annotation":[{"end":[631,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[631,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},"value":{"identifier":"xs","sourcePos":[637,10]}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[637,42],"start":[637,24]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[637,42],"start":[637,38]}},"kind":"Var","type":{"annotation":[{"end":[633,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[633,3]},[]],"contents":[{"annotation":[{"end":[633,7],"name":"tests/purus/passing/prelude/Prelude.purs","start":[633,3]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[633,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[633,8]},[]],"contents":{"kind":{"annotation":[{"end":[631,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[631,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},"value":{"identifier":"ell2","sourcePos":[635,1]}},"kind":"App"},"kind":"App"},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[635,33],"start":[635,29]}},"kind":"Var","type":{"annotation":[{"end":[632,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[632,3]},[]],"contents":[{"annotation":[{"end":[632,7],"name":"tests/purus/passing/prelude/Prelude.purs","start":[632,3]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[632,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[632,8]},[]],"contents":{"kind":{"annotation":[{"end":[631,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[631,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},"value":{"identifier":"ell1","sourcePos":[635,1]}}],"kind":"Case","type":{"annotation":[{"end":[634,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[634,3]},[]],"contents":[{"annotation":[{"end":[634,7],"name":"tests/purus/passing/prelude/Prelude.purs","start":[634,3]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[634,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[634,8]},[]],"contents":{"kind":{"annotation":[{"end":[631,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[631,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[633,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[633,3]},[]],"contents":[{"annotation":[{"end":[633,7],"name":"tests/purus/passing/prelude/Prelude.purs","start":[633,3]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[633,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[633,8]},[]],"contents":{"kind":{"annotation":[{"end":[631,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[631,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[634,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[634,3]},[]],"contents":[{"annotation":[{"end":[634,7],"name":"tests/purus/passing/prelude/Prelude.purs","start":[634,3]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[634,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[634,8]},[]],"contents":{"kind":{"annotation":[{"end":[631,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[631,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"kind":"Abs","type":{"annotation":[{"end":[634,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[631,3]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[631,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[631,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":312,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[632,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[632,3]},[]],"contents":[{"annotation":[{"end":[632,7],"name":"tests/purus/passing/prelude/Prelude.purs","start":[632,3]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[632,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[632,8]},[]],"contents":{"kind":{"annotation":[{"end":[631,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[631,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[634,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[633,3]},[]],"contents":[{"annotation":[{"end":[634,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[633,3]},[]],"contents":[{"annotation":[{"end":[633,12],"name":"tests/purus/passing/prelude/Prelude.purs","start":[633,10]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[633,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[633,3]},[]],"contents":[{"annotation":[{"end":[633,7],"name":"tests/purus/passing/prelude/Prelude.purs","start":[633,3]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[633,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[633,8]},[]],"contents":{"kind":{"annotation":[{"end":[631,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[631,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[634,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[634,3]},[]],"contents":[{"annotation":[{"end":[634,7],"name":"tests/purus/passing/prelude/Prelude.purs","start":[634,3]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[634,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[634,8]},[]],"contents":{"kind":{"annotation":[{"end":[631,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[631,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"identifier":"appendList"}]},{"bindType":"Rec","binds":[{"annotation":{"meta":null,"sourceSpan":{"end":[651,10],"start":[647,1]}},"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[656,33],"start":[652,1]}},"argument":"p","body":{"annotation":{"meta":null,"sourceSpan":{"end":[656,33],"start":[652,1]}},"argument":"ell","body":{"annotation":{"meta":null,"sourceSpan":{"end":[656,33],"start":[652,17]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[653,6],"start":[653,3]}},"binderType":"ConstructorBinder","binders":[],"constructorName":{"identifier":"Nil","moduleName":["Prim"]},"typeName":{"identifier":"List","moduleName":["Prim"]}}],"expression":{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[653,15],"start":[653,10]}},"kind":"Var","type":{"annotation":[{"end":[651,10],"name":"tests/purus/passing/prelude/Prelude.purs","start":[651,3]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"},"value":{"identifier":"False","moduleName":["Prim"]}},"isGuarded":false},{"binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[654,12],"start":[654,3]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[654,9],"start":[654,8]}},"binderType":"VarBinder","identifier":"x","type":{"annotation":[{"end":[650,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[650,8]},[]],"contents":{"kind":{"annotation":[{"end":[648,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[648,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}},{"annotation":{"meta":null,"sourceSpan":{"end":[654,12],"start":[654,10]}},"binderType":"VarBinder","identifier":"xs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[650,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[650,8]},[]],"contents":{"kind":{"annotation":[{"end":[648,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[648,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}}],"constructorName":{"identifier":"Cons","moduleName":["Prim"]},"typeName":{"identifier":"List","moduleName":["Prim"]}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[656,33],"start":[654,16]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"binderType":"ConstructorBinder","binders":[],"constructorName":{"identifier":"True","moduleName":["Prim"]},"typeName":{"identifier":"Boolean","moduleName":["Prim"]}}],"expression":{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[655,25],"start":[655,21]}},"kind":"Var","type":{"annotation":[{"end":[651,10],"name":"tests/purus/passing/prelude/Prelude.purs","start":[651,3]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"},"value":{"identifier":"True","moduleName":["Prim"]}},"isGuarded":false},{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[656,33],"start":[654,16]}},"binderType":"NullBinder"}],"expression":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[656,28],"start":[656,21]}},"kind":"Var","type":{"annotation":[{"end":[651,10],"name":"tests/purus/passing/prelude/Prelude.purs","start":[648,3]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[648,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[648,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":315,"type":{"annotation":[{"end":[651,10],"name":"tests/purus/passing/prelude/Prelude.purs","start":[649,3]},[]],"contents":[{"annotation":[{"end":[651,10],"name":"tests/purus/passing/prelude/Prelude.purs","start":[649,3]},[]],"contents":[{"annotation":[{"end":[649,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[649,18]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[649,16],"name":"tests/purus/passing/prelude/Prelude.purs","start":[649,4]},[]],"contents":[{"annotation":[{"end":[649,16],"name":"tests/purus/passing/prelude/Prelude.purs","start":[649,4]},[]],"contents":[{"annotation":[{"end":[649,8],"name":"tests/purus/passing/prelude/Prelude.purs","start":[649,6]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[649,5],"name":"tests/purus/passing/prelude/Prelude.purs","start":[649,4]},[]],"contents":{"kind":{"annotation":[{"end":[648,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[648,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[649,16],"name":"tests/purus/passing/prelude/Prelude.purs","start":[649,9]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[651,10],"name":"tests/purus/passing/prelude/Prelude.purs","start":[650,3]},[]],"contents":[{"annotation":[{"end":[651,10],"name":"tests/purus/passing/prelude/Prelude.purs","start":[650,3]},[]],"contents":[{"annotation":[{"end":[650,12],"name":"tests/purus/passing/prelude/Prelude.purs","start":[650,10]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[650,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[650,3]},[]],"contents":[{"annotation":[{"end":[650,7],"name":"tests/purus/passing/prelude/Prelude.purs","start":[650,3]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[650,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[650,8]},[]],"contents":{"kind":{"annotation":[{"end":[648,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[648,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[651,10],"name":"tests/purus/passing/prelude/Prelude.purs","start":[651,3]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"anyList","moduleName":["Prelude"]}},"annotation":{"meta":null,"sourceSpan":{"end":[656,30],"start":[656,21]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[656,30],"start":[656,29]}},"kind":"Var","type":{"annotation":[{"end":[649,16],"name":"tests/purus/passing/prelude/Prelude.purs","start":[649,4]},[]],"contents":[{"annotation":[{"end":[649,16],"name":"tests/purus/passing/prelude/Prelude.purs","start":[649,4]},[]],"contents":[{"annotation":[{"end":[649,8],"name":"tests/purus/passing/prelude/Prelude.purs","start":[649,6]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[649,5],"name":"tests/purus/passing/prelude/Prelude.purs","start":[649,4]},[]],"contents":{"kind":{"annotation":[{"end":[648,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[648,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[649,16],"name":"tests/purus/passing/prelude/Prelude.purs","start":[649,9]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"p","sourcePos":[652,1]}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[656,33],"start":[656,21]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[656,33],"start":[656,31]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[650,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[650,8]},[]],"contents":{"kind":{"annotation":[{"end":[648,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[648,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},"value":{"identifier":"xs","sourcePos":[654,10]}},"kind":"App"},"isGuarded":false}],"caseExpressions":[{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[654,20],"start":[654,19]}},"kind":"Var","type":{"annotation":[{"end":[649,16],"name":"tests/purus/passing/prelude/Prelude.purs","start":[649,4]},[]],"contents":[{"annotation":[{"end":[649,16],"name":"tests/purus/passing/prelude/Prelude.purs","start":[649,4]},[]],"contents":[{"annotation":[{"end":[649,8],"name":"tests/purus/passing/prelude/Prelude.purs","start":[649,6]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[649,5],"name":"tests/purus/passing/prelude/Prelude.purs","start":[649,4]},[]],"contents":{"kind":{"annotation":[{"end":[648,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[648,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[649,16],"name":"tests/purus/passing/prelude/Prelude.purs","start":[649,9]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"p","sourcePos":[652,1]}},"annotation":{"meta":null,"sourceSpan":{"end":[654,22],"start":[654,19]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[654,22],"start":[654,21]}},"kind":"Var","type":{"annotation":[{"end":[650,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[650,8]},[]],"contents":{"kind":{"annotation":[{"end":[648,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[648,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"},"value":{"identifier":"x","sourcePos":[654,8]}},"kind":"App"}],"kind":"Case","type":{"annotation":[{"end":[651,10],"name":"tests/purus/passing/prelude/Prelude.purs","start":[651,3]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[652,25],"start":[652,22]}},"kind":"Var","type":{"annotation":[{"end":[650,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[650,3]},[]],"contents":[{"annotation":[{"end":[650,7],"name":"tests/purus/passing/prelude/Prelude.purs","start":[650,3]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[650,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[650,8]},[]],"contents":{"kind":{"annotation":[{"end":[648,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[648,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},"value":{"identifier":"ell","sourcePos":[652,1]}}],"kind":"Case","type":{"annotation":[{"end":[651,10],"name":"tests/purus/passing/prelude/Prelude.purs","start":[651,3]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[650,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[650,3]},[]],"contents":[{"annotation":[{"end":[650,7],"name":"tests/purus/passing/prelude/Prelude.purs","start":[650,3]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[650,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[650,8]},[]],"contents":{"kind":{"annotation":[{"end":[648,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[648,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[651,10],"name":"tests/purus/passing/prelude/Prelude.purs","start":[651,3]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"kind":"Abs","type":{"annotation":[{"end":[651,10],"name":"tests/purus/passing/prelude/Prelude.purs","start":[648,3]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[648,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[648,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":316,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[649,16],"name":"tests/purus/passing/prelude/Prelude.purs","start":[649,4]},[]],"contents":[{"annotation":[{"end":[649,16],"name":"tests/purus/passing/prelude/Prelude.purs","start":[649,4]},[]],"contents":[{"annotation":[{"end":[649,8],"name":"tests/purus/passing/prelude/Prelude.purs","start":[649,6]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[649,5],"name":"tests/purus/passing/prelude/Prelude.purs","start":[649,4]},[]],"contents":{"kind":{"annotation":[{"end":[648,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[648,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[649,16],"name":"tests/purus/passing/prelude/Prelude.purs","start":[649,9]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[651,10],"name":"tests/purus/passing/prelude/Prelude.purs","start":[650,3]},[]],"contents":[{"annotation":[{"end":[651,10],"name":"tests/purus/passing/prelude/Prelude.purs","start":[650,3]},[]],"contents":[{"annotation":[{"end":[650,12],"name":"tests/purus/passing/prelude/Prelude.purs","start":[650,10]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[650,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[650,3]},[]],"contents":[{"annotation":[{"end":[650,7],"name":"tests/purus/passing/prelude/Prelude.purs","start":[650,3]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[650,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[650,8]},[]],"contents":{"kind":{"annotation":[{"end":[648,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[648,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[651,10],"name":"tests/purus/passing/prelude/Prelude.purs","start":[651,3]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"identifier":"anyList"}]},{"annotation":{"meta":null,"sourceSpan":{"end":[562,37],"start":[562,1]}},"bindType":"NonRec","expression":{"annotation":{"meta":null,"sourceSpan":{"end":[563,39],"start":[563,1]}},"argument":"x","body":{"annotation":{"meta":null,"sourceSpan":{"end":[563,39],"start":[563,1]}},"argument":"y","body":{"abstraction":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[563,29],"start":[563,11]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"identifier":"x","kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"x"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"x"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":{"kind":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"x"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"ifThenElse","moduleName":["Builtin"]}},"annotation":{"meta":null,"sourceSpan":{"end":[563,31],"start":[563,11]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[563,31],"start":[563,30]}},"kind":"Var","type":{"annotation":[{"end":[562,15],"name":"tests/purus/passing/prelude/Prelude.purs","start":[562,8]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"},"value":{"identifier":"x","sourcePos":[563,1]}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[563,33],"start":[563,11]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[563,33],"start":[563,32]}},"kind":"Var","type":{"annotation":[{"end":[562,26],"name":"tests/purus/passing/prelude/Prelude.purs","start":[562,19]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"},"value":{"identifier":"y","sourcePos":[563,1]}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[563,39],"start":[563,11]}},"argument":{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[563,39],"start":[563,34]}},"kind":"Var","type":{"annotation":[{"end":[562,26],"name":"tests/purus/passing/prelude/Prelude.purs","start":[562,19]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"},"value":{"identifier":"False","moduleName":["Prim"]}},"kind":"App"},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[562,26],"name":"tests/purus/passing/prelude/Prelude.purs","start":[562,19]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[562,37],"name":"tests/purus/passing/prelude/Prelude.purs","start":[562,30]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[562,15],"name":"tests/purus/passing/prelude/Prelude.purs","start":[562,8]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[562,37],"name":"tests/purus/passing/prelude/Prelude.purs","start":[562,19]},[]],"contents":[{"annotation":[{"end":[562,37],"name":"tests/purus/passing/prelude/Prelude.purs","start":[562,19]},[]],"contents":[{"annotation":[{"end":[562,29],"name":"tests/purus/passing/prelude/Prelude.purs","start":[562,27]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[562,26],"name":"tests/purus/passing/prelude/Prelude.purs","start":[562,19]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[{"end":[562,37],"name":"tests/purus/passing/prelude/Prelude.purs","start":[562,30]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"identifier":"and"},{"bindType":"Rec","binds":[{"annotation":{"meta":null,"sourceSpan":{"end":[662,10],"start":[658,1]}},"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[667,26],"start":[663,1]}},"argument":"p","body":{"annotation":{"meta":null,"sourceSpan":{"end":[667,26],"start":[663,1]}},"argument":"ell","body":{"annotation":{"meta":null,"sourceSpan":{"end":[667,26],"start":[663,17]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[664,6],"start":[664,3]}},"binderType":"ConstructorBinder","binders":[],"constructorName":{"identifier":"Nil","moduleName":["Prim"]},"typeName":{"identifier":"List","moduleName":["Prim"]}}],"expression":{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[664,14],"start":[664,10]}},"kind":"Var","type":{"annotation":[{"end":[662,10],"name":"tests/purus/passing/prelude/Prelude.purs","start":[662,3]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"},"value":{"identifier":"True","moduleName":["Prim"]}},"isGuarded":false},{"binders":[{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[665,12],"start":[665,3]}},"binderType":"ConstructorBinder","binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[665,9],"start":[665,8]}},"binderType":"VarBinder","identifier":"x","type":{"annotation":[{"end":[661,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[661,8]},[]],"contents":{"kind":{"annotation":[{"end":[659,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[659,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}},{"annotation":{"meta":null,"sourceSpan":{"end":[665,12],"start":[665,10]}},"binderType":"VarBinder","identifier":"xs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[661,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[661,8]},[]],"contents":{"kind":{"annotation":[{"end":[659,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[659,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}}],"constructorName":{"identifier":"Cons","moduleName":["Prim"]},"typeName":{"identifier":"List","moduleName":["Prim"]}}],"expression":{"annotation":{"meta":null,"sourceSpan":{"end":[667,26],"start":[665,16]}},"caseAlternatives":[{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[0,0],"start":[0,0]}},"binderType":"ConstructorBinder","binders":[],"constructorName":{"identifier":"True","moduleName":["Prim"]},"typeName":{"identifier":"Boolean","moduleName":["Prim"]}}],"expression":{"abstraction":{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[666,28],"start":[666,21]}},"kind":"Var","type":{"annotation":[{"end":[662,10],"name":"tests/purus/passing/prelude/Prelude.purs","start":[659,3]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[659,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[659,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":319,"type":{"annotation":[{"end":[662,10],"name":"tests/purus/passing/prelude/Prelude.purs","start":[660,3]},[]],"contents":[{"annotation":[{"end":[662,10],"name":"tests/purus/passing/prelude/Prelude.purs","start":[660,3]},[]],"contents":[{"annotation":[{"end":[660,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[660,18]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[660,16],"name":"tests/purus/passing/prelude/Prelude.purs","start":[660,4]},[]],"contents":[{"annotation":[{"end":[660,16],"name":"tests/purus/passing/prelude/Prelude.purs","start":[660,4]},[]],"contents":[{"annotation":[{"end":[660,8],"name":"tests/purus/passing/prelude/Prelude.purs","start":[660,6]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[660,5],"name":"tests/purus/passing/prelude/Prelude.purs","start":[660,4]},[]],"contents":{"kind":{"annotation":[{"end":[659,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[659,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[660,16],"name":"tests/purus/passing/prelude/Prelude.purs","start":[660,9]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[662,10],"name":"tests/purus/passing/prelude/Prelude.purs","start":[661,3]},[]],"contents":[{"annotation":[{"end":[662,10],"name":"tests/purus/passing/prelude/Prelude.purs","start":[661,3]},[]],"contents":[{"annotation":[{"end":[661,12],"name":"tests/purus/passing/prelude/Prelude.purs","start":[661,10]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[661,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[661,3]},[]],"contents":[{"annotation":[{"end":[661,7],"name":"tests/purus/passing/prelude/Prelude.purs","start":[661,3]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[661,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[661,8]},[]],"contents":{"kind":{"annotation":[{"end":[659,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[659,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[662,10],"name":"tests/purus/passing/prelude/Prelude.purs","start":[662,3]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"value":{"identifier":"allList","moduleName":["Prelude"]}},"annotation":{"meta":null,"sourceSpan":{"end":[666,30],"start":[666,21]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[666,30],"start":[666,29]}},"kind":"Var","type":{"annotation":[{"end":[660,16],"name":"tests/purus/passing/prelude/Prelude.purs","start":[660,4]},[]],"contents":[{"annotation":[{"end":[660,16],"name":"tests/purus/passing/prelude/Prelude.purs","start":[660,4]},[]],"contents":[{"annotation":[{"end":[660,8],"name":"tests/purus/passing/prelude/Prelude.purs","start":[660,6]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[660,5],"name":"tests/purus/passing/prelude/Prelude.purs","start":[660,4]},[]],"contents":{"kind":{"annotation":[{"end":[659,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[659,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[660,16],"name":"tests/purus/passing/prelude/Prelude.purs","start":[660,9]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"p","sourcePos":[663,1]}},"kind":"App"},"annotation":{"meta":null,"sourceSpan":{"end":[666,33],"start":[666,21]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[666,33],"start":[666,31]}},"kind":"Var","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[661,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[661,8]},[]],"contents":{"kind":{"annotation":[{"end":[659,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[659,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},"value":{"identifier":"xs","sourcePos":[665,10]}},"kind":"App"},"isGuarded":false},{"binders":[{"annotation":{"meta":null,"sourceSpan":{"end":[667,26],"start":[665,16]}},"binderType":"NullBinder"}],"expression":{"annotation":{"meta":{"constructorType":"SumType","identifiers":[],"metaType":"IsConstructor"},"sourceSpan":{"end":[667,26],"start":[667,21]}},"kind":"Var","type":{"annotation":[{"end":[662,10],"name":"tests/purus/passing/prelude/Prelude.purs","start":[662,3]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"},"value":{"identifier":"False","moduleName":["Prim"]}},"isGuarded":false}],"caseExpressions":[{"abstraction":{"annotation":{"meta":null,"sourceSpan":{"end":[665,20],"start":[665,19]}},"kind":"Var","type":{"annotation":[{"end":[660,16],"name":"tests/purus/passing/prelude/Prelude.purs","start":[660,4]},[]],"contents":[{"annotation":[{"end":[660,16],"name":"tests/purus/passing/prelude/Prelude.purs","start":[660,4]},[]],"contents":[{"annotation":[{"end":[660,8],"name":"tests/purus/passing/prelude/Prelude.purs","start":[660,6]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[660,5],"name":"tests/purus/passing/prelude/Prelude.purs","start":[660,4]},[]],"contents":{"kind":{"annotation":[{"end":[659,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[659,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[660,16],"name":"tests/purus/passing/prelude/Prelude.purs","start":[660,9]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"value":{"identifier":"p","sourcePos":[663,1]}},"annotation":{"meta":null,"sourceSpan":{"end":[665,22],"start":[665,19]}},"argument":{"annotation":{"meta":null,"sourceSpan":{"end":[665,22],"start":[665,21]}},"kind":"Var","type":{"annotation":[{"end":[661,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[661,8]},[]],"contents":{"kind":{"annotation":[{"end":[659,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[659,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"},"value":{"identifier":"x","sourcePos":[665,8]}},"kind":"App"}],"kind":"Case","type":{"annotation":[{"end":[662,10],"name":"tests/purus/passing/prelude/Prelude.purs","start":[662,3]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}},"isGuarded":false}],"caseExpressions":[{"annotation":{"meta":null,"sourceSpan":{"end":[663,25],"start":[663,22]}},"kind":"Var","type":{"annotation":[{"end":[661,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[661,3]},[]],"contents":[{"annotation":[{"end":[661,7],"name":"tests/purus/passing/prelude/Prelude.purs","start":[661,3]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[661,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[661,8]},[]],"contents":{"kind":{"annotation":[{"end":[659,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[659,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},"value":{"identifier":"ell","sourcePos":[663,1]}}],"kind":"Case","type":{"annotation":[{"end":[662,10],"name":"tests/purus/passing/prelude/Prelude.purs","start":[662,3]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}},"kind":"Abs","type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[661,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[661,3]},[]],"contents":[{"annotation":[{"end":[661,7],"name":"tests/purus/passing/prelude/Prelude.purs","start":[661,3]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[661,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[661,8]},[]],"contents":{"kind":{"annotation":[{"end":[659,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[659,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[662,10],"name":"tests/purus/passing/prelude/Prelude.purs","start":[662,3]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"kind":"Abs","type":{"annotation":[{"end":[662,10],"name":"tests/purus/passing/prelude/Prelude.purs","start":[659,3]},[]],"contents":{"identifier":"a","kind":{"annotation":[{"end":[659,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[659,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":320,"type":{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[{"annotation":[{"end":[0,0],"name":"","start":[0,0]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[660,16],"name":"tests/purus/passing/prelude/Prelude.purs","start":[660,4]},[]],"contents":[{"annotation":[{"end":[660,16],"name":"tests/purus/passing/prelude/Prelude.purs","start":[660,4]},[]],"contents":[{"annotation":[{"end":[660,8],"name":"tests/purus/passing/prelude/Prelude.purs","start":[660,6]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[660,5],"name":"tests/purus/passing/prelude/Prelude.purs","start":[660,4]},[]],"contents":{"kind":{"annotation":[{"end":[659,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[659,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[{"end":[660,16],"name":"tests/purus/passing/prelude/Prelude.purs","start":[660,9]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[662,10],"name":"tests/purus/passing/prelude/Prelude.purs","start":[661,3]},[]],"contents":[{"annotation":[{"end":[662,10],"name":"tests/purus/passing/prelude/Prelude.purs","start":[661,3]},[]],"contents":[{"annotation":[{"end":[661,12],"name":"tests/purus/passing/prelude/Prelude.purs","start":[661,10]},[]],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[{"end":[661,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[661,3]},[]],"contents":[{"annotation":[{"end":[661,7],"name":"tests/purus/passing/prelude/Prelude.purs","start":[661,3]},[]],"contents":[["Prim"],"List"],"tag":"TypeConstructor"},{"annotation":[{"end":[661,9],"name":"tests/purus/passing/prelude/Prelude.purs","start":[661,8]},[]],"contents":{"kind":{"annotation":[{"end":[659,20],"name":"tests/purus/passing/prelude/Prelude.purs","start":[659,16]},[]],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"var":"a"},"tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[{"end":[662,10],"name":"tests/purus/passing/prelude/Prelude.purs","start":[662,3]},[]],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"identifier":"allList"}]}],"exports":["serializeScriptContext","deserializeScriptContext","serializeScriptPurpose","deserializeScriptPurpose","serializeDCert","deserializeDCert","serializeStakingCredential","deserializeStakingCredential","serializeCredential","deserializeCredential","serializeValue","deserializeValue","serializeCurrencySymbol","deserializeCurrencySymbol","serializeTokenName","deserializeTokenName","serializeLovelace","deserializeLovelace","serializePOSIXTime","deserializePOSIXTime","serializeAddress","deserializeAddress","serializePubKeyHash","deserializePubKeyHash","serializeTxId","deserializeTxId","serializeTxInfo","deserializeTxInfo","serializeTxOut","deserializeTxOut","serializeTxOutRef","deserializeTxOutRef","serializeTxInInfo","deserializeTxInInfo","serializeOutputDatum","deserializeOutputDatum","serializeInterval","deserializeInterval","serializeExtended","deserializeExtended","serializeLowerBound","deserializeLowerBound","serializeUpperBound","deserializeUpperBound","serializeAssocMap","deserializeAssocMap","serializeScriptHash","deserializeScriptHash","serializeRedeemer","deserializeRedeemer","serializeRedeemerHash","deserializeRedeemerHash","serializeDatum","deserializeDatum","serializeDatumHash","deserializeDatumHash","serializeInt","deserializeInt","serializeByteString","deserializeByteString","serializeList","deserializeList","serializeTuple2","deserializeTuple2","serializeMaybe","deserializeMaybe","maybe","fromMaybe","identity","const","and","or","not","xor","mapList","filterList","takeList","dropList","zipWithList","appendList","lengthList","anyList","allList","sumList","productList","apply","flip"],"foreign":[],"imports":[{"annotation":{"meta":null,"sourceSpan":{"end":[694,19],"start":[1,1]}},"moduleName":["Builtin"]},{"annotation":{"meta":null,"sourceSpan":{"end":[694,19],"start":[1,1]}},"moduleName":["Prelude"]},{"annotation":{"meta":null,"sourceSpan":{"end":[694,19],"start":[1,1]}},"moduleName":["Prim"]}],"moduleName":["Prelude"],"modulePath":"tests/purus/passing/prelude/Prelude.purs","reExports":{},"sourceSpan":{"end":[694,19],"start":[1,1]}} \ No newline at end of file diff --git a/tests/purus/passing/prelude/output/Prelude/Prelude.cfn.pretty b/tests/purus/passing/prelude/output/Prelude/Prelude.cfn.pretty new file mode 100644 index 000000000..42db85255 --- /dev/null +++ b/tests/purus/passing/prelude/output/Prelude/Prelude.cfn.pretty @@ -0,0 +1,2893 @@ +Prelude (tests/purus/passing/prelude/Prelude.purs) + +Imported Modules: +------------------------------ + Builtin, + Prelude, + Prim + +Exports: +------------------------------ + serializeScriptContext, + deserializeScriptContext, + serializeScriptPurpose, + deserializeScriptPurpose, + serializeDCert, + deserializeDCert, + serializeStakingCredential, + deserializeStakingCredential, + serializeCredential, + deserializeCredential, + serializeValue, + deserializeValue, + serializeCurrencySymbol, + deserializeCurrencySymbol, + serializeTokenName, + deserializeTokenName, + serializeLovelace, + deserializeLovelace, + serializePOSIXTime, + deserializePOSIXTime, + serializeAddress, + deserializeAddress, + serializePubKeyHash, + deserializePubKeyHash, + serializeTxId, + deserializeTxId, + serializeTxInfo, + deserializeTxInfo, + serializeTxOut, + deserializeTxOut, + serializeTxOutRef, + deserializeTxOutRef, + serializeTxInInfo, + deserializeTxInInfo, + serializeOutputDatum, + deserializeOutputDatum, + serializeInterval, + deserializeInterval, + serializeExtended, + deserializeExtended, + serializeLowerBound, + deserializeLowerBound, + serializeUpperBound, + deserializeUpperBound, + serializeAssocMap, + deserializeAssocMap, + serializeScriptHash, + deserializeScriptHash, + serializeRedeemer, + deserializeRedeemer, + serializeRedeemerHash, + deserializeRedeemerHash, + serializeDatum, + deserializeDatum, + serializeDatumHash, + deserializeDatumHash, + serializeInt, + deserializeInt, + serializeByteString, + deserializeByteString, + serializeList, + deserializeList, + serializeTuple2, + deserializeTuple2, + serializeMaybe, + deserializeMaybe, + maybe, + fromMaybe, + identity, + const, + and, + or, + not, + xor, + mapList, + filterList, + takeList, + dropList, + zipWithList, + appendList, + lengthList, + anyList, + allList, + sumList, + productList, + apply, + flip + +Re-Exports: +------------------------------ + + +Foreign: +------------------------------ + + +Datatypes: +------------------------------ + + + +Declarations: +------------------------------ +zipWithList :: forall (a :: Prim.Type) (b :: Prim.Type) (c :: Prim.Type). (((a :: Prim.Type) -> (((b :: Prim.Type) -> ((c :: Prim.Type))))) -> ((List ((a :: Prim.Type)) -> ((List ((b :: Prim.Type)) -> (List ((c :: Prim.Type)))))))) +zipWithList = + \(f: ((a :: Prim.Type) -> (((b :: Prim.Type) -> ((c :: Prim.Type)))))) -> + \(ell1: List ((a :: Prim.Type))) -> + \(ell2: List ((b :: Prim.Type))) -> + case (ell1: List ((a :: Prim.Type))) of + Nil -> (Nil: List ((c :: Prim.Type))) + Cons x xs -> + case (ell2: List ((b :: Prim.Type))) of + Nil -> (Nil: List ((c :: Prim.Type))) + Cons y ys -> + (Cons: forall (x :: Prim.Type). ((x :: Prim.Type) -> + ((List ((x :: Prim.Type)) -> (List ((x :: Prim.Type))))))) + ((f: ((a :: Prim.Type) -> + (((b :: Prim.Type) -> ((c :: Prim.Type)))))) + (x: (a :: Prim.Type)) + (y: (b :: Prim.Type))) + ((zipWithList: forall (a :: Prim.Type) + (b :: Prim.Type) + (c :: Prim.Type). (((a :: Prim.Type) -> + (((b :: Prim.Type) -> ((c :: Prim.Type))))) -> + ((List ((a :: Prim.Type)) -> + ((List ((b :: Prim.Type)) -> (List ((c :: Prim.Type))))))))) + (f: ((a :: Prim.Type) -> + (((b :: Prim.Type) -> ((c :: Prim.Type)))))) + (xs: List ((a :: Prim.Type))) + (ys: List ((b :: Prim.Type)))) + +takeList :: forall (a :: Prim.Type). (Prim.Int -> ((List ((a :: Prim.Type)) -> (List ((a :: Prim.Type)))))) +takeList = + \(count: Prim.Int) -> + \(ell: List ((a :: Prim.Type))) -> + case ((lessThanEqualsInteger: (Prim.Int -> ((Prim.Int -> (Prim.Boolean))))) (count: Prim.Int) (0: Prim.Int)) of + True -> (Nil: List ((a :: Prim.Type))) + _ -> + case (ell: List ((a :: Prim.Type))) of + Nil -> (Nil: List ((a :: Prim.Type))) + Cons x xs -> + (Cons: forall (x :: Prim.Type). ((x :: Prim.Type) -> + ((List ((x :: Prim.Type)) -> (List ((x :: Prim.Type))))))) + (x: (a :: Prim.Type)) + ((takeList: forall (a :: Prim.Type). (Prim.Int -> + ((List ((a :: Prim.Type)) -> (List ((a :: Prim.Type))))))) + ((subtractInteger: (Prim.Int -> ((Prim.Int -> (Prim.Int))))) + (count: Prim.Int) + (1: Prim.Int)) + (xs: List ((a :: Prim.Type)))) + +sumList :: (List (Prim.Int) -> (Prim.Int)) +sumList = + \(ell: List (Prim.Int)) -> + case (ell: List (Prim.Int)) of + Nil -> (0: Prim.Int) + Cons x xs -> + (addInteger: (Prim.Int -> ((Prim.Int -> (Prim.Int))))) + (x: Prim.Int) + ((sumList: (List (Prim.Int) -> (Prim.Int))) (xs: List (Prim.Int))) + +serializeTuple2 :: forall (a :: Prim.Type) (b :: Prim.Type). (((a :: Prim.Type) -> (Builtin.BuiltinData)) -> ((((b :: Prim.Type) -> (Builtin.BuiltinData)) -> ((((Prim.Tuple2 ((a :: Prim.Type))) ((b :: Prim.Type))) -> (Builtin.BuiltinData)))))) +serializeTuple2 = + \(fA: ((a :: Prim.Type) -> (Builtin.BuiltinData))) -> + \(fB: ((b :: Prim.Type) -> (Builtin.BuiltinData))) -> + \(v: ((Prim.Tuple2 ((a :: Prim.Type))) ((b :: Prim.Type)))) -> + case (fA: ((a :: Prim.Type) -> (Builtin.BuiltinData))) (fB: ((b :: Prim.Type) -> (Builtin.BuiltinData))) (v: ((Prim.Tuple2 ((a :: Prim.Type))) ((b :: Prim.Type)))) of + fA1 fB1 Tuple2 x y -> + (constrData: (Prim.Int -> + (((Builtin.BuiltinList (Builtin.BuiltinData)) -> + (Builtin.BuiltinData))))) + (0: Prim.Int) + ((mkCons: forall (a :: Prim.Type). ((a :: Prim.Type) -> + (((Builtin.BuiltinList ((a :: Prim.Type))) -> + ((Builtin.BuiltinList ((a :: Prim.Type)))))))) + ((fA1: ((a :: Prim.Type) -> (Builtin.BuiltinData))) + (x: (a :: Prim.Type))) + ((mkCons: forall (a :: Prim.Type). ((a :: Prim.Type) -> + (((Builtin.BuiltinList ((a :: Prim.Type))) -> + ((Builtin.BuiltinList ((a :: Prim.Type)))))))) + ((fB1: ((b :: Prim.Type) -> (Builtin.BuiltinData))) + (y: (b :: Prim.Type))) + ((mkNilData: (Prim.Unit -> + ((Builtin.BuiltinList (Builtin.BuiltinData))))) + (unit: Prim.Unit)))) + +serializeRedeemer :: (Prim.Redeemer -> (Builtin.BuiltinData)) +serializeRedeemer = + \(v: Prim.Redeemer) -> + case (v: Prim.Redeemer) of + Redeemer dat -> (dat: Builtin.BuiltinData) + +serializeMaybe :: forall (a :: Prim.Type). (((a :: Prim.Type) -> (Builtin.BuiltinData)) -> (((Prim.Maybe ((a :: Prim.Type))) -> (Builtin.BuiltinData)))) +serializeMaybe = + \(f: ((a :: Prim.Type) -> (Builtin.BuiltinData))) -> + \(m: (Prim.Maybe ((a :: Prim.Type)))) -> + case (m: (Prim.Maybe ((a :: Prim.Type)))) of + Nothing -> + (constrData: (Prim.Int -> + (((Builtin.BuiltinList (Builtin.BuiltinData)) -> + (Builtin.BuiltinData))))) + (0: Prim.Int) + ((mkNilData: (Prim.Unit -> + ((Builtin.BuiltinList (Builtin.BuiltinData))))) + (unit: Prim.Unit)) + Just x -> + (constrData: (Prim.Int -> + (((Builtin.BuiltinList (Builtin.BuiltinData)) -> + (Builtin.BuiltinData))))) + (1: Prim.Int) + ((mkCons: forall (a :: Prim.Type). ((a :: Prim.Type) -> + (((Builtin.BuiltinList ((a :: Prim.Type))) -> + ((Builtin.BuiltinList ((a :: Prim.Type)))))))) + ((f: ((a :: Prim.Type) -> (Builtin.BuiltinData))) + (x: (a :: Prim.Type))) + ((mkNilData: (Prim.Unit -> + ((Builtin.BuiltinList (Builtin.BuiltinData))))) + (unit: Prim.Unit))) + +serializeList :: forall (a :: Prim.Type). (((a :: Prim.Type) -> (Builtin.BuiltinData)) -> ((List ((a :: Prim.Type)) -> (Builtin.BuiltinData)))) +serializeList = + \(f: ((a :: Prim.Type) -> (Builtin.BuiltinData))) -> + \(arr: List ((a :: Prim.Type))) -> + let + go :: (List (a*7) -> ((Builtin.BuiltinList (Builtin.BuiltinData)))) + go = + \(v: List (a*7)) -> + case (v: List (a*7)) of + Nil -> + (mkNilData: (Prim.Unit -> + ((Builtin.BuiltinList (Builtin.BuiltinData))))) + (unit: Prim.Unit) + Cons x xs -> + (mkCons: forall (a :: Prim.Type). ((a :: Prim.Type) -> + (((Builtin.BuiltinList ((a :: Prim.Type))) -> + ((Builtin.BuiltinList ((a :: Prim.Type)))))))) + ((f: ((a :: Prim.Type) -> (Builtin.BuiltinData))) (x: a*7)) + ((go: (List (a*7) -> + ((Builtin.BuiltinList (Builtin.BuiltinData))))) + (xs: List (a*7))) + in (listData: ((Builtin.BuiltinList (Builtin.BuiltinData)) -> + (Builtin.BuiltinData))) + ((go: (List (a*7) -> ((Builtin.BuiltinList (Builtin.BuiltinData))))) + (arr: List ((a :: Prim.Type)))) + +serializeInt :: (Prim.Int -> (Builtin.BuiltinData)) +serializeInt = (iData: (Prim.Int -> (Builtin.BuiltinData))) + +serializeLovelace :: (Prim.Lovelace -> (Builtin.BuiltinData)) +serializeLovelace = + \(v: Prim.Lovelace) -> + case (v: Prim.Lovelace) of + Lovelace i -> + (serializeInt: (Prim.Int -> (Builtin.BuiltinData))) (i: Prim.Int) + +serializePOSIXTime :: (Prim.POSIXTime -> (Builtin.BuiltinData)) +serializePOSIXTime = + \(v: Prim.POSIXTime) -> + case (v: Prim.POSIXTime) of + POSIXTime t -> + (serializeInt: (Prim.Int -> (Builtin.BuiltinData))) (t: Prim.Int) + +serializeExtended :: forall (a :: Prim.Type). (((a :: Prim.Type) -> (Builtin.BuiltinData)) -> (((Prim.Extended ((a :: Prim.Type))) -> (Builtin.BuiltinData)))) +serializeExtended = + \(f: ((a :: Prim.Type) -> (Builtin.BuiltinData))) -> + \(e: (Prim.Extended ((a :: Prim.Type)))) -> + case (e: (Prim.Extended ((a :: Prim.Type)))) of + NegInf -> + (constrData: (Prim.Int -> + (((Builtin.BuiltinList (Builtin.BuiltinData)) -> + (Builtin.BuiltinData))))) + (0: Prim.Int) + ((mkNilData: (Prim.Unit -> + ((Builtin.BuiltinList (Builtin.BuiltinData))))) + (unit: Prim.Unit)) + Finite x -> + (constrData: (Prim.Int -> + (((Builtin.BuiltinList (Builtin.BuiltinData)) -> + (Builtin.BuiltinData))))) + (1: Prim.Int) + ((mkCons: forall (a :: Prim.Type). ((a :: Prim.Type) -> + (((Builtin.BuiltinList ((a :: Prim.Type))) -> + ((Builtin.BuiltinList ((a :: Prim.Type)))))))) + ((f: ((a :: Prim.Type) -> (Builtin.BuiltinData))) + (x: (a :: Prim.Type))) + ((mkNilData: (Prim.Unit -> + ((Builtin.BuiltinList (Builtin.BuiltinData))))) + (unit: Prim.Unit))) + PosInf -> + (constrData: (Prim.Int -> + (((Builtin.BuiltinList (Builtin.BuiltinData)) -> + (Builtin.BuiltinData))))) + (2: Prim.Int) + ((mkNilData: (Prim.Unit -> + ((Builtin.BuiltinList (Builtin.BuiltinData))))) + (unit: Prim.Unit)) + +serializeLowerBound :: forall (a :: Prim.Type). (((a :: Prim.Type) -> (Builtin.BuiltinData)) -> (((Prim.LowerBound ((a :: Prim.Type))) -> (Builtin.BuiltinData)))) +serializeLowerBound = + \(f: ((a :: Prim.Type) -> (Builtin.BuiltinData))) -> + \(v: (Prim.LowerBound ((a :: Prim.Type)))) -> + case (f: ((a :: Prim.Type) -> (Builtin.BuiltinData))) (v: (Prim.LowerBound ((a :: Prim.Type)))) of + f1 LowerBound e -> + (constrData: (Prim.Int -> + (((Builtin.BuiltinList (Builtin.BuiltinData)) -> + (Builtin.BuiltinData))))) + (0: Prim.Int) + ((mkCons: forall (a :: Prim.Type). ((a :: Prim.Type) -> + (((Builtin.BuiltinList ((a :: Prim.Type))) -> + ((Builtin.BuiltinList ((a :: Prim.Type)))))))) + ((serializeExtended: forall (a :: Prim.Type). (((a :: Prim.Type) -> + (Builtin.BuiltinData)) -> + (((Prim.Extended ((a :: Prim.Type))) -> (Builtin.BuiltinData))))) + (f1: ((a :: Prim.Type) -> (Builtin.BuiltinData))) + (e: (Prim.Extended ((a :: Prim.Type))))) + ((mkNilData: (Prim.Unit -> + ((Builtin.BuiltinList (Builtin.BuiltinData))))) + (unit: Prim.Unit))) + +serializeUpperBound :: forall (a :: Prim.Type). (((a :: Prim.Type) -> (Builtin.BuiltinData)) -> (((Prim.UpperBound ((a :: Prim.Type))) -> (Builtin.BuiltinData)))) +serializeUpperBound = + \(f: ((a :: Prim.Type) -> (Builtin.BuiltinData))) -> + \(v: (Prim.UpperBound ((a :: Prim.Type)))) -> + case (f: ((a :: Prim.Type) -> (Builtin.BuiltinData))) (v: (Prim.UpperBound ((a :: Prim.Type)))) of + f1 UpperBound e -> + (constrData: (Prim.Int -> + (((Builtin.BuiltinList (Builtin.BuiltinData)) -> + (Builtin.BuiltinData))))) + (0: Prim.Int) + ((mkCons: forall (a :: Prim.Type). ((a :: Prim.Type) -> + (((Builtin.BuiltinList ((a :: Prim.Type))) -> + ((Builtin.BuiltinList ((a :: Prim.Type)))))))) + ((serializeExtended: forall (a :: Prim.Type). (((a :: Prim.Type) -> + (Builtin.BuiltinData)) -> + (((Prim.Extended ((a :: Prim.Type))) -> (Builtin.BuiltinData))))) + (f1: ((a :: Prim.Type) -> (Builtin.BuiltinData))) + (e: (Prim.Extended ((a :: Prim.Type))))) + ((mkNilData: (Prim.Unit -> + ((Builtin.BuiltinList (Builtin.BuiltinData))))) + (unit: Prim.Unit))) + +serializeInterval :: forall (a :: Prim.Type). (((a :: Prim.Type) -> (Builtin.BuiltinData)) -> (((Prim.Interval ((a :: Prim.Type))) -> (Builtin.BuiltinData)))) +serializeInterval = + \(f: ((a :: Prim.Type) -> (Builtin.BuiltinData))) -> + \(v: (Prim.Interval ((a :: Prim.Type)))) -> + case (f: ((a :: Prim.Type) -> (Builtin.BuiltinData))) (v: (Prim.Interval ((a :: Prim.Type)))) of + f1 Interval rec -> + (constrData: (Prim.Int -> + (((Builtin.BuiltinList (Builtin.BuiltinData)) -> + (Builtin.BuiltinData))))) + (0: Prim.Int) + ((mkCons: forall (a :: Prim.Type). ((a :: Prim.Type) -> + (((Builtin.BuiltinList ((a :: Prim.Type))) -> + ((Builtin.BuiltinList ((a :: Prim.Type)))))))) + ((serializeLowerBound: forall (a :: Prim.Type). (((a :: Prim.Type) -> + (Builtin.BuiltinData)) -> + (((Prim.LowerBound ((a :: Prim.Type))) -> (Builtin.BuiltinData))))) + (f1: ((a :: Prim.Type) -> (Builtin.BuiltinData))) + ((rec: { + from :: (Prim.LowerBound ((a :: Prim.Type))), + to :: (Prim.UpperBound ((a :: Prim.Type))) + }) + .from)) + ((mkCons: forall (a :: Prim.Type). ((a :: Prim.Type) -> + (((Builtin.BuiltinList ((a :: Prim.Type))) -> + ((Builtin.BuiltinList ((a :: Prim.Type)))))))) + ((serializeUpperBound: forall (a :: Prim.Type). (((a :: Prim.Type) -> + (Builtin.BuiltinData)) -> + (((Prim.UpperBound ((a :: Prim.Type))) -> + (Builtin.BuiltinData))))) + (f1: ((a :: Prim.Type) -> (Builtin.BuiltinData))) + ((rec: { + from :: (Prim.LowerBound ((a :: Prim.Type))), + to :: (Prim.UpperBound ((a :: Prim.Type))) + }) + .to)) + ((mkNilData: (Prim.Unit -> + ((Builtin.BuiltinList (Builtin.BuiltinData))))) + (unit: Prim.Unit)))) + +serializeDatum :: (Prim.Datum -> (Builtin.BuiltinData)) +serializeDatum = + \(v: Prim.Datum) -> + case (v: Prim.Datum) of + Datum dat -> (dat: Builtin.BuiltinData) + +serializeByteString :: (Builtin.BuiltinByteString -> (Builtin.BuiltinData)) +serializeByteString = + (bData: (Builtin.BuiltinByteString -> (Builtin.BuiltinData))) + +serializeCurrencySymbol :: (Prim.CurrencySymbol -> (Builtin.BuiltinData)) +serializeCurrencySymbol = + \(v: Prim.CurrencySymbol) -> + case (v: Prim.CurrencySymbol) of + CurrencySymbol bs -> + (serializeByteString: (Builtin.BuiltinByteString -> + (Builtin.BuiltinData))) + (bs: Builtin.BuiltinByteString) + +serializeDatumHash :: (Prim.DatumHash -> (Builtin.BuiltinData)) +serializeDatumHash = + \(v: Prim.DatumHash) -> + case (v: Prim.DatumHash) of + DatumHash bs -> + (serializeByteString: (Builtin.BuiltinByteString -> + (Builtin.BuiltinData))) + (bs: Builtin.BuiltinByteString) + +serializeOutputDatum :: (Prim.OutputDatum -> (Builtin.BuiltinData)) +serializeOutputDatum = + \(od: Prim.OutputDatum) -> + case (od: Prim.OutputDatum) of + NoOutputDatum -> + (constrData: (Prim.Int -> + (((Builtin.BuiltinList (Builtin.BuiltinData)) -> + (Builtin.BuiltinData))))) + (0: Prim.Int) + ((mkNilData: (Prim.Unit -> + ((Builtin.BuiltinList (Builtin.BuiltinData))))) + (unit: Prim.Unit)) + OutputDatumHash h -> + (constrData: (Prim.Int -> + (((Builtin.BuiltinList (Builtin.BuiltinData)) -> + (Builtin.BuiltinData))))) + (1: Prim.Int) + ((mkCons: forall (a :: Prim.Type). ((a :: Prim.Type) -> + (((Builtin.BuiltinList ((a :: Prim.Type))) -> + ((Builtin.BuiltinList ((a :: Prim.Type)))))))) + ((serializeDatumHash: (Prim.DatumHash -> (Builtin.BuiltinData))) + (h: Prim.DatumHash)) + ((mkNilData: (Prim.Unit -> + ((Builtin.BuiltinList (Builtin.BuiltinData))))) + (unit: Prim.Unit))) + OutputDatum d -> + (constrData: (Prim.Int -> + (((Builtin.BuiltinList (Builtin.BuiltinData)) -> + (Builtin.BuiltinData))))) + (2: Prim.Int) + ((mkCons: forall (a :: Prim.Type). ((a :: Prim.Type) -> + (((Builtin.BuiltinList ((a :: Prim.Type))) -> + ((Builtin.BuiltinList ((a :: Prim.Type)))))))) + ((serializeDatum: (Prim.Datum -> (Builtin.BuiltinData))) + (d: Prim.Datum)) + ((mkNilData: (Prim.Unit -> + ((Builtin.BuiltinList (Builtin.BuiltinData))))) + (unit: Prim.Unit))) + +serializePubKeyHash :: (Prim.PubKeyHash -> (Builtin.BuiltinData)) +serializePubKeyHash = + \(v: Prim.PubKeyHash) -> + case (v: Prim.PubKeyHash) of + PubKeyHash bs -> + (serializeByteString: (Builtin.BuiltinByteString -> + (Builtin.BuiltinData))) + (bs: Builtin.BuiltinByteString) + +serializeRedeemerHash :: (Prim.RedeemerHash -> (Builtin.BuiltinData)) +serializeRedeemerHash = + \(v: Prim.RedeemerHash) -> + case (v: Prim.RedeemerHash) of + RedeemerHash bs -> + (serializeByteString: (Builtin.BuiltinByteString -> + (Builtin.BuiltinData))) + (bs: Builtin.BuiltinByteString) + +serializeScriptHash :: (Prim.ScriptHash -> (Builtin.BuiltinData)) +serializeScriptHash = + \(v: Prim.ScriptHash) -> + case (v: Prim.ScriptHash) of + ScriptHash dat -> + (serializeByteString: (Builtin.BuiltinByteString -> + (Builtin.BuiltinData))) + (dat: Builtin.BuiltinByteString) + +serializeCredential :: (Prim.Credential -> (Builtin.BuiltinData)) +serializeCredential = + \(c: Prim.Credential) -> + case (c: Prim.Credential) of + PubKeyCredential pkh -> + (constrData: (Prim.Int -> + (((Builtin.BuiltinList (Builtin.BuiltinData)) -> + (Builtin.BuiltinData))))) + (0: Prim.Int) + ((mkCons: forall (a :: Prim.Type). ((a :: Prim.Type) -> + (((Builtin.BuiltinList ((a :: Prim.Type))) -> + ((Builtin.BuiltinList ((a :: Prim.Type)))))))) + ((serializePubKeyHash: (Prim.PubKeyHash -> (Builtin.BuiltinData))) + (pkh: Prim.PubKeyHash)) + ((mkNilData: (Prim.Unit -> + ((Builtin.BuiltinList (Builtin.BuiltinData))))) + (unit: Prim.Unit))) + ScriptCredential sh -> + (constrData: (Prim.Int -> + (((Builtin.BuiltinList (Builtin.BuiltinData)) -> + (Builtin.BuiltinData))))) + (1: Prim.Int) + ((mkCons: forall (a :: Prim.Type). ((a :: Prim.Type) -> + (((Builtin.BuiltinList ((a :: Prim.Type))) -> + ((Builtin.BuiltinList ((a :: Prim.Type)))))))) + ((serializeScriptHash: (Prim.ScriptHash -> (Builtin.BuiltinData))) + (sh: Prim.ScriptHash)) + ((mkNilData: (Prim.Unit -> + ((Builtin.BuiltinList (Builtin.BuiltinData))))) + (unit: Prim.Unit))) + +serializeStakingCredential :: (Prim.StakingCredential -> (Builtin.BuiltinData)) +serializeStakingCredential = + \(sc: Prim.StakingCredential) -> + case (sc: Prim.StakingCredential) of + StakingHash c -> + (constrData: (Prim.Int -> + (((Builtin.BuiltinList (Builtin.BuiltinData)) -> + (Builtin.BuiltinData))))) + (0: Prim.Int) + ((mkCons: forall (a :: Prim.Type). ((a :: Prim.Type) -> + (((Builtin.BuiltinList ((a :: Prim.Type))) -> + ((Builtin.BuiltinList ((a :: Prim.Type)))))))) + ((serializeCredential: (Prim.Credential -> (Builtin.BuiltinData))) + (c: Prim.Credential)) + ((mkNilData: (Prim.Unit -> + ((Builtin.BuiltinList (Builtin.BuiltinData))))) + (unit: Prim.Unit))) + StakingPtr i1 i2 i3 -> + (constrData: (Prim.Int -> + (((Builtin.BuiltinList (Builtin.BuiltinData)) -> + (Builtin.BuiltinData))))) + (1: Prim.Int) + ((mkCons: forall (a :: Prim.Type). ((a :: Prim.Type) -> + (((Builtin.BuiltinList ((a :: Prim.Type))) -> + ((Builtin.BuiltinList ((a :: Prim.Type)))))))) + ((serializeInt: (Prim.Int -> (Builtin.BuiltinData))) (i1: Prim.Int)) + ((mkCons: forall (a :: Prim.Type). ((a :: Prim.Type) -> + (((Builtin.BuiltinList ((a :: Prim.Type))) -> + ((Builtin.BuiltinList ((a :: Prim.Type)))))))) + ((serializeInt: (Prim.Int -> (Builtin.BuiltinData))) (i2: Prim.Int)) + ((mkCons: forall (a :: Prim.Type). ((a :: Prim.Type) -> + (((Builtin.BuiltinList ((a :: Prim.Type))) -> + ((Builtin.BuiltinList ((a :: Prim.Type)))))))) + ((serializeInt: (Prim.Int -> (Builtin.BuiltinData))) (i3: Prim.Int)) + ((mkNilData: (Prim.Unit -> + ((Builtin.BuiltinList (Builtin.BuiltinData))))) + (unit: Prim.Unit))))) + +serializeDCert :: (Prim.DCert -> (Builtin.BuiltinData)) +serializeDCert = + \(d: Prim.DCert) -> + case (d: Prim.DCert) of + DCertDelegRegKey sc -> + (constrData: (Prim.Int -> + (((Builtin.BuiltinList (Builtin.BuiltinData)) -> + (Builtin.BuiltinData))))) + (0: Prim.Int) + ((mkCons: forall (a :: Prim.Type). ((a :: Prim.Type) -> + (((Builtin.BuiltinList ((a :: Prim.Type))) -> + ((Builtin.BuiltinList ((a :: Prim.Type)))))))) + ((serializeStakingCredential: (Prim.StakingCredential -> + (Builtin.BuiltinData))) + (sc: Prim.StakingCredential)) + ((mkNilData: (Prim.Unit -> + ((Builtin.BuiltinList (Builtin.BuiltinData))))) + (unit: Prim.Unit))) + DCertDelegDeRegKey sc -> + (constrData: (Prim.Int -> + (((Builtin.BuiltinList (Builtin.BuiltinData)) -> + (Builtin.BuiltinData))))) + (1: Prim.Int) + ((mkCons: forall (a :: Prim.Type). ((a :: Prim.Type) -> + (((Builtin.BuiltinList ((a :: Prim.Type))) -> + ((Builtin.BuiltinList ((a :: Prim.Type)))))))) + ((serializeStakingCredential: (Prim.StakingCredential -> + (Builtin.BuiltinData))) + (sc: Prim.StakingCredential)) + ((mkNilData: (Prim.Unit -> + ((Builtin.BuiltinList (Builtin.BuiltinData))))) + (unit: Prim.Unit))) + DCertDelegDelegate sc pkh -> + (constrData: (Prim.Int -> + (((Builtin.BuiltinList (Builtin.BuiltinData)) -> + (Builtin.BuiltinData))))) + (2: Prim.Int) + ((mkCons: forall (a :: Prim.Type). ((a :: Prim.Type) -> + (((Builtin.BuiltinList ((a :: Prim.Type))) -> + ((Builtin.BuiltinList ((a :: Prim.Type)))))))) + ((serializeStakingCredential: (Prim.StakingCredential -> + (Builtin.BuiltinData))) + (sc: Prim.StakingCredential)) + ((mkCons: forall (a :: Prim.Type). ((a :: Prim.Type) -> + (((Builtin.BuiltinList ((a :: Prim.Type))) -> + ((Builtin.BuiltinList ((a :: Prim.Type)))))))) + ((serializePubKeyHash: (Prim.PubKeyHash -> (Builtin.BuiltinData))) + (pkh: Prim.PubKeyHash)) + ((mkNilData: (Prim.Unit -> + ((Builtin.BuiltinList (Builtin.BuiltinData))))) + (unit: Prim.Unit)))) + DCertPoolRegister pkh1 pkh2 -> + (constrData: (Prim.Int -> + (((Builtin.BuiltinList (Builtin.BuiltinData)) -> + (Builtin.BuiltinData))))) + (3: Prim.Int) + ((mkCons: forall (a :: Prim.Type). ((a :: Prim.Type) -> + (((Builtin.BuiltinList ((a :: Prim.Type))) -> + ((Builtin.BuiltinList ((a :: Prim.Type)))))))) + ((serializePubKeyHash: (Prim.PubKeyHash -> (Builtin.BuiltinData))) + (pkh1: Prim.PubKeyHash)) + ((mkCons: forall (a :: Prim.Type). ((a :: Prim.Type) -> + (((Builtin.BuiltinList ((a :: Prim.Type))) -> + ((Builtin.BuiltinList ((a :: Prim.Type)))))))) + ((serializePubKeyHash: (Prim.PubKeyHash -> (Builtin.BuiltinData))) + (pkh2: Prim.PubKeyHash)) + ((mkNilData: (Prim.Unit -> + ((Builtin.BuiltinList (Builtin.BuiltinData))))) + (unit: Prim.Unit)))) + DCertPoolRetire pkh i -> + (constrData: (Prim.Int -> + (((Builtin.BuiltinList (Builtin.BuiltinData)) -> + (Builtin.BuiltinData))))) + (4: Prim.Int) + ((mkCons: forall (a :: Prim.Type). ((a :: Prim.Type) -> + (((Builtin.BuiltinList ((a :: Prim.Type))) -> + ((Builtin.BuiltinList ((a :: Prim.Type)))))))) + ((serializePubKeyHash: (Prim.PubKeyHash -> (Builtin.BuiltinData))) + (pkh: Prim.PubKeyHash)) + ((mkCons: forall (a :: Prim.Type). ((a :: Prim.Type) -> + (((Builtin.BuiltinList ((a :: Prim.Type))) -> + ((Builtin.BuiltinList ((a :: Prim.Type)))))))) + ((serializeInt: (Prim.Int -> (Builtin.BuiltinData))) (i: Prim.Int)) + ((mkNilData: (Prim.Unit -> + ((Builtin.BuiltinList (Builtin.BuiltinData))))) + (unit: Prim.Unit)))) + DCertGenesis -> + (constrData: (Prim.Int -> + (((Builtin.BuiltinList (Builtin.BuiltinData)) -> + (Builtin.BuiltinData))))) + (5: Prim.Int) + ((mkNilData: (Prim.Unit -> + ((Builtin.BuiltinList (Builtin.BuiltinData))))) + (unit: Prim.Unit)) + DCertMir -> + (constrData: (Prim.Int -> + (((Builtin.BuiltinList (Builtin.BuiltinData)) -> + (Builtin.BuiltinData))))) + (6: Prim.Int) + ((mkNilData: (Prim.Unit -> + ((Builtin.BuiltinList (Builtin.BuiltinData))))) + (unit: Prim.Unit)) + +serializeTokenName :: (Prim.TokenName -> (Builtin.BuiltinData)) +serializeTokenName = + \(v: Prim.TokenName) -> + case (v: Prim.TokenName) of + TokenName bs -> + (serializeByteString: (Builtin.BuiltinByteString -> + (Builtin.BuiltinData))) + (bs: Builtin.BuiltinByteString) + +serializeTxId :: (Prim.TxId -> (Builtin.BuiltinData)) +serializeTxId = + \(v: Prim.TxId) -> + case (v: Prim.TxId) of + TxId bs -> + (constrData: (Prim.Int -> + (((Builtin.BuiltinList (Builtin.BuiltinData)) -> + (Builtin.BuiltinData))))) + (0: Prim.Int) + ((mkCons: forall (a :: Prim.Type). ((a :: Prim.Type) -> + (((Builtin.BuiltinList ((a :: Prim.Type))) -> + ((Builtin.BuiltinList ((a :: Prim.Type)))))))) + ((serializeByteString: (Builtin.BuiltinByteString -> + (Builtin.BuiltinData))) + (bs: Builtin.BuiltinByteString)) + ((mkNilData: (Prim.Unit -> + ((Builtin.BuiltinList (Builtin.BuiltinData))))) + (unit: Prim.Unit))) + +serializeTxOutRef :: (Prim.TxOutRef -> (Builtin.BuiltinData)) +serializeTxOutRef = + \(v: Prim.TxOutRef) -> + case (v: Prim.TxOutRef) of + TxOutRef rec -> + (constrData: (Prim.Int -> + (((Builtin.BuiltinList (Builtin.BuiltinData)) -> + (Builtin.BuiltinData))))) + (0: Prim.Int) + ((mkCons: forall (a :: Prim.Type). ((a :: Prim.Type) -> + (((Builtin.BuiltinList ((a :: Prim.Type))) -> + ((Builtin.BuiltinList ((a :: Prim.Type)))))))) + ((serializeTxId: (Prim.TxId -> (Builtin.BuiltinData))) + ((rec: { id :: Prim.TxId, idx :: Prim.Int }) + .id)) + ((mkCons: forall (a :: Prim.Type). ((a :: Prim.Type) -> + (((Builtin.BuiltinList ((a :: Prim.Type))) -> + ((Builtin.BuiltinList ((a :: Prim.Type)))))))) + ((serializeInt: (Prim.Int -> (Builtin.BuiltinData))) + ((rec: { id :: Prim.TxId, idx :: Prim.Int }) + .idx)) + ((mkNilData: (Prim.Unit -> + ((Builtin.BuiltinList (Builtin.BuiltinData))))) + (unit: Prim.Unit)))) + +serializeScriptPurpose :: (Prim.ScriptPurpose -> (Builtin.BuiltinData)) +serializeScriptPurpose = + \(sp: Prim.ScriptPurpose) -> + case (sp: Prim.ScriptPurpose) of + Minting cs -> + (constrData: (Prim.Int -> + (((Builtin.BuiltinList (Builtin.BuiltinData)) -> + (Builtin.BuiltinData))))) + (0: Prim.Int) + ((mkCons: forall (a :: Prim.Type). ((a :: Prim.Type) -> + (((Builtin.BuiltinList ((a :: Prim.Type))) -> + ((Builtin.BuiltinList ((a :: Prim.Type)))))))) + ((serializeCurrencySymbol: (Prim.CurrencySymbol -> + (Builtin.BuiltinData))) + (cs: Prim.CurrencySymbol)) + ((mkNilData: (Prim.Unit -> + ((Builtin.BuiltinList (Builtin.BuiltinData))))) + (unit: Prim.Unit))) + Spending tor -> + (constrData: (Prim.Int -> + (((Builtin.BuiltinList (Builtin.BuiltinData)) -> + (Builtin.BuiltinData))))) + (1: Prim.Int) + ((mkCons: forall (a :: Prim.Type). ((a :: Prim.Type) -> + (((Builtin.BuiltinList ((a :: Prim.Type))) -> + ((Builtin.BuiltinList ((a :: Prim.Type)))))))) + ((serializeTxOutRef: (Prim.TxOutRef -> (Builtin.BuiltinData))) + (tor: Prim.TxOutRef)) + ((mkNilData: (Prim.Unit -> + ((Builtin.BuiltinList (Builtin.BuiltinData))))) + (unit: Prim.Unit))) + Rewarding sc -> + (constrData: (Prim.Int -> + (((Builtin.BuiltinList (Builtin.BuiltinData)) -> + (Builtin.BuiltinData))))) + (2: Prim.Int) + ((mkCons: forall (a :: Prim.Type). ((a :: Prim.Type) -> + (((Builtin.BuiltinList ((a :: Prim.Type))) -> + ((Builtin.BuiltinList ((a :: Prim.Type)))))))) + ((serializeStakingCredential: (Prim.StakingCredential -> + (Builtin.BuiltinData))) + (sc: Prim.StakingCredential)) + ((mkNilData: (Prim.Unit -> + ((Builtin.BuiltinList (Builtin.BuiltinData))))) + (unit: Prim.Unit))) + Certifying d -> + (constrData: (Prim.Int -> + (((Builtin.BuiltinList (Builtin.BuiltinData)) -> + (Builtin.BuiltinData))))) + (3: Prim.Int) + ((mkCons: forall (a :: Prim.Type). ((a :: Prim.Type) -> + (((Builtin.BuiltinList ((a :: Prim.Type))) -> + ((Builtin.BuiltinList ((a :: Prim.Type)))))))) + ((serializeDCert: (Prim.DCert -> (Builtin.BuiltinData))) + (d: Prim.DCert)) + ((mkNilData: (Prim.Unit -> + ((Builtin.BuiltinList (Builtin.BuiltinData))))) + (unit: Prim.Unit))) + +serializeAssocMap :: forall (k :: Prim.Type) (v :: Prim.Type). (((k :: Prim.Type) -> (Builtin.BuiltinData)) -> ((((v :: Prim.Type) -> (Builtin.BuiltinData)) -> ((((Prim.AssocMap ((k :: Prim.Type))) ((v :: Prim.Type))) -> (Builtin.BuiltinData)))))) +serializeAssocMap = + \(fK: ((k :: Prim.Type) -> (Builtin.BuiltinData))) -> + \(fV: ((v :: Prim.Type) -> (Builtin.BuiltinData))) -> + \(v: ((Prim.AssocMap ((k :: Prim.Type))) ((v :: Prim.Type)))) -> + case (fK: ((k :: Prim.Type) -> (Builtin.BuiltinData))) (fV: ((v :: Prim.Type) -> (Builtin.BuiltinData))) (v: ((Prim.AssocMap ((k :: Prim.Type))) ((v :: Prim.Type)))) of + fK1 fV1 AssocMap ell -> + let + go :: (List (((Prim.Tuple2 (k*12)) (v*13))) -> ((Builtin.BuiltinList (((Builtin.BuiltinPair (Builtin.BuiltinData)) (Builtin.BuiltinData)))))) + go = + \(v1: List (((Prim.Tuple2 (k*12)) (v*13)))) -> + case (v1: List (((Prim.Tuple2 (k*12)) (v*13)))) of + Cons p xs -> + case (p: ((Prim.Tuple2 (k*12)) (v*13))) of + Tuple2 x y -> + (mkCons: forall (a :: Prim.Type). ((a :: Prim.Type) -> + (((Builtin.BuiltinList ((a :: Prim.Type))) -> + ((Builtin.BuiltinList ((a :: Prim.Type)))))))) + ((mkPairData: (Builtin.BuiltinData -> + ((Builtin.BuiltinData -> + (((Builtin.BuiltinPair + (Builtin.BuiltinData)) (Builtin.BuiltinData))))))) + ((fK1: ((k :: Prim.Type) -> + (Builtin.BuiltinData))) + (x: k*12)) + ((fV1: ((v :: Prim.Type) -> + (Builtin.BuiltinData))) + (y: v*13))) + ((go: (List (((Prim.Tuple2 (k*12)) (v*13))) -> + ((Builtin.BuiltinList + (((Builtin.BuiltinPair + (Builtin.BuiltinData)) (Builtin.BuiltinData))))))) + (xs: List (((Prim.Tuple2 (k*12)) (v*13))))) + Nil -> + (mkNilPairData: (Prim.Unit -> + ((Builtin.BuiltinList + (((Builtin.BuiltinPair + (Builtin.BuiltinData)) (Builtin.BuiltinData))))))) + (unit: Prim.Unit) + in (mapData: ((Builtin.BuiltinList + (((Builtin.BuiltinPair + (Builtin.BuiltinData)) (Builtin.BuiltinData)))) -> + (Builtin.BuiltinData))) + ((go: (List (((Prim.Tuple2 (k*12)) (v*13))) -> + ((Builtin.BuiltinList + (((Builtin.BuiltinPair + (Builtin.BuiltinData)) (Builtin.BuiltinData))))))) + (ell: List (((Prim.Tuple2 + ((k :: Prim.Type))) ((v :: Prim.Type)))))) + +serializeValue :: (Prim.Value -> (Builtin.BuiltinData)) +serializeValue = + \(v: Prim.Value) -> + case (v: Prim.Value) of + Value v1 -> + (serializeAssocMap: forall (k :: Prim.Type) + (v :: Prim.Type). (((k :: Prim.Type) -> (Builtin.BuiltinData)) -> + ((((v :: Prim.Type) -> (Builtin.BuiltinData)) -> + ((((Prim.AssocMap ((k :: Prim.Type))) ((v :: Prim.Type))) -> + (Builtin.BuiltinData))))))) + (serializeCurrencySymbol: (Prim.CurrencySymbol -> + (Builtin.BuiltinData))) + ((serializeAssocMap: forall (k :: Prim.Type) + (v :: Prim.Type). (((k :: Prim.Type) -> (Builtin.BuiltinData)) -> + ((((v :: Prim.Type) -> (Builtin.BuiltinData)) -> + ((((Prim.AssocMap ((k :: Prim.Type))) ((v :: Prim.Type))) -> + (Builtin.BuiltinData))))))) + (serializeTokenName: (Prim.TokenName -> (Builtin.BuiltinData))) + (serializeInt: (Prim.Int -> (Builtin.BuiltinData)))) + (v1: ((Prim.AssocMap + (Prim.CurrencySymbol)) (((Prim.AssocMap + (Prim.TokenName)) (Prim.Int))))) + +serializeAddress :: (Prim.Address -> (Builtin.BuiltinData)) +serializeAddress = + \(v: Prim.Address) -> + case (v: Prim.Address) of + Address rec -> + (constrData: (Prim.Int -> + (((Builtin.BuiltinList (Builtin.BuiltinData)) -> + (Builtin.BuiltinData))))) + (0: Prim.Int) + ((mkCons: forall (a :: Prim.Type). ((a :: Prim.Type) -> + (((Builtin.BuiltinList ((a :: Prim.Type))) -> + ((Builtin.BuiltinList ((a :: Prim.Type)))))))) + ((serializeCredential: (Prim.Credential -> (Builtin.BuiltinData))) + ((rec: { + credential :: Prim.Credential, + stakingCredential :: (Prim.Maybe (Prim.StakingCredential)) + }) + .credential)) + ((mkCons: forall (a :: Prim.Type). ((a :: Prim.Type) -> + (((Builtin.BuiltinList ((a :: Prim.Type))) -> + ((Builtin.BuiltinList ((a :: Prim.Type)))))))) + ((serializeMaybe: forall (a :: Prim.Type). (((a :: Prim.Type) -> + (Builtin.BuiltinData)) -> + (((Prim.Maybe ((a :: Prim.Type))) -> (Builtin.BuiltinData))))) + (serializeStakingCredential: (Prim.StakingCredential -> + (Builtin.BuiltinData))) + ((rec: { + credential :: Prim.Credential, + stakingCredential :: (Prim.Maybe (Prim.StakingCredential)) + }) + .stakingCredential)) + ((mkNilData: (Prim.Unit -> + ((Builtin.BuiltinList (Builtin.BuiltinData))))) + (unit: Prim.Unit)))) + +serializeTxOut :: (Prim.TxOut -> (Builtin.BuiltinData)) +serializeTxOut = + \(v: Prim.TxOut) -> + case (v: Prim.TxOut) of + TxOut rec -> + (constrData: (Prim.Int -> + (((Builtin.BuiltinList (Builtin.BuiltinData)) -> + (Builtin.BuiltinData))))) + (0: Prim.Int) + ((mkCons: forall (a :: Prim.Type). ((a :: Prim.Type) -> + (((Builtin.BuiltinList ((a :: Prim.Type))) -> + ((Builtin.BuiltinList ((a :: Prim.Type)))))))) + ((serializeAddress: (Prim.Address -> (Builtin.BuiltinData))) + ((rec: { + address :: Prim.Address, + value :: Prim.Value, + datum :: Prim.OutputDatum, + referenceScript :: (Prim.Maybe (Prim.ScriptHash)) + }) + .address)) + ((mkCons: forall (a :: Prim.Type). ((a :: Prim.Type) -> + (((Builtin.BuiltinList ((a :: Prim.Type))) -> + ((Builtin.BuiltinList ((a :: Prim.Type)))))))) + ((serializeValue: (Prim.Value -> (Builtin.BuiltinData))) + ((rec: { + address :: Prim.Address, + value :: Prim.Value, + datum :: Prim.OutputDatum, + referenceScript :: (Prim.Maybe (Prim.ScriptHash)) + }) + .value)) + ((mkCons: forall (a :: Prim.Type). ((a :: Prim.Type) -> + (((Builtin.BuiltinList ((a :: Prim.Type))) -> + ((Builtin.BuiltinList ((a :: Prim.Type)))))))) + ((serializeOutputDatum: (Prim.OutputDatum -> (Builtin.BuiltinData))) + ((rec: { + address :: Prim.Address, + value :: Prim.Value, + datum :: Prim.OutputDatum, + referenceScript :: (Prim.Maybe (Prim.ScriptHash)) + }) + .datum)) + ((mkCons: forall (a :: Prim.Type). ((a :: Prim.Type) -> + (((Builtin.BuiltinList ((a :: Prim.Type))) -> + ((Builtin.BuiltinList ((a :: Prim.Type)))))))) + ((serializeMaybe: forall (a :: Prim.Type). (((a :: Prim.Type) -> + (Builtin.BuiltinData)) -> + (((Prim.Maybe ((a :: Prim.Type))) -> (Builtin.BuiltinData))))) + (serializeScriptHash: (Prim.ScriptHash -> (Builtin.BuiltinData))) + ((rec: { + address :: Prim.Address, + value :: Prim.Value, + datum :: Prim.OutputDatum, + referenceScript :: (Prim.Maybe (Prim.ScriptHash)) + }) + .referenceScript)) + ((mkNilData: (Prim.Unit -> + ((Builtin.BuiltinList (Builtin.BuiltinData))))) + (unit: Prim.Unit)))))) + +serializeTxInInfo :: (Prim.TxInInfo -> (Builtin.BuiltinData)) +serializeTxInInfo = + \(v: Prim.TxInInfo) -> + case (v: Prim.TxInInfo) of + TxInInfo rec -> + (constrData: (Prim.Int -> + (((Builtin.BuiltinList (Builtin.BuiltinData)) -> + (Builtin.BuiltinData))))) + (0: Prim.Int) + ((mkCons: forall (a :: Prim.Type). ((a :: Prim.Type) -> + (((Builtin.BuiltinList ((a :: Prim.Type))) -> + ((Builtin.BuiltinList ((a :: Prim.Type)))))))) + ((serializeTxOutRef: (Prim.TxOutRef -> (Builtin.BuiltinData))) + ((rec: { txOutRef :: Prim.TxOutRef, resolved :: Prim.TxOut }) + .txOutRef)) + ((mkCons: forall (a :: Prim.Type). ((a :: Prim.Type) -> + (((Builtin.BuiltinList ((a :: Prim.Type))) -> + ((Builtin.BuiltinList ((a :: Prim.Type)))))))) + ((serializeTxOut: (Prim.TxOut -> (Builtin.BuiltinData))) + ((rec: { txOutRef :: Prim.TxOutRef, resolved :: Prim.TxOut }) + .resolved)) + ((mkNilData: (Prim.Unit -> + ((Builtin.BuiltinList (Builtin.BuiltinData))))) + (unit: Prim.Unit)))) + +serializeTxInfo :: (Prim.TxInfo -> (Builtin.BuiltinData)) +serializeTxInfo = + \(v: Prim.TxInfo) -> + case (v: Prim.TxInfo) of + TxInfo rec -> + (constrData: (Prim.Int -> + (((Builtin.BuiltinList (Builtin.BuiltinData)) -> + (Builtin.BuiltinData))))) + (0: Prim.Int) + ((mkCons: forall (a :: Prim.Type). ((a :: Prim.Type) -> + (((Builtin.BuiltinList ((a :: Prim.Type))) -> + ((Builtin.BuiltinList ((a :: Prim.Type)))))))) + ((serializeList: forall (a :: Prim.Type). (((a :: Prim.Type) -> + (Builtin.BuiltinData)) -> + ((List ((a :: Prim.Type)) -> (Builtin.BuiltinData))))) + (serializeTxInInfo: (Prim.TxInInfo -> (Builtin.BuiltinData))) + ((rec: { + inputs :: List (Prim.TxInInfo), + referenceInputs :: List (Prim.TxInInfo), + outputs :: List (Prim.TxOut), + fee :: Prim.Value, + mint :: Prim.Value, + dCert :: List (Prim.DCert), + wdrl :: ((Prim.AssocMap + (Prim.StakingCredential)) (Prim.Int)), + validRange :: (Prim.Interval (Prim.POSIXTime)), + signatories :: List (Prim.PubKeyHash), + redeemers :: ((Prim.AssocMap + (Prim.ScriptPurpose)) (Prim.Redeemer)), + data :: ((Prim.AssocMap (Prim.DatumHash)) (Prim.Datum)), + id :: Prim.TxId + }) + .inputs)) + ((mkCons: forall (a :: Prim.Type). ((a :: Prim.Type) -> + (((Builtin.BuiltinList ((a :: Prim.Type))) -> + ((Builtin.BuiltinList ((a :: Prim.Type)))))))) + ((serializeList: forall (a :: Prim.Type). (((a :: Prim.Type) -> + (Builtin.BuiltinData)) -> + ((List ((a :: Prim.Type)) -> (Builtin.BuiltinData))))) + (serializeTxInInfo: (Prim.TxInInfo -> (Builtin.BuiltinData))) + ((rec: { + inputs :: List (Prim.TxInInfo), + referenceInputs :: List (Prim.TxInInfo), + outputs :: List (Prim.TxOut), + fee :: Prim.Value, + mint :: Prim.Value, + dCert :: List (Prim.DCert), + wdrl :: ((Prim.AssocMap + (Prim.StakingCredential)) (Prim.Int)), + validRange :: (Prim.Interval (Prim.POSIXTime)), + signatories :: List (Prim.PubKeyHash), + redeemers :: ((Prim.AssocMap + (Prim.ScriptPurpose)) (Prim.Redeemer)), + data :: ((Prim.AssocMap (Prim.DatumHash)) (Prim.Datum)), + id :: Prim.TxId + }) + .referenceInputs)) + ((mkCons: forall (a :: Prim.Type). ((a :: Prim.Type) -> + (((Builtin.BuiltinList ((a :: Prim.Type))) -> + ((Builtin.BuiltinList ((a :: Prim.Type)))))))) + ((serializeList: forall (a :: Prim.Type). (((a :: Prim.Type) -> + (Builtin.BuiltinData)) -> + ((List ((a :: Prim.Type)) -> (Builtin.BuiltinData))))) + (serializeTxOut: (Prim.TxOut -> (Builtin.BuiltinData))) + ((rec: { + inputs :: List (Prim.TxInInfo), + referenceInputs :: List (Prim.TxInInfo), + outputs :: List (Prim.TxOut), + fee :: Prim.Value, + mint :: Prim.Value, + dCert :: List (Prim.DCert), + wdrl :: ((Prim.AssocMap + (Prim.StakingCredential)) (Prim.Int)), + validRange :: (Prim.Interval (Prim.POSIXTime)), + signatories :: List (Prim.PubKeyHash), + redeemers :: ((Prim.AssocMap + (Prim.ScriptPurpose)) (Prim.Redeemer)), + data :: ((Prim.AssocMap (Prim.DatumHash)) (Prim.Datum)), + id :: Prim.TxId + }) + .outputs)) + ((mkCons: forall (a :: Prim.Type). ((a :: Prim.Type) -> + (((Builtin.BuiltinList ((a :: Prim.Type))) -> + ((Builtin.BuiltinList ((a :: Prim.Type)))))))) + ((serializeValue: (Prim.Value -> (Builtin.BuiltinData))) + ((rec: { + inputs :: List (Prim.TxInInfo), + referenceInputs :: List (Prim.TxInInfo), + outputs :: List (Prim.TxOut), + fee :: Prim.Value, + mint :: Prim.Value, + dCert :: List (Prim.DCert), + wdrl :: ((Prim.AssocMap + (Prim.StakingCredential)) (Prim.Int)), + validRange :: (Prim.Interval (Prim.POSIXTime)), + signatories :: List (Prim.PubKeyHash), + redeemers :: ((Prim.AssocMap + (Prim.ScriptPurpose)) (Prim.Redeemer)), + data :: ((Prim.AssocMap (Prim.DatumHash)) (Prim.Datum)), + id :: Prim.TxId + }) + .fee)) + ((mkCons: forall (a :: Prim.Type). ((a :: Prim.Type) -> + (((Builtin.BuiltinList ((a :: Prim.Type))) -> + ((Builtin.BuiltinList ((a :: Prim.Type)))))))) + ((serializeValue: (Prim.Value -> (Builtin.BuiltinData))) + ((rec: { + inputs :: List (Prim.TxInInfo), + referenceInputs :: List (Prim.TxInInfo), + outputs :: List (Prim.TxOut), + fee :: Prim.Value, + mint :: Prim.Value, + dCert :: List (Prim.DCert), + wdrl :: ((Prim.AssocMap + (Prim.StakingCredential)) (Prim.Int)), + validRange :: (Prim.Interval (Prim.POSIXTime)), + signatories :: List (Prim.PubKeyHash), + redeemers :: ((Prim.AssocMap + (Prim.ScriptPurpose)) (Prim.Redeemer)), + data :: ((Prim.AssocMap (Prim.DatumHash)) (Prim.Datum)), + id :: Prim.TxId + }) + .mint)) + ((mkCons: forall (a :: Prim.Type). ((a :: Prim.Type) -> + (((Builtin.BuiltinList ((a :: Prim.Type))) -> + ((Builtin.BuiltinList ((a :: Prim.Type)))))))) + ((serializeList: forall (a :: Prim.Type). (((a :: Prim.Type) -> + (Builtin.BuiltinData)) -> + ((List ((a :: Prim.Type)) -> (Builtin.BuiltinData))))) + (serializeDCert: (Prim.DCert -> (Builtin.BuiltinData))) + ((rec: { + inputs :: List (Prim.TxInInfo), + referenceInputs :: List (Prim.TxInInfo), + outputs :: List (Prim.TxOut), + fee :: Prim.Value, + mint :: Prim.Value, + dCert :: List (Prim.DCert), + wdrl :: ((Prim.AssocMap + (Prim.StakingCredential)) (Prim.Int)), + validRange :: (Prim.Interval (Prim.POSIXTime)), + signatories :: List (Prim.PubKeyHash), + redeemers :: ((Prim.AssocMap + (Prim.ScriptPurpose)) (Prim.Redeemer)), + data :: ((Prim.AssocMap + (Prim.DatumHash)) (Prim.Datum)), + id :: Prim.TxId + }) + .dCert)) + ((mkCons: forall (a :: Prim.Type). ((a :: Prim.Type) -> + (((Builtin.BuiltinList ((a :: Prim.Type))) -> + ((Builtin.BuiltinList ((a :: Prim.Type)))))))) + ((serializeAssocMap: forall (k :: Prim.Type) + (v :: Prim.Type). (((k :: Prim.Type) -> + (Builtin.BuiltinData)) -> + ((((v :: Prim.Type) -> (Builtin.BuiltinData)) -> + ((((Prim.AssocMap ((k :: Prim.Type))) ((v :: Prim.Type))) -> + (Builtin.BuiltinData))))))) + (serializeStakingCredential: (Prim.StakingCredential -> + (Builtin.BuiltinData))) + (serializeInt: (Prim.Int -> (Builtin.BuiltinData))) + ((rec: { + inputs :: List (Prim.TxInInfo), + referenceInputs :: List (Prim.TxInInfo), + outputs :: List (Prim.TxOut), + fee :: Prim.Value, + mint :: Prim.Value, + dCert :: List (Prim.DCert), + wdrl :: ((Prim.AssocMap + (Prim.StakingCredential)) (Prim.Int)), + validRange :: (Prim.Interval (Prim.POSIXTime)), + signatories :: List (Prim.PubKeyHash), + redeemers :: ((Prim.AssocMap + (Prim.ScriptPurpose)) (Prim.Redeemer)), + data :: ((Prim.AssocMap + (Prim.DatumHash)) (Prim.Datum)), + id :: Prim.TxId + }) + .wdrl)) + ((mkCons: forall (a :: Prim.Type). ((a :: Prim.Type) -> + (((Builtin.BuiltinList ((a :: Prim.Type))) -> + ((Builtin.BuiltinList ((a :: Prim.Type)))))))) + ((serializeInterval: forall (a :: Prim.Type). (((a :: Prim.Type) -> + (Builtin.BuiltinData)) -> + (((Prim.Interval ((a :: Prim.Type))) -> + (Builtin.BuiltinData))))) + (serializePOSIXTime: (Prim.POSIXTime -> + (Builtin.BuiltinData))) + ((rec: { + inputs :: List (Prim.TxInInfo), + referenceInputs :: List (Prim.TxInInfo), + outputs :: List (Prim.TxOut), + fee :: Prim.Value, + mint :: Prim.Value, + dCert :: List (Prim.DCert), + wdrl :: ((Prim.AssocMap + (Prim.StakingCredential)) (Prim.Int)), + validRange :: (Prim.Interval (Prim.POSIXTime)), + signatories :: List (Prim.PubKeyHash), + redeemers :: ((Prim.AssocMap + (Prim.ScriptPurpose)) (Prim.Redeemer)), + data :: ((Prim.AssocMap + (Prim.DatumHash)) (Prim.Datum)), + id :: Prim.TxId + }) + .validRange)) + ((mkCons: forall (a :: Prim.Type). ((a :: Prim.Type) -> + (((Builtin.BuiltinList ((a :: Prim.Type))) -> + ((Builtin.BuiltinList ((a :: Prim.Type)))))))) + ((serializeList: forall (a :: Prim.Type). (((a :: Prim.Type) -> + (Builtin.BuiltinData)) -> + ((List ((a :: Prim.Type)) -> (Builtin.BuiltinData))))) + (serializePubKeyHash: (Prim.PubKeyHash -> + (Builtin.BuiltinData))) + ((rec: { + inputs :: List (Prim.TxInInfo), + referenceInputs :: List (Prim.TxInInfo), + outputs :: List (Prim.TxOut), + fee :: Prim.Value, + mint :: Prim.Value, + dCert :: List (Prim.DCert), + wdrl :: ((Prim.AssocMap + (Prim.StakingCredential)) (Prim.Int)), + validRange :: (Prim.Interval (Prim.POSIXTime)), + signatories :: List (Prim.PubKeyHash), + redeemers :: ((Prim.AssocMap + (Prim.ScriptPurpose)) (Prim.Redeemer)), + data :: ((Prim.AssocMap + (Prim.DatumHash)) (Prim.Datum)), + id :: Prim.TxId + }) + .signatories)) + ((mkCons: forall (a :: Prim.Type). ((a :: Prim.Type) -> + (((Builtin.BuiltinList ((a :: Prim.Type))) -> + ((Builtin.BuiltinList ((a :: Prim.Type)))))))) + ((serializeAssocMap: forall (k :: Prim.Type) + (v :: Prim.Type). (((k :: Prim.Type) -> + (Builtin.BuiltinData)) -> + ((((v :: Prim.Type) -> (Builtin.BuiltinData)) -> + ((((Prim.AssocMap ((k :: Prim.Type))) ((v :: Prim.Type))) -> + (Builtin.BuiltinData))))))) + (serializeScriptPurpose: (Prim.ScriptPurpose -> + (Builtin.BuiltinData))) + (serializeRedeemer: (Prim.Redeemer -> + (Builtin.BuiltinData))) + ((rec: { + inputs :: List (Prim.TxInInfo), + referenceInputs :: List (Prim.TxInInfo), + outputs :: List (Prim.TxOut), + fee :: Prim.Value, + mint :: Prim.Value, + dCert :: List (Prim.DCert), + wdrl :: ((Prim.AssocMap + (Prim.StakingCredential)) (Prim.Int)), + validRange :: (Prim.Interval (Prim.POSIXTime)), + signatories :: List (Prim.PubKeyHash), + redeemers :: ((Prim.AssocMap + (Prim.ScriptPurpose)) (Prim.Redeemer)), + data :: ((Prim.AssocMap + (Prim.DatumHash)) (Prim.Datum)), + id :: Prim.TxId + }) + .redeemers)) + ((mkCons: forall (a :: Prim.Type). ((a :: Prim.Type) -> + (((Builtin.BuiltinList ((a :: Prim.Type))) -> + ((Builtin.BuiltinList ((a :: Prim.Type)))))))) + ((serializeAssocMap: forall (k :: Prim.Type) + (v :: Prim.Type). (((k :: Prim.Type) -> + (Builtin.BuiltinData)) -> + ((((v :: Prim.Type) -> (Builtin.BuiltinData)) -> + ((((Prim.AssocMap + ((k :: Prim.Type))) ((v :: Prim.Type))) -> + (Builtin.BuiltinData))))))) + (serializeDatumHash: (Prim.DatumHash -> + (Builtin.BuiltinData))) + (serializeDatum: (Prim.Datum -> (Builtin.BuiltinData))) + ((rec: { + inputs :: List (Prim.TxInInfo), + referenceInputs :: List (Prim.TxInInfo), + outputs :: List (Prim.TxOut), + fee :: Prim.Value, + mint :: Prim.Value, + dCert :: List (Prim.DCert), + wdrl :: ((Prim.AssocMap + (Prim.StakingCredential)) (Prim.Int)), + validRange :: (Prim.Interval (Prim.POSIXTime)), + signatories :: List (Prim.PubKeyHash), + redeemers :: ((Prim.AssocMap + (Prim.ScriptPurpose)) (Prim.Redeemer)), + data :: ((Prim.AssocMap + (Prim.DatumHash)) (Prim.Datum)), + id :: Prim.TxId + }) + .data)) + ((mkCons: forall (a :: Prim.Type). ((a :: Prim.Type) -> + (((Builtin.BuiltinList ((a :: Prim.Type))) -> + ((Builtin.BuiltinList ((a :: Prim.Type)))))))) + ((serializeTxId: (Prim.TxId -> (Builtin.BuiltinData))) + ((rec: { + inputs :: List (Prim.TxInInfo), + referenceInputs :: List (Prim.TxInInfo), + outputs :: List (Prim.TxOut), + fee :: Prim.Value, + mint :: Prim.Value, + dCert :: List (Prim.DCert), + wdrl :: ((Prim.AssocMap + (Prim.StakingCredential)) (Prim.Int)), + validRange :: (Prim.Interval (Prim.POSIXTime)), + signatories :: List (Prim.PubKeyHash), + redeemers :: ((Prim.AssocMap + (Prim.ScriptPurpose)) (Prim.Redeemer)), + data :: ((Prim.AssocMap + (Prim.DatumHash)) (Prim.Datum)), + id :: Prim.TxId + }) + .id)) + ((mkNilData: (Prim.Unit -> + ((Builtin.BuiltinList (Builtin.BuiltinData))))) + (unit: Prim.Unit)))))))))))))) + +serializeScriptContext :: (Prim.ScriptContext -> (Builtin.BuiltinData)) +serializeScriptContext = + \(v: Prim.ScriptContext) -> + case (v: Prim.ScriptContext) of + ScriptContext rec -> + (constrData: (Prim.Int -> + (((Builtin.BuiltinList (Builtin.BuiltinData)) -> + (Builtin.BuiltinData))))) + (0: Prim.Int) + ((mkCons: forall (a :: Prim.Type). ((a :: Prim.Type) -> + (((Builtin.BuiltinList ((a :: Prim.Type))) -> + ((Builtin.BuiltinList ((a :: Prim.Type)))))))) + ((serializeTxInfo: (Prim.TxInfo -> (Builtin.BuiltinData))) + ((rec: { txInfo :: Prim.TxInfo, purpose :: Prim.ScriptPurpose }) + .txInfo)) + ((mkCons: forall (a :: Prim.Type). ((a :: Prim.Type) -> + (((Builtin.BuiltinList ((a :: Prim.Type))) -> + ((Builtin.BuiltinList ((a :: Prim.Type)))))))) + ((serializeScriptPurpose: (Prim.ScriptPurpose -> + (Builtin.BuiltinData))) + ((rec: { txInfo :: Prim.TxInfo, purpose :: Prim.ScriptPurpose }) + .purpose)) + ((mkNilData: (Prim.Unit -> + ((Builtin.BuiltinList (Builtin.BuiltinData))))) + (unit: Prim.Unit)))) + +productList :: (List (Prim.Int) -> (Prim.Int)) +productList = + \(ell: List (Prim.Int)) -> + case (ell: List (Prim.Int)) of + Nil -> (1: Prim.Int) + Cons x xs -> + (multiplyInteger: (Prim.Int -> ((Prim.Int -> (Prim.Int))))) + (x: Prim.Int) + ((productList: (List (Prim.Int) -> (Prim.Int))) (xs: List (Prim.Int))) + +or :: (Prim.Boolean -> ((Prim.Boolean -> (Prim.Boolean)))) +or = + \(x: Prim.Boolean) -> + \(y: Prim.Boolean) -> + (ifThenElse: forall (x :: Prim.Type). (Prim.Boolean -> + (((x :: Prim.Type) -> (((x :: Prim.Type) -> ((x :: Prim.Type)))))))) + (x: Prim.Boolean) + (True: Prim.Boolean) + (y: Prim.Boolean) + +not :: (Prim.Boolean -> (Prim.Boolean)) +not = + \(x: Prim.Boolean) -> + (ifThenElse: forall (x :: Prim.Type). (Prim.Boolean -> + (((x :: Prim.Type) -> (((x :: Prim.Type) -> ((x :: Prim.Type)))))))) + (x: Prim.Boolean) + (False: Prim.Boolean) + (True: Prim.Boolean) + +xor :: (Prim.Boolean -> ((Prim.Boolean -> (Prim.Boolean)))) +xor = + \(x: Prim.Boolean) -> + \(y: Prim.Boolean) -> + (ifThenElse: forall (x :: Prim.Type). (Prim.Boolean -> + (((x :: Prim.Type) -> (((x :: Prim.Type) -> ((x :: Prim.Type)))))))) + (x: Prim.Boolean) + ((not: (Prim.Boolean -> (Prim.Boolean))) (y: Prim.Boolean)) + (y: Prim.Boolean) + +maybe :: forall (a :: Prim.Type) (b :: Prim.Type). ((b :: Prim.Type) -> ((((a :: Prim.Type) -> ((b :: Prim.Type))) -> (((Prim.Maybe ((a :: Prim.Type))) -> ((b :: Prim.Type))))))) +maybe = + \(whenNothing: (b :: Prim.Type)) -> + \(whenJust: ((a :: Prim.Type) -> ((b :: Prim.Type)))) -> + \(m: (Prim.Maybe ((a :: Prim.Type)))) -> + case (m: (Prim.Maybe ((a :: Prim.Type)))) of + Nothing -> (whenNothing: (b :: Prim.Type)) + Just x -> + (whenJust: ((a :: Prim.Type) -> ((b :: Prim.Type)))) + (x: (a :: Prim.Type)) + +mapList :: forall (a :: Prim.Type) (b :: Prim.Type). (((a :: Prim.Type) -> ((b :: Prim.Type))) -> ((List ((a :: Prim.Type)) -> (List ((b :: Prim.Type)))))) +mapList = + \(f: ((a :: Prim.Type) -> ((b :: Prim.Type)))) -> + \(ell: List ((a :: Prim.Type))) -> + case (ell: List ((a :: Prim.Type))) of + Nil -> (Nil: List ((b :: Prim.Type))) + Cons x xs -> + (Cons: forall (x :: Prim.Type). ((x :: Prim.Type) -> + ((List ((x :: Prim.Type)) -> (List ((x :: Prim.Type))))))) + ((f: ((a :: Prim.Type) -> ((b :: Prim.Type)))) (x: (a :: Prim.Type))) + ((mapList: forall (a :: Prim.Type) + (b :: Prim.Type). (((a :: Prim.Type) -> ((b :: Prim.Type))) -> + ((List ((a :: Prim.Type)) -> (List ((b :: Prim.Type))))))) + (f: ((a :: Prim.Type) -> ((b :: Prim.Type)))) + (xs: List ((a :: Prim.Type)))) + +lengthList :: forall (a :: Prim.Type). (List ((a :: Prim.Type)) -> (Prim.Int)) +lengthList = + \(ell: List ((a :: Prim.Type))) -> + case (ell: List ((a :: Prim.Type))) of + Nil -> (0: Prim.Int) + Cons _ xs -> + (addInteger: (Prim.Int -> ((Prim.Int -> (Prim.Int))))) + (1: Prim.Int) + ((lengthList: forall (a :: Prim.Type). (List ((a :: Prim.Type)) -> + (Prim.Int))) + (xs: List ((a :: Prim.Type)))) + +identity :: forall (a :: Prim.Type). ((a :: Prim.Type) -> ((a :: Prim.Type))) +identity = \(x: (a :: Prim.Type)) -> (x: (a :: Prim.Type)) + +fromMaybe :: forall (a :: Prim.Type). ((a :: Prim.Type) -> (((Prim.Maybe ((a :: Prim.Type))) -> ((a :: Prim.Type))))) +fromMaybe = + \(whenNothing: (a :: Prim.Type)) -> + \(m: (Prim.Maybe ((a :: Prim.Type)))) -> + case (m: (Prim.Maybe ((a :: Prim.Type)))) of + Nothing -> (whenNothing: (a :: Prim.Type)) + Just x -> (x: (a :: Prim.Type)) + +flip :: forall (a :: Prim.Type) (b :: Prim.Type) (c :: Prim.Type). (((a :: Prim.Type) -> (((b :: Prim.Type) -> ((c :: Prim.Type))))) -> (((b :: Prim.Type) -> (((a :: Prim.Type) -> ((c :: Prim.Type))))))) +flip = + \(f: ((a :: Prim.Type) -> (((b :: Prim.Type) -> ((c :: Prim.Type)))))) -> + \(x: (b :: Prim.Type)) -> + \(y: (a :: Prim.Type)) -> + (f: ((a :: Prim.Type) -> (((b :: Prim.Type) -> ((c :: Prim.Type)))))) + (y: (a :: Prim.Type)) + (x: (b :: Prim.Type)) + +filterList :: forall (a :: Prim.Type). (((a :: Prim.Type) -> (Prim.Boolean)) -> ((List ((a :: Prim.Type)) -> (List ((a :: Prim.Type)))))) +filterList = + \(f: ((a :: Prim.Type) -> (Prim.Boolean))) -> + \(ell: List ((a :: Prim.Type))) -> + case (ell: List ((a :: Prim.Type))) of + Nil -> (Nil: List ((a :: Prim.Type))) + Cons x xs -> + case ((f: ((a :: Prim.Type) -> (Prim.Boolean))) (x: (a :: Prim.Type))) of + True -> + (Cons: forall (x :: Prim.Type). ((x :: Prim.Type) -> + ((List ((x :: Prim.Type)) -> (List ((x :: Prim.Type))))))) + (x: (a :: Prim.Type)) + ((filterList: forall (a :: Prim.Type). (((a :: Prim.Type) -> + (Prim.Boolean)) -> + ((List ((a :: Prim.Type)) -> (List ((a :: Prim.Type))))))) + (f: ((a :: Prim.Type) -> (Prim.Boolean))) + (xs: List ((a :: Prim.Type)))) + _ -> + (filterList: forall (a :: Prim.Type). (((a :: Prim.Type) -> + (Prim.Boolean)) -> + ((List ((a :: Prim.Type)) -> (List ((a :: Prim.Type))))))) + (f: ((a :: Prim.Type) -> (Prim.Boolean))) + (xs: List ((a :: Prim.Type))) + +dropList :: forall (a :: Prim.Type). (Prim.Int -> ((List ((a :: Prim.Type)) -> (List ((a :: Prim.Type)))))) +dropList = + \(count: Prim.Int) -> + \(ell: List ((a :: Prim.Type))) -> + case ((lessThanEqualsInteger: (Prim.Int -> ((Prim.Int -> (Prim.Boolean))))) (count: Prim.Int) (0: Prim.Int)) of + True -> (ell: List ((a :: Prim.Type))) + _ -> + case (ell: List ((a :: Prim.Type))) of + Nil -> (Nil: List ((a :: Prim.Type))) + Cons _ xs -> + (dropList: forall (a :: Prim.Type). (Prim.Int -> + ((List ((a :: Prim.Type)) -> (List ((a :: Prim.Type))))))) + ((subtractInteger: (Prim.Int -> ((Prim.Int -> (Prim.Int))))) + (count: Prim.Int) + (1: Prim.Int)) + (xs: List ((a :: Prim.Type))) + +deserializeTuple2 :: forall (a :: Prim.Type) (b :: Prim.Type). ((Builtin.BuiltinData -> ((a :: Prim.Type))) -> (((Builtin.BuiltinData -> ((b :: Prim.Type))) -> ((Builtin.BuiltinData -> (((Prim.Tuple2 ((a :: Prim.Type))) ((b :: Prim.Type))))))))) +deserializeTuple2 = + \(fA: (Builtin.BuiltinData -> ((a :: Prim.Type)))) -> + \(fB: (Builtin.BuiltinData -> ((b :: Prim.Type)))) -> + \(dat: Builtin.BuiltinData) -> + let + dat' :: Builtin.BuiltinData + dat' = + (sndPair: forall (a :: Prim.Type) + (b :: Prim.Type). (((Builtin.BuiltinPair + ((a :: Prim.Type))) ((b :: Prim.Type))) -> + ((b :: Prim.Type)))) + ((unConstrData: (Builtin.BuiltinData -> + (((Builtin.BuiltinPair (Prim.Int)) (Builtin.BuiltinData))))) + (dat: Builtin.BuiltinData)) + unlisted :: (Builtin.BuiltinList (Builtin.BuiltinData)) + unlisted = + (unListData: (Builtin.BuiltinData -> + ((Builtin.BuiltinList (Builtin.BuiltinData))))) + (dat': Builtin.BuiltinData) + unlisted' :: (Builtin.BuiltinList (Builtin.BuiltinData)) + unlisted' = + (tailList: forall (a :: Prim.Type). ((Builtin.BuiltinList + ((a :: Prim.Type))) -> + ((Builtin.BuiltinList ((a :: Prim.Type)))))) + (unlisted: (Builtin.BuiltinList (Builtin.BuiltinData))) + y :: (b :: Prim.Type) + y = + (fB: (Builtin.BuiltinData -> ((b :: Prim.Type)))) + ((headList: forall (a :: Prim.Type). ((Builtin.BuiltinList + ((a :: Prim.Type))) -> + ((a :: Prim.Type)))) + (unlisted': (Builtin.BuiltinList (Builtin.BuiltinData)))) + x :: (a :: Prim.Type) + x = + (fA: (Builtin.BuiltinData -> ((a :: Prim.Type)))) + ((headList: forall (a :: Prim.Type). ((Builtin.BuiltinList + ((a :: Prim.Type))) -> + ((a :: Prim.Type)))) + (unlisted: (Builtin.BuiltinList (Builtin.BuiltinData)))) + in (Tuple2: forall (t1 :: Prim.Type) + (t2 :: Prim.Type). ((t1 :: Prim.Type) -> + (((t2 :: Prim.Type) -> + (((Prim.Tuple2 ((t1 :: Prim.Type))) ((t2 :: Prim.Type)))))))) + (x: a*26) + (y: b*27) + +deserializeRedeemer :: (Builtin.BuiltinData -> (Prim.Redeemer)) +deserializeRedeemer = (Redeemer: (Builtin.BuiltinData -> (Prim.Redeemer))) + +deserializeMaybe :: forall (a :: Prim.Type). ((Builtin.BuiltinData -> ((a :: Prim.Type))) -> ((Builtin.BuiltinData -> ((Prim.Maybe ((a :: Prim.Type))))))) +deserializeMaybe = + \(f: (Builtin.BuiltinData -> ((a :: Prim.Type)))) -> + \(dat: Builtin.BuiltinData) -> + let + p :: ((Builtin.BuiltinPair (Prim.Int)) (Builtin.BuiltinData)) + p = + (unConstrData: (Builtin.BuiltinData -> + (((Builtin.BuiltinPair (Prim.Int)) (Builtin.BuiltinData))))) + (dat: Builtin.BuiltinData) + tag :: Prim.Int + tag = + (fstPair: forall (a :: Prim.Type) + (b :: Prim.Type). (((Builtin.BuiltinPair + ((a :: Prim.Type))) ((b :: Prim.Type))) -> + ((a :: Prim.Type)))) + (p: ((Builtin.BuiltinPair (Prim.Int)) (Builtin.BuiltinData))) + in case ((equalsInteger: (Prim.Int -> ((Prim.Int -> (Prim.Boolean))))) (tag: Prim.Int) (0: Prim.Int)) of + True -> (Nothing: (Prim.Maybe (a*28))) + _ -> + let + unlisted :: (Builtin.BuiltinList (Builtin.BuiltinData)) + unlisted = + (unListData: (Builtin.BuiltinData -> + ((Builtin.BuiltinList (Builtin.BuiltinData))))) + ((sndPair: forall (a :: Prim.Type) + (b :: Prim.Type). (((Builtin.BuiltinPair + ((a :: Prim.Type))) ((b :: Prim.Type))) -> + ((b :: Prim.Type)))) + (p: ((Builtin.BuiltinPair + (Prim.Int)) (Builtin.BuiltinData)))) + in (Just: forall (a :: Prim.Type). ((a :: Prim.Type) -> + ((Prim.Maybe ((a :: Prim.Type)))))) + ((f: (Builtin.BuiltinData -> ((a :: Prim.Type)))) + ((headList: forall (a :: Prim.Type). ((Builtin.BuiltinList + ((a :: Prim.Type))) -> + ((a :: Prim.Type)))) + (unlisted: (Builtin.BuiltinList (Builtin.BuiltinData))))) + +deserializeList :: forall (a :: Prim.Type). ((Builtin.BuiltinData -> ((a :: Prim.Type))) -> ((Builtin.BuiltinData -> (List ((a :: Prim.Type)))))) +deserializeList = + \(f: (Builtin.BuiltinData -> ((a :: Prim.Type)))) -> + \(dat: Builtin.BuiltinData) -> + let + go :: ((Builtin.BuiltinList (Builtin.BuiltinData)) -> (List (a*29))) + go = + \(ell: (Builtin.BuiltinList (Builtin.BuiltinData))) -> + case ((nullList: forall (a :: Prim.Type). ((Builtin.BuiltinList ((a :: Prim.Type))) -> (Prim.Boolean))) (ell: (Builtin.BuiltinList (Builtin.BuiltinData)))) of + True -> (Nil: List (a*29)) + _ -> + let + t :: (Builtin.BuiltinList (Builtin.BuiltinData)) + t = + (tailList: forall (a :: Prim.Type). ((Builtin.BuiltinList + ((a :: Prim.Type))) -> + ((Builtin.BuiltinList ((a :: Prim.Type)))))) + (ell: (Builtin.BuiltinList (Builtin.BuiltinData))) + h :: Builtin.BuiltinData + h = + (headList: forall (a :: Prim.Type). ((Builtin.BuiltinList + ((a :: Prim.Type))) -> + ((a :: Prim.Type)))) + (ell: (Builtin.BuiltinList (Builtin.BuiltinData))) + in (Cons: forall (x :: Prim.Type). ((x :: Prim.Type) -> + ((List ((x :: Prim.Type)) -> (List ((x :: Prim.Type))))))) + ((f: (Builtin.BuiltinData -> ((a :: Prim.Type)))) + (h: Builtin.BuiltinData)) + ((go: ((Builtin.BuiltinList (Builtin.BuiltinData)) -> + (List (a*29)))) + (t: (Builtin.BuiltinList (Builtin.BuiltinData)))) + in let + unlisted :: (Builtin.BuiltinList (Builtin.BuiltinData)) + unlisted = + (unListData: (Builtin.BuiltinData -> + ((Builtin.BuiltinList (Builtin.BuiltinData))))) + (dat: Builtin.BuiltinData) + in (go: ((Builtin.BuiltinList (Builtin.BuiltinData)) -> (List (a*29)))) + (unlisted: (Builtin.BuiltinList (Builtin.BuiltinData))) + +deserializeInt :: (Builtin.BuiltinData -> (Prim.Int)) +deserializeInt = (unIData: (Builtin.BuiltinData -> (Prim.Int))) + +deserializeLovelace :: (Builtin.BuiltinData -> (Prim.Lovelace)) +deserializeLovelace = + \(dat: Builtin.BuiltinData) -> + (Lovelace: (Prim.Int -> (Prim.Lovelace))) + ((deserializeInt: (Builtin.BuiltinData -> (Prim.Int))) + (dat: Builtin.BuiltinData)) + +deserializePOSIXTime :: (Builtin.BuiltinData -> (Prim.POSIXTime)) +deserializePOSIXTime = + \(dat: Builtin.BuiltinData) -> + (POSIXTime: (Prim.Int -> (Prim.POSIXTime))) + ((deserializeInt: (Builtin.BuiltinData -> (Prim.Int))) + (dat: Builtin.BuiltinData)) + +deserializeExtended :: forall (a :: Prim.Type). ((Builtin.BuiltinData -> ((a :: Prim.Type))) -> ((Builtin.BuiltinData -> ((Prim.Extended ((a :: Prim.Type))))))) +deserializeExtended = + \(f: (Builtin.BuiltinData -> ((a :: Prim.Type)))) -> + \(dat: Builtin.BuiltinData) -> + let + p :: ((Builtin.BuiltinPair (Prim.Int)) (Builtin.BuiltinData)) + p = + (unConstrData: (Builtin.BuiltinData -> + (((Builtin.BuiltinPair (Prim.Int)) (Builtin.BuiltinData))))) + (dat: Builtin.BuiltinData) + tag :: Prim.Int + tag = + (fstPair: forall (a :: Prim.Type) + (b :: Prim.Type). (((Builtin.BuiltinPair + ((a :: Prim.Type))) ((b :: Prim.Type))) -> + ((a :: Prim.Type)))) + (p: ((Builtin.BuiltinPair (Prim.Int)) (Builtin.BuiltinData))) + in case ((equalsInteger: (Prim.Int -> ((Prim.Int -> (Prim.Boolean))))) (tag: Prim.Int) (0: Prim.Int)) of + True -> (NegInf: (Prim.Extended (a*30))) + _ -> + case ((equalsInteger: (Prim.Int -> ((Prim.Int -> (Prim.Boolean))))) (tag: Prim.Int) (1: Prim.Int)) of + True -> + let + unlisted :: (Builtin.BuiltinList (Builtin.BuiltinData)) + unlisted = + (unListData: (Builtin.BuiltinData -> + ((Builtin.BuiltinList (Builtin.BuiltinData))))) + ((sndPair: forall (a :: Prim.Type) + (b :: Prim.Type). (((Builtin.BuiltinPair + ((a :: Prim.Type))) ((b :: Prim.Type))) -> + ((b :: Prim.Type)))) + (p: ((Builtin.BuiltinPair + (Prim.Int)) (Builtin.BuiltinData)))) + in (Finite: forall (a :: Prim.Type). ((a :: Prim.Type) -> + ((Prim.Extended ((a :: Prim.Type)))))) + ((f: (Builtin.BuiltinData -> ((a :: Prim.Type)))) + ((headList: forall (a :: Prim.Type). ((Builtin.BuiltinList + ((a :: Prim.Type))) -> + ((a :: Prim.Type)))) + (unlisted: (Builtin.BuiltinList + (Builtin.BuiltinData))))) + _ -> (PosInf: (Prim.Extended (a*30))) + +deserializeLowerBound :: forall (a :: Prim.Type). ((Builtin.BuiltinData -> ((a :: Prim.Type))) -> ((Builtin.BuiltinData -> ((Prim.LowerBound ((a :: Prim.Type))))))) +deserializeLowerBound = + \(f: (Builtin.BuiltinData -> ((a :: Prim.Type)))) -> + \(dat: Builtin.BuiltinData) -> + let + dat' :: Builtin.BuiltinData + dat' = + (sndPair: forall (a :: Prim.Type) + (b :: Prim.Type). (((Builtin.BuiltinPair + ((a :: Prim.Type))) ((b :: Prim.Type))) -> + ((b :: Prim.Type)))) + ((unConstrData: (Builtin.BuiltinData -> + (((Builtin.BuiltinPair (Prim.Int)) (Builtin.BuiltinData))))) + (dat: Builtin.BuiltinData)) + unlisted :: (Builtin.BuiltinList (Builtin.BuiltinData)) + unlisted = + (unListData: (Builtin.BuiltinData -> + ((Builtin.BuiltinList (Builtin.BuiltinData))))) + (dat': Builtin.BuiltinData) + e :: forall (a :: Prim.Type). (Prim.Extended ((a :: Prim.Type))) + e = + (deserializeExtended: forall (a :: Prim.Type). ((Builtin.BuiltinData -> + ((a :: Prim.Type))) -> + ((Builtin.BuiltinData -> ((Prim.Extended ((a :: Prim.Type)))))))) + (f: (Builtin.BuiltinData -> ((a :: Prim.Type)))) + ((headList: forall (a :: Prim.Type). ((Builtin.BuiltinList + ((a :: Prim.Type))) -> + ((a :: Prim.Type)))) + (unlisted: (Builtin.BuiltinList (Builtin.BuiltinData)))) + in (LowerBound: forall (a :: Prim.Type). ((Prim.Extended + ((a :: Prim.Type))) -> + ((Prim.LowerBound ((a :: Prim.Type)))))) + (e: (Prim.Extended (a*31))) + +deserializeUpperBound :: forall (a :: Prim.Type). ((Builtin.BuiltinData -> ((a :: Prim.Type))) -> ((Builtin.BuiltinData -> ((Prim.UpperBound ((a :: Prim.Type))))))) +deserializeUpperBound = + \(f: (Builtin.BuiltinData -> ((a :: Prim.Type)))) -> + \(dat: Builtin.BuiltinData) -> + let + dat' :: Builtin.BuiltinData + dat' = + (sndPair: forall (a :: Prim.Type) + (b :: Prim.Type). (((Builtin.BuiltinPair + ((a :: Prim.Type))) ((b :: Prim.Type))) -> + ((b :: Prim.Type)))) + ((unConstrData: (Builtin.BuiltinData -> + (((Builtin.BuiltinPair (Prim.Int)) (Builtin.BuiltinData))))) + (dat: Builtin.BuiltinData)) + unlisted :: (Builtin.BuiltinList (Builtin.BuiltinData)) + unlisted = + (unListData: (Builtin.BuiltinData -> + ((Builtin.BuiltinList (Builtin.BuiltinData))))) + (dat': Builtin.BuiltinData) + e :: forall (a :: Prim.Type). (Prim.Extended ((a :: Prim.Type))) + e = + (deserializeExtended: forall (a :: Prim.Type). ((Builtin.BuiltinData -> + ((a :: Prim.Type))) -> + ((Builtin.BuiltinData -> ((Prim.Extended ((a :: Prim.Type)))))))) + (f: (Builtin.BuiltinData -> ((a :: Prim.Type)))) + ((headList: forall (a :: Prim.Type). ((Builtin.BuiltinList + ((a :: Prim.Type))) -> + ((a :: Prim.Type)))) + (unlisted: (Builtin.BuiltinList (Builtin.BuiltinData)))) + in (UpperBound: forall (a :: Prim.Type). ((Prim.Extended + ((a :: Prim.Type))) -> + ((Prim.UpperBound ((a :: Prim.Type)))))) + (e: (Prim.Extended (a*32))) + +deserializeInterval :: forall (a :: Prim.Type). ((Builtin.BuiltinData -> ((a :: Prim.Type))) -> ((Builtin.BuiltinData -> ((Prim.Interval ((a :: Prim.Type))))))) +deserializeInterval = + \(f: (Builtin.BuiltinData -> ((a :: Prim.Type)))) -> + \(dat: Builtin.BuiltinData) -> + let + dat' :: Builtin.BuiltinData + dat' = + (sndPair: forall (a :: Prim.Type) + (b :: Prim.Type). (((Builtin.BuiltinPair + ((a :: Prim.Type))) ((b :: Prim.Type))) -> + ((b :: Prim.Type)))) + ((unConstrData: (Builtin.BuiltinData -> + (((Builtin.BuiltinPair (Prim.Int)) (Builtin.BuiltinData))))) + (dat: Builtin.BuiltinData)) + unlisted :: (Builtin.BuiltinList (Builtin.BuiltinData)) + unlisted = + (unListData: (Builtin.BuiltinData -> + ((Builtin.BuiltinList (Builtin.BuiltinData))))) + (dat': Builtin.BuiltinData) + from :: forall (a :: Prim.Type). (Prim.LowerBound ((a :: Prim.Type))) + from = + (deserializeLowerBound: forall (a :: Prim.Type). ((Builtin.BuiltinData -> + ((a :: Prim.Type))) -> + ((Builtin.BuiltinData -> ((Prim.LowerBound ((a :: Prim.Type)))))))) + (f: (Builtin.BuiltinData -> ((a :: Prim.Type)))) + ((headList: forall (a :: Prim.Type). ((Builtin.BuiltinList + ((a :: Prim.Type))) -> + ((a :: Prim.Type)))) + (unlisted: (Builtin.BuiltinList (Builtin.BuiltinData)))) + unlisted' :: (Builtin.BuiltinList (Builtin.BuiltinData)) + unlisted' = + (tailList: forall (a :: Prim.Type). ((Builtin.BuiltinList + ((a :: Prim.Type))) -> + ((Builtin.BuiltinList ((a :: Prim.Type)))))) + (unlisted: (Builtin.BuiltinList (Builtin.BuiltinData))) + to :: forall (a :: Prim.Type). (Prim.UpperBound ((a :: Prim.Type))) + to = + (deserializeUpperBound: forall (a :: Prim.Type). ((Builtin.BuiltinData -> + ((a :: Prim.Type))) -> + ((Builtin.BuiltinData -> ((Prim.UpperBound ((a :: Prim.Type)))))))) + (f: (Builtin.BuiltinData -> ((a :: Prim.Type)))) + ((headList: forall (a :: Prim.Type). ((Builtin.BuiltinList + ((a :: Prim.Type))) -> + ((a :: Prim.Type)))) + (unlisted': (Builtin.BuiltinList (Builtin.BuiltinData)))) + in (Interval: forall (a :: Prim.Type). ({ + from :: (Prim.LowerBound + ((a :: Prim.Type))), + to :: (Prim.UpperBound + ((a :: Prim.Type))) + } -> + ((Prim.Interval ((a :: Prim.Type)))))) + ({ + to: (to: (Prim.UpperBound (a*33))), + from: (from: (Prim.LowerBound (a*33))) + }: { + from :: (Prim.LowerBound (a*33)), + to :: (Prim.UpperBound (a*33)) + }) + +deserializeDatum :: (Builtin.BuiltinData -> (Prim.Datum)) +deserializeDatum = (Datum: (Builtin.BuiltinData -> (Prim.Datum))) + +deserializeByteString :: (Builtin.BuiltinData -> (Builtin.BuiltinByteString)) +deserializeByteString = + (unBData: (Builtin.BuiltinData -> (Builtin.BuiltinByteString))) + +deserializeCurrencySymbol :: (Builtin.BuiltinData -> (Prim.CurrencySymbol)) +deserializeCurrencySymbol = + \(dat: Builtin.BuiltinData) -> + (CurrencySymbol: (Builtin.BuiltinByteString -> (Prim.CurrencySymbol))) + ((deserializeByteString: (Builtin.BuiltinData -> + (Builtin.BuiltinByteString))) + (dat: Builtin.BuiltinData)) + +deserializeDatumHash :: (Builtin.BuiltinData -> (Prim.DatumHash)) +deserializeDatumHash = + \(dat: Builtin.BuiltinData) -> + (DatumHash: (Builtin.BuiltinByteString -> (Prim.DatumHash))) + ((deserializeByteString: (Builtin.BuiltinData -> + (Builtin.BuiltinByteString))) + (dat: Builtin.BuiltinData)) + +deserializeOutputDatum :: (Builtin.BuiltinData -> (Prim.OutputDatum)) +deserializeOutputDatum = + \(dat: Builtin.BuiltinData) -> + let + p :: ((Builtin.BuiltinPair (Prim.Int)) (Builtin.BuiltinData)) + p = + (unConstrData: (Builtin.BuiltinData -> + (((Builtin.BuiltinPair (Prim.Int)) (Builtin.BuiltinData))))) + (dat: Builtin.BuiltinData) + tag :: Prim.Int + tag = + (fstPair: forall (a :: Prim.Type) + (b :: Prim.Type). (((Builtin.BuiltinPair + ((a :: Prim.Type))) ((b :: Prim.Type))) -> + ((a :: Prim.Type)))) + (p: ((Builtin.BuiltinPair (Prim.Int)) (Builtin.BuiltinData))) + in case ((equalsInteger: (Prim.Int -> ((Prim.Int -> (Prim.Boolean))))) (tag: Prim.Int) (0: Prim.Int)) of + True -> (NoOutputDatum: Prim.OutputDatum) + _ -> + let + unlisted :: (Builtin.BuiltinList (Builtin.BuiltinData)) + unlisted = + (unListData: (Builtin.BuiltinData -> + ((Builtin.BuiltinList (Builtin.BuiltinData))))) + ((sndPair: forall (a :: Prim.Type) + (b :: Prim.Type). (((Builtin.BuiltinPair + ((a :: Prim.Type))) ((b :: Prim.Type))) -> + ((b :: Prim.Type)))) + (p: ((Builtin.BuiltinPair (Prim.Int)) (Builtin.BuiltinData)))) + x :: Builtin.BuiltinData + x = + (headList: forall (a :: Prim.Type). ((Builtin.BuiltinList + ((a :: Prim.Type))) -> + ((a :: Prim.Type)))) + (unlisted: (Builtin.BuiltinList (Builtin.BuiltinData))) + in case ((equalsInteger: (Prim.Int -> ((Prim.Int -> (Prim.Boolean))))) (tag: Prim.Int) (1: Prim.Int)) of + True -> + (OutputDatumHash: (Prim.DatumHash -> (Prim.OutputDatum))) + ((deserializeDatumHash: (Builtin.BuiltinData -> + (Prim.DatumHash))) + (x: Builtin.BuiltinData)) + _ -> + (OutputDatum: (Prim.Datum -> (Prim.OutputDatum))) + ((deserializeDatum: (Builtin.BuiltinData -> (Prim.Datum))) + (x: Builtin.BuiltinData)) + +deserializePubKeyHash :: (Builtin.BuiltinData -> (Prim.PubKeyHash)) +deserializePubKeyHash = + \(dat: Builtin.BuiltinData) -> + (PubKeyHash: (Builtin.BuiltinByteString -> (Prim.PubKeyHash))) + ((deserializeByteString: (Builtin.BuiltinData -> + (Builtin.BuiltinByteString))) + (dat: Builtin.BuiltinData)) + +deserializeRedeemerHash :: (Builtin.BuiltinData -> (Prim.RedeemerHash)) +deserializeRedeemerHash = + \(dat: Builtin.BuiltinData) -> + (RedeemerHash: (Builtin.BuiltinByteString -> (Prim.RedeemerHash))) + ((deserializeByteString: (Builtin.BuiltinData -> + (Builtin.BuiltinByteString))) + (dat: Builtin.BuiltinData)) + +deserializeScriptHash :: (Builtin.BuiltinData -> (Prim.ScriptHash)) +deserializeScriptHash = + \(dat: Builtin.BuiltinData) -> + (ScriptHash: (Builtin.BuiltinByteString -> (Prim.ScriptHash))) + ((deserializeByteString: (Builtin.BuiltinData -> + (Builtin.BuiltinByteString))) + (dat: Builtin.BuiltinData)) + +deserializeCredential :: (Builtin.BuiltinData -> (Prim.Credential)) +deserializeCredential = + \(dat: Builtin.BuiltinData) -> + let + p :: ((Builtin.BuiltinPair (Prim.Int)) (Builtin.BuiltinData)) + p = + (unConstrData: (Builtin.BuiltinData -> + (((Builtin.BuiltinPair (Prim.Int)) (Builtin.BuiltinData))))) + (dat: Builtin.BuiltinData) + tag :: Prim.Int + tag = + (fstPair: forall (a :: Prim.Type) + (b :: Prim.Type). (((Builtin.BuiltinPair + ((a :: Prim.Type))) ((b :: Prim.Type))) -> + ((a :: Prim.Type)))) + (p: ((Builtin.BuiltinPair (Prim.Int)) (Builtin.BuiltinData))) + unlisted :: (Builtin.BuiltinList (Builtin.BuiltinData)) + unlisted = + (unListData: (Builtin.BuiltinData -> + ((Builtin.BuiltinList (Builtin.BuiltinData))))) + ((sndPair: forall (a :: Prim.Type) + (b :: Prim.Type). (((Builtin.BuiltinPair + ((a :: Prim.Type))) ((b :: Prim.Type))) -> + ((b :: Prim.Type)))) + (p: ((Builtin.BuiltinPair (Prim.Int)) (Builtin.BuiltinData)))) + in case ((equalsInteger: (Prim.Int -> ((Prim.Int -> (Prim.Boolean))))) (tag: Prim.Int) (0: Prim.Int)) of + True -> + (PubKeyCredential: (Prim.PubKeyHash -> (Prim.Credential))) + ((deserializePubKeyHash: (Builtin.BuiltinData -> (Prim.PubKeyHash))) + ((headList: forall (a :: Prim.Type). ((Builtin.BuiltinList + ((a :: Prim.Type))) -> + ((a :: Prim.Type)))) + (unlisted: (Builtin.BuiltinList (Builtin.BuiltinData))))) + _ -> + (ScriptCredential: (Prim.ScriptHash -> (Prim.Credential))) + ((deserializeScriptHash: (Builtin.BuiltinData -> (Prim.ScriptHash))) + ((headList: forall (a :: Prim.Type). ((Builtin.BuiltinList + ((a :: Prim.Type))) -> + ((a :: Prim.Type)))) + (unlisted: (Builtin.BuiltinList (Builtin.BuiltinData))))) + +deserializeStakingCredential :: (Builtin.BuiltinData -> (Prim.StakingCredential)) +deserializeStakingCredential = + \(dat: Builtin.BuiltinData) -> + let + p :: ((Builtin.BuiltinPair (Prim.Int)) (Builtin.BuiltinData)) + p = + (unConstrData: (Builtin.BuiltinData -> + (((Builtin.BuiltinPair (Prim.Int)) (Builtin.BuiltinData))))) + (dat: Builtin.BuiltinData) + tag :: Prim.Int + tag = + (fstPair: forall (a :: Prim.Type) + (b :: Prim.Type). (((Builtin.BuiltinPair + ((a :: Prim.Type))) ((b :: Prim.Type))) -> + ((a :: Prim.Type)))) + (p: ((Builtin.BuiltinPair (Prim.Int)) (Builtin.BuiltinData))) + unlisted :: (Builtin.BuiltinList (Builtin.BuiltinData)) + unlisted = + (unListData: (Builtin.BuiltinData -> + ((Builtin.BuiltinList (Builtin.BuiltinData))))) + ((sndPair: forall (a :: Prim.Type) + (b :: Prim.Type). (((Builtin.BuiltinPair + ((a :: Prim.Type))) ((b :: Prim.Type))) -> + ((b :: Prim.Type)))) + (p: ((Builtin.BuiltinPair (Prim.Int)) (Builtin.BuiltinData)))) + in case ((equalsInteger: (Prim.Int -> ((Prim.Int -> (Prim.Boolean))))) (tag: Prim.Int) (0: Prim.Int)) of + True -> + (StakingHash: (Prim.Credential -> (Prim.StakingCredential))) + ((deserializeCredential: (Builtin.BuiltinData -> (Prim.Credential))) + ((headList: forall (a :: Prim.Type). ((Builtin.BuiltinList + ((a :: Prim.Type))) -> + ((a :: Prim.Type)))) + (unlisted: (Builtin.BuiltinList (Builtin.BuiltinData))))) + _ -> + let + unlisted' :: (Builtin.BuiltinList (Builtin.BuiltinData)) + unlisted' = + (tailList: forall (a :: Prim.Type). ((Builtin.BuiltinList + ((a :: Prim.Type))) -> + ((Builtin.BuiltinList ((a :: Prim.Type)))))) + (unlisted: (Builtin.BuiltinList (Builtin.BuiltinData))) + unlisted'' :: (Builtin.BuiltinList (Builtin.BuiltinData)) + unlisted'' = + (tailList: forall (a :: Prim.Type). ((Builtin.BuiltinList + ((a :: Prim.Type))) -> + ((Builtin.BuiltinList ((a :: Prim.Type)))))) + (unlisted': (Builtin.BuiltinList (Builtin.BuiltinData))) + i3 :: Prim.Int + i3 = + (deserializeInt: (Builtin.BuiltinData -> (Prim.Int))) + ((headList: forall (a :: Prim.Type). ((Builtin.BuiltinList + ((a :: Prim.Type))) -> + ((a :: Prim.Type)))) + (unlisted'': (Builtin.BuiltinList (Builtin.BuiltinData)))) + i2 :: Prim.Int + i2 = + (deserializeInt: (Builtin.BuiltinData -> (Prim.Int))) + ((headList: forall (a :: Prim.Type). ((Builtin.BuiltinList + ((a :: Prim.Type))) -> + ((a :: Prim.Type)))) + (unlisted': (Builtin.BuiltinList (Builtin.BuiltinData)))) + i1 :: Prim.Int + i1 = + (deserializeInt: (Builtin.BuiltinData -> (Prim.Int))) + ((headList: forall (a :: Prim.Type). ((Builtin.BuiltinList + ((a :: Prim.Type))) -> + ((a :: Prim.Type)))) + (unlisted: (Builtin.BuiltinList (Builtin.BuiltinData)))) + in (StakingPtr: (Prim.Int -> + ((Prim.Int -> ((Prim.Int -> (Prim.StakingCredential))))))) + (i1: Prim.Int) + (i2: Prim.Int) + (i3: Prim.Int) + +deserializeDCert :: (Builtin.BuiltinData -> (Prim.DCert)) +deserializeDCert = + \(dat: Builtin.BuiltinData) -> + let + p :: ((Builtin.BuiltinPair (Prim.Int)) (Builtin.BuiltinData)) + p = + (unConstrData: (Builtin.BuiltinData -> + (((Builtin.BuiltinPair (Prim.Int)) (Builtin.BuiltinData))))) + (dat: Builtin.BuiltinData) + tag :: Prim.Int + tag = + (fstPair: forall (a :: Prim.Type) + (b :: Prim.Type). (((Builtin.BuiltinPair + ((a :: Prim.Type))) ((b :: Prim.Type))) -> + ((a :: Prim.Type)))) + (p: ((Builtin.BuiltinPair (Prim.Int)) (Builtin.BuiltinData))) + unlisted :: (Builtin.BuiltinList (Builtin.BuiltinData)) + unlisted = + (unListData: (Builtin.BuiltinData -> + ((Builtin.BuiltinList (Builtin.BuiltinData))))) + ((sndPair: forall (a :: Prim.Type) + (b :: Prim.Type). (((Builtin.BuiltinPair + ((a :: Prim.Type))) ((b :: Prim.Type))) -> + ((b :: Prim.Type)))) + (p: ((Builtin.BuiltinPair (Prim.Int)) (Builtin.BuiltinData)))) + in case ((equalsInteger: (Prim.Int -> ((Prim.Int -> (Prim.Boolean))))) (tag: Prim.Int) (0: Prim.Int)) of + True -> + (DCertDelegRegKey: (Prim.StakingCredential -> (Prim.DCert))) + ((deserializeStakingCredential: (Builtin.BuiltinData -> + (Prim.StakingCredential))) + ((headList: forall (a :: Prim.Type). ((Builtin.BuiltinList + ((a :: Prim.Type))) -> + ((a :: Prim.Type)))) + (unlisted: (Builtin.BuiltinList (Builtin.BuiltinData))))) + _ -> + case ((equalsInteger: (Prim.Int -> ((Prim.Int -> (Prim.Boolean))))) (tag: Prim.Int) (1: Prim.Int)) of + True -> + (DCertDelegDeRegKey: (Prim.StakingCredential -> (Prim.DCert))) + ((deserializeStakingCredential: (Builtin.BuiltinData -> + (Prim.StakingCredential))) + ((headList: forall (a :: Prim.Type). ((Builtin.BuiltinList + ((a :: Prim.Type))) -> + ((a :: Prim.Type)))) + (unlisted: (Builtin.BuiltinList (Builtin.BuiltinData))))) + _ -> + case ((equalsInteger: (Prim.Int -> ((Prim.Int -> (Prim.Boolean))))) (tag: Prim.Int) (2: Prim.Int)) of + True -> + let + unlisted' :: (Builtin.BuiltinList (Builtin.BuiltinData)) + unlisted' = + (tailList: forall (a :: Prim.Type). ((Builtin.BuiltinList + ((a :: Prim.Type))) -> + ((Builtin.BuiltinList ((a :: Prim.Type)))))) + (unlisted: (Builtin.BuiltinList + (Builtin.BuiltinData))) + sc :: Prim.StakingCredential + sc = + (deserializeStakingCredential: (Builtin.BuiltinData -> + (Prim.StakingCredential))) + ((headList: forall (a :: Prim.Type). ((Builtin.BuiltinList + ((a :: Prim.Type))) -> + ((a :: Prim.Type)))) + (unlisted: (Builtin.BuiltinList + (Builtin.BuiltinData)))) + pkh :: Prim.PubKeyHash + pkh = + (deserializePubKeyHash: (Builtin.BuiltinData -> + (Prim.PubKeyHash))) + ((headList: forall (a :: Prim.Type). ((Builtin.BuiltinList + ((a :: Prim.Type))) -> + ((a :: Prim.Type)))) + (unlisted': (Builtin.BuiltinList + (Builtin.BuiltinData)))) + in (DCertDelegDelegate: (Prim.StakingCredential -> + ((Prim.PubKeyHash -> (Prim.DCert))))) + (sc: Prim.StakingCredential) + (pkh: Prim.PubKeyHash) + _ -> + case ((equalsInteger: (Prim.Int -> ((Prim.Int -> (Prim.Boolean))))) (tag: Prim.Int) (3: Prim.Int)) of + True -> + let + unlisted' :: (Builtin.BuiltinList (Builtin.BuiltinData)) + unlisted' = + (tailList: forall (a :: Prim.Type). ((Builtin.BuiltinList + ((a :: Prim.Type))) -> + ((Builtin.BuiltinList ((a :: Prim.Type)))))) + (unlisted: (Builtin.BuiltinList + (Builtin.BuiltinData))) + pkh2 :: Prim.PubKeyHash + pkh2 = + (deserializePubKeyHash: (Builtin.BuiltinData -> + (Prim.PubKeyHash))) + ((headList: forall (a :: Prim.Type). ((Builtin.BuiltinList + ((a :: Prim.Type))) -> + ((a :: Prim.Type)))) + (unlisted': (Builtin.BuiltinList + (Builtin.BuiltinData)))) + pkh1 :: Prim.PubKeyHash + pkh1 = + (deserializePubKeyHash: (Builtin.BuiltinData -> + (Prim.PubKeyHash))) + ((headList: forall (a :: Prim.Type). ((Builtin.BuiltinList + ((a :: Prim.Type))) -> + ((a :: Prim.Type)))) + (unlisted: (Builtin.BuiltinList + (Builtin.BuiltinData)))) + in (DCertPoolRegister: (Prim.PubKeyHash -> + ((Prim.PubKeyHash -> (Prim.DCert))))) + (pkh1: Prim.PubKeyHash) + (pkh2: Prim.PubKeyHash) + _ -> + case ((equalsInteger: (Prim.Int -> ((Prim.Int -> (Prim.Boolean))))) (tag: Prim.Int) (4: Prim.Int)) of + True -> + let + unlisted' :: (Builtin.BuiltinList (Builtin.BuiltinData)) + unlisted' = + (tailList: forall (a :: Prim.Type). ((Builtin.BuiltinList + ((a :: Prim.Type))) -> + ((Builtin.BuiltinList ((a :: Prim.Type)))))) + (unlisted: (Builtin.BuiltinList + (Builtin.BuiltinData))) + pkh :: Prim.PubKeyHash + pkh = + (deserializePubKeyHash: (Builtin.BuiltinData -> + (Prim.PubKeyHash))) + ((headList: forall (a :: Prim.Type). ((Builtin.BuiltinList + ((a :: Prim.Type))) -> + ((a :: Prim.Type)))) + (unlisted: (Builtin.BuiltinList + (Builtin.BuiltinData)))) + i :: Prim.Int + i = + (deserializeInt: (Builtin.BuiltinData -> + (Prim.Int))) + ((headList: forall (a :: Prim.Type). ((Builtin.BuiltinList + ((a :: Prim.Type))) -> + ((a :: Prim.Type)))) + (unlisted': (Builtin.BuiltinList + (Builtin.BuiltinData)))) + in (DCertPoolRetire: (Prim.PubKeyHash -> + ((Prim.Int -> (Prim.DCert))))) + (pkh: Prim.PubKeyHash) + (i: Prim.Int) + _ -> + case ((equalsInteger: (Prim.Int -> ((Prim.Int -> (Prim.Boolean))))) (tag: Prim.Int) (5: Prim.Int)) of + True -> (DCertGenesis: Prim.DCert) + _ -> (DCertMir: Prim.DCert) + +deserializeTokenName :: (Builtin.BuiltinData -> (Prim.TokenName)) +deserializeTokenName = + \(dat: Builtin.BuiltinData) -> + (TokenName: (Builtin.BuiltinByteString -> (Prim.TokenName))) + ((deserializeByteString: (Builtin.BuiltinData -> + (Builtin.BuiltinByteString))) + (dat: Builtin.BuiltinData)) + +deserializeTxId :: (Builtin.BuiltinData -> (Prim.TxId)) +deserializeTxId = + \(dat: Builtin.BuiltinData) -> + let + dat' :: Builtin.BuiltinData + dat' = + (sndPair: forall (a :: Prim.Type) + (b :: Prim.Type). (((Builtin.BuiltinPair + ((a :: Prim.Type))) ((b :: Prim.Type))) -> + ((b :: Prim.Type)))) + ((unConstrData: (Builtin.BuiltinData -> + (((Builtin.BuiltinPair (Prim.Int)) (Builtin.BuiltinData))))) + (dat: Builtin.BuiltinData)) + unlisted :: (Builtin.BuiltinList (Builtin.BuiltinData)) + unlisted = + (unListData: (Builtin.BuiltinData -> + ((Builtin.BuiltinList (Builtin.BuiltinData))))) + (dat': Builtin.BuiltinData) + in (TxId: (Builtin.BuiltinByteString -> (Prim.TxId))) + ((deserializeByteString: (Builtin.BuiltinData -> + (Builtin.BuiltinByteString))) + ((headList: forall (a :: Prim.Type). ((Builtin.BuiltinList + ((a :: Prim.Type))) -> + ((a :: Prim.Type)))) + (unlisted: (Builtin.BuiltinList (Builtin.BuiltinData))))) + +deserializeTxOutRef :: (Builtin.BuiltinData -> (Prim.TxOutRef)) +deserializeTxOutRef = + \(dat: Builtin.BuiltinData) -> + let + unlisted :: (Builtin.BuiltinList (Builtin.BuiltinData)) + unlisted = + (unListData: (Builtin.BuiltinData -> + ((Builtin.BuiltinList (Builtin.BuiltinData))))) + ((sndPair: forall (a :: Prim.Type) + (b :: Prim.Type). (((Builtin.BuiltinPair + ((a :: Prim.Type))) ((b :: Prim.Type))) -> + ((b :: Prim.Type)))) + ((unConstrData: (Builtin.BuiltinData -> + (((Builtin.BuiltinPair (Prim.Int)) (Builtin.BuiltinData))))) + (dat: Builtin.BuiltinData))) + unlisted' :: (Builtin.BuiltinList (Builtin.BuiltinData)) + unlisted' = + (tailList: forall (a :: Prim.Type). ((Builtin.BuiltinList + ((a :: Prim.Type))) -> + ((Builtin.BuiltinList ((a :: Prim.Type)))))) + (unlisted: (Builtin.BuiltinList (Builtin.BuiltinData))) + idx :: Prim.Int + idx = + (deserializeInt: (Builtin.BuiltinData -> (Prim.Int))) + ((headList: forall (a :: Prim.Type). ((Builtin.BuiltinList + ((a :: Prim.Type))) -> + ((a :: Prim.Type)))) + (unlisted': (Builtin.BuiltinList (Builtin.BuiltinData)))) + id1 :: Prim.TxId + id1 = + (deserializeTxId: (Builtin.BuiltinData -> (Prim.TxId))) + ((headList: forall (a :: Prim.Type). ((Builtin.BuiltinList + ((a :: Prim.Type))) -> + ((a :: Prim.Type)))) + (unlisted: (Builtin.BuiltinList (Builtin.BuiltinData)))) + in (TxOutRef: ({ id :: Prim.TxId, idx :: Prim.Int } -> (Prim.TxOutRef))) + ({ idx: (idx: Prim.Int), id: (id1: Prim.TxId) }: { + id :: Prim.TxId, + idx :: Prim.Int + }) + +deserializeScriptPurpose :: (Builtin.BuiltinData -> (Prim.ScriptPurpose)) +deserializeScriptPurpose = + \(dat: Builtin.BuiltinData) -> + let + p :: ((Builtin.BuiltinPair (Prim.Int)) (Builtin.BuiltinData)) + p = + (unConstrData: (Builtin.BuiltinData -> + (((Builtin.BuiltinPair (Prim.Int)) (Builtin.BuiltinData))))) + (dat: Builtin.BuiltinData) + tag :: Prim.Int + tag = + (fstPair: forall (a :: Prim.Type) + (b :: Prim.Type). (((Builtin.BuiltinPair + ((a :: Prim.Type))) ((b :: Prim.Type))) -> + ((a :: Prim.Type)))) + (p: ((Builtin.BuiltinPair (Prim.Int)) (Builtin.BuiltinData))) + x :: Builtin.BuiltinData + x = + (headList: forall (a :: Prim.Type). ((Builtin.BuiltinList + ((a :: Prim.Type))) -> + ((a :: Prim.Type)))) + ((unListData: (Builtin.BuiltinData -> + ((Builtin.BuiltinList (Builtin.BuiltinData))))) + ((sndPair: forall (a :: Prim.Type) + (b :: Prim.Type). (((Builtin.BuiltinPair + ((a :: Prim.Type))) ((b :: Prim.Type))) -> + ((b :: Prim.Type)))) + (p: ((Builtin.BuiltinPair (Prim.Int)) (Builtin.BuiltinData))))) + in case ((equalsInteger: (Prim.Int -> ((Prim.Int -> (Prim.Boolean))))) (0: Prim.Int) (tag: Prim.Int)) of + True -> + (Minting: (Prim.CurrencySymbol -> (Prim.ScriptPurpose))) + ((deserializeCurrencySymbol: (Builtin.BuiltinData -> + (Prim.CurrencySymbol))) + (x: Builtin.BuiltinData)) + _ -> + case ((equalsInteger: (Prim.Int -> ((Prim.Int -> (Prim.Boolean))))) (1: Prim.Int) (tag: Prim.Int)) of + True -> + (Spending: (Prim.TxOutRef -> (Prim.ScriptPurpose))) + ((deserializeTxOutRef: (Builtin.BuiltinData -> + (Prim.TxOutRef))) + (x: Builtin.BuiltinData)) + _ -> + case ((equalsInteger: (Prim.Int -> ((Prim.Int -> (Prim.Boolean))))) (2: Prim.Int) (tag: Prim.Int)) of + True -> + (Rewarding: (Prim.StakingCredential -> + (Prim.ScriptPurpose))) + ((deserializeStakingCredential: (Builtin.BuiltinData -> + (Prim.StakingCredential))) + (x: Builtin.BuiltinData)) + _ -> + (Certifying: (Prim.DCert -> (Prim.ScriptPurpose))) + ((deserializeDCert: (Builtin.BuiltinData -> (Prim.DCert))) + (x: Builtin.BuiltinData)) + +deserializeAssocMap :: forall (k :: Prim.Type) (v :: Prim.Type). ((Builtin.BuiltinData -> ((k :: Prim.Type))) -> (((Builtin.BuiltinData -> ((v :: Prim.Type))) -> ((Builtin.BuiltinData -> (((Prim.AssocMap ((k :: Prim.Type))) ((v :: Prim.Type))))))))) +deserializeAssocMap = + \(fK: (Builtin.BuiltinData -> ((k :: Prim.Type)))) -> + \(fV: (Builtin.BuiltinData -> ((v :: Prim.Type)))) -> + \(dat: Builtin.BuiltinData) -> + let + go :: ((Builtin.BuiltinList (((Builtin.BuiltinPair (Builtin.BuiltinData)) (Builtin.BuiltinData)))) -> (List (((Prim.Tuple2 (k*34)) (v*35))))) + go = + \(ell: (Builtin.BuiltinList + (((Builtin.BuiltinPair + (Builtin.BuiltinData)) (Builtin.BuiltinData))))) -> + case ((nullList: forall (a :: Prim.Type). ((Builtin.BuiltinList ((a :: Prim.Type))) -> (Prim.Boolean))) (ell: (Builtin.BuiltinList (((Builtin.BuiltinPair (Builtin.BuiltinData)) (Builtin.BuiltinData)))))) of + True -> (Nil: List (((Prim.Tuple2 (k*34)) (v*35)))) + _ -> + let + t :: (Builtin.BuiltinList (((Builtin.BuiltinPair (Builtin.BuiltinData)) (Builtin.BuiltinData)))) + t = + (tailList: forall (a :: Prim.Type). ((Builtin.BuiltinList + ((a :: Prim.Type))) -> + ((Builtin.BuiltinList ((a :: Prim.Type)))))) + (ell: (Builtin.BuiltinList + (((Builtin.BuiltinPair + (Builtin.BuiltinData)) (Builtin.BuiltinData))))) + p :: ((Builtin.BuiltinPair (Builtin.BuiltinData)) (Builtin.BuiltinData)) + p = + (headList: forall (a :: Prim.Type). ((Builtin.BuiltinList + ((a :: Prim.Type))) -> + ((a :: Prim.Type)))) + (ell: (Builtin.BuiltinList + (((Builtin.BuiltinPair + (Builtin.BuiltinData)) (Builtin.BuiltinData))))) + x :: Builtin.BuiltinData + x = + (fstPair: forall (a :: Prim.Type) + (b :: Prim.Type). (((Builtin.BuiltinPair + ((a :: Prim.Type))) ((b :: Prim.Type))) -> + ((a :: Prim.Type)))) + (p: ((Builtin.BuiltinPair + (Builtin.BuiltinData)) (Builtin.BuiltinData))) + y :: Builtin.BuiltinData + y = + (sndPair: forall (a :: Prim.Type) + (b :: Prim.Type). (((Builtin.BuiltinPair + ((a :: Prim.Type))) ((b :: Prim.Type))) -> + ((b :: Prim.Type)))) + (p: ((Builtin.BuiltinPair + (Builtin.BuiltinData)) (Builtin.BuiltinData))) + in (Cons: forall (x :: Prim.Type). ((x :: Prim.Type) -> + ((List ((x :: Prim.Type)) -> (List ((x :: Prim.Type))))))) + ((Tuple2: forall (t1 :: Prim.Type) + (t2 :: Prim.Type). ((t1 :: Prim.Type) -> + (((t2 :: Prim.Type) -> + (((Prim.Tuple2 + ((t1 :: Prim.Type))) ((t2 :: Prim.Type)))))))) + ((fK: (Builtin.BuiltinData -> ((k :: Prim.Type)))) + (x: Builtin.BuiltinData)) + ((fV: (Builtin.BuiltinData -> ((v :: Prim.Type)))) + (y: Builtin.BuiltinData))) + ((go: ((Builtin.BuiltinList + (((Builtin.BuiltinPair + (Builtin.BuiltinData)) (Builtin.BuiltinData)))) -> + (List (((Prim.Tuple2 (k*34)) (v*35)))))) + (t: (Builtin.BuiltinList + (((Builtin.BuiltinPair + (Builtin.BuiltinData)) (Builtin.BuiltinData)))))) + in (AssocMap: forall (k :: Prim.Type) + (v :: Prim.Type). (List (((Prim.Tuple2 + ((k :: Prim.Type))) ((v :: Prim.Type)))) -> + (((Prim.AssocMap ((k :: Prim.Type))) ((v :: Prim.Type)))))) + ((go: ((Builtin.BuiltinList + (((Builtin.BuiltinPair + (Builtin.BuiltinData)) (Builtin.BuiltinData)))) -> + (List (((Prim.Tuple2 (k*34)) (v*35)))))) + ((unMapData: (Builtin.BuiltinData -> + ((Builtin.BuiltinList + (((Builtin.BuiltinPair + (Builtin.BuiltinData)) (Builtin.BuiltinData))))))) + (dat: Builtin.BuiltinData))) + +deserializeValue :: (Builtin.BuiltinData -> (Prim.Value)) +deserializeValue = + \(dat: Builtin.BuiltinData) -> + (Value: (((Prim.AssocMap + (Prim.CurrencySymbol)) (((Prim.AssocMap (Prim.TokenName)) (Prim.Int)))) -> + (Prim.Value))) + ((deserializeAssocMap: forall (k :: Prim.Type) + (v :: Prim.Type). ((Builtin.BuiltinData -> ((k :: Prim.Type))) -> + (((Builtin.BuiltinData -> ((v :: Prim.Type))) -> + ((Builtin.BuiltinData -> + (((Prim.AssocMap ((k :: Prim.Type))) ((v :: Prim.Type)))))))))) + (deserializeCurrencySymbol: (Builtin.BuiltinData -> (Prim.CurrencySymbol))) + ((deserializeAssocMap: forall (k :: Prim.Type) + (v :: Prim.Type). ((Builtin.BuiltinData -> ((k :: Prim.Type))) -> + (((Builtin.BuiltinData -> ((v :: Prim.Type))) -> + ((Builtin.BuiltinData -> + (((Prim.AssocMap ((k :: Prim.Type))) ((v :: Prim.Type)))))))))) + (deserializeTokenName: (Builtin.BuiltinData -> (Prim.TokenName))) + (deserializeInt: (Builtin.BuiltinData -> (Prim.Int)))) + (dat: Builtin.BuiltinData)) + +deserializeAddress :: (Builtin.BuiltinData -> (Prim.Address)) +deserializeAddress = + \(dat: Builtin.BuiltinData) -> + let + dat' :: Builtin.BuiltinData + dat' = + (sndPair: forall (a :: Prim.Type) + (b :: Prim.Type). (((Builtin.BuiltinPair + ((a :: Prim.Type))) ((b :: Prim.Type))) -> + ((b :: Prim.Type)))) + ((unConstrData: (Builtin.BuiltinData -> + (((Builtin.BuiltinPair (Prim.Int)) (Builtin.BuiltinData))))) + (dat: Builtin.BuiltinData)) + unlisted :: (Builtin.BuiltinList (Builtin.BuiltinData)) + unlisted = + (unListData: (Builtin.BuiltinData -> + ((Builtin.BuiltinList (Builtin.BuiltinData))))) + (dat': Builtin.BuiltinData) + unlisted' :: (Builtin.BuiltinList (Builtin.BuiltinData)) + unlisted' = + (tailList: forall (a :: Prim.Type). ((Builtin.BuiltinList + ((a :: Prim.Type))) -> + ((Builtin.BuiltinList ((a :: Prim.Type)))))) + (unlisted: (Builtin.BuiltinList (Builtin.BuiltinData))) + stakingCredential :: (Prim.Maybe (Prim.StakingCredential)) + stakingCredential = + (deserializeMaybe: forall (a :: Prim.Type). ((Builtin.BuiltinData -> + ((a :: Prim.Type))) -> + ((Builtin.BuiltinData -> ((Prim.Maybe ((a :: Prim.Type)))))))) + (deserializeStakingCredential: (Builtin.BuiltinData -> + (Prim.StakingCredential))) + ((headList: forall (a :: Prim.Type). ((Builtin.BuiltinList + ((a :: Prim.Type))) -> + ((a :: Prim.Type)))) + (unlisted': (Builtin.BuiltinList (Builtin.BuiltinData)))) + credential :: Prim.Credential + credential = + (deserializeCredential: (Builtin.BuiltinData -> (Prim.Credential))) + ((headList: forall (a :: Prim.Type). ((Builtin.BuiltinList + ((a :: Prim.Type))) -> + ((a :: Prim.Type)))) + (unlisted: (Builtin.BuiltinList (Builtin.BuiltinData)))) + in (Address: ({ + credential :: Prim.Credential, + stakingCredential :: (Prim.Maybe (Prim.StakingCredential)) + } -> + (Prim.Address))) + ({ + stakingCredential: (stakingCredential: (Prim.Maybe + (Prim.StakingCredential))), + credential: (credential: Prim.Credential) + }: { + credential :: Prim.Credential, + stakingCredential :: (Prim.Maybe (Prim.StakingCredential)) + }) + +deserializeTxOut :: (Builtin.BuiltinData -> (Prim.TxOut)) +deserializeTxOut = + \(dat: Builtin.BuiltinData) -> + let + unlisted :: (Builtin.BuiltinList (Builtin.BuiltinData)) + unlisted = + (unListData: (Builtin.BuiltinData -> + ((Builtin.BuiltinList (Builtin.BuiltinData))))) + ((sndPair: forall (a :: Prim.Type) + (b :: Prim.Type). (((Builtin.BuiltinPair + ((a :: Prim.Type))) ((b :: Prim.Type))) -> + ((b :: Prim.Type)))) + ((unConstrData: (Builtin.BuiltinData -> + (((Builtin.BuiltinPair (Prim.Int)) (Builtin.BuiltinData))))) + (dat: Builtin.BuiltinData))) + unlisted1 :: (Builtin.BuiltinList (Builtin.BuiltinData)) + unlisted1 = + (tailList: forall (a :: Prim.Type). ((Builtin.BuiltinList + ((a :: Prim.Type))) -> + ((Builtin.BuiltinList ((a :: Prim.Type)))))) + (unlisted: (Builtin.BuiltinList (Builtin.BuiltinData))) + unlisted2 :: (Builtin.BuiltinList (Builtin.BuiltinData)) + unlisted2 = + (tailList: forall (a :: Prim.Type). ((Builtin.BuiltinList + ((a :: Prim.Type))) -> + ((Builtin.BuiltinList ((a :: Prim.Type)))))) + (unlisted1: (Builtin.BuiltinList (Builtin.BuiltinData))) + unlisted3 :: (Builtin.BuiltinList (Builtin.BuiltinData)) + unlisted3 = + (tailList: forall (a :: Prim.Type). ((Builtin.BuiltinList + ((a :: Prim.Type))) -> + ((Builtin.BuiltinList ((a :: Prim.Type)))))) + (unlisted2: (Builtin.BuiltinList (Builtin.BuiltinData))) + value :: Prim.Value + value = + (deserializeValue: (Builtin.BuiltinData -> (Prim.Value))) + ((headList: forall (a :: Prim.Type). ((Builtin.BuiltinList + ((a :: Prim.Type))) -> + ((a :: Prim.Type)))) + (unlisted1: (Builtin.BuiltinList (Builtin.BuiltinData)))) + referenceScript :: (Prim.Maybe (Prim.ScriptHash)) + referenceScript = + (deserializeMaybe: forall (a :: Prim.Type). ((Builtin.BuiltinData -> + ((a :: Prim.Type))) -> + ((Builtin.BuiltinData -> ((Prim.Maybe ((a :: Prim.Type)))))))) + (deserializeScriptHash: (Builtin.BuiltinData -> (Prim.ScriptHash))) + ((headList: forall (a :: Prim.Type). ((Builtin.BuiltinList + ((a :: Prim.Type))) -> + ((a :: Prim.Type)))) + (unlisted3: (Builtin.BuiltinList (Builtin.BuiltinData)))) + outputDatum :: Prim.OutputDatum + outputDatum = + (deserializeOutputDatum: (Builtin.BuiltinData -> (Prim.OutputDatum))) + ((headList: forall (a :: Prim.Type). ((Builtin.BuiltinList + ((a :: Prim.Type))) -> + ((a :: Prim.Type)))) + (unlisted2: (Builtin.BuiltinList (Builtin.BuiltinData)))) + address :: Prim.Address + address = + (deserializeAddress: (Builtin.BuiltinData -> (Prim.Address))) + ((headList: forall (a :: Prim.Type). ((Builtin.BuiltinList + ((a :: Prim.Type))) -> + ((a :: Prim.Type)))) + (unlisted: (Builtin.BuiltinList (Builtin.BuiltinData)))) + in (TxOut: ({ + address :: Prim.Address, + value :: Prim.Value, + datum :: Prim.OutputDatum, + referenceScript :: (Prim.Maybe (Prim.ScriptHash)) + } -> + (Prim.TxOut))) + ({ + referenceScript: (referenceScript: (Prim.Maybe (Prim.ScriptHash))), + datum: (outputDatum: Prim.OutputDatum), + value: (value: Prim.Value), + address: (address: Prim.Address) + }: { + address :: Prim.Address, + value :: Prim.Value, + datum :: Prim.OutputDatum, + referenceScript :: (Prim.Maybe (Prim.ScriptHash)) + }) + +deserializeTxInInfo :: (Builtin.BuiltinData -> (Prim.TxInInfo)) +deserializeTxInInfo = + \(dat: Builtin.BuiltinData) -> + let + unlisted :: (Builtin.BuiltinList (Builtin.BuiltinData)) + unlisted = + (unListData: (Builtin.BuiltinData -> + ((Builtin.BuiltinList (Builtin.BuiltinData))))) + ((sndPair: forall (a :: Prim.Type) + (b :: Prim.Type). (((Builtin.BuiltinPair + ((a :: Prim.Type))) ((b :: Prim.Type))) -> + ((b :: Prim.Type)))) + ((unConstrData: (Builtin.BuiltinData -> + (((Builtin.BuiltinPair (Prim.Int)) (Builtin.BuiltinData))))) + (dat: Builtin.BuiltinData))) + unlisted' :: (Builtin.BuiltinList (Builtin.BuiltinData)) + unlisted' = + (tailList: forall (a :: Prim.Type). ((Builtin.BuiltinList + ((a :: Prim.Type))) -> + ((Builtin.BuiltinList ((a :: Prim.Type)))))) + (unlisted: (Builtin.BuiltinList (Builtin.BuiltinData))) + resolved :: Prim.TxOut + resolved = + (deserializeTxOut: (Builtin.BuiltinData -> (Prim.TxOut))) + ((headList: forall (a :: Prim.Type). ((Builtin.BuiltinList + ((a :: Prim.Type))) -> + ((a :: Prim.Type)))) + (unlisted': (Builtin.BuiltinList (Builtin.BuiltinData)))) + outRef :: Prim.TxOutRef + outRef = + (deserializeTxOutRef: (Builtin.BuiltinData -> (Prim.TxOutRef))) + ((headList: forall (a :: Prim.Type). ((Builtin.BuiltinList + ((a :: Prim.Type))) -> + ((a :: Prim.Type)))) + (unlisted: (Builtin.BuiltinList (Builtin.BuiltinData)))) + in (TxInInfo: ({ txOutRef :: Prim.TxOutRef, resolved :: Prim.TxOut } -> + (Prim.TxInInfo))) + ({ + resolved: (resolved: Prim.TxOut), + txOutRef: (outRef: Prim.TxOutRef) + }: { txOutRef :: Prim.TxOutRef, resolved :: Prim.TxOut }) + +deserializeTxInfo :: (Builtin.BuiltinData -> (Prim.TxInfo)) +deserializeTxInfo = + \(dat: Builtin.BuiltinData) -> + let + unlisted :: (Builtin.BuiltinList (Builtin.BuiltinData)) + unlisted = + (unListData: (Builtin.BuiltinData -> + ((Builtin.BuiltinList (Builtin.BuiltinData))))) + ((sndPair: forall (a :: Prim.Type) + (b :: Prim.Type). (((Builtin.BuiltinPair + ((a :: Prim.Type))) ((b :: Prim.Type))) -> + ((b :: Prim.Type)))) + ((unConstrData: (Builtin.BuiltinData -> + (((Builtin.BuiltinPair (Prim.Int)) (Builtin.BuiltinData))))) + (dat: Builtin.BuiltinData))) + unlisted1 :: (Builtin.BuiltinList (Builtin.BuiltinData)) + unlisted1 = + (tailList: forall (a :: Prim.Type). ((Builtin.BuiltinList + ((a :: Prim.Type))) -> + ((Builtin.BuiltinList ((a :: Prim.Type)))))) + (unlisted: (Builtin.BuiltinList (Builtin.BuiltinData))) + unlisted2 :: (Builtin.BuiltinList (Builtin.BuiltinData)) + unlisted2 = + (tailList: forall (a :: Prim.Type). ((Builtin.BuiltinList + ((a :: Prim.Type))) -> + ((Builtin.BuiltinList ((a :: Prim.Type)))))) + (unlisted1: (Builtin.BuiltinList (Builtin.BuiltinData))) + unlisted3 :: (Builtin.BuiltinList (Builtin.BuiltinData)) + unlisted3 = + (tailList: forall (a :: Prim.Type). ((Builtin.BuiltinList + ((a :: Prim.Type))) -> + ((Builtin.BuiltinList ((a :: Prim.Type)))))) + (unlisted2: (Builtin.BuiltinList (Builtin.BuiltinData))) + unlisted4 :: (Builtin.BuiltinList (Builtin.BuiltinData)) + unlisted4 = + (tailList: forall (a :: Prim.Type). ((Builtin.BuiltinList + ((a :: Prim.Type))) -> + ((Builtin.BuiltinList ((a :: Prim.Type)))))) + (unlisted3: (Builtin.BuiltinList (Builtin.BuiltinData))) + unlisted5 :: (Builtin.BuiltinList (Builtin.BuiltinData)) + unlisted5 = + (tailList: forall (a :: Prim.Type). ((Builtin.BuiltinList + ((a :: Prim.Type))) -> + ((Builtin.BuiltinList ((a :: Prim.Type)))))) + (unlisted4: (Builtin.BuiltinList (Builtin.BuiltinData))) + unlisted6 :: (Builtin.BuiltinList (Builtin.BuiltinData)) + unlisted6 = + (tailList: forall (a :: Prim.Type). ((Builtin.BuiltinList + ((a :: Prim.Type))) -> + ((Builtin.BuiltinList ((a :: Prim.Type)))))) + (unlisted5: (Builtin.BuiltinList (Builtin.BuiltinData))) + unlisted7 :: (Builtin.BuiltinList (Builtin.BuiltinData)) + unlisted7 = + (tailList: forall (a :: Prim.Type). ((Builtin.BuiltinList + ((a :: Prim.Type))) -> + ((Builtin.BuiltinList ((a :: Prim.Type)))))) + (unlisted6: (Builtin.BuiltinList (Builtin.BuiltinData))) + unlisted8 :: (Builtin.BuiltinList (Builtin.BuiltinData)) + unlisted8 = + (tailList: forall (a :: Prim.Type). ((Builtin.BuiltinList + ((a :: Prim.Type))) -> + ((Builtin.BuiltinList ((a :: Prim.Type)))))) + (unlisted7: (Builtin.BuiltinList (Builtin.BuiltinData))) + unlisted9 :: (Builtin.BuiltinList (Builtin.BuiltinData)) + unlisted9 = + (tailList: forall (a :: Prim.Type). ((Builtin.BuiltinList + ((a :: Prim.Type))) -> + ((Builtin.BuiltinList ((a :: Prim.Type)))))) + (unlisted8: (Builtin.BuiltinList (Builtin.BuiltinData))) + unlisted10 :: (Builtin.BuiltinList (Builtin.BuiltinData)) + unlisted10 = + (tailList: forall (a :: Prim.Type). ((Builtin.BuiltinList + ((a :: Prim.Type))) -> + ((Builtin.BuiltinList ((a :: Prim.Type)))))) + (unlisted9: (Builtin.BuiltinList (Builtin.BuiltinData))) + unlisted11 :: (Builtin.BuiltinList (Builtin.BuiltinData)) + unlisted11 = + (tailList: forall (a :: Prim.Type). ((Builtin.BuiltinList + ((a :: Prim.Type))) -> + ((Builtin.BuiltinList ((a :: Prim.Type)))))) + (unlisted10: (Builtin.BuiltinList (Builtin.BuiltinData))) + validTimeRange :: (Prim.Interval (Prim.POSIXTime)) + validTimeRange = + (deserializeInterval: forall (a :: Prim.Type). ((Builtin.BuiltinData -> + ((a :: Prim.Type))) -> + ((Builtin.BuiltinData -> ((Prim.Interval ((a :: Prim.Type)))))))) + (deserializePOSIXTime: (Builtin.BuiltinData -> (Prim.POSIXTime))) + ((headList: forall (a :: Prim.Type). ((Builtin.BuiltinList + ((a :: Prim.Type))) -> + ((a :: Prim.Type)))) + (unlisted7: (Builtin.BuiltinList (Builtin.BuiltinData)))) + wdrl :: ((Prim.AssocMap (Prim.StakingCredential)) (Prim.Int)) + wdrl = + (deserializeAssocMap: forall (k :: Prim.Type) + (v :: Prim.Type). ((Builtin.BuiltinData -> ((k :: Prim.Type))) -> + (((Builtin.BuiltinData -> ((v :: Prim.Type))) -> + ((Builtin.BuiltinData -> + (((Prim.AssocMap ((k :: Prim.Type))) ((v :: Prim.Type)))))))))) + (deserializeStakingCredential: (Builtin.BuiltinData -> + (Prim.StakingCredential))) + (deserializeInt: (Builtin.BuiltinData -> (Prim.Int))) + ((headList: forall (a :: Prim.Type). ((Builtin.BuiltinList + ((a :: Prim.Type))) -> + ((a :: Prim.Type)))) + (unlisted6: (Builtin.BuiltinList (Builtin.BuiltinData)))) + signatories :: List (Prim.PubKeyHash) + signatories = + (deserializeList: forall (a :: Prim.Type). ((Builtin.BuiltinData -> + ((a :: Prim.Type))) -> + ((Builtin.BuiltinData -> (List ((a :: Prim.Type))))))) + (deserializePubKeyHash: (Builtin.BuiltinData -> (Prim.PubKeyHash))) + ((headList: forall (a :: Prim.Type). ((Builtin.BuiltinList + ((a :: Prim.Type))) -> + ((a :: Prim.Type)))) + (unlisted8: (Builtin.BuiltinList (Builtin.BuiltinData)))) + referenceInputs :: List (Prim.TxInInfo) + referenceInputs = + (deserializeList: forall (a :: Prim.Type). ((Builtin.BuiltinData -> + ((a :: Prim.Type))) -> + ((Builtin.BuiltinData -> (List ((a :: Prim.Type))))))) + (deserializeTxInInfo: (Builtin.BuiltinData -> (Prim.TxInInfo))) + ((headList: forall (a :: Prim.Type). ((Builtin.BuiltinList + ((a :: Prim.Type))) -> + ((a :: Prim.Type)))) + (unlisted1: (Builtin.BuiltinList (Builtin.BuiltinData)))) + redeemers :: ((Prim.AssocMap (Prim.ScriptPurpose)) (Prim.Redeemer)) + redeemers = + (deserializeAssocMap: forall (k :: Prim.Type) + (v :: Prim.Type). ((Builtin.BuiltinData -> ((k :: Prim.Type))) -> + (((Builtin.BuiltinData -> ((v :: Prim.Type))) -> + ((Builtin.BuiltinData -> + (((Prim.AssocMap ((k :: Prim.Type))) ((v :: Prim.Type)))))))))) + (deserializeScriptPurpose: (Builtin.BuiltinData -> + (Prim.ScriptPurpose))) + (deserializeRedeemer: (Builtin.BuiltinData -> (Prim.Redeemer))) + ((headList: forall (a :: Prim.Type). ((Builtin.BuiltinList + ((a :: Prim.Type))) -> + ((a :: Prim.Type)))) + (unlisted9: (Builtin.BuiltinList (Builtin.BuiltinData)))) + outputs :: List (Prim.TxOut) + outputs = + (deserializeList: forall (a :: Prim.Type). ((Builtin.BuiltinData -> + ((a :: Prim.Type))) -> + ((Builtin.BuiltinData -> (List ((a :: Prim.Type))))))) + (deserializeTxOut: (Builtin.BuiltinData -> (Prim.TxOut))) + ((headList: forall (a :: Prim.Type). ((Builtin.BuiltinList + ((a :: Prim.Type))) -> + ((a :: Prim.Type)))) + (unlisted2: (Builtin.BuiltinList (Builtin.BuiltinData)))) + mint :: Prim.Value + mint = + (deserializeValue: (Builtin.BuiltinData -> (Prim.Value))) + ((headList: forall (a :: Prim.Type). ((Builtin.BuiltinList + ((a :: Prim.Type))) -> + ((a :: Prim.Type)))) + (unlisted4: (Builtin.BuiltinList (Builtin.BuiltinData)))) + inputs :: List (Prim.TxInInfo) + inputs = + (deserializeList: forall (a :: Prim.Type). ((Builtin.BuiltinData -> + ((a :: Prim.Type))) -> + ((Builtin.BuiltinData -> (List ((a :: Prim.Type))))))) + (deserializeTxInInfo: (Builtin.BuiltinData -> (Prim.TxInInfo))) + ((headList: forall (a :: Prim.Type). ((Builtin.BuiltinList + ((a :: Prim.Type))) -> + ((a :: Prim.Type)))) + (unlisted: (Builtin.BuiltinList (Builtin.BuiltinData)))) + id1 :: Prim.TxId + id1 = + (deserializeTxId: (Builtin.BuiltinData -> (Prim.TxId))) + ((headList: forall (a :: Prim.Type). ((Builtin.BuiltinList + ((a :: Prim.Type))) -> + ((a :: Prim.Type)))) + (unlisted11: (Builtin.BuiltinList (Builtin.BuiltinData)))) + fee :: Prim.Value + fee = + (deserializeValue: (Builtin.BuiltinData -> (Prim.Value))) + ((headList: forall (a :: Prim.Type). ((Builtin.BuiltinList + ((a :: Prim.Type))) -> + ((a :: Prim.Type)))) + (unlisted3: (Builtin.BuiltinList (Builtin.BuiltinData)))) + data1 :: ((Prim.AssocMap (Prim.DatumHash)) (Prim.Datum)) + data1 = + (deserializeAssocMap: forall (k :: Prim.Type) + (v :: Prim.Type). ((Builtin.BuiltinData -> ((k :: Prim.Type))) -> + (((Builtin.BuiltinData -> ((v :: Prim.Type))) -> + ((Builtin.BuiltinData -> + (((Prim.AssocMap ((k :: Prim.Type))) ((v :: Prim.Type)))))))))) + (deserializeDatumHash: (Builtin.BuiltinData -> (Prim.DatumHash))) + (deserializeDatum: (Builtin.BuiltinData -> (Prim.Datum))) + ((headList: forall (a :: Prim.Type). ((Builtin.BuiltinList + ((a :: Prim.Type))) -> + ((a :: Prim.Type)))) + (unlisted10: (Builtin.BuiltinList (Builtin.BuiltinData)))) + dCert :: List (Prim.DCert) + dCert = + (deserializeList: forall (a :: Prim.Type). ((Builtin.BuiltinData -> + ((a :: Prim.Type))) -> + ((Builtin.BuiltinData -> (List ((a :: Prim.Type))))))) + (deserializeDCert: (Builtin.BuiltinData -> (Prim.DCert))) + ((headList: forall (a :: Prim.Type). ((Builtin.BuiltinList + ((a :: Prim.Type))) -> + ((a :: Prim.Type)))) + (unlisted5: (Builtin.BuiltinList (Builtin.BuiltinData)))) + in (TxInfo: ({ + inputs :: List (Prim.TxInInfo), + referenceInputs :: List (Prim.TxInInfo), + outputs :: List (Prim.TxOut), + fee :: Prim.Value, + mint :: Prim.Value, + dCert :: List (Prim.DCert), + wdrl :: ((Prim.AssocMap + (Prim.StakingCredential)) (Prim.Int)), + validRange :: (Prim.Interval (Prim.POSIXTime)), + signatories :: List (Prim.PubKeyHash), + redeemers :: ((Prim.AssocMap + (Prim.ScriptPurpose)) (Prim.Redeemer)), + data :: ((Prim.AssocMap (Prim.DatumHash)) (Prim.Datum)), + id :: Prim.TxId + } -> + (Prim.TxInfo))) + ({ + id: (id1: Prim.TxId), + data: (data1: ((Prim.AssocMap (Prim.DatumHash)) (Prim.Datum))), + redeemers: (redeemers: ((Prim.AssocMap + (Prim.ScriptPurpose)) (Prim.Redeemer))), + signatories: (signatories: List (Prim.PubKeyHash)), + validRange: (validTimeRange: (Prim.Interval (Prim.POSIXTime))), + wdrl: (wdrl: ((Prim.AssocMap (Prim.StakingCredential)) (Prim.Int))), + dCert: (dCert: List (Prim.DCert)), + mint: (mint: Prim.Value), + fee: (fee: Prim.Value), + outputs: (outputs: List (Prim.TxOut)), + referenceInputs: (referenceInputs: List (Prim.TxInInfo)), + inputs: (inputs: List (Prim.TxInInfo)) + }: { + inputs :: List (Prim.TxInInfo), + referenceInputs :: List (Prim.TxInInfo), + outputs :: List (Prim.TxOut), + fee :: Prim.Value, + mint :: Prim.Value, + dCert :: List (Prim.DCert), + wdrl :: ((Prim.AssocMap (Prim.StakingCredential)) (Prim.Int)), + validRange :: (Prim.Interval (Prim.POSIXTime)), + signatories :: List (Prim.PubKeyHash), + redeemers :: ((Prim.AssocMap + (Prim.ScriptPurpose)) (Prim.Redeemer)), + data :: ((Prim.AssocMap (Prim.DatumHash)) (Prim.Datum)), + id :: Prim.TxId + }) + +deserializeScriptContext :: (Builtin.BuiltinData -> (Prim.ScriptContext)) +deserializeScriptContext = + \(dat: Builtin.BuiltinData) -> + let + dat' :: Builtin.BuiltinData + dat' = + (sndPair: forall (a :: Prim.Type) + (b :: Prim.Type). (((Builtin.BuiltinPair + ((a :: Prim.Type))) ((b :: Prim.Type))) -> + ((b :: Prim.Type)))) + ((unConstrData: (Builtin.BuiltinData -> + (((Builtin.BuiltinPair (Prim.Int)) (Builtin.BuiltinData))))) + (dat: Builtin.BuiltinData)) + unlisted :: (Builtin.BuiltinList (Builtin.BuiltinData)) + unlisted = + (unListData: (Builtin.BuiltinData -> + ((Builtin.BuiltinList (Builtin.BuiltinData))))) + (dat': Builtin.BuiltinData) + txInfo :: Prim.TxInfo + txInfo = + (deserializeTxInfo: (Builtin.BuiltinData -> (Prim.TxInfo))) + ((headList: forall (a :: Prim.Type). ((Builtin.BuiltinList + ((a :: Prim.Type))) -> + ((a :: Prim.Type)))) + (unlisted: (Builtin.BuiltinList (Builtin.BuiltinData)))) + unlisted' :: (Builtin.BuiltinList (Builtin.BuiltinData)) + unlisted' = + (tailList: forall (a :: Prim.Type). ((Builtin.BuiltinList + ((a :: Prim.Type))) -> + ((Builtin.BuiltinList ((a :: Prim.Type)))))) + (unlisted: (Builtin.BuiltinList (Builtin.BuiltinData))) + purpose :: Prim.ScriptPurpose + purpose = + (deserializeScriptPurpose: (Builtin.BuiltinData -> + (Prim.ScriptPurpose))) + ((headList: forall (a :: Prim.Type). ((Builtin.BuiltinList + ((a :: Prim.Type))) -> + ((a :: Prim.Type)))) + (unlisted': (Builtin.BuiltinList (Builtin.BuiltinData)))) + in (ScriptContext: ({ + txInfo :: Prim.TxInfo, + purpose :: Prim.ScriptPurpose + } -> + (Prim.ScriptContext))) + ({ + purpose: (purpose: Prim.ScriptPurpose), + txInfo: (txInfo: Prim.TxInfo) + }: { txInfo :: Prim.TxInfo, purpose :: Prim.ScriptPurpose }) + +const :: forall (a :: Prim.Type) (b :: Prim.Type). ((a :: Prim.Type) -> (((b :: Prim.Type) -> ((b :: Prim.Type))))) +const = + \(v: (a :: Prim.Type)) -> \(x: (b :: Prim.Type)) -> (x: (b :: Prim.Type)) + +apply :: forall (a :: Prim.Type) (b :: Prim.Type). (((a :: Prim.Type) -> ((b :: Prim.Type))) -> (((a :: Prim.Type) -> ((b :: Prim.Type))))) +apply = + \(f: ((a :: Prim.Type) -> ((b :: Prim.Type)))) -> + \(x: (a :: Prim.Type)) -> + (f: ((a :: Prim.Type) -> ((b :: Prim.Type)))) (x: (a :: Prim.Type)) + +appendList :: forall (a :: Prim.Type). (List ((a :: Prim.Type)) -> ((List ((a :: Prim.Type)) -> (List ((a :: Prim.Type)))))) +appendList = + \(ell1: List ((a :: Prim.Type))) -> + \(ell2: List ((a :: Prim.Type))) -> + case (ell1: List ((a :: Prim.Type))) of + Nil -> (ell2: List ((a :: Prim.Type))) + Cons x xs -> + (Cons: forall (x :: Prim.Type). ((x :: Prim.Type) -> + ((List ((x :: Prim.Type)) -> (List ((x :: Prim.Type))))))) + (x: (a :: Prim.Type)) + ((appendList: forall (a :: Prim.Type). (List ((a :: Prim.Type)) -> + ((List ((a :: Prim.Type)) -> (List ((a :: Prim.Type))))))) + (xs: List ((a :: Prim.Type))) + (ell2: List ((a :: Prim.Type)))) + +anyList :: forall (a :: Prim.Type). (((a :: Prim.Type) -> (Prim.Boolean)) -> ((List ((a :: Prim.Type)) -> (Prim.Boolean)))) +anyList = + \(p: ((a :: Prim.Type) -> (Prim.Boolean))) -> + \(ell: List ((a :: Prim.Type))) -> + case (ell: List ((a :: Prim.Type))) of + Nil -> (False: Prim.Boolean) + Cons x xs -> + case ((p: ((a :: Prim.Type) -> (Prim.Boolean))) (x: (a :: Prim.Type))) of + True -> (True: Prim.Boolean) + _ -> + (anyList: forall (a :: Prim.Type). (((a :: Prim.Type) -> + (Prim.Boolean)) -> + ((List ((a :: Prim.Type)) -> (Prim.Boolean))))) + (p: ((a :: Prim.Type) -> (Prim.Boolean))) + (xs: List ((a :: Prim.Type))) + +and :: (Prim.Boolean -> ((Prim.Boolean -> (Prim.Boolean)))) +and = + \(x: Prim.Boolean) -> + \(y: Prim.Boolean) -> + (ifThenElse: forall (x :: Prim.Type). (Prim.Boolean -> + (((x :: Prim.Type) -> (((x :: Prim.Type) -> ((x :: Prim.Type)))))))) + (x: Prim.Boolean) + (y: Prim.Boolean) + (False: Prim.Boolean) + +allList :: forall (a :: Prim.Type). (((a :: Prim.Type) -> (Prim.Boolean)) -> ((List ((a :: Prim.Type)) -> (Prim.Boolean)))) +allList = + \(p: ((a :: Prim.Type) -> (Prim.Boolean))) -> + \(ell: List ((a :: Prim.Type))) -> + case (ell: List ((a :: Prim.Type))) of + Nil -> (True: Prim.Boolean) + Cons x xs -> + case ((p: ((a :: Prim.Type) -> (Prim.Boolean))) (x: (a :: Prim.Type))) of + True -> + (allList: forall (a :: Prim.Type). (((a :: Prim.Type) -> + (Prim.Boolean)) -> + ((List ((a :: Prim.Type)) -> (Prim.Boolean))))) + (p: ((a :: Prim.Type) -> (Prim.Boolean))) + (xs: List ((a :: Prim.Type))) + _ -> (False: Prim.Boolean) \ No newline at end of file diff --git a/tests/purus/passing/prelude/output/Prelude/externs.cbor b/tests/purus/passing/prelude/output/Prelude/externs.cbor new file mode 100644 index 000000000..9530db384 Binary files /dev/null and b/tests/purus/passing/prelude/output/Prelude/externs.cbor differ diff --git a/tests/purus/passing/prelude/output/package.json b/tests/purus/passing/prelude/output/package.json new file mode 100644 index 000000000..7c34deb58 --- /dev/null +++ b/tests/purus/passing/prelude/output/package.json @@ -0,0 +1 @@ +{"type":"module"} \ No newline at end of file diff --git a/tests/support/pscide/src/ImportsSpec1.purs b/tests/support/pscide/src/ImportsSpec1.purs index 098a55d2a..016dc46c1 100644 --- a/tests/support/pscide/src/ImportsSpec1.purs +++ b/tests/support/pscide/src/ImportsSpec1.purs @@ -17,7 +17,7 @@ exportedFunction x = x type MyType = String -type MyParamType a = Array a +type MyParamType a = List a newtype MyNewtype = MyNewtype String